From 9764dc91a725cafd0569321ae395f2923eec3d0d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 20 Feb 2025 00:45:42 +0000 Subject: [PATCH] CodeGen from PR 3627 in test-repo-billy/azure-rest-api-specs Merge f39cb0c3650a0e382cb88c49d53cfa21040de956 into 5fbc3c052e42e83c7286dbc29d88aa2238059ac4 --- .../agrifood-farming-rest/CHANGELOG.md | 36 ++----------------- .../agrifood-farming-rest/api-extractor.json | 2 +- .../agrifood-farming-rest/package.json | 24 ++++++------- .../samples-dev/createParty.ts | 7 ++-- .../samples-dev/deleteParty.ts | 7 ++-- .../samples-dev/listParties.ts | 7 ++-- .../v1-beta/typescript/src/createParty.ts | 9 ++--- .../v1-beta/typescript/src/deleteParty.ts | 7 ++-- .../v1-beta/typescript/src/listParties.ts | 9 ++--- .../samples/v1/typescript/src/createParty.ts | 7 ++-- .../samples/v1/typescript/src/deleteParty.ts | 7 ++-- .../samples/v1/typescript/src/listParties.ts | 7 ++-- .../test/public/sampleTest.spec.ts | 22 ++++++++++++ .../test/public/smoke.spec.ts | 4 +-- .../test/public/utils/recordedClient.ts | 27 ++++---------- .../agrifood-farming-rest/tsconfig.json | 14 +++++--- .../tsconfig.samples.json | 2 +- .../agrifood-farming-rest/tsconfig.test.json | 7 +--- .../vitest.browser.config.ts | 6 ++-- .../agrifood-farming-rest/vitest.config.ts | 1 + .../vitest.esm.config.ts | 1 + sdk/agrifood/ci.yml | 2 ++ 22 files changed, 85 insertions(+), 130 deletions(-) create mode 100644 sdk/agrifood/agrifood-farming-rest/test/public/sampleTest.spec.ts diff --git a/sdk/agrifood/agrifood-farming-rest/CHANGELOG.md b/sdk/agrifood/agrifood-farming-rest/CHANGELOG.md index 58d42accfe08..d9df5e6b21ec 100644 --- a/sdk/agrifood/agrifood-farming-rest/CHANGELOG.md +++ b/sdk/agrifood/agrifood-farming-rest/CHANGELOG.md @@ -1,37 +1,7 @@ # Release History - -## 1.0.0-beta.3 (2024-12-16) - -### Features Added -- Refresh @azure-rest/agrifood-farming SDK - -## 1.0.0-beta.2 (2023-02-24) + +## 1.0.0 (2025-02-20) ### Features Added -- Adding clients for Sensor Integration which includes crud operations on DeviceDataModels, Devices, SensorDataModels, Sensors, SensorMappings, SensorPartnerIntegration and get Sensor events. -- Adding new APIs for STAC search and get feature -- Adding breedingMethods and Measurements as part of Crop Entity -- Adding geographicIdentifier as part of Season Entity -- Adding trait, relativeMeasurements and treatments as part of CropVariety Entity -- Adding type, crs, centroid and bbox(bounding box of the geometry) as part of Boundary Entity -- Adding Source field in Party, Farm, Field, Seasonal Field, Boundary, Crop, Crop variety, Season and Attachment -- CreatedBy and ModifiedBy in all entities -- Measure renamed to measurements in Prescription & Crop -- Acreage renamed to area in Boundary -- Get Feature and Search Feature APIs for Sentinel 2 L2A and Sentinel 2 L1C STAC collections -- Adding Weather Data APIs to fetch IBM weather data -- Re-generate with latest generator version. This contains splitting models into input and output models and typing improvements [#20059](https://github.com/Azure/azure-sdk-for-js/pull/20059) -- Export pagination helper function. [#15831](https://github.com/Azure/azure-sdk-for-js/pull/15831) - -### Breaking Changes - -- Removing primaryBoundaryId & boundaryIds from Field and Seasonal Field -- Removing isPrimary flag from Boundary -- Removing avgYields from Seasonal Field -- Renaming Farmer to Party -- Renaming CropVariety to CropProduct - -## 1.0.0-beta.1 (2021-05-26) - -- First release of package, see README.md for details. +The package of @azure-rest/agrifood-farming is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/agrifood/agrifood-farming-rest/api-extractor.json b/sdk/agrifood/agrifood-farming-rest/api-extractor.json index a214e7bd14bd..e762880dc464 100644 --- a/sdk/agrifood/agrifood-farming-rest/api-extractor.json +++ b/sdk/agrifood/agrifood-farming-rest/api-extractor.json @@ -28,4 +28,4 @@ } } } -} +} \ No newline at end of file diff --git a/sdk/agrifood/agrifood-farming-rest/package.json b/sdk/agrifood/agrifood-farming-rest/package.json index 66173bad1fe4..a6c9f478d60d 100644 --- a/sdk/agrifood/agrifood-farming-rest/package.json +++ b/sdk/agrifood/agrifood-farming-rest/package.json @@ -3,7 +3,7 @@ "sdk-type": "client", "author": "Microsoft Corporation", "description": "An isomorphic REST client library for the Azure FarmBeats Service.", - "version": "1.0.0-beta.3", + "version": "1.0.0", "keywords": [ "node", "azure", @@ -79,28 +79,27 @@ "autoPublish": false, "dependencies": { "@azure-rest/core-client": "^1.0.0", - "@azure/core-auth": "^1.3.0", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", "@azure/core-lro": "^3.1.0", - "@azure/logger": "^1.0.0", - "tslib": "^2.2.0", - "@azure/abort-controller": "^2.1.2" + "@azure/logger": "^1.1.4", + "tslib": "^2.8.1" }, "devDependencies": { - "@azure-tools/test-utils": "^1.0.1", - "@azure/core-rest-pipeline": "^1.9.2", "@azure-tools/test-credential": "^2.0.0", "@azure-tools/test-recorder": "^4.1.0", "@azure-tools/test-utils-vitest": "^1.0.0", - "@azure/core-util": "^1.0.0", + "@azure/core-rest-pipeline": "^1.9.2", + "@azure/core-util": "^1.11.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.0.1", + "@azure/identity": "^4.7.0", "@types/node": "^18.0.0", "@vitest/browser": "^3.0.3", "@vitest/coverage-istanbul": "^3.0.3", "dotenv": "^16.0.0", "eslint": "^9.9.0", - "playwright": "^1.49.0", + "playwright": "^1.50.1", "typescript": "~5.7.2", "vitest": "^3.0.3" }, @@ -141,5 +140,6 @@ "default": "./dist/commonjs/index.js" } } - } -} + }, + "react-native": "./dist/react-native/index.js" +} \ No newline at end of file diff --git a/sdk/agrifood/agrifood-farming-rest/samples-dev/createParty.ts b/sdk/agrifood/agrifood-farming-rest/samples-dev/createParty.ts index 9b24c32b054e..0175e480081e 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples-dev/createParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples-dev/createParty.ts @@ -10,13 +10,10 @@ import FarmBeats, { isUnexpected } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farmbeatsClient.path("/parties/{partyId}", partyId).patch({ diff --git a/sdk/agrifood/agrifood-farming-rest/samples-dev/deleteParty.ts b/sdk/agrifood/agrifood-farming-rest/samples-dev/deleteParty.ts index fc0a16668c42..260816b36820 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples-dev/deleteParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples-dev/deleteParty.ts @@ -10,13 +10,10 @@ import FarmBeats, { isUnexpected } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farmbeatsClient.path("/parties/{partyId}", partyId).delete(); diff --git a/sdk/agrifood/agrifood-farming-rest/samples-dev/listParties.ts b/sdk/agrifood/agrifood-farming-rest/samples-dev/listParties.ts index 92c87a1c9de9..8b382e495e8b 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples-dev/listParties.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples-dev/listParties.ts @@ -10,13 +10,10 @@ import FarmBeats, { isUnexpected, paginate } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const response = await farmbeatsClient.path("/parties").get(); diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/createParty.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/createParty.ts index 7992aa15f983..0603eda8b642 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/createParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/createParty.ts @@ -7,15 +7,12 @@ * @summary creates a party */ -import FarmBeats, { PartyOutput, isUnexpected } from "@azure-rest/agrifood-farming"; +import FarmBeats, { isUnexpected } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farmbeatsClient.path("/parties/{partyId}", partyId).patch({ diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/deleteParty.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/deleteParty.ts index a61ee70295d9..8c910ee32f41 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/deleteParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/deleteParty.ts @@ -9,13 +9,10 @@ import FarmBeats, { isUnexpected } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farming = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farming.path("/parties/{partyId}", partyId).delete(); diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/listParties.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/listParties.ts index 0542a3e30667..ea89c9e47793 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/listParties.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1-beta/typescript/src/listParties.ts @@ -7,15 +7,12 @@ * @summary gets a list of parties */ -import FarmBeats, { isUnexpected, PartyOutput, paginate } from "@azure-rest/agrifood-farming"; +import FarmBeats, { isUnexpected, paginate } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farming = FarmBeats(endpoint, new DefaultAzureCredential()); const response = await farming.path("/parties").get(); diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/createParty.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/createParty.ts index 8fe9f512687b..c61ee16d4293 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/createParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/createParty.ts @@ -9,13 +9,10 @@ import FarmBeats from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farmbeatsClient.path("/parties/{partyId}", partyId).patch({ diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/deleteParty.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/deleteParty.ts index 19c220db0bb0..c96a6869ea73 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/deleteParty.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/deleteParty.ts @@ -9,13 +9,10 @@ import FarmBeats from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const partyId = "test_party"; const result = await farmbeatsClient.path("/parties/{partyId}", partyId).delete(); diff --git a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/listParties.ts b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/listParties.ts index c2c248852c7b..d098ae6279c6 100644 --- a/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/listParties.ts +++ b/sdk/agrifood/agrifood-farming-rest/samples/v1/typescript/src/listParties.ts @@ -9,13 +9,10 @@ import FarmBeats, { Party } from "@azure-rest/agrifood-farming"; import { DefaultAzureCredential } from "@azure/identity"; -import dotenv from "dotenv"; - -dotenv.config(); - +import "dotenv/config"; const endpoint = process.env["FARMBEATS_ENDPOINT"] || ""; -async function main() { +async function main(): Promise { const farmbeatsClient = FarmBeats(endpoint, new DefaultAzureCredential()); const result = await farmbeatsClient.path("/parties").get(); diff --git a/sdk/agrifood/agrifood-farming-rest/test/public/sampleTest.spec.ts b/sdk/agrifood/agrifood-farming-rest/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..45cc68d7aaac --- /dev/null +++ b/sdk/agrifood/agrifood-farming-rest/test/public/sampleTest.spec.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder } from "@azure-tools/test-recorder"; +import { createRecorder } from "./utils/recordedClient.js"; +import { describe, it, assert, beforeEach, afterEach } from "vitest"; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async () => { + recorder = await createRecorder(this); + }); + + afterEach(async () => { + await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/agrifood/agrifood-farming-rest/test/public/smoke.spec.ts b/sdk/agrifood/agrifood-farming-rest/test/public/smoke.spec.ts index fa64bab5dd4f..1d809871b244 100644 --- a/sdk/agrifood/agrifood-farming-rest/test/public/smoke.spec.ts +++ b/sdk/agrifood/agrifood-farming-rest/test/public/smoke.spec.ts @@ -13,12 +13,12 @@ describe("List parties", () => { let recorder: Recorder; let client: FarmBeatsClient; - beforeEach(async function (ctx) { + beforeEach(async (ctx) => { recorder = await createRecorder(ctx); client = createClient(recorder.configureClientOptions({})); }); - afterEach(async function () { + afterEach(async () => { await recorder.stop(); }); diff --git a/sdk/agrifood/agrifood-farming-rest/test/public/utils/recordedClient.ts b/sdk/agrifood/agrifood-farming-rest/test/public/utils/recordedClient.ts index 4fea9177124b..ff4ec4e9fc2c 100644 --- a/sdk/agrifood/agrifood-farming-rest/test/public/utils/recordedClient.ts +++ b/sdk/agrifood/agrifood-farming-rest/test/public/utils/recordedClient.ts @@ -1,23 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { RecorderStartOptions, TestInfo } from "@azure-tools/test-recorder"; -import { Recorder, env } from "@azure-tools/test-recorder"; -import type { FarmBeatsClient } from "../../../src/index.js"; -import FarmBeats from "../../../src/index.js"; -import { createTestCredential } from "@azure-tools/test-credential"; -import type { ClientOptions } from "@azure-rest/core-client"; +import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder"; -const envSetupForPlayback: Record = { - FARMBEATS_ENDPOINT: "https://fakeaccount.farmbeats.azure.net", - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", +const replaceableVariables: Record = { SUBSCRIPTION_ID: "azure_subscription_id", }; const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback, - removeCentralSanitizers: ["AZSDK3430", "AZSDK3493", "AZSDK2030"], + envSetupForPlayback: replaceableVariables, }; /** @@ -25,14 +15,9 @@ const recorderEnvSetup: RecorderStartOptions = { * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export async function createRecorder(context: TestInfo): Promise { - const recorder = new Recorder(context); + +export async function createRecorder(context: Context): Promise { + const recorder = new Recorder(context.currentTest); await recorder.start(recorderEnvSetup); return recorder; } - -export function createClient(options?: ClientOptions): FarmBeatsClient { - const credential = createTestCredential(); - - return FarmBeats(env.FARMBEATS_ENDPOINT as string, credential, { ...options }); -} diff --git a/sdk/agrifood/agrifood-farming-rest/tsconfig.json b/sdk/agrifood/agrifood-farming-rest/tsconfig.json index 273d9078a24a..f55ad563a063 100644 --- a/sdk/agrifood/agrifood-farming-rest/tsconfig.json +++ b/sdk/agrifood/agrifood-farming-rest/tsconfig.json @@ -1,7 +1,13 @@ { "references": [ - { "path": "./tsconfig.src.json" }, - { "path": "./tsconfig.samples.json" }, - { "path": "./tsconfig.test.json" } + { + "path": "./tsconfig.src.json" + }, + { + "path": "./tsconfig.samples.json" + }, + { + "path": "./tsconfig.test.json" + } ] -} +} \ No newline at end of file diff --git a/sdk/agrifood/agrifood-farming-rest/tsconfig.samples.json b/sdk/agrifood/agrifood-farming-rest/tsconfig.samples.json index 8a94aec45800..383c7fe2bab7 100644 --- a/sdk/agrifood/agrifood-farming-rest/tsconfig.samples.json +++ b/sdk/agrifood/agrifood-farming-rest/tsconfig.samples.json @@ -2,7 +2,7 @@ "extends": "../../../tsconfig.samples.base.json", "compilerOptions": { "paths": { - "@azure/openai": ["./dist/esm"] + "@azure-rest/agrifood-farming": ["./dist/esm"] } } } diff --git a/sdk/agrifood/agrifood-farming-rest/tsconfig.test.json b/sdk/agrifood/agrifood-farming-rest/tsconfig.test.json index ef177b505ac8..290ca214aebc 100644 --- a/sdk/agrifood/agrifood-farming-rest/tsconfig.test.json +++ b/sdk/agrifood/agrifood-farming-rest/tsconfig.test.json @@ -1,8 +1,3 @@ { - "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"], - "compilerOptions": { - "paths": { - "@azure-rest/agrifood-farming": ["./src/index.ts"] - } - } + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] } diff --git a/sdk/agrifood/agrifood-farming-rest/vitest.browser.config.ts b/sdk/agrifood/agrifood-farming-rest/vitest.browser.config.ts index b48c61b2ef46..182729ab5ce9 100644 --- a/sdk/agrifood/agrifood-farming-rest/vitest.browser.config.ts +++ b/sdk/agrifood/agrifood-farming-rest/vitest.browser.config.ts @@ -9,9 +9,9 @@ export default mergeConfig( viteConfig, defineConfig({ test: { - include: [ - "dist-test/browser/test/**/*.spec.js", - ], + include: ["dist-test/browser/test/**/*.spec.js",], + testTimeout: 1200000, + hookTimeout: 1200000, }, }), ); diff --git a/sdk/agrifood/agrifood-farming-rest/vitest.config.ts b/sdk/agrifood/agrifood-farming-rest/vitest.config.ts index 86a71911ccc2..40e031385dd8 100644 --- a/sdk/agrifood/agrifood-farming-rest/vitest.config.ts +++ b/sdk/agrifood/agrifood-farming-rest/vitest.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/agrifood/agrifood-farming-rest/vitest.esm.config.ts b/sdk/agrifood/agrifood-farming-rest/vitest.esm.config.ts index 2f6e757a54f7..a70127279fc9 100644 --- a/sdk/agrifood/agrifood-farming-rest/vitest.esm.config.ts +++ b/sdk/agrifood/agrifood-farming-rest/vitest.esm.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/agrifood/ci.yml b/sdk/agrifood/ci.yml index 1eb64aa303a9..e205c50a6e90 100644 --- a/sdk/agrifood/ci.yml +++ b/sdk/agrifood/ci.yml @@ -19,6 +19,8 @@ pr: - feature/* - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/agrifood/