@azure/arm-playwrighttesting 1.0.0 → 1.0.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/CHANGELOG.md +7 -1
- package/LICENSE +4 -4
- package/README.md +25 -14
- package/dist/browser/api/accountQuotas/index.js +2 -2
- package/dist/browser/api/accountQuotas/index.js.map +1 -1
- package/dist/browser/api/accounts/index.js +20 -11
- package/dist/browser/api/accounts/index.js.map +1 -1
- package/dist/browser/api/azurePlaywrightServiceContext.js +12 -9
- package/dist/browser/api/azurePlaywrightServiceContext.js.map +1 -1
- package/dist/browser/api/operations/index.js +1 -1
- package/dist/browser/api/operations/index.js.map +1 -1
- package/dist/browser/api/quotas/index.js +2 -2
- package/dist/browser/api/quotas/index.js.map +1 -1
- package/dist/browser/azurePlaywrightServiceClient.js +16 -3
- package/dist/browser/azurePlaywrightServiceClient.js.map +1 -1
- package/dist/browser/classic/accountQuotas/index.js +3 -1
- package/dist/browser/classic/accountQuotas/index.js.map +1 -1
- package/dist/browser/classic/accounts/index.js +3 -1
- package/dist/browser/classic/accounts/index.js.map +1 -1
- package/dist/browser/classic/operations/index.js +3 -1
- package/dist/browser/classic/operations/index.js.map +1 -1
- package/dist/browser/classic/quotas/index.js +3 -1
- package/dist/browser/classic/quotas/index.js.map +1 -1
- package/dist/browser/restorePollerHelpers.js +11 -13
- package/dist/browser/restorePollerHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pagingHelpers.js +31 -50
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pollingHelpers.js +14 -11
- package/dist/browser/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/commonjs/api/accountQuotas/index.js +2 -2
- package/dist/commonjs/api/accountQuotas/index.js.map +1 -1
- package/dist/commonjs/api/accounts/index.js +20 -11
- package/dist/commonjs/api/accounts/index.js.map +1 -1
- package/dist/commonjs/api/azurePlaywrightServiceContext.js +12 -9
- package/dist/commonjs/api/azurePlaywrightServiceContext.js.map +1 -1
- package/dist/commonjs/api/operations/index.js +1 -1
- package/dist/commonjs/api/operations/index.js.map +1 -1
- package/dist/commonjs/api/quotas/index.js +2 -2
- package/dist/commonjs/api/quotas/index.js.map +1 -1
- package/dist/commonjs/azurePlaywrightServiceClient.js +16 -3
- package/dist/commonjs/azurePlaywrightServiceClient.js.map +1 -1
- package/dist/commonjs/classic/accountQuotas/index.js +3 -1
- package/dist/commonjs/classic/accountQuotas/index.js.map +1 -1
- package/dist/commonjs/classic/accounts/index.js +3 -1
- package/dist/commonjs/classic/accounts/index.js.map +1 -1
- package/dist/commonjs/classic/operations/index.js +3 -1
- package/dist/commonjs/classic/operations/index.js.map +1 -1
- package/dist/commonjs/classic/quotas/index.js +3 -1
- package/dist/commonjs/classic/quotas/index.js.map +1 -1
- package/dist/commonjs/restorePollerHelpers.js +11 -13
- package/dist/commonjs/restorePollerHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pagingHelpers.js +31 -50
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pollingHelpers.js +14 -11
- package/dist/commonjs/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/api/accountQuotas/index.js +2 -2
- package/dist/esm/api/accountQuotas/index.js.map +1 -1
- package/dist/esm/api/accounts/index.js +20 -11
- package/dist/esm/api/accounts/index.js.map +1 -1
- package/dist/esm/api/azurePlaywrightServiceContext.js +12 -9
- package/dist/esm/api/azurePlaywrightServiceContext.js.map +1 -1
- package/dist/esm/api/operations/index.js +1 -1
- package/dist/esm/api/operations/index.js.map +1 -1
- package/dist/esm/api/quotas/index.js +2 -2
- package/dist/esm/api/quotas/index.js.map +1 -1
- package/dist/esm/azurePlaywrightServiceClient.js +16 -3
- package/dist/esm/azurePlaywrightServiceClient.js.map +1 -1
- package/dist/esm/classic/accountQuotas/index.js +3 -1
- package/dist/esm/classic/accountQuotas/index.js.map +1 -1
- package/dist/esm/classic/accounts/index.js +3 -1
- package/dist/esm/classic/accounts/index.js.map +1 -1
- package/dist/esm/classic/operations/index.js +3 -1
- package/dist/esm/classic/operations/index.js.map +1 -1
- package/dist/esm/classic/quotas/index.js +3 -1
- package/dist/esm/classic/quotas/index.js.map +1 -1
- package/dist/esm/restorePollerHelpers.js +11 -13
- package/dist/esm/restorePollerHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pagingHelpers.js +31 -50
- package/dist/esm/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pollingHelpers.js +14 -11
- package/dist/esm/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/react-native/api/accountQuotas/index.js +2 -2
- package/dist/react-native/api/accountQuotas/index.js.map +1 -1
- package/dist/react-native/api/accounts/index.js +20 -11
- package/dist/react-native/api/accounts/index.js.map +1 -1
- package/dist/react-native/api/azurePlaywrightServiceContext.js +12 -9
- package/dist/react-native/api/azurePlaywrightServiceContext.js.map +1 -1
- package/dist/react-native/api/operations/index.js +1 -1
- package/dist/react-native/api/operations/index.js.map +1 -1
- package/dist/react-native/api/quotas/index.js +2 -2
- package/dist/react-native/api/quotas/index.js.map +1 -1
- package/dist/react-native/azurePlaywrightServiceClient.js +16 -3
- package/dist/react-native/azurePlaywrightServiceClient.js.map +1 -1
- package/dist/react-native/classic/accountQuotas/index.js +3 -1
- package/dist/react-native/classic/accountQuotas/index.js.map +1 -1
- package/dist/react-native/classic/accounts/index.js +3 -1
- package/dist/react-native/classic/accounts/index.js.map +1 -1
- package/dist/react-native/classic/operations/index.js +3 -1
- package/dist/react-native/classic/operations/index.js.map +1 -1
- package/dist/react-native/classic/quotas/index.js +3 -1
- package/dist/react-native/classic/quotas/index.js.map +1 -1
- package/dist/react-native/restorePollerHelpers.js +11 -13
- package/dist/react-native/restorePollerHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.js +31 -50
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pollingHelpers.js +14 -11
- package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -1
- package/package.json +41 -50
- /package/review/{arm-playwrighttesting-models.api.md → arm-playwrighttesting-models-node.api.md} +0 -0
- /package/review/{arm-playwrighttesting.api.md → arm-playwrighttesting-node.api.md} +0 -0
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { logger } from "../logger.js";
|
|
5
4
|
import { getClient } from "@azure-rest/core-client";
|
|
6
5
|
/** Microsoft.AzurePlaywrightService Resource Provider Management API. */
|
|
7
6
|
export function createAzurePlaywrightService(credential, options = {}) {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const userAgentInfo = `azsdk-js-arm-playwrighttesting/1.0.0`;
|
|
7
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;
|
|
8
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
9
|
+
const userAgentInfo = `azsdk-js-arm-playwrighttesting/1.0.1`;
|
|
12
10
|
const userAgentPrefix = prefixFromOptions
|
|
13
11
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
14
12
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const { apiVersion: _, ...updatedOptions } = {
|
|
14
|
+
...options,
|
|
15
|
+
userAgentOptions: { userAgentPrefix },
|
|
16
|
+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
|
|
17
|
+
credentials: {
|
|
18
|
+
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
18
21
|
const clientContext = getClient(endpointUrl, credential, updatedOptions);
|
|
19
22
|
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
20
|
-
const apiVersion =
|
|
23
|
+
const apiVersion = options.apiVersion ?? "2024-12-01";
|
|
21
24
|
clientContext.pipeline.addPolicy({
|
|
22
25
|
name: "ClientApiVersionPolicy",
|
|
23
26
|
sendRequest: (req, next) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azurePlaywrightServiceContext.js","sourceRoot":"","sources":["../../../src/api/azurePlaywrightServiceContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"azurePlaywrightServiceContext.js","sourceRoot":"","sources":["../../../src/api/azurePlaywrightServiceContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAa3E,yEAAyE;AACzE,MAAM,UAAU,4BAA4B,CAC1C,UAA2B,EAC3B,UAAsD,EAAE;IAExD,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,8BAA8B,CAAC;IAC1F,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,sCAAsC,CAAC;IAC7D,MAAM,eAAe,GAAG,iBAAiB;QACvC,CAAC,CAAC,GAAG,iBAAiB,iBAAiB,aAAa,EAAE;QACtD,CAAC,CAAC,gBAAgB,aAAa,EAAE,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,GAAG;QAC3C,GAAG,OAAO;QACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;QACrC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;QACzE,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,GAAG,WAAW,WAAW,CAAC;SACnE;KACF,CAAC;IACF,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACzE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;IACtD,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,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,EAAE,CAAC;gBACzC,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;IACH,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/** Microsoft.AzurePlaywrightService Resource Provider Management API. */\nexport interface AzurePlaywrightServiceContext extends Client {}\n\n/** Optional parameters for the client. */\nexport interface AzurePlaywrightServiceClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\n/** Microsoft.AzurePlaywrightService Resource Provider Management API. */\nexport function createAzurePlaywrightService(\n credential: TokenCredential,\n options: AzurePlaywrightServiceClientOptionalParams = {},\n): AzurePlaywrightServiceContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-arm-playwrighttesting/1.0.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2024-12-01\";\n clientContext.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\")) {\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 return clientContext;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { createRestError, operationOptionsToRequestParameters, } from "@azure-re
|
|
|
6
6
|
export function _operationsListSend(context, options = { requestOptions: {} }) {
|
|
7
7
|
return context
|
|
8
8
|
.path("/providers/Microsoft.AzurePlaywrightService/operations")
|
|
9
|
-
.get(
|
|
9
|
+
.get({ ...operationOptionsToRequestParameters(options) });
|
|
10
10
|
}
|
|
11
11
|
export async function _operationsListDeserialize(result) {
|
|
12
12
|
const expectedStatuses = ["200"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,gCAAgC,GAEjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,OAAO,OAAO;SACX,IAAI,CAAC,wDAAwD,CAAC;SAC9D,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,gCAAgC,GAEjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,OAAO,OAAO;SACX,IAAI,CAAC,wDAAwD,CAAC;SAC9D,GAAG,CAAC,EAAE,GAAG,mCAAmC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,gCAAgC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,OAAO,uBAAuB,CAC5B,OAAO,EACP,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,0BAA0B,EAC1B,CAAC,KAAK,CAAC,EACP,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAChD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceContext as Client, OperationsListOptionalParams } from \"../index.js\";\nimport {\n _OperationListResult,\n _operationListResultDeserializer,\n Operation,\n} from \"../../models/models.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _operationsListSend(\n context: Client,\n options: OperationsListOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n return context\n .path(\"/providers/Microsoft.AzurePlaywrightService/operations\")\n .get({ ...operationOptionsToRequestParameters(options) });\n}\n\nexport async function _operationsListDeserialize(\n result: PathUncheckedResponse,\n): Promise<_OperationListResult> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _operationListResultDeserializer(result.body);\n}\n\n/** List the operations for the provider */\nexport function operationsList(\n context: Client,\n options: OperationsListOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<Operation> {\n return buildPagedAsyncIterator(\n context,\n () => _operationsListSend(context, options),\n _operationsListDeserialize,\n [\"200\"],\n { itemName: \"value\", nextLinkName: \"nextLink\" },\n );\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { createRestError, operationOptionsToRequestParameters, } from "@azure-re
|
|
|
6
6
|
export function _quotasGetSend(context, subscriptionId, location, quotaName, options = { requestOptions: {} }) {
|
|
7
7
|
return context
|
|
8
8
|
.path("/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}", subscriptionId, location, quotaName)
|
|
9
|
-
.get(
|
|
9
|
+
.get({ ...operationOptionsToRequestParameters(options) });
|
|
10
10
|
}
|
|
11
11
|
export async function _quotasGetDeserialize(result) {
|
|
12
12
|
const expectedStatuses = ["200"];
|
|
@@ -23,7 +23,7 @@ export async function quotasGet(context, subscriptionId, location, quotaName, op
|
|
|
23
23
|
export function _quotasListBySubscriptionSend(context, subscriptionId, location, options = { requestOptions: {} }) {
|
|
24
24
|
return context
|
|
25
25
|
.path("/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas", subscriptionId, location)
|
|
26
|
-
.get(
|
|
26
|
+
.get({ ...operationOptionsToRequestParameters(options) });
|
|
27
27
|
}
|
|
28
28
|
export async function _quotasListBySubscriptionDeserialize(result) {
|
|
29
29
|
const expectedStatuses = ["200"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/quotas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAGL,iBAAiB,EAEjB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,cAAsB,EACtB,QAAgB,EAChB,SAAqB,EACrB,UAAmC,EAAE,cAAc,EAAE,EAAE,EAAE;IAEzD,OAAO,OAAO;SACX,IAAI,CACH,oHAAoH,EACpH,cAAc,EACd,QAAQ,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;AAED,MAAM,UAAU,6BAA6B,CAC3C,OAAe,EACf,cAAsB,EACtB,QAAgB,EAChB,UAAkD,EAAE,cAAc,EAAE,EAAE,EAAE;IAExE,OAAO,OAAO;SACX,IAAI,CACH,wGAAwG,EACxG,cAAc,EACd,QAAQ,CACT;SACA,GAAG,CAAC,EAAE,GAAG,mCAAmC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,cAAsB,EACtB,QAAgB,EAChB,UAAkD,EAAE,cAAc,EAAE,EAAE,EAAE;IAExE,OAAO,uBAAuB,CAC5B,OAAO,EACP,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC/E,oCAAoC,EACpC,CAAC,KAAK,CAAC,EACP,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAChD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n AzurePlaywrightServiceContext as Client,\n QuotasGetOptionalParams,\n QuotasListBySubscriptionOptionalParams,\n} from \"../index.js\";\nimport {\n QuotaNames,\n Quota,\n quotaDeserializer,\n _QuotaListResult,\n _quotaListResultDeserializer,\n} from \"../../models/models.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _quotasGetSend(\n context: Client,\n subscriptionId: string,\n location: string,\n quotaName: QuotaNames,\n options: QuotasGetOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n return context\n .path(\n \"/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}\",\n subscriptionId,\n location,\n quotaName,\n )\n .get({ ...operationOptionsToRequestParameters(options) });\n}\n\nexport async function _quotasGetDeserialize(result: PathUncheckedResponse): Promise<Quota> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return quotaDeserializer(result.body);\n}\n\n/** Get subscription quota by name. */\nexport async function quotasGet(\n context: Client,\n subscriptionId: string,\n location: string,\n quotaName: QuotaNames,\n options: QuotasGetOptionalParams = { requestOptions: {} },\n): Promise<Quota> {\n const result = await _quotasGetSend(context, subscriptionId, location, quotaName, options);\n return _quotasGetDeserialize(result);\n}\n\nexport function _quotasListBySubscriptionSend(\n context: Client,\n subscriptionId: string,\n location: string,\n options: QuotasListBySubscriptionOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n return context\n .path(\n \"/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas\",\n subscriptionId,\n location,\n )\n .get({ ...operationOptionsToRequestParameters(options) });\n}\n\nexport async function _quotasListBySubscriptionDeserialize(\n result: PathUncheckedResponse,\n): Promise<_QuotaListResult> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n throw createRestError(result);\n }\n\n return _quotaListResultDeserializer(result.body);\n}\n\n/** List quotas for a given subscription Id. */\nexport function quotasListBySubscription(\n context: Client,\n subscriptionId: string,\n location: string,\n options: QuotasListBySubscriptionOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<Quota> {\n return buildPagedAsyncIterator(\n context,\n () => _quotasListBySubscriptionSend(context, subscriptionId, location, options),\n _quotasListBySubscriptionDeserialize,\n [\"200\"],\n { itemName: \"value\", nextLinkName: \"nextLink\" },\n );\n}\n"]}
|
|
@@ -6,19 +6,32 @@ import { getQuotasOperations } from "./classic/quotas/index.js";
|
|
|
6
6
|
import { getAccountQuotasOperations, } from "./classic/accountQuotas/index.js";
|
|
7
7
|
import { createAzurePlaywrightService, } from "./api/index.js";
|
|
8
8
|
export class AzurePlaywrightServiceClient {
|
|
9
|
+
_client;
|
|
10
|
+
/** The pipeline used by this client to make requests */
|
|
11
|
+
pipeline;
|
|
9
12
|
/** Microsoft.AzurePlaywrightService Resource Provider Management API. */
|
|
10
13
|
constructor(credential, subscriptionId, options = {}) {
|
|
11
|
-
|
|
12
|
-
const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
|
|
14
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
13
15
|
const userAgentPrefix = prefixFromOptions
|
|
14
16
|
? `${prefixFromOptions} azsdk-js-client`
|
|
15
17
|
: `azsdk-js-client`;
|
|
16
|
-
this._client = createAzurePlaywrightService(credential,
|
|
18
|
+
this._client = createAzurePlaywrightService(credential, {
|
|
19
|
+
...options,
|
|
20
|
+
userAgentOptions: { userAgentPrefix },
|
|
21
|
+
});
|
|
17
22
|
this.pipeline = this._client.pipeline;
|
|
18
23
|
this.operations = getOperationsOperations(this._client);
|
|
19
24
|
this.accounts = getAccountsOperations(this._client, subscriptionId);
|
|
20
25
|
this.quotas = getQuotasOperations(this._client, subscriptionId);
|
|
21
26
|
this.accountQuotas = getAccountQuotasOperations(this._client, subscriptionId);
|
|
22
27
|
}
|
|
28
|
+
/** The operation groups for Operations */
|
|
29
|
+
operations;
|
|
30
|
+
/** The operation groups for Accounts */
|
|
31
|
+
accounts;
|
|
32
|
+
/** The operation groups for Quotas */
|
|
33
|
+
quotas;
|
|
34
|
+
/** The operation groups for AccountQuotas */
|
|
35
|
+
accountQuotas;
|
|
23
36
|
}
|
|
24
37
|
//# sourceMappingURL=azurePlaywrightServiceClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azurePlaywrightServiceClient.js","sourceRoot":"","sources":["../../src/azurePlaywrightServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAsB,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAoB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EACL,0BAA0B,GAE3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,4BAA4B,GAG7B,MAAM,gBAAgB,CAAC;AAMxB,MAAM,OAAO,4BAA4B;
|
|
1
|
+
{"version":3,"file":"azurePlaywrightServiceClient.js","sourceRoot":"","sources":["../../src/azurePlaywrightServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAsB,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAoB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EACL,0BAA0B,GAE3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,4BAA4B,GAG7B,MAAM,gBAAgB,CAAC;AAMxB,MAAM,OAAO,4BAA4B;IAC/B,OAAO,CAAgC;IAC/C,wDAAwD;IACxC,QAAQ,CAAW;IAEnC,yEAAyE;IACzE,YACE,UAA2B,EAC3B,cAAsB,EACtB,UAAsD,EAAE;QAExD,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;QACrE,MAAM,eAAe,GAAG,iBAAiB;YACvC,CAAC,CAAC,GAAG,iBAAiB,kBAAkB;YACxC,CAAC,CAAC,iBAAiB,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,4BAA4B,CAAC,UAAU,EAAE;YACtD,GAAG,OAAO;YACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAChE,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAChF,CAAC;IAED,0CAA0C;IAC1B,UAAU,CAAuB;IACjD,wCAAwC;IACxB,QAAQ,CAAqB;IAC7C,sCAAsC;IACtB,MAAM,CAAmB;IACzC,6CAA6C;IAC7B,aAAa,CAA0B;CACxD","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getOperationsOperations, OperationsOperations } from \"./classic/operations/index.js\";\nimport { getAccountsOperations, AccountsOperations } from \"./classic/accounts/index.js\";\nimport { getQuotasOperations, QuotasOperations } from \"./classic/quotas/index.js\";\nimport {\n getAccountQuotasOperations,\n AccountQuotasOperations,\n} from \"./classic/accountQuotas/index.js\";\nimport {\n createAzurePlaywrightService,\n AzurePlaywrightServiceContext,\n AzurePlaywrightServiceClientOptionalParams,\n} from \"./api/index.js\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport { AzurePlaywrightServiceClientOptionalParams } from \"./api/azurePlaywrightServiceContext.js\";\n\nexport class AzurePlaywrightServiceClient {\n private _client: AzurePlaywrightServiceContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n /** Microsoft.AzurePlaywrightService Resource Provider Management API. */\n constructor(\n credential: TokenCredential,\n subscriptionId: string,\n options: AzurePlaywrightServiceClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createAzurePlaywrightService(credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.operations = getOperationsOperations(this._client);\n this.accounts = getAccountsOperations(this._client, subscriptionId);\n this.quotas = getQuotasOperations(this._client, subscriptionId);\n this.accountQuotas = getAccountQuotasOperations(this._client, subscriptionId);\n }\n\n /** The operation groups for Operations */\n public readonly operations: OperationsOperations;\n /** The operation groups for Accounts */\n public readonly accounts: AccountsOperations;\n /** The operation groups for Quotas */\n public readonly quotas: QuotasOperations;\n /** The operation groups for AccountQuotas */\n public readonly accountQuotas: AccountQuotasOperations;\n}\n"]}
|
|
@@ -8,6 +8,8 @@ export function getAccountQuotas(context, subscriptionId) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export function getAccountQuotasOperations(context, subscriptionId) {
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
...getAccountQuotas(context, subscriptionId),
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/accountQuotas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAyBhG,MAAM,UAAU,gBAAgB,CAAC,OAAsC,EAAE,cAAsB;IAC7F,OAAO;QACL,GAAG,EAAE,CACH,iBAAyB,EACzB,WAAmB,EACnB,SAAqB,EACrB,OAAwC,EACxC,EAAE,CACF,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;QAC/F,aAAa,EAAE,CACb,iBAAyB,EACzB,WAAmB,EACnB,OAAkD,EAClD,EAAE,CACF,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;KAC/F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,cAAsB;IAEtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/accountQuotas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAyBhG,MAAM,UAAU,gBAAgB,CAAC,OAAsC,EAAE,cAAsB;IAC7F,OAAO;QACL,GAAG,EAAE,CACH,iBAAyB,EACzB,WAAmB,EACnB,SAAqB,EACrB,OAAwC,EACxC,EAAE,CACF,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;QAC/F,aAAa,EAAE,CACb,iBAAyB,EACzB,WAAmB,EACnB,OAAkD,EAClD,EAAE,CACF,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;KAC/F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,cAAsB;IAEtB,OAAO;QACL,GAAG,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC;KAC7C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceContext } from \"../../api/azurePlaywrightServiceContext.js\";\nimport { accountQuotasGet, accountQuotasListByAccount } from \"../../api/accountQuotas/index.js\";\nimport { AccountQuota, QuotaNames } from \"../../models/models.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport {\n AccountQuotasGetOptionalParams,\n AccountQuotasListByAccountOptionalParams,\n} from \"../../api/options.js\";\n\n/** Interface representing a AccountQuotas operations. */\nexport interface AccountQuotasOperations {\n /** Get quota by name for an account. */\n get: (\n resourceGroupName: string,\n accountName: string,\n quotaName: QuotaNames,\n options?: AccountQuotasGetOptionalParams,\n ) => Promise<AccountQuota>;\n /** List quotas for a given account. */\n listByAccount: (\n resourceGroupName: string,\n accountName: string,\n options?: AccountQuotasListByAccountOptionalParams,\n ) => PagedAsyncIterableIterator<AccountQuota>;\n}\n\nexport function getAccountQuotas(context: AzurePlaywrightServiceContext, subscriptionId: string) {\n return {\n get: (\n resourceGroupName: string,\n accountName: string,\n quotaName: QuotaNames,\n options?: AccountQuotasGetOptionalParams,\n ) =>\n accountQuotasGet(context, subscriptionId, resourceGroupName, accountName, quotaName, options),\n listByAccount: (\n resourceGroupName: string,\n accountName: string,\n options?: AccountQuotasListByAccountOptionalParams,\n ) =>\n accountQuotasListByAccount(context, subscriptionId, resourceGroupName, accountName, options),\n };\n}\n\nexport function getAccountQuotasOperations(\n context: AzurePlaywrightServiceContext,\n subscriptionId: string,\n): AccountQuotasOperations {\n return {\n ...getAccountQuotas(context, subscriptionId),\n };\n}\n"]}
|
|
@@ -13,6 +13,8 @@ export function getAccounts(context, subscriptionId) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export function getAccountsOperations(context, subscriptionId) {
|
|
16
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
...getAccounts(context, subscriptionId),
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/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cAAc,EAAE,IAAI,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,cAAsB;IAEtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/accounts/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AA+DrC,MAAM,UAAU,WAAW,CAAC,OAAsC,EAAE,cAAsB;IACxF,OAAO;QACL,GAAG,EAAE,CAAC,iBAAyB,EAAE,WAAmB,EAAE,OAAmC,EAAE,EAAE,CAC3F,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;QAC/E,cAAc,EAAE,CACd,iBAAyB,EACzB,WAAmB,EACnB,QAAiB,EACjB,OAA8C,EAC9C,EAAE,CACF,sBAAsB,CACpB,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,OAAO,CACR;QACH,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,UAAyB,EACzB,OAAsC,EACtC,EAAE,CACF,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;QAC9F,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,OAAsC,EACtC,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;QACrF,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAmD,EACnD,EAAE,CAAC,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,CAAC;QACrF,kBAAkB,EAAE,CAAC,OAAkD,EAAE,EAAE,CACzE,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC;QAC9D,qBAAqB,EAAE,CACrB,IAAkC,EAClC,OAAqD,EACrD,EAAE,CAAC,6BAA6B,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,cAAsB;IAEtB,OAAO;QACL,GAAG,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC;KACxC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceContext } from \"../../api/azurePlaywrightServiceContext.js\";\nimport {\n accountsGet,\n accountsCreateOrUpdate,\n accountsUpdate,\n accountsDelete,\n accountsListByResourceGroup,\n accountsListBySubscription,\n accountsCheckNameAvailability,\n} from \"../../api/accounts/index.js\";\nimport {\n Account,\n AccountUpdate,\n CheckNameAvailabilityRequest,\n CheckNameAvailabilityResponse,\n} from \"../../models/models.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\nimport {\n AccountsGetOptionalParams,\n AccountsCreateOrUpdateOptionalParams,\n AccountsUpdateOptionalParams,\n AccountsDeleteOptionalParams,\n AccountsListByResourceGroupOptionalParams,\n AccountsListBySubscriptionOptionalParams,\n AccountsCheckNameAvailabilityOptionalParams,\n} from \"../../api/options.js\";\n\n/** Interface representing a Accounts operations. */\nexport interface AccountsOperations {\n /** Get a Account */\n get: (\n resourceGroupName: string,\n accountName: string,\n options?: AccountsGetOptionalParams,\n ) => Promise<Account>;\n /** Create a Account */\n createOrUpdate: (\n resourceGroupName: string,\n accountName: string,\n resource: Account,\n options?: AccountsCreateOrUpdateOptionalParams,\n ) => PollerLike<OperationState<Account>, Account>;\n /** Update a Account */\n update: (\n resourceGroupName: string,\n accountName: string,\n properties: AccountUpdate,\n options?: AccountsUpdateOptionalParams,\n ) => Promise<Account>;\n /** Delete a Account */\n delete: (\n resourceGroupName: string,\n accountName: string,\n options?: AccountsDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** List Account resources by resource group */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: AccountsListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<Account>;\n /** List Account resources by subscription ID */\n listBySubscription: (\n options?: AccountsListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<Account>;\n /** Adds check global name availability operation, normally used if a resource name must be globally unique. */\n checkNameAvailability: (\n body: CheckNameAvailabilityRequest,\n options?: AccountsCheckNameAvailabilityOptionalParams,\n ) => Promise<CheckNameAvailabilityResponse>;\n}\n\nexport function getAccounts(context: AzurePlaywrightServiceContext, subscriptionId: string) {\n return {\n get: (resourceGroupName: string, accountName: string, options?: AccountsGetOptionalParams) =>\n accountsGet(context, subscriptionId, resourceGroupName, accountName, options),\n createOrUpdate: (\n resourceGroupName: string,\n accountName: string,\n resource: Account,\n options?: AccountsCreateOrUpdateOptionalParams,\n ) =>\n accountsCreateOrUpdate(\n context,\n subscriptionId,\n resourceGroupName,\n accountName,\n resource,\n options,\n ),\n update: (\n resourceGroupName: string,\n accountName: string,\n properties: AccountUpdate,\n options?: AccountsUpdateOptionalParams,\n ) =>\n accountsUpdate(context, subscriptionId, resourceGroupName, accountName, properties, options),\n delete: (\n resourceGroupName: string,\n accountName: string,\n options?: AccountsDeleteOptionalParams,\n ) => accountsDelete(context, subscriptionId, resourceGroupName, accountName, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: AccountsListByResourceGroupOptionalParams,\n ) => accountsListByResourceGroup(context, subscriptionId, resourceGroupName, options),\n listBySubscription: (options?: AccountsListBySubscriptionOptionalParams) =>\n accountsListBySubscription(context, subscriptionId, options),\n checkNameAvailability: (\n body: CheckNameAvailabilityRequest,\n options?: AccountsCheckNameAvailabilityOptionalParams,\n ) => accountsCheckNameAvailability(context, subscriptionId, body, options),\n };\n}\n\nexport function getAccountsOperations(\n context: AzurePlaywrightServiceContext,\n subscriptionId: string,\n): AccountsOperations {\n return {\n ...getAccounts(context, subscriptionId),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAW/D,MAAM,UAAU,aAAa,CAAC,OAAsC;IAClE,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACnF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,OAAsC;IAEtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAW/D,MAAM,UAAU,aAAa,CAAC,OAAsC;IAClE,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACnF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,OAAsC;IAEtC,OAAO;QACL,GAAG,aAAa,CAAC,OAAO,CAAC;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceContext } from \"../../api/azurePlaywrightServiceContext.js\";\nimport { operationsList } from \"../../api/operations/index.js\";\nimport { OperationsListOptionalParams } from \"../../api/options.js\";\nimport { Operation } from \"../../models/models.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Operations operations. */\nexport interface OperationsOperations {\n /** List the operations for the provider */\n list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator<Operation>;\n}\n\nexport function getOperations(context: AzurePlaywrightServiceContext) {\n return {\n list: (options?: OperationsListOptionalParams) => operationsList(context, options),\n };\n}\n\nexport function getOperationsOperations(\n context: AzurePlaywrightServiceContext,\n): OperationsOperations {\n return {\n ...getOperations(context),\n };\n}\n"]}
|
|
@@ -8,6 +8,8 @@ export function getQuotas(context, subscriptionId) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export function getQuotasOperations(context, subscriptionId) {
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
...getQuotas(context, subscriptionId),
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/quotas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAmBhF,MAAM,UAAU,SAAS,CAAC,OAAsC,EAAE,cAAsB;IACtF,OAAO;QACL,GAAG,EAAE,CAAC,QAAgB,EAAE,SAAqB,EAAE,OAAiC,EAAE,EAAE,CAClF,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;QAClE,kBAAkB,EAAE,CAAC,QAAgB,EAAE,OAAgD,EAAE,EAAE,CACzF,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC;KACvE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAAsC,EACtC,cAAsB;IAEtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/quotas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAmBhF,MAAM,UAAU,SAAS,CAAC,OAAsC,EAAE,cAAsB;IACtF,OAAO;QACL,GAAG,EAAE,CAAC,QAAgB,EAAE,SAAqB,EAAE,OAAiC,EAAE,EAAE,CAClF,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;QAClE,kBAAkB,EAAE,CAAC,QAAgB,EAAE,OAAgD,EAAE,EAAE,CACzF,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC;KACvE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAAsC,EACtC,cAAsB;IAEtB,OAAO;QACL,GAAG,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC;KACtC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceContext } from \"../../api/azurePlaywrightServiceContext.js\";\nimport {\n QuotasGetOptionalParams,\n QuotasListBySubscriptionOptionalParams,\n} from \"../../api/options.js\";\nimport { quotasGet, quotasListBySubscription } from \"../../api/quotas/index.js\";\nimport { QuotaNames, Quota } from \"../../models/models.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Quotas operations. */\nexport interface QuotasOperations {\n /** Get subscription quota by name. */\n get: (\n location: string,\n quotaName: QuotaNames,\n options?: QuotasGetOptionalParams,\n ) => Promise<Quota>;\n /** List quotas for a given subscription Id. */\n listBySubscription: (\n location: string,\n options?: QuotasListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<Quota>;\n}\n\nexport function getQuotas(context: AzurePlaywrightServiceContext, subscriptionId: string) {\n return {\n get: (location: string, quotaName: QuotaNames, options?: QuotasGetOptionalParams) =>\n quotasGet(context, subscriptionId, location, quotaName, options),\n listBySubscription: (location: string, options?: QuotasListBySubscriptionOptionalParams) =>\n quotasListBySubscription(context, subscriptionId, location, options),\n };\n}\n\nexport function getQuotasOperations(\n context: AzurePlaywrightServiceContext,\n subscriptionId: string,\n): QuotasOperations {\n return {\n ...getQuotas(context, subscriptionId),\n };\n}\n"]}
|
|
@@ -9,21 +9,20 @@ import { deserializeState, } from "@azure/core-lro";
|
|
|
9
9
|
* needs to be constructed after the original one is not in scope.
|
|
10
10
|
*/
|
|
11
11
|
export function restorePoller(client, serializedState, sourceOperation, options) {
|
|
12
|
-
var _a, _b, _c;
|
|
13
12
|
const pollerConfig = deserializeState(serializedState).config;
|
|
14
13
|
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
15
14
|
if (!initialRequestUrl || !requestMethod) {
|
|
16
|
-
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation
|
|
15
|
+
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
|
|
17
16
|
}
|
|
18
|
-
const resourceLocationConfig = metadata
|
|
19
|
-
const { deserializer, expectedStatuses = [] } =
|
|
20
|
-
const deserializeHelper =
|
|
17
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
18
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
19
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
21
20
|
if (!deserializeHelper) {
|
|
22
|
-
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation
|
|
21
|
+
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
23
22
|
}
|
|
24
|
-
return getLongRunningPoller(
|
|
25
|
-
updateIntervalInMs: options
|
|
26
|
-
abortSignal: options
|
|
23
|
+
return getLongRunningPoller(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
24
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
25
|
+
abortSignal: options?.abortSignal,
|
|
27
26
|
resourceLocationConfig,
|
|
28
27
|
restoreFrom: serializedState,
|
|
29
28
|
initialRequestUrl,
|
|
@@ -40,7 +39,6 @@ const deserializeMap = {
|
|
|
40
39
|
},
|
|
41
40
|
};
|
|
42
41
|
function getDeserializationHelper(urlStr, method) {
|
|
43
|
-
var _a, _b, _c, _d;
|
|
44
42
|
const path = new URL(urlStr).pathname;
|
|
45
43
|
const pathParts = path.split("/");
|
|
46
44
|
// Traverse list to match the longest candidate
|
|
@@ -60,13 +58,13 @@ function getDeserializationHelper(urlStr, method) {
|
|
|
60
58
|
// track if we have found a match to return the values found.
|
|
61
59
|
let found = true;
|
|
62
60
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
63
|
-
if (
|
|
64
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
61
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
62
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
65
63
|
// If the current part of the candidate is a "template" part
|
|
66
64
|
// Try to use the suffix of pattern to match the path
|
|
67
65
|
// {guid} ==> $
|
|
68
66
|
// {guid}:export ==> :export$
|
|
69
|
-
const isMatched = new RegExp(`${
|
|
67
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
70
68
|
if (!isMatched) {
|
|
71
69
|
found = false;
|
|
72
70
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OA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CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzurePlaywrightServiceClient } from \"./azurePlaywrightServiceClient.js\";\nimport {\n _accountsCreateOrUpdateDeserialize,\n _accountsDeleteDeserialize,\n} from \"./api/accounts/index.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: AzurePlaywrightServiceClient,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}\":\n {\n deserializer: _accountsCreateOrUpdateDeserialize,\n expectedStatuses: [\"200\", \"201\"],\n },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}\":\n {\n deserializer: _accountsDeleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
3
|
import { createRestError } from "@azure-rest/core-client";
|
|
5
4
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
6
5
|
/**
|
|
7
6
|
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
8
7
|
*/
|
|
9
8
|
export function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const nextLinkName = (_b = options.nextLinkName) !== null && _b !== void 0 ? _b : "nextLink";
|
|
9
|
+
const itemName = options.itemName ?? "value";
|
|
10
|
+
const nextLinkName = options.nextLinkName ?? "nextLink";
|
|
13
11
|
const pagedResult = {
|
|
14
12
|
getPage: async (pageLink) => {
|
|
15
13
|
const result = pageLink === undefined
|
|
@@ -25,7 +23,7 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
25
23
|
};
|
|
26
24
|
},
|
|
27
25
|
byPage: (settings) => {
|
|
28
|
-
const { continuationToken } = settings
|
|
26
|
+
const { continuationToken } = settings ?? {};
|
|
29
27
|
return getPageAsyncIterator(pagedResult, {
|
|
30
28
|
pageLink: continuationToken,
|
|
31
29
|
});
|
|
@@ -41,7 +39,6 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
41
39
|
* @returns a paged async iterator that iterates over results.
|
|
42
40
|
*/
|
|
43
41
|
function getPagedAsyncIterator(pagedResult) {
|
|
44
|
-
var _a;
|
|
45
42
|
const iter = getItemAsyncIterator(pagedResult);
|
|
46
43
|
return {
|
|
47
44
|
next() {
|
|
@@ -50,55 +47,39 @@ function getPagedAsyncIterator(pagedResult) {
|
|
|
50
47
|
[Symbol.asyncIterator]() {
|
|
51
48
|
return this;
|
|
52
49
|
},
|
|
53
|
-
byPage:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
byPage: pagedResult?.byPage ??
|
|
51
|
+
((settings) => {
|
|
52
|
+
const { continuationToken } = settings ?? {};
|
|
53
|
+
return getPageAsyncIterator(pagedResult, {
|
|
54
|
+
pageLink: continuationToken,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
|
-
function getItemAsyncIterator(pagedResult) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (var _d = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _d = true) {
|
|
67
|
-
_c = pages_1_1.value;
|
|
68
|
-
_d = false;
|
|
69
|
-
const page = _c;
|
|
70
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
|
-
finally {
|
|
75
|
-
try {
|
|
76
|
-
if (!_d && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
|
|
77
|
-
}
|
|
78
|
-
finally { if (e_1) throw e_1.error; }
|
|
79
|
-
}
|
|
80
|
-
});
|
|
59
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
60
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
61
|
+
for await (const page of pages) {
|
|
62
|
+
yield* page;
|
|
63
|
+
}
|
|
81
64
|
}
|
|
82
|
-
function getPageAsyncIterator(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
async function* getPageAsyncIterator(pagedResult, options = {}) {
|
|
66
|
+
const { pageLink } = options;
|
|
67
|
+
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
|
|
68
|
+
if (!response) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let result = response.page;
|
|
72
|
+
result.continuationToken = response.nextPageLink;
|
|
73
|
+
yield result;
|
|
74
|
+
while (response.nextPageLink) {
|
|
75
|
+
response = await pagedResult.getPage(response.nextPageLink);
|
|
86
76
|
if (!response) {
|
|
87
|
-
return
|
|
77
|
+
return;
|
|
88
78
|
}
|
|
89
|
-
|
|
79
|
+
result = response.page;
|
|
90
80
|
result.continuationToken = response.nextPageLink;
|
|
91
|
-
yield
|
|
92
|
-
|
|
93
|
-
response = yield __await(pagedResult.getPage(response.nextPageLink));
|
|
94
|
-
if (!response) {
|
|
95
|
-
return yield __await(void 0);
|
|
96
|
-
}
|
|
97
|
-
result = response.page;
|
|
98
|
-
result.continuationToken = response.nextPageLink;
|
|
99
|
-
yield yield __await(result);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
81
|
+
yield result;
|
|
82
|
+
}
|
|
102
83
|
}
|
|
103
84
|
/**
|
|
104
85
|
* Gets for the value of nextLink in the body
|
|
@@ -124,7 +105,7 @@ function getElements(body, itemName) {
|
|
|
124
105
|
if (!Array.isArray(value)) {
|
|
125
106
|
throw new RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
126
107
|
}
|
|
127
|
-
return value
|
|
108
|
+
return value ?? [];
|
|
128
109
|
}
|
|
129
110
|
/**
|
|
130
111
|
* Checks if a request failed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA+EtD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAMrC,MAAc,EACd,kBAAgD,EAChD,mBAAgE,EAChE,gBAA0B,EAC1B,UAA0C,EAAE;;IAE5C,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC;IAC7C,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,UAAU,CAAC;IACxD,MAAM,WAAW,GAAgD;QAC/D,OAAO,EAAE,KAAK,EAAE,QAAiB,EAAE,EAAE;YACnC,MAAM,MAAM,GACV,QAAQ,KAAK,SAAS;gBACpB,CAAC,CAAC,MAAM,kBAAkB,EAAE;gBAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;YACjD,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,MAAmB,CAAC,CAAC;YAC/D,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACpD,MAAM,MAAM,GAAG,WA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AoD,OAAO,QAAQ,EAAE,CACnG,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pagingHelpers.js","sourceRoot":"","sources":["../../../src/static-helpers/pagingHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA+EtD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAMrC,MAAc,EACd,kBAAgD,EAChD,mBAAgE,EAChE,gBAA0B,EAC1B,UAA0C,EAAE;IAE5C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;IAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,UAAU,CAAC;IACxD,MAAM,WAAW,GAAgD;QAC/D,OAAO,EAAE,KAAK,EAAE,QAAiB,EAAE,E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AEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACzF,MAAM,IAAI,SAAS,CACjB,iBAAiB,YAAY,oDAAoD,OAAO,QAAQ,EAAE,CACnG,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B,EAAE,gBAA0B;IACrF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\n/**\n * Options for the byPage method\n */\nexport interface PageSettings {\n /**\n * A reference to a specific page to start iterating from.\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that describes a page of results.\n */\nexport type ContinuablePage<TElement, TPage = TElement[]> = TPage & {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n};\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n> {\n /**\n * Link to the first page of results.\n */\n firstPageLink?: string;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => TElement[];\n}\n\n/**\n * Options for the paging helper\n */\nexport interface BuildPagedAsyncIteratorOptions {\n itemName?: string;\n nextLinkName?: string;\n}\n\n/**\n * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator\n */\nexport function buildPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n>(\n client: Client,\n getInitialResponse: () => PromiseLike<TResponse>,\n processResponseBody: (result: TResponse) => PromiseLike<unknown>,\n expectedStatuses: string[],\n options: BuildPagedAsyncIteratorOptions = {},\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const itemName = options.itemName ?? \"value\";\n const nextLinkName = options.nextLinkName ?? \"nextLink\";\n const pagedResult: PagedResult<TElement, TPage, TPageSettings> = {\n getPage: async (pageLink?: string) => {\n const result =\n pageLink === undefined\n ? await getInitialResponse()\n : await client.pathUnchecked(pageLink).get();\n checkPagingRequest(result, expectedStatuses);\n const results = await processResponseBody(result as TResponse);\n const nextLink = getNextLink(results, nextLinkName);\n const values = getElements<TElement>(results, itemName) as TPage;\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n byPage: (settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n },\n };\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\n\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings extends PageSettings = PageSettings,\n>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: TPageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n for await (const page of pages) {\n yield* page as unknown as TElement[];\n }\n}\n\nasync function* getPageAsyncIterator<TElement, TPage, TPageSettings extends PageSettings>(\n pagedResult: PagedResult<TElement, TPage, TPageSettings>,\n options: {\n pageLink?: string;\n } = {},\n): AsyncIterableIterator<ContinuablePage<TElement, TPage>> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n let result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n result = response.page as ContinuablePage<TElement, TPage>;\n result.continuationToken = response.nextPageLink;\n yield result;\n }\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\" && nextLink !== null) {\n throw new RestError(\n `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`,\n );\n }\n\n if (nextLink === null) {\n return undefined;\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n if (!Array.isArray(value)) {\n throw new RestError(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {\n if (!expectedStatuses.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n"]}
|