@azure-rest/arm-appservice 1.0.0-beta.1 → 1.0.0-beta.3
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 +21 -0
- package/LICENSE +4 -4
- package/README.md +35 -23
- package/dist/browser/clientDefinitions.d.ts +3273 -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/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 +654 -0
- package/dist/browser/isUnexpected.d.ts.map +1 -0
- package/dist/browser/isUnexpected.js +761 -0
- 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 +4422 -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 +6074 -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-esm/src → dist/browser}/paginateHelper.js +70 -3
- package/dist/browser/paginateHelper.js.map +1 -0
- package/dist/browser/parameters.d.ts +2468 -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 +107 -0
- package/dist/browser/pollingHelper.js.map +1 -0
- package/dist/browser/responses.d.ts +7390 -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/webSiteManagementClient.d.ts +15 -0
- package/dist/browser/webSiteManagementClient.d.ts.map +1 -0
- package/dist/browser/webSiteManagementClient.js +44 -0
- package/dist/browser/webSiteManagementClient.js.map +1 -0
- package/dist/commonjs/clientDefinitions.d.ts +3273 -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/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 +654 -0
- package/dist/commonjs/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/isUnexpected.js +764 -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 +4422 -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 +6074 -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 +140 -0
- package/dist/commonjs/paginateHelper.js.map +1 -0
- package/dist/commonjs/parameters.d.ts +2468 -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 +110 -0
- package/dist/commonjs/pollingHelper.js.map +1 -0
- package/dist/commonjs/responses.d.ts +7390 -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/tsdoc-metadata.json +11 -0
- package/dist/commonjs/webSiteManagementClient.d.ts +15 -0
- package/dist/commonjs/webSiteManagementClient.d.ts.map +1 -0
- package/dist/commonjs/webSiteManagementClient.js +47 -0
- package/dist/commonjs/webSiteManagementClient.js.map +1 -0
- package/dist/esm/clientDefinitions.d.ts +3273 -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/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 +654 -0
- package/dist/esm/isUnexpected.d.ts.map +1 -0
- package/dist/esm/isUnexpected.js +761 -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 +4422 -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 +6074 -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 +137 -0
- package/dist/esm/paginateHelper.js.map +1 -0
- package/dist/esm/parameters.d.ts +2468 -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 +107 -0
- package/dist/esm/pollingHelper.js.map +1 -0
- package/dist/esm/responses.d.ts +7390 -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/webSiteManagementClient.d.ts +15 -0
- package/dist/esm/webSiteManagementClient.d.ts.map +1 -0
- package/dist/esm/webSiteManagementClient.js +44 -0
- package/dist/esm/webSiteManagementClient.js.map +1 -0
- package/dist/react-native/clientDefinitions.d.ts +3273 -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/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 +654 -0
- package/dist/react-native/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/isUnexpected.js +761 -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 +4422 -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 +6074 -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 +137 -0
- package/dist/react-native/paginateHelper.js.map +1 -0
- package/dist/react-native/parameters.d.ts +2468 -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 +107 -0
- package/dist/react-native/pollingHelper.js.map +1 -0
- package/dist/react-native/responses.d.ts +7390 -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/webSiteManagementClient.d.ts +15 -0
- package/dist/react-native/webSiteManagementClient.d.ts.map +1 -0
- package/dist/react-native/webSiteManagementClient.js +44 -0
- package/dist/react-native/webSiteManagementClient.js.map +1 -0
- package/package.json +87 -80
- package/review/{arm-appservice.api.md → arm-appservice-node.api.md} +5443 -4440
- package/dist/index.js +0 -144
- 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/index.js +0 -13
- package/dist-esm/src/index.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.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 -46
- 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/webSiteManagementClient.js +0 -21
- package/dist-esm/src/webSiteManagementClient.js.map +0 -1
- package/types/arm-appservice.d.ts +0 -27921
package/dist/index.js
DELETED
|
@@ -1,144 +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
|
-
function createClient(credentials, options = {}) {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : "https://management.azure.com";
|
|
13
|
-
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2021-03-01";
|
|
14
|
-
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
15
|
-
scopes: ["https://management.azure.com/.default"],
|
|
16
|
-
} });
|
|
17
|
-
const userAgentInfo = `azsdk-js-arm-appservice-rest/1.0.0-beta.1`;
|
|
18
|
-
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
19
|
-
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
20
|
-
: `${userAgentInfo}`;
|
|
21
|
-
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
22
|
-
userAgentPrefix,
|
|
23
|
-
} });
|
|
24
|
-
const client = coreClient.getClient(baseUrl, credentials, options);
|
|
25
|
-
return client;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Copyright (c) Microsoft Corporation.
|
|
29
|
-
/**
|
|
30
|
-
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
31
|
-
* @param client - Client to use for sending the next page requests
|
|
32
|
-
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
33
|
-
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
34
|
-
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
35
|
-
*/
|
|
36
|
-
function paginate(client, initialResponse, options = {}) {
|
|
37
|
-
let firstRun = true;
|
|
38
|
-
const itemName = "value";
|
|
39
|
-
const nextLinkName = "nextLink";
|
|
40
|
-
const { customGetPage } = options;
|
|
41
|
-
const pagedResult = {
|
|
42
|
-
firstPageLink: "",
|
|
43
|
-
getPage: typeof customGetPage === "function"
|
|
44
|
-
? customGetPage
|
|
45
|
-
: async (pageLink) => {
|
|
46
|
-
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
47
|
-
firstRun = false;
|
|
48
|
-
checkPagingRequest(result);
|
|
49
|
-
const nextLink = getNextLink(result.body, nextLinkName);
|
|
50
|
-
const values = getElements(result.body, itemName);
|
|
51
|
-
return {
|
|
52
|
-
page: values,
|
|
53
|
-
nextPageLink: nextLink,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
return corePaging.getPagedAsyncIterator(pagedResult);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Gets for the value of nextLink in the body
|
|
61
|
-
*/
|
|
62
|
-
function getNextLink(body, nextLinkName) {
|
|
63
|
-
if (!nextLinkName) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
const nextLink = body[nextLinkName];
|
|
67
|
-
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
68
|
-
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
69
|
-
}
|
|
70
|
-
return nextLink;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Gets the elements of the current request in the body.
|
|
74
|
-
*/
|
|
75
|
-
function getElements(body, itemName) {
|
|
76
|
-
const value = body[itemName];
|
|
77
|
-
// value has to be an array according to the x-ms-pageable extension.
|
|
78
|
-
// The fact that this must be an array is used above to calculate the
|
|
79
|
-
// type of elements in the page in PaginateReturn
|
|
80
|
-
if (!Array.isArray(value)) {
|
|
81
|
-
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
82
|
-
}
|
|
83
|
-
return value !== null && value !== void 0 ? value : [];
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Checks if a request failed
|
|
87
|
-
*/
|
|
88
|
-
function checkPagingRequest(response) {
|
|
89
|
-
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
90
|
-
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
91
|
-
throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Copyright (c) Microsoft Corporation.
|
|
96
|
-
/**
|
|
97
|
-
* Helper function that builds a Poller object to help polling a long running operation.
|
|
98
|
-
* @param client - Client to use for sending the request to get additional pages.
|
|
99
|
-
* @param initialResponse - The initial response.
|
|
100
|
-
* @param options - Options to set a resume state or custom polling interval.
|
|
101
|
-
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
102
|
-
*/
|
|
103
|
-
function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
104
|
-
const poller = {
|
|
105
|
-
requestMethod: initialResponse.request.method,
|
|
106
|
-
requestPath: initialResponse.request.url,
|
|
107
|
-
sendInitialRequest: async () => {
|
|
108
|
-
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
|
109
|
-
// we are not triggering the initial request here, just extracting the information from the
|
|
110
|
-
// response we were provided.
|
|
111
|
-
return getLroResponse(initialResponse);
|
|
112
|
-
},
|
|
113
|
-
sendPollRequest: async (path) => {
|
|
114
|
-
// This is the callback that is going to be called to poll the service
|
|
115
|
-
// to get the latest status. We use the client provided and the polling path
|
|
116
|
-
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
|
117
|
-
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
|
118
|
-
const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
|
|
119
|
-
return getLroResponse(response);
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
return new coreLro.LroEngine(poller, options);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Converts a Rest Client response to a response that the LRO engine knows about
|
|
126
|
-
* @param response - a rest client http response
|
|
127
|
-
* @returns - An LRO response that the LRO engine can work with
|
|
128
|
-
*/
|
|
129
|
-
function getLroResponse(response) {
|
|
130
|
-
if (Number.isNaN(response.status)) {
|
|
131
|
-
throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
flatResponse: response,
|
|
135
|
-
rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Copyright (c) Microsoft Corporation.
|
|
140
|
-
|
|
141
|
-
exports["default"] = createClient;
|
|
142
|
-
exports.getLongRunningPoller = getLongRunningPoller;
|
|
143
|
-
exports.paginate = paginate;
|
|
144
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/webSiteManagementClient.ts","../src/paginateHelper.ts","../src/pollingHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { WebSiteManagementClient } from \"./clientDefinitions\";\n\nexport default function createClient(\n credentials: TokenCredential,\n options: ClientOptions = {}\n): WebSiteManagementClient {\n const baseUrl = options.baseUrl ?? \"https://management.azure.com\";\n options.apiVersion = options.apiVersion ?? \"2021-03-01\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://management.azure.com/.default\"],\n },\n };\n\n const userAgentInfo = `azsdk-js-arm-appservice-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as WebSiteManagementClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\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\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or 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\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\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): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport {\n LongRunningOperation,\n LroEngine,\n LroEngineOptions,\n LroResponse,\n PollerLike,\n PollOperationState,\n} from \"@azure/core-lro\";\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}\n): PollerLike<PollOperationState<TResult>, TResult> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n return getLroResponse(response as TResult);\n },\n };\n\n return new LroEngine(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO engine knows about\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO engine can work with\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport WebSiteManagementClient from \"./webSiteManagementClient\";\n\nexport * from \"./webSiteManagementClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\nexport * from \"./pollingHelper\";\n\nexport default WebSiteManagementClient;\n"],"names":["getClient","getPagedAsyncIterator","createRestError","LroEngine"],"mappings":";;;;;;;;AAAA;AAOwB,SAAA,YAAY,CAClC,WAA4B,EAC5B,UAAyB,EAAE,EAAA;;IAE3B,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,8BAA8B,CAAC;IAClE,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY,CAAC;AACxD,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,uCAAuC,CAAC;AAClD,SAAA,EAAA,CACF,CAAC;IAEF,MAAM,aAAa,GAAG,CAAA,yCAAA,CAA2C,CAAC;IAClE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;UAChE,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAI,CAAA,EAAA,aAAa,CAAE,CAAA;AAChE,UAAE,CAAA,EAAG,aAAa,CAAA,CAAE,CAAC;AACzB,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,gBAAgB,EAAE;YAChB,eAAe;AAChB,SAAA,EAAA,CACF,CAAC;IAEF,MAAM,MAAM,GAAGA,oBAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA4B,CAAC;AAEnF,IAAA,OAAO,MAAM,CAAC;AAChB;;ACnCA;AA6CA;;;;;;AAMG;AACG,S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