@typespec/ts-http-runtime 1.0.0-alpha.20240701.3 → 1.0.0-alpha.20240705.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client/common.d.ts +0 -1
- package/dist/browser/client/common.d.ts.map +1 -1
- package/dist/browser/interfaces.d.ts +0 -2
- package/dist/browser/interfaces.d.ts.map +1 -1
- package/dist/browser/util/concat.common.d.ts +0 -1
- package/dist/browser/util/concat.common.d.ts.map +1 -1
- package/dist/browser/util/file.d.ts +0 -1
- package/dist/browser/util/file.d.ts.map +1 -1
- package/dist/browser/util/typeGuards.d.ts +0 -1
- package/dist/browser/util/typeGuards.d.ts.map +1 -1
- package/dist/commonjs/auth/keyCredential.js +1 -2
- package/dist/commonjs/auth/keyCredential.js.map +1 -1
- package/dist/commonjs/auth/tokenCredential.js +1 -2
- package/dist/commonjs/auth/tokenCredential.js.map +1 -1
- package/dist/commonjs/client/apiVersionPolicy.js +2 -2
- package/dist/commonjs/client/apiVersionPolicy.js.map +1 -1
- package/dist/commonjs/client/clientHelpers.js +3 -4
- package/dist/commonjs/client/clientHelpers.js.map +1 -1
- package/dist/commonjs/client/common.d.ts +0 -1
- package/dist/commonjs/client/common.d.ts.map +1 -1
- package/dist/commonjs/client/getClient.js +1 -2
- package/dist/commonjs/client/getClient.js.map +1 -1
- package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js +2 -2
- package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/client/multipart.js +2 -3
- package/dist/commonjs/client/multipart.js.map +1 -1
- package/dist/commonjs/client/operationOptionHelpers.js +1 -2
- package/dist/commonjs/client/operationOptionHelpers.js.map +1 -1
- package/dist/commonjs/client/restError.js +1 -2
- package/dist/commonjs/client/restError.js.map +1 -1
- package/dist/commonjs/client/sendRequest.js +1 -2
- package/dist/commonjs/client/sendRequest.js.map +1 -1
- package/dist/commonjs/client/urlHelpers.js +3 -4
- package/dist/commonjs/client/urlHelpers.js.map +1 -1
- package/dist/commonjs/createPipelineFromOptions.js +1 -2
- package/dist/commonjs/createPipelineFromOptions.js.map +1 -1
- package/dist/commonjs/defaultHttpClient.js +1 -2
- package/dist/commonjs/defaultHttpClient.js.map +1 -1
- package/dist/commonjs/fetchHttpClient.js +1 -2
- package/dist/commonjs/fetchHttpClient.js.map +1 -1
- package/dist/commonjs/httpHeaders.js +1 -2
- package/dist/commonjs/httpHeaders.js.map +1 -1
- package/dist/commonjs/interfaces.d.ts +0 -2
- package/dist/commonjs/interfaces.d.ts.map +1 -1
- package/dist/commonjs/logger/log.common.js +1 -2
- package/dist/commonjs/logger/log.common.js.map +1 -1
- package/dist/commonjs/logger/log.js +1 -2
- package/dist/commonjs/logger/log.js.map +1 -1
- package/dist/commonjs/logger/logger.js +4 -4
- package/dist/commonjs/logger/logger.js.map +1 -1
- package/dist/commonjs/nodeHttpClient.js +2 -3
- package/dist/commonjs/nodeHttpClient.js.map +1 -1
- package/dist/commonjs/pipeline.js +1 -2
- package/dist/commonjs/pipeline.js.map +1 -1
- package/dist/commonjs/pipelineRequest.js +1 -2
- package/dist/commonjs/pipelineRequest.js.map +1 -1
- package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js +2 -2
- package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/policies/decompressResponsePolicy.js +2 -2
- package/dist/commonjs/policies/decompressResponsePolicy.js.map +1 -1
- package/dist/commonjs/policies/defaultRetryPolicy.js +2 -2
- package/dist/commonjs/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/exponentialRetryPolicy.js +2 -2
- package/dist/commonjs/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/formDataPolicy.js +2 -2
- package/dist/commonjs/policies/formDataPolicy.js.map +1 -1
- package/dist/commonjs/policies/logPolicy.js +2 -2
- package/dist/commonjs/policies/logPolicy.js.map +1 -1
- package/dist/commonjs/policies/multipartPolicy.js +2 -2
- package/dist/commonjs/policies/multipartPolicy.js.map +1 -1
- package/dist/commonjs/policies/proxyPolicy.common.js +4 -4
- package/dist/commonjs/policies/proxyPolicy.common.js.map +1 -1
- package/dist/commonjs/policies/proxyPolicy.js +4 -4
- package/dist/commonjs/policies/proxyPolicy.js.map +1 -1
- package/dist/commonjs/policies/redirectPolicy.js +2 -2
- package/dist/commonjs/policies/redirectPolicy.js.map +1 -1
- package/dist/commonjs/policies/retryPolicy.js +1 -2
- package/dist/commonjs/policies/retryPolicy.js.map +1 -1
- package/dist/commonjs/policies/systemErrorRetryPolicy.js +2 -2
- package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/throttlingRetryPolicy.js +2 -2
- package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/tlsPolicy.js +2 -2
- package/dist/commonjs/policies/tlsPolicy.js.map +1 -1
- package/dist/commonjs/policies/tracingPolicy.js +2 -2
- package/dist/commonjs/policies/tracingPolicy.js.map +1 -1
- package/dist/commonjs/policies/userAgentPolicy.js +2 -2
- package/dist/commonjs/policies/userAgentPolicy.js.map +1 -1
- package/dist/commonjs/restError.js +2 -2
- package/dist/commonjs/restError.js.map +1 -1
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +3 -4
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +1 -1
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +2 -3
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +1 -1
- package/dist/commonjs/tracing/instrumenter.js +4 -5
- package/dist/commonjs/tracing/instrumenter.js.map +1 -1
- package/dist/commonjs/tracing/tracingClient.js +1 -2
- package/dist/commonjs/tracing/tracingClient.js.map +1 -1
- package/dist/commonjs/tracing/tracingContext.js +2 -2
- package/dist/commonjs/tracing/tracingContext.js.map +1 -1
- package/dist/commonjs/util/aborterUtils.js +1 -2
- package/dist/commonjs/util/aborterUtils.js.map +1 -1
- package/dist/commonjs/util/bytesEncoding.common.js +10 -11
- package/dist/commonjs/util/bytesEncoding.common.js.map +1 -1
- package/dist/commonjs/util/bytesEncoding.js +2 -3
- package/dist/commonjs/util/bytesEncoding.js.map +1 -1
- package/dist/commonjs/util/concat.common.d.ts +0 -1
- package/dist/commonjs/util/concat.common.d.ts.map +1 -1
- package/dist/commonjs/util/concat.common.js +1 -2
- package/dist/commonjs/util/concat.common.js.map +1 -1
- package/dist/commonjs/util/concat.d.ts +0 -1
- package/dist/commonjs/util/concat.d.ts.map +1 -1
- package/dist/commonjs/util/concat.js +1 -2
- package/dist/commonjs/util/concat.js.map +1 -1
- package/dist/commonjs/util/createAbortablePromise.js +1 -2
- package/dist/commonjs/util/createAbortablePromise.js.map +1 -1
- package/dist/commonjs/util/delay.js +1 -2
- package/dist/commonjs/util/delay.js.map +1 -1
- package/dist/commonjs/util/error.js +2 -3
- package/dist/commonjs/util/error.js.map +1 -1
- package/dist/commonjs/util/file.d.ts +0 -1
- package/dist/commonjs/util/file.d.ts.map +1 -1
- package/dist/commonjs/util/file.js +3 -4
- package/dist/commonjs/util/file.js.map +1 -1
- package/dist/commonjs/util/helpers.js +2 -3
- package/dist/commonjs/util/helpers.js.map +1 -1
- package/dist/commonjs/util/object.js +1 -2
- package/dist/commonjs/util/object.js.map +1 -1
- package/dist/commonjs/util/random.js +1 -2
- package/dist/commonjs/util/random.js.map +1 -1
- package/dist/commonjs/util/sha256.common.js +2 -3
- package/dist/commonjs/util/sha256.common.js.map +1 -1
- package/dist/commonjs/util/sha256.js +2 -3
- package/dist/commonjs/util/sha256.js.map +1 -1
- package/dist/commonjs/util/tokenCycler.js +2 -2
- package/dist/commonjs/util/tokenCycler.js.map +1 -1
- package/dist/commonjs/util/typeGuards.d.ts +0 -1
- package/dist/commonjs/util/typeGuards.d.ts.map +1 -1
- package/dist/commonjs/util/typeGuards.js +8 -9
- package/dist/commonjs/util/typeGuards.js.map +1 -1
- package/dist/commonjs/util/userAgent.js +2 -3
- package/dist/commonjs/util/userAgent.js.map +1 -1
- package/dist/commonjs/util/userAgentPlatform.js +2 -3
- package/dist/commonjs/util/userAgentPlatform.js.map +1 -1
- package/dist/commonjs/util/uuidUtils.common.js +2 -3
- package/dist/commonjs/util/uuidUtils.common.js.map +1 -1
- package/dist/commonjs/util/uuidUtils.js +1 -2
- package/dist/commonjs/util/uuidUtils.js.map +1 -1
- package/dist/commonjs/xhrHttpClient.js +1 -2
- package/dist/commonjs/xhrHttpClient.js.map +1 -1
- package/dist/esm/client/common.d.ts +0 -1
- package/dist/esm/client/common.d.ts.map +1 -1
- package/dist/esm/interfaces.d.ts +0 -2
- package/dist/esm/interfaces.d.ts.map +1 -1
- package/dist/esm/util/concat.common.d.ts +0 -1
- package/dist/esm/util/concat.common.d.ts.map +1 -1
- package/dist/esm/util/concat.d.ts +0 -1
- package/dist/esm/util/concat.d.ts.map +1 -1
- package/dist/esm/util/file.d.ts +0 -1
- package/dist/esm/util/file.d.ts.map +1 -1
- package/dist/esm/util/typeGuards.d.ts +0 -1
- package/dist/esm/util/typeGuards.d.ts.map +1 -1
- package/dist/react-native/client/common.d.ts +0 -1
- package/dist/react-native/client/common.d.ts.map +1 -1
- package/dist/react-native/interfaces.d.ts +0 -2
- package/dist/react-native/interfaces.d.ts.map +1 -1
- package/dist/react-native/util/concat.common.d.ts +0 -1
- package/dist/react-native/util/concat.common.d.ts.map +1 -1
- package/dist/react-native/util/file.d.ts +0 -1
- package/dist/react-native/util/file.d.ts.map +1 -1
- package/dist/react-native/util/typeGuards.d.ts +0 -1
- package/dist/react-native/util/typeGuards.d.ts.map +1 -1
- package/dist/ts-http-runtime.d.ts +0 -2
- package/package.json +5 -4
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.createDefaultTracingSpan = createDefaultTracingSpan;
|
|
6
|
+
exports.createDefaultInstrumenter = createDefaultInstrumenter;
|
|
7
|
+
exports.useInstrumenter = useInstrumenter;
|
|
8
|
+
exports.getInstrumenter = getInstrumenter;
|
|
6
9
|
const tracingContext_js_1 = require("./tracingContext.js");
|
|
7
10
|
function createDefaultTracingSpan() {
|
|
8
11
|
return {
|
|
@@ -21,7 +24,6 @@ function createDefaultTracingSpan() {
|
|
|
21
24
|
},
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
|
-
exports.createDefaultTracingSpan = createDefaultTracingSpan;
|
|
25
27
|
function createDefaultInstrumenter() {
|
|
26
28
|
return {
|
|
27
29
|
createRequestHeaders: () => {
|
|
@@ -41,7 +43,6 @@ function createDefaultInstrumenter() {
|
|
|
41
43
|
},
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
exports.createDefaultInstrumenter = createDefaultInstrumenter;
|
|
45
46
|
/** @internal */
|
|
46
47
|
let instrumenterImplementation;
|
|
47
48
|
/**
|
|
@@ -52,7 +53,6 @@ let instrumenterImplementation;
|
|
|
52
53
|
function useInstrumenter(instrumenter) {
|
|
53
54
|
instrumenterImplementation = instrumenter;
|
|
54
55
|
}
|
|
55
|
-
exports.useInstrumenter = useInstrumenter;
|
|
56
56
|
/**
|
|
57
57
|
* Gets the currently set instrumenter, a No-Op instrumenter by default.
|
|
58
58
|
*
|
|
@@ -64,5 +64,4 @@ function getInstrumenter() {
|
|
|
64
64
|
}
|
|
65
65
|
return instrumenterImplementation;
|
|
66
66
|
}
|
|
67
|
-
exports.getInstrumenter = getInstrumenter;
|
|
68
67
|
//# sourceMappingURL=instrumenter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumenter.js","sourceRoot":"","sources":["../../../src/tracing/instrumenter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"instrumenter.js","sourceRoot":"","sources":["../../../src/tracing/instrumenter.ts"],"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Instrumenter,\n InstrumenterSpanOptions,\n TracingContext,\n TracingSpan,\n} from \"./interfaces.js\";\nimport { createTracingContext } from \"./tracingContext.js\";\n\nexport function createDefaultTracingSpan(): TracingSpan {\n return {\n end: () => {\n // noop\n },\n isRecording: () => false,\n recordException: () => {\n // noop\n },\n setAttribute: () => {\n // noop\n },\n setStatus: () => {\n // noop\n },\n };\n}\n\nexport function createDefaultInstrumenter(): Instrumenter {\n return {\n createRequestHeaders: (): Record<string, string> => {\n return {};\n },\n parseTraceparentHeader: (): TracingContext | undefined => {\n return undefined;\n },\n startSpan: (\n _name: string,\n spanOptions: InstrumenterSpanOptions,\n ): { span: TracingSpan; tracingContext: TracingContext } => {\n return {\n span: createDefaultTracingSpan(),\n tracingContext: createTracingContext({ parentContext: spanOptions.tracingContext }),\n };\n },\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n _context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return callback(...callbackArgs);\n },\n };\n}\n\n/** @internal */\nlet instrumenterImplementation: Instrumenter | undefined;\n\n/**\n * Extends the SDK with support for a given instrumenter implementation.\n *\n * @param instrumenter - The instrumenter implementation to use.\n */\nexport function useInstrumenter(instrumenter: Instrumenter): void {\n instrumenterImplementation = instrumenter;\n}\n\n/**\n * Gets the currently set instrumenter, a No-Op instrumenter by default.\n *\n * @returns The currently set instrumenter\n */\nexport function getInstrumenter(): Instrumenter {\n if (!instrumenterImplementation) {\n instrumenterImplementation = createDefaultInstrumenter();\n }\n return instrumenterImplementation;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.createTracingClient =
|
|
5
|
+
exports.createTracingClient = createTracingClient;
|
|
6
6
|
const instrumenter_js_1 = require("./instrumenter.js");
|
|
7
7
|
const tracingContext_js_1 = require("./tracingContext.js");
|
|
8
8
|
/**
|
|
@@ -74,5 +74,4 @@ function createTracingClient(options) {
|
|
|
74
74
|
createRequestHeaders,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
exports.createTracingClient = createTracingClient;
|
|
78
77
|
//# sourceMappingURL=tracingClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracingClient.js","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"tracingClient.js","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqBlC,kDAkGC;AA3GD,uDAAoD;AACpD,2DAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE3D,SAAS,SAAS,CAChB,IAAY,EACZ,gBAA0B,EAC1B,WAAgC;;QAKhC,MAAM,eAAe,GAAG,IAAA,iCAAe,GAAE,CAAC,SAAS,CAAC,IAAI,kCACnD,WAAW,KACd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,0CAAE,cAAc,IAChE,CAAC;QACH,IAAI,cAAc,GAAG,eAAe,CAAC,cAAc,CAAC;QACpD,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,oCAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;YACzD,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,oCAAgB,C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O,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,SAAS,sBAAsB,CAAC,iBAAyB;QACvD,OAAO,IAAA,iCAAe,GAAE,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACH,SAAS,oBAAoB,CAAC,cAA+B;QAC3D,OAAO,IAAA,iCAAe,GAAE,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,SAAS;QACT,QAAQ;QACR,WAAW;QACX,sBAAsB;QACtB,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n OperationTracingOptions,\n OptionsWithTracingContext,\n Resolved,\n TracingClient,\n TracingClientOptions,\n TracingContext,\n TracingSpan,\n TracingSpanOptions,\n} from \"./interfaces.js\";\nimport { getInstrumenter } from \"./instrumenter.js\";\nimport { knownContextKeys } from \"./tracingContext.js\";\n\n/**\n * Creates a new tracing client.\n *\n * @param options - Options used to configure the tracing client.\n * @returns - An instance of {@link TracingClient}.\n */\nexport function createTracingClient(options: TracingClientOptions): TracingClient {\n const { namespace, packageName, packageVersion } = options;\n\n function startSpan<Options extends { tracingOptions?: OperationTracingOptions }>(\n name: string,\n operationOptions?: Options,\n spanOptions?: TracingSpanOptions,\n ): {\n span: TracingSpan;\n updatedOptions: OptionsWithTracingContext<Options>;\n } {\n const startSpanResult = getInstrumenter().startSpan(name, {\n ...spanOptions,\n packageName: packageName,\n packageVersion: packageVersion,\n tracingContext: operationOptions?.tracingOptions?.tracingContext,\n });\n let tracingContext = startSpanResult.tracingContext;\n const span = startSpanResult.span;\n if (!tracingContext.getValue(knownContextKeys.namespace)) {\n tracingContext = tracingContext.setValue(knownContextKeys.namespace, namespace);\n }\n span.setAttribute(\"az.namespace\", tracingContext.getValue(knownContextKeys.namespace));\n const updatedOptions: OptionsWithTracingContext<Options> = Object.assign({}, operationOptions, {\n tracingOptions: { ...operationOptions?.tracingOptions, tracingContext },\n });\n\n return {\n span,\n updatedOptions,\n };\n }\n\n async function withSpan<\n Options extends { tracingOptions?: OperationTracingOptions },\n Callback extends (\n updatedOptions: Options,\n span: Omit<TracingSpan, \"end\">,\n ) => ReturnType<Callback>,\n >(\n name: string,\n operationOptions: Options,\n callback: Callback,\n spanOptions?: TracingSpanOptions,\n ): Promise<Resolved<ReturnType<Callback>>> {\n const { span, updatedOptions } = startSpan(name, operationOptions, spanOptions);\n try {\n const result = await withContext(updatedOptions.tracingOptions.tracingContext, () =>\n Promise.resolve(callback(updatedOptions, span)),\n );\n span.setStatus({ status: \"success\" });\n return result as ReturnType<typeof withSpan>;\n } catch (err: any) {\n span.setStatus({ status: \"error\", error: err });\n throw err;\n } finally {\n span.end();\n }\n }\n\n function withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return getInstrumenter().withContext(context, callback, ...callbackArgs);\n }\n\n /**\n * Parses a traceparent header value into a span identifier.\n *\n * @param traceparentHeader - The traceparent header to parse.\n * @returns An implementation-specific identifier for the span.\n */\n function parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined {\n return getInstrumenter().parseTraceparentHeader(traceparentHeader);\n }\n\n /**\n * Creates a set of request headers to propagate tracing information to a backend.\n *\n * @param tracingContext - The context containing the span to serialize.\n * @returns The set of headers to add to a request.\n */\n function createRequestHeaders(tracingContext?: TracingContext): Record<string, string> {\n return getInstrumenter().createRequestHeaders(tracingContext);\n }\n\n return {\n startSpan,\n withSpan,\n withContext,\n parseTraceparentHeader,\n createRequestHeaders,\n };\n}\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.TracingContextImpl = exports.
|
|
5
|
+
exports.TracingContextImpl = exports.knownContextKeys = void 0;
|
|
6
|
+
exports.createTracingContext = createTracingContext;
|
|
6
7
|
/** @internal */
|
|
7
8
|
exports.knownContextKeys = {
|
|
8
9
|
span: Symbol.for("@typespec/ts-http-runtime span"),
|
|
@@ -25,7 +26,6 @@ function createTracingContext(options = {}) {
|
|
|
25
26
|
}
|
|
26
27
|
return context;
|
|
27
28
|
}
|
|
28
|
-
exports.createTracingContext = createTracingContext;
|
|
29
29
|
/** @internal */
|
|
30
30
|
class TracingContextImpl {
|
|
31
31
|
constructor(initialContext) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracingContext.js","sourceRoot":"","sources":["../../../src/tracing/tracingContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;
|
|
1
|
+
{"version":3,"file":"tracingContext.js","sourceRoot":"","sources":["../../../src/tracing/tracingContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAiBlC,oDASC;AAtBD,gBAAgB;AACH,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC;CAC7D,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,UAAuC,EAAE;IAC5E,IAAI,OAAO,GAAmB,IAAI,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gBAAgB;AAChB,MAAa,kBAAkB;IAE7B,YAAY,cAA+B;QACzC,IAAI,CAAC,WAAW;YACd,cAAc,YAAY,kBAAkB;gBAC1C,CAAC,CAAC,IAAI,GAAG,CAAkB,cAAc,CAAC,WAAW,CAAC;gBACtD,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAc;QAClC,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxBD,gDAwBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TracingContext, TracingSpan } from \"./interfaces.js\";\n\n/** @internal */\nexport const knownContextKeys = {\n span: Symbol.for(\"@typespec/ts-http-runtime span\"),\n namespace: Symbol.for(\"@typespec/ts-http-runtime namespace\"),\n};\n\n/**\n * Creates a new {@link TracingContext} with the given options.\n * @param options - A set of known keys that may be set on the context.\n * @returns A new {@link TracingContext} with the given options.\n *\n * @internal\n */\nexport function createTracingContext(options: CreateTracingContextOptions = {}): TracingContext {\n let context: TracingContext = new TracingContextImpl(options.parentContext);\n if (options.span) {\n context = context.setValue(knownContextKeys.span, options.span);\n }\n if (options.namespace) {\n context = context.setValue(knownContextKeys.namespace, options.namespace);\n }\n return context;\n}\n\n/** @internal */\nexport class TracingContextImpl implements TracingContext {\n private _contextMap: Map<symbol, unknown>;\n constructor(initialContext?: TracingContext) {\n this._contextMap =\n initialContext instanceof TracingContextImpl\n ? new Map<symbol, unknown>(initialContext._contextMap)\n : new Map();\n }\n\n setValue(key: symbol, value: unknown): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.set(key, value);\n return newContext;\n }\n\n getValue(key: symbol): unknown {\n return this._contextMap.get(key);\n }\n\n deleteValue(key: symbol): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.delete(key);\n return newContext;\n }\n}\n\n/**\n * Represents a set of items that can be set when creating a new {@link TracingContext}.\n */\nexport interface CreateTracingContextOptions {\n /** The {@link parentContext} - the newly created context will contain all the values of the parent context unless overridden. */\n parentContext?: TracingContext;\n /** An initial span to set on the context. */\n span?: TracingSpan;\n /** The namespace to set on any child spans. */\n namespace?: string;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.cancelablePromiseRace =
|
|
5
|
+
exports.cancelablePromiseRace = cancelablePromiseRace;
|
|
6
6
|
/**
|
|
7
7
|
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
|
8
8
|
*/
|
|
@@ -21,5 +21,4 @@ async function cancelablePromiseRace(abortablePromiseBuilders, options) {
|
|
|
21
21
|
(_b = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _b === void 0 ? void 0 : _b.removeEventListener("abort", abortHandler);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.cancelablePromiseRace = cancelablePromiseRace;
|
|
25
24
|
//# sourceMappingURL=aborterUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../../src/util/aborterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../../src/util/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 { AbortSignalLike } from \"../abort-controller/AbortSignalLike.js\";\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"]}
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.uint8ArrayToString = uint8ArrayToString;
|
|
6
|
+
exports.stringToUint8Array = stringToUint8Array;
|
|
7
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
8
|
+
exports.uint8ArrayToBase64Url = uint8ArrayToBase64Url;
|
|
9
|
+
exports.uint8ArrayToUtf8String = uint8ArrayToUtf8String;
|
|
10
|
+
exports.uint8ArrayToHexString = uint8ArrayToHexString;
|
|
11
|
+
exports.utf8StringToUint8Array = utf8StringToUint8Array;
|
|
12
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
13
|
+
exports.base64UrlToUint8Array = base64UrlToUint8Array;
|
|
14
|
+
exports.hexStringToUint8Array = hexStringToUint8Array;
|
|
6
15
|
/**
|
|
7
16
|
* The helper that transforms bytes with specific character encoding into string
|
|
8
17
|
* @param bytes - the uint8array bytes
|
|
@@ -21,7 +30,6 @@ function uint8ArrayToString(bytes, format) {
|
|
|
21
30
|
return uint8ArrayToHexString(bytes);
|
|
22
31
|
}
|
|
23
32
|
}
|
|
24
|
-
exports.uint8ArrayToString = uint8ArrayToString;
|
|
25
33
|
/**
|
|
26
34
|
* The helper that transforms string to specific character encoded bytes array.
|
|
27
35
|
* @param value - the string to be converted
|
|
@@ -40,7 +48,6 @@ function stringToUint8Array(value, format) {
|
|
|
40
48
|
return hexStringToUint8Array(value);
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
|
-
exports.stringToUint8Array = stringToUint8Array;
|
|
44
51
|
/**
|
|
45
52
|
* Decodes a Uint8Array into a Base64 string.
|
|
46
53
|
* @internal
|
|
@@ -48,7 +55,6 @@ exports.stringToUint8Array = stringToUint8Array;
|
|
|
48
55
|
function uint8ArrayToBase64(bytes) {
|
|
49
56
|
return btoa([...bytes].map((x) => String.fromCharCode(x)).join(""));
|
|
50
57
|
}
|
|
51
|
-
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
52
58
|
/**
|
|
53
59
|
* Decodes a Uint8Array into a Base64Url string.
|
|
54
60
|
* @internal
|
|
@@ -56,7 +62,6 @@ exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
|
56
62
|
function uint8ArrayToBase64Url(bytes) {
|
|
57
63
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
58
64
|
}
|
|
59
|
-
exports.uint8ArrayToBase64Url = uint8ArrayToBase64Url;
|
|
60
65
|
/**
|
|
61
66
|
* Decodes a Uint8Array into a javascript string.
|
|
62
67
|
* @internal
|
|
@@ -66,7 +71,6 @@ function uint8ArrayToUtf8String(bytes) {
|
|
|
66
71
|
const dataString = decoder.decode(bytes);
|
|
67
72
|
return dataString;
|
|
68
73
|
}
|
|
69
|
-
exports.uint8ArrayToUtf8String = uint8ArrayToUtf8String;
|
|
70
74
|
/**
|
|
71
75
|
* Decodes a Uint8Array into a hex string
|
|
72
76
|
* @internal
|
|
@@ -74,7 +78,6 @@ exports.uint8ArrayToUtf8String = uint8ArrayToUtf8String;
|
|
|
74
78
|
function uint8ArrayToHexString(bytes) {
|
|
75
79
|
return [...bytes].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
76
80
|
}
|
|
77
|
-
exports.uint8ArrayToHexString = uint8ArrayToHexString;
|
|
78
81
|
/**
|
|
79
82
|
* Encodes a JavaScript string into a Uint8Array.
|
|
80
83
|
* @internal
|
|
@@ -82,7 +85,6 @@ exports.uint8ArrayToHexString = uint8ArrayToHexString;
|
|
|
82
85
|
function utf8StringToUint8Array(value) {
|
|
83
86
|
return new TextEncoder().encode(value);
|
|
84
87
|
}
|
|
85
|
-
exports.utf8StringToUint8Array = utf8StringToUint8Array;
|
|
86
88
|
/**
|
|
87
89
|
* Encodes a Base64 string into a Uint8Array.
|
|
88
90
|
* @internal
|
|
@@ -90,7 +92,6 @@ exports.utf8StringToUint8Array = utf8StringToUint8Array;
|
|
|
90
92
|
function base64ToUint8Array(value) {
|
|
91
93
|
return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));
|
|
92
94
|
}
|
|
93
|
-
exports.base64ToUint8Array = base64ToUint8Array;
|
|
94
95
|
/**
|
|
95
96
|
* Encodes a Base64Url string into a Uint8Array.
|
|
96
97
|
* @internal
|
|
@@ -99,7 +100,6 @@ function base64UrlToUint8Array(value) {
|
|
|
99
100
|
const base64String = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
100
101
|
return base64ToUint8Array(base64String);
|
|
101
102
|
}
|
|
102
|
-
exports.base64UrlToUint8Array = base64UrlToUint8Array;
|
|
103
103
|
const hexDigits = new Set("0123456789abcdefABCDEF");
|
|
104
104
|
/**
|
|
105
105
|
* Encodes a hex string into a Uint8Array
|
|
@@ -119,5 +119,4 @@ function hexStringToUint8Array(value) {
|
|
|
119
119
|
}
|
|
120
120
|
return bytes;
|
|
121
121
|
}
|
|
122
|
-
exports.hexStringToUint8Array = hexStringToUint8Array;
|
|
123
122
|
//# sourceMappingURL=bytesEncoding.common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytesEncoding.common.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"bytesEncoding.common.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,gDAWC;AAQD,gDAWC;AAMD,gDAEC;AAMD,sDAEC;AAMD,wDAIC;AAMD,sDAEC;AAMD,wDAEC;AAMD,gDAEC;AAMD,sDAGC;AAQD,sDAeC;AAtHD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,WAAW;YACd,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACtC,KAAK,KAAK;YACR,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAa,EAAE,MAAoB;IACpE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,WAAW;YACd,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACtC,KAAK,KAAK;YACR,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,KAAiB;IAClD,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC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AAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjE,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAEpD;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,KAAa;IACjD,sGAAsG;IACtG,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5D,oFAAoF;YACpF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\ndeclare global {\n // stub these out for the browser\n function btoa(input: string): string;\n function atob(input: string): string;\n}\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 switch (format) {\n case \"utf-8\":\n return uint8ArrayToUtf8String(bytes);\n case \"base64\":\n return uint8ArrayToBase64(bytes);\n case \"base64url\":\n return uint8ArrayToBase64Url(bytes);\n case \"hex\":\n return uint8ArrayToHexString(bytes);\n }\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 switch (format) {\n case \"utf-8\":\n return utf8StringToUint8Array(value);\n case \"base64\":\n return base64ToUint8Array(value);\n case \"base64url\":\n return base64UrlToUint8Array(value);\n case \"hex\":\n return hexStringToUint8Array(value);\n }\n}\n\n/**\n * Decodes a Uint8Array into a Base64 string.\n * @internal\n */\nexport function uint8ArrayToBase64(bytes: Uint8Array): string {\n return btoa([...bytes].map((x) => String.fromCharCode(x)).join(\"\"));\n}\n\n/**\n * Decodes a Uint8Array into a Base64Url string.\n * @internal\n */\nexport function uint8ArrayToBase64Url(bytes: Uint8Array): string {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Decodes a Uint8Array into a javascript string.\n * @internal\n */\nexport function uint8ArrayToUtf8String(bytes: Uint8Array): string {\n const decoder = new TextDecoder();\n const dataString = decoder.decode(bytes);\n return dataString;\n}\n\n/**\n * Decodes a Uint8Array into a hex string\n * @internal\n */\nexport function uint8ArrayToHexString(bytes: Uint8Array): string {\n return [...bytes].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Encodes a JavaScript string into a Uint8Array.\n * @internal\n */\nexport function utf8StringToUint8Array(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\n/**\n * Encodes a Base64 string into a Uint8Array.\n * @internal\n */\nexport function base64ToUint8Array(value: string): Uint8Array {\n return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));\n}\n\n/**\n * Encodes a Base64Url string into a Uint8Array.\n * @internal\n */\nexport function base64UrlToUint8Array(value: string): Uint8Array {\n const base64String = value.replace(/-/g, \"+\").replace(/_/g, \"/\");\n return base64ToUint8Array(base64String);\n}\n\nconst hexDigits = new Set(\"0123456789abcdefABCDEF\");\n\n/**\n * Encodes a hex string into a Uint8Array\n * @internal\n */\nexport function hexStringToUint8Array(value: string): Uint8Array {\n // If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior\n const bytes = new Uint8Array(value.length / 2);\n for (let i = 0; i < value.length / 2; ++i) {\n const highNibble = value[2 * i];\n const lowNibble = value[2 * i + 1];\n if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {\n // Replicate Node Buffer behavior by exiting early when we encounter an invalid byte\n return bytes.slice(0, i);\n }\n\n bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);\n }\n\n return bytes;\n}\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.uint8ArrayToString = uint8ArrayToString;
|
|
6
|
+
exports.stringToUint8Array = stringToUint8Array;
|
|
6
7
|
/**
|
|
7
8
|
* The helper that transforms bytes with specific character encoding into string
|
|
8
9
|
* @param bytes - the uint8array bytes
|
|
@@ -12,7 +13,6 @@ exports.stringToUint8Array = exports.uint8ArrayToString = void 0;
|
|
|
12
13
|
function uint8ArrayToString(bytes, format) {
|
|
13
14
|
return Buffer.from(bytes).toString(format);
|
|
14
15
|
}
|
|
15
|
-
exports.uint8ArrayToString = uint8ArrayToString;
|
|
16
16
|
/**
|
|
17
17
|
* The helper that transforms string to specific character encoded bytes array.
|
|
18
18
|
* @param value - the string to be converted
|
|
@@ -22,5 +22,4 @@ exports.uint8ArrayToString = uint8ArrayToString;
|
|
|
22
22
|
function stringToUint8Array(value, format) {
|
|
23
23
|
return Buffer.from(value, format);
|
|
24
24
|
}
|
|
25
|
-
exports.stringToUint8Array = stringToUint8Array;
|
|
26
25
|
//# sourceMappingURL=bytesEncoding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytesEncoding.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"bytesEncoding.js","sourceRoot":"","sources":["../../../src/util/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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.common.d.ts","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"concat.common.d.ts","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,KAAK,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,UAAU,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,CAAC,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC,EAAE,GAC/C,OAAO,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAO/C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.concat =
|
|
5
|
+
exports.concat = concat;
|
|
6
6
|
const file_js_1 = require("./file.js");
|
|
7
7
|
const typeGuards_js_1 = require("./typeGuards.js");
|
|
8
8
|
/**
|
|
@@ -45,5 +45,4 @@ async function concat(sources) {
|
|
|
45
45
|
}
|
|
46
46
|
return new Blob(parts);
|
|
47
47
|
}
|
|
48
|
-
exports.concat = concat;
|
|
49
48
|
//# sourceMappingURL=concat.common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.common.js","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"concat.common.js","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAuDlC,wBASC;AA9DD,uCAA0C;AAC1C,mDAA4E;AAE5E;;;GAGG;AACH,SAAS,KAAK,CAAC,MAAkC;IAC/C,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC;AAED,KAAK,UAAU,UAAU,CACvB,MAAsD;IAEtD,IAAI,MAAM,YAAY,IAAI,IAAI,MAAM,YAAY,UAAU,EAAE,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAA,mCAAmB,EAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,+EAA+E;IAC/E,oFAAoF;IACpF,uBAAuB;IACvB,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC;IAEzC,2CAA2C;IAC3C,IAAI,IAAA,oCAAoB,EAAC,UAAU,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,iJAAiJ,CAClJ,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AASD;;;;;;;;GAQG;AACI,KAAK,UAAU,MAAM,CAC1B,OAAgD;IAEhD,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getRawContent } from \"./file.js\";\nimport { isNodeReadableStream, isWebReadableStream } from \"./typeGuards.js\";\n\n/**\n * Drain the content of the given ReadableStream into a Blob.\n * The blob's content may end up in memory or on disk dependent on size.\n */\nfunction drain(stream: ReadableStream<Uint8Array>): Promise<Blob> {\n return new Response(stream).blob();\n}\n\nasync function toBlobPart(\n source: ReadableStream<Uint8Array> | Blob | Uint8Array,\n): Promise<BlobPart> {\n if (source instanceof Blob || source instanceof Uint8Array) {\n return source;\n }\n\n if (isWebReadableStream(source)) {\n return drain(source);\n }\n\n // If it's not a true Blob, and it's not a Uint8Array, we can assume the source\n // is a fake File created by createFileFromStream and we can get the original stream\n // using getRawContent.\n const rawContent = getRawContent(source);\n\n // Shouldn't happen but guard for it anyway\n if (isNodeReadableStream(rawContent)) {\n throw new Error(\n \"Encountered unexpected type. In the browser, `concat` supports Web ReadableStream, Blob, Uint8Array, and files created using `createFile` only.\",\n );\n }\n\n return toBlobPart(rawContent);\n}\n\n/**\n * Accepted binary data types for concat\n *\n * @internal\n */\ntype ConcatSource = ReadableStream<Uint8Array> | Blob | Uint8Array;\n\n/**\n * Utility function that concatenates a set of binary inputs into one combined output.\n *\n * @param sources - array of sources for the concatenation\n * @returns - in Node, a (() =\\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.\n * In browser, returns a `Blob` representing all the concatenated inputs.\n *\n * @internal\n */\nexport async function concat(\n sources: (ConcatSource | (() => ConcatSource))[],\n): Promise<(() => NodeJS.ReadableStream) | Blob> {\n const parts = [];\n for (const source of sources) {\n parts.push(await toBlobPart(typeof source === \"function\" ? source() : source));\n }\n\n return new Blob(parts);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/util/concat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/util/concat.ts"],"names":[],"mappings":"AA2DA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,GAAG,UAAU,GAAG,IAAI,CAAC;AAElG;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,CAAC,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC,EAAE,GAC/C,OAAO,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAc/C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.concat =
|
|
5
|
+
exports.concat = concat;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const stream_1 = require("stream");
|
|
8
8
|
const typeGuards_js_1 = require("./typeGuards.js");
|
|
@@ -88,5 +88,4 @@ async function concat(sources) {
|
|
|
88
88
|
})());
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
exports.concat = concat;
|
|
92
91
|
//# sourceMappingURL=concat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/util/concat.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/util/concat.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA0ElC,wBAgBC;;AAxFD,mCAAkC;AAElC,mDAAyC;AACzC,uCAA0C;AAE1C,SAAgB,mBAAmB;;QAGjC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,OAAO,IAAI,EAAE,CAAC;gBACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,sBAAM,MAAM,CAAC,IAAI,EAAE,CAAA,CAAC;gBAC5C,IAAI,IAAI,EAAE,CAAC;oBACT,qCAAO;gBACT,CAAC;gBAED,4BAAM,KAAK,CAAA,CAAC;YACd,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CAAA;AAED,SAAS,iBAAiB,CAAI,SAAc;IAC1C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACrC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,G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A,0BAAA,sBAAA,MAAM,CAAA,CAAA,YAAA,6FAAE,CAAC;4BAAT,sBAAM;4BAAN,WAAM;4BAArB,MAAM,KAAK,KAAA,CAAA;4BACpB,4BAAM,KAAK,CAAA,CAAC;wBACd,CAAC;;;;;;;;;gBACH,CAAC;YACH,CAAC;SAAA,CAAC,EAAE,CACL,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Readable } from \"stream\";\nimport type { ReadableStream as AsyncIterableReadableStream } from \"stream/web\";\nimport { isBlob } from \"./typeGuards.js\";\nimport { getRawContent } from \"./file.js\";\n\nasync function* streamAsyncIterator(\n this: ReadableStream<Uint8Array>,\n): AsyncIterableIterator<Uint8Array> {\n const reader = this.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n return;\n }\n\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\nfunction makeAsyncIterable<T>(webStream: any): asserts webStream is AsyncIterableReadableStream<T> {\n if (!webStream[Symbol.asyncIterator]) {\n webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);\n }\n\n if (!webStream.values) {\n webStream.values = streamAsyncIterator.bind(webStream);\n }\n}\n\nfunction ensureNodeStream(\n stream: ReadableStream<Uint8Array> | NodeJS.ReadableStream,\n): NodeJS.ReadableStream {\n if (stream instanceof ReadableStream) {\n makeAsyncIterable<Uint8Array>(stream);\n return Readable.fromWeb(stream);\n } else {\n return stream;\n }\n}\n\nfunction toStream(\n source: ReadableStream<Uint8Array> | NodeJS.ReadableStream | Uint8Array | Blob,\n): NodeJS.ReadableStream {\n if (source instanceof Uint8Array) {\n return Readable.from(Buffer.from(source));\n } else if (isBlob(source)) {\n return toStream(getRawContent(source));\n } else {\n return ensureNodeStream(source);\n }\n}\n\n/**\n * Accepted binary data types for concat\n *\n * @internal\n */\nexport type ConcatSource = ReadableStream<Uint8Array> | NodeJS.ReadableStream | Uint8Array | Blob;\n\n/**\n * Utility function that concatenates a set of binary inputs into one combined output.\n *\n * @param sources - array of sources for the concatenation\n * @returns - in Node, a (() =\\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.\n * In browser, returns a `Blob` representing all the concatenated inputs.\n *\n * @internal\n */\nexport async function concat(\n sources: (ConcatSource | (() => ConcatSource))[],\n): Promise<(() => NodeJS.ReadableStream) | Blob> {\n return function () {\n const streams = sources.map((x) => (typeof x === \"function\" ? x() : x)).map(toStream);\n\n return Readable.from(\n (async function* () {\n for (const stream of streams as NodeJS.ReadableStream[]) {\n for await (const chunk of stream) {\n yield chunk;\n }\n }\n })(),\n );\n };\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.createAbortablePromise =
|
|
5
|
+
exports.createAbortablePromise = createAbortablePromise;
|
|
6
6
|
const AbortError_js_1 = require("../abort-controller/AbortError.js");
|
|
7
7
|
/**
|
|
8
8
|
* Creates an abortable promise.
|
|
@@ -42,5 +42,4 @@ function createAbortablePromise(buildPromise, options) {
|
|
|
42
42
|
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
exports.createAbortablePromise = createAbortablePromise;
|
|
46
45
|
//# sourceMappingURL=createAbortablePromise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../../src/util/createAbortablePromise.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"createAbortablePromise.js","sourceRoot":"","sources":["../../../src/util/createAbortablePromise.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmBlC,wDAuCC;AAxDD,qEAA+D;AAW/D;;;;;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Error } from \"../abort-controller/AbortError.js\";\nimport { 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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.delay =
|
|
5
|
+
exports.delay = delay;
|
|
6
6
|
const createAbortablePromise_js_1 = require("./createAbortablePromise.js");
|
|
7
7
|
const StandardAbortMessage = "The delay was aborted.";
|
|
8
8
|
/**
|
|
@@ -22,5 +22,4 @@ function delay(timeInMs, options) {
|
|
|
22
22
|
abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : StandardAbortMessage,
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
exports.delay = delay;
|
|
26
25
|
//# sourceMappingURL=delay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../src/util/delay.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../src/util/delay.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkBlC,sBAaC;AA5BD,2EAAqE;AAErE,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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortOptions } from \"./aborterUtils.js\";\nimport { createAbortablePromise } from \"./createAbortablePromise.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"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.isError = isError;
|
|
6
|
+
exports.getErrorMessage = getErrorMessage;
|
|
6
7
|
const object_js_1 = require("./object.js");
|
|
7
8
|
/**
|
|
8
9
|
* Typeguard for an error object shape (has name and message)
|
|
@@ -16,7 +17,6 @@ function isError(e) {
|
|
|
16
17
|
}
|
|
17
18
|
return false;
|
|
18
19
|
}
|
|
19
|
-
exports.isError = isError;
|
|
20
20
|
/**
|
|
21
21
|
* Given what is thought to be an error object, return the message if possible.
|
|
22
22
|
* If the message is missing, returns a stringified version of the input.
|
|
@@ -43,5 +43,4 @@ function getErrorMessage(e) {
|
|
|
43
43
|
return `Unknown error ${stringified}`;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
exports.getErrorMessage = getErrorMessage;
|
|
47
46
|
//# sourceMappingURL=error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/util/error.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/util/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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/util/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/util/file.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAyCD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,GACT,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,CAMjE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,EAChE,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,2BAAgC,GACxC,IAAI,CAoBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAAsB,GAC9B,IAAI,CAgBN"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.getRawContent = getRawContent;
|
|
6
|
+
exports.createFileFromStream = createFileFromStream;
|
|
7
|
+
exports.createFile = createFile;
|
|
6
8
|
const checkEnvironment_js_1 = require("./checkEnvironment.js");
|
|
7
9
|
const typeGuards_js_1 = require("./typeGuards.js");
|
|
8
10
|
const unimplementedMethods = {
|
|
@@ -49,7 +51,6 @@ function getRawContent(blob) {
|
|
|
49
51
|
return blob.stream();
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
exports.getRawContent = getRawContent;
|
|
53
54
|
/**
|
|
54
55
|
* Create an object that implements the File interface. This object is intended to be
|
|
55
56
|
* passed into RequestBodyType.formData, and is not guaranteed to work as expected in
|
|
@@ -77,7 +78,6 @@ function createFileFromStream(stream, name, options = {}) {
|
|
|
77
78
|
return s;
|
|
78
79
|
}, [rawContent]: stream });
|
|
79
80
|
}
|
|
80
|
-
exports.createFileFromStream = createFileFromStream;
|
|
81
81
|
/**
|
|
82
82
|
* Create an object that implements the File interface. This object is intended to be
|
|
83
83
|
* passed into RequestBodyType.formData, and is not guaranteed to work as expected in
|
|
@@ -98,5 +98,4 @@ function createFile(content, name, options = {}) {
|
|
|
98
98
|
return new File([content], name, options);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
exports.createFile = createFile;
|
|
102
101
|
//# sourceMappingURL=file.js.map
|