@azure-rest/agrifood-farming 1.0.0-alpha.20250718.1 → 1.0.0-alpha.20250730.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/farmBeats.js +13 -11
- package/dist/browser/farmBeats.js.map +1 -1
- package/dist/browser/isUnexpected.js +4 -5
- package/dist/browser/isUnexpected.js.map +1 -1
- package/dist/browser/paginateHelper.js +43 -73
- package/dist/browser/paginateHelper.js.map +1 -1
- package/dist/browser/pollingHelper.js +11 -8
- package/dist/browser/pollingHelper.js.map +1 -1
- package/dist/commonjs/farmBeats.js +13 -11
- package/dist/commonjs/farmBeats.js.map +1 -1
- package/dist/commonjs/isUnexpected.js +4 -5
- package/dist/commonjs/isUnexpected.js.map +1 -1
- package/dist/commonjs/paginateHelper.js +43 -73
- package/dist/commonjs/paginateHelper.js.map +1 -1
- package/dist/commonjs/pollingHelper.js +11 -8
- package/dist/commonjs/pollingHelper.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/farmBeats.js +13 -11
- package/dist/esm/farmBeats.js.map +1 -1
- package/dist/esm/isUnexpected.js +4 -5
- package/dist/esm/isUnexpected.js.map +1 -1
- package/dist/esm/paginateHelper.js +43 -73
- package/dist/esm/paginateHelper.js.map +1 -1
- package/dist/esm/pollingHelper.js +11 -8
- package/dist/esm/pollingHelper.js.map +1 -1
- package/dist/react-native/farmBeats.js +13 -11
- package/dist/react-native/farmBeats.js.map +1 -1
- package/dist/react-native/isUnexpected.js +4 -5
- package/dist/react-native/isUnexpected.js.map +1 -1
- package/dist/react-native/paginateHelper.js +43 -73
- package/dist/react-native/paginateHelper.js.map +1 -1
- package/dist/react-native/pollingHelper.js +11 -8
- package/dist/react-native/pollingHelper.js.map +1 -1
- package/package.json +2 -2
- package/review/agrifood-farming-node.api.md +11020 -11020
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { getClient } from "@azure-rest/core-client";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
/**
|
|
@@ -9,21 +8,24 @@ import { logger } from "./logger.js";
|
|
|
9
8
|
* @param credentials - uniquely identify client credential
|
|
10
9
|
* @param options - the parameter for all optional parameters
|
|
11
10
|
*/
|
|
12
|
-
export default function createClient($host, credentials,
|
|
13
|
-
|
|
14
|
-
var { apiVersion = "2022-11-01-preview" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
15
|
-
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${$host}`;
|
|
11
|
+
export default function createClient($host, credentials, { apiVersion = "2022-11-01-preview", ...options } = {}) {
|
|
12
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `${$host}`;
|
|
16
13
|
const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.3`;
|
|
17
14
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
18
15
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
19
16
|
: `${userAgentInfo}`;
|
|
20
|
-
options =
|
|
17
|
+
options = {
|
|
18
|
+
...options,
|
|
19
|
+
userAgentOptions: {
|
|
21
20
|
userAgentPrefix,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
},
|
|
22
|
+
loggingOptions: {
|
|
23
|
+
logger: options.loggingOptions?.logger ?? logger.info,
|
|
24
|
+
},
|
|
25
|
+
credentials: {
|
|
26
|
+
scopes: options.credentials?.scopes ?? ["https://farmbeats.azure.net/.default"],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
27
29
|
const client = getClient(endpointUrl, credentials, options);
|
|
28
30
|
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
29
31
|
client.pipeline.addPolicy({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farmBeats.js","sourceRoot":"","sources":["../../src/farmBeats.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"farmBeats.js","sourceRoot":"","sources":["../../src/farmBeats.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,KAAa,EACb,WAA4B,EAC5B,EAAE,UAAU,GAAG,oBAAoB,EAAE,GAAG,OAAO,KAA6B,EAAE;IAE9E,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,GAAG,KAAK,EAAE,CAAC;IACtE,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;QACD,cAAc,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI;SACtD;QACD,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,sCAAsC,CAAC;SAChF;KACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAoB,CAAC;IAE/E,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { FarmBeatsClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface FarmBeatsClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `FarmBeatsClient`\n * @param $host - server parameter\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n $host: string,\n credentials: TokenCredential,\n { apiVersion = \"2022-11-01-preview\", ...options }: FarmBeatsClientOptions = {},\n): FarmBeatsClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${$host}`;\n const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.3`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://farmbeats.azure.net/.default\"],\n },\n };\n const client = getClient(endpointUrl, credentials, options) as FarmBeatsClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
|
|
@@ -204,7 +204,7 @@ const responseMap = {
|
|
|
204
204
|
};
|
|
205
205
|
export function isUnexpected(response) {
|
|
206
206
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
207
|
-
const url = new URL(lroOriginal
|
|
207
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
208
208
|
const method = response.request.method;
|
|
209
209
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
210
210
|
if (!pathDetails) {
|
|
@@ -213,7 +213,6 @@ export function isUnexpected(response) {
|
|
|
213
213
|
return !pathDetails.includes(response.status);
|
|
214
214
|
}
|
|
215
215
|
function getParametrizedPathSuccess(method, path) {
|
|
216
|
-
var _a, _b, _c, _d;
|
|
217
216
|
const pathParts = path.split("/");
|
|
218
217
|
// Traverse list to match the longest candidate
|
|
219
218
|
// matchedLen: the length of candidate path
|
|
@@ -232,13 +231,13 @@ function getParametrizedPathSuccess(method, path) {
|
|
|
232
231
|
// track if we have found a match to return the values found.
|
|
233
232
|
let found = true;
|
|
234
233
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
235
|
-
if (
|
|
236
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
234
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
235
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
237
236
|
// If the current part of the candidate is a "template" part
|
|
238
237
|
// Try to use the suffix of pattern to match the path
|
|
239
238
|
// {guid} ==> $
|
|
240
239
|
// {guid}:export ==> :export$
|
|
241
|
-
const isMatched = new RegExp(`${
|
|
240
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
242
241
|
if (!isMatched) {
|
|
243
242
|
found = false;
|
|
244
243
|
break;
|