Commit iniziale

This commit is contained in:
Paolo A
2025-02-18 22:59:07 +00:00
commit 4bbf35cefb
6879 changed files with 623784 additions and 0 deletions

21
node_modules/@azure/core-util/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2020 Microsoft
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.

40
node_modules/@azure/core-util/README.md generated vendored Normal file
View File

@@ -0,0 +1,40 @@
# 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.
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcore%2Fcore-util%2FREADME.png)

View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"aborterUtils.d.ts","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;IACtD,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjB;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,SAAS,OAAO,EAAE,EAC7D,wBAAwB,EAAE,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAC9D,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,eAAe,CAAA;CAAE,GAC1C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAcpB"}

View File

@@ -0,0 +1,21 @@
// 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) {
var _a, _b;
const aborter = new AbortController();
function abortHandler() {
aborter.abort();
}
(_a = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", abortHandler);
try {
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
}
finally {
aborter.abort();
(_b = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _b === void 0 ? void 0 : _b.removeEventListener("abort", abortHandler);
}
}
//# sourceMappingURL=aborterUtils.js.map

View 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,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,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,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,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"]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding-browser.d.mts","sourceRoot":"","sources":["../../src/bytesEncoding-browser.mts"],"names":[],"mappings":"AAGA,cAAc,2BAA2B,CAAC"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding-browser.mjs","sourceRoot":"","sources":["../../src/bytesEncoding-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./bytesEncoding.common.js\";\n"]}

View File

@@ -0,0 +1,61 @@
declare global {
function btoa(input: string): string;
function atob(input: string): string;
}
/** 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;
/**
* Decodes a Uint8Array into a Base64 string.
* @internal
*/
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a Base64Url string.
* @internal
*/
export declare function uint8ArrayToBase64Url(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a javascript string.
* @internal
*/
export declare function uint8ArrayToUtf8String(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a hex string
* @internal
*/
export declare function uint8ArrayToHexString(bytes: Uint8Array): string;
/**
* Encodes a JavaScript string into a Uint8Array.
* @internal
*/
export declare function utf8StringToUint8Array(value: string): Uint8Array;
/**
* Encodes a Base64 string into a Uint8Array.
* @internal
*/
export declare function base64ToUint8Array(value: string): Uint8Array;
/**
* Encodes a Base64Url string into a Uint8Array.
* @internal
*/
export declare function base64UrlToUint8Array(value: string): Uint8Array;
/**
* Encodes a hex string into a Uint8Array
* @internal
*/
export declare function hexStringToUint8Array(value: string): Uint8Array;
//# sourceMappingURL=bytesEncoding.common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding.common.d.ts","sourceRoot":"","sources":["../../src/bytesEncoding.common.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IAEb,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAWlF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAWlF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAG/D;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAe/D"}

View File

@@ -0,0 +1,110 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* 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) {
switch (format) {
case "utf-8":
return uint8ArrayToUtf8String(bytes);
case "base64":
return uint8ArrayToBase64(bytes);
case "base64url":
return uint8ArrayToBase64Url(bytes);
case "hex":
return uint8ArrayToHexString(bytes);
}
}
/**
* 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) {
switch (format) {
case "utf-8":
return utf8StringToUint8Array(value);
case "base64":
return base64ToUint8Array(value);
case "base64url":
return base64UrlToUint8Array(value);
case "hex":
return hexStringToUint8Array(value);
}
}
/**
* Decodes a Uint8Array into a Base64 string.
* @internal
*/
export function uint8ArrayToBase64(bytes) {
return btoa([...bytes].map((x) => String.fromCharCode(x)).join(""));
}
/**
* Decodes a Uint8Array into a Base64Url string.
* @internal
*/
export function uint8ArrayToBase64Url(bytes) {
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
}
/**
* Decodes a Uint8Array into a javascript string.
* @internal
*/
export function uint8ArrayToUtf8String(bytes) {
const decoder = new TextDecoder();
const dataString = decoder.decode(bytes);
return dataString;
}
/**
* Decodes a Uint8Array into a hex string
* @internal
*/
export function uint8ArrayToHexString(bytes) {
return [...bytes].map((x) => x.toString(16).padStart(2, "0")).join("");
}
/**
* Encodes a JavaScript string into a Uint8Array.
* @internal
*/
export function utf8StringToUint8Array(value) {
return new TextEncoder().encode(value);
}
/**
* Encodes a Base64 string into a Uint8Array.
* @internal
*/
export function base64ToUint8Array(value) {
return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));
}
/**
* Encodes a Base64Url string into a Uint8Array.
* @internal
*/
export function base64UrlToUint8Array(value) {
const base64String = value.replace(/-/g, "+").replace(/_/g, "/");
return base64ToUint8Array(base64String);
}
const hexDigits = new Set("0123456789abcdefABCDEF");
/**
* Encodes a hex string into a Uint8Array
* @internal
*/
export function hexStringToUint8Array(value) {
// If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior
const bytes = new Uint8Array(value.length / 2);
for (let i = 0; i < value.length / 2; ++i) {
const highNibble = value[2 * i];
const lowNibble = value[2 * i + 1];
if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {
// Replicate Node Buffer behavior by exiting early when we encounter an invalid byte
return bytes.slice(0, i);
}
bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);
}
return bytes;
}
//# sourceMappingURL=bytesEncoding.common.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
export * from "./bytesEncoding.common.js";
//# sourceMappingURL=bytesEncoding-browser.d.mts.map

View File

@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export * from "./bytesEncoding.common.js";
//# sourceMappingURL=bytesEncoding-browser.mjs.map

View File

