@azure-rest/arm-compute 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.
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/dist-esm/src/computeManagementClient.js +11 -6
- package/dist-esm/src/computeManagementClient.js.map +1 -1
- package/dist-esm/src/isUnexpected.js +2 -3
- package/dist-esm/src/isUnexpected.js.map +1 -1
- package/dist-esm/src/paginateHelper.js +1 -1
- package/dist-esm/src/paginateHelper.js.map +1 -1
- package/dist-esm/src/pollingHelper.js +6 -2
- package/dist-esm/src/pollingHelper.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,18 +6,23 @@ import { getClient } from "@azure-rest/core-client";
|
|
|
6
6
|
* @param credentials type: TokenCredential
|
|
7
7
|
*/
|
|
8
8
|
export default function createClient(credentials, options = {}) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const baseUrl = options.baseUrl ?? `https://management.azure.com`;
|
|
10
|
+
options = {
|
|
11
|
+
...options,
|
|
12
|
+
credentials: {
|
|
12
13
|
scopes: ["https://management.azure.com/.default"],
|
|
13
|
-
}
|
|
14
|
+
},
|
|
15
|
+
};
|
|
14
16
|
const userAgentInfo = `azsdk-js-arm-compute-rest/1.0.0-beta.1`;
|
|
15
17
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
16
18
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
17
19
|
: `${userAgentInfo}`;
|
|
18
|
-
options =
|
|
20
|
+
options = {
|
|
21
|
+
...options,
|
|
22
|
+
userAgentOptions: {
|
|
19
23
|
userAgentPrefix,
|
|
20
|
-
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
21
26
|
const client = getClient(baseUrl, credentials, options);
|
|
22
27
|
return client;
|
|
23
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeManagementClient.js","sourceRoot":"","sources":["../../src/computeManagementClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAiB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAInE;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA4B,EAC5B,UAAyB,EAAE
|
|
1
|
+
{"version":3,"file":"computeManagementClient.js","sourceRoot":"","sources":["../../src/computeManagementClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAiB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAInE;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA4B,EAC5B,UAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,8BAA8B,CAAC;IAClE,OAAO,GAAG;QACR,GAAG,OAAO;QACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,uCAAuC,CAAC;SAClD;KACF,CAAC;IAEF,MAAM,aAAa,GAAG,wCAAwC,CAAC;IAC/D,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,CAA4B,CAAC;IAEnF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { ComputeManagementClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of the class ComputeManagementClient class.\n * @param credentials type: TokenCredential\n */\nexport default function createClient(\n credentials: TokenCredential,\n options: ClientOptions = {},\n): ComputeManagementClient {\n const baseUrl = options.baseUrl ?? `https://management.azure.com`;\n options = {\n ...options,\n credentials: {\n scopes: [\"https://management.azure.com/.default\"],\n },\n };\n\n const userAgentInfo = `azsdk-js-arm-compute-rest/1.0.0-beta.1`;\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 ComputeManagementClient;\n\n return client;\n}\n"]}
|
|
@@ -350,7 +350,7 @@ const responseMap = {
|
|
|
350
350
|
};
|
|
351
351
|
export function isUnexpected(response) {
|
|
352
352
|
const lroOriginal = response.headers["x-ms-original-url"];
|
|
353
|
-
const url = new URL(lroOriginal
|
|
353
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
354
354
|
const method = response.request.method;
|
|
355
355
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
356
356
|
if (!pathDetails) {
|
|
@@ -359,7 +359,6 @@ export function isUnexpected(response) {
|
|
|
359
359
|
return !pathDetails.includes(response.status);
|
|
360
360
|
}
|
|
361
361
|
function geParametrizedPathSuccess(path) {
|
|
362
|
-
var _a, _b;
|
|
363
362
|
const pathParts = path.split("/");
|
|
364
363
|
// Iterate the responseMap to find a match
|
|
365
364
|
for (const [key, value] of Object.entries(responseMap)) {
|
|
@@ -374,7 +373,7 @@ function geParametrizedPathSuccess(path) {
|
|
|
374
373
|
// track if we have found a match to return the values found.
|
|
375
374
|
let found = true;
|
|
376
375
|
for (let i = 0; i < candidateParts.length; i++) {
|
|
377
|
-
if (
|
|
376
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.endsWith("}")) {
|
|
378
377
|
// If the current part of the candidate is a "template" part
|
|
379
378
|
// it is a match with the actual path part on hand
|
|
380
379
|
// skip as the parameterized part can match anything
|