@azure/arm-managedapplications 2.0.0-beta.1 → 2.0.0

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 (154) hide show
  1. package/CHANGELOG.md +6 -11
  2. package/README.md +15 -9
  3. package/dist/index.js +145 -929
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/{esm → dist-esm/src}/applicationClient.d.ts +7 -19
  8. package/dist-esm/src/applicationClient.d.ts.map +1 -0
  9. package/{esm → dist-esm/src}/applicationClient.js +31 -74
  10. package/dist-esm/src/applicationClient.js.map +1 -0
  11. package/dist-esm/src/index.d.ts +5 -0
  12. package/dist-esm/src/index.d.ts.map +1 -0
  13. package/{esm → dist-esm/src}/index.js +0 -1
  14. package/dist-esm/src/index.js.map +1 -0
  15. package/dist-esm/src/lroImpl.d.ts +16 -0
  16. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  17. package/dist-esm/src/lroImpl.js +29 -0
  18. package/dist-esm/src/lroImpl.js.map +1 -0
  19. package/{esm → dist-esm/src}/models/index.d.ts +39 -59
  20. package/dist-esm/src/models/index.d.ts.map +1 -0
  21. package/{esm → dist-esm/src}/models/index.js +0 -0
  22. package/dist-esm/src/models/index.js.map +1 -0
  23. package/{esm → dist-esm/src}/models/mappers.d.ts +2 -2
  24. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  25. package/{esm → dist-esm/src}/models/mappers.js +34 -34
  26. package/dist-esm/src/models/mappers.js.map +1 -0
  27. package/{esm → dist-esm/src}/models/parameters.d.ts +0 -0
  28. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  29. package/{esm → dist-esm/src}/models/parameters.js +0 -0
  30. package/dist-esm/src/models/parameters.js.map +1 -0
  31. package/{esm → dist-esm/src}/operations/applicationDefinitions.d.ts +4 -22
  32. package/dist-esm/src/operations/applicationDefinitions.d.ts.map +1 -0
  33. package/{esm → dist-esm/src}/operations/applicationDefinitions.js +23 -93
  34. package/dist-esm/src/operations/applicationDefinitions.js.map +1 -0
  35. package/{esm → dist-esm/src}/operations/applications.d.ts +4 -36
  36. package/dist-esm/src/operations/applications.d.ts.map +1 -0
  37. package/{esm → dist-esm/src}/operations/applications.js +23 -170
  38. package/dist-esm/src/operations/applications.js.map +1 -0
  39. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  40. package/dist-esm/src/operations/index.d.ts.map +1 -0
  41. package/{esm → dist-esm/src}/operations/index.js +0 -0
  42. package/dist-esm/src/operations/index.js.map +1 -0
  43. package/{esm → dist-esm/src}/operationsInterfaces/applicationDefinitions.d.ts +1 -9
  44. package/dist-esm/src/operationsInterfaces/applicationDefinitions.d.ts.map +1 -0
  45. package/{esm → dist-esm/src}/operationsInterfaces/applicationDefinitions.js +1 -1
  46. package/dist-esm/src/operationsInterfaces/applicationDefinitions.js.map +1 -0
  47. package/{esm → dist-esm/src}/operationsInterfaces/applications.d.ts +1 -15
  48. package/dist-esm/src/operationsInterfaces/applications.d.ts.map +1 -0
  49. package/{esm → dist-esm/src}/operationsInterfaces/applications.js +1 -1
  50. package/dist-esm/src/operationsInterfaces/applications.js.map +1 -0
  51. package/{esm → dist-esm/src}/operationsInterfaces/index.d.ts +0 -0
  52. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  53. package/{esm → dist-esm/src}/operationsInterfaces/index.js +0 -0
  54. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  55. package/dist-esm/test/sampleTest.d.ts +2 -0
  56. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  57. package/dist-esm/test/sampleTest.js +40 -0
  58. package/dist-esm/test/sampleTest.js.map +1 -0
  59. package/package.json +27 -33
  60. package/review/arm-managedapplications.api.md +20 -58
  61. package/src/applicationClient.ts +56 -94
  62. package/src/index.ts +0 -1
  63. package/src/lroImpl.ts +34 -0
  64. package/src/models/index.ts +37 -65
  65. package/src/models/mappers.ts +34 -34
  66. package/src/operations/applicationDefinitions.ts +27 -128
  67. package/src/operations/applications.ts +27 -217
  68. package/src/operationsInterfaces/applicationDefinitions.ts +0 -13
  69. package/src/operationsInterfaces/applications.ts +0 -23
  70. package/tsconfig.json +2 -3
  71. package/{esm/index.d.ts → types/arm-managedapplications.d.ts} +19 -91
  72. package/types/tsdoc-metadata.json +11 -0
  73. package/esm/applicationClient.d.ts.map +0 -1
  74. package/esm/applicationClient.js.map +0 -1
  75. package/esm/applicationClientContext.d.ts +0 -16
  76. package/esm/applicationClientContext.d.ts.map +0 -1
  77. package/esm/applicationClientContext.js +0 -49
  78. package/esm/applicationClientContext.js.map +0 -1
  79. package/esm/coreClientLro.d.ts +0 -26
  80. package/esm/coreClientLro.d.ts.map +0 -1
  81. package/esm/coreClientLro.js +0 -186
  82. package/esm/coreClientLro.js.map +0 -1
  83. package/esm/index.d.ts.map +0 -1
  84. package/esm/index.js.map +0 -1
  85. package/esm/lro/azureAsyncPolling.d.ts +0 -3
  86. package/esm/lro/azureAsyncPolling.d.ts.map +0 -1
  87. package/esm/lro/azureAsyncPolling.js +0 -67
  88. package/esm/lro/azureAsyncPolling.js.map +0 -1
  89. package/esm/lro/bodyPolling.d.ts +0 -8
  90. package/esm/lro/bodyPolling.d.ts.map +0 -1
  91. package/esm/lro/bodyPolling.js +0 -37
  92. package/esm/lro/bodyPolling.js.map +0 -1
  93. package/esm/lro/index.d.ts +0 -4
  94. package/esm/lro/index.d.ts.map +0 -1
  95. package/esm/lro/index.js +0 -12
  96. package/esm/lro/index.js.map +0 -1
  97. package/esm/lro/locationPolling.d.ts +0 -3
  98. package/esm/lro/locationPolling.d.ts.map +0 -1
  99. package/esm/lro/locationPolling.js +0 -19
  100. package/esm/lro/locationPolling.js.map +0 -1
  101. package/esm/lro/lroEngine.d.ts +0 -14
  102. package/esm/lro/lroEngine.d.ts.map +0 -1
  103. package/esm/lro/lroEngine.js +0 -41
  104. package/esm/lro/lroEngine.js.map +0 -1
  105. package/esm/lro/models.d.ts +0 -138
  106. package/esm/lro/models.d.ts.map +0 -1
  107. package/esm/lro/models.js +0 -14
  108. package/esm/lro/models.js.map +0 -1
  109. package/esm/lro/operation.d.ts +0 -36
  110. package/esm/lro/operation.d.ts.map +0 -1
  111. package/esm/lro/operation.js +0 -82
  112. package/esm/lro/operation.js.map +0 -1
  113. package/esm/lro/passthrough.d.ts +0 -3
  114. package/esm/lro/passthrough.d.ts.map +0 -1
  115. package/esm/lro/passthrough.js +0 -15
  116. package/esm/lro/passthrough.js.map +0 -1
  117. package/esm/lro/requestUtils.d.ts +0 -16
  118. package/esm/lro/requestUtils.d.ts.map +0 -1
  119. package/esm/lro/requestUtils.js +0 -73
  120. package/esm/lro/requestUtils.js.map +0 -1
  121. package/esm/lro/stateMachine.d.ts +0 -18
  122. package/esm/lro/stateMachine.d.ts.map +0 -1
  123. package/esm/lro/stateMachine.js +0 -84
  124. package/esm/lro/stateMachine.js.map +0 -1
  125. package/esm/models/index.d.ts.map +0 -1
  126. package/esm/models/index.js.map +0 -1
  127. package/esm/models/mappers.d.ts.map +0 -1
  128. package/esm/models/mappers.js.map +0 -1
  129. package/esm/models/parameters.d.ts.map +0 -1
  130. package/esm/models/parameters.js.map +0 -1
  131. package/esm/operations/applicationDefinitions.d.ts.map +0 -1
  132. package/esm/operations/applicationDefinitions.js.map +0 -1
  133. package/esm/operations/applications.d.ts.map +0 -1
  134. package/esm/operations/applications.js.map +0 -1
  135. package/esm/operations/index.d.ts.map +0 -1
  136. package/esm/operations/index.js.map +0 -1
  137. package/esm/operationsInterfaces/applicationDefinitions.d.ts.map +0 -1
  138. package/esm/operationsInterfaces/applicationDefinitions.js.map +0 -1
  139. package/esm/operationsInterfaces/applications.d.ts.map +0 -1
  140. package/esm/operationsInterfaces/applications.js.map +0 -1
  141. package/esm/operationsInterfaces/index.d.ts.map +0 -1
  142. package/esm/operationsInterfaces/index.js.map +0 -1
  143. package/src/applicationClientContext.ts +0 -70
  144. package/src/coreClientLro.ts +0 -323
  145. package/src/lro/azureAsyncPolling.ts +0 -96
  146. package/src/lro/bodyPolling.ts +0 -54
  147. package/src/lro/index.ts +0 -26
  148. package/src/lro/locationPolling.ts +0 -30
  149. package/src/lro/lroEngine.ts +0 -61
  150. package/src/lro/models.ts +0 -173
  151. package/src/lro/operation.ts +0 -120
  152. package/src/lro/passthrough.ts +0 -23
  153. package/src/lro/requestUtils.ts +0 -105
  154. package/src/lro/stateMachine.ts +0 -138