@@ -0,0 +1,34 @@
/**
* 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 a Web Worker.
*/
export declare const isWebWorker: 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 Bun.sh.
*/
export declare const isBun: 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 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 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;
//# sourceMappingURL=checkEnvironment.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkEnvironment.d.ts","sourceRoot":"","sources":["../../src/checkEnvironment.ts"],"names":[],"mappings":"AAoCA;;GAEG;AAEH,eAAO,MAAM,SAAS,SAA0E,CAAC;AAEjG;;GAEG;AACH,eAAO,MAAM,WAAW,SAKiC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,MAAM,SAGuB,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,KAAK,SAAmE,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,UAAU,SAGqB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,MAAM,SAAa,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,aAAa,SAAkC,CAAC;AAE7D;;GAEG;AAEH,eAAO,MAAM,aAAa,SACgD,CAAC"}

View File

@@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var _a, _b, _c, _d;
/**
* A constant that indicates whether the environment the code is running is a Web Browser.
*/
// eslint-disable-next-line @azure/azure-sdk/ts-no-window
export const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
/**
* A constant that indicates whether the environment the code is running is a Web Worker.
*/
export const isWebWorker = typeof self === "object" &&
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
(((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
/**
* A constant that indicates whether the environment the code is running is Deno.
*/
export const isDeno = typeof Deno !== "undefined" &&
typeof Deno.version !== "undefined" &&
typeof Deno.version.deno !== "undefined";
/**
* A constant that indicates whether the environment the code is running is Bun.sh.
*/
export const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
/**
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
*/
export const isNodeLike = typeof globalThis.process !== "undefined" &&
Boolean(globalThis.process.version) &&
Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
/**
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
* @deprecated Use `isNodeLike` instead.
*/
export const isNode = isNodeLike;
/**
* A constant that indicates whether the environment the code is running is Node.JS.
*/
export const isNodeRuntime = isNodeLike && !isBun && !isDeno;
/**
* A constant that indicates whether the environment the code is running is in React-Native.
*/
// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
export const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
//# sourceMappingURL=checkEnvironment.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkEnvironment.js","sourceRoot":"","sources":["../../src/checkEnvironment.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAmClC;;GAEG;AACH,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAEjG;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,OAAO,IAAI,KAAK,QAAQ;IACxB,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,CAAA,KAAK,UAAU;IACzC,CAAC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,4BAA4B;QACtD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,0BAA0B;QACrD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,yBAAyB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,OAAO,IAAI,KAAK,WAAW;IAC3B,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,WAAW,CAAC;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,OAAO,UAAU,CAAC,OAAO,KAAK,WAAW;IACzC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,OAAO,CAAC,MAAA,UAAU,CAAC,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC;AAE7D;;GAEG;AACH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,aAAa,GACxB,OAAO,SAAS,KAAK,WAAW,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAK,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ninterface Window {\n document: unknown;\n}\n\ninterface DedicatedWorkerGlobalScope {\n constructor: {\n name: string;\n };\n\n importScripts: (...paths: string[]) => void;\n}\n\ninterface Navigator {\n product: string;\n}\n\ninterface DenoGlobal {\n version: {\n deno: string;\n };\n}\n\ninterface BunGlobal {\n version: string;\n}\n\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\ndeclare const window: Window;\ndeclare const self: DedicatedWorkerGlobalScope;\ndeclare const Deno: DenoGlobal;\ndeclare const Bun: BunGlobal;\ndeclare const navigator: Navigator;\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\nexport const isWebWorker =\n typeof self === \"object\" &&\n typeof self?.importScripts === \"function\" &&\n (self.constructor?.name === \"DedicatedWorkerGlobalScope\" ||\n self.constructor?.name === \"ServiceWorkerGlobalScope\" ||\n self.constructor?.name === \"SharedWorkerGlobalScope\");\n\n/**\n * A constant that indicates whether the environment the code is running is Deno.\n */\nexport const isDeno =\n typeof Deno !== \"undefined\" &&\n typeof Deno.version !== \"undefined\" &&\n typeof Deno.version.deno !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\nexport const isBun = typeof Bun !== \"undefined\" && typeof Bun.version !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n */\nexport const isNodeLike =\n typeof globalThis.process !== \"undefined\" &&\n Boolean(globalThis.process.version) &&\n Boolean(globalThis.process.versions?.node);\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n * @deprecated Use `isNodeLike` instead.\n */\nexport const isNode = isNodeLike;\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNodeRuntime = isNodeLike && !isBun && !isDeno;\n\n/**\n * A constant that indicates whether the environment the code is running is in React-Native.\n */\n// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js\nexport const isReactNative =\n typeof navigator !== \"undefined\" && navigator?.product === \"ReactNative\";\n"]}

View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"createAbortablePromise.d.ts","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IACjE,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,YAAY,EAAE,CACZ,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC3B,IAAI,EACT,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,CAAC,CAAC,CAiCZ"}

View 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 !== null && options !== void 0 ? options : {};
return new Promise((resolve, reject) => {
function rejectOnAbort() {
reject(new AbortError(abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : "The operation was aborted."));
}
function removeListeners() {
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener("abort", onAbort);
}
function onAbort() {
cleanupBeforeAbort === null || cleanupBeforeAbort === void 0 ? void 0 : cleanupBeforeAbort();
removeListeners();
rejectOnAbort();
}
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
return rejectOnAbort();
}
try {
buildPromise((x) => {
removeListeners();
resolve(x);
}, (x) => {
removeListeners();
reject(x);
});
}
catch (err) {
reject(err);
}
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort);
});
}
//# sourceMappingURL=createAbortablePromise.js.map

View 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,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,EAAI,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,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,aAAX,WAAW,uBAAX,WAAW,CAAE,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
View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY;CAAG;AAErD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAa7E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE;IACN,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GACA;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAY5B"}

39
node_modules/@azure/core-util/dist/browser/delay.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { createAbortablePromise } from "./createAbortablePromise.js";
import { getRandomIntegerInclusive } from "./random.js";
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 !== null && options !== void 0 ? options : {};
return createAbortablePromise((resolve) => {
token = setTimeout(resolve, timeInMs);
}, {
cleanupBeforeAbort: () => clearTimeout(token),
abortSignal,
abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? 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

View 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,aAAa,CAAC;AAExD,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,aAAP,OAAO,cAAP,OAAO,GAAI,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,aAAb,aAAa,cAAb,aAAa,GAAI,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 \"./random.js\";\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"]}

