@typespec/ts-http-runtime 0.3.4-alpha.20260302.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client/sendRequest.d.ts +10 -1
- package/dist/browser/client/sendRequest.js +8 -2
- package/dist/browser/client/sendRequest.js.map +1 -1
- package/dist/browser/defaultHttpClient.d.ts +1 -1
- package/dist/browser/defaultHttpClient.js +1 -1
- package/dist/browser/defaultHttpClient.js.map +1 -0
- package/dist/browser/index.d.ts +2 -2
- package/dist/browser/index.js +0 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/logger/log.d.ts +1 -1
- package/dist/browser/logger/log.js +1 -1
- package/dist/browser/logger/log.js.map +1 -0
- package/dist/browser/pipelineRequest.d.ts +1 -1
- package/dist/browser/pipelineRequest.js.map +1 -1
- package/dist/browser/policies/decompressResponsePolicy.d.ts +3 -2
- package/dist/browser/policies/decompressResponsePolicy.js +1 -4
- package/dist/browser/policies/decompressResponsePolicy.js.map +1 -0
- package/dist/browser/policies/internal.d.ts +7 -7
- package/dist/browser/policies/internal.js +2 -2
- package/dist/browser/policies/internal.js.map +1 -1
- package/dist/browser/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/browser/policies/proxyPolicy.common.js +2 -2
- package/dist/browser/policies/proxyPolicy.common.js.map +1 -1
- package/dist/browser/policies/proxyPolicy.d.ts +1 -1
- package/dist/browser/policies/proxyPolicy.js +1 -1
- package/dist/browser/policies/proxyPolicy.js.map +1 -0
- package/dist/browser/policies/redirectPolicy.d.ts +7 -0
- package/dist/browser/policies/redirectPolicy.js +13 -4
- package/dist/browser/policies/redirectPolicy.js.map +1 -1
- package/dist/browser/util/bytesEncoding.d.ts +1 -1
- package/dist/browser/util/bytesEncoding.js +1 -1
- package/dist/browser/util/bytesEncoding.js.map +1 -0
- package/dist/browser/util/concat.common.d.ts +1 -2
- package/dist/browser/util/concat.common.js.map +1 -1
- package/dist/browser/util/concat.d.ts +1 -1
- package/dist/browser/util/concat.js +1 -1
- package/dist/browser/util/concat.js.map +1 -0
- package/dist/browser/util/inspect.d.ts +1 -1
- package/dist/browser/util/inspect.js +1 -1
- package/dist/browser/util/inspect.js.map +1 -0
- package/dist/browser/util/sha256.d.ts +1 -1
- package/dist/browser/util/sha256.js +1 -1
- package/dist/browser/util/sha256.js.map +1 -0
- package/dist/browser/util/userAgentPlatform.d.ts +1 -1
- package/dist/browser/util/userAgentPlatform.js +1 -1
- package/dist/browser/util/userAgentPlatform.js.map +1 -0
- package/dist/browser/util/uuidUtils.d.ts +1 -1
- package/dist/browser/util/uuidUtils.js +1 -1
- package/dist/browser/util/uuidUtils.js.map +1 -0
- package/dist/commonjs/abort-controller/AbortError.js +30 -40
- package/dist/commonjs/abort-controller/AbortError.js.map +7 -1
- package/dist/commonjs/auth/credentials.js +36 -25
- package/dist/commonjs/auth/credentials.js.map +7 -1
- package/dist/commonjs/auth/oauth2Flows.js +15 -5
- package/dist/commonjs/auth/oauth2Flows.js.map +7 -1
- package/dist/commonjs/auth/schemes.js +15 -5
- package/dist/commonjs/auth/schemes.js.map +7 -1
- package/dist/commonjs/client/apiVersionPolicy.js +39 -25
- package/dist/commonjs/client/apiVersionPolicy.js.map +7 -1
- package/dist/commonjs/client/clientHelpers.js +62 -39
- package/dist/commonjs/client/clientHelpers.js.map +7 -1
- package/dist/commonjs/client/common.js +15 -5
- package/dist/commonjs/client/common.js.map +7 -1
- package/dist/commonjs/client/getClient.js +170 -82
- package/dist/commonjs/client/getClient.js.map +7 -1
- package/dist/commonjs/client/multipart.js +119 -110
- package/dist/commonjs/client/multipart.js.map +7 -1
- package/dist/commonjs/client/operationOptionHelpers.js +36 -21
- package/dist/commonjs/client/operationOptionHelpers.js.map +7 -1
- package/dist/commonjs/client/restError.js +44 -26
- package/dist/commonjs/client/restError.js.map +7 -1
- package/dist/commonjs/client/sendRequest.d.ts +10 -1
- package/dist/commonjs/client/sendRequest.js +150 -164
- package/dist/commonjs/client/sendRequest.js.map +7 -1
- package/dist/commonjs/client/urlHelpers.js +124 -131
- package/dist/commonjs/client/urlHelpers.js.map +7 -1
- package/dist/commonjs/constants.js +30 -8
- package/dist/commonjs/constants.js.map +7 -1
- package/dist/commonjs/createPipelineFromOptions.js +56 -45
- package/dist/commonjs/createPipelineFromOptions.js.map +7 -1
- package/dist/commonjs/defaultHttpClient.js +28 -11
- package/dist/commonjs/defaultHttpClient.js.map +7 -1
- package/dist/commonjs/fetchHttpClient.js +211 -256
- package/dist/commonjs/fetchHttpClient.js.map +7 -1
- package/dist/commonjs/httpHeaders.js +97 -82
- package/dist/commonjs/httpHeaders.js.map +7 -1
- package/dist/commonjs/index.d.ts +2 -2
- package/dist/commonjs/index.js +67 -36
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/interfaces.js +15 -5
- package/dist/commonjs/interfaces.js.map +7 -1
- package/dist/commonjs/log.js +28 -8
- package/dist/commonjs/log.js.map +7 -1
- package/dist/commonjs/logger/debug.js +150 -155
- package/dist/commonjs/logger/debug.js.map +7 -1
- package/dist/commonjs/logger/internal.js +27 -8
- package/dist/commonjs/logger/internal.js.map +7 -1
- package/dist/commonjs/logger/log.common.js +39 -23
- package/dist/commonjs/logger/log.common.js.map +7 -1
- package/dist/commonjs/logger/log.js +40 -11
- package/dist/commonjs/logger/log.js.map +7 -1
- package/dist/commonjs/logger/logger.js +120 -110
- package/dist/commonjs/logger/logger.js.map +7 -1
- package/dist/commonjs/nodeHttpClient.js +313 -321
- package/dist/commonjs/nodeHttpClient.js.map +7 -1
- package/dist/commonjs/pipeline.js +190 -247
- package/dist/commonjs/pipeline.js.map +7 -1
- package/dist/commonjs/pipelineRequest.d.ts +1 -1
- package/dist/commonjs/pipelineRequest.js +69 -54
- package/dist/commonjs/pipelineRequest.js.map +7 -1
- package/dist/commonjs/policies/agentPolicy.js +38 -24
- package/dist/commonjs/policies/agentPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +45 -32
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +50 -32
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +47 -32
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/checkInsecureConnection.js +47 -44
- package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +7 -1
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +45 -32
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/decompressResponsePolicy.js +38 -25
- package/dist/commonjs/policies/decompressResponsePolicy.js.map +7 -1
- package/dist/commonjs/policies/defaultRetryPolicy.js +39 -27
- package/dist/commonjs/policies/defaultRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/exponentialRetryPolicy.js +43 -26
- package/dist/commonjs/policies/exponentialRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/formDataPolicy.js +101 -90
- package/dist/commonjs/policies/formDataPolicy.js.map +7 -1
- package/dist/commonjs/policies/internal.d.ts +7 -7
- package/dist/commonjs/policies/internal.js +94 -48
- package/dist/commonjs/policies/internal.js.map +7 -1
- package/dist/commonjs/policies/logPolicy.js +49 -35
- package/dist/commonjs/policies/logPolicy.js.map +7 -1
- package/dist/commonjs/policies/multipartPolicy.js +117 -99
- package/dist/commonjs/policies/multipartPolicy.js.map +7 -1
- package/dist/commonjs/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/commonjs/policies/proxyPolicy.common.js +38 -25
- package/dist/commonjs/policies/proxyPolicy.common.js.map +7 -1
- package/dist/commonjs/policies/proxyPolicy.js +160 -171
- package/dist/commonjs/policies/proxyPolicy.js.map +7 -1
- package/dist/commonjs/policies/redirectPolicy.d.ts +7 -0
- package/dist/commonjs/policies/redirectPolicy.js +62 -51
- package/dist/commonjs/policies/redirectPolicy.js.map +7 -1
- package/dist/commonjs/policies/retryPolicy.js +123 -105
- package/dist/commonjs/policies/retryPolicy.js.map +7 -1
- package/dist/commonjs/policies/systemErrorRetryPolicy.js +46 -31
- package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/throttlingRetryPolicy.js +38 -30
- package/dist/commonjs/policies/throttlingRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/tlsPolicy.js +38 -24
- package/dist/commonjs/policies/tlsPolicy.js.map +7 -1
- package/dist/commonjs/policies/userAgentPolicy.js +41 -28
- package/dist/commonjs/policies/userAgentPolicy.js.map +7 -1
- package/dist/commonjs/restError.js +93 -90
- package/dist/commonjs/restError.js.map +7 -1
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +63 -62
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +7 -1
- package/dist/commonjs/retryStrategies/retryStrategy.js +15 -5
- package/dist/commonjs/retryStrategies/retryStrategy.js.map +7 -1
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +58 -69
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +7 -1
- package/dist/commonjs/util/arrayBuffer.js +34 -21
- package/dist/commonjs/util/arrayBuffer.js.map +7 -1
- package/dist/commonjs/util/bytesEncoding.common.js +83 -100
- package/dist/commonjs/util/bytesEncoding.common.js.map +7 -1
- package/dist/commonjs/util/bytesEncoding.js +30 -21
- package/dist/commonjs/util/bytesEncoding.js.map +7 -1
- package/dist/commonjs/util/checkEnvironment.js +45 -44
- package/dist/commonjs/util/checkEnvironment.js.map +7 -1
- package/dist/commonjs/util/concat.common.d.ts +1 -2
- package/dist/commonjs/util/concat.common.js +51 -52
- package/dist/commonjs/util/concat.common.js.map +7 -1
- package/dist/commonjs/util/concat.js +70 -61
- package/dist/commonjs/util/concat.js.map +7 -1
- package/dist/commonjs/util/delay.js +31 -21
- package/dist/commonjs/util/delay.js.map +7 -1
- package/dist/commonjs/util/error.js +33 -17
- package/dist/commonjs/util/error.js.map +7 -1
- package/dist/commonjs/util/helpers.js +65 -57
- package/dist/commonjs/util/helpers.js.map +7 -1
- package/dist/commonjs/util/inspect.common.js +27 -7
- package/dist/commonjs/util/inspect.common.js.map +7 -1
- package/dist/commonjs/util/inspect.js +28 -8
- package/dist/commonjs/util/inspect.js.map +7 -1
- package/dist/commonjs/util/internal.js +67 -32
- package/dist/commonjs/util/internal.js.map +7 -1
- package/dist/commonjs/util/object.js +27 -15
- package/dist/commonjs/util/object.js.map +7 -1
- package/dist/commonjs/util/random.js +30 -22
- package/dist/commonjs/util/random.js.map +7 -1
- package/dist/commonjs/util/sanitizer.js +157 -148
- package/dist/commonjs/util/sanitizer.js.map +7 -1
- package/dist/commonjs/util/sha256.common.js +61 -45
- package/dist/commonjs/util/sha256.common.js.map +7 -1
- package/dist/commonjs/util/sha256.js +32 -22
- package/dist/commonjs/util/sha256.js.map +7 -1
- package/dist/commonjs/util/typeGuards.js +41 -21
- package/dist/commonjs/util/typeGuards.js.map +7 -1
- package/dist/commonjs/util/userAgent.js +43 -28
- package/dist/commonjs/util/userAgent.js.map +7 -1
- package/dist/commonjs/util/userAgentPlatform.js +51 -29
- package/dist/commonjs/util/userAgentPlatform.js.map +7 -1
- package/dist/commonjs/util/uuidUtils.common.js +43 -39
- package/dist/commonjs/util/uuidUtils.common.js.map +7 -1
- package/dist/commonjs/util/uuidUtils.js +27 -12
- package/dist/commonjs/util/uuidUtils.js.map +7 -1
- package/dist/commonjs/xhrHttpClient.js +171 -163
- package/dist/commonjs/xhrHttpClient.js.map +7 -1
- package/dist/esm/client/sendRequest.d.ts +10 -1
- package/dist/esm/client/sendRequest.js +8 -2
- package/dist/esm/client/sendRequest.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pipelineRequest.d.ts +1 -1
- package/dist/esm/pipelineRequest.js.map +1 -1
- package/dist/esm/policies/internal.d.ts +7 -7
- package/dist/esm/policies/internal.js +2 -2
- package/dist/esm/policies/internal.js.map +1 -1
- package/dist/esm/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/esm/policies/proxyPolicy.common.js +2 -2
- package/dist/esm/policies/proxyPolicy.common.js.map +1 -1
- package/dist/esm/policies/redirectPolicy.d.ts +7 -0
- package/dist/esm/policies/redirectPolicy.js +13 -4
- package/dist/esm/policies/redirectPolicy.js.map +1 -1
- package/dist/esm/util/concat.common.d.ts +1 -2
- package/dist/esm/util/concat.common.js.map +1 -1
- package/dist/react-native/client/sendRequest.d.ts +10 -1
- package/dist/react-native/client/sendRequest.js +8 -2
- package/dist/react-native/client/sendRequest.js.map +1 -1
- package/dist/react-native/defaultHttpClient.d.ts +1 -1
- package/dist/react-native/defaultHttpClient.js +1 -1
- package/dist/react-native/defaultHttpClient.js.map +1 -0
- package/dist/react-native/index.d.ts +2 -2
- package/dist/react-native/index.js +0 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/logger/log.d.ts +1 -1
- package/dist/react-native/logger/log.js +1 -1
- package/dist/react-native/logger/log.js.map +1 -0
- package/dist/react-native/pipelineRequest.d.ts +1 -1
- package/dist/react-native/pipelineRequest.js.map +1 -1
- package/dist/react-native/policies/internal.d.ts +7 -7
- package/dist/react-native/policies/internal.js +2 -2
- package/dist/react-native/policies/internal.js.map +1 -1
- package/dist/react-native/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/react-native/policies/proxyPolicy.common.js +2 -2
- package/dist/react-native/policies/proxyPolicy.common.js.map +1 -1
- package/dist/react-native/policies/proxyPolicy.d.ts +1 -1
- package/dist/react-native/policies/proxyPolicy.js +1 -1
- package/dist/react-native/policies/proxyPolicy.js.map +1 -0
- package/dist/react-native/policies/redirectPolicy.d.ts +7 -0
- package/dist/react-native/policies/redirectPolicy.js +13 -4
- package/dist/react-native/policies/redirectPolicy.js.map +1 -1
- package/dist/react-native/util/bytesEncoding.d.ts +1 -1
- package/dist/react-native/util/bytesEncoding.js +1 -1
- package/dist/react-native/util/bytesEncoding.js.map +1 -0
- package/dist/react-native/util/concat.common.d.ts +1 -2
- package/dist/react-native/util/concat.common.js.map +1 -1
- package/dist/react-native/util/concat.d.ts +1 -1
- package/dist/react-native/util/concat.js +1 -1
- package/dist/react-native/util/concat.js.map +1 -0
- package/dist/react-native/util/inspect.d.ts +1 -1
- package/dist/react-native/util/inspect.js +1 -1
- package/dist/react-native/util/inspect.js.map +1 -0
- package/dist/react-native/util/sha256.d.ts +1 -1
- package/dist/react-native/util/sha256.js +1 -1
- package/dist/react-native/util/sha256.js.map +1 -0
- package/dist/react-native/util/userAgentPlatform.d.ts +1 -1
- package/dist/react-native/util/userAgentPlatform.js +1 -1
- package/dist/react-native/util/userAgentPlatform.js.map +1 -0
- package/dist/react-native/util/uuidUtils.d.ts +1 -1
- package/dist/react-native/util/uuidUtils.js +1 -1
- package/dist/react-native/util/uuidUtils.js.map +1 -0
- package/package.json +3 -23
- package/dist/browser/defaultHttpClient-browser.mjs.map +0 -1
- package/dist/browser/logger/log-browser.mjs.map +0 -1
- package/dist/browser/policies/decompressResponsePolicy-browser.mjs.map +0 -1
- package/dist/browser/policies/proxyPolicy-browser.mjs.map +0 -1
- package/dist/browser/util/bytesEncoding-browser.mjs.map +0 -1
- package/dist/browser/util/concat-browser.mjs.map +0 -1
- package/dist/browser/util/inspect-browser.mjs.map +0 -1
- package/dist/browser/util/sha256-browser.mjs.map +0 -1
- package/dist/browser/util/userAgentPlatform-browser.mjs.map +0 -1
- package/dist/browser/util/uuidUtils-browser.mjs.map +0 -1
- package/dist/react-native/defaultHttpClient-react-native.mjs.map +0 -1
- package/dist/react-native/logger/log-react-native.mjs.map +0 -1
- package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +0 -1
- package/dist/react-native/util/bytesEncoding-react-native.mjs.map +0 -1
- package/dist/react-native/util/concat-react-native.mjs.map +0 -1
- package/dist/react-native/util/inspect-react-native.mjs.map +0 -1
- package/dist/react-native/util/sha256-react-native.mjs.map +0 -1
- package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +0 -1
- package/dist/react-native/util/uuidUtils-react-native.mjs.map +0 -1
|
@@ -1,62 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var helpers_exports = {};
|
|
19
|
+
__export(helpers_exports, {
|
|
20
|
+
delay: () => delay,
|
|
21
|
+
parseHeaderValueAsNumber: () => parseHeaderValueAsNumber
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
24
|
+
var import_AbortError = require("../abort-controller/AbortError.js");
|
|
8
25
|
const StandardAbortMessage = "The operation was aborted.";
|
|
9
|
-
/**
|
|
10
|
-
* A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.
|
|
11
|
-
* @param delayInMs - The number of milliseconds to be delayed.
|
|
12
|
-
* @param value - The value to be resolved with after a timeout of t milliseconds.
|
|
13
|
-
* @param options - The options for delay - currently abort options
|
|
14
|
-
* - abortSignal - The abortSignal associated with containing operation.
|
|
15
|
-
* - abortErrorMsg - The abort error message associated with containing operation.
|
|
16
|
-
* @returns Resolved promise
|
|
17
|
-
*/
|
|
18
26
|
function delay(delayInMs, value, options) {
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
let timer = void 0;
|
|
29
|
+
let onAborted = void 0;
|
|
30
|
+
const rejectOnAbort = () => {
|
|
31
|
+
return reject(
|
|
32
|
+
new import_AbortError.AbortError(options?.abortErrorMsg ? options?.abortErrorMsg : StandardAbortMessage)
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
const removeListeners = () => {
|
|
36
|
+
if (options?.abortSignal && onAborted) {
|
|
37
|
+
options.abortSignal.removeEventListener("abort", onAborted);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
onAborted = () => {
|
|
41
|
+
if (timer) {
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
}
|
|
44
|
+
removeListeners();
|
|
45
|
+
return rejectOnAbort();
|
|
46
|
+
};
|
|
47
|
+
if (options?.abortSignal && options.abortSignal.aborted) {
|
|
48
|
+
return rejectOnAbort();
|
|
49
|
+
}
|
|
50
|
+
timer = setTimeout(() => {
|
|
51
|
+
removeListeners();
|
|
52
|
+
resolve(value);
|
|
53
|
+
}, delayInMs);
|
|
54
|
+
if (options?.abortSignal) {
|
|
55
|
+
options.abortSignal.addEventListener("abort", onAborted);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
48
58
|
}
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
* @returns the parsed value or undefined if the parsed value is invalid.
|
|
52
|
-
*/
|
|
53
59
|
function parseHeaderValueAsNumber(response, headerName) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return;
|
|
60
|
-
return valueAsNum;
|
|
60
|
+
const value = response.headers.get(headerName);
|
|
61
|
+
if (!value) return;
|
|
62
|
+
const valueAsNum = Number(value);
|
|
63
|
+
if (Number.isNaN(valueAsNum)) return;
|
|
64
|
+
return valueAsNum;
|
|
61
65
|
}
|
|
62
|
-
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
delay,
|
|
69
|
+
parseHeaderValueAsNumber
|
|
70
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { PipelineResponse } from \"../interfaces.js\";\n\nconst StandardAbortMessage = \"The operation was aborted.\";\n\n/**\n * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.\n * @param delayInMs - The number of milliseconds to be delayed.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n * @param options - The options for delay - currently abort options\n * - abortSignal - The abortSignal associated with containing operation.\n * - abortErrorMsg - The abort error message associated with containing operation.\n * @returns Resolved promise\n */\nexport function delay<T>(\n delayInMs: number,\n value?: T,\n options?: {\n abortSignal?: AbortSignal;\n abortErrorMsg?: string;\n },\n): Promise<T | void> {\n return new Promise((resolve, reject) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n let onAborted: (() => void) | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n return reject(\n new AbortError(options?.abortErrorMsg ? options?.abortErrorMsg : StandardAbortMessage),\n );\n };\n\n const removeListeners = (): void => {\n if (options?.abortSignal && onAborted) {\n options.abortSignal.removeEventListener(\"abort\", onAborted);\n }\n };\n\n onAborted = (): void => {\n if (timer) {\n clearTimeout(timer);\n }\n removeListeners();\n return rejectOnAbort();\n };\n\n if (options?.abortSignal && options.abortSignal.aborted) {\n return rejectOnAbort();\n }\n\n timer = setTimeout(() => {\n removeListeners();\n resolve(value);\n }, delayInMs);\n\n if (options?.abortSignal) {\n options.abortSignal.addEventListener(\"abort\", onAborted);\n }\n });\n}\n\n/**\n * @internal\n * @returns the parsed value or undefined if the parsed value is invalid.\n */\nexport function parseHeaderValueAsNumber(\n response: PipelineResponse,\n headerName: string,\n): number | undefined {\n const value = response.headers.get(headerName);\n if (!value) return;\n const valueAsNum = Number(value);\n if (Number.isNaN(valueAsNum)) return;\n return valueAsNum;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2B;AAG3B,MAAM,uBAAuB;AAWtB,SAAS,MACd,WACA,OACA,SAImB;AACnB,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,QAAI,QAAmD;AACvD,QAAI,YAAsC;AAE1C,UAAM,gBAAgB,MAAY;AAChC,aAAO;AAAA,QACL,IAAI,6BAAW,SAAS,gBAAgB,SAAS,gBAAgB,oBAAoB;AAAA,MACvF;AAAA,IACF;AAEA,UAAM,kBAAkB,MAAY;AAClC,UAAI,SAAS,eAAe,WAAW;AACrC,gBAAQ,YAAY,oBAAoB,SAAS,SAAS;AAAA,MAC5D;AAAA,IACF;AAEA,gBAAY,MAAY;AACtB,UAAI,OAAO;AACT,qBAAa,KAAK;AAAA,MACpB;AACA,sBAAgB;AAChB,aAAO,cAAc;AAAA,IACvB;AAEA,QAAI,SAAS,eAAe,QAAQ,YAAY,SAAS;AACvD,aAAO,cAAc;AAAA,IACvB;AAEA,YAAQ,WAAW,MAAM;AACvB,sBAAgB;AAChB,cAAQ,KAAK;AAAA,IACf,GAAG,SAAS;AAEZ,QAAI,SAAS,aAAa;AACxB,cAAQ,YAAY,iBAAiB,SAAS,SAAS;AAAA,IACzD;AAAA,EACF,CAAC;AACH;AAMO,SAAS,yBACd,UACA,YACoB;AACpB,QAAM,QAAQ,SAAS,QAAQ,IAAI,UAAU;AAC7C,MAAI,CAAC,MAAO;AACZ,QAAM,aAAa,OAAO,KAAK;AAC/B,MAAI,OAAO,MAAM,UAAU,EAAG;AAC9B,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var inspect_common_exports = {};
|
|
19
|
+
__export(inspect_common_exports, {
|
|
20
|
+
custom: () => custom
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(inspect_common_exports);
|
|
23
|
+
const custom = /* @__PURE__ */ Symbol();
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
custom
|
|
27
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/inspect.common.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const custom = Symbol();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,SAAS,uBAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var inspect_exports = {};
|
|
19
|
+
__export(inspect_exports, {
|
|
20
|
+
custom: () => custom
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(inspect_exports);
|
|
23
|
+
var import_node_util = require("node:util");
|
|
24
|
+
const custom = import_node_util.inspect.custom;
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
custom
|
|
28
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/inspect.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { inspect } from \"node:util\";\n\nexport const custom = inspect.custom;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAwB;AAEjB,MAAM,SAAS,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var internal_exports = {};
|
|
19
|
+
__export(internal_exports, {
|
|
20
|
+
Sanitizer: () => import_sanitizer.Sanitizer,
|
|
21
|
+
calculateRetryDelay: () => import_delay.calculateRetryDelay,
|
|
22
|
+
computeSha256Hash: () => import_sha256.computeSha256Hash,
|
|
23
|
+
computeSha256Hmac: () => import_sha256.computeSha256Hmac,
|
|
24
|
+
getRandomIntegerInclusive: () => import_random.getRandomIntegerInclusive,
|
|
25
|
+
isBrowser: () => import_checkEnvironment.isBrowser,
|
|
26
|
+
isBun: () => import_checkEnvironment.isBun,
|
|
27
|
+
isDeno: () => import_checkEnvironment.isDeno,
|
|
28
|
+
isError: () => import_error.isError,
|
|
29
|
+
isNodeLike: () => import_checkEnvironment.isNodeLike,
|
|
30
|
+
isNodeRuntime: () => import_checkEnvironment.isNodeRuntime,
|
|
31
|
+
isObject: () => import_object.isObject,
|
|
32
|
+
isReactNative: () => import_checkEnvironment.isReactNative,
|
|
33
|
+
isWebWorker: () => import_checkEnvironment.isWebWorker,
|
|
34
|
+
randomUUID: () => import_uuidUtils.randomUUID,
|
|
35
|
+
stringToUint8Array: () => import_bytesEncoding.stringToUint8Array,
|
|
36
|
+
uint8ArrayToString: () => import_bytesEncoding.uint8ArrayToString
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(internal_exports);
|
|
39
|
+
var import_delay = require("./delay.js");
|
|
40
|
+
var import_random = require("./random.js");
|
|
41
|
+
var import_object = require("./object.js");
|
|
42
|
+
var import_error = require("./error.js");
|
|
43
|
+
var import_sha256 = require("./sha256.js");
|
|
44
|
+
var import_uuidUtils = require("./uuidUtils.js");
|
|
45
|
+
var import_checkEnvironment = require("./checkEnvironment.js");
|
|
46
|
+
var import_bytesEncoding = require("./bytesEncoding.js");
|
|
47
|
+
var import_sanitizer = require("./sanitizer.js");
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
Sanitizer,
|
|
51
|
+
calculateRetryDelay,
|
|
52
|
+
computeSha256Hash,
|
|
53
|
+
computeSha256Hmac,
|
|
54
|
+
getRandomIntegerInclusive,
|
|
55
|
+
isBrowser,
|
|
56
|
+
isBun,
|
|
57
|
+
isDeno,
|
|
58
|
+
isError,
|
|
59
|
+
isNodeLike,
|
|
60
|
+
isNodeRuntime,
|
|
61
|
+
isObject,
|
|
62
|
+
isReactNative,
|
|
63
|
+
isWebWorker,
|
|
64
|
+
randomUUID,
|
|
65
|
+
stringToUint8Array,
|
|
66
|
+
uint8ArrayToString
|
|
67
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/internal.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { calculateRetryDelay } from \"./delay.js\";\nexport { getRandomIntegerInclusive } from \"./random.js\";\nexport { isObject, type UnknownObject } from \"./object.js\";\nexport { isError } from \"./error.js\";\nexport { computeSha256Hash, computeSha256Hmac } from \"./sha256.js\";\nexport { randomUUID } from \"./uuidUtils.js\";\nexport {\n isBrowser,\n isBun,\n isNodeLike,\n isNodeRuntime,\n isDeno,\n isReactNative,\n isWebWorker,\n} from \"./checkEnvironment.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"./bytesEncoding.js\";\nexport { Sanitizer, type SanitizerOptions } from \"./sanitizer.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAoC;AACpC,oBAA0C;AAC1C,oBAA6C;AAC7C,mBAAwB;AACxB,oBAAqD;AACrD,uBAA2B;AAC3B,8BAQO;AACP,2BAA0E;AAC1E,uBAAiD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var object_exports = {};
|
|
19
|
+
__export(object_exports, {
|
|
20
|
+
isObject: () => isObject
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(object_exports);
|
|
10
23
|
function isObject(input) {
|
|
11
|
-
|
|
12
|
-
input !== null &&
|
|
13
|
-
!Array.isArray(input) &&
|
|
14
|
-
!(input instanceof RegExp) &&
|
|
15
|
-
!(input instanceof Date));
|
|
24
|
+
return typeof input === "object" && input !== null && !Array.isArray(input) && !(input instanceof RegExp) && !(input instanceof Date);
|
|
16
25
|
}
|
|
17
|
-
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
isObject
|
|
29
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/object.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * A generic shape for a plain JS object.\n */\nexport type UnknownObject = { [s: string]: unknown };\n\n/**\n * Helper to determine when an input is a generic JS object.\n * @returns true when input is an object type that is not null, Array, RegExp, or Date.\n */\nexport function isObject(input: unknown): input is UnknownObject {\n return (\n typeof input === \"object\" &&\n input !== null &&\n !Array.isArray(input) &&\n !(input instanceof RegExp) &&\n !(input instanceof Date)\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,SAAS,OAAwC;AAC/D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,EAAE,iBAAiB,WACnB,EAAE,iBAAiB;AAEvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var random_exports = {};
|
|
19
|
+
__export(random_exports, {
|
|
20
|
+
getRandomIntegerInclusive: () => getRandomIntegerInclusive
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(random_exports);
|
|
14
23
|
function getRandomIntegerInclusive(min, max) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Since Math.random() can never return 1, we have to make the range one larger
|
|
20
|
-
// in order to be inclusive of the maximum value after we take the floor.
|
|
21
|
-
const offset = Math.floor(Math.random() * (max - min + 1));
|
|
22
|
-
return offset + min;
|
|
24
|
+
min = Math.ceil(min);
|
|
25
|
+
max = Math.floor(max);
|
|
26
|
+
const offset = Math.floor(Math.random() * (max - min + 1));
|
|
27
|
+
return offset + min;
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
getRandomIntegerInclusive
|
|
32
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/util/random.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Returns a random integer value between a lower and upper bound,\n * inclusive of both bounds.\n * Note that this uses Math.random and isn't secure. If you need to use\n * this for any kind of security purpose, find a better source of random.\n * @param min - The smallest integer value allowed.\n * @param max - The largest integer value allowed.\n */\nexport function getRandomIntegerInclusive(min: number, max: number): number {\n // Make sure inputs are integers.\n min = Math.ceil(min);\n max = Math.floor(max);\n // Pick a random offset from zero to the size of the range.\n // Since Math.random() can never return 1, we have to make the range one larger\n // in order to be inclusive of the maximum value after we take the floor.\n const offset = Math.floor(Math.random() * (max - min + 1));\n return offset + min;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,SAAS,0BAA0B,KAAa,KAAqB;AAE1E,QAAM,KAAK,KAAK,GAAG;AACnB,QAAM,KAAK,MAAM,GAAG;AAIpB,QAAM,SAAS,KAAK,MAAM,KAAK,OAAO,KAAK,MAAM,MAAM,EAAE;AACzD,SAAO,SAAS;AAClB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|