@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.
Files changed (160) hide show
  1. package/dist/browser/api/index.d.ts +1 -1
  2. package/dist/browser/api/index.js.map +1 -1
  3. package/dist/browser/api/widgetAnalyticsContext.d.ts +2 -2
  4. package/dist/browser/api/widgetAnalyticsContext.js +1 -1
  5. package/dist/browser/api/widgetAnalyticsContext.js.map +1 -1
  6. package/dist/browser/api/widgets/index.d.ts +1 -1
  7. package/dist/browser/api/widgets/index.js.map +1 -1
  8. package/dist/browser/api/widgets/operations.d.ts +6 -6
  9. package/dist/browser/api/widgets/operations.js +2 -2
  10. package/dist/browser/api/widgets/operations.js.map +1 -1
  11. package/dist/browser/api/widgets/options.d.ts +1 -1
  12. package/dist/browser/api/widgets/options.js.map +1 -1
  13. package/dist/browser/classic/index.d.ts +1 -1
  14. package/dist/browser/classic/index.js.map +1 -1
  15. package/dist/browser/classic/widgets/index.d.ts +5 -5
  16. package/dist/browser/classic/widgets/index.js.map +1 -1
  17. package/dist/browser/index.d.ts +7 -7
  18. package/dist/browser/index.js.map +1 -1
  19. package/dist/browser/models/index.d.ts +1 -1
  20. package/dist/browser/models/index.js.map +1 -1
  21. package/dist/browser/models/models.d.ts +1 -1
  22. package/dist/browser/models/models.js.map +1 -1
  23. package/dist/browser/restorePollerHelpers.d.ts +4 -4
  24. package/dist/browser/restorePollerHelpers.js +1 -1
  25. package/dist/browser/restorePollerHelpers.js.map +1 -1
  26. package/dist/browser/static-helpers/pagingHelpers.d.ts +1 -1
  27. package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
  28. package/dist/browser/static-helpers/pollingHelpers.d.ts +3 -3
  29. package/dist/browser/static-helpers/pollingHelpers.js +1 -1
  30. package/dist/browser/static-helpers/pollingHelpers.js.map +1 -1
  31. package/dist/browser/widgetAnalyticsClient.d.ts +5 -5
  32. package/dist/browser/widgetAnalyticsClient.js +1 -1
  33. package/dist/browser/widgetAnalyticsClient.js.map +1 -1
  34. package/dist/commonjs/api/index.d.ts +1 -1
  35. package/dist/commonjs/api/index.js +27 -8
  36. package/dist/commonjs/api/index.js.map +7 -1
  37. package/dist/commonjs/api/widgetAnalyticsContext.d.ts +2 -2
  38. package/dist/commonjs/api/widgetAnalyticsContext.js +54 -38
  39. package/dist/commonjs/api/widgetAnalyticsContext.js.map +7 -1
  40. package/dist/commonjs/api/widgets/index.d.ts +1 -1
  41. package/dist/commonjs/api/widgets/index.js +35 -12
  42. package/dist/commonjs/api/widgets/index.js.map +7 -1
  43. package/dist/commonjs/api/widgets/operations.d.ts +6 -6
  44. package/dist/commonjs/api/widgets/operations.js +208 -147
  45. package/dist/commonjs/api/widgets/operations.js.map +7 -1
  46. package/dist/commonjs/api/widgets/options.d.ts +1 -1
  47. package/dist/commonjs/api/widgets/options.js +15 -5
  48. package/dist/commonjs/api/widgets/options.js.map +7 -1
  49. package/dist/commonjs/classic/index.d.ts +1 -1
  50. package/dist/commonjs/classic/index.js +15 -5
  51. package/dist/commonjs/classic/index.js.map +7 -1
  52. package/dist/commonjs/classic/widgets/index.d.ts +5 -5
  53. package/dist/commonjs/classic/widgets/index.js +37 -17
  54. package/dist/commonjs/classic/widgets/index.js.map +7 -1
  55. package/dist/commonjs/index.d.ts +7 -7
  56. package/dist/commonjs/index.js +35 -13
  57. package/dist/commonjs/index.js.map +7 -1
  58. package/dist/commonjs/logger.js +28 -8
  59. package/dist/commonjs/logger.js.map +7 -1
  60. package/dist/commonjs/models/index.d.ts +1 -1
  61. package/dist/commonjs/models/index.js +29 -9
  62. package/dist/commonjs/models/index.js.map +7 -1
  63. package/dist/commonjs/models/models.d.ts +1 -1
  64. package/dist/commonjs/models/models.js +86 -68
  65. package/dist/commonjs/models/models.js.map +7 -1
  66. package/dist/commonjs/restorePollerHelpers.d.ts +4 -4
  67. package/dist/commonjs/restorePollerHelpers.js +96 -87
  68. package/dist/commonjs/restorePollerHelpers.js.map +7 -1
  69. package/dist/commonjs/static-helpers/pagingHelpers.d.ts +1 -1
  70. package/dist/commonjs/static-helpers/pagingHelpers.js +109 -103
  71. package/dist/commonjs/static-helpers/pagingHelpers.js.map +7 -1
  72. package/dist/commonjs/static-helpers/pollingHelpers.d.ts +3 -3
  73. package/dist/commonjs/static-helpers/pollingHelpers.js +86 -76
  74. package/dist/commonjs/static-helpers/pollingHelpers.js.map +7 -1
  75. package/dist/commonjs/static-helpers/urlTemplate.js +157 -159
  76. package/dist/commonjs/static-helpers/urlTemplate.js.map +7 -1
  77. package/dist/commonjs/tsdoc-metadata.json +1 -1
  78. package/dist/commonjs/widgetAnalyticsClient.d.ts +5 -5
  79. package/dist/commonjs/widgetAnalyticsClient.js +50 -33
  80. package/dist/commonjs/widgetAnalyticsClient.js.map +7 -1
  81. package/dist/esm/api/index.d.ts +1 -1
  82. package/dist/esm/api/index.js +6 -4
  83. package/dist/esm/api/index.js.map +7 -1
  84. package/dist/esm/api/widgetAnalyticsContext.d.ts +2 -2
  85. package/dist/esm/api/widgetAnalyticsContext.js +30 -34
  86. package/dist/esm/api/widgetAnalyticsContext.js.map +7 -1
  87. package/dist/esm/api/widgets/index.d.ts +1 -1
  88. package/dist/esm/api/widgets/index.js +14 -4
  89. package/dist/esm/api/widgets/index.js.map +7 -1
  90. package/dist/esm/api/widgets/operations.d.ts +6 -6
  91. package/dist/esm/api/widgets/operations.js +186 -140
  92. package/dist/esm/api/widgets/operations.js.map +7 -1
  93. package/dist/esm/api/widgets/options.d.ts +1 -1
  94. package/dist/esm/api/widgets/options.js +0 -4
  95. package/dist/esm/api/widgets/options.js.map +7 -1
  96. package/dist/esm/classic/index.d.ts +1 -1
  97. package/dist/esm/classic/index.js +0 -4
  98. package/dist/esm/classic/index.js.map +7 -1
  99. package/dist/esm/classic/widgets/index.d.ts +5 -5
  100. package/dist/esm/classic/widgets/index.js +21 -15
  101. package/dist/esm/classic/widgets/index.js.map +7 -1
  102. package/dist/esm/index.d.ts +7 -7
  103. package/dist/esm/index.js +12 -6
  104. package/dist/esm/index.js.map +7 -1
  105. package/dist/esm/logger.js +4 -4
  106. package/dist/esm/logger.js.map +7 -1
  107. package/dist/esm/models/index.d.ts +1 -1
  108. package/dist/esm/models/index.js +8 -4
  109. package/dist/esm/models/index.js.map +7 -1
  110. package/dist/esm/models/models.d.ts +1 -1
  111. package/dist/esm/models/models.js +62 -65
  112. package/dist/esm/models/models.js.map +7 -1
  113. package/dist/esm/restorePollerHelpers.d.ts +4 -4
  114. package/dist/esm/restorePollerHelpers.js +76 -84
  115. package/dist/esm/restorePollerHelpers.js.map +7 -1
  116. package/dist/esm/static-helpers/pagingHelpers.d.ts +1 -1
  117. package/dist/esm/static-helpers/pagingHelpers.js +85 -99
  118. package/dist/esm/static-helpers/pagingHelpers.js.map +7 -1
  119. package/dist/esm/static-helpers/pollingHelpers.d.ts +3 -3
  120. package/dist/esm/static-helpers/pollingHelpers.js +63 -73
  121. package/dist/esm/static-helpers/pollingHelpers.js.map +7 -1
  122. package/dist/esm/static-helpers/urlTemplate.js +134 -156
  123. package/dist/esm/static-helpers/urlTemplate.js.map +7 -1
  124. package/dist/esm/widgetAnalyticsClient.d.ts +5 -5
  125. package/dist/esm/widgetAnalyticsClient.js +27 -29
  126. package/dist/esm/widgetAnalyticsClient.js.map +7 -1
  127. package/dist/react-native/api/index.d.ts +1 -1
  128. package/dist/react-native/api/index.js.map +1 -1
  129. package/dist/react-native/api/widgetAnalyticsContext.d.ts +2 -2
  130. package/dist/react-native/api/widgetAnalyticsContext.js +1 -1
  131. package/dist/react-native/api/widgetAnalyticsContext.js.map +1 -1
  132. package/dist/react-native/api/widgets/index.d.ts +1 -1
  133. package/dist/react-native/api/widgets/index.js.map +1 -1
  134. package/dist/react-native/api/widgets/operations.d.ts +6 -6
  135. package/dist/react-native/api/widgets/operations.js +2 -2
  136. package/dist/react-native/api/widgets/operations.js.map +1 -1
  137. package/dist/react-native/api/widgets/options.d.ts +1 -1
  138. package/dist/react-native/api/widgets/options.js.map +1 -1
  139. package/dist/react-native/classic/index.d.ts +1 -1
  140. package/dist/react-native/classic/index.js.map +1 -1
  141. package/dist/react-native/classic/widgets/index.d.ts +5 -5
  142. package/dist/react-native/classic/widgets/index.js.map +1 -1
  143. package/dist/react-native/index.d.ts +7 -7
  144. package/dist/react-native/index.js.map +1 -1
  145. package/dist/react-native/models/index.d.ts +1 -1
  146. package/dist/react-native/models/index.js.map +1 -1
  147. package/dist/react-native/models/models.d.ts +1 -1
  148. package/dist/react-native/models/models.js.map +1 -1
  149. package/dist/react-native/restorePollerHelpers.d.ts +4 -4
  150. package/dist/react-native/restorePollerHelpers.js +1 -1
  151. package/dist/react-native/restorePollerHelpers.js.map +1 -1
  152. package/dist/react-native/static-helpers/pagingHelpers.d.ts +1 -1
  153. package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
  154. package/dist/react-native/static-helpers/pollingHelpers.d.ts +3 -3
  155. package/dist/react-native/static-helpers/pollingHelpers.js +1 -1
  156. package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -1
  157. package/dist/react-native/widgetAnalyticsClient.d.ts +5 -5
  158. package/dist/react-native/widgetAnalyticsClient.js +1 -1
  159. package/dist/react-native/widgetAnalyticsClient.js.map +1 -1
  160. package/package.json +3 -23