13
node_modules/@azure/core-util/dist/browser/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* 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;
/**
* 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAO9C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAgBlD"}

42
node_modules/@azure/core-util/dist/browser/error.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { isObject } from "./object.js";
/**
* Typeguard for an error object shape (has name and message)
* @param e - Something caught by a catch clause.
*/
export function isError(e) {
if (isObject(e)) {
const hasName = typeof e.name === "string";
const hasMessage = typeof e.message === "string";
return hasName && hasMessage;
}
return false;
}
/**
* 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;QAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC;QACjD,OAAO,OAAO,IAAI,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;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 { isObject } from \"./object.js\";\n\n/**\n * Typeguard for an error object shape (has name and message)\n * @param e - Something caught by a catch clause.\n */\nexport function isError(e: unknown): e is Error {\n if (isObject(e)) {\n const hasName = typeof e.name === \"string\";\n const hasMessage = typeof e.message === \"string\";\n return hasName && hasMessage;\n }\n return false;\n}\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"]}

View File

@@ -0,0 +1,6 @@
/**
* @public
* Supported HTTP methods to use when making requests.
*/
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
//# sourceMappingURL=httpMethods.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpMethods.d.ts","sourceRoot":"","sources":["../../src/httpMethods.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,KAAK,GACL,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,OAAO,CAAC"}

View File

@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export {};
//# sourceMappingURL=httpMethods.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpMethods.js","sourceRoot":"","sources":["../../src/httpMethods.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @public\n * Supported HTTP methods to use when making requests.\n */\nexport type HttpMethods =\n | \"GET\"\n | \"PUT\"\n | \"POST\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"OPTIONS\"\n | \"TRACE\";\n"]}

13
node_modules/@azure/core-util/dist/browser/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
export { delay, type DelayOptions, calculateRetryDelay } from "./delay.js";
export { type AbortOptions, cancelablePromiseRace, type AbortablePromiseBuilder, } from "./aborterUtils.js";
export { createAbortablePromise, type CreateAbortablePromiseOptions, } from "./createAbortablePromise.js";
export { getRandomIntegerInclusive } from "./random.js";
export { isObject, type UnknownObject } from "./object.js";
export { isError, getErrorMessage } from "./error.js";
export { computeSha256Hash, computeSha256Hmac } from "./sha256.js";
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
export { randomUUID } from "./uuidUtils.js";
export { HttpMethods } from "./httpMethods.js";
export { isBrowser, isBun, isNode, isNodeLike, isNodeRuntime, isDeno, isReactNative, isWebWorker, } from "./checkEnvironment.js";
export { uint8ArrayToString, stringToUint8Array, type EncodingType } from "./bytesEncoding.js";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EACL,KAAK,YAAY,EACjB,qBAAqB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACb,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC"}

14
node_modules/@azure/core-util/dist/browser/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export { delay, calculateRetryDelay } from "./delay.js";
export { cancelablePromiseRace, } from "./aborterUtils.js";
export { createAbortablePromise, } from "./createAbortablePromise.js";
export { getRandomIntegerInclusive } from "./random.js";
export { isObject } from "./object.js";
export { isError, getErrorMessage } from "./error.js";
export { computeSha256Hash, computeSha256Hmac } from "./sha256.js";
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
export { randomUUID } from "./uuidUtils.js";
export { isBrowser, isBun, isNode, isNodeLike, isNodeRuntime, isDeno, isReactNative, isWebWorker, } from "./checkEnvironment.js";
export { uint8ArrayToString, stringToUint8Array } from "./bytesEncoding.js";
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAqB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAEL,qBAAqB,GAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACb,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { delay, type DelayOptions, calculateRetryDelay } from \"./delay.js\";\nexport {\n type AbortOptions,\n cancelablePromiseRace,\n type AbortablePromiseBuilder,\n} from \"./aborterUtils.js\";\nexport {\n createAbortablePromise,\n type CreateAbortablePromiseOptions,\n} from \"./createAbortablePromise.js\";\nexport { getRandomIntegerInclusive } from \"./random.js\";\nexport { isObject, type UnknownObject } from \"./object.js\";\nexport { isError, getErrorMessage } from \"./error.js\";\nexport { computeSha256Hash, computeSha256Hmac } from \"./sha256.js\";\nexport { isDefined, isObjectWithProperties, objectHasProperty } from \"./typeGuards.js\";\nexport { randomUUID } from \"./uuidUtils.js\";\nexport { HttpMethods } from \"./httpMethods.js\";\nexport {\n isBrowser,\n isBun,\n isNode,\n isNodeLike,\n isNodeRuntime,\n isDeno,\n isReactNative,\n isWebWorker,\n} from \"./checkEnvironment.js\";\nexport { uint8ArrayToString, stringToUint8Array, type EncodingType } from \"./bytesEncoding.js\";\n"]}

12
node_modules/@azure/core-util/dist/browser/object.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
* A generic shape for a plain JS object.
*/
export type UnknownObject = {
[s: string]: unknown;
};
/**
* 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;
//# sourceMappingURL=object.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/object.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAErD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQ/D"}

14
node_modules/@azure/core-util/dist/browser/object.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* 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 (typeof input === "object" &&
input !== null &&
!Array.isArray(input) &&
!(input instanceof RegExp) &&
!(input instanceof Date));
}
//# sourceMappingURL=object.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/object.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,CAAC,CAAC,KAAK,YAAY,MAAM,CAAC;QAC1B,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * A generic shape for a plain JS object.\n */\nexport type UnknownObject = { [s: string]: unknown };\n\n/**\n * Helper to determine when an input is a generic JS object.\n * @returns true when input is an object type that is not null, Array, RegExp, or Date.\n */\nexport function isObject(input: unknown): input is UnknownObject {\n return (\n typeof input === \"object\" &&\n input !== null &&\n !Array.isArray(input) &&\n !(input instanceof RegExp) &&\n !(input instanceof Date)\n );\n}\n"]}

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

