@azure-rest/agrifood-farming 1.0.0-alpha.20240115.1 → 1.0.0-alpha.20240129.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.
@@ -8,24 +8,19 @@ import { getClient } from "@azure-rest/core-client";
8
8
  * @param options type: ClientOptions, the parameter for all optional parameters
9
9
  */
10
10
  export default function createClient($host, credentials, options = {}) {
11
- const baseUrl = options.baseUrl ?? `${$host}`;
12
- options.apiVersion = options.apiVersion ?? "2022-11-01-preview";
13
- options = {
14
- ...options,
15
- credentials: {
11
+ var _a, _b;
12
+ const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${$host}`;
13
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-11-01-preview";
14
+ options = Object.assign(Object.assign({}, options), { credentials: {
16
15
  scopes: ["https://farmbeats.azure.net/.default"],
17
- },
18
- };
16
+ } });
19
17
  const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.2`;
20
18
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
21
19
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
22
20
  : `${userAgentInfo}`;
23
- options = {
24
- ...options,
25
- userAgentOptions: {
21
+ options = Object.assign(Object.assign({}, options), { userAgentOptions: {
26
22
  userAgentPrefix,
27
- },
28
- };
23
+ } });
29
24
  const client = getClient(baseUrl, credentials, options);
30
25
  return client;
31
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"farmBeats.js","sourceRoot":"","sources":["../../src/farmBeats.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AAInE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,KAAa,EACb,WAA4B,EAC5B,UAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,KAAK,EAAE,CAAC;IAC9C,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAChE,OAAO,GAAG;QACR,GAAG,OAAO;QACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,sCAAsC,CAAC;SACjD;KACF,CAAC;IAEF,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;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAoB,CAAC;IAE3E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { FarmBeatsClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `FarmBeatsClient`\n * @param $host type: string, server parameter\n * @param credentials type: TokenCredential, uniquely identify client credential\n * @param options type: ClientOptions, the parameter for all optional parameters\n */\nexport default function createClient(\n $host: string,\n credentials: TokenCredential,\n options: ClientOptions = {},\n): FarmBeatsClient {\n const baseUrl = options.baseUrl ?? `${$host}`;\n options.apiVersion = options.apiVersion ?? \"2022-11-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://farmbeats.azure.net/.default\"],\n },\n };\n\n const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.2`;\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 };\n\n const client = getClient(baseUrl, credentials, options) as FarmBeatsClient;\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"farmBeats.js","sourceRoot":"","sources":["../../src/farmBeats.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AAInE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,KAAa,EACb,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,KAAK,EAAE,CAAC;IAC9C,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,sCAAsC,CAAC;SACjD,GACF,CAAC;IAEF,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,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAoB,CAAC;IAE3E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { FarmBeatsClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `FarmBeatsClient`\n * @param $host type: string, server parameter\n * @param credentials type: TokenCredential, uniquely identify client credential\n * @param options type: ClientOptions, the parameter for all optional parameters\n */\nexport default function createClient(\n $host: string,\n credentials: TokenCredential,\n options: ClientOptions = {},\n): FarmBeatsClient {\n const baseUrl = options.baseUrl ?? `${$host}`;\n options.apiVersion = options.apiVersion ?? \"2022-11-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://farmbeats.azure.net/.default\"],\n },\n };\n\n const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.2`;\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 };\n\n const client = getClient(baseUrl, credentials, options) as FarmBeatsClient;\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 ?? response.request.url);
207
+ const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
208
208
  const method = response.request.method;
209
209
  let pathDetails = responseMap[`${method} ${url.pathname}`];
210
210
  if (!pathDetails) {
@@ -213,6 +213,7 @@ 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;
216
217
  const pathParts = path.split("/");
217
218
  // Traverse list to match the longest candidate
218
219
  // matchedLen: the length of candidate path
@@ -231,13 +232,13 @@ function getParametrizedPathSuccess(method, path) {
231
232
  // track if we have found a match to return the values found.
232
233
  let found = true;
233
234
  for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
234
- if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
235
- const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
235
+ if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
236
+ const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
236
237
  // If the current part of the candidate is a "template" part
237
238
  // Try to use the suffix of pattern to match the path
238
239
  // {guid} ==> $
239
240
  // {guid}:export ==> :export$
240
- const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
241
+ const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
241
242
  if (!isMatched) {
242
243
  found = false;
243
244
  break;