Initial
This commit is contained in:
21
node_modules/@azure/core-util/LICENSE
generated
vendored
Normal file
21
node_modules/@azure/core-util/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
38
node_modules/@azure/core-util/README.md
generated
vendored
Normal file
38
node_modules/@azure/core-util/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Azure Core Util client library for JavaScript (Experimental)
|
||||
|
||||
This library is intended to provide various shared utility functions for client SDK packages.
|
||||
|
||||
## Getting started
|
||||
|
||||
### Requirements
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
||||
|
||||
### Installation
|
||||
|
||||
This package is primarily used in authoring client SDKs and not meant to be consumed directly by end users.
|
||||
|
||||
## Key concepts
|
||||
|
||||
Utility methods provided by this library should be stateless.
|
||||
|
||||
## Examples
|
||||
|
||||
Examples can be found in the `samples` folder.
|
||||
|
||||
## Next steps
|
||||
|
||||
Look at usage in dependent client SDKs.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you run into issues while using this library, please feel free to [file an issue](https://github.com/Azure/azure-sdk-for-js/issues/new).
|
||||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
27
node_modules/@azure/core-util/dist/browser/aborterUtils.d.ts
generated
vendored
Normal file
27
node_modules/@azure/core-util/dist/browser/aborterUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { AbortSignalLike } from "@azure/abort-controller";
|
||||
/**
|
||||
* Options related to abort controller.
|
||||
*/
|
||||
export interface AbortOptions {
|
||||
/**
|
||||
* The abortSignal associated with containing operation.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* The abort error message associated with containing operation.
|
||||
*/
|
||||
abortErrorMsg?: string;
|
||||
}
|
||||
/**
|
||||
* Represents a function that returns a promise that can be aborted.
|
||||
*/
|
||||
export type AbortablePromiseBuilder<T> = (abortOptions: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}) => Promise<T>;
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}): Promise<T[number]>;
|
||||
//# sourceMappingURL=aborterUtils.d.ts.map
|
||||
20
node_modules/@azure/core-util/dist/browser/aborterUtils.js
generated
vendored
Normal file
20
node_modules/@azure/core-util/dist/browser/aborterUtils.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export async function cancelablePromiseRace(abortablePromiseBuilders, options) {
|
||||
const aborter = new AbortController();
|
||||
function abortHandler() {
|
||||
aborter.abort();
|
||||
}
|
||||
options?.abortSignal?.addEventListener("abort", abortHandler);
|
||||
try {
|
||||
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
|
||||
}
|
||||
finally {
|
||||
aborter.abort();
|
||||
options?.abortSignal?.removeEventListener("abort", abortHandler);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=aborterUtils.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/aborterUtils.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/aborterUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAyBlC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
|
||||
16
node_modules/@azure/core-util/dist/browser/createAbortablePromise.d.ts
generated
vendored
Normal file
16
node_modules/@azure/core-util/dist/browser/createAbortablePromise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for the createAbortablePromise function.
|
||||
*/
|
||||
export interface CreateAbortablePromiseOptions extends AbortOptions {
|
||||
/** A function to be called if the promise was aborted */
|
||||
cleanupBeforeAbort?: () => void;
|
||||
}
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export declare function createAbortablePromise<T>(buildPromise: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, options?: CreateAbortablePromiseOptions): Promise<T>;
|
||||
//# sourceMappingURL=createAbortablePromise.d.ts.map
|
||||
42
node_modules/@azure/core-util/dist/browser/createAbortablePromise.js
generated
vendored
Normal file
42
node_modules/@azure/core-util/dist/browser/createAbortablePromise.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { AbortError } from "@azure/abort-controller";
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export function createAbortablePromise(buildPromise, options) {
|
||||
const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
|
||||
return new Promise((resolve, reject) => {
|
||||
function rejectOnAbort() {
|
||||
reject(new AbortError(abortErrorMsg ?? "The operation was aborted."));
|
||||
}
|
||||
function removeListeners() {
|
||||
abortSignal?.removeEventListener("abort", onAbort);
|
||||
}
|
||||
function onAbort() {
|
||||
cleanupBeforeAbort?.();
|
||||
removeListeners();
|
||||
rejectOnAbort();
|
||||
}
|
||||
if (abortSignal?.aborted) {
|
||||
return rejectOnAbort();
|
||||
}
|
||||
try {
|
||||
buildPromise((x) => {
|
||||
removeListeners();
|
||||
resolve(x);
|
||||
}, (x) => {
|
||||
removeListeners();
|
||||
reject(x);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
abortSignal?.addEventListener("abort", onAbort);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=createAbortablePromise.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/createAbortablePromise.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/createAbortablePromise.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAGS,EACT,OAAuC;IAEvC,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,IAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,EAAE,EAAE,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;YACzB,OAAO,aAAa,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CACV,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { AbortOptions } from \"./aborterUtils.js\";\n\n/**\n * Options for the createAbortablePromise function.\n */\nexport interface CreateAbortablePromiseOptions extends AbortOptions {\n /** A function to be called if the promise was aborted */\n cleanupBeforeAbort?: () => void;\n}\n\n/**\n * Creates an abortable promise.\n * @param buildPromise - A function that takes the resolve and reject functions as parameters.\n * @param options - The options for the abortable promise.\n * @returns A promise that can be aborted.\n */\nexport function createAbortablePromise<T>(\n buildPromise: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void,\n ) => void,\n options?: CreateAbortablePromiseOptions,\n): Promise<T> {\n const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};\n return new Promise((resolve, reject) => {\n function rejectOnAbort(): void {\n reject(new AbortError(abortErrorMsg ?? \"The operation was aborted.\"));\n }\n function removeListeners(): void {\n abortSignal?.removeEventListener(\"abort\", onAbort);\n }\n function onAbort(): void {\n cleanupBeforeAbort?.();\n removeListeners();\n rejectOnAbort();\n }\n if (abortSignal?.aborted) {\n return rejectOnAbort();\n }\n try {\n buildPromise(\n (x) => {\n removeListeners();\n resolve(x);\n },\n (x) => {\n removeListeners();\n reject(x);\n },\n );\n } catch (err) {\n reject(err);\n }\n abortSignal?.addEventListener(\"abort\", onAbort);\n });\n}\n"]}
|
||||
26
node_modules/@azure/core-util/dist/browser/delay.d.ts
generated
vendored
Normal file
26
node_modules/@azure/core-util/dist/browser/delay.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for support abort functionality for the delay method
|
||||
*/
|
||||
export interface DelayOptions extends AbortOptions {
|
||||
}
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export declare function delay(timeInMs: number, options?: DelayOptions): Promise<void>;
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
//# sourceMappingURL=delay.d.ts.map
|
||||
39
node_modules/@azure/core-util/dist/browser/delay.js
generated
vendored
Normal file
39
node_modules/@azure/core-util/dist/browser/delay.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { createAbortablePromise } from "./createAbortablePromise.js";
|
||||
import { getRandomIntegerInclusive } from "@typespec/ts-http-runtime/internal/util";
|
||||
const StandardAbortMessage = "The delay was aborted.";
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export function delay(timeInMs, options) {
|
||||
let token;
|
||||
const { abortSignal, abortErrorMsg } = options ?? {};
|
||||
return createAbortablePromise((resolve) => {
|
||||
token = setTimeout(resolve, timeInMs);
|
||||
}, {
|
||||
cleanupBeforeAbort: () => clearTimeout(token),
|
||||
abortSignal,
|
||||
abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
// Exponentially increase the delay each time
|
||||
const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
|
||||
// Don't let the delay exceed the maximum
|
||||
const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
|
||||
// Allow the final value to have some "jitter" (within 50% of the delay size) so
|
||||
// that retries across multiple clients don't occur simultaneously.
|
||||
const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);
|
||||
return { retryAfterInMs };
|
||||
}
|
||||
//# sourceMappingURL=delay.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/delay.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/delay.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAOtD;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,IAAI,KAAoC,CAAC;IACzC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACrD,OAAO,sBAAsB,CAC3B,CAAC,OAAO,EAAE,EAAE;QACV,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,EACD;QACE,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;QAC7C,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,oBAAoB;KACrD,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAoB,EACpB,MAGC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAE3E,yCAAyC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE1E,gFAAgF;IAChF,mEAAmE;IACnE,MAAM,cAAc,GAAG,YAAY,GAAG,CAAC,GAAG,yBAAyB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IAEzF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortOptions } from \"./aborterUtils.js\";\nimport { createAbortablePromise } from \"./createAbortablePromise.js\";\nimport { getRandomIntegerInclusive } from \"@typespec/ts-http-runtime/internal/util\";\n\nconst StandardAbortMessage = \"The delay was aborted.\";\n\n/**\n * Options for support abort functionality for the delay method\n */\nexport interface DelayOptions extends AbortOptions {}\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @param options - The options for delay - currently abort options\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number, options?: DelayOptions): Promise<void> {\n let token: ReturnType<typeof setTimeout>;\n const { abortSignal, abortErrorMsg } = options ?? {};\n return createAbortablePromise(\n (resolve) => {\n token = setTimeout(resolve, timeInMs);\n },\n {\n cleanupBeforeAbort: () => clearTimeout(token),\n abortSignal,\n abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,\n },\n );\n}\n\n/**\n * Calculates the delay interval for retry attempts using exponential delay with jitter.\n * @param retryAttempt - The current retry attempt number.\n * @param config - The exponential retry configuration.\n * @returns An object containing the calculated retry delay.\n */\nexport function calculateRetryDelay(\n retryAttempt: number,\n config: {\n retryDelayInMs: number;\n maxRetryDelayInMs: number;\n },\n): { retryAfterInMs: number } {\n // Exponentially increase the delay each time\n const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);\n\n // Don't let the delay exceed the maximum\n const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);\n\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);\n\n return { retryAfterInMs };\n}\n"]}
|
||||
8
node_modules/@azure/core-util/dist/browser/error.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-util/dist/browser/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export declare function getErrorMessage(e: unknown): string;
|
||||
//# sourceMappingURL=error.d.ts.map
|
||||
30
node_modules/@azure/core-util/dist/browser/error.js
generated
vendored
Normal file
30
node_modules/@azure/core-util/dist/browser/error.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { isError } from "@typespec/ts-http-runtime/internal/util";
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export function getErrorMessage(e) {
|
||||
if (isError(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/error.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/error.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAC/B,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,WAAW,GAAG,6BAA6B,CAAC;QAC9C,CAAC;QACD,OAAO,iBAAiB,WAAW,EAAE,CAAC;IACxC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"@typespec/ts-http-runtime/internal/util\";\n\n/**\n * Given what is thought to be an error object, return the message if possible.\n * If the message is missing, returns a stringified version of the input.\n * @param e - Something thrown from a try block\n * @returns The error message or a string of the input\n */\nexport function getErrorMessage(e: unknown): string {\n if (isError(e)) {\n return e.message;\n } else {\n let stringified: string;\n try {\n if (typeof e === \"object\" && e) {\n stringified = JSON.stringify(e);\n } else {\n stringified = String(e);\n }\n } catch (err: any) {\n stringified = \"[unable to stringify input]\";\n }\n return `Unknown error ${stringified}`;\n }\n}\n"]}
|
||||
129
node_modules/@azure/core-util/dist/browser/index.d.ts
generated
vendored
Normal file
129
node_modules/@azure/core-util/dist/browser/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
export { type AbortOptions, type AbortablePromiseBuilder, cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { type CreateAbortablePromiseOptions, createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { type DelayOptions, delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export declare function getRandomIntegerInclusive(min: number, max: number): number;
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export declare function isError(e: unknown): e is Error;
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export declare function isObject(input: unknown): input is UnknownObject;
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export declare function randomUUID(): string;
|
||||
/**
|
||||
* Supported HTTP methods to use when making requests.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
||||
/**
|
||||
* A generic shape for a plain JS object.
|
||||
*/
|
||||
export type UnknownObject = {
|
||||
[s: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export declare const isBrowser: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export declare const isBun: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export declare const isDeno: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export declare const isNode: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export declare const isNodeLike: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export declare const isNodeRuntime: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export declare const isReactNative: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export declare const isWebWorker: boolean;
|
||||
/** The supported character encoding type */
|
||||
export type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
131
node_modules/@azure/core-util/dist/browser/index.js
generated
vendored
Normal file
131
node_modules/@azure/core-util/dist/browser/index.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import * as tspRuntime from "@typespec/ts-http-runtime/internal/util";
|
||||
export { cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
return tspRuntime.calculateRetryDelay(retryAttempt, config);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export function computeSha256Hash(content, encoding) {
|
||||
return tspRuntime.computeSha256Hash(content, encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
return tspRuntime.computeSha256Hmac(key, stringToSign, encoding);
|
||||
}
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export function getRandomIntegerInclusive(min, max) {
|
||||
return tspRuntime.getRandomIntegerInclusive(min, max);
|
||||
}
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export function isError(e) {
|
||||
return tspRuntime.isError(e);
|
||||
}
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export function isObject(input) {
|
||||
return tspRuntime.isObject(input);
|
||||
}
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export function randomUUID() {
|
||||
return tspRuntime.randomUUID();
|
||||
}
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export const isBrowser = tspRuntime.isBrowser;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export const isBun = tspRuntime.isBun;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export const isDeno = tspRuntime.isDeno;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export const isNode = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export const isNodeLike = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export const isNodeRuntime = tspRuntime.isNodeRuntime;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export const isReactNative = tspRuntime.isReactNative;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export const isWebWorker = tspRuntime.isWebWorker;
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export function uint8ArrayToString(bytes, format) {
|
||||
return tspRuntime.uint8ArrayToString(bytes, format);
|
||||
}
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export function stringToUint8Array(value, format) {
|
||||
return tspRuntime.stringToUint8Array(value, format);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-util/dist/browser/package.json
generated
vendored
Normal file
3
node_modules/@azure/core-util/dist/browser/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
18
node_modules/@azure/core-util/dist/browser/typeGuards.d.ts
generated
vendored
Normal file
18
node_modules/@azure/core-util/dist/browser/typeGuards.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export declare function isDefined<T>(thing: T | undefined | null): thing is T;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export declare function isObjectWithProperties<Thing, PropertyName extends string>(thing: Thing, properties: PropertyName[]): thing is Thing & Record<PropertyName, unknown>;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export declare function objectHasProperty<Thing, PropertyName extends string>(thing: Thing, property: PropertyName): thing is Thing & Record<PropertyName, unknown>;
|
||||
//# sourceMappingURL=typeGuards.d.ts.map
|
||||
34
node_modules/@azure/core-util/dist/browser/typeGuards.js
generated
vendored
Normal file
34
node_modules/@azure/core-util/dist/browser/typeGuards.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
//# sourceMappingURL=typeGuards.js.map
|
||||
1
node_modules/@azure/core-util/dist/browser/typeGuards.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/browser/typeGuards.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,KAA2B;IACtD,OAAO,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAY,EACZ,UAA0B;IAE1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAY,EACZ,QAAsB;IAEtB,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAK,KAAiC,CAChG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Helper TypeGuard that checks if something is defined or not.\n * @param thing - Anything\n */\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return typeof thing !== \"undefined\" && thing !== null;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified properties.\n * @param thing - Anything.\n * @param properties - The name of the properties that should appear in the object.\n */\nexport function isObjectWithProperties<Thing, PropertyName extends string>(\n thing: Thing,\n properties: PropertyName[],\n): thing is Thing & Record<PropertyName, unknown> {\n if (!isDefined(thing) || typeof thing !== \"object\") {\n return false;\n }\n\n for (const property of properties) {\n if (!objectHasProperty(thing, property)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified property.\n * @param thing - Any object.\n * @param property - The name of the property that should appear in the object.\n */\nexport function objectHasProperty<Thing, PropertyName extends string>(\n thing: Thing,\n property: PropertyName,\n): thing is Thing & Record<PropertyName, unknown> {\n return (\n isDefined(thing) && typeof thing === \"object\" && property in (thing as Record<string, unknown>)\n );\n}\n"]}
|
||||
27
node_modules/@azure/core-util/dist/commonjs/aborterUtils.d.ts
generated
vendored
Normal file
27
node_modules/@azure/core-util/dist/commonjs/aborterUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { AbortSignalLike } from "@azure/abort-controller";
|
||||
/**
|
||||
* Options related to abort controller.
|
||||
*/
|
||||
export interface AbortOptions {
|
||||
/**
|
||||
* The abortSignal associated with containing operation.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* The abort error message associated with containing operation.
|
||||
*/
|
||||
abortErrorMsg?: string;
|
||||
}
|
||||
/**
|
||||
* Represents a function that returns a promise that can be aborted.
|
||||
*/
|
||||
export type AbortablePromiseBuilder<T> = (abortOptions: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}) => Promise<T>;
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}): Promise<T[number]>;
|
||||
//# sourceMappingURL=aborterUtils.d.ts.map
|
||||
23
node_modules/@azure/core-util/dist/commonjs/aborterUtils.js
generated
vendored
Normal file
23
node_modules/@azure/core-util/dist/commonjs/aborterUtils.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cancelablePromiseRace = cancelablePromiseRace;
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
async function cancelablePromiseRace(abortablePromiseBuilders, options) {
|
||||
const aborter = new AbortController();
|
||||
function abortHandler() {
|
||||
aborter.abort();
|
||||
}
|
||||
options?.abortSignal?.addEventListener("abort", abortHandler);
|
||||
try {
|
||||
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
|
||||
}
|
||||
finally {
|
||||
aborter.abort();
|
||||
options?.abortSignal?.removeEventListener("abort", abortHandler);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=aborterUtils.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/aborterUtils.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/aborterUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4BlC,sDAiBC;AApBD;;GAEG;AACI,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
|
||||
16
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.d.ts
generated
vendored
Normal file
16
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for the createAbortablePromise function.
|
||||
*/
|
||||
export interface CreateAbortablePromiseOptions extends AbortOptions {
|
||||
/** A function to be called if the promise was aborted */
|
||||
cleanupBeforeAbort?: () => void;
|
||||
}
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export declare function createAbortablePromise<T>(buildPromise: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, options?: CreateAbortablePromiseOptions): Promise<T>;
|
||||
//# sourceMappingURL=createAbortablePromise.d.ts.map
|
||||
45
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.js
generated
vendored
Normal file
45
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createAbortablePromise = createAbortablePromise;
|
||||
const abort_controller_1 = require("@azure/abort-controller");
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
function createAbortablePromise(buildPromise, options) {
|
||||
const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
|
||||
return new Promise((resolve, reject) => {
|
||||
function rejectOnAbort() {
|
||||
reject(new abort_controller_1.AbortError(abortErrorMsg ?? "The operation was aborted."));
|
||||
}
|
||||
function removeListeners() {
|
||||
abortSignal?.removeEventListener("abort", onAbort);
|
||||
}
|
||||
function onAbort() {
|
||||
cleanupBeforeAbort?.();
|
||||
removeListeners();
|
||||
rejectOnAbort();
|
||||
}
|
||||
if (abortSignal?.aborted) {
|
||||
return rejectOnAbort();
|
||||
}
|
||||
try {
|
||||
buildPromise((x) => {
|
||||
removeListeners();
|
||||
resolve(x);
|
||||
}, (x) => {
|
||||
removeListeners();
|
||||
reject(x);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
abortSignal?.addEventListener("abort", onAbort);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=createAbortablePromise.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/createAbortablePromise.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,wDAuCC;AAxDD,8DAAqD;AAWrD;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,YAGS,EACT,OAAuC;IAEvC,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,6BAAU,CAAC,aAAa,IAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,EAAE,EAAE,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;YACzB,OAAO,aAAa,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CACV,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { AbortOptions } from \"./aborterUtils.js\";\n\n/**\n * Options for the createAbortablePromise function.\n */\nexport interface CreateAbortablePromiseOptions extends AbortOptions {\n /** A function to be called if the promise was aborted */\n cleanupBeforeAbort?: () => void;\n}\n\n/**\n * Creates an abortable promise.\n * @param buildPromise - A function that takes the resolve and reject functions as parameters.\n * @param options - The options for the abortable promise.\n * @returns A promise that can be aborted.\n */\nexport function createAbortablePromise<T>(\n buildPromise: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void,\n ) => void,\n options?: CreateAbortablePromiseOptions,\n): Promise<T> {\n const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};\n return new Promise((resolve, reject) => {\n function rejectOnAbort(): void {\n reject(new AbortError(abortErrorMsg ?? \"The operation was aborted.\"));\n }\n function removeListeners(): void {\n abortSignal?.removeEventListener(\"abort\", onAbort);\n }\n function onAbort(): void {\n cleanupBeforeAbort?.();\n removeListeners();\n rejectOnAbort();\n }\n if (abortSignal?.aborted) {\n return rejectOnAbort();\n }\n try {\n buildPromise(\n (x) => {\n removeListeners();\n resolve(x);\n },\n (x) => {\n removeListeners();\n reject(x);\n },\n );\n } catch (err) {\n reject(err);\n }\n abortSignal?.addEventListener(\"abort\", onAbort);\n });\n}\n"]}
|
||||
26
node_modules/@azure/core-util/dist/commonjs/delay.d.ts
generated
vendored
Normal file
26
node_modules/@azure/core-util/dist/commonjs/delay.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for support abort functionality for the delay method
|
||||
*/
|
||||
export interface DelayOptions extends AbortOptions {
|
||||
}
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export declare function delay(timeInMs: number, options?: DelayOptions): Promise<void>;
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
//# sourceMappingURL=delay.d.ts.map
|
||||
43
node_modules/@azure/core-util/dist/commonjs/delay.js
generated
vendored
Normal file
43
node_modules/@azure/core-util/dist/commonjs/delay.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.delay = delay;
|
||||
exports.calculateRetryDelay = calculateRetryDelay;
|
||||
const createAbortablePromise_js_1 = require("./createAbortablePromise.js");
|
||||
const util_1 = require("@typespec/ts-http-runtime/internal/util");
|
||||
const StandardAbortMessage = "The delay was aborted.";
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
function delay(timeInMs, options) {
|
||||
let token;
|
||||
const { abortSignal, abortErrorMsg } = options ?? {};
|
||||
return (0, createAbortablePromise_js_1.createAbortablePromise)((resolve) => {
|
||||
token = setTimeout(resolve, timeInMs);
|
||||
}, {
|
||||
cleanupBeforeAbort: () => clearTimeout(token),
|
||||
abortSignal,
|
||||
abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
function calculateRetryDelay(retryAttempt, config) {
|
||||
// Exponentially increase the delay each time
|
||||
const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
|
||||
// Don't let the delay exceed the maximum
|
||||
const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
|
||||
// Allow the final value to have some "jitter" (within 50% of the delay size) so
|
||||
// that retries across multiple clients don't occur simultaneously.
|
||||
const retryAfterInMs = clampedDelay / 2 + (0, util_1.getRandomIntegerInclusive)(0, clampedDelay / 2);
|
||||
return { retryAfterInMs };
|
||||
}
|
||||
//# sourceMappingURL=delay.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/delay.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/delay.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,sBAaC;AAQD,kDAkBC;AAvDD,2EAAqE;AACrE,kEAAoF;AAEpF,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAOtD;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,IAAI,KAAoC,CAAC;IACzC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACrD,OAAO,IAAA,kDAAsB,EAC3B,CAAC,OAAO,EAAE,EAAE;QACV,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,EACD;QACE,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;QAC7C,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,oBAAoB;KACrD,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,MAGC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAE3E,yCAAyC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE1E,gFAAgF;IAChF,mEAAmE;IACnE,MAAM,cAAc,GAAG,YAAY,GAAG,CAAC,GAAG,IAAA,gCAAyB,EAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IAEzF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortOptions } from \"./aborterUtils.js\";\nimport { createAbortablePromise } from \"./createAbortablePromise.js\";\nimport { getRandomIntegerInclusive } from \"@typespec/ts-http-runtime/internal/util\";\n\nconst StandardAbortMessage = \"The delay was aborted.\";\n\n/**\n * Options for support abort functionality for the delay method\n */\nexport interface DelayOptions extends AbortOptions {}\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @param options - The options for delay - currently abort options\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number, options?: DelayOptions): Promise<void> {\n let token: ReturnType<typeof setTimeout>;\n const { abortSignal, abortErrorMsg } = options ?? {};\n return createAbortablePromise(\n (resolve) => {\n token = setTimeout(resolve, timeInMs);\n },\n {\n cleanupBeforeAbort: () => clearTimeout(token),\n abortSignal,\n abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,\n },\n );\n}\n\n/**\n * Calculates the delay interval for retry attempts using exponential delay with jitter.\n * @param retryAttempt - The current retry attempt number.\n * @param config - The exponential retry configuration.\n * @returns An object containing the calculated retry delay.\n */\nexport function calculateRetryDelay(\n retryAttempt: number,\n config: {\n retryDelayInMs: number;\n maxRetryDelayInMs: number;\n },\n): { retryAfterInMs: number } {\n // Exponentially increase the delay each time\n const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);\n\n // Don't let the delay exceed the maximum\n const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);\n\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);\n\n return { retryAfterInMs };\n}\n"]}
|
||||
8
node_modules/@azure/core-util/dist/commonjs/error.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-util/dist/commonjs/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export declare function getErrorMessage(e: unknown): string;
|
||||
//# sourceMappingURL=error.d.ts.map
|
||||
33
node_modules/@azure/core-util/dist/commonjs/error.js
generated
vendored
Normal file
33
node_modules/@azure/core-util/dist/commonjs/error.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getErrorMessage = getErrorMessage;
|
||||
const util_1 = require("@typespec/ts-http-runtime/internal/util");
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
function getErrorMessage(e) {
|
||||
if ((0, util_1.isError)(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/error.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/error.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAUlC,0CAgBC;AAxBD,kEAAkE;AAElE;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,CAAU;IACxC,IAAI,IAAA,cAAO,EAAC,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAC/B,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,WAAW,GAAG,6BAA6B,CAAC;QAC9C,CAAC;QACD,OAAO,iBAAiB,WAAW,EAAE,CAAC;IACxC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"@typespec/ts-http-runtime/internal/util\";\n\n/**\n * Given what is thought to be an error object, return the message if possible.\n * If the message is missing, returns a stringified version of the input.\n * @param e - Something thrown from a try block\n * @returns The error message or a string of the input\n */\nexport function getErrorMessage(e: unknown): string {\n if (isError(e)) {\n return e.message;\n } else {\n let stringified: string;\n try {\n if (typeof e === \"object\" && e) {\n stringified = JSON.stringify(e);\n } else {\n stringified = String(e);\n }\n } catch (err: any) {\n stringified = \"[unable to stringify input]\";\n }\n return `Unknown error ${stringified}`;\n }\n}\n"]}
|
||||
129
node_modules/@azure/core-util/dist/commonjs/index.d.ts
generated
vendored
Normal file
129
node_modules/@azure/core-util/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
export { type AbortOptions, type AbortablePromiseBuilder, cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { type CreateAbortablePromiseOptions, createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { type DelayOptions, delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export declare function getRandomIntegerInclusive(min: number, max: number): number;
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export declare function isError(e: unknown): e is Error;
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export declare function isObject(input: unknown): input is UnknownObject;
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export declare function randomUUID(): string;
|
||||
/**
|
||||
* Supported HTTP methods to use when making requests.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
||||
/**
|
||||
* A generic shape for a plain JS object.
|
||||
*/
|
||||
export type UnknownObject = {
|
||||
[s: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export declare const isBrowser: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export declare const isBun: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export declare const isDeno: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export declare const isNode: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export declare const isNodeLike: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export declare const isNodeRuntime: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export declare const isReactNative: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export declare const isWebWorker: boolean;
|
||||
/** The supported character encoding type */
|
||||
export type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
151
node_modules/@azure/core-util/dist/commonjs/index.js
generated
vendored
Normal file
151
node_modules/@azure/core-util/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isWebWorker = exports.isReactNative = exports.isNodeRuntime = exports.isNodeLike = exports.isNode = exports.isDeno = exports.isBun = exports.isBrowser = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.getErrorMessage = exports.delay = exports.createAbortablePromise = exports.cancelablePromiseRace = void 0;
|
||||
exports.calculateRetryDelay = calculateRetryDelay;
|
||||
exports.computeSha256Hash = computeSha256Hash;
|
||||
exports.computeSha256Hmac = computeSha256Hmac;
|
||||
exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
|
||||
exports.isError = isError;
|
||||
exports.isObject = isObject;
|
||||
exports.randomUUID = randomUUID;
|
||||
exports.uint8ArrayToString = uint8ArrayToString;
|
||||
exports.stringToUint8Array = stringToUint8Array;
|
||||
const tslib_1 = require("tslib");
|
||||
const tspRuntime = tslib_1.__importStar(require("@typespec/ts-http-runtime/internal/util"));
|
||||
var aborterUtils_js_1 = require("./aborterUtils.js");
|
||||
Object.defineProperty(exports, "cancelablePromiseRace", { enumerable: true, get: function () { return aborterUtils_js_1.cancelablePromiseRace; } });
|
||||
var createAbortablePromise_js_1 = require("./createAbortablePromise.js");
|
||||
Object.defineProperty(exports, "createAbortablePromise", { enumerable: true, get: function () { return createAbortablePromise_js_1.createAbortablePromise; } });
|
||||
var delay_js_1 = require("./delay.js");
|
||||
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return delay_js_1.delay; } });
|
||||
var error_js_1 = require("./error.js");
|
||||
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return error_js_1.getErrorMessage; } });
|
||||
var typeGuards_js_1 = require("./typeGuards.js");
|
||||
Object.defineProperty(exports, "isDefined", { enumerable: true, get: function () { return typeGuards_js_1.isDefined; } });
|
||||
Object.defineProperty(exports, "isObjectWithProperties", { enumerable: true, get: function () { return typeGuards_js_1.isObjectWithProperties; } });
|
||||
Object.defineProperty(exports, "objectHasProperty", { enumerable: true, get: function () { return typeGuards_js_1.objectHasProperty; } });
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
function calculateRetryDelay(retryAttempt, config) {
|
||||
return tspRuntime.calculateRetryDelay(retryAttempt, config);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
function computeSha256Hash(content, encoding) {
|
||||
return tspRuntime.computeSha256Hash(content, encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
return tspRuntime.computeSha256Hmac(key, stringToSign, encoding);
|
||||
}
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
function getRandomIntegerInclusive(min, max) {
|
||||
return tspRuntime.getRandomIntegerInclusive(min, max);
|
||||
}
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
function isError(e) {
|
||||
return tspRuntime.isError(e);
|
||||
}
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
function isObject(input) {
|
||||
return tspRuntime.isObject(input);
|
||||
}
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
function randomUUID() {
|
||||
return tspRuntime.randomUUID();
|
||||
}
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
exports.isBrowser = tspRuntime.isBrowser;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
exports.isBun = tspRuntime.isBun;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
exports.isDeno = tspRuntime.isDeno;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
exports.isNode = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
exports.isNodeLike = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
exports.isNodeRuntime = tspRuntime.isNodeRuntime;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
exports.isReactNative = tspRuntime.isReactNative;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
exports.isWebWorker = tspRuntime.isWebWorker;
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
function uint8ArrayToString(bytes, format) {
|
||||
return tspRuntime.uint8ArrayToString(bytes, format);
|
||||
}
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
function stringToUint8Array(value, format) {
|
||||
return tspRuntime.stringToUint8Array(value, format);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-util/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@azure/core-util/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
11
node_modules/@azure/core-util/dist/commonjs/tsdoc-metadata.json
generated
vendored
Normal file
11
node_modules/@azure/core-util/dist/commonjs/tsdoc-metadata.json
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
||||
// It should be published with your NPM package. It should not be tracked by Git.
|
||||
{
|
||||
"tsdocVersion": "0.12",
|
||||
"toolPackages": [
|
||||
{
|
||||
"packageName": "@microsoft/api-extractor",
|
||||
"packageVersion": "7.52.11"
|
||||
}
|
||||
]
|
||||
}
|
||||
18
node_modules/@azure/core-util/dist/commonjs/typeGuards.d.ts
generated
vendored
Normal file
18
node_modules/@azure/core-util/dist/commonjs/typeGuards.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export declare function isDefined<T>(thing: T | undefined | null): thing is T;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export declare function isObjectWithProperties<Thing, PropertyName extends string>(thing: Thing, properties: PropertyName[]): thing is Thing & Record<PropertyName, unknown>;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export declare function objectHasProperty<Thing, PropertyName extends string>(thing: Thing, property: PropertyName): thing is Thing & Record<PropertyName, unknown>;
|
||||
//# sourceMappingURL=typeGuards.d.ts.map
|
||||
39
node_modules/@azure/core-util/dist/commonjs/typeGuards.js
generated
vendored
Normal file
39
node_modules/@azure/core-util/dist/commonjs/typeGuards.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDefined = isDefined;
|
||||
exports.isObjectWithProperties = isObjectWithProperties;
|
||||
exports.objectHasProperty = objectHasProperty;
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
//# sourceMappingURL=typeGuards.js.map
|
||||
1
node_modules/@azure/core-util/dist/commonjs/typeGuards.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/commonjs/typeGuards.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAMlC,8BAEC;AAOD,wDAeC;AAOD,8CAOC;AA1CD;;;GAGG;AACH,SAAgB,SAAS,CAAI,KAA2B;IACtD,OAAO,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CACpC,KAAY,EACZ,UAA0B;IAE1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,KAAY,EACZ,QAAsB;IAEtB,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAK,KAAiC,CAChG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Helper TypeGuard that checks if something is defined or not.\n * @param thing - Anything\n */\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return typeof thing !== \"undefined\" && thing !== null;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified properties.\n * @param thing - Anything.\n * @param properties - The name of the properties that should appear in the object.\n */\nexport function isObjectWithProperties<Thing, PropertyName extends string>(\n thing: Thing,\n properties: PropertyName[],\n): thing is Thing & Record<PropertyName, unknown> {\n if (!isDefined(thing) || typeof thing !== \"object\") {\n return false;\n }\n\n for (const property of properties) {\n if (!objectHasProperty(thing, property)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified property.\n * @param thing - Any object.\n * @param property - The name of the property that should appear in the object.\n */\nexport function objectHasProperty<Thing, PropertyName extends string>(\n thing: Thing,\n property: PropertyName,\n): thing is Thing & Record<PropertyName, unknown> {\n return (\n isDefined(thing) && typeof thing === \"object\" && property in (thing as Record<string, unknown>)\n );\n}\n"]}
|
||||
27
node_modules/@azure/core-util/dist/esm/aborterUtils.d.ts
generated
vendored
Normal file
27
node_modules/@azure/core-util/dist/esm/aborterUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { AbortSignalLike } from "@azure/abort-controller";
|
||||
/**
|
||||
* Options related to abort controller.
|
||||
*/
|
||||
export interface AbortOptions {
|
||||
/**
|
||||
* The abortSignal associated with containing operation.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* The abort error message associated with containing operation.
|
||||
*/
|
||||
abortErrorMsg?: string;
|
||||
}
|
||||
/**
|
||||
* Represents a function that returns a promise that can be aborted.
|
||||
*/
|
||||
export type AbortablePromiseBuilder<T> = (abortOptions: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}) => Promise<T>;
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}): Promise<T[number]>;
|
||||
//# sourceMappingURL=aborterUtils.d.ts.map
|
||||
20
node_modules/@azure/core-util/dist/esm/aborterUtils.js
generated
vendored
Normal file
20
node_modules/@azure/core-util/dist/esm/aborterUtils.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export async function cancelablePromiseRace(abortablePromiseBuilders, options) {
|
||||
const aborter = new AbortController();
|
||||
function abortHandler() {
|
||||
aborter.abort();
|
||||
}
|
||||
options?.abortSignal?.addEventListener("abort", abortHandler);
|
||||
try {
|
||||
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
|
||||
}
|
||||
finally {
|
||||
aborter.abort();
|
||||
options?.abortSignal?.removeEventListener("abort", abortHandler);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=aborterUtils.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/aborterUtils.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/aborterUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAyBlC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
|
||||
16
node_modules/@azure/core-util/dist/esm/createAbortablePromise.d.ts
generated
vendored
Normal file
16
node_modules/@azure/core-util/dist/esm/createAbortablePromise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for the createAbortablePromise function.
|
||||
*/
|
||||
export interface CreateAbortablePromiseOptions extends AbortOptions {
|
||||
/** A function to be called if the promise was aborted */
|
||||
cleanupBeforeAbort?: () => void;
|
||||
}
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export declare function createAbortablePromise<T>(buildPromise: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, options?: CreateAbortablePromiseOptions): Promise<T>;
|
||||
//# sourceMappingURL=createAbortablePromise.d.ts.map
|
||||
42
node_modules/@azure/core-util/dist/esm/createAbortablePromise.js
generated
vendored
Normal file
42
node_modules/@azure/core-util/dist/esm/createAbortablePromise.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { AbortError } from "@azure/abort-controller";
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export function createAbortablePromise(buildPromise, options) {
|
||||
const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
|
||||
return new Promise((resolve, reject) => {
|
||||
function rejectOnAbort() {
|
||||
reject(new AbortError(abortErrorMsg ?? "The operation was aborted."));
|
||||
}
|
||||
function removeListeners() {
|
||||
abortSignal?.removeEventListener("abort", onAbort);
|
||||
}
|
||||
function onAbort() {
|
||||
cleanupBeforeAbort?.();
|
||||
removeListeners();
|
||||
rejectOnAbort();
|
||||
}
|
||||
if (abortSignal?.aborted) {
|
||||
return rejectOnAbort();
|
||||
}
|
||||
try {
|
||||
buildPromise((x) => {
|
||||
removeListeners();
|
||||
resolve(x);
|
||||
}, (x) => {
|
||||
removeListeners();
|
||||
reject(x);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
abortSignal?.addEventListener("abort", onAbort);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=createAbortablePromise.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/createAbortablePromise.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/createAbortablePromise.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAGS,EACT,OAAuC;IAEvC,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,IAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,EAAE,EAAE,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;YACzB,OAAO,aAAa,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CACV,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { AbortOptions } from \"./aborterUtils.js\";\n\n/**\n * Options for the createAbortablePromise function.\n */\nexport interface CreateAbortablePromiseOptions extends AbortOptions {\n /** A function to be called if the promise was aborted */\n cleanupBeforeAbort?: () => void;\n}\n\n/**\n * Creates an abortable promise.\n * @param buildPromise - A function that takes the resolve and reject functions as parameters.\n * @param options - The options for the abortable promise.\n * @returns A promise that can be aborted.\n */\nexport function createAbortablePromise<T>(\n buildPromise: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void,\n ) => void,\n options?: CreateAbortablePromiseOptions,\n): Promise<T> {\n const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};\n return new Promise((resolve, reject) => {\n function rejectOnAbort(): void {\n reject(new AbortError(abortErrorMsg ?? \"The operation was aborted.\"));\n }\n function removeListeners(): void {\n abortSignal?.removeEventListener(\"abort\", onAbort);\n }\n function onAbort(): void {\n cleanupBeforeAbort?.();\n removeListeners();\n rejectOnAbort();\n }\n if (abortSignal?.aborted) {\n return rejectOnAbort();\n }\n try {\n buildPromise(\n (x) => {\n removeListeners();\n resolve(x);\n },\n (x) => {\n removeListeners();\n reject(x);\n },\n );\n } catch (err) {\n reject(err);\n }\n abortSignal?.addEventListener(\"abort\", onAbort);\n });\n}\n"]}
|
||||
26
node_modules/@azure/core-util/dist/esm/delay.d.ts
generated
vendored
Normal file
26
node_modules/@azure/core-util/dist/esm/delay.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for support abort functionality for the delay method
|
||||
*/
|
||||
export interface DelayOptions extends AbortOptions {
|
||||
}
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export declare function delay(timeInMs: number, options?: DelayOptions): Promise<void>;
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
//# sourceMappingURL=delay.d.ts.map
|
||||
39
node_modules/@azure/core-util/dist/esm/delay.js
generated
vendored
Normal file
39
node_modules/@azure/core-util/dist/esm/delay.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { createAbortablePromise } from "./createAbortablePromise.js";
|
||||
import { getRandomIntegerInclusive } from "@typespec/ts-http-runtime/internal/util";
|
||||
const StandardAbortMessage = "The delay was aborted.";
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export function delay(timeInMs, options) {
|
||||
let token;
|
||||
const { abortSignal, abortErrorMsg } = options ?? {};
|
||||
return createAbortablePromise((resolve) => {
|
||||
token = setTimeout(resolve, timeInMs);
|
||||
}, {
|
||||
cleanupBeforeAbort: () => clearTimeout(token),
|
||||
abortSignal,
|
||||
abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
// Exponentially increase the delay each time
|
||||
const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
|
||||
// Don't let the delay exceed the maximum
|
||||
const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
|
||||
// Allow the final value to have some "jitter" (within 50% of the delay size) so
|
||||
// that retries across multiple clients don't occur simultaneously.
|
||||
const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);
|
||||
return { retryAfterInMs };
|
||||
}
|
||||
//# sourceMappingURL=delay.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/delay.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/delay.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAOtD;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,IAAI,KAAoC,CAAC;IACzC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACrD,OAAO,sBAAsB,CAC3B,CAAC,OAAO,EAAE,EAAE;QACV,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,EACD;QACE,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;QAC7C,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,oBAAoB;KACrD,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAoB,EACpB,MAGC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAE3E,yCAAyC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE1E,gFAAgF;IAChF,mEAAmE;IACnE,MAAM,cAAc,GAAG,YAAY,GAAG,CAAC,GAAG,yBAAyB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IAEzF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortOptions } from \"./aborterUtils.js\";\nimport { createAbortablePromise } from \"./createAbortablePromise.js\";\nimport { getRandomIntegerInclusive } from \"@typespec/ts-http-runtime/internal/util\";\n\nconst StandardAbortMessage = \"The delay was aborted.\";\n\n/**\n * Options for support abort functionality for the delay method\n */\nexport interface DelayOptions extends AbortOptions {}\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @param options - The options for delay - currently abort options\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number, options?: DelayOptions): Promise<void> {\n let token: ReturnType<typeof setTimeout>;\n const { abortSignal, abortErrorMsg } = options ?? {};\n return createAbortablePromise(\n (resolve) => {\n token = setTimeout(resolve, timeInMs);\n },\n {\n cleanupBeforeAbort: () => clearTimeout(token),\n abortSignal,\n abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,\n },\n );\n}\n\n/**\n * Calculates the delay interval for retry attempts using exponential delay with jitter.\n * @param retryAttempt - The current retry attempt number.\n * @param config - The exponential retry configuration.\n * @returns An object containing the calculated retry delay.\n */\nexport function calculateRetryDelay(\n retryAttempt: number,\n config: {\n retryDelayInMs: number;\n maxRetryDelayInMs: number;\n },\n): { retryAfterInMs: number } {\n // Exponentially increase the delay each time\n const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);\n\n // Don't let the delay exceed the maximum\n const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);\n\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);\n\n return { retryAfterInMs };\n}\n"]}
|
||||
8
node_modules/@azure/core-util/dist/esm/error.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-util/dist/esm/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export declare function getErrorMessage(e: unknown): string;
|
||||
//# sourceMappingURL=error.d.ts.map
|
||||
30
node_modules/@azure/core-util/dist/esm/error.js
generated
vendored
Normal file
30
node_modules/@azure/core-util/dist/esm/error.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { isError } from "@typespec/ts-http-runtime/internal/util";
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export function getErrorMessage(e) {
|
||||
if (isError(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/error.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/error.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAC/B,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,WAAW,GAAG,6BAA6B,CAAC;QAC9C,CAAC;QACD,OAAO,iBAAiB,WAAW,EAAE,CAAC;IACxC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"@typespec/ts-http-runtime/internal/util\";\n\n/**\n * Given what is thought to be an error object, return the message if possible.\n * If the message is missing, returns a stringified version of the input.\n * @param e - Something thrown from a try block\n * @returns The error message or a string of the input\n */\nexport function getErrorMessage(e: unknown): string {\n if (isError(e)) {\n return e.message;\n } else {\n let stringified: string;\n try {\n if (typeof e === \"object\" && e) {\n stringified = JSON.stringify(e);\n } else {\n stringified = String(e);\n }\n } catch (err: any) {\n stringified = \"[unable to stringify input]\";\n }\n return `Unknown error ${stringified}`;\n }\n}\n"]}
|
||||
129
node_modules/@azure/core-util/dist/esm/index.d.ts
generated
vendored
Normal file
129
node_modules/@azure/core-util/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
export { type AbortOptions, type AbortablePromiseBuilder, cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { type CreateAbortablePromiseOptions, createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { type DelayOptions, delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export declare function getRandomIntegerInclusive(min: number, max: number): number;
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export declare function isError(e: unknown): e is Error;
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export declare function isObject(input: unknown): input is UnknownObject;
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export declare function randomUUID(): string;
|
||||
/**
|
||||
* Supported HTTP methods to use when making requests.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
||||
/**
|
||||
* A generic shape for a plain JS object.
|
||||
*/
|
||||
export type UnknownObject = {
|
||||
[s: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export declare const isBrowser: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export declare const isBun: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export declare const isDeno: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export declare const isNode: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export declare const isNodeLike: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export declare const isNodeRuntime: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export declare const isReactNative: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export declare const isWebWorker: boolean;
|
||||
/** The supported character encoding type */
|
||||
export type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
131
node_modules/@azure/core-util/dist/esm/index.js
generated
vendored
Normal file
131
node_modules/@azure/core-util/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import * as tspRuntime from "@typespec/ts-http-runtime/internal/util";
|
||||
export { cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
return tspRuntime.calculateRetryDelay(retryAttempt, config);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export function computeSha256Hash(content, encoding) {
|
||||
return tspRuntime.computeSha256Hash(content, encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
return tspRuntime.computeSha256Hmac(key, stringToSign, encoding);
|
||||
}
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export function getRandomIntegerInclusive(min, max) {
|
||||
return tspRuntime.getRandomIntegerInclusive(min, max);
|
||||
}
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export function isError(e) {
|
||||
return tspRuntime.isError(e);
|
||||
}
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export function isObject(input) {
|
||||
return tspRuntime.isObject(input);
|
||||
}
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export function randomUUID() {
|
||||
return tspRuntime.randomUUID();
|
||||
}
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export const isBrowser = tspRuntime.isBrowser;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export const isBun = tspRuntime.isBun;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export const isDeno = tspRuntime.isDeno;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export const isNode = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export const isNodeLike = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export const isNodeRuntime = tspRuntime.isNodeRuntime;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export const isReactNative = tspRuntime.isReactNative;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export const isWebWorker = tspRuntime.isWebWorker;
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export function uint8ArrayToString(bytes, format) {
|
||||
return tspRuntime.uint8ArrayToString(bytes, format);
|
||||
}
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export function stringToUint8Array(value, format) {
|
||||
return tspRuntime.stringToUint8Array(value, format);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-util/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/@azure/core-util/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
18
node_modules/@azure/core-util/dist/esm/typeGuards.d.ts
generated
vendored
Normal file
18
node_modules/@azure/core-util/dist/esm/typeGuards.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export declare function isDefined<T>(thing: T | undefined | null): thing is T;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export declare function isObjectWithProperties<Thing, PropertyName extends string>(thing: Thing, properties: PropertyName[]): thing is Thing & Record<PropertyName, unknown>;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export declare function objectHasProperty<Thing, PropertyName extends string>(thing: Thing, property: PropertyName): thing is Thing & Record<PropertyName, unknown>;
|
||||
//# sourceMappingURL=typeGuards.d.ts.map
|
||||
34
node_modules/@azure/core-util/dist/esm/typeGuards.js
generated
vendored
Normal file
34
node_modules/@azure/core-util/dist/esm/typeGuards.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
//# sourceMappingURL=typeGuards.js.map
|
||||
1
node_modules/@azure/core-util/dist/esm/typeGuards.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/esm/typeGuards.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,KAA2B;IACtD,OAAO,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAY,EACZ,UAA0B;IAE1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAY,EACZ,QAAsB;IAEtB,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAK,KAAiC,CAChG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Helper TypeGuard that checks if something is defined or not.\n * @param thing - Anything\n */\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return typeof thing !== \"undefined\" && thing !== null;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified properties.\n * @param thing - Anything.\n * @param properties - The name of the properties that should appear in the object.\n */\nexport function isObjectWithProperties<Thing, PropertyName extends string>(\n thing: Thing,\n properties: PropertyName[],\n): thing is Thing & Record<PropertyName, unknown> {\n if (!isDefined(thing) || typeof thing !== \"object\") {\n return false;\n }\n\n for (const property of properties) {\n if (!objectHasProperty(thing, property)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified property.\n * @param thing - Any object.\n * @param property - The name of the property that should appear in the object.\n */\nexport function objectHasProperty<Thing, PropertyName extends string>(\n thing: Thing,\n property: PropertyName,\n): thing is Thing & Record<PropertyName, unknown> {\n return (\n isDefined(thing) && typeof thing === \"object\" && property in (thing as Record<string, unknown>)\n );\n}\n"]}
|
||||
27
node_modules/@azure/core-util/dist/react-native/aborterUtils.d.ts
generated
vendored
Normal file
27
node_modules/@azure/core-util/dist/react-native/aborterUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { AbortSignalLike } from "@azure/abort-controller";
|
||||
/**
|
||||
* Options related to abort controller.
|
||||
*/
|
||||
export interface AbortOptions {
|
||||
/**
|
||||
* The abortSignal associated with containing operation.
|
||||
*/
|
||||
abortSignal?: AbortSignalLike;
|
||||
/**
|
||||
* The abort error message associated with containing operation.
|
||||
*/
|
||||
abortErrorMsg?: string;
|
||||
}
|
||||
/**
|
||||
* Represents a function that returns a promise that can be aborted.
|
||||
*/
|
||||
export type AbortablePromiseBuilder<T> = (abortOptions: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}) => Promise<T>;
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
|
||||
abortSignal?: AbortSignalLike;
|
||||
}): Promise<T[number]>;
|
||||
//# sourceMappingURL=aborterUtils.d.ts.map
|
||||
20
node_modules/@azure/core-util/dist/react-native/aborterUtils.js
generated
vendored
Normal file
20
node_modules/@azure/core-util/dist/react-native/aborterUtils.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
||||
*/
|
||||
export async function cancelablePromiseRace(abortablePromiseBuilders, options) {
|
||||
const aborter = new AbortController();
|
||||
function abortHandler() {
|
||||
aborter.abort();
|
||||
}
|
||||
options?.abortSignal?.addEventListener("abort", abortHandler);
|
||||
try {
|
||||
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
|
||||
}
|
||||
finally {
|
||||
aborter.abort();
|
||||
options?.abortSignal?.removeEventListener("abort", abortHandler);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=aborterUtils.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/aborterUtils.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/aborterUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAyBlC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
|
||||
16
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.d.ts
generated
vendored
Normal file
16
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for the createAbortablePromise function.
|
||||
*/
|
||||
export interface CreateAbortablePromiseOptions extends AbortOptions {
|
||||
/** A function to be called if the promise was aborted */
|
||||
cleanupBeforeAbort?: () => void;
|
||||
}
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export declare function createAbortablePromise<T>(buildPromise: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, options?: CreateAbortablePromiseOptions): Promise<T>;
|
||||
//# sourceMappingURL=createAbortablePromise.d.ts.map
|
||||
42
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.js
generated
vendored
Normal file
42
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { AbortError } from "@azure/abort-controller";
|
||||
/**
|
||||
* Creates an abortable promise.
|
||||
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
||||
* @param options - The options for the abortable promise.
|
||||
* @returns A promise that can be aborted.
|
||||
*/
|
||||
export function createAbortablePromise(buildPromise, options) {
|
||||
const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
|
||||
return new Promise((resolve, reject) => {
|
||||
function rejectOnAbort() {
|
||||
reject(new AbortError(abortErrorMsg ?? "The operation was aborted."));
|
||||
}
|
||||
function removeListeners() {
|
||||
abortSignal?.removeEventListener("abort", onAbort);
|
||||
}
|
||||
function onAbort() {
|
||||
cleanupBeforeAbort?.();
|
||||
removeListeners();
|
||||
rejectOnAbort();
|
||||
}
|
||||
if (abortSignal?.aborted) {
|
||||
return rejectOnAbort();
|
||||
}
|
||||
try {
|
||||
buildPromise((x) => {
|
||||
removeListeners();
|
||||
resolve(x);
|
||||
}, (x) => {
|
||||
removeListeners();
|
||||
reject(x);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
abortSignal?.addEventListener("abort", onAbort);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=createAbortablePromise.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/createAbortablePromise.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAGS,EACT,OAAuC;IAEvC,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,IAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,EAAE,EAAE,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,EAAE,OAAO,EAAE,CAAC;YACzB,OAAO,aAAa,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CACV,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;gBACJ,eAAe,EAAE,CAAC;gBAClB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { AbortOptions } from \"./aborterUtils.js\";\n\n/**\n * Options for the createAbortablePromise function.\n */\nexport interface CreateAbortablePromiseOptions extends AbortOptions {\n /** A function to be called if the promise was aborted */\n cleanupBeforeAbort?: () => void;\n}\n\n/**\n * Creates an abortable promise.\n * @param buildPromise - A function that takes the resolve and reject functions as parameters.\n * @param options - The options for the abortable promise.\n * @returns A promise that can be aborted.\n */\nexport function createAbortablePromise<T>(\n buildPromise: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void,\n ) => void,\n options?: CreateAbortablePromiseOptions,\n): Promise<T> {\n const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};\n return new Promise((resolve, reject) => {\n function rejectOnAbort(): void {\n reject(new AbortError(abortErrorMsg ?? \"The operation was aborted.\"));\n }\n function removeListeners(): void {\n abortSignal?.removeEventListener(\"abort\", onAbort);\n }\n function onAbort(): void {\n cleanupBeforeAbort?.();\n removeListeners();\n rejectOnAbort();\n }\n if (abortSignal?.aborted) {\n return rejectOnAbort();\n }\n try {\n buildPromise(\n (x) => {\n removeListeners();\n resolve(x);\n },\n (x) => {\n removeListeners();\n reject(x);\n },\n );\n } catch (err) {\n reject(err);\n }\n abortSignal?.addEventListener(\"abort\", onAbort);\n });\n}\n"]}
|
||||
26
node_modules/@azure/core-util/dist/react-native/delay.d.ts
generated
vendored
Normal file
26
node_modules/@azure/core-util/dist/react-native/delay.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { AbortOptions } from "./aborterUtils.js";
|
||||
/**
|
||||
* Options for support abort functionality for the delay method
|
||||
*/
|
||||
export interface DelayOptions extends AbortOptions {
|
||||
}
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export declare function delay(timeInMs: number, options?: DelayOptions): Promise<void>;
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
//# sourceMappingURL=delay.d.ts.map
|
||||
39
node_modules/@azure/core-util/dist/react-native/delay.js
generated
vendored
Normal file
39
node_modules/@azure/core-util/dist/react-native/delay.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { createAbortablePromise } from "./createAbortablePromise.js";
|
||||
import { getRandomIntegerInclusive } from "@typespec/ts-http-runtime/internal/util";
|
||||
const StandardAbortMessage = "The delay was aborted.";
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @param options - The options for delay - currently abort options
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
export function delay(timeInMs, options) {
|
||||
let token;
|
||||
const { abortSignal, abortErrorMsg } = options ?? {};
|
||||
return createAbortablePromise((resolve) => {
|
||||
token = setTimeout(resolve, timeInMs);
|
||||
}, {
|
||||
cleanupBeforeAbort: () => clearTimeout(token),
|
||||
abortSignal,
|
||||
abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
* @param config - The exponential retry configuration.
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
// Exponentially increase the delay each time
|
||||
const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
|
||||
// Don't let the delay exceed the maximum
|
||||
const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
|
||||
// Allow the final value to have some "jitter" (within 50% of the delay size) so
|
||||
// that retries across multiple clients don't occur simultaneously.
|
||||
const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);
|
||||
return { retryAfterInMs };
|
||||
}
|
||||
//# sourceMappingURL=delay.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/delay.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/delay.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAOtD;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,IAAI,KAAoC,CAAC;IACzC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACrD,OAAO,sBAAsB,CAC3B,CAAC,OAAO,EAAE,EAAE;QACV,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,EACD;QACE,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;QAC7C,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,oBAAoB;KACrD,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAoB,EACpB,MAGC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAE3E,yCAAyC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE1E,gFAAgF;IAChF,mEAAmE;IACnE,MAAM,cAAc,GAAG,YAAY,GAAG,CAAC,GAAG,yBAAyB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;IAEzF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortOptions } from \"./aborterUtils.js\";\nimport { createAbortablePromise } from \"./createAbortablePromise.js\";\nimport { getRandomIntegerInclusive } from \"@typespec/ts-http-runtime/internal/util\";\n\nconst StandardAbortMessage = \"The delay was aborted.\";\n\n/**\n * Options for support abort functionality for the delay method\n */\nexport interface DelayOptions extends AbortOptions {}\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @param options - The options for delay - currently abort options\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number, options?: DelayOptions): Promise<void> {\n let token: ReturnType<typeof setTimeout>;\n const { abortSignal, abortErrorMsg } = options ?? {};\n return createAbortablePromise(\n (resolve) => {\n token = setTimeout(resolve, timeInMs);\n },\n {\n cleanupBeforeAbort: () => clearTimeout(token),\n abortSignal,\n abortErrorMsg: abortErrorMsg ?? StandardAbortMessage,\n },\n );\n}\n\n/**\n * Calculates the delay interval for retry attempts using exponential delay with jitter.\n * @param retryAttempt - The current retry attempt number.\n * @param config - The exponential retry configuration.\n * @returns An object containing the calculated retry delay.\n */\nexport function calculateRetryDelay(\n retryAttempt: number,\n config: {\n retryDelayInMs: number;\n maxRetryDelayInMs: number;\n },\n): { retryAfterInMs: number } {\n // Exponentially increase the delay each time\n const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);\n\n // Don't let the delay exceed the maximum\n const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);\n\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);\n\n return { retryAfterInMs };\n}\n"]}
|
||||
8
node_modules/@azure/core-util/dist/react-native/error.d.ts
generated
vendored
Normal file
8
node_modules/@azure/core-util/dist/react-native/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export declare function getErrorMessage(e: unknown): string;
|
||||
//# sourceMappingURL=error.d.ts.map
|
||||
30
node_modules/@azure/core-util/dist/react-native/error.js
generated
vendored
Normal file
30
node_modules/@azure/core-util/dist/react-native/error.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { isError } from "@typespec/ts-http-runtime/internal/util";
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
export function getErrorMessage(e) {
|
||||
if (isError(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/error.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/error.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAC/B,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,WAAW,GAAG,6BAA6B,CAAC;QAC9C,CAAC;QACD,OAAO,iBAAiB,WAAW,EAAE,CAAC;IACxC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"@typespec/ts-http-runtime/internal/util\";\n\n/**\n * Given what is thought to be an error object, return the message if possible.\n * If the message is missing, returns a stringified version of the input.\n * @param e - Something thrown from a try block\n * @returns The error message or a string of the input\n */\nexport function getErrorMessage(e: unknown): string {\n if (isError(e)) {\n return e.message;\n } else {\n let stringified: string;\n try {\n if (typeof e === \"object\" && e) {\n stringified = JSON.stringify(e);\n } else {\n stringified = String(e);\n }\n } catch (err: any) {\n stringified = \"[unable to stringify input]\";\n }\n return `Unknown error ${stringified}`;\n }\n}\n"]}
|
||||
129
node_modules/@azure/core-util/dist/react-native/index.d.ts
generated
vendored
Normal file
129
node_modules/@azure/core-util/dist/react-native/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
export { type AbortOptions, type AbortablePromiseBuilder, cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { type CreateAbortablePromiseOptions, createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { type DelayOptions, delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
||||
retryDelayInMs: number;
|
||||
maxRetryDelayInMs: number;
|
||||
}): {
|
||||
retryAfterInMs: number;
|
||||
};
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export declare function getRandomIntegerInclusive(min: number, max: number): number;
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export declare function isError(e: unknown): e is Error;
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export declare function isObject(input: unknown): input is UnknownObject;
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export declare function randomUUID(): string;
|
||||
/**
|
||||
* Supported HTTP methods to use when making requests.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
||||
/**
|
||||
* A generic shape for a plain JS object.
|
||||
*/
|
||||
export type UnknownObject = {
|
||||
[s: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export declare const isBrowser: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export declare const isBun: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export declare const isDeno: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export declare const isNode: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export declare const isNodeLike: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export declare const isNodeRuntime: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export declare const isReactNative: boolean;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export declare const isWebWorker: boolean;
|
||||
/** The supported character encoding type */
|
||||
export type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
131
node_modules/@azure/core-util/dist/react-native/index.js
generated
vendored
Normal file
131
node_modules/@azure/core-util/dist/react-native/index.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import * as tspRuntime from "@typespec/ts-http-runtime/internal/util";
|
||||
export { cancelablePromiseRace, } from "./aborterUtils.js";
|
||||
export { createAbortablePromise, } from "./createAbortablePromise.js";
|
||||
export { delay } from "./delay.js";
|
||||
export { getErrorMessage } from "./error.js";
|
||||
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
|
||||
/**
|
||||
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
||||
*
|
||||
* @param retryAttempt - The current retry attempt number.
|
||||
*
|
||||
* @param config - The exponential retry configuration.
|
||||
*
|
||||
* @returns An object containing the calculated retry delay.
|
||||
*/
|
||||
export function calculateRetryDelay(retryAttempt, config) {
|
||||
return tspRuntime.calculateRetryDelay(retryAttempt, config);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
*
|
||||
* @param content - The data to be included in the hash.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
export function computeSha256Hash(content, encoding) {
|
||||
return tspRuntime.computeSha256Hash(content, encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
*
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
*
|
||||
* @param stringToSign - The data to be signed.
|
||||
*
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
export function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
return tspRuntime.computeSha256Hmac(key, stringToSign, encoding);
|
||||
}
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound, inclusive of both bounds. Note that this uses Math.random and isn't secure. If you need to use this for any kind of security purpose, find a better source of random.
|
||||
*
|
||||
* @param min - The smallest integer value allowed.
|
||||
*
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
export function getRandomIntegerInclusive(min, max) {
|
||||
return tspRuntime.getRandomIntegerInclusive(min, max);
|
||||
}
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
*
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
export function isError(e) {
|
||||
return tspRuntime.isError(e);
|
||||
}
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
*
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
export function isObject(input) {
|
||||
return tspRuntime.isObject(input);
|
||||
}
|
||||
/**
|
||||
* Generated Universally Unique Identifier
|
||||
*
|
||||
* @returns RFC4122 v4 UUID.
|
||||
*/
|
||||
export function randomUUID() {
|
||||
return tspRuntime.randomUUID();
|
||||
}
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Browser.
|
||||
*/
|
||||
export const isBrowser = tspRuntime.isBrowser;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Bun.sh.
|
||||
*/
|
||||
export const isBun = tspRuntime.isBun;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Deno.
|
||||
*/
|
||||
export const isDeno = tspRuntime.isDeno;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use `isNodeLike` instead.
|
||||
*/
|
||||
export const isNode = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
||||
*/
|
||||
export const isNodeLike = tspRuntime.isNodeLike;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
export const isNodeRuntime = tspRuntime.isNodeRuntime;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is in React-Native.
|
||||
*/
|
||||
export const isReactNative = tspRuntime.isReactNative;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is a Web Worker.
|
||||
*/
|
||||
export const isWebWorker = tspRuntime.isWebWorker;
|
||||
/**
|
||||
* The helper that transforms bytes with specific character encoding into string
|
||||
* @param bytes - the uint8array bytes
|
||||
* @param format - the format we use to encode the byte
|
||||
* @returns a string of the encoded string
|
||||
*/
|
||||
export function uint8ArrayToString(bytes, format) {
|
||||
return tspRuntime.uint8ArrayToString(bytes, format);
|
||||
}
|
||||
/**
|
||||
* The helper that transforms string to specific character encoded bytes array.
|
||||
* @param value - the string to be converted
|
||||
* @param format - the format we use to decode the value
|
||||
* @returns a uint8array
|
||||
*/
|
||||
export function stringToUint8Array(value, format) {
|
||||
return tspRuntime.stringToUint8Array(value, format);
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@azure/core-util/dist/react-native/package.json
generated
vendored
Normal file
3
node_modules/@azure/core-util/dist/react-native/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
18
node_modules/@azure/core-util/dist/react-native/typeGuards.d.ts
generated
vendored
Normal file
18
node_modules/@azure/core-util/dist/react-native/typeGuards.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export declare function isDefined<T>(thing: T | undefined | null): thing is T;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export declare function isObjectWithProperties<Thing, PropertyName extends string>(thing: Thing, properties: PropertyName[]): thing is Thing & Record<PropertyName, unknown>;
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export declare function objectHasProperty<Thing, PropertyName extends string>(thing: Thing, property: PropertyName): thing is Thing & Record<PropertyName, unknown>;
|
||||
//# sourceMappingURL=typeGuards.d.ts.map
|
||||
34
node_modules/@azure/core-util/dist/react-native/typeGuards.js
generated
vendored
Normal file
34
node_modules/@azure/core-util/dist/react-native/typeGuards.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
export function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
export function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
export function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
//# sourceMappingURL=typeGuards.js.map
|
||||
1
node_modules/@azure/core-util/dist/react-native/typeGuards.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-util/dist/react-native/typeGuards.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,KAA2B;IACtD,OAAO,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAY,EACZ,UAA0B;IAE1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAY,EACZ,QAAsB;IAEtB,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAK,KAAiC,CAChG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Helper TypeGuard that checks if something is defined or not.\n * @param thing - Anything\n */\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return typeof thing !== \"undefined\" && thing !== null;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified properties.\n * @param thing - Anything.\n * @param properties - The name of the properties that should appear in the object.\n */\nexport function isObjectWithProperties<Thing, PropertyName extends string>(\n thing: Thing,\n properties: PropertyName[],\n): thing is Thing & Record<PropertyName, unknown> {\n if (!isDefined(thing) || typeof thing !== \"object\") {\n return false;\n }\n\n for (const property of properties) {\n if (!objectHasProperty(thing, property)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Helper TypeGuard that checks if the input is an object with the specified property.\n * @param thing - Any object.\n * @param property - The name of the property that should appear in the object.\n */\nexport function objectHasProperty<Thing, PropertyName extends string>(\n thing: Thing,\n property: PropertyName,\n): thing is Thing & Record<PropertyName, unknown> {\n return (\n isDefined(thing) && typeof thing === \"object\" && property in (thing as Record<string, unknown>)\n );\n}\n"]}
|
||||
107
node_modules/@azure/core-util/package.json
generated
vendored
Normal file
107
node_modules/@azure/core-util/package.json
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"name": "@azure/core-util",
|
||||
"version": "1.13.1",
|
||||
"description": "Core library for shared utility methods",
|
||||
"sdk-type": "client",
|
||||
"type": "module",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"browser": "./dist/browser/index.js",
|
||||
"react-native": "./dist/react-native/index.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"browser": {
|
||||
"types": "./dist/browser/index.d.ts",
|
||||
"default": "./dist/browser/index.js"
|
||||
},
|
||||
"react-native": {
|
||||
"types": "./dist/react-native/index.d.ts",
|
||||
"default": "./dist/react-native/index.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"!dist/**/*.d.*ts.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"repository": "github:Azure/azure-sdk-for-js",
|
||||
"keywords": [
|
||||
"azure",
|
||||
"cloud"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/",
|
||||
"sideEffects": false,
|
||||
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^2.1.2",
|
||||
"@typespec/ts-http-runtime": "^0.3.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.19.0",
|
||||
"@vitest/browser": "^3.2.3",
|
||||
"@vitest/coverage-istanbul": "^3.2.3",
|
||||
"eslint": "^9.33.0",
|
||||
"playwright": "^1.50.1",
|
||||
"typescript": "~5.8.3",
|
||||
"vitest": "^3.2.3",
|
||||
"@azure-tools/vite-plugin-browser-test-map": "^1.0.0",
|
||||
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
||||
"@azure/dev-tool": "^1.0.0"
|
||||
},
|
||||
"//metadata": {
|
||||
"migrationDate": "2023-03-08T18:36:03.000Z"
|
||||
},
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"dialects": [
|
||||
"esm",
|
||||
"commonjs"
|
||||
],
|
||||
"esmDialects": [
|
||||
"browser",
|
||||
"react-native"
|
||||
],
|
||||
"selfLink": false,
|
||||
"project": "../../../tsconfig.src.build.json"
|
||||
},
|
||||
"module": "./dist/esm/index.js",
|
||||
"scripts": {
|
||||
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
||||
"build:samples": "echo Skipped.",
|
||||
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
||||
"clean": "rimraf --glob dist dist-* temp *.tgz *.log",
|
||||
"execute:samples": "echo skipped",
|
||||
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
||||
"lint": "eslint package.json src test",
|
||||
"lint:fix": "eslint package.json src test --fix --fix-type [problem,suggestion]",
|
||||
"pack": "pnpm pack 2>&1",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --no-test-proxy --browser",
|
||||
"test:node": "dev-tool run build-test --no-browser-test && dev-tool run test:vitest --no-test-proxy",
|
||||
"update-snippets": "dev-tool run update-snippets"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user