10
node_modules/@azure/core-util/dist/browser/random.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* 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;
//# sourceMappingURL=random.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/random.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAS1E"}

21
node_modules/@azure/core-util/dist/browser/random.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* 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) {
// Make sure inputs are integers.
min = Math.ceil(min);
max = Math.floor(max);
// Pick a random offset from zero to the size of the range.
// Since Math.random() can never return 1, we have to make the range one larger
// in order to be inclusive of the maximum value after we take the floor.
const offset = Math.floor(Math.random() * (max - min + 1));
return offset + min;
}
//# sourceMappingURL=random.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/random.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAW,EAAE,GAAW;IAChE,iCAAiC;IACjC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,2DAA2D;IAC3D,+EAA+E;IAC/E,yEAAyE;IACzE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,MAAM,GAAG,GAAG,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Returns a random integer value between a lower and upper bound,\n * inclusive of both bounds.\n * Note that this uses Math.random and isn't secure. If you need to use\n * this for any kind of security purpose, find a better source of random.\n * @param min - The smallest integer value allowed.\n * @param max - The largest integer value allowed.\n */\nexport function getRandomIntegerInclusive(min: number, max: number): number {\n // Make sure inputs are integers.\n min = Math.ceil(min);\n max = Math.floor(max);\n // Pick a random offset from zero to the size of the range.\n // Since Math.random() can never return 1, we have to make the range one larger\n // in order to be inclusive of the maximum value after we take the floor.\n const offset = Math.floor(Math.random() * (max - min + 1));\n return offset + min;\n}\n"]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha256-browser.d.mts","sourceRoot":"","sources":["../../src/sha256-browser.mts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha256-browser.mjs","sourceRoot":"","sources":["../../src/sha256-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./sha256.common.js\";\n"]}

View File