@@ -1 +1,7 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"template\");\n"]}
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
@@ -1,4 +1,8 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- export { KnownOperationState, KnownVersions, } from "./models.js";
4
- //# sourceMappingURL=index.js.map
1
+ import {
2
+ KnownOperationState,
3
+ KnownVersions
4
+ } from "./models.js";
5
+ export {
6
+ KnownOperationState,
7
+ KnownVersions
8
+ };
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAIL,mBAAmB,EAEnB,aAAa,GACd,MAAM,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n WidgetSuite,\n FakedSharedModel,\n ResourceOperationStatusWidgetSuiteWidgetSuiteError,\n KnownOperationState,\n OperationState,\n KnownVersions,\n} from \"./models.js\";\n"]}
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,4 +1,4 @@
1
- import { ErrorModel } from "@azure-rest/core-client";
1
+ import type { ErrorModel } from "@azure-rest/core-client";
2
2
  /** A widget. */
3
3
  export interface WidgetSuite {
4
4
  /** The widget name. */
@@ -1,73 +1,70 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- export function widgetSuiteSerializer(item) {
4
- return {
5
- manufacturerId: item["manufacturerId"],
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
- export function widgetSuiteDeserializer(item) {
12
- return {
13
- name: item["name"],
14
- manufacturerId: item["manufacturerId"],
15
- sharedModel: !item["sharedModel"]
16
- ? item["sharedModel"]
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
- export function fakedSharedModelSerializer(item) {
21
- return { tag: item["tag"], createdAt: item["createdAt"].toISOString() };
14
+ function fakedSharedModelSerializer(item) {
15
+ return { tag: item["tag"], createdAt: item["createdAt"].toISOString() };
22
16
  }
23
- export function fakedSharedModelDeserializer(item) {
24
- return {
25
- tag: item["tag"],
26
- createdAt: new Date(item["createdAt"]),
27
- };
17
+ function fakedSharedModelDeserializer(item) {
18
+ return {
19
+ tag: item["tag"],
20
+ createdAt: new Date(item["createdAt"])
21
+ };
28
22
  }
29
- export function resourceOperationStatusWidgetSuiteWidgetSuiteErrorDeserializer(item) {
30
- return {
31
- id: item["id"],
32
- status: item["status"],
33
- error: !item["error"] ? item["error"] : item["error"],
34
- result: !item["result"] ? item["result"] : widgetSuiteDeserializer(item["result"]),
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
- /** Enum describing allowed operation states. */
38
- export var KnownOperationState;
39
- (function (KnownOperationState) {
40
- /** The operation has not started. */
41
- KnownOperationState["NotStarted"] = "NotStarted";
42
- /** The operation is in progress. */
43
- KnownOperationState["Running"] = "Running";
44
- /** The operation has completed successfully. */
45
- KnownOperationState["Succeeded"] = "Succeeded";
46
- /** The operation has failed. */
47
- KnownOperationState["Failed"] = "Failed";
48
- /** The operation has been canceled by the user. */
49
- KnownOperationState["Canceled"] = "Canceled";
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
- export function widgetSuiteArraySerializer(result) {
58
- return result.map((item) => {
59
- return widgetSuiteSerializer(item);
60
- });
45
+ function widgetSuiteArraySerializer(result) {
46
+ return result.map((item) => {
47
+ return widgetSuiteSerializer(item);
48
+ });
61
49
  }
62
- export function widgetSuiteArrayDeserializer(result) {
63
- return result.map((item) => {
64
- return widgetSuiteDeserializer(item);
65
- });
50
+ function widgetSuiteArrayDeserializer(result) {
51
+ return result.map((item) => {
52
+ return widgetSuiteDeserializer(item);
53
+ });
66
54
  }
67
- /** Versions info. */
68
- export var KnownVersions;
69
- (function (KnownVersions) {
70
- /** The 2022-12-01 version. */
71
- KnownVersions["V20221201"] = "2022-12-01";
72
- })(KnownVersions || (KnownVersions = {}));
73
- //# sourceMappingURL=models.js.map
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
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,MAAM,UAAU,qBAAqB,CAAC,IAAiB;IACrD,OAAO;QACL,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC;QACtC,WAAW,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC;YAC/B,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;YACrB,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAS;IAC/C,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,cAAc,EAAE,IAAI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,4CAAqB,CAAA;AACvB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAuBD,MAAM,UAAU,6BAA6B,CAAC,IAAS;IACrD,OAAO;QACL,KAAK,EAAE,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAA0B;IACnE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA0B;IACrE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qBAAqB;AACrB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,8BAA8B;IAC9B,yCAAwB,CAAA;AAC1B,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { 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"]}
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;AAAA,IACjB,gBAAgB,KAAK,gBAAgB;AAAA,IACrC,aAAa,CAAC,KAAK,aAAa,IAC5B,KAAK,aAAa,IAClB,6BAA6B,KAAK,aAAa,CAAC;AAAA,EACtD;AACF;AAUO,SAAS,2BAA2B,MAA6B;AACtE,SAAO,EAAE,KAAK,KAAK,KAAK,GAAG,WAAW,KAAK,WAAW,EAAE,YAAY,EAAE;AACxE;AAEO,SAAS,6BAA6B,MAA6B;AACxE,SAAO;AAAA,IACL,KAAK,KAAK,KAAK;AAAA,IACf,WAAW,IAAI,KAAK,KAAK,WAAW,CAAC;AAAA,EACvC;AACF;AAcO,SAAS,+DACd,MACoD;AACpD,SAAO;AAAA,IACL,IAAI,KAAK,IAAI;AAAA,IACb,QAAQ,KAAK,QAAQ;AAAA,IACrB,OAAO,CAAC,KAAK,OAAO,IAAI,KAAK,OAAO,IAAI,KAAK,OAAO;AAAA,IACpD,QAAQ,CAAC,KAAK,QAAQ,IAAI,KAAK,QAAQ,IAAI,wBAAwB,KAAK,QAAQ,CAAC;AAAA,EACnF;AACF;AAGO,IAAK,sBAAL,kBAAKA,yBAAL;AAEL,EAAAA,qBAAA,gBAAa;AAEb,EAAAA,qBAAA,aAAU;AAEV,EAAAA,qBAAA,eAAY;AAEZ,EAAAA,qBAAA,YAAS;AAET,EAAAA,qBAAA,cAAW;AAVD,SAAAA;AAAA,GAAA;AAkCL,SAAS,8BAA8B,MAA8B;AAC1E,SAAO;AAAA,IACL,OAAO,6BAA6B,KAAK,OAAO,CAAC;AAAA,IACjD,UAAU,KAAK,UAAU;AAAA,EAC3B;AACF;AAEO,SAAS,2BAA2B,QAAmC;AAC5E,SAAO,OAAO,IAAI,CAAC,SAAS;AAC1B,WAAO,sBAAsB,IAAI;AAAA,EACnC,CAAC;AACH;AAEO,SAAS,6BAA6B,QAAmC;AAC9E,SAAO,OAAO,IAAI,CAAC,SAAS;AAC1B,WAAO,wBAAwB,IAAI;AAAA,EACrC,CAAC;AACH;AAGO,IAAK,gBAAL,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
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { _deleteWidgetDeserialize, _createOrUpdateWidgetDeserialize, } from "./api/widgets/operations.js";
1
+ import {
2
+ _deleteWidgetDeserialize,
3
+ _createOrUpdateWidgetDeserialize
4
+ } from "./api/widgets/operations.js";
4
5
  import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js";
5
- import { deserializeState, } from "@azure/core-lro";
6
- /**
7
- * Creates a poller from the serialized state of another poller. This can be
8
- * useful when you want to create pollers on a different host or a poller
9
- * needs to be constructed after the original one is not in scope.
10
- */
11
- export function restorePoller(client, serializedState, sourceOperation, options) {
12
- const pollerConfig = deserializeState(serializedState).config;
13
- const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
14
- if (!initialRequestUrl || !requestMethod) {
15
- throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
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
- const resourceLocationConfig = metadata?.["resourceLocationConfig"];
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
- "DELETE /widgets/{widgetName}": {
33
- deserializer: _deleteWidgetDeserialize,
34
- expectedStatuses: ["202", "200"],
35
- },
36
- "PATCH /widgets/{widgetName}": {
37
- deserializer: _createOrUpdateWidgetDeserialize,
38
- expectedStatuses: ["201", "200", "202"],
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
- const path = new URL(urlStr).pathname;
43
- const pathParts = path.split("/");
44
- // Traverse list to match the longest candidate
45
- // matchedLen: the length of candidate path
46
- // matchedValue: the matched status code array
47
- let matchedLen = -1, matchedValue;
48
- // Iterate the responseMap to find a match
49
- for (const [key, value] of Object.entries(deserializeMap)) {
50
- // Extracting the path from the map key which is in format
51
- // GET /path/foo
52
- if (!key.startsWith(method)) {
53
- continue;
54
- }
55
- const candidatePath = getPathFromMapKey(key);
56
- // Get each part of the url path
57
- const candidateParts = candidatePath.split("/");
58
- // track if we have found a match to return the values found.
59
- let found = true;
60
- for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
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
- return matchedValue;
78
+ }
79
+ return matchedValue;
90
80
  }
91
81
  function getPathFromMapKey(mapKey) {
92
- const pathStart = mapKey.indexOf("/");
93
- return mapKey.slice(pathStart);
82
+ const pathStart = mapKey.indexOf("/");
83
+ return mapKey.slice(pathStart);
94
84
  }
95
- //# sourceMappingURL=restorePollerHelpers.js.map
85
+ export {
86
+ restorePoller
87
+ };
@@ -1 +1,7 @@
1
- {"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAGL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAgBzB;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA6B,EAC7B,eAAuB,EACvB,eAAiF,EACjF,OAAuC;IAEvC,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;IACpE,IAAI,CAAC,iBAAiB,IAAI,CAAC,aAAa,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,6BAA6B,eAAe,wBAAwB,eAAe,EAAE,IAAI,EAAE,CAC5F,CAAC;IACJ,CAAC;IACD,MAAM,sBAAsB,GAAG,QAAQ,EAAE,CAAC,wBAAwB,CAErD,CAAC;IACd,MAAM,EAAE,YAAY,EAAE,gBAAgB,GAAG,EAAE,EAAE,GAC3C,wBAAwB,CAAC,iBAAiB,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC;IACnE,MAAM,iBAAiB,GAAG,OAAO,EAAE,mBAAmB,IAAI,YAAY,CAAC;IACvE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,0FAA0F,eAAe,EAAE,IAAI,GAAG,CACnH,CAAC;IACJ,CAAC;IACD,OAAO,oBAAoB,CACxB,MAAc,CAAC,SAAS,CAAC,IAAI,MAAM,EACp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;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { WidgetAnalyticsClient } from \"./widgetAnalyticsClient.js\";\nimport {\n _deleteWidgetDeserialize,\n _createOrUpdateWidgetDeserialize,\n} from \"./api/widgets/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: 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"]}
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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AK,KAAK;AAC5F,UAAI,eAAe,CAAC,GAAG,WAAW,GAAG,KAAK,eAAe,CAAC,GAAG,QAAQ,GAAG,MAAM,IAAI;AAChF,cAAM,QAAQ,eAAe,CAAC,EAAG,QAAQ,GAAG,IAAI,GAC9C,MAAM,eAAe,CAAC,GAAG;AAK3B,cAAM,YAAY,IAAI,OAAO,GAAG,eAAe,CAAC,GAAG,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE;AAAA,UACtE,UAAU,CAAC,KAAK;AAAA,QAClB;AAEA,YAAI,CAAC,WAAW;AACd,kBAAQ;AACR;AAAA,QACF;AACA;AAAA,MACF;AAKA,UAAI,eAAe,CAAC,MAAM,UAAU,CAAC,GAAG;AACtC,gBAAQ;AACR;AAAA,MACF;AAAA,IACF;AAIA,QAAI,SAAS,cAAc,SAAS,YAAY;AAC9C,mBAAa,cAAc;AAC3B,qBAAe;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,kBAAkB,QAAwB;AACjD,QAAM,YAAY,OAAO,QAAQ,GAAG;AACpC,SAAO,OAAO,MAAM,SAAS;AAC/B;",
6
+ "names": []
7
+ }
@@ -1,4 +1,4 @@
1
- import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
1
+ import type { Client, PathUncheckedResponse } from "@azure-rest/core-client";
2
2
  /**
3
3
  * Options for the byPage method
4
4
  */