@azure-rest/iot-device-update 1.0.1-alpha.20241219.1 → 1.1.0-alpha.20241223.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/clientDefinitions.d.ts +51 -51
- package/dist/browser/clientDefinitions.js.map +1 -1
- package/dist/browser/deviceUpdate.d.ts +12 -1
- package/dist/browser/deviceUpdate.d.ts.map +1 -1
- package/dist/browser/deviceUpdate.js +31 -9
- package/dist/browser/deviceUpdate.js.map +1 -1
- package/dist/browser/isUnexpected.d.ts +51 -51
- package/dist/browser/isUnexpected.js +37 -30
- package/dist/browser/isUnexpected.js.map +1 -1
- 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 +11 -10
- package/dist/browser/models.d.ts.map +1 -1
- package/dist/browser/models.js.map +1 -1
- package/dist/browser/outputModels.d.ts +53 -5
- package/dist/browser/outputModels.d.ts.map +1 -1
- package/dist/browser/outputModels.js.map +1 -1
- package/dist/browser/paginateHelper.d.ts +27 -2
- package/dist/browser/paginateHelper.d.ts.map +1 -1
- package/dist/browser/paginateHelper.js +98 -1
- package/dist/browser/paginateHelper.js.map +1 -1
- package/dist/browser/parameters.d.ts +7 -5
- package/dist/browser/parameters.d.ts.map +1 -1
- package/dist/browser/parameters.js.map +1 -1
- package/dist/browser/pollingHelper.d.ts +67 -2
- package/dist/browser/pollingHelper.d.ts.map +1 -1
- package/dist/browser/pollingHelper.js +65 -9
- package/dist/browser/pollingHelper.js.map +1 -1
- package/dist/browser/responses.d.ts +50 -62
- package/dist/browser/responses.d.ts.map +1 -1
- package/dist/browser/responses.js.map +1 -1
- package/dist/commonjs/clientDefinitions.d.ts +51 -51
- package/dist/commonjs/clientDefinitions.js.map +1 -1
- package/dist/commonjs/deviceUpdate.d.ts +12 -1
- package/dist/commonjs/deviceUpdate.d.ts.map +1 -1
- package/dist/commonjs/deviceUpdate.js +31 -9
- package/dist/commonjs/deviceUpdate.js.map +1 -1
- package/dist/commonjs/isUnexpected.d.ts +51 -51
- package/dist/commonjs/isUnexpected.js +37 -30
- package/dist/commonjs/isUnexpected.js.map +1 -1
- 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 +11 -10
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js.map +1 -1
- package/dist/commonjs/outputModels.d.ts +53 -5
- package/dist/commonjs/outputModels.d.ts.map +1 -1
- package/dist/commonjs/outputModels.js.map +1 -1
- package/dist/commonjs/paginateHelper.d.ts +27 -2
- package/dist/commonjs/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/paginateHelper.js +99 -2
- package/dist/commonjs/paginateHelper.js.map +1 -1
- package/dist/commonjs/parameters.d.ts +7 -5
- package/dist/commonjs/parameters.d.ts.map +1 -1
- package/dist/commonjs/parameters.js.map +1 -1
- package/dist/commonjs/pollingHelper.d.ts +67 -2
- package/dist/commonjs/pollingHelper.d.ts.map +1 -1
- package/dist/commonjs/pollingHelper.js +64 -8
- package/dist/commonjs/pollingHelper.js.map +1 -1
- package/dist/commonjs/responses.d.ts +50 -62
- package/dist/commonjs/responses.d.ts.map +1 -1
- package/dist/commonjs/responses.js.map +1 -1
- package/dist/esm/clientDefinitions.d.ts +51 -51
- package/dist/esm/clientDefinitions.js.map +1 -1
- package/dist/esm/deviceUpdate.d.ts +12 -1
- package/dist/esm/deviceUpdate.d.ts.map +1 -1
- package/dist/esm/deviceUpdate.js +31 -9
- package/dist/esm/deviceUpdate.js.map +1 -1
- package/dist/esm/isUnexpected.d.ts +51 -51
- package/dist/esm/isUnexpected.js +37 -30
- package/dist/esm/isUnexpected.js.map +1 -1
- 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 +11 -10
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/outputModels.d.ts +53 -5
- package/dist/esm/outputModels.d.ts.map +1 -1
- package/dist/esm/outputModels.js.map +1 -1
- package/dist/esm/paginateHelper.d.ts +27 -2
- package/dist/esm/paginateHelper.d.ts.map +1 -1
- package/dist/esm/paginateHelper.js +98 -1
- package/dist/esm/paginateHelper.js.map +1 -1
- package/dist/esm/parameters.d.ts +7 -5
- package/dist/esm/parameters.d.ts.map +1 -1
- package/dist/esm/parameters.js.map +1 -1
- package/dist/esm/pollingHelper.d.ts +67 -2
- package/dist/esm/pollingHelper.d.ts.map +1 -1
- package/dist/esm/pollingHelper.js +65 -9
- package/dist/esm/pollingHelper.js.map +1 -1
- package/dist/esm/responses.d.ts +50 -62
- package/dist/esm/responses.d.ts.map +1 -1
- package/dist/esm/responses.js.map +1 -1
- package/dist/react-native/clientDefinitions.d.ts +51 -51
- package/dist/react-native/clientDefinitions.js.map +1 -1
- package/dist/react-native/deviceUpdate.d.ts +12 -1
- package/dist/react-native/deviceUpdate.d.ts.map +1 -1
- package/dist/react-native/deviceUpdate.js +31 -9
- package/dist/react-native/deviceUpdate.js.map +1 -1
- package/dist/react-native/isUnexpected.d.ts +51 -51
- package/dist/react-native/isUnexpected.js +37 -30
- package/dist/react-native/isUnexpected.js.map +1 -1
- 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 +11 -10
- package/dist/react-native/models.d.ts.map +1 -1
- package/dist/react-native/models.js.map +1 -1
- package/dist/react-native/outputModels.d.ts +53 -5
- package/dist/react-native/outputModels.d.ts.map +1 -1
- package/dist/react-native/outputModels.js.map +1 -1
- package/dist/react-native/paginateHelper.d.ts +27 -2
- package/dist/react-native/paginateHelper.d.ts.map +1 -1
- package/dist/react-native/paginateHelper.js +98 -1
- package/dist/react-native/paginateHelper.js.map +1 -1
- package/dist/react-native/parameters.d.ts +7 -5
- package/dist/react-native/parameters.d.ts.map +1 -1
- package/dist/react-native/parameters.js.map +1 -1
- package/dist/react-native/pollingHelper.d.ts +67 -2
- package/dist/react-native/pollingHelper.d.ts.map +1 -1
- package/dist/react-native/pollingHelper.js +65 -9
- package/dist/react-native/pollingHelper.js.map +1 -1
- package/dist/react-native/responses.d.ts +50 -62
- package/dist/react-native/responses.d.ts.map +1 -1
- package/dist/react-native/responses.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,7 +1,104 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
4
|
import { createRestError } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* returns an async iterator that iterates over results. It also has a `byPage`
|
|
7
|
+
* method that returns pages of items at once.
|
|
8
|
+
*
|
|
9
|
+
* @param pagedResult - an object that specifies how to get pages.
|
|
10
|
+
* @returns a paged async iterator that iterates over results.
|
|
11
|
+
*/
|
|
12
|
+
function getPagedAsyncIterator(pagedResult) {
|
|
13
|
+
var _a;
|
|
14
|
+
const iter = getItemAsyncIterator(pagedResult);
|
|
15
|
+
return {
|
|
16
|
+
next() {
|
|
17
|
+
return iter.next();
|
|
18
|
+
},
|
|
19
|
+
[Symbol.asyncIterator]() {
|
|
20
|
+
return this;
|
|
21
|
+
},
|
|
22
|
+
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => {
|
|
23
|
+
const { continuationToken } = settings !== null && settings !== void 0 ? settings : {};
|
|
24
|
+
return getPageAsyncIterator(pagedResult, {
|
|
25
|
+
pageLink: continuationToken,
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getItemAsyncIterator(pagedResult) {
|
|
31
|
+
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
|
|
32
|
+
var _a, e_1, _b, _c, _d, e_2, _e, _f;
|
|
33
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
34
|
+
const firstVal = yield __await(pages.next());
|
|
35
|
+
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
|
|
36
|
+
if (!Array.isArray(firstVal.value)) {
|
|
37
|
+
// can extract elements from this page
|
|
38
|
+
const { toElements } = pagedResult;
|
|
39
|
+
if (toElements) {
|
|
40
|
+
yield __await(yield* __asyncDelegator(__asyncValues(toElements(firstVal.value))));
|
|
41
|
+
try {
|
|
42
|
+
for (var _g = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) {
|
|
43
|
+
_c = pages_1_1.value;
|
|
44
|
+
_g = false;
|
|
45
|
+
const page = _c;
|
|
46
|
+
yield __await(yield* __asyncDelegator(__asyncValues(toElements(page))));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
|
+
finally {
|
|
51
|
+
try {
|
|
52
|
+
if (!_g && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
|
|
53
|
+
}
|
|
54
|
+
finally { if (e_1) throw e_1.error; }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
yield yield __await(firstVal.value);
|
|
59
|
+
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
|
|
60
|
+
yield __await(yield* __asyncDelegator(__asyncValues(pages)));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value)));
|
|
65
|
+
try {
|
|
66
|
+
for (var _h = true, pages_2 = __asyncValues(pages), pages_2_1; pages_2_1 = yield __await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) {
|
|
67
|
+
_f = pages_2_1.value;
|
|
68
|
+
_h = false;
|
|
69
|
+
const page = _f;
|
|
70
|
+
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
|
|
71
|
+
// it must be the case that `TPage = TElement[]`
|
|
72
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
76
|
+
finally {
|
|
77
|
+
try {
|
|
78
|
+
if (!_h && !_d && (_e = pages_2.return)) yield __await(_e.call(pages_2));
|
|
79
|
+
}
|
|
80
|
+
finally { if (e_2) throw e_2.error; }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function getPageAsyncIterator(pagedResult_1) {
|
|
86
|
+
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) {
|
|
87
|
+
const { pageLink } = options;
|
|
88
|
+
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink));
|
|
89
|
+
if (!response) {
|
|
90
|
+
return yield __await(void 0);
|
|
91
|
+
}
|
|
92
|
+
yield yield __await(response.page);
|
|
93
|
+
while (response.nextPageLink) {
|
|
94
|
+
response = yield __await(pagedResult.getPage(response.nextPageLink));
|
|
95
|
+
if (!response) {
|
|
96
|
+
return yield __await(void 0);
|
|
97
|
+
}
|
|
98
|
+
yield yield __await(response.page);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
5
102
|
/**
|
|
6
103
|
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
7
104
|
* @param client - Client to use for sending the next page requests
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.js","s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AS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;IACnF,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;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,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;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,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 type { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } 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"]}
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,SAAS,qBAAqB,CAM5B,WAAqD;;IAErD,MAAM,IAAI,GAAG,oBAAoB,CAAwC,WAAW,CAAC,CAAC;IACtF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,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AAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,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;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,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 type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\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 */\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string,\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, 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?: PageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken as unknown as TLink | undefined,\n });\n }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator<TPage>),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n // can extract elements from this page\n const { toElements } = pagedResult;\n if (toElements) {\n yield* toElements(firstVal.value) as TElement[];\n for await (const page of pages) {\n yield* toElements(page) as TElement[];\n }\n } else {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n }\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n pageLink?: TLink;\n } = {},\n): AsyncIterableIterator<TPage> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n }\n}\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\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 = 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<TPage>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\ninterface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => unknown[];\n}\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> = (pageLink: string) => 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"]}
|
package/dist/esm/parameters.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface DeviceUpdateGetUpdateHeaders {
|
|
|
25
25
|
"If-None-Match"?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface DeviceUpdateGetUpdateHeaderParam {
|
|
28
|
-
headers
|
|
28
|
+
headers?: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;
|
|
29
29
|
}
|
|
30
30
|
export type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;
|
|
31
31
|
export type DeviceUpdateDeleteUpdateParameters = RequestParameters;
|
|
@@ -45,7 +45,7 @@ export interface DeviceUpdateGetFileHeaders {
|
|
|
45
45
|
"If-None-Match"?: string;
|
|
46
46
|
}
|
|
47
47
|
export interface DeviceUpdateGetFileHeaderParam {
|
|
48
|
-
headers
|
|
48
|
+
headers?: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;
|
|
49
49
|
}
|
|
50
50
|
export type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;
|
|
51
51
|
export interface DeviceUpdateListOperationStatusesQueryParamProperties {
|
|
@@ -63,7 +63,7 @@ export interface DeviceUpdateGetOperationStatusHeaders {
|
|
|
63
63
|
"If-None-Match"?: string;
|
|
64
64
|
}
|
|
65
65
|
export interface DeviceUpdateGetOperationStatusHeaderParam {
|
|
66
|
-
headers
|
|
66
|
+
headers?: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders;
|
|
67
67
|
}
|
|
68
68
|
export type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam & RequestParameters;
|
|
69
69
|
export interface DeviceManagementListDeviceClassesQueryParamProperties {
|
|
@@ -75,9 +75,11 @@ export interface DeviceManagementListDeviceClassesQueryParam {
|
|
|
75
75
|
}
|
|
76
76
|
export type DeviceManagementListDeviceClassesParameters = DeviceManagementListDeviceClassesQueryParam & RequestParameters;
|
|
77
77
|
export type DeviceManagementGetDeviceClassParameters = RequestParameters;
|
|
78
|
+
/** The device class json merge patch body. Currently only supports patching friendlyName. */
|
|
79
|
+
export type PatchBodyResourceMergeAndPatch = Partial<PatchBody>;
|
|
78
80
|
export interface DeviceManagementUpdateDeviceClassBodyParam {
|
|
79
81
|
/** The device class json merge patch body. Currently only supports patching friendlyName. */
|
|
80
|
-
body:
|
|
82
|
+
body: PatchBodyResourceMergeAndPatch;
|
|
81
83
|
}
|
|
82
84
|
export interface DeviceManagementUpdateDeviceClassMediaTypesParam {
|
|
83
85
|
/** Request content type */
|
|
@@ -176,7 +178,7 @@ export interface DeviceManagementGetOperationStatusHeaders {
|
|
|
176
178
|
"If-None-Match"?: string;
|
|
177
179
|
}
|
|
178
180
|
export interface DeviceManagementGetOperationStatusHeaderParam {
|
|
179
|
-
headers
|
|
181
|
+
headers?: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders;
|
|
180
182
|
}
|
|
181
183
|
export type DeviceManagementGetOperationStatusParameters = DeviceManagementGetOperationStatusHeaderParam & RequestParameters;
|
|
182
184
|
export interface DeviceManagementListOperationStatusesQueryParamProperties {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/F,MAAM,WAAW,2CAA2C;IAC1D,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iCAAiC;IAChD,eAAe,CAAC,EAAE,2CAA2C,CAAC;CAC/D;AAED,MAAM,MAAM,iCAAiC,GAAG,iCAAiC,GAC/E,iBAAiB,CAAC;AAEpB,MAAM,WAAW,iCAAiC;IAChD,mIAAmI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BAAiB,CAAC;AAEpE,MAAM,WAAW,yDAAyD;IACxE,uIAAuI;IACvI,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yMAAyM;IACzM,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+CAA+C;IAC9D,eAAe,CAAC,EAAE,yDAAyD,CAAC;CAC7E;AAED,MAAM,MAAM,+CAA+C,GACzD,+CAA+C,GAAG,iBAAiB,CAAC;AAEtE,MAAM,WAAW,2CAA2C;IAC1D,qCAAqC;IACrC,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,iDAAiD;IAChE,2BAA2B;IAC3B,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,MAAM,4CAA4C,GACtD,iDAAiD,GAC/C,2CAA2C,GAC3C,iBAAiB,CAAC;AACtB,MAAM,MAAM,0CAA0C,GAAG,iBAAiB,CAAC;AAC3E,MAAM,MAAM,4CAA4C,GAAG,iBAAiB,CAAC;AAC7E,MAAM,MAAM,wDAAwD,GAAG,iBAAiB,CAAC;AAEzF,MAAM,WAAW,uDAAuD;IACtE,2HAA2H;IAC3H,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6CAA6C;IAC5D,eAAe,EAAE,uDAAuD,CAAC;CAC1E;AAED,MAAM,MAAM,6CAA6C,GACvD,6CAA6C,GAAG,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { ImportUpdateInputItem, PatchBody, Deployment, LogCollection } from \"./models.js\";\n\nexport interface DeviceUpdateListUpdatesQueryParamProperties {\n /** Request updates matching a free-text search expression. */\n search?: string;\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListUpdatesQueryParam {\n queryParameters?: DeviceUpdateListUpdatesQueryParamProperties;\n}\n\nexport type DeviceUpdateListUpdatesParameters = DeviceUpdateListUpdatesQueryParam &\n RequestParameters;\n\nexport interface DeviceUpdateImportUpdateBodyParam {\n /** The update to be imported (see schema https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). */\n body: Array<ImportUpdateInputItem>;\n}\n\nexport interface DeviceUpdateImportUpdateMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateMediaTypesParam &\n DeviceUpdateImportUpdateBodyParam &\n RequestParameters;\n\nexport interface DeviceUpdateGetUpdateHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetUpdateHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;\n}\n\nexport type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;\nexport type DeviceUpdateDeleteUpdateParameters = RequestParameters;\nexport type DeviceUpdateListProvidersParameters = RequestParameters;\nexport type DeviceUpdateListNamesParameters = RequestParameters;\n\nexport interface DeviceUpdateListVersionsQueryParamProperties {\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListVersionsQueryParam {\n queryParameters?: DeviceUpdateListVersionsQueryParamProperties;\n}\n\nexport type DeviceUpdateListVersionsParameters = DeviceUpdateListVersionsQueryParam &\n RequestParameters;\nexport type DeviceUpdateListFilesParameters = RequestParameters;\n\nexport interface DeviceUpdateGetFileHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetFileHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;\n}\n\nexport type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;\n\nexport interface DeviceUpdateListOperationStatusesQueryParamProperties {\n /** Optional to filter operations by status property. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceUpdateListOperationStatusesQueryParam {\n queryParameters?: DeviceUpdateListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceUpdateListOperationStatusesParameters =\n DeviceUpdateListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceUpdateGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetOperationStatusHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders;\n}\n\nexport type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam &\n RequestParameters;\n\nexport interface DeviceManagementListDeviceClassesQueryParamProperties {\n /** Restricts the set of device classes returned. You can filter on friendly name. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassesQueryParam {\n queryParameters?: DeviceManagementListDeviceClassesQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassesParameters =\n DeviceManagementListDeviceClassesQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementUpdateDeviceClassBodyParam {\n /** The device class json merge patch body. Currently only supports patching friendlyName. */\n body: PatchBody;\n}\n\nexport interface DeviceManagementUpdateDeviceClassMediaTypesParam {\n /** Request content type */\n contentType?: \"application/merge-patch+json\";\n}\n\nexport type DeviceManagementUpdateDeviceClassParameters =\n DeviceManagementUpdateDeviceClassMediaTypesParam &\n DeviceManagementUpdateDeviceClassBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeviceClassParameters = RequestParameters;\nexport type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementListDevicesQueryParamProperties {\n /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. Use DeploymentStatus eq null to query for devices with no deployment status (that have never been deployed to). */\n filter?: string;\n}\n\nexport interface DeviceManagementListDevicesQueryParam {\n queryParameters?: DeviceManagementListDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListDevicesParameters = DeviceManagementListDevicesQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementImportDevicesBodyParam {\n /** The types of devices to import. */\n body: \"Devices\" | \"Modules\" | \"All\";\n}\n\nexport interface DeviceManagementImportDevicesMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementImportDevicesParameters = DeviceManagementImportDevicesMediaTypesParam &\n DeviceManagementImportDevicesBodyParam &\n RequestParameters;\nexport type DeviceManagementGetDeviceParameters = RequestParameters;\nexport type DeviceManagementGetDeviceModuleParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceParameters = RequestParameters;\n\nexport interface DeviceManagementListGroupsQueryParamProperties {\n /** Orders the set of groups returned. You can order by groupId, deviceCount, createdDate, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListGroupsQueryParam {\n queryParameters?: DeviceManagementListGroupsQueryParamProperties;\n}\n\nexport type DeviceManagementListGroupsParameters = DeviceManagementListGroupsQueryParam &\n RequestParameters;\nexport type DeviceManagementGetGroupParameters = RequestParameters;\nexport type DeviceManagementDeleteGroupParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceForGroupParameters = RequestParameters;\nexport type DeviceManagementListBestUpdatesForGroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForGroupParameters =\n DeviceManagementListDeploymentsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentParameters = RequestParameters;\n\nexport interface DeviceManagementCreateOrUpdateDeploymentBodyParam {\n /** The deployment properties. */\n body: Deployment;\n}\n\nexport interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCreateOrUpdateDeploymentParameters =\n DeviceManagementCreateOrUpdateDeploymentMediaTypesParam &\n DeviceManagementCreateOrUpdateDeploymentBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties {\n /** Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2') */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassSubgroupsForGroupParameters =\n DeviceManagementListDeviceClassSubgroupsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters = RequestParameters;\nexport type DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForDeviceClassSubgroupParameters =\n DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementStopDeploymentParameters = RequestParameters;\nexport type DeviceManagementRetryDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties {\n /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam {\n queryParameters?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters =\n DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam & RequestParameters;\n\nexport interface DeviceManagementGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceManagementGetOperationStatusHeaderParam {\n headers: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders;\n}\n\nexport type DeviceManagementGetOperationStatusParameters =\n DeviceManagementGetOperationStatusHeaderParam & RequestParameters;\n\nexport interface DeviceManagementListOperationStatusesQueryParamProperties {\n /** Restricts the set of operations returned. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceManagementListOperationStatusesQueryParam {\n queryParameters?: DeviceManagementListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceManagementListOperationStatusesParameters =\n DeviceManagementListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceManagementStartLogCollectionBodyParam {\n /** The log collection properties. */\n body: LogCollection;\n}\n\nexport interface DeviceManagementStartLogCollectionMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementStartLogCollectionParameters =\n DeviceManagementStartLogCollectionMediaTypesParam &\n DeviceManagementStartLogCollectionBodyParam &\n RequestParameters;\nexport type DeviceManagementGetLogCollectionParameters = RequestParameters;\nexport type DeviceManagementListLogCollectionsParameters = RequestParameters;\nexport type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListHealthOfDevicesQueryParamProperties {\n /** Restricts the set of devices for which device health is returned. You can filter on status, device id and module id. */\n filter: string;\n}\n\nexport interface DeviceManagementListHealthOfDevicesQueryParam {\n queryParameters: DeviceManagementListHealthOfDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListHealthOfDevicesParameters =\n DeviceManagementListHealthOfDevicesQueryParam & RequestParameters;\n"]}
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { ImportUpdateInputItem, PatchBody, Deployment, LogCollection } from \"./models.js\";\n\nexport interface DeviceUpdateListUpdatesQueryParamProperties {\n /** Request updates matching a free-text search expression. */\n search?: string;\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListUpdatesQueryParam {\n queryParameters?: DeviceUpdateListUpdatesQueryParamProperties;\n}\n\nexport type DeviceUpdateListUpdatesParameters = DeviceUpdateListUpdatesQueryParam &\n RequestParameters;\n\nexport interface DeviceUpdateImportUpdateBodyParam {\n /** The update to be imported (see schema https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). */\n body: Array<ImportUpdateInputItem>;\n}\n\nexport interface DeviceUpdateImportUpdateMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateMediaTypesParam &\n DeviceUpdateImportUpdateBodyParam &\n RequestParameters;\n\nexport interface DeviceUpdateGetUpdateHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetUpdateHeaderParam {\n headers?: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;\n}\n\nexport type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;\nexport type DeviceUpdateDeleteUpdateParameters = RequestParameters;\nexport type DeviceUpdateListProvidersParameters = RequestParameters;\nexport type DeviceUpdateListNamesParameters = RequestParameters;\n\nexport interface DeviceUpdateListVersionsQueryParamProperties {\n /** Optional to filter updates by isDeployable property. */\n filter?: string;\n}\n\nexport interface DeviceUpdateListVersionsQueryParam {\n queryParameters?: DeviceUpdateListVersionsQueryParamProperties;\n}\n\nexport type DeviceUpdateListVersionsParameters = DeviceUpdateListVersionsQueryParam &\n RequestParameters;\nexport type DeviceUpdateListFilesParameters = RequestParameters;\n\nexport interface DeviceUpdateGetFileHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetFileHeaderParam {\n headers?: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;\n}\n\nexport type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;\n\nexport interface DeviceUpdateListOperationStatusesQueryParamProperties {\n /** Optional to filter operations by status property. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceUpdateListOperationStatusesQueryParam {\n queryParameters?: DeviceUpdateListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceUpdateListOperationStatusesParameters =\n DeviceUpdateListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceUpdateGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetOperationStatusHeaderParam {\n headers?: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders;\n}\n\nexport type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam &\n RequestParameters;\n\nexport interface DeviceManagementListDeviceClassesQueryParamProperties {\n /** Restricts the set of device classes returned. You can filter on friendly name. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassesQueryParam {\n queryParameters?: DeviceManagementListDeviceClassesQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassesParameters =\n DeviceManagementListDeviceClassesQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassParameters = RequestParameters;\n/** The device class json merge patch body. Currently only supports patching friendlyName. */\nexport type PatchBodyResourceMergeAndPatch = Partial<PatchBody>;\n\nexport interface DeviceManagementUpdateDeviceClassBodyParam {\n /** The device class json merge patch body. Currently only supports patching friendlyName. */\n body: PatchBodyResourceMergeAndPatch;\n}\n\nexport interface DeviceManagementUpdateDeviceClassMediaTypesParam {\n /** Request content type */\n contentType?: \"application/merge-patch+json\";\n}\n\nexport type DeviceManagementUpdateDeviceClassParameters =\n DeviceManagementUpdateDeviceClassMediaTypesParam &\n DeviceManagementUpdateDeviceClassBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeviceClassParameters = RequestParameters;\nexport type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementListDevicesQueryParamProperties {\n /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. Use DeploymentStatus eq null to query for devices with no deployment status (that have never been deployed to). */\n filter?: string;\n}\n\nexport interface DeviceManagementListDevicesQueryParam {\n queryParameters?: DeviceManagementListDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListDevicesParameters = DeviceManagementListDevicesQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementImportDevicesBodyParam {\n /** The types of devices to import. */\n body: \"Devices\" | \"Modules\" | \"All\";\n}\n\nexport interface DeviceManagementImportDevicesMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementImportDevicesParameters = DeviceManagementImportDevicesMediaTypesParam &\n DeviceManagementImportDevicesBodyParam &\n RequestParameters;\nexport type DeviceManagementGetDeviceParameters = RequestParameters;\nexport type DeviceManagementGetDeviceModuleParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceParameters = RequestParameters;\n\nexport interface DeviceManagementListGroupsQueryParamProperties {\n /** Orders the set of groups returned. You can order by groupId, deviceCount, createdDate, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListGroupsQueryParam {\n queryParameters?: DeviceManagementListGroupsQueryParamProperties;\n}\n\nexport type DeviceManagementListGroupsParameters = DeviceManagementListGroupsQueryParam &\n RequestParameters;\nexport type DeviceManagementGetGroupParameters = RequestParameters;\nexport type DeviceManagementDeleteGroupParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceForGroupParameters = RequestParameters;\nexport type DeviceManagementListBestUpdatesForGroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForGroupParameters =\n DeviceManagementListDeploymentsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentParameters = RequestParameters;\n\nexport interface DeviceManagementCreateOrUpdateDeploymentBodyParam {\n /** The deployment properties. */\n body: Deployment;\n}\n\nexport interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCreateOrUpdateDeploymentParameters =\n DeviceManagementCreateOrUpdateDeploymentMediaTypesParam &\n DeviceManagementCreateOrUpdateDeploymentBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties {\n /** Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and compatProperties/propertyName2 eq 'value2') */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeviceClassSubgroupsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceClassSubgroupsForGroupParameters =\n DeviceManagementListDeviceClassSubgroupsForGroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters = RequestParameters;\nexport type DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties {\n /** Orders the set of deployments returned. You can order by start date. */\n orderby?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForDeviceClassSubgroupParameters =\n DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam & RequestParameters;\nexport type DeviceManagementGetDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters = RequestParameters;\nexport type DeviceManagementStopDeploymentParameters = RequestParameters;\nexport type DeviceManagementRetryDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties {\n /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */\n filter?: string;\n}\n\nexport interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam {\n queryParameters?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParamProperties;\n}\n\nexport type DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters =\n DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentQueryParam & RequestParameters;\n\nexport interface DeviceManagementGetOperationStatusHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceManagementGetOperationStatusHeaderParam {\n headers?: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders;\n}\n\nexport type DeviceManagementGetOperationStatusParameters =\n DeviceManagementGetOperationStatusHeaderParam & RequestParameters;\n\nexport interface DeviceManagementListOperationStatusesQueryParamProperties {\n /** Restricts the set of operations returned. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n top?: number;\n}\n\nexport interface DeviceManagementListOperationStatusesQueryParam {\n queryParameters?: DeviceManagementListOperationStatusesQueryParamProperties;\n}\n\nexport type DeviceManagementListOperationStatusesParameters =\n DeviceManagementListOperationStatusesQueryParam & RequestParameters;\n\nexport interface DeviceManagementStartLogCollectionBodyParam {\n /** The log collection properties. */\n body: LogCollection;\n}\n\nexport interface DeviceManagementStartLogCollectionMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementStartLogCollectionParameters =\n DeviceManagementStartLogCollectionMediaTypesParam &\n DeviceManagementStartLogCollectionBodyParam &\n RequestParameters;\nexport type DeviceManagementGetLogCollectionParameters = RequestParameters;\nexport type DeviceManagementListLogCollectionsParameters = RequestParameters;\nexport type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListHealthOfDevicesQueryParamProperties {\n /** Restricts the set of devices for which device health is returned. You can filter on status, device id and module id. */\n filter: string;\n}\n\nexport interface DeviceManagementListHealthOfDevicesQueryParam {\n queryParameters: DeviceManagementListHealthOfDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListHealthOfDevicesParameters =\n DeviceManagementListHealthOfDevicesQueryParam & RequestParameters;\n"]}
|
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
import type { Client, HttpResponse } from "@azure-rest/core-client";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
3
|
+
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro";
|
|
4
|
+
/**
|
|
5
|
+
* A simple poller that can be used to poll a long running operation.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the poller has finished polling.
|
|
10
|
+
*/
|
|
11
|
+
isDone(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the state of the operation.
|
|
14
|
+
*/
|
|
15
|
+
getOperationState(): TState;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the result value of the operation,
|
|
18
|
+
* regardless of the state of the poller.
|
|
19
|
+
* It can return undefined or an incomplete form of the final TResult value
|
|
20
|
+
* depending on the implementation.
|
|
21
|
+
*/
|
|
22
|
+
getResult(): TResult | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a promise that will resolve once a single polling request finishes.
|
|
25
|
+
* It does this by calling the update method of the Poller's operation.
|
|
26
|
+
*/
|
|
27
|
+
poll(options?: {
|
|
28
|
+
abortSignal?: AbortSignalLike;
|
|
29
|
+
}): Promise<TState>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a promise that will resolve once the underlying operation is completed.
|
|
32
|
+
*/
|
|
33
|
+
pollUntilDone(pollOptions?: {
|
|
34
|
+
abortSignal?: AbortSignalLike;
|
|
35
|
+
}): Promise<TResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Invokes the provided callback after each polling is completed,
|
|
38
|
+
* sending the current state of the poller's operation.
|
|
39
|
+
*
|
|
40
|
+
* It returns a method that can be used to stop receiving updates on the given callback function.
|
|
41
|
+
*/
|
|
42
|
+
onProgress(callback: (state: TState) => void): CancelOnProgress;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a promise that could be used for serialized version of the poller's operation
|
|
45
|
+
* by invoking the operation's serialize method.
|
|
46
|
+
*/
|
|
47
|
+
serialize(): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Wait the poller to be submitted.
|
|
50
|
+
*/
|
|
51
|
+
submitted(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a string representation of the poller's operation. Similar to serialize but returns a string.
|
|
54
|
+
* @deprecated Use serialize() instead.
|
|
55
|
+
*/
|
|
56
|
+
toString(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling
|
|
59
|
+
* @deprecated Use abortSignal to stop polling instead.
|
|
60
|
+
*/
|
|
61
|
+
stopPolling(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Returns true if the poller is stopped.
|
|
64
|
+
* @deprecated Use abortSignal status to track this instead.
|
|
65
|
+
*/
|
|
66
|
+
isStopped(): boolean;
|
|
67
|
+
}
|
|
3
68
|
/**
|
|
4
69
|
* Helper function that builds a Poller object to help polling a long running operation.
|
|
5
70
|
* @param client - Client to use for sending the request to get additional pages.
|
|
@@ -7,5 +72,5 @@ import type { LroEngineOptions, PollerLike, PollOperationState } from "@azure/co
|
|
|
7
72
|
* @param options - Options to set a resume state or custom polling interval.
|
|
8
73
|
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
9
74
|
*/
|
|
10
|
-
export declare function getLongRunningPoller<TResult extends HttpResponse>(client: Client, initialResponse: TResult, options?:
|
|
75
|
+
export declare function getLongRunningPoller<TResult extends HttpResponse>(client: Client, initialResponse: TResult, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
|
|
11
76
|
//# sourceMappingURL=pollingHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAGvB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO;IAC/E;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,iBAAiB,IAAI,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE;;OAEG;IACH,aAAa,CAAC,WAAW,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAAC;IAEhE;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,SAAS,YAAY,EACrE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,OAAO,GAAE,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAM,GACtE,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAgF7D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
3
|
+
import { createHttpPoller } from "@azure/core-lro";
|
|
4
4
|
/**
|
|
5
5
|
* Helper function that builds a Poller object to help polling a long running operation.
|
|
6
6
|
* @param client - Client to use for sending the request to get additional pages.
|
|
@@ -8,33 +8,89 @@ import { LroEngine } from "@azure/core-lro";
|
|
|
8
8
|
* @param options - Options to set a resume state or custom polling interval.
|
|
9
9
|
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
|
10
10
|
*/
|
|
11
|
-
export function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
11
|
+
export async function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
12
|
+
var _a;
|
|
13
|
+
const abortController = new AbortController();
|
|
12
14
|
const poller = {
|
|
13
|
-
requestMethod: initialResponse.request.method,
|
|
14
|
-
requestPath: initialResponse.request.url,
|
|
15
15
|
sendInitialRequest: async () => {
|
|
16
16
|
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
|
17
17
|
// we are not triggering the initial request here, just extracting the information from the
|
|
18
18
|
// response we were provided.
|
|
19
19
|
return getLroResponse(initialResponse);
|
|
20
20
|
},
|
|
21
|
-
sendPollRequest: async (path) => {
|
|
21
|
+
sendPollRequest: async (path, pollOptions) => {
|
|
22
22
|
// This is the callback that is going to be called to poll the service
|
|
23
23
|
// to get the latest status. We use the client provided and the polling path
|
|
24
24
|
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
|
25
25
|
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
|
26
|
-
|
|
26
|
+
function abortListener() {
|
|
27
|
+
abortController.abort();
|
|
28
|
+
}
|
|
29
|
+
const inputAbortSignal = pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.abortSignal;
|
|
30
|
+
const abortSignal = abortController.signal;
|
|
31
|
+
if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
|
|
32
|
+
abortController.abort();
|
|
33
|
+
}
|
|
34
|
+
else if (!abortSignal.aborted) {
|
|
35
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, {
|
|
36
|
+
once: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let response;
|
|
40
|
+
try {
|
|
41
|
+
response = await client
|
|
42
|
+
.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url)
|
|
43
|
+
.get({ abortSignal });
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener);
|
|
47
|
+
}
|
|
27
48
|
const lroResponse = getLroResponse(response);
|
|
28
49
|
lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
|
|
29
50
|
return lroResponse;
|
|
30
51
|
},
|
|
31
52
|
};
|
|
32
|
-
|
|
53
|
+
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
|
|
54
|
+
const httpPoller = createHttpPoller(poller, options);
|
|
55
|
+
const simplePoller = {
|
|
56
|
+
isDone() {
|
|
57
|
+
return httpPoller.isDone;
|
|
58
|
+
},
|
|
59
|
+
isStopped() {
|
|
60
|
+
return abortController.signal.aborted;
|
|
61
|
+
},
|
|
62
|
+
getOperationState() {
|
|
63
|
+
if (!httpPoller.operationState) {
|
|
64
|
+
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
|
|
65
|
+
}
|
|
66
|
+
return httpPoller.operationState;
|
|
67
|
+
},
|
|
68
|
+
getResult() {
|
|
69
|
+
return httpPoller.result;
|
|
70
|
+
},
|
|
71
|
+
toString() {
|
|
72
|
+
if (!httpPoller.operationState) {
|
|
73
|
+
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
|
|
74
|
+
}
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
state: httpPoller.operationState,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
stopPolling() {
|
|
80
|
+
abortController.abort();
|
|
81
|
+
},
|
|
82
|
+
onProgress: httpPoller.onProgress,
|
|
83
|
+
poll: httpPoller.poll,
|
|
84
|
+
pollUntilDone: httpPoller.pollUntilDone,
|
|
85
|
+
serialize: httpPoller.serialize,
|
|
86
|
+
submitted: httpPoller.submitted,
|
|
87
|
+
};
|
|
88
|
+
return simplePoller;
|
|
33
89
|
}
|
|
34
90
|
/**
|
|
35
|
-
* Converts a Rest Client response to a response that the LRO
|
|
91
|
+
* Converts a Rest Client response to a response that the LRO implementation understands
|
|
36
92
|
* @param response - a rest client http response
|
|
37
|
-
* @returns - An LRO response that the LRO
|
|
93
|
+
* @returns - An LRO response that the LRO implementation understands
|
|
38
94
|
*/
|
|
39
95
|
function getLroResponse(response) {
|
|
40
96
|
if (Number.isNaN(response.status)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAoEnD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;;IAEvE,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,MAAM,GAA8B;QACxC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAY,EAAE,WAA+C,EAAE,EAAE;YACvF,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,SAAS,aAAa;gBACpB,eAAe,CAAC,KAAK,EAAE,CAAC;YAC1B,CAAC;YACD,MAAM,gBAAgB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAAC;YAClD,MAAM,WAAW,GAA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AAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;YACJ,CAAC;YACD,OAAO,UAAU,CAAC,cAAc,CAAC;QACnC,CAAC;QACD,SAAS;YACP,OAAO,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC;QACD,QAAQ;YACN,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,UAAU,CAAC,cAAc;aACjC,CAAC,CAAC;QACL,CAAC;QACD,WAAW;YACT,eAAe,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QACD,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;KAChC,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CACrB,QAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\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 async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\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: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\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 function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<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"]}
|