@@ -0,0 +1,14 @@
/**
* 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>;
/**
* 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>;
//# sourceMappingURL=sha256.common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha256.common.d.ts","sourceRoot":"","sources":["../../src/sha256.common.ts"],"names":[],"mappings":"AAmEA;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,OAAO,CAAC,MAAM,CAAC,CAKjB"}

View File

@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { stringToUint8Array, uint8ArrayToString } from "./bytesEncoding.js";
let subtleCrypto;
/**
* Returns a cached reference to the Web API crypto.subtle object.
* @internal
*/
function getCrypto() {
if (subtleCrypto) {
return subtleCrypto;
}
if (!self.crypto || !self.crypto.subtle) {
throw new Error("Your browser environment does not support cryptography functions.");
}
subtleCrypto = self.crypto.subtle;
return subtleCrypto;
}
/**
* 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 async function computeSha256Hmac(key, stringToSign, encoding) {
const crypto = getCrypto();
const keyBytes = stringToUint8Array(key, "base64");
const stringToSignBytes = stringToUint8Array(stringToSign, "utf-8");
const cryptoKey = await crypto.importKey("raw", keyBytes, {
name: "HMAC",
hash: { name: "SHA-256" },
}, false, ["sign"]);
const signature = await crypto.sign({
name: "HMAC",
hash: { name: "SHA-256" },
}, cryptoKey, stringToSignBytes);
return uint8ArrayToString(new Uint8Array(signature), encoding);
}
/**
* 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 async function computeSha256Hash(content, encoding) {
const contentBytes = stringToUint8Array(content, "utf-8");
const digest = await getCrypto().digest({ name: "SHA-256" }, contentBytes);
return uint8ArrayToString(new Uint8Array(digest), encoding);
}
//# sourceMappingURL=sha256.common.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha256.common.js","sourceRoot":"","sources":["../../src/sha256.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA6C5E,IAAI,YAAsC,CAAC;AAE3C;;;GAGG;AACH,SAAS,SAAS;IAChB,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IAED,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAW,EACX,YAAoB,EACpB,QAA0B;IAE1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEpE,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CACtC,KAAK,EACL,QAAQ,EACR;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CACjC;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,SAAS,EACT,iBAAiB,CAClB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAe,EACf,QAA0B;IAE1B,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC,CAAC;IAE3E,OAAO,kBAAkB,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { stringToUint8Array, uint8ArrayToString } from \"./bytesEncoding.js\";\n\n// stubs for browser self.crypto\ninterface JsonWebKey {}\ninterface CryptoKey {}\ntype KeyUsage =\n | \"decrypt\"\n | \"deriveBits\"\n | \"deriveKey\"\n | \"encrypt\"\n | \"sign\"\n | \"unwrapKey\"\n | \"verify\"\n | \"wrapKey\";\ninterface Algorithm {\n name: string;\n}\ninterface SubtleCrypto {\n importKey(\n format: string,\n keyData: JsonWebKey,\n algorithm: HmacImportParams,\n extractable: boolean,\n usage: KeyUsage[],\n ): Promise<CryptoKey>;\n sign(\n algorithm: HmacImportParams,\n key: CryptoKey,\n data: ArrayBufferView | ArrayBuffer,\n ): Promise<ArrayBuffer>;\n digest(algorithm: Algorithm, data: ArrayBufferView | ArrayBuffer): Promise<ArrayBuffer>;\n}\ninterface Crypto {\n readonly subtle: SubtleCrypto;\n getRandomValues<T extends ArrayBufferView | null>(array: T): T;\n}\ndeclare const self: {\n crypto: Crypto;\n};\ninterface HmacImportParams {\n name: string;\n hash: Algorithm;\n length?: number;\n}\n\nlet subtleCrypto: SubtleCrypto | undefined;\n\n/**\n * Returns a cached reference to the Web API crypto.subtle object.\n * @internal\n */\nfunction getCrypto(): SubtleCrypto {\n if (subtleCrypto) {\n return subtleCrypto;\n }\n\n if (!self.crypto || !self.crypto.subtle) {\n throw new Error(\"Your browser environment does not support cryptography functions.\");\n }\n\n subtleCrypto = self.crypto.subtle;\n return subtleCrypto;\n}\n\n/**\n * Generates a SHA-256 HMAC signature.\n * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.\n * @param stringToSign - The data to be signed.\n * @param encoding - The textual encoding to use for the returned HMAC digest.\n */\nexport async function computeSha256Hmac(\n key: string,\n stringToSign: string,\n encoding: \"base64\" | \"hex\",\n): Promise<string> {\n const crypto = getCrypto();\n const keyBytes = stringToUint8Array(key, \"base64\");\n const stringToSignBytes = stringToUint8Array(stringToSign, \"utf-8\");\n\n const cryptoKey = await crypto.importKey(\n \"raw\",\n keyBytes,\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n const signature = await crypto.sign(\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n cryptoKey,\n stringToSignBytes,\n );\n\n return uint8ArrayToString(new Uint8Array(signature), encoding);\n}\n\n/**\n * Generates a SHA-256 hash.\n * @param content - The data to be included in the hash.\n * @param encoding - The textual encoding to use for the returned hash.\n */\nexport async function computeSha256Hash(\n content: string,\n encoding: \"base64\" | \"hex\",\n): Promise<string> {\n const contentBytes = stringToUint8Array(content, \"utf-8\");\n const digest = await getCrypto().digest({ name: \"SHA-256\" }, contentBytes);\n\n return uint8ArrayToString(new Uint8Array(digest), encoding);\n}\n"]}

View File

@@ -0,0 +1,2 @@
export * from "./sha256.common.js";
//# sourceMappingURL=sha256-browser.d.mts.map

4
node_modules/@azure/core-util/dist/browser/sha256.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export * from "./sha256.common.js";
//# sourceMappingURL=sha256-browser.mjs.map

View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["../../src/typeGuards.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,IAAI,CAAC,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,SAAS,MAAM,EACvE,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,YAAY,EAAE,GACzB,KAAK,IAAI,KAAK,GAAG,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAYhD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,SAAS,MAAM,EAClE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,GACrB,KAAK,IAAI,KAAK,GAAG,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAIhD"}

View 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

View 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"]}

View File

@@ -0,0 +1 @@
{"version":3,"file":"uuidUtils-browser.d.mts","sourceRoot":"","sources":["../../src/uuidUtils-browser.mts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"uuidUtils-browser.mjs","sourceRoot":"","sources":["../../src/uuidUtils-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAUrD,gEAAgE;AAChE,MAAM,YAAY,GAChB,OAAO,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,0CAAE,UAAU,CAAA,KAAK,UAAU;IAClD,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IACtD,CAAC,CAAC,YAAY,CAAC;AAEnB;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,YAAY,EAAE,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { generateUUID } from \"./uuidUtils.common.js\";\n\ninterface Crypto {\n randomUUID(): string;\n}\n\ndeclare const globalThis: {\n crypto: Crypto;\n};\n\n// NOTE: This could be undefined if not used in a secure context\nconst uuidFunction =\n typeof globalThis?.crypto?.randomUUID === \"function\"\n ? globalThis.crypto.randomUUID.bind(globalThis.crypto)\n : generateUUID;\n\n/**\n * Generated Universally Unique Identifier\n *\n * @returns RFC4122 v4 UUID.\n */\nexport function randomUUID(): string {\n return uuidFunction();\n}\n"]}

View File

@@ -0,0 +1,13 @@
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export declare function generateUUID(): string;
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export declare function randomUUID(): string;
//# sourceMappingURL=uuidUtils.common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"uuidUtils.common.d.ts","sourceRoot":"","sources":["../../src/uuidUtils.common.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAqBrC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}

View File

@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export function generateUUID() {
let uuid = "";
for (let i = 0; i < 32; i++) {
// Generate a random number between 0 and 15
const randomNumber = Math.floor(Math.random() * 16);
// Set the UUID version to 4 in the 13th position
if (i === 12) {
uuid += "4";
}
else if (i === 16) {
// Set the UUID variant to "10" in the 17th position
uuid += (randomNumber & 0x3) | 0x8;
}
else {
// Add a random hexadecimal digit to the UUID string
uuid += randomNumber.toString(16);
}
// Add hyphens to the UUID string at the appropriate positions
if (i === 7 || i === 11 || i === 15 || i === 19) {
uuid += "-";
}
}
return uuid;
}
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export function randomUUID() {
return generateUUID();
}
//# sourceMappingURL=uuidUtils.common.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"uuidUtils.common.js","sourceRoot":"","sources":["../../src/uuidUtils.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,4CAA4C;QAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACpD,iDAAiD;QACjD,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACb,IAAI,IAAI,GAAG,CAAC;QACd,CAAC;aAAM,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACpB,oDAAoD;YACpD,IAAI,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,oDAAoD;YACpD,IAAI,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;QACD,8DAA8D;QAC9D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YAChD,IAAI,IAAI,GAAG,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,YAAY,EAAE,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Generated Universally Unique Identifier\n *\n * @returns RFC4122 v4 UUID.\n */\nexport function generateUUID(): string {\n let uuid = \"\";\n for (let i = 0; i < 32; i++) {\n // Generate a random number between 0 and 15\n const randomNumber = Math.floor(Math.random() * 16);\n // Set the UUID version to 4 in the 13th position\n if (i === 12) {\n uuid += \"4\";\n } else if (i === 16) {\n // Set the UUID variant to \"10\" in the 17th position\n uuid += (randomNumber & 0x3) | 0x8;\n } else {\n // Add a random hexadecimal digit to the UUID string\n uuid += randomNumber.toString(16);\n }\n // Add hyphens to the UUID string at the appropriate positions\n if (i === 7 || i === 11 || i === 15 || i === 19) {\n uuid += \"-\";\n }\n }\n return uuid;\n}\n\n/**\n * Generated Universally Unique Identifier\n *\n * @returns RFC4122 v4 UUID.\n */\nexport function randomUUID(): string {\n return generateUUID();\n}\n"]}

View File

@@ -0,0 +1,7 @@
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export declare function randomUUID(): string;
//# sourceMappingURL=uuidUtils-browser.d.mts.map

View File

@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var _a;
import { generateUUID } from "./uuidUtils.common.js";
// NOTE: This could be undefined if not used in a secure context
const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
? globalThis.crypto.randomUUID.bind(globalThis.crypto)
: generateUUID;
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
export function randomUUID() {
return uuidFunction();
}
//# sourceMappingURL=uuidUtils-browser.mjs.map

View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"aborterUtils.d.ts","sourceRoot":"","sources":["../../src/aborterUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;IACtD,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjB;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,SAAS,OAAO,EAAE,EAC7D,wBAAwB,EAAE,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAC9D,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,eAAe,CAAA;CAAE,GAC1C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAcpB"}

View File

@@ -0,0 +1,24 @@
"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) {
var _a, _b;
const aborter = new AbortController();
function abortHandler() {
aborter.abort();
}
(_a = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", abortHandler);
try {
return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })));
}
finally {
aborter.abort();
(_b = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _b === void 0 ? void 0 : _b.removeEventListener("abort", abortHandler);
}
}
//# sourceMappingURL=aborterUtils.js.map

