@azure-rest/agrifood-farming 1.0.0-alpha.20240111.1 → 1.0.0-alpha.20240115.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,19 +8,24 @@ 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
- 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: {
11
+ const baseUrl = options.baseUrl ?? `${$host}`;
12
+ options.apiVersion = options.apiVersion ?? "2022-11-01-preview";
13
+ options = {
14
+ ...options,
15
+ credentials: {
15
16
  scopes: ["https://farmbeats.azure.net/.default"],
16
- } });
17
+ },
18
+ };
17
19
  const userAgentInfo = `azsdk-js-agrifood-farming-rest/1.0.0-beta.2`;
18
20
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
19
21
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
20
22
  : `${userAgentInfo}`;
21
- options = Object.assign(Object.assign({}, options), { userAgentOptions: {
23
+ options = {
24
+ ...options,
25
+ userAgentOptions: {
22
26
  userAgentPrefix,
23
- } });
27
+ },
28
+ };
24
29
  const client = getClient(baseUrl, credentials, options);
25
30
  return client;
26
31
  }
@@ -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,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"]}
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"]}
@@ -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 !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
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 (((_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;
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(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
240
+ const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
242
241
  if (!isMatched) {
243
242
  found = false;
244
243
  break;