@azure-rest/arm-servicefabric 1.0.0-beta.1 → 1.0.0-beta.2
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/LICENSE +4 -4
- package/README.md +4 -6
- package/dist/browser/clientDefinitions.d.ts +137 -0
- package/dist/browser/clientDefinitions.d.ts.map +1 -0
- package/dist/browser/clientDefinitions.js +4 -0
- package/dist/browser/clientDefinitions.js.map +1 -0
- package/dist/browser/customizedApiVersionPolicy.d.ts +10 -0
- package/dist/browser/customizedApiVersionPolicy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/customizedApiVersionPolicy.js +1 -1
- package/dist/browser/customizedApiVersionPolicy.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +14 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/isUnexpected.d.ts +32 -0
- package/dist/browser/isUnexpected.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/isUnexpected.js +64 -120
- package/dist/browser/isUnexpected.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/models.d.ts +772 -0
- package/dist/browser/models.d.ts.map +1 -0
- package/dist/browser/models.js +4 -0
- package/dist/browser/models.js.map +1 -0
- package/dist/browser/outputModels.d.ts +861 -0
- package/dist/browser/outputModels.d.ts.map +1 -0
- package/dist/browser/outputModels.js +4 -0
- package/dist/browser/outputModels.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/paginateHelper.d.ts +68 -0
- package/dist/browser/paginateHelper.d.ts.map +1 -0
- package/dist/browser/paginateHelper.js +167 -0
- package/dist/browser/paginateHelper.js.map +1 -0
- package/dist/browser/parameters.d.ts +105 -0
- package/dist/browser/parameters.d.ts.map +1 -0
- package/dist/browser/parameters.js +4 -0
- package/dist/browser/parameters.js.map +1 -0
- package/dist/browser/pollingHelper.d.ts +76 -0
- package/dist/browser/pollingHelper.d.ts.map +1 -0
- package/dist/browser/pollingHelper.js +104 -0
- package/dist/browser/pollingHelper.js.map +1 -0
- package/dist/browser/responses.d.ts +328 -0
- package/dist/browser/responses.d.ts.map +1 -0
- package/dist/browser/responses.js +4 -0
- package/dist/browser/responses.js.map +1 -0
- package/dist/browser/serviceFabricClient.d.ts +15 -0
- package/dist/browser/serviceFabricClient.d.ts.map +1 -0
- package/dist/browser/serviceFabricClient.js +42 -0
- package/dist/browser/serviceFabricClient.js.map +1 -0
- package/dist/commonjs/clientDefinitions.d.ts +137 -0
- package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/clientDefinitions.js +5 -0
- package/dist/commonjs/clientDefinitions.js.map +1 -0
- package/dist/commonjs/customizedApiVersionPolicy.d.ts +10 -0
- package/dist/commonjs/customizedApiVersionPolicy.d.ts.map +1 -0
- package/dist/commonjs/customizedApiVersionPolicy.js +27 -0
- package/dist/commonjs/customizedApiVersionPolicy.js.map +1 -0
- package/dist/commonjs/index.d.ts +12 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +17 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/isUnexpected.d.ts +32 -0
- package/dist/commonjs/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/isUnexpected.js +102 -0
- package/dist/commonjs/isUnexpected.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/models.d.ts +772 -0
- package/dist/commonjs/models.d.ts.map +1 -0
- package/dist/commonjs/models.js +5 -0
- package/dist/commonjs/models.js.map +1 -0
- package/dist/commonjs/outputModels.d.ts +861 -0
- package/dist/commonjs/outputModels.d.ts.map +1 -0
- package/dist/commonjs/outputModels.js +5 -0
- package/dist/commonjs/outputModels.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/paginateHelper.d.ts +68 -0
- package/dist/commonjs/paginateHelper.d.ts.map +1 -0
- package/dist/commonjs/paginateHelper.js +170 -0
- package/dist/commonjs/paginateHelper.js.map +1 -0
- package/dist/commonjs/parameters.d.ts +105 -0
- package/dist/commonjs/parameters.d.ts.map +1 -0
- package/dist/commonjs/parameters.js +5 -0
- package/dist/commonjs/parameters.js.map +1 -0
- package/dist/commonjs/pollingHelper.d.ts +76 -0
- package/dist/commonjs/pollingHelper.d.ts.map +1 -0
- package/dist/commonjs/pollingHelper.js +107 -0
- package/dist/commonjs/pollingHelper.js.map +1 -0
- package/dist/commonjs/responses.d.ts +328 -0
- package/dist/commonjs/responses.d.ts.map +1 -0
- package/dist/commonjs/responses.js +5 -0
- package/dist/commonjs/responses.js.map +1 -0
- package/dist/commonjs/serviceFabricClient.d.ts +15 -0
- package/dist/commonjs/serviceFabricClient.d.ts.map +1 -0
- package/dist/commonjs/serviceFabricClient.js +45 -0
- package/dist/commonjs/serviceFabricClient.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/clientDefinitions.d.ts +137 -0
- package/dist/esm/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/clientDefinitions.js +4 -0
- package/dist/esm/clientDefinitions.js.map +1 -0
- package/dist/esm/customizedApiVersionPolicy.d.ts +10 -0
- package/dist/esm/customizedApiVersionPolicy.d.ts.map +1 -0
- package/dist/esm/customizedApiVersionPolicy.js +23 -0
- package/dist/esm/customizedApiVersionPolicy.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/isUnexpected.d.ts +32 -0
- package/dist/esm/isUnexpected.d.ts.map +1 -0
- package/dist/esm/isUnexpected.js +99 -0
- package/dist/esm/isUnexpected.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/models.d.ts +772 -0
- package/dist/esm/models.d.ts.map +1 -0
- package/dist/esm/models.js +4 -0
- package/dist/esm/models.js.map +1 -0
- package/dist/esm/outputModels.d.ts +861 -0
- package/dist/esm/outputModels.d.ts.map +1 -0
- package/dist/esm/outputModels.js +4 -0
- package/dist/esm/outputModels.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/paginateHelper.d.ts +68 -0
- package/dist/esm/paginateHelper.d.ts.map +1 -0
- package/dist/esm/paginateHelper.js +167 -0
- package/dist/esm/paginateHelper.js.map +1 -0
- package/dist/esm/parameters.d.ts +105 -0
- package/dist/esm/parameters.d.ts.map +1 -0
- package/dist/esm/parameters.js +4 -0
- package/dist/esm/parameters.js.map +1 -0
- package/dist/esm/pollingHelper.d.ts +76 -0
- package/dist/esm/pollingHelper.d.ts.map +1 -0
- package/dist/esm/pollingHelper.js +104 -0
- package/dist/esm/pollingHelper.js.map +1 -0
- package/dist/esm/responses.d.ts +328 -0
- package/dist/esm/responses.d.ts.map +1 -0
- package/dist/esm/responses.js +4 -0
- package/dist/esm/responses.js.map +1 -0
- package/dist/esm/serviceFabricClient.d.ts +15 -0
- package/dist/esm/serviceFabricClient.d.ts.map +1 -0
- package/dist/esm/serviceFabricClient.js +42 -0
- package/dist/esm/serviceFabricClient.js.map +1 -0
- package/dist/react-native/clientDefinitions.d.ts +137 -0
- package/dist/react-native/clientDefinitions.d.ts.map +1 -0
- package/dist/react-native/clientDefinitions.js +4 -0
- package/dist/react-native/clientDefinitions.js.map +1 -0
- package/dist/react-native/customizedApiVersionPolicy.d.ts +10 -0
- package/dist/react-native/customizedApiVersionPolicy.d.ts.map +1 -0
- package/dist/react-native/customizedApiVersionPolicy.js +23 -0
- package/dist/react-native/customizedApiVersionPolicy.js.map +1 -0
- package/dist/react-native/index.d.ts +12 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +14 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/isUnexpected.d.ts +32 -0
- package/dist/react-native/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/isUnexpected.js +99 -0
- package/dist/react-native/isUnexpected.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/models.d.ts +772 -0
- package/dist/react-native/models.d.ts.map +1 -0
- package/dist/react-native/models.js +4 -0
- package/dist/react-native/models.js.map +1 -0
- package/dist/react-native/outputModels.d.ts +861 -0
- package/dist/react-native/outputModels.d.ts.map +1 -0
- package/dist/react-native/outputModels.js +4 -0
- package/dist/react-native/outputModels.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/paginateHelper.d.ts +68 -0
- package/dist/react-native/paginateHelper.d.ts.map +1 -0
- package/dist/react-native/paginateHelper.js +167 -0
- package/dist/react-native/paginateHelper.js.map +1 -0
- package/dist/react-native/parameters.d.ts +105 -0
- package/dist/react-native/parameters.d.ts.map +1 -0
- package/dist/react-native/parameters.js +4 -0
- package/dist/react-native/parameters.js.map +1 -0
- package/dist/react-native/pollingHelper.d.ts +76 -0
- package/dist/react-native/pollingHelper.d.ts.map +1 -0
- package/dist/react-native/pollingHelper.js +104 -0
- package/dist/react-native/pollingHelper.js.map +1 -0
- package/dist/react-native/responses.d.ts +328 -0
- package/dist/react-native/responses.d.ts.map +1 -0
- package/dist/react-native/responses.js +4 -0
- package/dist/react-native/responses.js.map +1 -0
- package/dist/react-native/serviceFabricClient.d.ts +15 -0
- package/dist/react-native/serviceFabricClient.d.ts.map +1 -0
- package/dist/react-native/serviceFabricClient.js +42 -0
- package/dist/react-native/serviceFabricClient.js.map +1 -0
- package/package.json +82 -66
- package/dist/index.js +0 -330
- package/dist/index.js.map +0 -1
- package/dist-esm/src/clientDefinitions.js +0 -4
- package/dist-esm/src/clientDefinitions.js.map +0 -1
- package/dist-esm/src/customizedApiVersionPolicy.js.map +0 -1
- package/dist-esm/src/index.js +0 -14
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/isUnexpected.js.map +0 -1
- package/dist-esm/src/models.js +0 -4
- package/dist-esm/src/models.js.map +0 -1
- package/dist-esm/src/outputModels.js +0 -4
- package/dist-esm/src/outputModels.js.map +0 -1
- package/dist-esm/src/paginateHelper.js +0 -70
- package/dist-esm/src/paginateHelper.js.map +0 -1
- package/dist-esm/src/parameters.js +0 -4
- package/dist-esm/src/parameters.js.map +0 -1
- package/dist-esm/src/pollingHelper.js +0 -48
- package/dist-esm/src/pollingHelper.js.map +0 -1
- package/dist-esm/src/responses.js +0 -4
- package/dist-esm/src/responses.js.map +0 -1
- package/dist-esm/src/serviceFabricClient.js +0 -27
- package/dist-esm/src/serviceFabricClient.js.map +0 -1
- package/review/arm-servicefabric.api.md +0 -2071
- package/types/arm-servicefabric.d.ts +0 -2480
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { __rest } from "tslib";
|
|
4
|
+
import { getClient } from "@azure-rest/core-client";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
/**
|
|
7
|
+
* Initialize a new instance of `ServiceFabricClient`
|
|
8
|
+
* @param credentials - uniquely identify client credential
|
|
9
|
+
* @param options - the parameter for all optional parameters
|
|
10
|
+
*/
|
|
11
|
+
export default function createClient(credentials, _a = {}) {
|
|
12
|
+
var _b, _c, _d, _e, _f, _g;
|
|
13
|
+
var { apiVersion = "2021-06-01" } = _a, options = __rest(_a, ["apiVersion"]);
|
|
14
|
+
const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `https://management.azure.com`;
|
|
15
|
+
const userAgentInfo = `azsdk-js-arm-servicefabric-rest/1.0.0-beta.2`;
|
|
16
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
17
|
+
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
18
|
+
: `${userAgentInfo}`;
|
|
19
|
+
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
20
|
+
userAgentPrefix,
|
|
21
|
+
}, loggingOptions: {
|
|
22
|
+
logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
|
|
23
|
+
}, credentials: {
|
|
24
|
+
scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://management.azure.com/.default"],
|
|
25
|
+
} });
|
|
26
|
+
const client = getClient(endpointUrl, credentials, options);
|
|
27
|
+
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
28
|
+
client.pipeline.addPolicy({
|
|
29
|
+
name: "ClientApiVersionPolicy",
|
|
30
|
+
sendRequest: (req, next) => {
|
|
31
|
+
// Use the apiVersion defined in request url directly
|
|
32
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
33
|
+
const url = new URL(req.url);
|
|
34
|
+
if (!url.searchParams.get("api-version") && apiVersion) {
|
|
35
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
36
|
+
}
|
|
37
|
+
return next(req);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return client;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=serviceFabricClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceFabricClient.js","sourceRoot":"","sources":["../../src/serviceFabricClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,WAA4B,EAC5B,KAAwE,EAAE;;QAA1E,EAAE,UAAU,GAAG,YAAY,OAA+C,EAA1C,OAAO,cAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,8BAA8B,CAAC;IAC1F,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,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,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,uCAAuC,CAAC;SACjF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAwB,CAAC;IAEnF,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 { ServiceFabricClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface ServiceFabricClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `ServiceFabricClient`\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n credentials: TokenCredential,\n { apiVersion = \"2021-06-01\", ...options }: ServiceFabricClientOptions = {},\n): ServiceFabricClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;\n const userAgentInfo = `azsdk-js-arm-servicefabric-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 loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://management.azure.com/.default\"],\n },\n };\n const client = getClient(endpointUrl, credentials, options) as ServiceFabricClient;\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"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-rest/arm-servicefabric",
|
|
3
|
-
"sdk-type": "
|
|
3
|
+
"sdk-type": "mgmt",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.2",
|
|
6
6
|
"description": "",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"isomorphic"
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"module": "./dist
|
|
18
|
-
"types": "./
|
|
16
|
+
"main": "./dist/commonjs/index.js",
|
|
17
|
+
"module": "./dist/esm/index.js",
|
|
18
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
19
19
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicefabric/arm-servicefabric-rest/README.md",
|
|
20
20
|
"repository": "github:Azure/azure-sdk-for-js",
|
|
21
21
|
"bugs": {
|
|
@@ -23,11 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist/",
|
|
26
|
-
"dist-esm/src/",
|
|
27
|
-
"types/arm-servicefabric.d.ts",
|
|
28
26
|
"README.md",
|
|
29
|
-
"LICENSE"
|
|
30
|
-
"review/*"
|
|
27
|
+
"LICENSE"
|
|
31
28
|
],
|
|
32
29
|
"//metadata": {
|
|
33
30
|
"constantPaths": [
|
|
@@ -38,90 +35,109 @@
|
|
|
38
35
|
]
|
|
39
36
|
},
|
|
40
37
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
38
|
+
"node": ">=18.0.0"
|
|
42
39
|
},
|
|
43
40
|
"scripts": {
|
|
44
|
-
"
|
|
45
|
-
"build:browser": "
|
|
46
|
-
"build:
|
|
41
|
+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
42
|
+
"build:browser": "dev-tool run build-package && dev-tool run bundle",
|
|
43
|
+
"build:debug": "dev-tool run build-package && dev-tool run bundle && dev-tool run extract-api",
|
|
44
|
+
"build:node": "dev-tool run build-package && dev-tool run bundle --browser-test false",
|
|
47
45
|
"build:samples": "echo skipped.",
|
|
48
|
-
"build:test": "
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
46
|
+
"build:test": "dev-tool run build-package && dev-tool run bundle",
|
|
47
|
+
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
48
|
+
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
52
49
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
53
|
-
"extract-api": "
|
|
54
|
-
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
50
|
+
"extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api",
|
|
51
|
+
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
55
52
|
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
53
|
+
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
56
54
|
"integration-test:browser": "dev-tool run test:browser",
|
|
57
55
|
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
|
|
58
|
-
"
|
|
59
|
-
"lint:fix": "eslint package.json api-extractor.json src test --
|
|
60
|
-
"lint": "eslint package.json api-extractor.json src test --ext .ts",
|
|
56
|
+
"lint": "eslint package.json api-extractor.json src test",
|
|
57
|
+
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
|
|
61
58
|
"pack": "npm pack 2>&1",
|
|
59
|
+
"test": "npm run clean && npm run build:test && npm run unit-test",
|
|
62
60
|
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
|
63
61
|
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
|
64
|
-
"test": "npm run clean && npm run build:test && npm run unit-test",
|
|
65
62
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
66
|
-
"unit-test:
|
|
67
|
-
"unit-test:
|
|
68
|
-
"
|
|
63
|
+
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
64
|
+
"unit-test:node": "dev-tool run test:vitest",
|
|
65
|
+
"update-snippets": "echo skipped"
|
|
69
66
|
},
|
|
70
67
|
"sideEffects": false,
|
|
71
68
|
"autoPublish": false,
|
|
72
69
|
"dependencies": {
|
|
70
|
+
"@azure-rest/core-client": "^1.0.0",
|
|
71
|
+
"@azure/abort-controller": "^2.1.2",
|
|
73
72
|
"@azure/core-auth": "^1.3.0",
|
|
74
|
-
"@azure
|
|
73
|
+
"@azure/core-lro": "^3.1.0",
|
|
74
|
+
"@azure/core-paging": "^1.2.0",
|
|
75
75
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
76
76
|
"@azure/logger": "^1.0.0",
|
|
77
|
-
"tslib": "^2.2.0"
|
|
78
|
-
"@azure/core-paging": "^1.2.0",
|
|
79
|
-
"@azure/core-lro": "^2.2.0"
|
|
77
|
+
"tslib": "^2.2.0"
|
|
80
78
|
},
|
|
81
79
|
"devDependencies": {
|
|
82
|
-
"@
|
|
83
|
-
"
|
|
84
|
-
"@
|
|
85
|
-
"dotenv": "^8.2.0",
|
|
86
|
-
"eslint": "^7.15.0",
|
|
87
|
-
"mkdirp": "^1.0.4",
|
|
88
|
-
"prettier": "2.2.1",
|
|
89
|
-
"rimraf": "^3.0.0",
|
|
90
|
-
"source-map-support": "^0.5.9",
|
|
91
|
-
"typescript": "~4.2.0",
|
|
80
|
+
"@azure-tools/test-credential": "^2.0.0",
|
|
81
|
+
"@azure-tools/test-recorder": "^4.1.0",
|
|
82
|
+
"@azure-tools/test-utils-vitest": "^1.0.0",
|
|
92
83
|
"@azure/dev-tool": "^1.0.0",
|
|
93
84
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
94
|
-
"@azure
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"karma-edge-launcher": "^0.4.2",
|
|
105
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
106
|
-
"karma-firefox-launcher": "^1.1.0",
|
|
107
|
-
"karma-ie-launcher": "^1.0.0",
|
|
108
|
-
"karma-junit-reporter": "^2.0.1",
|
|
109
|
-
"karma-mocha-reporter": "^2.2.5",
|
|
110
|
-
"karma-mocha": "^2.0.1",
|
|
111
|
-
"karma-source-map-support": "~1.4.0",
|
|
112
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
113
|
-
"karma": "^6.2.0",
|
|
114
|
-
"nyc": "^14.0.0"
|
|
115
|
-
},
|
|
116
|
-
"browser": {
|
|
117
|
-
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
|
|
85
|
+
"@azure/identity": "^4.0.1",
|
|
86
|
+
"@types/node": "^18.0.0",
|
|
87
|
+
"@vitest/browser": "^3.0.3",
|
|
88
|
+
"@vitest/coverage-istanbul": "^3.0.3",
|
|
89
|
+
"autorest": "latest",
|
|
90
|
+
"dotenv": "^16.0.0",
|
|
91
|
+
"eslint": "^9.9.0",
|
|
92
|
+
"playwright": "^1.49.1",
|
|
93
|
+
"typescript": "~5.7.2",
|
|
94
|
+
"vitest": "^3.0.3"
|
|
118
95
|
},
|
|
96
|
+
"browser": "./dist/browser/index.js",
|
|
119
97
|
"//sampleConfiguration": {
|
|
120
98
|
"productName": "",
|
|
121
99
|
"productSlugs": [
|
|
122
100
|
"azure"
|
|
123
101
|
],
|
|
124
|
-
"disableDocsMs": true
|
|
125
|
-
|
|
102
|
+
"disableDocsMs": true
|
|
103
|
+
},
|
|
104
|
+
"type": "module",
|
|
105
|
+
"tshy": {
|
|
106
|
+
"project": "./tsconfig.src.json",
|
|
107
|
+
"exports": {
|
|
108
|
+
"./package.json": "./package.json",
|
|
109
|
+
".": "./src/index.ts"
|
|
110
|
+
},
|
|
111
|
+
"dialects": [
|
|
112
|
+
"esm",
|
|
113
|
+
"commonjs"
|
|
114
|
+
],
|
|
115
|
+
"esmDialects": [
|
|
116
|
+
"browser",
|
|
117
|
+
"react-native"
|
|
118
|
+
],
|
|
119
|
+
"selfLink": false
|
|
120
|
+
},
|
|
121
|
+
"react-native": "./dist/react-native/index.js",
|
|
122
|
+
"exports": {
|
|
123
|
+
"./package.json": "./package.json",
|
|
124
|
+
".": {
|
|
125
|
+
"browser": {
|
|
126
|
+
"types": "./dist/browser/index.d.ts",
|
|
127
|
+
"default": "./dist/browser/index.js"
|
|
128
|
+
},
|
|
129
|
+
"react-native": {
|
|
130
|
+
"types": "./dist/react-native/index.d.ts",
|
|
131
|
+
"default": "./dist/react-native/index.js"
|
|
132
|
+
},
|
|
133
|
+
"import": {
|
|
134
|
+
"types": "./dist/esm/index.d.ts",
|
|
135
|
+
"default": "./dist/esm/index.js"
|
|
136
|
+
},
|
|
137
|
+
"require": {
|
|
138
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
139
|
+
"default": "./dist/commonjs/index.js"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
126
142
|
}
|
|
127
143
|
}
|
package/dist/index.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var coreClient = require('@azure-rest/core-client');
|
|
6
|
-
var corePaging = require('@azure/core-paging');
|
|
7
|
-
var coreLro = require('@azure/core-lro');
|
|
8
|
-
|
|
9
|
-
// Copyright (c) Microsoft Corporation.
|
|
10
|
-
// Licensed under the MIT license.
|
|
11
|
-
const apiVersionPolicyName = "CustomizedApiVersionPolicy";
|
|
12
|
-
/**
|
|
13
|
-
* Creates a policy that sets the apiVersion as a query parameter on every request
|
|
14
|
-
* @param options - Client options
|
|
15
|
-
* @returns Pipeline policy that sets the apiVersion as a query parameter on every request
|
|
16
|
-
*/
|
|
17
|
-
function customizedApiVersionPolicy(options) {
|
|
18
|
-
return {
|
|
19
|
-
name: apiVersionPolicyName,
|
|
20
|
-
sendRequest: (req, next) => {
|
|
21
|
-
if (options.apiVersion) {
|
|
22
|
-
const url = new URL(req.url);
|
|
23
|
-
// add or replace the existing api-version with client one
|
|
24
|
-
url.searchParams.set("api-version", options.apiVersion);
|
|
25
|
-
req.url = url.toString();
|
|
26
|
-
}
|
|
27
|
-
return next(req);
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Copyright (c) Microsoft Corporation.
|
|
33
|
-
function createClient(credentials, options = {}) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : "https://management.azure.com";
|
|
36
|
-
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2021-06-01";
|
|
37
|
-
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
38
|
-
scopes: ["https://management.azure.com/.default"],
|
|
39
|
-
} });
|
|
40
|
-
const userAgentInfo = `azsdk-js-arm-servicefabric-rest/1.0.0-beta.1`;
|
|
41
|
-
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
42
|
-
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
43
|
-
: `${userAgentInfo}`;
|
|
44
|
-
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
45
|
-
userAgentPrefix,
|
|
46
|
-
} });
|
|
47
|
-
const client = coreClient.getClient(baseUrl, credentials, options);
|
|
48
|
-
// Considering ApiVersionPolicy in core has bugs so we replace with our customized one
|
|
49
|
-
client.pipeline.removePolicy({
|
|
50
|
-
name: "ApiVersionPolicy",
|
|
51
|
-
});
|
|
52
|
-
client.pipeline.addPolicy(customizedApiVersionPolicy(options));
|
|
53
|
-
return client;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Copyright (c) Microsoft Corporation.
|
|
57
|
-
// Licensed under the MIT license.
|
|
58
|
-
const responseMap = {
|
|
59
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}": [
|
|
60
|
-
"200",
|
|
61
|
-
],
|
|
62
|
-
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}": [
|
|
63
|
-
"200",
|
|
64
|
-
"202",
|
|
65
|
-
],
|
|
66
|
-
"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}": [
|
|
67
|
-
"200",
|
|
68
|
-
"202",
|
|
69
|
-
],
|
|
70
|
-
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}": [
|
|
71
|
-
"200",
|
|
72
|
-
"204",
|
|
73
|
-
],
|
|
74
|
-
"GET /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters": [
|
|
75
|
-
"200",
|
|
76
|
-
],
|
|
77
|
-
"GET /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters": ["200"],
|
|
78
|
-
"POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions": [
|
|
79
|
-
"200",
|
|
80
|
-
],
|
|
81
|
-
"GET /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}": [
|
|
82
|
-
"200",
|
|
83
|
-
],
|
|
84
|
-
"GET /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}": [
|
|
85
|
-
"200",
|
|
86
|
-
],
|
|
87
|
-
"GET /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions": [
|
|
88
|
-
"200",
|
|
89
|
-
],
|
|
90
|
-
"GET /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions": [
|
|
91
|
-
"200",
|
|
92
|
-
],
|
|
93
|
-
"GET /providers/Microsoft.ServiceFabric/operations": ["200"],
|
|
94
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}": [
|
|
95
|
-
"200",
|
|
96
|
-
],
|
|
97
|
-
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}": [
|
|
98
|
-
"200",
|
|
99
|
-
],
|
|
100
|
-
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}": [
|
|
101
|
-
"202",
|
|
102
|
-
"204",
|
|
103
|
-
],
|
|
104
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes": [
|
|
105
|
-
"200",
|
|
106
|
-
],
|
|
107
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}": [
|
|
108
|
-
"200",
|
|
109
|
-
],
|
|
110
|
-
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}": [
|
|
111
|
-
"202",
|
|
112
|
-
],
|
|
113
|
-
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}": [
|
|
114
|
-
"202",
|
|
115
|
-
"204",
|
|
116
|
-
],
|
|
117
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions": [
|
|
118
|
-
"200",
|
|
119
|
-
],
|
|
120
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}": [
|
|
121
|
-
"200",
|
|
122
|
-
],
|
|
123
|
-
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}": [
|
|
124
|
-
"202",
|
|
125
|
-
],
|
|
126
|
-
"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}": [
|
|
127
|
-
"202",
|
|
128
|
-
],
|
|
129
|
-
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}": [
|
|
130
|
-
"202",
|
|
131
|
-
"204",
|
|
132
|
-
],
|
|
133
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications": [
|
|
134
|
-
"200",
|
|
135
|
-
],
|
|
136
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}": [
|
|
137
|
-
"200",
|
|
138
|
-
],
|
|
139
|
-
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}": [
|
|
140
|
-
"202",
|
|
141
|
-
],
|
|
142
|
-
"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}": [
|
|
143
|
-
"202",
|
|
144
|
-
],
|
|
145
|
-
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}": [
|
|
146
|
-
"202",
|
|
147
|
-
"204",
|
|
148
|
-
],
|
|
149
|
-
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services": [
|
|
150
|
-
"200",
|
|
151
|
-
],
|
|
152
|
-
};
|
|
153
|
-
function isUnexpected(response) {
|
|
154
|
-
const lroOriginal = response.headers["x-ms-original-url"];
|
|
155
|
-
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
156
|
-
const method = response.request.method;
|
|
157
|
-
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
158
|
-
if (!pathDetails) {
|
|
159
|
-
pathDetails = geParametrizedPathSuccess(url.pathname);
|
|
160
|
-
}
|
|
161
|
-
return !pathDetails.includes(response.status);
|
|
162
|
-
}
|
|
163
|
-
function geParametrizedPathSuccess(path) {
|
|
164
|
-
const pathParts = path.split("/");
|
|
165
|
-
// Iterate the responseMap to find a match
|
|
166
|
-
for (const [key, value] of Object.entries(responseMap)) {
|
|
167
|
-
// Extracting the path from the map key which is in format
|
|
168
|
-
// GET /path/foo
|
|
169
|
-
const candidatePath = getPathFromMapKey(key);
|
|
170
|
-
// Get each part of the url path
|
|
171
|
-
const candidateParts = candidatePath.split("/");
|
|
172
|
-
// If the candidate and actual paths don't match in size
|
|
173
|
-
// we move on to the next candidate path
|
|
174
|
-
if (candidateParts.length === pathParts.length && hasParametrizedPath(key)) {
|
|
175
|
-
// track if we have found a match to return the values found.
|
|
176
|
-
let found = true;
|
|
177
|
-
for (let i = 0; i < candidateParts.length; i++) {
|
|
178
|
-
if (candidateParts[i].startsWith("{") && candidateParts[i].endsWith("}")) {
|
|
179
|
-
// If the current part of the candidate is a "template" part
|
|
180
|
-
// it is a match with the actual path part on hand
|
|
181
|
-
// skip as the parameterized part can match anything
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
// If the candidate part is not a template and
|
|
185
|
-
// the parts don't match mark the candidate as not found
|
|
186
|
-
// to move on with the next candidate path.
|
|
187
|
-
if (candidateParts[i] !== pathParts[i]) {
|
|
188
|
-
found = false;
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// We finished evaluating the current candidate parts
|
|
193
|
-
// if all parts matched we return the success values form
|
|
194
|
-
// the path mapping.
|
|
195
|
-
if (found) {
|
|
196
|
-
return value;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
// No match was found, return an empty array.
|
|
201
|
-
return [];
|
|
202
|
-
}
|
|
203
|
-
function hasParametrizedPath(path) {
|
|
204
|
-
return path.includes("/{");
|
|
205
|
-
}
|
|
206
|
-
function getPathFromMapKey(mapKey) {
|
|
207
|
-
const pathStart = mapKey.indexOf("/");
|
|
208
|
-
return mapKey.slice(pathStart);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Copyright (c) Microsoft Corporation.
|
|
212
|
-
/**
|
|
213
|
-
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
214
|
-
* @param client - Client to use for sending the next page requests
|
|
215
|
-
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
216
|
-
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
217
|
-
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
218
|
-
*/
|
|
219
|
-
function paginate(client, initialResponse, options = {}) {
|
|
220
|
-
let firstRun = true;
|
|
221
|
-
const itemName = "value";
|
|
222
|
-
const nextLinkName = "nextLink";
|
|
223
|
-
const { customGetPage } = options;
|
|
224
|
-
const pagedResult = {
|
|
225
|
-
firstPageLink: "",
|
|
226
|
-
getPage: typeof customGetPage === "function"
|
|
227
|
-
? customGetPage
|
|
228
|
-
: async (pageLink) => {
|
|
229
|
-
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
230
|
-
firstRun = false;
|
|
231
|
-
checkPagingRequest(result);
|
|
232
|
-
const nextLink = getNextLink(result.body, nextLinkName);
|
|
233
|
-
const values = getElements(result.body, itemName);
|
|
234
|
-
return {
|
|
235
|
-
page: values,
|
|
236
|
-
nextPageLink: nextLink,
|
|
237
|
-
};
|
|
238
|
-
},
|
|
239
|
-
};
|
|
240
|
-
return corePaging.getPagedAsyncIterator(pagedResult);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Gets for the value of nextLink in the body
|
|
244
|
-
*/
|
|
245
|
-
function getNextLink(body, nextLinkName) {
|
|
246
|
-
if (!nextLinkName) {
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
const nextLink = body[nextLinkName];
|
|
250
|
-
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
251
|
-
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
252
|
-
}
|
|
253
|
-
return nextLink;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Gets the elements of the current request in the body.
|
|
257
|
-
*/
|
|
258
|
-
function getElements(body, itemName) {
|
|
259
|
-
const value = body[itemName];
|
|
260
|
-
// value has to be an array according to the x-ms-pageable extension.
|
|
261
|
-
// The fact that this must be an array is used above to calculate the
|
|
262
|
-
// type of elements in the page in PaginateReturn
|
|
263
|
-
if (!Array.isArray(value)) {
|
|
264
|
-
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
265
|
-
}
|
|
266
|
-
return value !== null && value !== void 0 ? value : [];
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Checks if a request failed
|
|
270
|
-
*/
|
|
271
|
-
function checkPagingRequest(response) {
|
|
272
|
-
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
273
|
-
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
274
|
-
throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// Copyright (c) Microsoft Corporation.
|
|
279
|
-
/**
|
|
280
|
-
* Helper function that builds a Poller object to help polling a long running operation.
|
|
281
|
-
* @param client - Client to use for sending the request to get additional pages.
|
|
282
|
-
* @param initialResponse - The initial response.
|
|
283
|
-
* @param options - Options to set a resume state or custom polling interval.
|
|
284
|
-
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
285
|
-
*/
|
|
286
|
-
function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
287
|
-
const poller = {
|
|
288
|
-
requestMethod: initialResponse.request.method,
|
|
289
|
-
requestPath: initialResponse.request.url,
|
|
290
|
-
sendInitialRequest: async () => {
|
|
291
|
-
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
|
292
|
-
// we are not triggering the initial request here, just extracting the information from the
|
|
293
|
-
// response we were provided.
|
|
294
|
-
return getLroResponse(initialResponse);
|
|
295
|
-
},
|
|
296
|
-
sendPollRequest: async (path) => {
|
|
297
|
-
// This is the callback that is going to be called to poll the service
|
|
298
|
-
// to get the latest status. We use the client provided and the polling path
|
|
299
|
-
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
|
300
|
-
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
|
301
|
-
const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
|
|
302
|
-
const lroResponse = getLroResponse(response);
|
|
303
|
-
lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
|
|
304
|
-
return lroResponse;
|
|
305
|
-
},
|
|
306
|
-
};
|
|
307
|
-
return new coreLro.LroEngine(poller, options);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Converts a Rest Client response to a response that the LRO engine knows about
|
|
311
|
-
* @param response - a rest client http response
|
|
312
|
-
* @returns - An LRO response that the LRO engine can work with
|
|
313
|
-
*/
|
|
314
|
-
function getLroResponse(response) {
|
|
315
|
-
if (Number.isNaN(response.status)) {
|
|
316
|
-
throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
|
|
317
|
-
}
|
|
318
|
-
return {
|
|
319
|
-
flatResponse: response,
|
|
320
|
-
rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Copyright (c) Microsoft Corporation.
|
|
325
|
-
|
|
326
|
-
exports["default"] = createClient;
|
|
327
|
-
exports.getLongRunningPoller = getLongRunningPoller;
|
|
328
|
-
exports.isUnexpected = isUnexpected;
|
|
329
|
-
exports.paginate = paginate;
|
|
330
|
-
//# sourceMappingURL=index.js.map
|