View 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,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,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,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,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"]}

View File

@@ -0,0 +1,61 @@
declare global {
function btoa(input: string): string;
function atob(input: string): string;
}
/** 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;
/**
* Decodes a Uint8Array into a Base64 string.
* @internal
*/
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a Base64Url string.
* @internal
*/
export declare function uint8ArrayToBase64Url(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a javascript string.
* @internal
*/
export declare function uint8ArrayToUtf8String(bytes: Uint8Array): string;
/**
* Decodes a Uint8Array into a hex string
* @internal
*/
export declare function uint8ArrayToHexString(bytes: Uint8Array): string;
/**
* Encodes a JavaScript string into a Uint8Array.
* @internal
*/
export declare function utf8StringToUint8Array(value: string): Uint8Array;
/**
* Encodes a Base64 string into a Uint8Array.
* @internal
*/
export declare function base64ToUint8Array(value: string): Uint8Array;
/**
* Encodes a Base64Url string into a Uint8Array.
* @internal
*/
export declare function base64UrlToUint8Array(value: string): Uint8Array;
/**
* Encodes a hex string into a Uint8Array
* @internal
*/
export declare function hexStringToUint8Array(value: string): Uint8Array;
//# sourceMappingURL=bytesEncoding.common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding.common.d.ts","sourceRoot":"","sources":["../../src/bytesEncoding.common.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IAEb,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAWlF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAWlF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAG/D;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAe/D"}

View File

@@ -0,0 +1,122 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.uint8ArrayToString = uint8ArrayToString;
exports.stringToUint8Array = stringToUint8Array;
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
exports.uint8ArrayToBase64Url = uint8ArrayToBase64Url;
exports.uint8ArrayToUtf8String = uint8ArrayToUtf8String;
exports.uint8ArrayToHexString = uint8ArrayToHexString;
exports.utf8StringToUint8Array = utf8StringToUint8Array;
exports.base64ToUint8Array = base64ToUint8Array;
exports.base64UrlToUint8Array = base64UrlToUint8Array;
exports.hexStringToUint8Array = hexStringToUint8Array;
/**
* 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) {
switch (format) {
case "utf-8":
return uint8ArrayToUtf8String(bytes);
case "base64":
return uint8ArrayToBase64(bytes);
case "base64url":
return uint8ArrayToBase64Url(bytes);
case "hex":
return uint8ArrayToHexString(bytes);
}
}
/**
* 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) {
switch (format) {
case "utf-8":
return utf8StringToUint8Array(value);
case "base64":
return base64ToUint8Array(value);
case "base64url":
return base64UrlToUint8Array(value);
case "hex":
return hexStringToUint8Array(value);
}
}
/**
* Decodes a Uint8Array into a Base64 string.
* @internal
*/
function uint8ArrayToBase64(bytes) {
return btoa([...bytes].map((x) => String.fromCharCode(x)).join(""));
}
/**
* Decodes a Uint8Array into a Base64Url string.
* @internal
*/
function uint8ArrayToBase64Url(bytes) {
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
}
/**
* Decodes a Uint8Array into a javascript string.
* @internal
*/
function uint8ArrayToUtf8String(bytes) {
const decoder = new TextDecoder();
const dataString = decoder.decode(bytes);
return dataString;
}
/**
* Decodes a Uint8Array into a hex string
* @internal
*/
function uint8ArrayToHexString(bytes) {
return [...bytes].map((x) => x.toString(16).padStart(2, "0")).join("");
}
/**
* Encodes a JavaScript string into a Uint8Array.
* @internal
*/
function utf8StringToUint8Array(value) {
return new TextEncoder().encode(value);
}
/**
* Encodes a Base64 string into a Uint8Array.
* @internal
*/
function base64ToUint8Array(value) {
return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));
}
/**
* Encodes a Base64Url string into a Uint8Array.
* @internal
*/
function base64UrlToUint8Array(value) {
const base64String = value.replace(/-/g, "+").replace(/_/g, "/");
return base64ToUint8Array(base64String);
}
const hexDigits = new Set("0123456789abcdefABCDEF");
/**
* Encodes a hex string into a Uint8Array
* @internal
*/
function hexStringToUint8Array(value) {
// If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior
const bytes = new Uint8Array(value.length / 2);
for (let i = 0; i < value.length / 2; ++i) {
const highNibble = value[2 * i];
const lowNibble = value[2 * i + 1];
if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {
// Replicate Node Buffer behavior by exiting early when we encounter an invalid byte
return bytes.slice(0, i);
}
bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);
}
return bytes;
}
//# sourceMappingURL=bytesEncoding.common.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/** 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=bytesEncoding.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding.d.ts","sourceRoot":"","sources":["../../src/bytesEncoding.ts"],"names":[],"mappings":"AAGA,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAElF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAElF"}

