@azure-rest/arm-compute 1.0.0-alpha.20240115.1 → 1.0.0-alpha.20240117.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 +12 -20
- package/dist/index.js.map +1 -1
- package/dist-esm/src/computeManagementClient.js +6 -11
- package/dist-esm/src/computeManagementClient.js.map +1 -1
- package/dist-esm/src/isUnexpected.js +3 -2
- 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 +2 -6
- package/dist-esm/src/pollingHelper.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,23 +6,18 @@ 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
|
-
|
|
12
|
-
credentials: {
|
|
9
|
+
var _a;
|
|
10
|
+
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `https://management.azure.com`;
|
|
11
|
+
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
13
12
|
scopes: ["https://management.azure.com/.default"],
|
|
14
|
-
}
|
|
15
|
-
};
|
|
13
|
+
} });
|
|
16
14
|
const userAgentInfo = `azsdk-js-arm-compute-rest/1.0.0-beta.1`;
|
|
17
15
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
18
16
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
19
17
|
: `${userAgentInfo}`;
|
|
20
|
-
options = {
|
|
21
|
-
...options,
|
|
22
|
-
userAgentOptions: {
|
|
18
|
+
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
23
19
|
userAgentPrefix,
|
|
24
|
-
}
|
|
25
|
-
};
|
|
20
|
+
} });
|
|
26
21
|
const client = getClient(baseUrl, credentials, options);
|
|
27
22
|
return client;
|
|
28
23
|
}
|
|
@@ -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,MAAA,OAAO,CAAC,OAAO,mCAAI,8BAA8B,CAAC;IAClE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,uCAAuC,CAAC;SAClD,GACF,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,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,GACF,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 !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
354
354
|
const method = response.request.method;
|
|
355
355
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
356
356
|
if (!pathDetails) {
|
|
@@ -359,6 +359,7 @@ export function isUnexpected(response) {
|
|
|
359
359
|
return !pathDetails.includes(response.status);
|
|
360
360
|
}
|
|
361
361
|
function geParametrizedPathSuccess(path) {
|
|
362
|
+
var _a, _b;
|
|
362
363
|
const pathParts = path.split("/");
|
|
363
364
|
// Iterate the responseMap to find a match
|
|
364
365
|
for (const [key, value] of Object.entries(responseMap)) {
|
|
@@ -373,7 +374,7 @@ function geParametrizedPathSuccess(path) {
|
|
|
373
374
|
// track if we have found a match to return the values found.
|
|
374
375
|
let found = true;
|
|
375
376
|
for (let i = 0; i < candidateParts.length; i++) {
|
|
376
|
-
if (candidateParts[i]
|
|
377
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.endsWith("}"))) {
|
|
377
378
|
// If the current part of the candidate is a "template" part
|
|
378
379
|
// it is a match with the actual path part on hand
|
|
379
380
|
// skip as the parameterized part can match anything
|