@azure/template 1.0.13-beta.5823502 → 1.0.13-beta.5963717
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/api/index.d.ts +1 -1
- package/dist/browser/api/index.js.map +1 -1
- package/dist/browser/api/widgetAnalyticsContext.d.ts +2 -2
- package/dist/browser/api/widgetAnalyticsContext.js +1 -1
- package/dist/browser/api/widgetAnalyticsContext.js.map +1 -1
- package/dist/browser/api/widgets/index.d.ts +1 -1
- package/dist/browser/api/widgets/index.js.map +1 -1
- package/dist/browser/api/widgets/operations.d.ts +6 -6
- package/dist/browser/api/widgets/operations.js +2 -2
- package/dist/browser/api/widgets/operations.js.map +1 -1
- package/dist/browser/api/widgets/options.d.ts +1 -1
- package/dist/browser/api/widgets/options.js.map +1 -1
- package/dist/browser/classic/index.d.ts +1 -1
- package/dist/browser/classic/index.js.map +1 -1
- package/dist/browser/classic/widgets/index.d.ts +5 -5
- package/dist/browser/classic/widgets/index.js.map +1 -1
- package/dist/browser/index.d.ts +7 -7
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/models/index.d.ts +1 -1
- package/dist/browser/models/index.js.map +1 -1
- package/dist/browser/models/models.d.ts +1 -1
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/restorePollerHelpers.d.ts +4 -4
- package/dist/browser/restorePollerHelpers.js +1 -1
- package/dist/browser/restorePollerHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pagingHelpers.d.ts +1 -1
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pollingHelpers.d.ts +3 -3
- package/dist/browser/static-helpers/pollingHelpers.js +1 -1
- package/dist/browser/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/browser/widgetAnalyticsClient.d.ts +5 -5
- package/dist/browser/widgetAnalyticsClient.js +1 -1
- package/dist/browser/widgetAnalyticsClient.js.map +1 -1
- package/dist/commonjs/api/index.d.ts +1 -1
- package/dist/commonjs/api/index.js +27 -8
- package/dist/commonjs/api/index.js.map +7 -1
- package/dist/commonjs/api/widgetAnalyticsContext.d.ts +2 -2
- package/dist/commonjs/api/widgetAnalyticsContext.js +54 -38
- package/dist/commonjs/api/widgetAnalyticsContext.js.map +7 -1
- package/dist/commonjs/api/widgets/index.d.ts +1 -1
- package/dist/commonjs/api/widgets/index.js +35 -12
- package/dist/commonjs/api/widgets/index.js.map +7 -1
- package/dist/commonjs/api/widgets/operations.d.ts +6 -6
- package/dist/commonjs/api/widgets/operations.js +208 -147
- package/dist/commonjs/api/widgets/operations.js.map +7 -1
- package/dist/commonjs/api/widgets/options.d.ts +1 -1
- package/dist/commonjs/api/widgets/options.js +15 -5
- package/dist/commonjs/api/widgets/options.js.map +7 -1
- package/dist/commonjs/classic/index.d.ts +1 -1
- package/dist/commonjs/classic/index.js +15 -5
- package/dist/commonjs/classic/index.js.map +7 -1
- package/dist/commonjs/classic/widgets/index.d.ts +5 -5
- package/dist/commonjs/classic/widgets/index.js +37 -17
- package/dist/commonjs/classic/widgets/index.js.map +7 -1
- package/dist/commonjs/index.d.ts +7 -7
- package/dist/commonjs/index.js +35 -13
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/logger.js +28 -8
- package/dist/commonjs/logger.js.map +7 -1
- package/dist/commonjs/models/index.d.ts +1 -1
- package/dist/commonjs/models/index.js +29 -9
- package/dist/commonjs/models/index.js.map +7 -1
- package/dist/commonjs/models/models.d.ts +1 -1
- package/dist/commonjs/models/models.js +86 -68
- package/dist/commonjs/models/models.js.map +7 -1
- package/dist/commonjs/restorePollerHelpers.d.ts +4 -4
- package/dist/commonjs/restorePollerHelpers.js +96 -87
- package/dist/commonjs/restorePollerHelpers.js.map +7 -1
- package/dist/commonjs/static-helpers/pagingHelpers.d.ts +1 -1
- package/dist/commonjs/static-helpers/pagingHelpers.js +109 -103
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +7 -1
- package/dist/commonjs/static-helpers/pollingHelpers.d.ts +3 -3
- package/dist/commonjs/static-helpers/pollingHelpers.js +86 -76
- package/dist/commonjs/static-helpers/pollingHelpers.js.map +7 -1
- package/dist/commonjs/static-helpers/urlTemplate.js +157 -159
- package/dist/commonjs/static-helpers/urlTemplate.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/widgetAnalyticsClient.d.ts +5 -5
- package/dist/commonjs/widgetAnalyticsClient.js +50 -33
- package/dist/commonjs/widgetAnalyticsClient.js.map +7 -1
- package/dist/esm/api/index.d.ts +1 -1
- package/dist/esm/api/index.js +6 -4
- package/dist/esm/api/index.js.map +7 -1
- package/dist/esm/api/widgetAnalyticsContext.d.ts +2 -2
- package/dist/esm/api/widgetAnalyticsContext.js +30 -34
- package/dist/esm/api/widgetAnalyticsContext.js.map +7 -1
- package/dist/esm/api/widgets/index.d.ts +1 -1
- package/dist/esm/api/widgets/index.js +14 -4
- package/dist/esm/api/widgets/index.js.map +7 -1
- package/dist/esm/api/widgets/operations.d.ts +6 -6
- package/dist/esm/api/widgets/operations.js +186 -140
- package/dist/esm/api/widgets/operations.js.map +7 -1
- package/dist/esm/api/widgets/options.d.ts +1 -1
- package/dist/esm/api/widgets/options.js +0 -4
- package/dist/esm/api/widgets/options.js.map +7 -1
- package/dist/esm/classic/index.d.ts +1 -1
- package/dist/esm/classic/index.js +0 -4
- package/dist/esm/classic/index.js.map +7 -1
- package/dist/esm/classic/widgets/index.d.ts +5 -5
- package/dist/esm/classic/widgets/index.js +21 -15
- package/dist/esm/classic/widgets/index.js.map +7 -1
- package/dist/esm/index.d.ts +7 -7
- package/dist/esm/index.js +12 -6
- package/dist/esm/index.js.map +7 -1
- package/dist/esm/logger.js +4 -4
- package/dist/esm/logger.js.map +7 -1
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +8 -4
- package/dist/esm/models/index.js.map +7 -1
- package/dist/esm/models/models.d.ts +1 -1
- package/dist/esm/models/models.js +62 -65
- package/dist/esm/models/models.js.map +7 -1
- package/dist/esm/restorePollerHelpers.d.ts +4 -4
- package/dist/esm/restorePollerHelpers.js +76 -84
- package/dist/esm/restorePollerHelpers.js.map +7 -1
- package/dist/esm/static-helpers/pagingHelpers.d.ts +1 -1
- package/dist/esm/static-helpers/pagingHelpers.js +85 -99
- package/dist/esm/static-helpers/pagingHelpers.js.map +7 -1
- package/dist/esm/static-helpers/pollingHelpers.d.ts +3 -3
- package/dist/esm/static-helpers/pollingHelpers.js +63 -73
- package/dist/esm/static-helpers/pollingHelpers.js.map +7 -1
- package/dist/esm/static-helpers/urlTemplate.js +134 -156
- package/dist/esm/static-helpers/urlTemplate.js.map +7 -1
- package/dist/esm/widgetAnalyticsClient.d.ts +5 -5
- package/dist/esm/widgetAnalyticsClient.js +27 -29
- package/dist/esm/widgetAnalyticsClient.js.map +7 -1
- package/dist/react-native/api/index.d.ts +1 -1
- package/dist/react-native/api/index.js.map +1 -1
- package/dist/react-native/api/widgetAnalyticsContext.d.ts +2 -2
- package/dist/react-native/api/widgetAnalyticsContext.js +1 -1
- package/dist/react-native/api/widgetAnalyticsContext.js.map +1 -1
- package/dist/react-native/api/widgets/index.d.ts +1 -1
- package/dist/react-native/api/widgets/index.js.map +1 -1
- package/dist/react-native/api/widgets/operations.d.ts +6 -6
- package/dist/react-native/api/widgets/operations.js +2 -2
- package/dist/react-native/api/widgets/operations.js.map +1 -1
- package/dist/react-native/api/widgets/options.d.ts +1 -1
- package/dist/react-native/api/widgets/options.js.map +1 -1
- package/dist/react-native/classic/index.d.ts +1 -1
- package/dist/react-native/classic/index.js.map +1 -1
- package/dist/react-native/classic/widgets/index.d.ts +5 -5
- package/dist/react-native/classic/widgets/index.js.map +1 -1
- package/dist/react-native/index.d.ts +7 -7
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/models/index.d.ts +1 -1
- package/dist/react-native/models/index.js.map +1 -1
- package/dist/react-native/models/models.d.ts +1 -1
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/restorePollerHelpers.d.ts +4 -4
- package/dist/react-native/restorePollerHelpers.js +1 -1
- package/dist/react-native/restorePollerHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.d.ts +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pollingHelpers.d.ts +3 -3
- package/dist/react-native/static-helpers/pollingHelpers.js +1 -1
- package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/react-native/widgetAnalyticsClient.d.ts +5 -5
- package/dist/react-native/widgetAnalyticsClient.js +1 -1
- package/dist/react-native/widgetAnalyticsClient.js.map +1 -1
- package/package.json +3 -23
package/dist/esm/logger.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/template/template/src/logger.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"template\");\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,0BAA0B;AAC5B,MAAM,SAAS,mBAAmB,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { WidgetSuite, FakedSharedModel, ResourceOperationStatusWidgetSuiteWidgetSuiteError, KnownOperationState, OperationState, KnownVersions, } from "./models.js";
|
|
1
|
+
export { type WidgetSuite, type FakedSharedModel, type ResourceOperationStatusWidgetSuiteWidgetSuiteError, KnownOperationState, type OperationState, KnownVersions, } from "./models.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/models/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
KnownOperationState,
|
|
3
|
+
KnownVersions
|
|
4
|
+
} from "./models.js";
|
|
5
|
+
export {
|
|
6
|
+
KnownOperationState,
|
|
7
|
+
KnownVersions
|
|
8
|
+
};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/template/template/src/models/index.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n type WidgetSuite,\n type FakedSharedModel,\n type ResourceOperationStatusWidgetSuiteWidgetSuiteError,\n KnownOperationState,\n type OperationState,\n KnownVersions,\n} from \"./models.js\";\n"],
|
|
5
|
+
"mappings": "AAGA;AAAA,EAIE;AAAA,EAEA;AAAA,OACK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,73 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sharedModel: !item["sharedModel"]
|
|
7
|
-
? item["sharedModel"]
|
|
8
|
-
: fakedSharedModelSerializer(item["sharedModel"]),
|
|
9
|
-
};
|
|
1
|
+
function widgetSuiteSerializer(item) {
|
|
2
|
+
return {
|
|
3
|
+
manufacturerId: item["manufacturerId"],
|
|
4
|
+
sharedModel: !item["sharedModel"] ? item["sharedModel"] : fakedSharedModelSerializer(item["sharedModel"])
|
|
5
|
+
};
|
|
10
6
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
: fakedSharedModelDeserializer(item["sharedModel"]),
|
|
18
|
-
};
|
|
7
|
+
function widgetSuiteDeserializer(item) {
|
|
8
|
+
return {
|
|
9
|
+
name: item["name"],
|
|
10
|
+
manufacturerId: item["manufacturerId"],
|
|
11
|
+
sharedModel: !item["sharedModel"] ? item["sharedModel"] : fakedSharedModelDeserializer(item["sharedModel"])
|
|
12
|
+
};
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
function fakedSharedModelSerializer(item) {
|
|
15
|
+
return { tag: item["tag"], createdAt: item["createdAt"].toISOString() };
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
function fakedSharedModelDeserializer(item) {
|
|
18
|
+
return {
|
|
19
|
+
tag: item["tag"],
|
|
20
|
+
createdAt: new Date(item["createdAt"])
|
|
21
|
+
};
|
|
28
22
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(item) {
|
|
24
|
+
return {
|
|
25
|
+
id: item["id"],
|
|
26
|
+
status: item["status"],
|
|
27
|
+
error: !item["error"] ? item["error"] : item["error"],
|
|
28
|
+
result: !item["result"] ? item["result"] : widgetSuiteDeserializer(item["result"])
|
|
29
|
+
};
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})(KnownOperationState || (KnownOperationState = {}));
|
|
51
|
-
export function _pagedWidgetSuiteDeserializer(item) {
|
|
52
|
-
return {
|
|
53
|
-
value: widgetSuiteArrayDeserializer(item["value"]),
|
|
54
|
-
nextLink: item["nextLink"],
|
|
55
|
-
};
|
|
31
|
+
var KnownOperationState = /* @__PURE__ */ ((KnownOperationState2) => {
|
|
32
|
+
KnownOperationState2["NotStarted"] = "NotStarted";
|
|
33
|
+
KnownOperationState2["Running"] = "Running";
|
|
34
|
+
KnownOperationState2["Succeeded"] = "Succeeded";
|
|
35
|
+
KnownOperationState2["Failed"] = "Failed";
|
|
36
|
+
KnownOperationState2["Canceled"] = "Canceled";
|
|
37
|
+
return KnownOperationState2;
|
|
38
|
+
})(KnownOperationState || {});
|
|
39
|
+
function _pagedWidgetSuiteDeserializer(item) {
|
|
40
|
+
return {
|
|
41
|
+
value: widgetSuiteArrayDeserializer(item["value"]),
|
|
42
|
+
nextLink: item["nextLink"]
|
|
43
|
+
};
|
|
56
44
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
function widgetSuiteArraySerializer(result) {
|
|
46
|
+
return result.map((item) => {
|
|
47
|
+
return widgetSuiteSerializer(item);
|
|
48
|
+
});
|
|
61
49
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
function widgetSuiteArrayDeserializer(result) {
|
|
51
|
+
return result.map((item) => {
|
|
52
|
+
return widgetSuiteDeserializer(item);
|
|
53
|
+
});
|
|
66
54
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
var KnownVersions = /* @__PURE__ */ ((KnownVersions2) => {
|
|
56
|
+
KnownVersions2["V20221201"] = "2022-12-01";
|
|
57
|
+
return KnownVersions2;
|
|
58
|
+
})(KnownVersions || {});
|
|
59
|
+
export {
|
|
60
|
+
KnownOperationState,
|
|
61
|
+
KnownVersions,
|
|
62
|
+
_pagedWidgetSuiteDeserializer,
|
|
63
|
+
fakedSharedModelDeserializer,
|
|
64
|
+
fakedSharedModelSerializer,
|
|
65
|
+
resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer,
|
|
66
|
+
widgetSuiteArrayDeserializer,
|
|
67
|
+
widgetSuiteArraySerializer,
|
|
68
|
+
widgetSuiteDeserializer,
|
|
69
|
+
widgetSuiteSerializer
|
|
70
|
+
};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/template/template/src/models/models.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ErrorModel } from \"@azure-rest/core-client\";\n\n/** A widget. */\nexport interface WidgetSuite {\n /** The widget name. */\n readonly name: string;\n /** The ID of the widget's manufacturer. */\n manufacturerId: string;\n /** The faked shared model. */\n sharedModel?: FakedSharedModel;\n}\n\nexport function widgetSuiteSerializer(item: WidgetSuite): any {\n return {\n manufacturerId: item[\"manufacturerId\"],\n sharedModel: !item[\"sharedModel\"]\n ? item[\"sharedModel\"]\n : fakedSharedModelSerializer(item[\"sharedModel\"]),\n };\n}\n\nexport function widgetSuiteDeserializer(item: any): WidgetSuite {\n return {\n name: item[\"name\"],\n manufacturerId: item[\"manufacturerId\"],\n sharedModel: !item[\"sharedModel\"]\n ? item[\"sharedModel\"]\n : fakedSharedModelDeserializer(item[\"sharedModel\"]),\n };\n}\n\n/** Faked shared model */\nexport interface FakedSharedModel {\n /** The tag. */\n tag: string;\n /** The created date. */\n createdAt: Date;\n}\n\nexport function fakedSharedModelSerializer(item: FakedSharedModel): any {\n return { tag: item[\"tag\"], createdAt: item[\"createdAt\"].toISOString() };\n}\n\nexport function fakedSharedModelDeserializer(item: any): FakedSharedModel {\n return {\n tag: item[\"tag\"],\n createdAt: new Date(item[\"createdAt\"]),\n };\n}\n\n/** Provides status details for long running operations. */\nexport interface ResourceOperationStatusWidgetSuiteWidgetSuiteError {\n /** The unique ID of the operation. */\n id: string;\n /** The status of the operation */\n status: OperationState;\n /** Error object that describes the error when status is \"Failed\". */\n error?: ErrorModel;\n /** The result of the operation. */\n result?: WidgetSuite;\n}\n\nexport function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(\n item: any,\n): ResourceOperationStatusWidgetSuiteWidgetSuiteError {\n return {\n id: item[\"id\"],\n status: item[\"status\"],\n error: !item[\"error\"] ? item[\"error\"] : item[\"error\"],\n result: !item[\"result\"] ? item[\"result\"] : widgetSuiteDeserializer(item[\"result\"]),\n };\n}\n\n/** Enum describing allowed operation states. */\nexport enum KnownOperationState {\n /** The operation has not started. */\n NotStarted = \"NotStarted\",\n /** The operation is in progress. */\n Running = \"Running\",\n /** The operation has completed successfully. */\n Succeeded = \"Succeeded\",\n /** The operation has failed. */\n Failed = \"Failed\",\n /** The operation has been canceled by the user. */\n Canceled = \"Canceled\",\n}\n\n/**\n * Enum describing allowed operation states. \\\n * {@link KnownOperationState} can be used interchangeably with OperationState,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **NotStarted**: The operation has not started. \\\n * **Running**: The operation is in progress. \\\n * **Succeeded**: The operation has completed successfully. \\\n * **Failed**: The operation has failed. \\\n * **Canceled**: The operation has been canceled by the user.\n */\nexport type OperationState = string;\n\n/** Paged collection of WidgetSuite items */\nexport interface _PagedWidgetSuite {\n /** The WidgetSuite items on this page */\n value: WidgetSuite[];\n /** The link to the next page of items */\n nextLink?: string;\n}\n\nexport function _pagedWidgetSuiteDeserializer(item: any): _PagedWidgetSuite {\n return {\n value: widgetSuiteArrayDeserializer(item[\"value\"]),\n nextLink: item[\"nextLink\"],\n };\n}\n\nexport function widgetSuiteArraySerializer(result: Array<WidgetSuite>): any[] {\n return result.map((item) => {\n return widgetSuiteSerializer(item);\n });\n}\n\nexport function widgetSuiteArrayDeserializer(result: Array<WidgetSuite>): any[] {\n return result.map((item) => {\n return widgetSuiteDeserializer(item);\n });\n}\n\n/** Versions info. */\nexport enum KnownVersions {\n /** The 2022-12-01 version. */\n V20221201 = \"2022-12-01\",\n}\n"],
|
|
5
|
+
"mappings": "AAeO,SAAS,sBAAsB,MAAwB;AAC5D,SAAO;AAAA,IACL,gBAAgB,KAAK,gBAAgB;AAAA,IACrC,aAAa,CAAC,KAAK,aAAa,IAC5B,KAAK,aAAa,IAClB,2BAA2B,KAAK,aAAa,CAAC;AAAA,EACpD;AACF;AAEO,SAAS,wBAAwB,MAAwB;AAC9D,SAAO;AAAA,IACL,MAAM,KAAK,MAAM;AAA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L,kBAAKC,mBAAL;AAEL,EAAAA,eAAA,eAAY;AAFF,SAAAA;AAAA,GAAA;",
|
|
6
|
+
"names": ["KnownOperationState", "KnownVersions"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WidgetAnalyticsClient } from "./widgetAnalyticsClient.js";
|
|
2
|
-
import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
-
import { AbortSignalLike } from "@azure/abort-controller";
|
|
4
|
-
import { PollerLike, OperationState } from "@azure/core-lro";
|
|
1
|
+
import type { WidgetAnalyticsClient } from "./widgetAnalyticsClient.js";
|
|
2
|
+
import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
+
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
4
|
+
import type { PollerLike, OperationState } from "@azure/core-lro";
|
|
5
5
|
export interface RestorePollerOptions<TResult, TResponse extends PathUncheckedResponse = PathUncheckedResponse> extends OperationOptions {
|
|
6
6
|
/** Delay to wait until next poll, in milliseconds. */
|
|
7
7
|
updateIntervalInMs?: number;
|
|
@@ -1,95 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
_deleteWidgetDeserialize,
|
|
3
|
+
_createOrUpdateWidgetDeserialize
|
|
4
|
+
} from "./api/widgets/operations.js";
|
|
4
5
|
import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js";
|
|
5
|
-
import { deserializeState
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import { deserializeState } from "@azure/core-lro";
|
|
7
|
+
function restorePoller(client, serializedState, sourceOperation, options) {
|
|
8
|
+
const pollerConfig = deserializeState(serializedState).config;
|
|
9
|
+
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
10
|
+
if (!initialRequestUrl || !requestMethod) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
16
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
17
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
18
|
+
if (!deserializeHelper) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return getLongRunningPoller(
|
|
24
|
+
client["_client"] ?? client,
|
|
25
|
+
deserializeHelper,
|
|
26
|
+
expectedStatuses,
|
|
27
|
+
{
|
|
28
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
29
|
+
abortSignal: options?.abortSignal,
|
|
30
|
+
resourceLocationConfig,
|
|
31
|
+
restoreFrom: serializedState,
|
|
32
|
+
initialRequestUrl
|
|
16
33
|
}
|
|
17
|
-
|
|
18
|
-
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
19
|
-
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
20
|
-
if (!deserializeHelper) {
|
|
21
|
-
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
22
|
-
}
|
|
23
|
-
return getLongRunningPoller(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
24
|
-
updateIntervalInMs: options?.updateIntervalInMs,
|
|
25
|
-
abortSignal: options?.abortSignal,
|
|
26
|
-
resourceLocationConfig,
|
|
27
|
-
restoreFrom: serializedState,
|
|
28
|
-
initialRequestUrl,
|
|
29
|
-
});
|
|
34
|
+
);
|
|
30
35
|
}
|
|
31
36
|
const deserializeMap = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
"DELETE /widgets/{widgetName}": {
|
|
38
|
+
deserializer: _deleteWidgetDeserialize,
|
|
39
|
+
expectedStatuses: ["202", "200"]
|
|
40
|
+
},
|
|
41
|
+
"PATCH /widgets/{widgetName}": {
|
|
42
|
+
deserializer: _createOrUpdateWidgetDeserialize,
|
|
43
|
+
expectedStatuses: ["201", "200", "202"]
|
|
44
|
+
}
|
|
40
45
|
};
|
|
41
46
|
function getDeserializationHelper(urlStr, method) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
62
|
-
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
63
|
-
// If the current part of the candidate is a "template" part
|
|
64
|
-
// Try to use the suffix of pattern to match the path
|
|
65
|
-
// {guid} ==> $
|
|
66
|
-
// {guid}:export ==> :export$
|
|
67
|
-
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
68
|
-
if (!isMatched) {
|
|
69
|
-
found = false;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
// If the candidate part is not a template and
|
|
75
|
-
// the parts don't match mark the candidate as not found
|
|
76
|
-
// to move on with the next candidate path.
|
|
77
|
-
if (candidateParts[i] !== pathParts[j]) {
|
|
78
|
-
found = false;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// We finished evaluating the current candidate parts
|
|
83
|
-
// Update the matched value if and only if we found the longer pattern
|
|
84
|
-
if (found && candidatePath.length > matchedLen) {
|
|
85
|
-
matchedLen = candidatePath.length;
|
|
86
|
-
matchedValue = value;
|
|
47
|
+
const path = new URL(urlStr).pathname;
|
|
48
|
+
const pathParts = path.split("/");
|
|
49
|
+
let matchedLen = -1, matchedValue;
|
|
50
|
+
for (const [key, value] of Object.entries(deserializeMap)) {
|
|
51
|
+
if (!key.startsWith(method)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const candidatePath = getPathFromMapKey(key);
|
|
55
|
+
const candidateParts = candidatePath.split("/");
|
|
56
|
+
let found = true;
|
|
57
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
58
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
59
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
60
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(
|
|
61
|
+
pathParts[j] || ""
|
|
62
|
+
);
|
|
63
|
+
if (!isMatched) {
|
|
64
|
+
found = false;
|
|
65
|
+
break;
|
|
87
66
|
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
70
|
+
found = false;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (found && candidatePath.length > matchedLen) {
|
|
75
|
+
matchedLen = candidatePath.length;
|
|
76
|
+
matchedValue = value;
|
|
88
77
|
}
|
|
89
|
-
|
|
78
|
+
}
|
|
79
|
+
return matchedValue;
|
|
90
80
|
}
|
|
91
81
|
function getPathFromMapKey(mapKey) {
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
const pathStart = mapKey.indexOf("/");
|
|
83
|
+
return mapKey.slice(pathStart);
|
|
94
84
|
}
|
|
95
|
-
|
|
85
|
+
export {
|
|
86
|
+
restorePoller
|
|
87
|
+
};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/template/template/src/restorePollerHelpers.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { WidgetAnalyticsClient } from \"./widgetAnalyticsClient.js\";\nimport {\n _deleteWidgetDeserialize,\n _createOrUpdateWidgetDeserialize,\n} from \"./api/widgets/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport type { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { PollerLike, OperationState, ResourceLocationConfig } from \"@azure/core-lro\";\nimport { deserializeState } from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: WidgetAnalyticsClient,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /widgets/{widgetName}\": {\n deserializer: _deleteWidgetDeserialize,\n expectedStatuses: [\"202\", \"200\"],\n },\n \"PATCH /widgets/{widgetName}\": {\n deserializer: _createOrUpdateWidgetDeserialize,\n expectedStatuses: [\"201\", \"200\", \"202\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"],
|
|
5
|
+
"mappings": "AAIA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AAIrC,SAAS,wBAAwB;AAqB1B,SAAS,cACd,QACA,iBACA,iBACA,SAC8C;AAC9C,QAAM,eAAe,iBAAiB,eAAe,EAAE;AACvD,QAAM,EAAE,mBAAmB,eAAe,SAAS,IAAI;AACvD,MAAI,CAAC,qBAAqB,CAAC,eAAe;AACxC,UAAM,IAAI;AAAA,MACR,6BAA6B,eAAe,wBAAwB,iBAAiB,IAAI;AAAA,IAC3F;AAAA,EACF;AACA,QAAM,yBAAyB,WAAW,wBAAwB;AAGlE,QAAM,EAAE,cAAc,mBAAmB,CAAC,EAAE,IAC1C,yBAAyB,mBAAmB,aAAa,KAAK,CAAC;AACjE,QAAM,oBAAoB,SAAS,uBAAuB;AAC1D,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI;AAAA,MACR,0FAA0F,iBAAiB,IAAI;AAAA,IACjH;AAAA,EACF;AACA,SAAO;AAAA,IACJ,OAA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