View File

@@ -0,0 +1,25 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.uint8ArrayToString = uint8ArrayToString;
exports.stringToUint8Array = stringToUint8Array;
/**
* 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 Buffer.from(bytes).toString(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 Buffer.from(value, format);
}
//# sourceMappingURL=bytesEncoding.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bytesEncoding.js","sourceRoot":"","sources":["../../src/bytesEncoding.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAWlC,gDAEC;AAQD,gDAEC;AAlBD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAa,EAAE,MAAoB;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n return Buffer.from(bytes).toString(format);\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n return Buffer.from(value, format);\n}\n"]}

View File

@@ -0,0 +1,34 @@
/**
* 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 a Web Worker.
*/
export declare const isWebWorker: 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 Bun.sh.
*/
export declare const isBun: 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 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 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;
//# sourceMappingURL=checkEnvironment.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkEnvironment.d.ts","sourceRoot":"","sources":["../../src/checkEnvironment.ts"],"names":[],"mappings":"AAoCA;;GAEG;AAEH,eAAO,MAAM,SAAS,SAA0E,CAAC;AAEjG;;GAEG;AACH,eAAO,MAAM,WAAW,SAKiC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,MAAM,SAGuB,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,KAAK,SAAmE,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,UAAU,SAGqB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,MAAM,SAAa,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,aAAa,SAAkC,CAAC;AAE7D;;GAEG;AAEH,eAAO,MAAM,aAAa,SACgD,CAAC"}

View File

@@ -0,0 +1,50 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var _a, _b, _c, _d;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isReactNative = exports.isNodeRuntime = exports.isNode = exports.isNodeLike = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0;
/**
* A constant that indicates whether the environment the code is running is a Web Browser.
*/
// eslint-disable-next-line @azure/azure-sdk/ts-no-window
exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
/**
* A constant that indicates whether the environment the code is running is a Web Worker.
*/
exports.isWebWorker = typeof self === "object" &&
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
(((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
/**
* A constant that indicates whether the environment the code is running is Deno.
*/
exports.isDeno = typeof Deno !== "undefined" &&
typeof Deno.version !== "undefined" &&
typeof Deno.version.deno !== "undefined";
/**
* A constant that indicates whether the environment the code is running is Bun.sh.
*/
exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
/**
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
*/
exports.isNodeLike = typeof globalThis.process !== "undefined" &&
Boolean(globalThis.process.version) &&
Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
/**
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
* @deprecated Use `isNodeLike` instead.
*/
exports.isNode = exports.isNodeLike;
/**
* A constant that indicates whether the environment the code is running is Node.JS.
*/
exports.isNodeRuntime = exports.isNodeLike && !exports.isBun && !exports.isDeno;
/**
* A constant that indicates whether the environment the code is running is in React-Native.
*/
// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
exports.isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
//# sourceMappingURL=checkEnvironment.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkEnvironment.js","sourceRoot":"","sources":["../../src/checkEnvironment.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAmClC;;GAEG;AACH,yDAAyD;AAC5C,QAAA,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAEjG;;GAEG;AACU,QAAA,WAAW,GACtB,OAAO,IAAI,KAAK,QAAQ;IACxB,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,CAAA,KAAK,UAAU;IACzC,CAAC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,4BAA4B;QACtD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,0BAA0B;QACrD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,yBAAyB,CAAC,CAAC;AAE1D;;GAEG;AACU,QAAA,MAAM,GACjB,OAAO,IAAI,KAAK,WAAW;IAC3B,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;AAE3C;;GAEG;AACU,QAAA,KAAK,GAAG,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,WAAW,CAAC;AAEtF;;GAEG;AACU,QAAA,UAAU,GACrB,OAAO,UAAU,CAAC,OAAO,KAAK,WAAW;IACzC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,OAAO,CAAC,MAAA,UAAU,CAAC,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;AAE7C;;;GAGG;AACU,QAAA,MAAM,GAAG,kBAAU,CAAC;AAEjC;;GAEG;AACU,QAAA,aAAa,GAAG,kBAAU,IAAI,CAAC,aAAK,IAAI,CAAC,cAAM,CAAC;AAE7D;;GAEG;AACH,4GAA4G;AAC/F,QAAA,aAAa,GACxB,OAAO,SAAS,KAAK,WAAW,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAK,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ninterface Window {\n document: unknown;\n}\n\ninterface DedicatedWorkerGlobalScope {\n constructor: {\n name: string;\n };\n\n importScripts: (...paths: string[]) => void;\n}\n\ninterface Navigator {\n product: string;\n}\n\ninterface DenoGlobal {\n version: {\n deno: string;\n };\n}\n\ninterface BunGlobal {\n version: string;\n}\n\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\ndeclare const window: Window;\ndeclare const self: DedicatedWorkerGlobalScope;\ndeclare const Deno: DenoGlobal;\ndeclare const Bun: BunGlobal;\ndeclare const navigator: Navigator;\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\nexport const isWebWorker =\n typeof self === \"object\" &&\n typeof self?.importScripts === \"function\" &&\n (self.constructor?.name === \"DedicatedWorkerGlobalScope\" ||\n self.constructor?.name === \"ServiceWorkerGlobalScope\" ||\n self.constructor?.name === \"SharedWorkerGlobalScope\");\n\n/**\n * A constant that indicates whether the environment the code is running is Deno.\n */\nexport const isDeno =\n typeof Deno !== \"undefined\" &&\n typeof Deno.version !== \"undefined\" &&\n typeof Deno.version.deno !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\nexport const isBun = typeof Bun !== \"undefined\" && typeof Bun.version !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n */\nexport const isNodeLike =\n typeof globalThis.process !== \"undefined\" &&\n Boolean(globalThis.process.version) &&\n Boolean(globalThis.process.versions?.node);\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n * @deprecated Use `isNodeLike` instead.\n */\nexport const isNode = isNodeLike;\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNodeRuntime = isNodeLike && !isBun && !isDeno;\n\n/**\n * A constant that indicates whether the environment the code is running is in React-Native.\n */\n// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js\nexport const isReactNative =\n typeof navigator !== \"undefined\" && navigator?.product === \"ReactNative\";\n"]}

View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"createAbortablePromise.d.ts","sourceRoot":"","sources":["../../src/createAbortablePromise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IACjE,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,YAAY,EAAE,CACZ,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC3B,IAAI,EACT,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,CAAC,CAAC,CAiCZ"}

View 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 !== null && options !== void 0 ? options : {};
return new Promise((resolve, reject) => {
function rejectOnAbort() {
reject(new abort_controller_1.AbortError(abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : "The operation was aborted."));
}
function removeListeners() {
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener("abort", onAbort);
}
function onAbort() {
cleanupBeforeAbort === null || cleanupBeforeAbort === void 0 ? void 0 : cleanupBeforeAbort();
removeListeners();
rejectOnAbort();
}
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
return rejectOnAbort();
}
try {
buildPromise((x) => {
removeListeners();
resolve(x);
}, (x) => {
removeListeners();
reject(x);
});
}
catch (err) {
reject(err);
}
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort);
});
}
//# sourceMappingURL=createAbortablePromise.js.map