@@ -1,67 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import { __awaiter } from "tslib";
9
- // Copyright (c) Microsoft Corporation.
10
- // Licensed under the MIT license.
11
- import { failureStates, successStates } from "./models";
12
- import { isUnexpectedPollingResponse } from "./requestUtils";
13
- function getResponseStatus(rawResponse) {
14
- var _a, _b;
15
- const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
16
- return (_b = status === null || status === void 0 ? void 0 : status.toLowerCase()) !== null && _b !== void 0 ? _b : "succeeded";
17
- }
18
- function isAzureAsyncPollingDone(rawResponse) {
19
- const state = getResponseStatus(rawResponse);
20
- if (isUnexpectedPollingResponse(rawResponse) ||
21
- failureStates.includes(state)) {
22
- throw new Error(`Operation status: ${state}`);
23
- }
24
- return successStates.includes(state);
25
- }
26
- function sendFinalRequest(lro, lroResourceLocationConfig, resourceLocation) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- switch (lroResourceLocationConfig) {
29
- case "original-uri":
30
- return lro.retrieveAzureAsyncResource();
31
- case "azure-async-operation":
32
- return Promise.resolve(undefined);
33
- case "location":
34
- default:
35
- return lro.retrieveAzureAsyncResource(resourceLocation);
36
- }
37
- });
38
- }
39
- export function processAzureAsyncOperationResult(lro, resourceLocation, lroResourceLocationConfig) {
40
- return (rawResponse, flatResponse) => {
41
- if (isAzureAsyncPollingDone(rawResponse)) {
42
- if (resourceLocation === undefined) {
43
- return { rawResponse, flatResponse, done: true };
44
- }
45
- else {
46
- return {
47
- rawResponse,
48
- flatResponse,
49
- done: false,
50
- next: () => __awaiter(this, void 0, void 0, function* () {
51
- const finalResponse = yield sendFinalRequest(lro, lroResourceLocationConfig, resourceLocation);
52
- return Object.assign(Object.assign({}, (finalResponse !== null && finalResponse !== void 0 ? finalResponse : {
53
- rawResponse,
54
- flatResponse
55
- })), { done: true });
56
- })
57
- };
58
- }
59
- }
60
- return {
61
- rawResponse,
62
- flatResponse,
63
- done: false
64
- };
65
- };
66
- }
67
- //# sourceMappingURL=azureAsyncPolling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureAsyncPolling.js","sourceRoot":"","sources":["../../src/lro/azureAsyncPolling.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,aAAa,EAOb,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,SAAS,iBAAiB,CAAC,WAAwB;;IACjD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAC,WAAW,CAAC,IAAgB,mCAAI,EAAE,CAAC;IACvD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,EAAE,mCAAI,WAAW,CAAC;AAC9C,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAwB;IACvD,MAAM,KAAK,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC7C,IACE,2BAA2B,CAAC,WAAW,CAAC;QACxC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC7B;QACA,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;KAC/C;IACD,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,SAAe,gBAAgB,CAC7B,GAAkC,EAClC,yBAAqD,EACrD,gBAAyB;;QAEzB,QAAQ,yBAAyB,EAAE;YACjC,KAAK,cAAc;gBACjB,OAAO,GAAG,CAAC,0BAA0B,EAAE,CAAC;YAC1C,KAAK,uBAAuB;gBAC1B,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACpC,KAAK,UAAU,CAAC;YAChB;gBACE,OAAO,GAAG,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;SAC3D;IACH,CAAC;CAAA;AAED,MAAM,UAAU,gCAAgC,CAC9C,GAAkC,EAClC,gBAAyB,EACzB,yBAAqD;IAErD,OAAO,CACL,WAAwB,EACxB,YAAqB,EACD,EAAE;QACtB,IAAI,uBAAuB,CAAC,WAAW,CAAC,EAAE;YACxC,IAAI,gBAAgB,KAAK,SAAS,EAAE;gBAClC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;aAClD;iBAAM;gBACL,OAAO;oBACL,WAAW;oBACX,YAAY;oBACZ,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,GAAS,EAAE;wBACf,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAC1C,GAAG,EACH,yBAAyB,EACzB,gBAAgB,CACjB,CAAC;wBACF,uCACK,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI;4BACnB,WAAW;4BACX,YAAY;yBACb,CAAC,KACF,IAAI,EAAE,IAAI,IACV;oBACJ,CAAC,CAAA;iBACF,CAAC;aACH;SACF;QACD,OAAO;YACL,WAAW;YACX,YAAY;YACZ,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- import { LroStatus, RawResponse } from "./models";
2
- export declare function isBodyPollingDone(rawResponse: RawResponse): boolean;
3
- /**
4
- * Creates a polling strategy based on BodyPolling which uses the provisioning state
5
- * from the result to determine the current operation state
6
- */
7
- export declare function processBodyPollingOperationResult<TResult>(rawResponse: RawResponse, flatResponse: TResult): LroStatus<TResult>;
8
- //# sourceMappingURL=bodyPolling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bodyPolling.d.ts","sourceRoot":"","sources":["../../src/lro/bodyPolling.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,SAAS,EACT,WAAW,EAEZ,MAAM,UAAU,CAAC;AAUlB,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAWnE;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EACvD,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,OAAO,GACpB,SAAS,CAAC,OAAO,CAAC,CAMpB"}
@@ -1,37 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- // Copyright (c) Microsoft Corporation.
9
- // Licensed under the MIT license.
10
- import { failureStates, successStates } from "./models";
11
- import { isUnexpectedPollingResponse } from "./requestUtils";
12
- function getProvisioningState(rawResponse) {
13
- var _a, _b, _c;
14
- const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
15
- const state = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState;
16
- return (_c = state === null || state === void 0 ? void 0 : state.toLowerCase()) !== null && _c !== void 0 ? _c : "succeeded";
17
- }
18
- export function isBodyPollingDone(rawResponse) {
19
- const state = getProvisioningState(rawResponse);
20
- if (isUnexpectedPollingResponse(rawResponse) ||
21
- failureStates.includes(state)) {
22
- throw new Error(`The long running operation has failed. The provisioning state: ${state}.`);
23
- }
24
- return successStates.includes(state);
25
- }
26
- /**
27
- * Creates a polling strategy based on BodyPolling which uses the provisioning state
28
- * from the result to determine the current operation state
29
- */
30
- export function processBodyPollingOperationResult(rawResponse, flatResponse) {
31
- return {
32
- rawResponse,
33
- flatResponse,
34
- done: isBodyPollingDone(rawResponse)
35
- };
36
- }
37
- //# sourceMappingURL=bodyPolling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bodyPolling.js","sourceRoot":"","sources":["../../src/lro/bodyPolling.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,aAAa,EAIb,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,SAAS,oBAAoB,CAAC,WAAwB;;IACpD,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,MAAC,WAAW,CAAC,IAAgB,mCAAI,EAAE,CAAC;IAC9E,MAAM,KAAK,GACT,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,iBAAiB,mCAAI,iBAAiB,CAAC;IACrD,OAAO,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE,mCAAI,WAAW,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAwB;IACxD,MAAM,KAAK,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAChD,IACE,2BAA2B,CAAC,WAAW,CAAC;QACxC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC7B;QACA,MAAM,IAAI,KAAK,CACb,kEAAkE,KAAK,GAAG,CAC3E,CAAC;KACH;IACD,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iCAAiC,CAC/C,WAAwB,EACxB,YAAqB;IAErB,OAAO;QACL,WAAW;QACX,YAAY;QACZ,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;KACrC,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- export { LroEngine } from "./lroEngine";
2
- export { createGetLroStatusFromResponse } from "./stateMachine";
3
- export { LroResourceLocationConfig, GetLroStatusFromResponse, RawResponse, LongRunningOperation, LroConfig, LroMode, LroResponse, LroStatus, LroTerminalState, LroInProgressState, LroEngineOptions } from "./models";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lro/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,UAAU,CAAC"}
package/esm/lro/index.js DELETED
@@ -1,12 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- // Copyright (c) Microsoft Corporation.
9
- // Licensed under the MIT license.
10
- export { LroEngine } from "./lroEngine";
11
- export { createGetLroStatusFromResponse } from "./stateMachine";
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lro/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { LroStatus, RawResponse } from "./models";
2
- export declare function processLocationPollingOperationResult<TResult>(rawResponse: RawResponse, flatResponse: TResult): LroStatus<TResult>;
3
- //# sourceMappingURL=locationPolling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locationPolling.d.ts","sourceRoot":"","sources":["../../src/lro/locationPolling.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AASlD,wBAAgB,qCAAqC,CAAC,OAAO,EAC3D,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,OAAO,GACpB,SAAS,CAAC,OAAO,CAAC,CAMpB"}
@@ -1,19 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import { isUnexpectedPollingResponse } from "./requestUtils";
9
- function isLocationPollingDone(rawResponse) {
10
- return (!isUnexpectedPollingResponse(rawResponse) && rawResponse.statusCode !== 202);
11
- }
12
- export function processLocationPollingOperationResult(rawResponse, flatResponse) {
13
- return {
14
- rawResponse,
15
- flatResponse,
16
- done: isLocationPollingDone(rawResponse)
17
- };
18
- }
19
- //# sourceMappingURL=locationPolling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locationPolling.js","sourceRoot":"","sources":["../../src/lro/locationPolling.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,SAAS,qBAAqB,CAAC,WAAwB;IACrD,OAAO,CACL,CAAC,2BAA2B,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,UAAU,KAAK,GAAG,CAC5E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,WAAwB,EACxB,YAAqB;IAErB,OAAO;QACL,WAAW;QACX,YAAY;QACZ,IAAI,EAAE,qBAAqB,CAAC,WAAW,CAAC;KACzC,CAAC;AACJ,CAAC"}
@@ -1,14 +0,0 @@
1
- import { Poller, PollOperationState } from "@azure/core-lro";
2
- import { LongRunningOperation, LroEngineOptions } from "./models";
3
- /**
4
- * The LRO Engine, a class that performs polling.
5
- */
6
- export declare class LroEngine<TResult, TState extends PollOperationState<TResult>> extends Poller<TState, TResult> {
7
- private intervalInMs;
8
- constructor(lro: LongRunningOperation<TResult>, options?: LroEngineOptions);
9
- /**
10
- * The method used by the poller to wait before attempting to update its operation.
11
- */
12
- delay(): Promise<void>;
13
- }
14
- //# sourceMappingURL=lroEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lroEngine.d.ts","sourceRoot":"","sources":["../../src/lro/lroEngine.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAEjB,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,qBAAa,SAAS,CACpB,OAAO,EACP,MAAM,SAAS,kBAAkB,CAAC,OAAO,CAAC,CAC1C,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,OAAO,CAAC,YAAY,CAAS;gBAEjB,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAwB1E;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAKvB"}
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- // Copyright (c) Microsoft Corporation.
9
- // Licensed under the MIT license.
10
- import { Poller } from "@azure/core-lro";
11
- import { GenericPollOperation } from "./operation";
12
- /**
13
- * The LRO Engine, a class that performs polling.
14
- */
15
- export class LroEngine extends Poller {
16
- constructor(lro, options) {
17
- const { intervalInMs = 2000, resumeFrom } = options || {};
18
- function deserializeState(resumeFrom) {
19
- try {
20
- return JSON.parse(resumeFrom).state;
21
- }
22
- catch (e) {
23
- throw new Error(`LroEngine: Unable to deserialize state: ${resumeFrom}`);
24
- }
25
- }
26
- const state = resumeFrom
27
- ? deserializeState(resumeFrom)
28
- : {};
29
- const operation = new GenericPollOperation(state, lro);
30
- super(operation);
31
- this.intervalInMs = intervalInMs;
32
- operation.setPollerConfig(this);
33
- }
34
- /**
35
- * The method used by the poller to wait before attempting to update its operation.
36
- */
37
- delay() {
38
- return new Promise((resolve) => setTimeout(() => resolve(), this.intervalInMs));
39
- }
40
- }
41
- //# sourceMappingURL=lroEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lroEngine.js","sourceRoot":"","sources":["../../src/lro/lroEngine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAsB,MAAM,iBAAiB,CAAC;AAM7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,SAGX,SAAQ,MAAuB;IAG/B,YAAY,GAAkC,EAAE,OAA0B;QACxE,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAC1D,SAAS,gBAAgB,CACvB,UAAkB;YAElB,IAAI;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;aACrC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CACb,2CAA2C,UAAU,EAAE,CACxD,CAAC;aACH;QACH,CAAC;QACD,MAAM,KAAK,GAAkD,UAAU;YACrE,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC;YAC9B,CAAC,CAAE,EAAU,CAAC;QAEhB,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACvD,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,SAAS,CAAC,eAAe,CAAC,IAAW,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAC/C,CAAC;IACJ,CAAC;CACF"}
@@ -1,138 +0,0 @@
1
- import { PollOperationState } from "@azure/core-lro";
2
- /**
3
- * Options for the LRO poller.
4
- */
5
- export interface LroEngineOptions {
6
- /**
7
- * Defines how much time the poller is going to wait before making a new request to the service.
8
- */
9
- intervalInMs?: number;
10
- /**
11
- * A serialized poller which can be used to resume an existing paused Long-Running-Operation.
12
- */
13
- resumeFrom?: string;
14
- }
15
- export declare const successStates: string[];
16
- export declare const failureStates: string[];
17
- /**
18
- * The LRO states that signal that the LRO has completed.
19
- */
20
- export declare const terminalStates: string[];
21
- /**
22
- * The potential location of the result of the LRO if specified by the LRO extension in the swagger.
23
- */
24
- export declare type LroResourceLocationConfig = "azure-async-operation" | "location" | "original-uri";
25
- /**
26
- * The type of a LRO response body. This is just a convenience type for checking the status of the operation.
27
- */
28
- export interface LroBody extends Record<string, unknown> {
29
- /** The status of the operation. */
30
- status?: string;
31
- /** The state of the provisioning process */
32
- provisioningState?: string;
33
- /** The properties of the provisioning process */
34
- properties?: {
35
- provisioningState?: string;
36
- } & Record<string, unknown>;
37
- }
38
- /**
39
- * Simple type of the raw response.
40
- */
41
- export interface RawResponse {
42
- /** The HTTP status code */
43
- statusCode: number;
44
- /** A HttpHeaders collection in the response represented as a simple JSON object where all header names have been normalized to be lower-case. */
45
- headers: {
46
- [headerName: string]: string;
47
- };
48
- /** The parsed response body */
49
- body?: unknown;
50
- }
51
- /**
52
- * The type of the response of a LRO.
53
- */
54
- export interface LroResponse<T> {
55
- /** The flattened response */
56
- flatResponse: T;
57
- /** The raw response */
58
- rawResponse: RawResponse;
59
- }
60
- /** The type of which LRO implementation being followed by a specific API. */
61
- export declare type LroMode = "AzureAsync" | "Location" | "Body";
62
- /**
63
- * The configuration of a LRO to determine how to perform polling and checking whether the operation has completed.
64
- */
65
- export interface LroConfig {
66
- /** The LRO mode */
67
- mode?: LroMode;
68
- /** The path of a provisioned resource */
69
- resourceLocation?: string;
70
- }
71
- /**
72
- * Type of a polling operation state that can actually be resumed.
73
- */
74
- export declare type ResumablePollOperationState<T> = PollOperationState<T> & {
75
- initialRawResponse?: RawResponse;
76
- config?: LroConfig;
77
- pollingURL?: string;
78
- };
79
- export interface PollerConfig {
80
- intervalInMs: number;
81
- }
82
- /**
83
- * The type of a terminal state of an LRO.
84
- */
85
- export interface LroTerminalState<T> extends LroResponse<T> {
86
- /**
87
- * Whether the operation has finished.
88
- */
89
- done: true;
90
- }
91
- /**
92
- * The type of an in-progress state of an LRO.
93
- */
94
- export interface LroInProgressState<T> extends LroResponse<T> {
95
- /**
96
- * Whether the operation has finished.
97
- */
98
- done: false;
99
- /**
100
- * The request to be sent next if it is different from the standard polling one.
101
- * Notice that it will disregard any polling URLs provided to it.
102
- */
103
- next?: () => Promise<LroStatus<T>>;
104
- }
105
- /**
106
- * The type of an LRO state which is a tagged union of terminal and in-progress states.
107
- */
108
- export declare type LroStatus<T> = LroTerminalState<T> | LroInProgressState<T>;
109
- /**
110
- * The type of the getLROStatusFromResponse method. It takes the response as input and returns along the response whether the operation has finished.
111
- */
112
- export declare type GetLroStatusFromResponse<T> = (rawResponse: RawResponse, flatResponse: T) => LroStatus<T>;
113
- /**
114
- * Description of a long running operation.
115
- */
116
- export interface LongRunningOperation<T> {
117
- /**
118
- * The request path.
119
- */
120
- requestPath: string;
121
- /**
122
- * The HTTP request method.
123
- */
124
- requestMethod: string;
125
- /**
126
- * A function that can be used to send initial request to the service.
127
- */
128
- sendInitialRequest: (initializeState: (rawResponse: RawResponse, flatResponse: unknown) => boolean) => Promise<LroResponse<T>>;
129
- /**
130
- * A function that can be used to poll for the current status of a long running operation.
131
- */
132
- sendPollRequest: (config: LroConfig, path: string) => Promise<LroStatus<T>>;
133
- /**
134
- * A function that can be used to retrieve the provisioned azure resource.
135
- */
136
- retrieveAzureAsyncResource: (path?: string) => Promise<LroResponse<T>>;
137
- }
138
- //# sourceMappingURL=models.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/lro/models.ts"],"names":[],"mappings":"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"}
package/esm/lro/models.js DELETED
@@ -1,14 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- export const successStates = ["succeeded"];
9
- export const failureStates = ["failed", "canceled", "cancelled"];
10
- /**
11
- * The LRO states that signal that the LRO has completed.
12
- */
13
- export const terminalStates = successStates.concat(failureStates);
14
- //# sourceMappingURL=models.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/lro/models.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,WAAW,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACjE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { AbortSignalLike } from "@azure/abort-controller";
2
- import { PollOperationState, PollOperation } from "@azure/core-lro";
3
- import { PollerConfig, ResumablePollOperationState, LongRunningOperation } from "./models";
4
- export declare class GenericPollOperation<TResult, TState extends PollOperationState<TResult>> implements PollOperation<TState, TResult> {
5
- state: TState & ResumablePollOperationState<TResult>;
6
- private lro;
7
- private getLROStatusFromResponse?;
8
- private pollerConfig?;
9
- constructor(state: TState & ResumablePollOperationState<TResult>, lro: LongRunningOperation<TResult>);
10
- setPollerConfig(pollerConfig: PollerConfig): void;
11
- /**
12
- * General update function for LROPoller, the general process is as follows
13
- * 1. Check initial operation result to determine the strategy to use
14
- * - Strategies: Location, Azure-AsyncOperation, Original Uri
15
- * 2. Check if the operation result has a terminal state
16
- * - Terminal state will be determined by each strategy
17
- * 2.1 If it is terminal state Check if a final GET request is required, if so
18
- * send final GET request and return result from operation. If no final GET
19
- * is required, just return the result from operation.
20
- * - Determining what to call for final request is responsibility of each strategy
21
- * 2.2 If it is not terminal state, call the polling operation and go to step 1
22
- * - Determining what to call for polling is responsibility of each strategy
23
- * - Strategies will always use the latest URI for polling if provided otherwise
24
- * the last known one
25
- */
26
- update(options?: {
27
- abortSignal?: AbortSignalLike | undefined;
28
- fireProgress?: ((state: TState) => void) | undefined;
29
- }): Promise<PollOperation<TState, TResult>>;
30
- cancel(): Promise<PollOperation<TState, TResult>>;
31
- /**
32
- * Serializes the Poller operation.
33
- */
34
- toString(): string;
35
- }
36
- //# sourceMappingURL=operation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/lro/operation.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAIlB,qBAAa,oBAAoB,CAC/B,OAAO,EACP,MAAM,SAAS,kBAAkB,CAAC,OAAO,CAAC,CAC1C,YAAW,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC;IAOhC,KAAK,EAAE,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC;IAC3D,OAAO,CAAC,GAAG;IAPb,OAAO,CAAC,wBAAwB,CAAC,CAGA;IACjC,OAAO,CAAC,YAAY,CAAC,CAAe;gBAE3B,KAAK,EAAE,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC,EACnD,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC;IAGrC,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAIxD;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,OAAO,CAAC,EAAE;QACrB,WAAW,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;QAC1C,YAAY,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;KACtD,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAgDrC,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKvD;;OAEG;IACI,QAAQ,IAAI,MAAM;CAK1B"}
@@ -1,82 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import { __awaiter } from "tslib";
9
- import { getPollingUrl } from "./requestUtils";
10
- import { createInitializeState, createPollForLROStatus } from "./stateMachine";
11
- export class GenericPollOperation {
12
- constructor(state, lro) {
13
- this.state = state;
14
- this.lro = lro;
15
- }
16
- setPollerConfig(pollerConfig) {
17
- this.pollerConfig = pollerConfig;
18
- }
19
- /**
20
- * General update function for LROPoller, the general process is as follows
21
- * 1. Check initial operation result to determine the strategy to use
22
- * - Strategies: Location, Azure-AsyncOperation, Original Uri
23
- * 2. Check if the operation result has a terminal state
24
- * - Terminal state will be determined by each strategy
25
- * 2.1 If it is terminal state Check if a final GET request is required, if so
26
- * send final GET request and return result from operation. If no final GET
27
- * is required, just return the result from operation.
28
- * - Determining what to call for final request is responsibility of each strategy
29
- * 2.2 If it is not terminal state, call the polling operation and go to step 1
30
- * - Determining what to call for polling is responsibility of each strategy
31
- * - Strategies will always use the latest URI for polling if provided otherwise
32
- * the last known one
33
- */
34
- update(options) {
35
- var _a, _b;
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const state = this.state;
38
- if (!state.isStarted) {
39
- const initializeState = createInitializeState(state, this.lro.requestPath, this.lro.requestMethod);
40
- yield this.lro.sendInitialRequest(initializeState);
41
- }
42
- if (!state.isCompleted) {
43
- if (this.getLROStatusFromResponse === undefined) {
44
- if (state.config === undefined) {
45
- throw new Error("Bad state: LRO mode is undefined. Please check if the serialized state is well-formed.");
46
- }
47
- this.getLROStatusFromResponse = createPollForLROStatus(this.lro, state.config);
48
- }
49
- if (state.pollingURL === undefined) {
50
- throw new Error("Bad state: polling URL is undefined. Please check if the serialized state is well-formed.");
51
- }
52
- const currentState = yield this.getLROStatusFromResponse(state.pollingURL, this.pollerConfig);
53
- if (currentState.done) {
54
- state.result = currentState.flatResponse;
55
- state.isCompleted = true;
56
- }
57
- else {
58
- this.getLROStatusFromResponse =
59
- (_a = currentState.next) !== null && _a !== void 0 ? _a : this.getLROStatusFromResponse;
60
- state.pollingURL = getPollingUrl(currentState.rawResponse, state.pollingURL);
61
- }
62
- }
63
- (_b = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _b === void 0 ? void 0 : _b.call(options, state);
64
- return this;
65
- });
66
- }
67
- cancel() {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- this.state.isCancelled = true;
70
- return this;
71
- });
72
- }
73
- /**
74
- * Serializes the Poller operation.
75
- */
76
- toString() {
77
- return JSON.stringify({
78
- state: this.state
79
- });
80
- }
81
- }
82
- //# sourceMappingURL=operation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/lro/operation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAaH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,MAAM,OAAO,oBAAoB;IAS/B,YACS,KAAoD,EACnD,GAAkC;QADnC,UAAK,GAAL,KAAK,CAA+C;QACnD,QAAG,GAAH,GAAG,CAA+B;IACzC,CAAC;IAEG,eAAe,CAAC,YAA0B;QAC/C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,OAGZ;;;YACC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;gBACpB,MAAM,eAAe,GAAG,qBAAqB,CAC3C,KAAK,EACL,IAAI,CAAC,GAAG,CAAC,WAAW,EACpB,IAAI,CAAC,GAAG,CAAC,aAAa,CACvB,CAAC;gBACF,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;aACpD;YAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;gBACtB,IAAI,IAAI,CAAC,wBAAwB,KAAK,SAAS,EAAE;oBAC/C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;wBAC9B,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;qBACH;oBACD,IAAI,CAAC,wBAAwB,GAAG,sBAAsB,CACpD,IAAI,CAAC,GAAG,EACR,KAAK,CAAC,MAAM,CACb,CAAC;iBACH;gBACD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;oBAClC,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;iBACH;gBACD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,wBAAwB,CACtD,KAAK,CAAC,UAAU,EAChB,IAAI,CAAC,YAAa,CACnB,CAAC;gBACF,IAAI,YAAY,CAAC,IAAI,EAAE;oBACrB,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC;oBACzC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;iBAC1B;qBAAM;oBACL,IAAI,CAAC,wBAAwB;wBAC3B,MAAA,YAAY,CAAC,IAAI,mCAAI,IAAI,CAAC,wBAAwB,CAAC;oBACrD,KAAK,CAAC,UAAU,GAAG,aAAa,CAC9B,YAAY,CAAC,WAAW,EACxB,KAAK,CAAC,UAAU,CACjB,CAAC;iBACH;aACF;YACD,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,+CAArB,OAAO,EAAiB,KAAK,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;;KACb;IAEK,MAAM;;YACV,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- import { LroStatus, RawResponse } from "./models";
2
- export declare function processPassthroughOperationResult<TResult>(rawResponse: RawResponse, flatResponse: TResult): LroStatus<TResult>;
3
- //# sourceMappingURL=passthrough.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"passthrough.d.ts","sourceRoot":"","sources":["../../src/lro/passthrough.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElD,wBAAgB,iCAAiC,CAAC,OAAO,EACvD,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,OAAO,GACpB,SAAS,CAAC,OAAO,CAAC,CAMpB"}
@@ -1,15 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- export function processPassthroughOperationResult(rawResponse, flatResponse) {
9
- return {
10
- rawResponse,
11
- flatResponse,
12
- done: true
13
- };
14
- }
15
- //# sourceMappingURL=passthrough.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"passthrough.js","sourceRoot":"","sources":["../../src/lro/passthrough.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,UAAU,iCAAiC,CAC/C,WAAwB,EACxB,YAAqB;IAErB,OAAO;QACL,WAAW;QACX,YAAY;QACZ,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC"}
@@ -1,16 +0,0 @@
1
- import { LroConfig, RawResponse } from "./models";
2
- /**
3
- * Detects where the continuation token is and returns it. Notice that azure-asyncoperation
4
- * must be checked first before the other location headers because there are scenarios
5
- * where both azure-asyncoperation and location could be present in the same response but
6
- * azure-asyncoperation should be the one to use for polling.
7
- */
8
- export declare function getPollingUrl(rawResponse: RawResponse, defaultPath: string): string;
9
- export declare function inferLroMode(requestPath: string, requestMethod: string, rawResponse: RawResponse): LroConfig;
10
- export declare class RestError extends Error {
11
- statusCode?: number;
12
- constructor(message: string, statusCode: number);
13
- }
14
- export declare function isUnexpectedInitialResponse(rawResponse: RawResponse): boolean;
15
- export declare function isUnexpectedPollingResponse(rawResponse: RawResponse): boolean;
16
- //# sourceMappingURL=requestUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestUtils.d.ts","sourceRoot":"","sources":["../../src/lro/requestUtils.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,GAClB,MAAM,CAOR;AAcD,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,WAAW,GACvB,SAAS,CAwBX;AAED,qBAAa,SAAU,SAAQ,KAAK;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;gBACf,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAOhD;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAS7E;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAS7E"}