@azure/core-lro 3.3.2-alpha.20260310.2 → 3.4.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.
- package/README.md +14 -15
- package/dist/browser/http/models.js.map +1 -1
- package/dist/browser/http/operation.js +1 -1
- package/dist/browser/http/operation.js.map +1 -1
- package/dist/commonjs/http/models.js +1 -0
- package/dist/commonjs/http/models.js.map +2 -2
- package/dist/commonjs/http/operation.js +2 -1
- package/dist/commonjs/http/operation.js.map +3 -3
- package/dist/commonjs/http/poller.js +1 -0
- package/dist/commonjs/http/poller.js.map +1 -1
- package/dist/commonjs/http/utils.js +1 -0
- package/dist/commonjs/http/utils.js.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/logger.js +1 -0
- package/dist/commonjs/logger.js.map +1 -1
- package/dist/commonjs/poller/constants.js +1 -0
- package/dist/commonjs/poller/constants.js.map +1 -1
- package/dist/commonjs/poller/models.js +1 -0
- package/dist/commonjs/poller/models.js.map +1 -1
- package/dist/commonjs/poller/operation.js +1 -0
- package/dist/commonjs/poller/operation.js.map +1 -1
- package/dist/commonjs/poller/poller.js +1 -0
- package/dist/commonjs/poller/poller.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/http/models.js +4 -0
- package/dist/esm/http/models.js.map +1 -7
- package/dist/esm/http/operation.js +217 -219
- package/dist/esm/http/operation.js.map +1 -7
- package/dist/esm/http/poller.js +44 -58
- package/dist/esm/http/poller.js.map +1 -7
- package/dist/esm/http/utils.js +41 -32
- package/dist/esm/http/utils.js.map +1 -7
- package/dist/esm/index.js +5 -6
- package/dist/esm/index.js.map +1 -7
- package/dist/esm/logger.js +8 -4
- package/dist/esm/logger.js.map +1 -7
- package/dist/esm/poller/constants.js +11 -6
- package/dist/esm/poller/constants.js.map +1 -7
- package/dist/esm/poller/models.js +4 -0
- package/dist/esm/poller/models.js.map +1 -7
- package/dist/esm/poller/operation.js +150 -176
- package/dist/esm/poller/operation.js.map +1 -7
- package/dist/esm/poller/poller.js +176 -177
- package/dist/esm/poller/poller.js.map +1 -7
- package/dist/react-native/http/models.js.map +1 -1
- package/dist/react-native/http/operation.js +1 -1
- package/dist/react-native/http/operation.js.map +1 -1
- package/package.json +31 -20
package/dist/esm/http/poller.js
CHANGED
|
@@ -1,61 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
getOperationStatus,
|
|
5
|
-
getResourceLocation,
|
|
6
|
-
getStatusFromInitialResponse,
|
|
7
|
-
inferLroMode,
|
|
8
|
-
isOperationError,
|
|
9
|
-
parseRetryAfter
|
|
10
|
-
} from "./operation.js";
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { getErrorFromResponse, getOperationLocation, getOperationStatus, getResourceLocation, getStatusFromInitialResponse, inferLroMode, isOperationError, parseRetryAfter, } from "./operation.js";
|
|
11
4
|
import { buildCreatePoller } from "../poller/poller.js";
|
|
12
5
|
import { rewriteUrl } from "./utils.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
withOperationLocation,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
restoreFrom,
|
|
54
|
-
updateState,
|
|
55
|
-
processResult: processResult ? ({ flatResponse }, state) => processResult(flatResponse, state) : ({ flatResponse }) => flatResponse
|
|
56
|
-
}
|
|
57
|
-
);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a poller that can be used to poll a long-running operation.
|
|
8
|
+
* @param lro - Description of the long-running operation
|
|
9
|
+
* @param options - options to configure the poller
|
|
10
|
+
* @returns an initialized poller
|
|
11
|
+
*/
|
|
12
|
+
export function createHttpPoller(lro, options) {
|
|
13
|
+
const { resourceLocationConfig, intervalInMs, processResult, restoreFrom, updateState, withOperationLocation, resolveOnUnsuccessful = false, baseUrl, skipFinalGet, } = options || {};
|
|
14
|
+
return buildCreatePoller({
|
|
15
|
+
getStatusFromInitialResponse,
|
|
16
|
+
getStatusFromPollResponse: getOperationStatus,
|
|
17
|
+
isOperationError,
|
|
18
|
+
getOperationLocation,
|
|
19
|
+
getResourceLocation,
|
|
20
|
+
getPollingInterval: parseRetryAfter,
|
|
21
|
+
getError: getErrorFromResponse,
|
|
22
|
+
resolveOnUnsuccessful,
|
|
23
|
+
})({
|
|
24
|
+
init: async () => {
|
|
25
|
+
const response = await lro.sendInitialRequest();
|
|
26
|
+
const config = inferLroMode(response.rawResponse, resourceLocationConfig, skipFinalGet);
|
|
27
|
+
return {
|
|
28
|
+
response,
|
|
29
|
+
operationLocation: rewriteUrl({ url: config?.operationLocation, baseUrl }),
|
|
30
|
+
resourceLocation: rewriteUrl({ url: config?.resourceLocation, baseUrl }),
|
|
31
|
+
initialRequestUrl: config?.initialRequestUrl,
|
|
32
|
+
requestMethod: config?.requestMethod,
|
|
33
|
+
...(config?.mode ? { metadata: { mode: config.mode } } : {}),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
poll: lro.sendPollRequest,
|
|
37
|
+
}, {
|
|
38
|
+
intervalInMs,
|
|
39
|
+
withOperationLocation,
|
|
40
|
+
restoreFrom,
|
|
41
|
+
updateState,
|
|
42
|
+
processResult: processResult
|
|
43
|
+
? ({ flatResponse }, state) => processResult(flatResponse, state)
|
|
44
|
+
: ({ flatResponse }) => flatResponse,
|
|
45
|
+
});
|
|
58
46
|
}
|
|
59
|
-
|
|
60
|
-
createHttpPoller
|
|
61
|
-
};
|
|
47
|
+
//# sourceMappingURL=poller.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["/mnt/vss/_work/1/s/sdk/core/core-lro/src/http/poller.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RunningOperation, OperationResponse } from \"./models.js\";\nimport type { OperationState, PollerLike } from \"../poller/models.js\";\nimport {\n getErrorFromResponse,\n getOperationLocation,\n getOperationStatus,\n getResourceLocation,\n getStatusFromInitialResponse,\n inferLroMode,\n isOperationError,\n parseRetryAfter,\n} from \"./operation.js\";\nimport type { CreateHttpPollerOptions } from \"./models.js\";\nimport { buildCreatePoller } from \"../poller/poller.js\";\nimport { rewriteUrl } from \"./utils.js\";\n\n/**\n * Creates a poller that can be used to poll a long-running operation.\n * @param lro - Description of the long-running operation\n * @param options - options to configure the poller\n * @returns an initialized poller\n */\nexport function createHttpPoller<TResult, TState extends OperationState<TResult>>(\n lro: RunningOperation,\n options?: CreateHttpPollerOptions<TResult, TState>,\n): PollerLike<TState, TResult> {\n const {\n resourceLocationConfig,\n intervalInMs,\n processResult,\n restoreFrom,\n updateState,\n withOperationLocation,\n resolveOnUnsuccessful = false,\n baseUrl,\n skipFinalGet,\n } = options || {};\n return buildCreatePoller<OperationResponse, TResult, TState>({\n getStatusFromInitialResponse,\n getStatusFromPollResponse: getOperationStatus,\n isOperationError,\n getOperationLocation,\n getResourceLocation,\n getPollingInterval: parseRetryAfter,\n getError: getErrorFromResponse,\n resolveOnUnsuccessful,\n })(\n {\n init: async () => {\n const response = await lro.sendInitialRequest();\n const config = inferLroMode(response.rawResponse, resourceLocationConfig, skipFinalGet);\n return {\n response,\n operationLocation: rewriteUrl({ url: config?.operationLocation, baseUrl }),\n resourceLocation: rewriteUrl({ url: config?.resourceLocation, baseUrl }),\n initialRequestUrl: config?.initialRequestUrl,\n requestMethod: config?.requestMethod,\n ...(config?.mode ? { metadata: { mode: config.mode } } : {}),\n };\n },\n poll: lro.sendPollRequest,\n },\n {\n intervalInMs,\n withOperationLocation,\n restoreFrom,\n updateState,\n processResult: processResult\n ? ({ flatResponse }, state) => processResult(flatResponse, state)\n : ({ flatResponse }) => flatResponse as Promise<TResult>,\n },\n );\n}\n"],
|
|
5
|
-
"mappings": "AAKA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAQpB,SAAS,iBACd,KACA,SAC6B;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,wBAAwB;AAAA,IACxB;AAAA,IACA;AAAA,EACF,IAAI,WAAW,CAAC;AAChB,SAAO,kBAAsD;AAAA,IAC3D;AAAA,IACA,2BAA2B;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,UAAU;AAAA,IACV;AAAA,EACF,CAAC;AAAA,IACC;AAAA,MACE,MAAM,YAAY;AAChB,cAAM,WAAW,MAAM,IAAI,mBAAmB;AAC9C,cAAM,SAAS,aAAa,SAAS,aAAa,wBAAwB,YAAY;AACtF,eAAO;AAAA,UACL;AAAA,UACA,mBAAmB,WAAW,EAAE,KAAK,QAAQ,mBAAmB,QAAQ,CAAC;AAAA,UACzE,kBAAkB,WAAW,EAAE,KAAK,QAAQ,kBAAkB,QAAQ,CAAC;AAAA,UACvE,mBAAmB,QAAQ;AAAA,UAC3B,eAAe,QAAQ;AAAA,UACvB,GAAI,QAAQ,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,KAAK,EAAE,IAAI,CAAC;AAAA,QAC5D;AAAA,MACF;AAAA,MACA,MAAM,IAAI;AAAA,IACZ;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe,gBACX,CAAC,EAAE,aAAa,GAAG,UAAU,cAAc,cAAc,KAAK,IAC9D,CAAC,EAAE,aAAa,MAAM;AAAA,IAC5B;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/http/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAqB,EACrB,OAAkD;IAElD,MAAM,EACJ,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,qBAAqB,GAAG,KAAK,EAC7B,OAAO,EACP,YAAY,GACb,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,OAAO,iBAAiB,CAAqC;QAC3D,4BAA4B;QAC5B,yBAAyB,EAAE,kBAAkB;QAC7C,gBAAgB;QAChB,oBAAoB;QACpB,mBAAmB;QACnB,kBAAkB,EAAE,eAAe;QACnC,QAAQ,EAAE,oBAAoB;QAC9B,qBAAqB;KACtB,CAAC,CACA;QACE,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,kBAAkB,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,sBAAsB,EAAE,YAAY,CAAC,CAAC;YACxF,OAAO;gBACL,QAAQ;gBACR,iBAAiB,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC;gBAC1E,gBAAgB,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC;gBACxE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB;gBAC5C,aAAa,EAAE,MAAM,EAAE,aAAa;gBACpC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7D,CAAC;QACJ,CAAC;QACD,IAAI,EAAE,GAAG,CAAC,eAAe;KAC1B,EACD;QACE,YAAY;QACZ,qBAAqB;QACrB,WAAW;QACX,WAAW;QACX,aAAa,EAAE,aAAa;YAC1B,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,KAAK,CAAC;YACjE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAgC;KAC3D,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RunningOperation, OperationResponse } from \"./models.js\";\nimport type { OperationState, PollerLike } from \"../poller/models.js\";\nimport {\n getErrorFromResponse,\n getOperationLocation,\n getOperationStatus,\n getResourceLocation,\n getStatusFromInitialResponse,\n inferLroMode,\n isOperationError,\n parseRetryAfter,\n} from \"./operation.js\";\nimport type { CreateHttpPollerOptions } from \"./models.js\";\nimport { buildCreatePoller } from \"../poller/poller.js\";\nimport { rewriteUrl } from \"./utils.js\";\n\n/**\n * Creates a poller that can be used to poll a long-running operation.\n * @param lro - Description of the long-running operation\n * @param options - options to configure the poller\n * @returns an initialized poller\n */\nexport function createHttpPoller<TResult, TState extends OperationState<TResult>>(\n lro: RunningOperation,\n options?: CreateHttpPollerOptions<TResult, TState>,\n): PollerLike<TState, TResult> {\n const {\n resourceLocationConfig,\n intervalInMs,\n processResult,\n restoreFrom,\n updateState,\n withOperationLocation,\n resolveOnUnsuccessful = false,\n baseUrl,\n skipFinalGet,\n } = options || {};\n return buildCreatePoller<OperationResponse, TResult, TState>({\n getStatusFromInitialResponse,\n getStatusFromPollResponse: getOperationStatus,\n isOperationError,\n getOperationLocation,\n getResourceLocation,\n getPollingInterval: parseRetryAfter,\n getError: getErrorFromResponse,\n resolveOnUnsuccessful,\n })(\n {\n init: async () => {\n const response = await lro.sendInitialRequest();\n const config = inferLroMode(response.rawResponse, resourceLocationConfig, skipFinalGet);\n return {\n response,\n operationLocation: rewriteUrl({ url: config?.operationLocation, baseUrl }),\n resourceLocation: rewriteUrl({ url: config?.resourceLocation, baseUrl }),\n initialRequestUrl: config?.initialRequestUrl,\n requestMethod: config?.requestMethod,\n ...(config?.mode ? { metadata: { mode: config.mode } } : {}),\n };\n },\n poll: lro.sendPollRequest,\n },\n {\n intervalInMs,\n withOperationLocation,\n restoreFrom,\n updateState,\n processResult: processResult\n ? ({ flatResponse }, state) => processResult(flatResponse, state)\n : ({ flatResponse }) => flatResponse as Promise<TResult>,\n },\n );\n}\n"]}
|
package/dist/esm/http/utils.js
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* Rewrites a given URL to use the specified base URL.
|
|
5
|
+
* It preserves the pathname, search parameters, and fragment.
|
|
6
|
+
* Handles relative URLs and proper encoding.
|
|
7
|
+
*
|
|
8
|
+
* @param params - An object containing the url and baseUrl.
|
|
9
|
+
* url - The original URL (absolute or relative).
|
|
10
|
+
* baseUrl - The new base URL to use.
|
|
11
|
+
* @returns The rewritten URL as a string.
|
|
12
|
+
*/
|
|
13
|
+
export function rewriteUrl({ url, baseUrl, }) {
|
|
14
|
+
if (!url) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
if (!baseUrl) {
|
|
18
|
+
return url;
|
|
19
|
+
}
|
|
20
|
+
let originalUrl;
|
|
21
|
+
try {
|
|
22
|
+
// Try to parse inputUrl as an absolute URL.
|
|
23
|
+
originalUrl = new URL(url);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// If inputUrl is relative, resolve using the provided baseUrl.
|
|
27
|
+
try {
|
|
28
|
+
originalUrl = new URL(url, baseUrl);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
throw new Error(`Invalid input URL provided: ${url}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let newBase;
|
|
15
35
|
try {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
36
|
+
newBase = new URL(baseUrl);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
throw new Error(`Invalid base URL provided: ${baseUrl}`);
|
|
19
40
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
newBase = new URL(baseUrl);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
throw new Error(`Invalid base URL provided: ${baseUrl}`);
|
|
26
|
-
}
|
|
27
|
-
const rewrittenUrl = new URL(
|
|
28
|
-
`${originalUrl.pathname}${originalUrl.search}${originalUrl.hash}`,
|
|
29
|
-
newBase
|
|
30
|
-
);
|
|
31
|
-
return rewrittenUrl.toString();
|
|
41
|
+
const rewrittenUrl = new URL(`${originalUrl.pathname}${originalUrl.search}${originalUrl.hash}`, newBase);
|
|
42
|
+
return rewrittenUrl.toString();
|
|
32
43
|
}
|
|
33
|
-
|
|
34
|
-
rewriteUrl
|
|
35
|
-
};
|
|
44
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["/mnt/vss/_work/1/s/sdk/core/core-lro/src/http/utils.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Rewrites a given URL to use the specified base URL.\n * It preserves the pathname, search parameters, and fragment.\n * Handles relative URLs and proper encoding.\n *\n * @param params - An object containing the url and baseUrl.\n * url - The original URL (absolute or relative).\n * baseUrl - The new base URL to use.\n * @returns The rewritten URL as a string.\n */\nexport function rewriteUrl({\n url,\n baseUrl,\n}: {\n url?: string;\n baseUrl?: string;\n}): string | undefined {\n if (!url) {\n return undefined;\n }\n if (!baseUrl) {\n return url;\n }\n\n let originalUrl: URL;\n\n try {\n // Try to parse inputUrl as an absolute URL.\n originalUrl = new URL(url);\n } catch {\n // If inputUrl is relative, resolve using the provided baseUrl.\n try {\n originalUrl = new URL(url, baseUrl);\n } catch (e) {\n throw new Error(`Invalid input URL provided: ${url}`);\n }\n }\n\n let newBase: URL;\n try {\n newBase = new URL(baseUrl);\n } catch (e) {\n throw new Error(`Invalid base URL provided: ${baseUrl}`);\n }\n\n const rewrittenUrl = new URL(\n `${originalUrl.pathname}${originalUrl.search}${originalUrl.hash}`,\n newBase,\n );\n\n return rewrittenUrl.toString();\n}\n"],
|
|
5
|
-
"mappings": "AAaO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AACF,GAGuB;AACrB,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,MAAI;AAEJ,MAAI;AAEF,kBAAc,IAAI,IAAI,GAAG;AAAA,EAC3B,QAAQ;AAEN,QAAI;AACF,oBAAc,IAAI,IAAI,KAAK,OAAO;AAAA,IACpC,SAAS,GAAG;AACV,YAAM,IAAI,MAAM,+BAA+B,GAAG,EAAE;AAAA,IACtD;AAAA,EACF;AAEA,MAAI;AACJ,MAAI;AACF,cAAU,IAAI,IAAI,OAAO;AAAA,EAC3B,SAAS,GAAG;AACV,UAAM,IAAI,MAAM,8BAA8B,OAAO,EAAE;AAAA,EACzD;AAEA,QAAM,eAAe,IAAI;AAAA,IACvB,GAAG,YAAY,QAAQ,GAAG,YAAY,MAAM,GAAG,YAAY,IAAI;AAAA,IAC/D;AAAA,EACF;AAEA,SAAO,aAAa,SAAS;AAC/B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/http/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,GAAG,EACH,OAAO,GAIR;IACC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,WAAgB,CAAC;IAErB,IAAI,CAAC;QACH,4CAA4C;QAC5C,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;QAC/D,IAAI,CAAC;YACH,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,IAAI,OAAY,CAAC;IACjB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,GAAG,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,EACjE,OAAO,CACR,CAAC;IAEF,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Rewrites a given URL to use the specified base URL.\n * It preserves the pathname, search parameters, and fragment.\n * Handles relative URLs and proper encoding.\n *\n * @param params - An object containing the url and baseUrl.\n * url - The original URL (absolute or relative).\n * baseUrl - The new base URL to use.\n * @returns The rewritten URL as a string.\n */\nexport function rewriteUrl({\n url,\n baseUrl,\n}: {\n url?: string;\n baseUrl?: string;\n}): string | undefined {\n if (!url) {\n return undefined;\n }\n if (!baseUrl) {\n return url;\n }\n\n let originalUrl: URL;\n\n try {\n // Try to parse inputUrl as an absolute URL.\n originalUrl = new URL(url);\n } catch {\n // If inputUrl is relative, resolve using the provided baseUrl.\n try {\n originalUrl = new URL(url, baseUrl);\n } catch (e) {\n throw new Error(`Invalid input URL provided: ${url}`);\n }\n }\n\n let newBase: URL;\n try {\n newBase = new URL(baseUrl);\n } catch (e) {\n throw new Error(`Invalid base URL provided: ${baseUrl}`);\n }\n\n const rewrittenUrl = new URL(\n `${originalUrl.pathname}${originalUrl.search}${originalUrl.hash}`,\n newBase,\n );\n\n return rewrittenUrl.toString();\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export { createHttpPoller } from "./http/poller.js";
|
|
4
|
+
export { deserializeState } from "./poller/operation.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["/mnt/vss/_work/1/s/sdk/core/core-lro/src/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createHttpPoller } from \"./http/poller.js\";\nexport type {\n CancelOnProgress,\n OperationState,\n OperationStatus,\n PollerLike,\n RestorableOperationState,\n OperationConfig,\n} from \"./poller/models.js\";\nexport type {\n ResourceLocationConfig,\n RunningOperation,\n OperationResponse,\n RawResponse,\n RawRequest,\n CreateHttpPollerOptions,\n} from \"./http/models.js\";\nexport { deserializeState } from \"./poller/operation.js\";\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,wBAAwB;AAiBjC,SAAS,wBAAwB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAiBpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createHttpPoller } from \"./http/poller.js\";\nexport type {\n CancelOnProgress,\n OperationState,\n OperationStatus,\n PollerLike,\n RestorableOperationState,\n OperationConfig,\n} from \"./poller/models.js\";\nexport type {\n ResourceLocationConfig,\n RunningOperation,\n OperationResponse,\n RawResponse,\n RawRequest,\n CreateHttpPollerOptions,\n} from \"./http/models.js\";\nexport { deserializeState } from \"./poller/operation.js\";\n"]}
|
package/dist/esm/logger.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
1
3
|
import { createClientLogger } from "@azure/logger";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The `@azure/logger` configuration for this package.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const logger = createClientLogger("core-lro");
|
|
9
|
+
//# sourceMappingURL=logger.js.map
|
package/dist/esm/logger.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["/mnt/vss/_work/1/s/sdk/core/core-lro/src/logger.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * @internal\n */\nexport const logger = createClientLogger(\"core-lro\");\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,0BAA0B;AAM5B,MAAM,SAAS,mBAAmB,UAAU;",
|
|
6
|
-
"names": []
|
|
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;AAEnD;;;GAGG;AACH,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\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * @internal\n */\nexport const logger = createClientLogger(\"core-lro\");\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* The default time interval to wait before sending the next polling request.
|
|
5
|
+
*/
|
|
6
|
+
export const POLL_INTERVAL_IN_MS = 2000;
|
|
7
|
+
/**
|
|
8
|
+
* The closed set of terminal states.
|
|
9
|
+
*/
|
|
10
|
+
export const terminalStates = ["succeeded", "canceled", "failed"];
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["/mnt/vss/_work/1/s/sdk/core/core-lro/src/poller/constants.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * The default time interval to wait before sending the next polling request.\n */\nexport const POLL_INTERVAL_IN_MS = 2000;\n/**\n * The closed set of terminal states.\n */\nexport const terminalStates = [\"succeeded\", \"canceled\", \"failed\"];\n"],
|
|
5
|
-
"mappings": "AAMO,MAAM,sBAAsB;AAI5B,MAAM,iBAAiB,CAAC,aAAa,YAAY,QAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/poller/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * The default time interval to wait before sending the next polling request.\n */\nexport const POLL_INTERVAL_IN_MS = 2000;\n/**\n * The closed set of terminal states.\n */\nexport const terminalStates = [\"succeeded\", \"canceled\", \"failed\"];\n"]}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/poller/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\n/**\n * Configurations for how to poll the operation and to check whether it has\n * terminated.\n */\nexport interface OperationConfig {\n /** The operation location */\n operationLocation?: string;\n /** The resource location */\n resourceLocation?: string;\n /** The initial request Url */\n initialRequestUrl?: string;\n /** The request method */\n requestMethod?: string;\n /** metadata about the operation */\n metadata?: Record<string, string>;\n}\n\n/**\n * The description of an operation.\n */\nexport interface Operation<TResponse, TOptions> {\n /**\n * Sends the initiation request and returns, in addition to the response, the\n * operation location, the potential resource location, and a set of metadata.\n */\n init: () => Promise<\n OperationConfig & {\n response: TResponse;\n }\n >;\n /**\n * Sends the polling request.\n */\n poll: (location: string, options?: TOptions) => Promise<TResponse>;\n}\n\n/**\n * Type of a restorable long-running operation.\n */\nexport type RestorableOperationState<TResult, T extends OperationState<TResult>> = T & {\n /** The operation configuration */\n config: OperationConfig;\n};\n\n/**\n * Options for `createPoller`.\n */\nexport interface CreatePollerOptions<TResponse, TResult, TState> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n intervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n restoreFrom?: string;\n /**\n * A function to process the result of the LRO.\n */\n processResult?: (result: TResponse, state: TState) => Promise<TResult>;\n /**\n * A function to process the state of the LRO.\n */\n updateState?: (state: TState, lastResponse: TResponse) => void;\n /**\n * A function to be called each time the operation location is updated by the\n * service.\n */\n withOperationLocation?: (operationLocation: string) => void;\n}\n\nexport interface LroError {\n code: string;\n innererror?: InnerError;\n message: string;\n}\n\nexport interface InnerError {\n code: string;\n message: string;\n innererror?: InnerError;\n}\n\n/**\n * Options for `buildCreatePoller`.\n */\nexport interface BuildCreatePollerOptions<\n TResponse,\n TResult,\n TState extends OperationState<TResult>,\n> {\n /**\n * Gets the status of the operation from the response received when the\n * operation was initialized. Note that the operation could be already in\n * a terminal state at this time.\n */\n getStatusFromInitialResponse: (inputs: {\n response: TResponse;\n state: RestorableOperationState<TResult, TState>;\n operationLocation?: string;\n }) => OperationStatus;\n /**\n * Gets the status of the operation from a response received when the\n * operation was polled.\n */\n getStatusFromPollResponse: (\n response: TResponse,\n state: RestorableOperationState<TResult, TState>,\n ) => OperationStatus;\n /**\n * Determines if the input error is an operation error.\n */\n isOperationError: (error: Error) => boolean;\n /**\n * Gets the updated operation location from polling responses.\n */\n getOperationLocation?: (\n response: TResponse,\n state: RestorableOperationState<TResult, TState>,\n ) => string | undefined;\n /**\n * Gets the resource location from a response.\n */\n getResourceLocation: (\n response: TResponse,\n state: RestorableOperationState<TResult, TState>,\n ) => string | undefined;\n /**\n * Gets from the response the time interval the service suggests the client to\n * wait before sending the next polling request.\n */\n getPollingInterval?: (response: TResponse) => number | undefined;\n /**\n * Extracts an error model from a response.\n */\n getError?: (response: TResponse) => LroError | undefined;\n /**\n * Control whether to throw an exception if the operation failed or was canceled.\n */\n resolveOnUnsuccessful: boolean;\n}\n\n/**\n * The set of possible states an operation can be in at any given time.\n */\nexport type OperationStatus = \"notStarted\" | \"running\" | \"succeeded\" | \"canceled\" | \"failed\";\n\n/**\n * While the poller works as the local control mechanism to start triggering and\n * wait for a long-running operation, OperationState documents the status of\n * the remote long-running operation. It gets updated after each poll.\n */\nexport interface OperationState<TResult> {\n /**\n * The current status of the operation.\n */\n status: OperationStatus;\n /**\n * Will exist if the operation encountered any error.\n */\n error?: Error;\n /**\n * Will exist if the operation produced a result of the expected type.\n */\n result?: TResult;\n}\n\n/**\n * CancelOnProgress is used as the return value of a Poller's onProgress method.\n * When a user invokes onProgress, they're required to pass in a function that will be\n * called as a callback with the new data received each time the poll operation is updated.\n * onProgress returns a function that will prevent any further update to reach the original callback.\n */\nexport type CancelOnProgress = () => void;\n\n/**\n * A poller for an operation.\n */\nexport interface PollerLike<\n TState extends OperationState<TResult>,\n TResult,\n> extends Promise<TResult> {\n /**\n * Is true if the poller has finished polling.\n */\n readonly isDone: boolean;\n /**\n * The state of the operation.\n * It can be undefined if the poller has not been submitted yet.\n */\n readonly operationState: TState | undefined;\n /**\n * The result value of the operation, regardless of the state of the poller.\n * It can be undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n readonly result: TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Returns a promise that could be used to check if the poller has been submitted.\n */\n submitted(): Promise<void>;\n}\n"]}
|