View 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,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,aAAa;YACpB,MAAM,CAAC,IAAI,6BAAU,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,4BAA4B,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,SAAS,eAAe;YACtB,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,OAAO;YACd,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,EAAI,CAAC;YACvB,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,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,aAAX,WAAW,uBAAX,WAAW,CAAE,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
View 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,YAAY;CAAG;AAErD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAa7E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE;IACN,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GACA;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAY5B"}

43
node_modules/@azure/core-util/dist/commonjs/delay.js generated vendored Normal file
View 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 random_js_1 = require("./random.js");
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 !== null && options !== void 0 ? options : {};
return (0, createAbortablePromise_js_1.createAbortablePromise)((resolve) => {
token = setTimeout(resolve, timeInMs);
}, {
cleanupBeforeAbort: () => clearTimeout(token),
abortSignal,
abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? 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, random_js_1.getRandomIntegerInclusive)(0, clampedDelay / 2);
return { retryAfterInMs };
}
//# sourceMappingURL=delay.js.map

View 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,2CAAwD;AAExD,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,aAAP,OAAO,cAAP,OAAO,GAAI,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,aAAb,aAAa,cAAb,aAAa,GAAI,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,qCAAyB,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 \"./random.js\";\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"]}

13
node_modules/@azure/core-util/dist/commonjs/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* 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;
/**
* 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

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAO9C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAgBlD"}

46
node_modules/@azure/core-util/dist/commonjs/error.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.isError = isError;
exports.getErrorMessage = getErrorMessage;
const object_js_1 = require("./object.js");
/**
* Typeguard for an error object shape (has name and message)
* @param e - Something caught by a catch clause.
*/
function isError(e) {
if ((0, object_js_1.isObject)(e)) {
const hasName = typeof e.name === "string";
const hasMessage = typeof e.message === "string";
return hasName && hasMessage;
}
return false;
}
/**
* 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 (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

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAQlC,0BAOC;AAQD,0CAgBC;AArCD,2CAAuC;AAEvC;;;GAGG;AACH,SAAgB,OAAO,CAAC,CAAU;IAChC,IAAI,IAAA,oBAAQ,EAAC,CAAC,CAAC,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;QAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC;QACjD,OAAO,OAAO,IAAI,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAgB,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 { isObject } from \"./object.js\";\n\n/**\n * Typeguard for an error object shape (has name and message)\n * @param e - Something caught by a catch clause.\n */\nexport function isError(e: unknown): e is Error {\n if (isObject(e)) {\n const hasName = typeof e.name === \"string\";\n const hasMessage = typeof e.message === \"string\";\n return hasName && hasMessage;\n }\n return false;\n}\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"]}

View File

@@ -0,0 +1,6 @@
/**
* @public
* Supported HTTP methods to use when making requests.
*/
export type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
//# sourceMappingURL=httpMethods.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpMethods.d.ts","sourceRoot":"","sources":["../../src/httpMethods.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,KAAK,GACL,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,OAAO,CAAC"}

View File

@@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=httpMethods.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpMethods.js","sourceRoot":"","sources":["../../src/httpMethods.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @public\n * Supported HTTP methods to use when making requests.\n */\nexport type HttpMethods =\n | \"GET\"\n | \"PUT\"\n | \"POST\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"OPTIONS\"\n | \"TRACE\";\n"]}

13
node_modules/@azure/core-util/dist/commonjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
export { delay, type DelayOptions, calculateRetryDelay } from "./delay.js";
export { type AbortOptions, cancelablePromiseRace, type AbortablePromiseBuilder, } from "./aborterUtils.js";
export { createAbortablePromise, type CreateAbortablePromiseOptions, } from "./createAbortablePromise.js";
export { getRandomIntegerInclusive } from "./random.js";
export { isObject, type UnknownObject } from "./object.js";
export { isError, getErrorMessage } from "./error.js";
export { computeSha256Hash, computeSha256Hmac } from "./sha256.js";
export { isDefined, isObjectWithProperties, objectHasProperty } from "./typeGuards.js";
export { randomUUID } from "./uuidUtils.js";
export { HttpMethods } from "./httpMethods.js";
export { isBrowser, isBun, isNode, isNodeLike, isNodeRuntime, isDeno, isReactNative, isWebWorker, } from "./checkEnvironment.js";
export { uint8ArrayToString, stringToUint8Array, type EncodingType } from "./bytesEncoding.js";
//# sourceMappingURL=index.d.ts.map

Some files were not shown because too many files have changed in this diff Show More