@typespec/ts-http-runtime 0.3.5-alpha.20260310.2 → 0.3.5
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/multipart.js.map +1 -1
- package/dist/browser/client/sendRequest.js +12 -4
- package/dist/browser/client/sendRequest.js.map +1 -1
- package/dist/browser/client/urlHelpers.js +9 -3
- package/dist/browser/client/urlHelpers.js.map +1 -1
- package/dist/browser/fetchHttpClient.d.ts +5 -0
- package/dist/browser/fetchHttpClient.js.map +1 -1
- package/dist/browser/logger/logger.js.map +1 -1
- package/dist/browser/policies/retryPolicy.js +4 -3
- package/dist/browser/policies/retryPolicy.js.map +1 -1
- package/dist/browser/util/concat.d.ts +16 -1
- package/dist/browser/util/concat.js +55 -1
- package/dist/browser/util/concat.js.map +1 -1
- package/dist/browser/util/sanitizer.js +3 -3
- package/dist/browser/util/sanitizer.js.map +1 -1
- package/dist/browser/util/typeGuards.js +2 -2
- package/dist/browser/util/typeGuards.js.map +1 -1
- package/dist/browser/util/userAgentPlatform.d.ts +28 -0
- package/dist/browser/util/userAgentPlatform.js +9 -10
- package/dist/browser/util/userAgentPlatform.js.map +1 -1
- package/dist/browser/util/uuidUtils.common.js +1 -1
- package/dist/browser/util/uuidUtils.common.js.map +1 -1
- package/dist/commonjs/abort-controller/AbortError.js +1 -0
- package/dist/commonjs/abort-controller/AbortError.js.map +1 -1
- package/dist/commonjs/auth/credentials.js +1 -0
- package/dist/commonjs/auth/credentials.js.map +1 -1
- package/dist/commonjs/auth/oauth2Flows.js +1 -0
- package/dist/commonjs/auth/oauth2Flows.js.map +1 -1
- package/dist/commonjs/auth/schemes.js +1 -0
- package/dist/commonjs/auth/schemes.js.map +1 -1
- package/dist/commonjs/client/apiVersionPolicy.js +1 -0
- package/dist/commonjs/client/apiVersionPolicy.js.map +1 -1
- package/dist/commonjs/client/clientHelpers.js +1 -0
- package/dist/commonjs/client/clientHelpers.js.map +1 -1
- package/dist/commonjs/client/common.js +1 -0
- package/dist/commonjs/client/common.js.map +1 -1
- package/dist/commonjs/client/getClient.js +1 -0
- package/dist/commonjs/client/getClient.js.map +1 -1
- package/dist/commonjs/client/multipart.js +1 -0
- package/dist/commonjs/client/multipart.js.map +3 -3
- package/dist/commonjs/client/operationOptionHelpers.js +1 -0
- package/dist/commonjs/client/operationOptionHelpers.js.map +1 -1
- package/dist/commonjs/client/restError.js +1 -0
- package/dist/commonjs/client/restError.js.map +1 -1
- package/dist/commonjs/client/sendRequest.js +13 -2
- package/dist/commonjs/client/sendRequest.js.map +3 -3
- package/dist/commonjs/client/urlHelpers.js +7 -3
- package/dist/commonjs/client/urlHelpers.js.map +3 -3
- package/dist/commonjs/constants.js +1 -0
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/createPipelineFromOptions.js +1 -0
- package/dist/commonjs/createPipelineFromOptions.js.map +1 -1
- package/dist/commonjs/defaultHttpClient.js +1 -0
- package/dist/commonjs/defaultHttpClient.js.map +1 -1
- package/dist/commonjs/fetchHttpClient.d.ts +5 -0
- package/dist/commonjs/fetchHttpClient.js +1 -0
- package/dist/commonjs/fetchHttpClient.js.map +3 -3
- package/dist/commonjs/httpHeaders.js +1 -0
- package/dist/commonjs/httpHeaders.js.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/interfaces.js +1 -0
- package/dist/commonjs/interfaces.js.map +1 -1
- package/dist/commonjs/log.js +1 -0
- package/dist/commonjs/log.js.map +1 -1
- package/dist/commonjs/logger/debug.js +1 -0
- package/dist/commonjs/logger/debug.js.map +1 -1
- package/dist/commonjs/logger/internal.js +1 -0
- package/dist/commonjs/logger/internal.js.map +1 -1
- package/dist/commonjs/logger/log.common.js +1 -0
- package/dist/commonjs/logger/log.common.js.map +1 -1
- package/dist/commonjs/logger/log.js +1 -0
- package/dist/commonjs/logger/log.js.map +1 -1
- package/dist/commonjs/logger/logger.js +1 -0
- package/dist/commonjs/logger/logger.js.map +3 -3
- package/dist/commonjs/nodeHttpClient.js +1 -0
- package/dist/commonjs/nodeHttpClient.js.map +1 -1
- package/dist/commonjs/pipeline.js +1 -0
- package/dist/commonjs/pipeline.js.map +1 -1
- package/dist/commonjs/pipelineRequest.js +1 -0
- package/dist/commonjs/pipelineRequest.js.map +1 -1
- package/dist/commonjs/policies/agentPolicy.js +1 -0
- package/dist/commonjs/policies/agentPolicy.js.map +1 -1
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +1 -0
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +1 -0
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +1 -0
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/policies/auth/checkInsecureConnection.js +1 -0
- package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +1 -1
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +1 -0
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +1 -1
- package/dist/commonjs/policies/decompressResponsePolicy.js +1 -0
- package/dist/commonjs/policies/decompressResponsePolicy.js.map +1 -1
- package/dist/commonjs/policies/defaultRetryPolicy.js +1 -0
- package/dist/commonjs/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/exponentialRetryPolicy.js +1 -0
- package/dist/commonjs/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/formDataPolicy.js +1 -0
- package/dist/commonjs/policies/formDataPolicy.js.map +1 -1
- package/dist/commonjs/policies/internal.js +1 -0
- package/dist/commonjs/policies/internal.js.map +1 -1
- package/dist/commonjs/policies/logPolicy.js +1 -0
- package/dist/commonjs/policies/logPolicy.js.map +1 -1
- package/dist/commonjs/policies/multipartPolicy.js +1 -0
- package/dist/commonjs/policies/multipartPolicy.js.map +1 -1
- package/dist/commonjs/policies/proxyPolicy.common.js +1 -0
- package/dist/commonjs/policies/proxyPolicy.common.js.map +1 -1
- package/dist/commonjs/policies/proxyPolicy.js +3 -3
- package/dist/commonjs/policies/proxyPolicy.js.map +3 -3
- package/dist/commonjs/policies/redirectPolicy.js +1 -0
- package/dist/commonjs/policies/redirectPolicy.js.map +1 -1
- package/dist/commonjs/policies/retryPolicy.js +5 -3
- package/dist/commonjs/policies/retryPolicy.js.map +3 -3
- package/dist/commonjs/policies/systemErrorRetryPolicy.js +1 -0
- package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/throttlingRetryPolicy.js +1 -0
- package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/tlsPolicy.js +1 -0
- package/dist/commonjs/policies/tlsPolicy.js.map +1 -1
- package/dist/commonjs/policies/userAgentPolicy.js +1 -0
- package/dist/commonjs/policies/userAgentPolicy.js.map +1 -1
- package/dist/commonjs/restError.js +1 -0
- package/dist/commonjs/restError.js.map +1 -1
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +1 -0
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +1 -1
- package/dist/commonjs/retryStrategies/retryStrategy.js +1 -0
- package/dist/commonjs/retryStrategies/retryStrategy.js.map +1 -1
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +1 -0
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/arrayBuffer.js +1 -0
- package/dist/commonjs/util/arrayBuffer.js.map +1 -1
- package/dist/commonjs/util/bytesEncoding.common.js +1 -0
- package/dist/commonjs/util/bytesEncoding.common.js.map +1 -1
- package/dist/commonjs/util/bytesEncoding.js +1 -0
- package/dist/commonjs/util/bytesEncoding.js.map +1 -1
- package/dist/commonjs/util/checkEnvironment.js +1 -0
- package/dist/commonjs/util/checkEnvironment.js.map +1 -1
- package/dist/commonjs/util/concat.js +1 -0
- package/dist/commonjs/util/concat.js.map +1 -1
- package/dist/commonjs/util/delay.js +1 -0
- package/dist/commonjs/util/delay.js.map +1 -1
- package/dist/commonjs/util/error.js +1 -0
- package/dist/commonjs/util/error.js.map +1 -1
- package/dist/commonjs/util/helpers.js +1 -0
- package/dist/commonjs/util/helpers.js.map +1 -1
- package/dist/commonjs/util/inspect.common.js +1 -0
- package/dist/commonjs/util/inspect.common.js.map +1 -1
- package/dist/commonjs/util/inspect.js +1 -0
- package/dist/commonjs/util/inspect.js.map +1 -1
- package/dist/commonjs/util/internal.js +1 -0
- package/dist/commonjs/util/internal.js.map +1 -1
- package/dist/commonjs/util/object.js +1 -0
- package/dist/commonjs/util/object.js.map +1 -1
- package/dist/commonjs/util/random.js +1 -0
- package/dist/commonjs/util/random.js.map +1 -1
- package/dist/commonjs/util/sanitizer.js +4 -3
- package/dist/commonjs/util/sanitizer.js.map +3 -3
- package/dist/commonjs/util/sha256.common.js +1 -0
- package/dist/commonjs/util/sha256.common.js.map +1 -1
- package/dist/commonjs/util/sha256.js +1 -0
- package/dist/commonjs/util/sha256.js.map +1 -1
- package/dist/commonjs/util/typeGuards.js +3 -2
- package/dist/commonjs/util/typeGuards.js.map +3 -3
- package/dist/commonjs/util/userAgent.js +1 -0
- package/dist/commonjs/util/userAgent.js.map +1 -1
- package/dist/commonjs/util/userAgentPlatform.d.ts +8 -0
- package/dist/commonjs/util/userAgentPlatform.js +7 -7
- package/dist/commonjs/util/userAgentPlatform.js.map +3 -3
- package/dist/commonjs/util/uuidUtils.common.js +2 -1
- package/dist/commonjs/util/uuidUtils.common.js.map +3 -3
- package/dist/commonjs/util/uuidUtils.js +1 -0
- package/dist/commonjs/util/uuidUtils.js.map +1 -1
- package/dist/commonjs/xhrHttpClient.js +1 -0
- package/dist/commonjs/xhrHttpClient.js.map +1 -1
- package/dist/esm/client/multipart.js.map +1 -1
- package/dist/esm/client/sendRequest.js +12 -4
- package/dist/esm/client/sendRequest.js.map +1 -1
- package/dist/esm/client/urlHelpers.js +9 -3
- package/dist/esm/client/urlHelpers.js.map +1 -1
- package/dist/esm/fetchHttpClient.d.ts +5 -0
- package/dist/esm/fetchHttpClient.js.map +1 -1
- package/dist/esm/logger/logger.js.map +1 -1
- package/dist/esm/policies/proxyPolicy.js +2 -3
- package/dist/esm/policies/proxyPolicy.js.map +1 -1
- package/dist/esm/policies/retryPolicy.js +4 -3
- package/dist/esm/policies/retryPolicy.js.map +1 -1
- package/dist/esm/util/sanitizer.js +3 -3
- package/dist/esm/util/sanitizer.js.map +1 -1
- package/dist/esm/util/typeGuards.js +2 -2
- package/dist/esm/util/typeGuards.js.map +1 -1
- package/dist/esm/util/userAgentPlatform.d.ts +8 -0
- package/dist/esm/util/userAgentPlatform.js +6 -7
- package/dist/esm/util/userAgentPlatform.js.map +1 -1
- package/dist/esm/util/uuidUtils.common.js +1 -1
- package/dist/esm/util/uuidUtils.common.js.map +1 -1
- package/dist/react-native/client/multipart.js.map +1 -1
- package/dist/react-native/client/sendRequest.js +12 -4
- package/dist/react-native/client/sendRequest.js.map +1 -1
- package/dist/react-native/client/urlHelpers.js +9 -3
- package/dist/react-native/client/urlHelpers.js.map +1 -1
- package/dist/react-native/fetchHttpClient.d.ts +5 -0
- package/dist/react-native/fetchHttpClient.js.map +1 -1
- package/dist/react-native/logger/logger.js.map +1 -1
- package/dist/react-native/policies/retryPolicy.js +4 -3
- package/dist/react-native/policies/retryPolicy.js.map +1 -1
- package/dist/react-native/util/concat.d.ts +34 -1
- package/dist/react-native/util/concat.js +48 -1
- package/dist/react-native/util/concat.js.map +1 -1
- package/dist/react-native/util/sanitizer.js +3 -3
- package/dist/react-native/util/sanitizer.js.map +1 -1
- package/dist/react-native/util/typeGuards.js +2 -2
- package/dist/react-native/util/typeGuards.js.map +1 -1
- package/dist/react-native/util/uuidUtils.common.js +1 -1
- package/dist/react-native/util/uuidUtils.common.js.map +1 -1
- package/package.json +10 -8
- package/dist/browser/util/concat.common.d.ts +0 -17
- package/dist/browser/util/concat.common.js +0 -58
- package/dist/browser/util/concat.common.js.map +0 -1
- package/dist/commonjs/util/concat.common.d.ts +0 -17
- package/dist/commonjs/util/concat.common.js +0 -60
- package/dist/commonjs/util/concat.common.js.map +0 -7
- package/dist/esm/util/concat.common.d.ts +0 -17
- package/dist/esm/util/concat.common.js +0 -58
- package/dist/esm/util/concat.common.js.map +0 -1
- package/dist/react-native/util/concat.common.d.ts +0 -17
- package/dist/react-native/util/concat.common.js +0 -58
- package/dist/react-native/util/concat.common.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type * as http from \"http\";\nimport type * as https from \"https\";\nimport { HttpsProxyAgent } from \"https-proxy-agent\";\nimport { HttpProxyAgent } from \"http-proxy-agent\";\nimport type {\n PipelineRequest,\n PipelineResponse,\n ProxySettings,\n SendRequest,\n} from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { logger } from \"../log.js\";\n\nconst HTTPS_PROXY = \"HTTPS_PROXY\";\nconst HTTP_PROXY = \"HTTP_PROXY\";\nconst ALL_PROXY = \"ALL_PROXY\";\nconst NO_PROXY = \"NO_PROXY\";\n\n/**\n * The programmatic identifier of the proxyPolicy.\n */\nexport const proxyPolicyName = \"proxyPolicy\";\n\n/**\n * Stores the patterns specified in NO_PROXY environment variable.\n * @internal\n */\nexport const globalNoProxyList: string[] = [];\nlet noProxyListLoaded: boolean = false;\n\n/** A cache of whether a host should bypass the proxy. */\nconst globalBypassedMap: Map<string, boolean> = new Map();\n\nfunction getEnvironmentValue(name: string): string | undefined {\n if (process.env[name]) {\n return process.env[name];\n } else if (process.env[name.toLowerCase()]) {\n return process.env[name.toLowerCase()];\n }\n return undefined;\n}\n\nfunction loadEnvironmentProxyValue(): string | undefined {\n if (!process) {\n return undefined;\n }\n\n const httpsProxy = getEnvironmentValue(HTTPS_PROXY);\n const allProxy = getEnvironmentValue(ALL_PROXY);\n const httpProxy = getEnvironmentValue(HTTP_PROXY);\n\n return httpsProxy || allProxy || httpProxy;\n}\n\n/**\n * Check whether the host of a given `uri` matches any pattern in the no proxy list.\n * If there's a match, any request sent to the same host shouldn't have the proxy settings set.\n * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210\n */\nfunction isBypassed(\n uri: string,\n noProxyList: string[],\n bypassedMap?: Map<string, boolean>,\n): boolean | undefined {\n if (noProxyList.length === 0) {\n return false;\n }\n const host = new URL(uri).hostname;\n if (bypassedMap?.has(host)) {\n return bypassedMap.get(host);\n }\n let isBypassedFlag = false;\n for (const pattern of noProxyList) {\n if (pattern[0] === \".\") {\n // This should match either domain it self or any subdomain or host\n // .foo.com will match foo.com it self or *.foo.com\n if (host.endsWith(pattern)) {\n isBypassedFlag = true;\n } else {\n if (host.length === pattern.length - 1 && host === pattern.slice(1)) {\n isBypassedFlag = true;\n }\n }\n } else {\n if (host === pattern) {\n isBypassedFlag = true;\n }\n }\n }\n bypassedMap?.set(host, isBypassedFlag);\n return isBypassedFlag;\n}\n\nexport function loadNoProxy(): string[] {\n const noProxy = getEnvironmentValue(NO_PROXY);\n noProxyListLoaded = true;\n if (noProxy) {\n return noProxy\n .split(\",\")\n .map((item) => item.trim())\n .filter((item) => item.length);\n }\n\n return [];\n}\n\n/**\n * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.\n * If no argument is given, it attempts to parse a proxy URL from the environment\n * variables `HTTPS_PROXY` or `HTTP_PROXY`.\n * @param proxyUrl - The url of the proxy to use. May contain authentication information.\n * @deprecated - Internally this method is no longer necessary when setting proxy information.\n */\nexport function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined {\n if (!proxyUrl) {\n proxyUrl = loadEnvironmentProxyValue();\n if (!proxyUrl) {\n return undefined;\n }\n }\n\n const parsedUrl = new URL(proxyUrl);\n const schema = parsedUrl.protocol ? parsedUrl.protocol + \"//\" : \"\";\n return {\n host: schema + parsedUrl.hostname,\n port: Number.parseInt(parsedUrl.port || \"80\"),\n username: parsedUrl.username,\n password: parsedUrl.password,\n };\n}\n\n/**\n * This method attempts to parse a proxy URL from the environment\n * variables `HTTPS_PROXY` or `HTTP_PROXY`.\n */\nfunction getDefaultProxySettingsInternal(): URL | undefined {\n const envProxy = loadEnvironmentProxyValue();\n return envProxy ? new URL(envProxy) : undefined;\n}\n\nfunction getUrlFromProxySettings(settings: ProxySettings): URL {\n let parsedProxyUrl: URL;\n try {\n parsedProxyUrl = new URL(settings.host);\n } catch {\n throw new Error(\n `Expecting a valid host string in proxy settings, but found \"${settings.host}\".`,\n );\n }\n\n parsedProxyUrl.port = String(settings.port);\n if (settings.username) {\n parsedProxyUrl.username = settings.username;\n }\n if (settings.password) {\n parsedProxyUrl.password = settings.password;\n }\n\n return parsedProxyUrl;\n}\n\nfunction setProxyAgentOnRequest(\n request: PipelineRequest,\n cachedAgents: CachedAgents,\n proxyUrl: URL,\n): void {\n // Custom Agent should take precedence so if one is present\n // we should skip to avoid overwriting it.\n if (request.agent) {\n return;\n }\n\n const url = new URL(request.url);\n\n const isInsecure = url.protocol !== \"https:\";\n\n if (request.tlsSettings) {\n logger.warning(\n \"TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.\",\n );\n }\n\n
|
|
5
|
-
"mappings": "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
|
|
3
|
+
"sources": ["../../../src/policies/proxyPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type * as http from \"http\";\nimport type * as https from \"https\";\nimport { HttpsProxyAgent } from \"https-proxy-agent\";\nimport { HttpProxyAgent } from \"http-proxy-agent\";\nimport type {\n PipelineRequest,\n PipelineResponse,\n ProxySettings,\n SendRequest,\n} from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { logger } from \"../log.js\";\n\nconst HTTPS_PROXY = \"HTTPS_PROXY\";\nconst HTTP_PROXY = \"HTTP_PROXY\";\nconst ALL_PROXY = \"ALL_PROXY\";\nconst NO_PROXY = \"NO_PROXY\";\n\n/**\n * The programmatic identifier of the proxyPolicy.\n */\nexport const proxyPolicyName = \"proxyPolicy\";\n\n/**\n * Stores the patterns specified in NO_PROXY environment variable.\n * @internal\n */\nexport const globalNoProxyList: string[] = [];\nlet noProxyListLoaded: boolean = false;\n\n/** A cache of whether a host should bypass the proxy. */\nconst globalBypassedMap: Map<string, boolean> = new Map();\n\nfunction getEnvironmentValue(name: string): string | undefined {\n if (process.env[name]) {\n return process.env[name];\n } else if (process.env[name.toLowerCase()]) {\n return process.env[name.toLowerCase()];\n }\n return undefined;\n}\n\nfunction loadEnvironmentProxyValue(): string | undefined {\n if (!process) {\n return undefined;\n }\n\n const httpsProxy = getEnvironmentValue(HTTPS_PROXY);\n const allProxy = getEnvironmentValue(ALL_PROXY);\n const httpProxy = getEnvironmentValue(HTTP_PROXY);\n\n return httpsProxy || allProxy || httpProxy;\n}\n\n/**\n * Check whether the host of a given `uri` matches any pattern in the no proxy list.\n * If there's a match, any request sent to the same host shouldn't have the proxy settings set.\n * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210\n */\nfunction isBypassed(\n uri: string,\n noProxyList: string[],\n bypassedMap?: Map<string, boolean>,\n): boolean | undefined {\n if (noProxyList.length === 0) {\n return false;\n }\n const host = new URL(uri).hostname;\n if (bypassedMap?.has(host)) {\n return bypassedMap.get(host);\n }\n let isBypassedFlag = false;\n for (const pattern of noProxyList) {\n if (pattern[0] === \".\") {\n // This should match either domain it self or any subdomain or host\n // .foo.com will match foo.com it self or *.foo.com\n if (host.endsWith(pattern)) {\n isBypassedFlag = true;\n } else {\n if (host.length === pattern.length - 1 && host === pattern.slice(1)) {\n isBypassedFlag = true;\n }\n }\n } else {\n if (host === pattern) {\n isBypassedFlag = true;\n }\n }\n }\n bypassedMap?.set(host, isBypassedFlag);\n return isBypassedFlag;\n}\n\nexport function loadNoProxy(): string[] {\n const noProxy = getEnvironmentValue(NO_PROXY);\n noProxyListLoaded = true;\n if (noProxy) {\n return noProxy\n .split(\",\")\n .map((item) => item.trim())\n .filter((item) => item.length);\n }\n\n return [];\n}\n\n/**\n * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.\n * If no argument is given, it attempts to parse a proxy URL from the environment\n * variables `HTTPS_PROXY` or `HTTP_PROXY`.\n * @param proxyUrl - The url of the proxy to use. May contain authentication information.\n * @deprecated - Internally this method is no longer necessary when setting proxy information.\n */\nexport function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined {\n if (!proxyUrl) {\n proxyUrl = loadEnvironmentProxyValue();\n if (!proxyUrl) {\n return undefined;\n }\n }\n\n const parsedUrl = new URL(proxyUrl);\n const schema = parsedUrl.protocol ? parsedUrl.protocol + \"//\" : \"\";\n return {\n host: schema + parsedUrl.hostname,\n port: Number.parseInt(parsedUrl.port || \"80\"),\n username: parsedUrl.username,\n password: parsedUrl.password,\n };\n}\n\n/**\n * This method attempts to parse a proxy URL from the environment\n * variables `HTTPS_PROXY` or `HTTP_PROXY`.\n */\nfunction getDefaultProxySettingsInternal(): URL | undefined {\n const envProxy = loadEnvironmentProxyValue();\n return envProxy ? new URL(envProxy) : undefined;\n}\n\nfunction getUrlFromProxySettings(settings: ProxySettings): URL {\n let parsedProxyUrl: URL;\n try {\n parsedProxyUrl = new URL(settings.host);\n } catch {\n throw new Error(\n `Expecting a valid host string in proxy settings, but found \"${settings.host}\".`,\n );\n }\n\n parsedProxyUrl.port = String(settings.port);\n if (settings.username) {\n parsedProxyUrl.username = settings.username;\n }\n if (settings.password) {\n parsedProxyUrl.password = settings.password;\n }\n\n return parsedProxyUrl;\n}\n\nfunction setProxyAgentOnRequest(\n request: PipelineRequest,\n cachedAgents: CachedAgents,\n proxyUrl: URL,\n): void {\n // Custom Agent should take precedence so if one is present\n // we should skip to avoid overwriting it.\n if (request.agent) {\n return;\n }\n\n const url = new URL(request.url);\n\n const isInsecure = url.protocol !== \"https:\";\n\n if (request.tlsSettings) {\n logger.warning(\n \"TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.\",\n );\n }\n\n if (isInsecure) {\n if (!cachedAgents.httpProxyAgent) {\n cachedAgents.httpProxyAgent = new HttpProxyAgent(proxyUrl);\n }\n request.agent = cachedAgents.httpProxyAgent;\n } else {\n if (!cachedAgents.httpsProxyAgent) {\n cachedAgents.httpsProxyAgent = new HttpsProxyAgent(proxyUrl);\n }\n request.agent = cachedAgents.httpsProxyAgent;\n }\n}\n\ninterface CachedAgents {\n httpsProxyAgent?: https.Agent;\n httpProxyAgent?: http.Agent;\n}\n\n/**\n * A policy that allows one to apply proxy settings to all requests.\n * If not passed static settings, they will be retrieved from the HTTPS_PROXY\n * or HTTP_PROXY environment variables.\n * @param proxySettings - ProxySettings to use on each request.\n * @param options - additional settings, for example, custom NO_PROXY patterns\n */\nexport function proxyPolicy(\n proxySettings?: ProxySettings,\n options?: {\n /** a list of patterns to override those loaded from NO_PROXY environment variable. */\n customNoProxyList?: string[];\n },\n): PipelinePolicy {\n if (!noProxyListLoaded) {\n globalNoProxyList.push(...loadNoProxy());\n }\n\n const defaultProxy = proxySettings\n ? getUrlFromProxySettings(proxySettings)\n : getDefaultProxySettingsInternal();\n\n const cachedAgents: CachedAgents = {};\n\n return {\n name: proxyPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (\n !request.proxySettings &&\n defaultProxy &&\n !isBypassed(\n request.url,\n options?.customNoProxyList ?? globalNoProxyList,\n options?.customNoProxyList ? undefined : globalBypassedMap,\n )\n ) {\n setProxyAgentOnRequest(request, cachedAgents, defaultProxy);\n } else if (request.proxySettings) {\n setProxyAgentOnRequest(\n request,\n cachedAgents,\n getUrlFromProxySettings(request.proxySettings),\n );\n }\n return next(request);\n },\n };\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/policies/redirectPolicy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { logger } from \"../log.js\";\n\n/**\n * The programmatic identifier of the redirectPolicy.\n */\nexport const redirectPolicyName = \"redirectPolicy\";\n\n/**\n * Methods that are allowed to follow redirects 301 and 302\n */\nconst allowedRedirect = [\"GET\", \"HEAD\"];\n\n/**\n * Options for how redirect responses are handled.\n */\nexport interface RedirectPolicyOptions {\n /**\n * The maximum number of times the redirect URL will be tried before\n * failing. Defaults to 20.\n */\n maxRetries?: number;\n /**\n * Whether to follow redirects to a different origin (scheme + host + port).\n * When false (the default), cross-origin redirects are not followed and the\n * redirect response is returned directly to the caller.\n * Defaults to false.\n */\n allowCrossOriginRedirects?: boolean;\n}\n\n/**\n * A policy to follow Location headers from the server in order\n * to support server-side redirection.\n * In the browser, this policy is not used.\n * @param options - Options to control policy behavior.\n */\nexport function redirectPolicy(options: RedirectPolicyOptions = {}): PipelinePolicy {\n const { maxRetries = 20, allowCrossOriginRedirects = false } = options;\n return {\n name: redirectPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const response = await next(request);\n return handleRedirect(next, response, maxRetries, allowCrossOriginRedirects);\n },\n };\n}\n\nasync function handleRedirect(\n next: SendRequest,\n response: PipelineResponse,\n maxRetries: number,\n allowCrossOriginRedirects: boolean,\n currentRetries: number = 0,\n): Promise<PipelineResponse> {\n const { request, status, headers } = response;\n const locationHeader = headers.get(\"location\");\n if (\n locationHeader &&\n (status === 300 ||\n (status === 301 && allowedRedirect.includes(request.method)) ||\n (status === 302 && allowedRedirect.includes(request.method)) ||\n (status === 303 && request.method === \"POST\") ||\n status === 307) &&\n currentRetries < maxRetries\n ) {\n const url = new URL(locationHeader, request.url);\n\n // Only follow redirects to the same origin by default.\n if (!allowCrossOriginRedirects) {\n const originalUrl = new URL(request.url);\n if (url.origin !== originalUrl.origin) {\n logger.verbose(\n `Skipping cross-origin redirect from ${originalUrl.origin} to ${url.origin}.`,\n );\n return response;\n }\n }\n\n request.url = url.toString();\n\n // POST request with Status code 303 should be converted into a\n // redirected GET request if the redirect url is present in the location header\n if (status === 303) {\n request.method = \"GET\";\n request.headers.delete(\"Content-Length\");\n delete request.body;\n }\n\n request.headers.delete(\"Authorization\");\n\n const res = await next(request);\n return handleRedirect(next, res, maxRetries, allowCrossOriginRedirects, currentRetries + 1);\n }\n\n return response;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,iBAAuB;AAKhB,MAAM,qBAAqB;AAKlC,MAAM,kBAAkB,CAAC,OAAO,MAAM;AA0B/B,SAAS,eAAe,UAAiC,CAAC,GAAmB;AAClF,QAAM,EAAE,aAAa,IAAI,4BAA4B,MAAM,IAAI;AAC/D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,YAAM,WAAW,MAAM,KAAK,OAAO;AACnC,aAAO,eAAe,MAAM,UAAU,YAAY,yBAAyB;AAAA,IAC7E;AAAA,EACF;AACF;AAEA,eAAe,eACb,MACA,UACA,YACA,2BACA,iBAAyB,GACE;AAC3B,QAAM,EAAE,SAAS,QAAQ,QAAQ,IAAI;AACrC,QAAM,iBAAiB,QAAQ,IAAI,UAAU;AAC7C,MACE,mBACC,WAAW,OACT,WAAW,OAAO,gBAAgB,SAAS,QAAQ,MAAM,KACzD,WAAW,OAAO,gBAAgB,SAAS,QAAQ,MAAM,KACzD,WAAW,OAAO,QAAQ,WAAW,UACtC,WAAW,QACb,iBAAiB,YACjB;AACA,UAAM,MAAM,IAAI,IAAI,gBAAgB,QAAQ,GAAG;AAG/C,QAAI,CAAC,2BAA2B;AAC9B,YAAM,cAAc,IAAI,IAAI,QAAQ,GAAG;AACvC,UAAI,IAAI,WAAW,YAAY,QAAQ;AACrC,0BAAO;AAAA,UACL,uCAAuC,YAAY,MAAM,OAAO,IAAI,MAAM;AAAA,QAC5E;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,YAAQ,MAAM,IAAI,SAAS;AAI3B,QAAI,WAAW,KAAK;AAClB,cAAQ,SAAS;AACjB,cAAQ,QAAQ,OAAO,gBAAgB;AACvC,aAAO,QAAQ;AAAA,IACjB;AAEA,YAAQ,QAAQ,OAAO,eAAe;AAEtC,UAAM,MAAM,MAAM,KAAK,OAAO;AAC9B,WAAO,eAAe,MAAM,KAAK,YAAY,2BAA2B,iBAAiB,CAAC;AAAA,EAC5F;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
@@ -21,6 +21,7 @@ __export(retryPolicy_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(retryPolicy_exports);
|
|
23
23
|
var import_helpers = require("../util/helpers.js");
|
|
24
|
+
var import_restError = require("../restError.js");
|
|
24
25
|
var import_AbortError = require("../abort-controller/AbortError.js");
|
|
25
26
|
var import_logger = require("../logger/logger.js");
|
|
26
27
|
var import_constants = require("../constants.js");
|
|
@@ -44,11 +45,11 @@ function retryPolicy(strategies, options = { maxRetries: import_constants.DEFAUL
|
|
|
44
45
|
logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
|
|
45
46
|
} catch (e) {
|
|
46
47
|
logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
|
|
47
|
-
|
|
48
|
-
if (!e || responseError.name !== "RestError") {
|
|
48
|
+
if (!(0, import_restError.isRestError)(e)) {
|
|
49
49
|
throw e;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
responseError = e;
|
|
52
|
+
response = e.response;
|
|
52
53
|
}
|
|
53
54
|
if (request.abortSignal?.aborted) {
|
|
54
55
|
logger.error(`Retry ${retryCount}: Request aborted.`);
|
|
@@ -123,3 +124,4 @@ function retryPolicy(strategies, options = { maxRetries: import_constants.DEFAUL
|
|
|
123
124
|
0 && (module.exports = {
|
|
124
125
|
retryPolicy
|
|
125
126
|
});
|
|
127
|
+
//# sourceMappingURL=retryPolicy.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { delay } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"../retryStrategies/retryStrategy.js\";\nimport type { RestError } from \"../restError.js\";\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { createClientLogger } from \"../logger/logger.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nconst retryPolicyLogger = createClientLogger(\"ts-http-runtime retryPolicy\");\n\n/**\n * The programmatic identifier of the retryPolicy.\n */\nconst retryPolicyName = \"retryPolicy\";\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: TypeSpecRuntimeLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n const logger = options.logger || retryPolicyLogger;\n return {\n name: retryPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n let response: PipelineResponse | undefined;\n let responseError: RestError | undefined;\n let retryCount = -1;\n\n retryRequest: while (true) {\n retryCount += 1;\n response = undefined;\n responseError = undefined;\n\n try {\n logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);\n response = await next(request);\n logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);\n } catch (e
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAAsB;AAGtB,wBAA2B;AAE3B,oBAAmC;AACnC,uBAA2C;AAE3C,MAAM,wBAAoB,kCAAmB,6BAA6B;AAK1E,MAAM,kBAAkB;AAmBjB,SAAS,YACd,YACA,UAA8B,EAAE,YAAY,4CAA2B,GACvD;AAChB,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI;AACJ,UAAI;AACJ,UAAI,aAAa;AAEjB,mBAAc,QAAO,MAAM;AACzB,sBAAc;AACd,mBAAW;AACX,wBAAgB;AAEhB,YAAI;AACF,iBAAO,KAAK,SAAS,UAAU,gCAAgC,QAAQ,SAAS;AAChF,qBAAW,MAAM,KAAK,OAAO;AAC7B,iBAAO,KAAK,SAAS,UAAU,sCAAsC,QAAQ,SAAS;AAAA,QACxF,SAAS,
|
|
3
|
+
"sources": ["../../../src/policies/retryPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { delay } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"../retryStrategies/retryStrategy.js\";\nimport type { RestError } from \"../restError.js\";\nimport { isRestError } from \"../restError.js\";\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { createClientLogger } from \"../logger/logger.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nconst retryPolicyLogger = createClientLogger(\"ts-http-runtime retryPolicy\");\n\n/**\n * The programmatic identifier of the retryPolicy.\n */\nconst retryPolicyName = \"retryPolicy\";\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: TypeSpecRuntimeLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n const logger = options.logger || retryPolicyLogger;\n return {\n name: retryPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n let response: PipelineResponse | undefined;\n let responseError: RestError | undefined;\n let retryCount = -1;\n\n retryRequest: while (true) {\n retryCount += 1;\n response = undefined;\n responseError = undefined;\n\n try {\n logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);\n response = await next(request);\n logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);\n } catch (e) {\n logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);\n\n // RestErrors are valid targets for the retry strategies.\n // If none of the retry strategies can work with them, they will be thrown later in this policy.\n // If the received error is not a RestError, it is immediately thrown.\n if (!isRestError(e)) {\n throw e;\n }\n\n responseError = e;\n response = e.response;\n }\n\n if (request.abortSignal?.aborted) {\n logger.error(`Retry ${retryCount}: Request aborted.`);\n const abortError = new AbortError();\n throw abortError;\n }\n\n if (retryCount >= (options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT)) {\n logger.info(\n `Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`,\n );\n if (responseError) {\n throw responseError;\n } else if (response) {\n return response;\n } else {\n throw new Error(\"Maximum retries reached with no response or error to throw\");\n }\n }\n\n logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);\n\n strategiesLoop: for (const strategy of strategies) {\n const strategyLogger = strategy.logger || logger;\n strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);\n\n const modifiers = strategy.retry({\n retryCount,\n response,\n responseError,\n });\n\n if (modifiers.skipStrategy) {\n strategyLogger.info(`Retry ${retryCount}: Skipped.`);\n continue strategiesLoop;\n }\n\n const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;\n\n if (errorToThrow) {\n strategyLogger.error(\n `Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`,\n errorToThrow,\n );\n throw errorToThrow;\n }\n\n if (retryAfterInMs || retryAfterInMs === 0) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`,\n );\n await delay(retryAfterInMs, undefined, { abortSignal: request.abortSignal });\n continue retryRequest;\n }\n\n if (redirectTo) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`,\n );\n request.url = redirectTo;\n continue retryRequest;\n }\n }\n\n if (responseError) {\n logger.info(\n `None of the retry strategies could work with the received error. Throwing it.`,\n );\n throw responseError;\n }\n if (response) {\n logger.info(\n `None of the retry strategies could work with the received response. Returning it.`,\n );\n return response;\n }\n\n // If all the retries skip and there's no response,\n // we're still in the retry loop, so a new request will be sent\n // until `maxRetries` is reached.\n }\n },\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAAsB;AAGtB,uBAA4B;AAC5B,wBAA2B;AAE3B,oBAAmC;AACnC,uBAA2C;AAE3C,MAAM,wBAAoB,kCAAmB,6BAA6B;AAK1E,MAAM,kBAAkB;AAmBjB,SAAS,YACd,YACA,UAA8B,EAAE,YAAY,4CAA2B,GACvD;AAChB,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI;AACJ,UAAI;AACJ,UAAI,aAAa;AAEjB,mBAAc,QAAO,MAAM;AACzB,sBAAc;AACd,mBAAW;AACX,wBAAgB;AAEhB,YAAI;AACF,iBAAO,KAAK,SAAS,UAAU,gCAAgC,QAAQ,SAAS;AAChF,qBAAW,MAAM,KAAK,OAAO;AAC7B,iBAAO,KAAK,SAAS,UAAU,sCAAsC,QAAQ,SAAS;AAAA,QACxF,SAAS,GAAG;AACV,iBAAO,MAAM,SAAS,UAAU,oCAAoC,QAAQ,SAAS;AAKrF,cAAI,KAAC,8BAAY,CAAC,GAAG;AACnB,kBAAM;AAAA,UACR;AAEA,0BAAgB;AAChB,qBAAW,EAAE;AAAA,QACf;AAEA,YAAI,QAAQ,aAAa,SAAS;AAChC,iBAAO,MAAM,SAAS,UAAU,oBAAoB;AACpD,gBAAM,aAAa,IAAI,6BAAW;AAClC,gBAAM;AAAA,QACR;AAEA,YAAI,eAAe,QAAQ,cAAc,8CAA6B;AACpE,iBAAO;AAAA,YACL,SAAS,UAAU;AAAA,UACrB;AACA,cAAI,eAAe;AACjB,kBAAM;AAAA,UACR,WAAW,UAAU;AACnB,mBAAO;AAAA,UACT,OAAO;AACL,kBAAM,IAAI,MAAM,4DAA4D;AAAA,UAC9E;AAAA,QACF;AAEA,eAAO,KAAK,SAAS,UAAU,gBAAgB,WAAW,MAAM,oBAAoB;AAEpF,uBAAgB,YAAW,YAAY,YAAY;AACjD,gBAAM,iBAAiB,SAAS,UAAU;AAC1C,yBAAe,KAAK,SAAS,UAAU,+BAA+B,SAAS,IAAI,GAAG;AAEtF,gBAAM,YAAY,SAAS,MAAM;AAAA,YAC/B;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAED,cAAI,UAAU,cAAc;AAC1B,2BAAe,KAAK,SAAS,UAAU,YAAY;AACnD,qBAAS;AAAA,UACX;AAEA,gBAAM,EAAE,cAAc,gBAAgB,WAAW,IAAI;AAErD,cAAI,cAAc;AAChB,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI;AAAA,cACpD;AAAA,YACF;AACA,kBAAM;AAAA,UACR;AAEA,cAAI,kBAAkB,mBAAmB,GAAG;AAC1C,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI,kBAAkB,cAAc;AAAA,YACtF;AACA,sBAAM,sBAAM,gBAAgB,QAAW,EAAE,aAAa,QAAQ,YAAY,CAAC;AAC3E,qBAAS;AAAA,UACX;AAEA,cAAI,YAAY;AACd,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI,iBAAiB,UAAU;AAAA,YACjF;AACA,oBAAQ,MAAM;AACd,qBAAS;AAAA,UACX;AAAA,QACF;AAEA,YAAI,eAAe;AACjB,iBAAO;AAAA,YACL;AAAA,UACF;AACA,gBAAM;AAAA,QACR;AACA,YAAI,UAAU;AACZ,iBAAO;AAAA,YACL;AAAA,UACF;AACA,iBAAO;AAAA,QACT;AAAA,MAKF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/policies/systemErrorRetryPolicy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { exponentialRetryStrategy } from \"../retryStrategies/exponentialRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link systemErrorRetryPolicy}\n */\nexport const systemErrorRetryPolicyName = \"systemErrorRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface SystemErrorRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second.) The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * A retry policy that specifically seeks to handle errors in the\n * underlying transport layer (e.g. DNS lookup failures) rather than\n * retryable error codes from the server itself.\n * @param options - Options that customize the policy.\n */\nexport function systemErrorRetryPolicy(\n options: SystemErrorRetryPolicyOptions = {},\n): PipelinePolicy {\n return {\n name: systemErrorRetryPolicyName,\n sendRequest: retryPolicy(\n [\n exponentialRetryStrategy({\n ...options,\n ignoreHttpStatusCodes: true,\n }),\n ],\n {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n },\n ).sendRequest,\n };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sCAAyC;AACzC,yBAA4B;AAC5B,uBAA2C;AAKpC,MAAM,6BAA6B;AA+BnC,SAAS,uBACd,UAAyC,CAAC,GAC1B;AAChB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAa;AAAA,MACX;AAAA,YACE,0DAAyB;AAAA,UACvB,GAAG;AAAA,UACH,uBAAuB;AAAA,QACzB,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE,YAAY,QAAQ,cAAc;AAAA,MACpC;AAAA,IACF,EAAE;AAAA,EACJ;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/policies/throttlingRetryPolicy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { throttlingRetryStrategy } from \"../retryStrategies/throttlingRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link throttlingRetryPolicy}\n */\nexport const throttlingRetryPolicyName = \"throttlingRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface ThrottlingRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy that retries when the server sends a 429 response with a Retry-After header.\n *\n * To learn more, please refer to\n * https://learn.microsoft.com/azure/azure-resource-manager/resource-manager-request-limits,\n * https://learn.microsoft.com/azure/azure-subscription-service-limits and\n * https://learn.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qCAAwC;AACxC,yBAA4B;AAC5B,uBAA2C;AAKpC,MAAM,4BAA4B;AAsBlC,SAAS,sBAAsB,UAAwC,CAAC,GAAmB;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAa,gCAAY,KAAC,wDAAwB,CAAC,GAAG;AAAA,MACpD,YAAY,QAAQ,cAAc;AAAA,IACpC,CAAC,EAAE;AAAA,EACL;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/policies/tlsPolicy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport type { TlsSettings } from \"../interfaces.js\";\n\n/**\n * Name of the TLS Policy\n */\nexport const tlsPolicyName = \"tlsPolicy\";\n\n/**\n * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.\n */\nexport function tlsPolicy(tlsSettings?: TlsSettings): PipelinePolicy {\n return {\n name: tlsPolicyName,\n sendRequest: async (req, next) => {\n // Users may define a request tlsSettings, honor those over the client level one\n if (!req.tlsSettings) {\n req.tlsSettings = tlsSettings;\n }\n return next(req);\n },\n };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,MAAM,gBAAgB;AAKtB,SAAS,UAAU,aAA2C;AACnE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa,OAAO,KAAK,SAAS;AAEhC,UAAI,CAAC,IAAI,aAAa;AACpB,YAAI,cAAc;AAAA,MACpB;AACA,aAAO,KAAK,GAAG;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/policies/userAgentPolicy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { getUserAgentHeaderName, getUserAgentValue } from \"../util/userAgent.js\";\n\nconst UserAgentHeaderName = getUserAgentHeaderName();\n\n/**\n * The programmatic identifier of the userAgentPolicy.\n */\nexport const userAgentPolicyName = \"userAgentPolicy\";\n\n/**\n * Options for adding user agent details to outgoing requests.\n */\nexport interface UserAgentPolicyOptions {\n /**\n * String prefix to add to the user agent for outgoing requests.\n * Defaults to an empty string.\n */\n userAgentPrefix?: string;\n}\n\n/**\n * A policy that sets the User-Agent header (or equivalent) to reflect\n * the library version.\n * @param options - Options to customize the user agent value.\n */\nexport function userAgentPolicy(options: UserAgentPolicyOptions = {}): PipelinePolicy {\n const userAgentValue = getUserAgentValue(options.userAgentPrefix);\n return {\n name: userAgentPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (!request.headers.has(UserAgentHeaderName)) {\n request.headers.set(UserAgentHeaderName, await userAgentValue);\n }\n return next(request);\n },\n };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,uBAA0D;AAE1D,MAAM,0BAAsB,yCAAuB;AAK5C,MAAM,sBAAsB;AAkB5B,SAAS,gBAAgB,UAAkC,CAAC,GAAmB;AACpF,QAAM,qBAAiB,oCAAkB,QAAQ,eAAe;AAChE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI,CAAC,QAAQ,QAAQ,IAAI,mBAAmB,GAAG;AAC7C,gBAAQ,QAAQ,IAAI,qBAAqB,MAAM,cAAc;AAAA,MAC/D;AACA,aAAO,KAAK,OAAO;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../src/restError.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"./util/error.js\";\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\nimport { custom } from \"./util/inspect.js\";\nimport { Sanitizer } from \"./util/sanitizer.js\";\n\nconst errorSanitizer = new Sanitizer();\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n this.name = \"RestError\";\n this.code = options.code;\n this.statusCode = options.statusCode;\n\n // The request and response may contain sensitive information in the headers or body.\n // To help prevent this sensitive information being accidentally logged, the request and response\n // properties are marked as non-enumerable here. This prevents them showing up in the output of\n // JSON.stringify and console.log.\n Object.defineProperty(this, \"request\", { value: options.request, enumerable: false });\n Object.defineProperty(this, \"response\", { value: options.response, enumerable: false });\n\n // Only include useful agent information in the request for logging, as the full agent object\n // may contain large binary data.\n const agent = this.request?.agent\n ? {\n maxFreeSockets: this.request.agent.maxFreeSockets,\n maxSockets: this.request.agent.maxSockets,\n }\n : undefined;\n\n // Logging method for util.inspect in Node\n Object.defineProperty(this, custom, {\n value: () => {\n // Extract non-enumerable properties and add them back. This is OK since in this output the request and\n // response get sanitized.\n return `RestError: ${this.message} \\n ${errorSanitizer.sanitize({\n ...this,\n request: { ...this.request, agent },\n response: this.response,\n })}`;\n },\n enumerable: false,\n });\n\n Object.setPrototypeOf(this, RestError.prototype);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n if (e instanceof RestError) {\n return true;\n }\n return isError(e) && e.name === \"RestError\";\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAwB;AAExB,qBAAuB;AACvB,uBAA0B;AAE1B,MAAM,iBAAiB,IAAI,2BAAU;AA2B9B,MAAM,kBAAkB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,OAAgB,qBAA6B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,OAAgB,cAAsB;AAAA;AAAA;AAAA;AAAA,EAK/B;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA,EAEP,YAAY,SAAiB,UAA4B,CAAC,GAAG;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,aAAa,QAAQ;AAM1B,WAAO,eAAe,MAAM,WAAW,EAAE,OAAO,QAAQ,SAAS,YAAY,MAAM,CAAC;AACpF,WAAO,eAAe,MAAM,YAAY,EAAE,OAAO,QAAQ,UAAU,YAAY,MAAM,CAAC;AAItF,UAAM,QAAQ,KAAK,SAAS,QACxB;AAAA,MACE,gBAAgB,KAAK,QAAQ,MAAM;AAAA,MACnC,YAAY,KAAK,QAAQ,MAAM;AAAA,IACjC,IACA;AAGJ,WAAO,eAAe,MAAM,uBAAQ;AAAA,MAClC,OAAO,MAAM;AAGX,eAAO,cAAc,KAAK,OAAO;AAAA,GAAO,eAAe,SAAS;AAAA,UAC9D,GAAG;AAAA,UACH,SAAS,EAAE,GAAG,KAAK,SAAS,MAAM;AAAA,UAClC,UAAU,KAAK;AAAA,QACjB,CAAC,CAAC;AAAA,MACJ;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAED,WAAO,eAAe,MAAM,UAAU,SAAS;AAAA,EACjD;AACF;AAMO,SAAS,YAAY,GAA4B;AACtD,MAAI,aAAa,WAAW;AAC1B,WAAO;AAAA,EACT;AACA,aAAO,sBAAQ,CAAC,KAAK,EAAE,SAAS;AAClC;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/retryStrategies/exponentialRetryStrategy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\nimport { calculateRetryDelay } from \"../util/delay.js\";\nimport type { RetryStrategy } from \"./retryStrategy.js\";\nimport { isThrottlingRetryResponse } from \"./throttlingRetryStrategy.js\";\n\n// intervals are in milliseconds\nconst DEFAULT_CLIENT_RETRY_INTERVAL = 1000;\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n/**\n * A retry strategy that retries with an exponentially increasing delay in these two cases:\n * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).\n * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).\n */\nexport function exponentialRetryStrategy(\n options: {\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second.) The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n\n /**\n * If true it won't retry if it received a system error.\n */\n ignoreSystemErrors?: boolean;\n\n /**\n * If true it won't retry if it received a non-fatal HTTP status code.\n */\n ignoreHttpStatusCodes?: boolean;\n } = {},\n): RetryStrategy {\n const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL;\n const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL;\n\n return {\n name: \"exponentialRetryStrategy\",\n retry({ retryCount, response, responseError }) {\n const matchedSystemError = isSystemError(responseError);\n const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;\n\n const isExponential = isExponentialRetryResponse(response);\n const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;\n const unknownResponse = response && (isThrottlingRetryResponse(response) || !isExponential);\n\n if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {\n return { skipStrategy: true };\n }\n\n if (responseError && !matchedSystemError && !isExponential) {\n return { errorToThrow: responseError };\n }\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: retryInterval,\n maxRetryDelayInMs: maxRetryInterval,\n });\n },\n };\n}\n\n/**\n * A response is a retry response if it has status codes:\n * - 408, or\n * - Greater or equal than 500, except for 501 and 505.\n */\nexport function isExponentialRetryResponse(response?: PipelineResponse): boolean {\n return Boolean(\n response &&\n response.status !== undefined &&\n (response.status >= 500 || response.status === 408) &&\n response.status !== 501 &&\n response.status !== 505,\n );\n}\n\n/**\n * Determines whether an error from a pipeline response was triggered in the network layer.\n */\nexport function isSystemError(err?: RestError): boolean {\n if (!err) {\n return false;\n }\n return (\n err.code === \"ETIMEDOUT\" ||\n err.code === \"ESOCKETTIMEDOUT\" ||\n err.code === \"ECONNREFUSED\" ||\n err.code === \"ECONNRESET\" ||\n err.code === \"ENOENT\" ||\n err.code === \"ENOTFOUND\"\n );\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAoC;AAEpC,qCAA0C;AAG1C,MAAM,gCAAgC;AACtC,MAAM,oCAAoC,MAAO;AAO1C,SAAS,yBACd,UAuBI,CAAC,GACU;AACf,QAAM,gBAAgB,QAAQ,kBAAkB;AAChD,QAAM,mBAAmB,QAAQ,qBAAqB;AAEtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,YAAY,UAAU,cAAc,GAAG;AAC7C,YAAM,qBAAqB,cAAc,aAAa;AACtD,YAAM,qBAAqB,sBAAsB,QAAQ;AAEzD,YAAM,gBAAgB,2BAA2B,QAAQ;AACzD,YAAM,4BAA4B,iBAAiB,QAAQ;AAC3D,YAAM,kBAAkB,iBAAa,0DAA0B,QAAQ,KAAK,CAAC;AAE7E,UAAI,mBAAmB,6BAA6B,oBAAoB;AACtE,eAAO,EAAE,cAAc,KAAK;AAAA,MAC9B;AAEA,UAAI,iBAAiB,CAAC,sBAAsB,CAAC,eAAe;AAC1D,eAAO,EAAE,cAAc,cAAc;AAAA,MACvC;AAEA,iBAAO,kCAAoB,YAAY;AAAA,QACrC,gBAAgB;AAAA,QAChB,mBAAmB;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAOO,SAAS,2BAA2B,UAAsC;AAC/E,SAAO;AAAA,IACL,YACA,SAAS,WAAW,WACnB,SAAS,UAAU,OAAO,SAAS,WAAW,QAC/C,SAAS,WAAW,OACpB,SAAS,WAAW;AAAA,EACtB;AACF;AAKO,SAAS,cAAc,KAA0B;AACtD,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,SACE,IAAI,SAAS,eACb,IAAI,SAAS,qBACb,IAAI,SAAS,kBACb,IAAI,SAAS,gBACb,IAAI,SAAS,YACb,IAAI,SAAS;AAEjB;",
|
|
6
6
|
"names": []
|
|
@@ -13,3 +13,4 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
14
|
var retryStrategy_exports = {};
|
|
15
15
|
module.exports = __toCommonJS(retryStrategy_exports);
|
|
16
|
+
//# sourceMappingURL=retryStrategy.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/retryStrategies/retryStrategy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\n\n/**\n * Information provided to the retry strategy about the current progress of the retry policy.\n */\nexport interface RetryInformation {\n /**\n * A {@link PipelineResponse}, if the last retry attempt succeeded.\n */\n response?: PipelineResponse;\n /**\n * A {@link RestError}, if the last retry attempt failed.\n */\n responseError?: RestError;\n /**\n * Total number of retries so far.\n */\n retryCount: number;\n}\n\n/**\n * Properties that can modify the behavior of the retry policy.\n */\nexport interface RetryModifiers {\n /**\n * If true, allows skipping the current strategy from running on the retry policy.\n */\n skipStrategy?: boolean;\n /**\n * Indicates to retry against this URL.\n */\n redirectTo?: string;\n /**\n * Controls whether to retry in a given number of milliseconds.\n * If provided, a new retry will be attempted.\n */\n retryAfterInMs?: number;\n /**\n * Indicates to throw this error instead of retrying.\n */\n errorToThrow?: RestError;\n}\n\n/**\n * A retry strategy is intended to define whether to retry or not, and how to retry.\n */\nexport interface RetryStrategy {\n /**\n * Name of the retry strategy. Used for logging.\n */\n name: string;\n /**\n * Logger. If it's not provided, a default logger for all retry strategies is used.\n */\n logger?: TypeSpecRuntimeLogger;\n /**\n * Function that determines how to proceed with the subsequent requests.\n * @param state - Retry state\n */\n retry(state: RetryInformation): RetryModifiers;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/retryStrategies/throttlingRetryStrategy.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport { parseHeaderValueAsNumber } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"./retryStrategy.js\";\n\n/**\n * The header that comes back from services representing\n * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry).\n */\nconst RetryAfterHeader = \"Retry-After\";\n/**\n * The headers that come back from services representing\n * the amount of time (minimum) to wait to retry.\n *\n * \"retry-after-ms\", \"x-ms-retry-after-ms\" : milliseconds\n * \"Retry-After\" : seconds or timestamp\n */\nconst AllRetryAfterHeaders: string[] = [\"retry-after-ms\", \"x-ms-retry-after-ms\", RetryAfterHeader];\n\n/**\n * A response is a throttling retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n *\n * Returns the `retryAfterInMs` value if the response is a throttling retry response.\n * If not throttling retry response, returns `undefined`.\n *\n * @internal\n */\nfunction getRetryAfterInMs(response?: PipelineResponse): number | undefined {\n if (!(response && [429, 503].includes(response.status))) return undefined;\n try {\n // Headers: \"retry-after-ms\", \"x-ms-retry-after-ms\", \"Retry-After\"\n for (const header of AllRetryAfterHeaders) {\n const retryAfterValue = parseHeaderValueAsNumber(response, header);\n if (retryAfterValue === 0 || retryAfterValue) {\n // \"Retry-After\" header ==> seconds\n // \"retry-after-ms\", \"x-ms-retry-after-ms\" headers ==> milli-seconds\n const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1;\n return retryAfterValue * multiplyingFactor; // in milli-seconds\n }\n }\n\n // RetryAfterHeader (\"Retry-After\") has a special case where it might be formatted as a date instead of a number of seconds\n const retryAfterHeader = response.headers.get(RetryAfterHeader);\n if (!retryAfterHeader) return;\n\n const date = Date.parse(retryAfterHeader);\n const diff = date - Date.now();\n // negative diff would mean a date in the past, so retry asap with 0 milliseconds\n return Number.isFinite(diff) ? Math.max(0, diff) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * A response is a retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n */\nexport function isThrottlingRetryResponse(response?: PipelineResponse): boolean {\n return Number.isFinite(getRetryAfterInMs(response));\n}\n\nexport function throttlingRetryStrategy(): RetryStrategy {\n return {\n name: \"throttlingRetryStrategy\",\n retry({ response }) {\n const retryAfterInMs = getRetryAfterInMs(response);\n if (!Number.isFinite(retryAfterInMs)) {\n return { skipStrategy: true };\n }\n return {\n retryAfterInMs,\n };\n },\n };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAAyC;AAOzC,MAAM,mBAAmB;AAQzB,MAAM,uBAAiC,CAAC,kBAAkB,uBAAuB,gBAAgB;AAWjG,SAAS,kBAAkB,UAAiD;AAC1E,MAAI,EAAE,YAAY,CAAC,KAAK,GAAG,EAAE,SAAS,SAAS,MAAM,GAAI,QAAO;AAChE,MAAI;AAEF,eAAW,UAAU,sBAAsB;AACzC,YAAM,sBAAkB,yCAAyB,UAAU,MAAM;AACjE,UAAI,oBAAoB,KAAK,iBAAiB;AAG5C,cAAM,oBAAoB,WAAW,mBAAmB,MAAO;AAC/D,eAAO,kBAAkB;AAAA,MAC3B;AAAA,IACF;AAGA,UAAM,mBAAmB,SAAS,QAAQ,IAAI,gBAAgB;AAC9D,QAAI,CAAC,iBAAkB;AAEvB,UAAM,OAAO,KAAK,MAAM,gBAAgB;AACxC,UAAM,OAAO,OAAO,KAAK,IAAI;AAE7B,WAAO,OAAO,SAAS,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,IAAI;AAAA,EACrD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,0BAA0B,UAAsC;AAC9E,SAAO,OAAO,SAAS,kBAAkB,QAAQ,CAAC;AACpD;AAEO,SAAS,0BAAyC;AACvD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,SAAS,GAAG;AAClB,YAAM,iBAAiB,kBAAkB,QAAQ;AACjD,UAAI,CAAC,OAAO,SAAS,cAAc,GAAG;AACpC,eAAO,EAAE,cAAc,KAAK;AAAA,MAC9B;AACA,aAAO;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/arrayBuffer.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Converts an ArrayBufferView to an ArrayBuffer.\n * @param source - The source ArrayBufferView.\n * @returns The resulting ArrayBuffer.\n */\nexport function arrayBufferViewToArrayBuffer(source: ArrayBufferView): ArrayBuffer {\n if (\n source.buffer instanceof ArrayBuffer &&\n source.byteOffset === 0 &&\n source.byteLength === source.buffer.byteLength\n ) {\n return source.buffer;\n }\n\n const arrayBuffer = new ArrayBuffer(source.byteLength);\n const view = new Uint8Array(arrayBuffer);\n const sourceView = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n view.set(sourceView);\n return view.buffer;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,6BAA6B,QAAsC;AACjF,MACE,OAAO,kBAAkB,eACzB,OAAO,eAAe,KACtB,OAAO,eAAe,OAAO,OAAO,YACpC;AACA,WAAO,OAAO;AAAA,EAChB;AAEA,QAAM,cAAc,IAAI,YAAY,OAAO,UAAU;AACrD,QAAM,OAAO,IAAI,WAAW,WAAW;AACvC,QAAM,aAAa,IAAI,WAAW,OAAO,QAAQ,OAAO,YAAY,OAAO,UAAU;AACrF,OAAK,IAAI,UAAU;AACnB,SAAO,KAAK;AACd;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/bytesEncoding.common.ts"],
|
|
4
4
|
"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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,SAAS,mBAAmB,OAAmB,QAA8B;AAClF,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,uBAAuB,KAAK;AAAA,IACrC,KAAK;AACH,aAAO,mBAAmB,KAAK;AAAA,IACjC,KAAK;AACH,aAAO,sBAAsB,KAAK;AAAA,IACpC,KAAK;AACH,aAAO,sBAAsB,KAAK;AAAA,EACtC;AACF;AAQO,SAAS,mBAAmB,OAAe,QAAkC;AAClF,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,uBAAuB,KAAK;AAAA,IACrC,KAAK;AACH,aAAO,mBAAmB,KAAK;AAAA,IACjC,KAAK;AACH,aAAO,sBAAsB,KAAK;AAAA,IACpC,KAAK;AACH,aAAO,sBAAsB,KAAK;AAAA,EACtC;AACF;AAMO,SAAS,mBAAmB,OAA2B;AAC5D,SAAO,KAAK,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACpE;AAMO,SAAS,sBAAsB,OAA2B;AAC/D,SAAO,mBAAmB,KAAK,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,MAAM,EAAE;AAC3F;AAMO,SAAS,uBAAuB,OAA2B;AAChE,QAAM,UAAU,IAAI,YAAY;AAChC,QAAM,aAAa,QAAQ,OAAO,KAAK;AACvC,SAAO;AACT;AAMO,SAAS,sBAAsB,OAA2B;AAC/D,SAAO,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AACvE;AAMO,SAAS,uBAAuB,OAA2B;AAChE,SAAO,IAAI,YAAY,EAAE,OAAO,KAAK;AACvC;AAMO,SAAS,mBAAmB,OAA2B;AAC5D,SAAO,IAAI,WAAW,CAAC,GAAG,KAAK,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE;AAMO,SAAS,sBAAsB,OAA2B;AAC/D,QAAM,eAAe,MAAM,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AAC/D,SAAO,mBAAmB,YAAY;AACxC;AAEA,MAAM,YAAY,IAAI,IAAI,wBAAwB;AAM3C,SAAS,sBAAsB,OAA2B;AAE/D,QAAM,QAAQ,IAAI,WAAW,MAAM,SAAS,CAAC;AAC7C,WAAS,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,EAAE,GAAG;AACzC,UAAM,aAAa,MAAM,IAAI,CAAC;AAC9B,UAAM,YAAY,MAAM,IAAI,IAAI,CAAC;AACjC,QAAI,CAAC,UAAU,IAAI,UAAU,KAAK,CAAC,UAAU,IAAI,SAAS,GAAG;AAE3D,aAAO,MAAM,MAAM,GAAG,CAAC;AAAA,IACzB;AAEA,UAAM,CAAC,IAAI,SAAS,GAAG,UAAU,GAAG,SAAS,IAAI,EAAE;AAAA,EACrD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/bytesEncoding.ts"],
|
|
4
4
|
"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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,mBAAmB,OAAmB,QAA8B;AAClF,SAAO,OAAO,KAAK,KAAK,EAAE,SAAS,MAAM;AAC3C;AAQO,SAAS,mBAAmB,OAAe,QAAkC;AAClF,SAAO,OAAO,KAAK,OAAO,MAAM;AAClC;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/checkEnvironment.ts"],
|
|
4
4
|
"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 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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCO,MAAM,YAAY,OAAO,WAAW,eAAe,OAAO,OAAO,aAAa;AAK9E,MAAM,cACX,OAAO,SAAS,YAChB,OAAO,MAAM,kBAAkB,eAC9B,KAAK,aAAa,SAAS,gCAC1B,KAAK,aAAa,SAAS,8BAC3B,KAAK,aAAa,SAAS;AAKxB,MAAM,SACX,OAAO,SAAS,eAChB,OAAO,KAAK,YAAY,eACxB,OAAO,KAAK,QAAQ,SAAS;AAKxB,MAAM,QAAQ,OAAO,QAAQ,eAAe,OAAO,IAAI,YAAY;AAKnE,MAAM,aACX,OAAO,WAAW,YAAY,eAC9B,QAAQ,WAAW,QAAQ,OAAO,KAClC,QAAQ,WAAW,QAAQ,UAAU,IAAI;AAKpC,MAAM,gBAAgB,cAAc,CAAC,SAAS,CAAC;AAM/C,MAAM,gBACX,OAAO,cAAc,eAAe,WAAW,YAAY;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/concat.ts"],
|
|
4
4
|
"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\";\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 ensureNodeStream(source.stream());\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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAyB;AAEzB,wBAAuB;AAEvB,gBAAgB,sBAEqB;AACnC,QAAM,SAAS,KAAK,UAAU;AAC9B,MAAI;AACF,WAAO,MAAM;AACX,YAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,UAAI,MAAM;AACR;AAAA,MACF;AAEA,YAAM;AAAA,IACR;AAAA,EACF,UAAE;AACA,WAAO,YAAY;AAAA,EACrB;AACF;AAEA,SAAS,kBAAqB,WAAqE;AACjG,MAAI,CAAC,UAAU,OAAO,aAAa,GAAG;AACpC,cAAU,OAAO,aAAa,IAAI,oBAAoB,KAAK,SAAS;AAAA,EACtE;AAEA,MAAI,CAAC,UAAU,QAAQ;AACrB,cAAU,SAAS,oBAAoB,KAAK,SAAS;AAAA,EACvD;AACF;AAEA,SAAS,iBACP,QACuB;AACvB,MAAI,kBAAkB,gBAAgB;AACpC,sBAA8B,MAAM;AACpC,WAAO,uBAAS,QAAQ,MAAM;AAAA,EAChC,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SACP,QACuB;AACvB,MAAI,kBAAkB,YAAY;AAChC,WAAO,uBAAS,KAAK,OAAO,KAAK,MAAM,CAAC;AAAA,EAC1C,eAAW,0BAAO,MAAM,GAAG;AACzB,WAAO,iBAAiB,OAAO,OAAO,CAAC;AAAA,EACzC,OAAO;AACL,WAAO,iBAAiB,MAAM;AAAA,EAChC;AACF;AAkBA,eAAsB,OACpB,SAC+C;AAC/C,SAAO,WAAY;AACjB,UAAM,UAAU,QAAQ,IAAI,CAAC,MAAO,OAAO,MAAM,aAAa,EAAE,IAAI,CAAE,EAAE,IAAI,QAAQ;AAEpF,WAAO,uBAAS;AAAA,OACb,mBAAmB;AAClB,mBAAW,UAAU,SAAoC;AACvD,2BAAiB,SAAS,QAAQ;AAChC,kBAAM;AAAA,UACR;AAAA,QACF;AAAA,MACF,GAAG;AAAA,IACL;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/delay.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { getRandomIntegerInclusive } from \"./random.js\";\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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA0C;AAQnC,SAAS,oBACd,cACA,QAI4B;AAE5B,QAAM,mBAAmB,OAAO,iBAAiB,KAAK,IAAI,GAAG,YAAY;AAGzE,QAAM,eAAe,KAAK,IAAI,OAAO,mBAAmB,gBAAgB;AAIxE,QAAM,iBAAiB,eAAe,QAAI,yCAA0B,GAAG,eAAe,CAAC;AAEvF,SAAO,EAAE,eAAe;AAC1B;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/error.ts"],
|
|
4
4
|
"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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAyB;AAMlB,SAAS,QAAQ,GAAwB;AAC9C,UAAI,wBAAS,CAAC,GAAG;AACf,UAAM,UAAU,OAAO,EAAE,SAAS;AAClC,UAAM,aAAa,OAAO,EAAE,YAAY;AACxC,WAAO,WAAW;AAAA,EACpB;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/helpers.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { PipelineResponse } from \"../interfaces.js\";\n\nconst StandardAbortMessage = \"The operation was aborted.\";\n\n/**\n * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.\n * @param delayInMs - The number of milliseconds to be delayed.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n * @param options - The options for delay - currently abort options\n * - abortSignal - The abortSignal associated with containing operation.\n * - abortErrorMsg - The abort error message associated with containing operation.\n * @returns Resolved promise\n */\nexport function delay<T>(\n delayInMs: number,\n value?: T,\n options?: {\n abortSignal?: AbortSignal;\n abortErrorMsg?: string;\n },\n): Promise<T | void> {\n return new Promise((resolve, reject) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n let onAborted: (() => void) | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n return reject(\n new AbortError(options?.abortErrorMsg ? options?.abortErrorMsg : StandardAbortMessage),\n );\n };\n\n const removeListeners = (): void => {\n if (options?.abortSignal && onAborted) {\n options.abortSignal.removeEventListener(\"abort\", onAborted);\n }\n };\n\n onAborted = (): void => {\n if (timer) {\n clearTimeout(timer);\n }\n removeListeners();\n return rejectOnAbort();\n };\n\n if (options?.abortSignal && options.abortSignal.aborted) {\n return rejectOnAbort();\n }\n\n timer = setTimeout(() => {\n removeListeners();\n resolve(value);\n }, delayInMs);\n\n if (options?.abortSignal) {\n options.abortSignal.addEventListener(\"abort\", onAborted);\n }\n });\n}\n\n/**\n * @internal\n * @returns the parsed value or undefined if the parsed value is invalid.\n */\nexport function parseHeaderValueAsNumber(\n response: PipelineResponse,\n headerName: string,\n): number | undefined {\n const value = response.headers.get(headerName);\n if (!value) return;\n const valueAsNum = Number(value);\n if (Number.isNaN(valueAsNum)) return;\n return valueAsNum;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2B;AAG3B,MAAM,uBAAuB;AAWtB,SAAS,MACd,WACA,OACA,SAImB;AACnB,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,QAAI,QAAmD;AACvD,QAAI,YAAsC;AAE1C,UAAM,gBAAgB,MAAY;AAChC,aAAO;AAAA,QACL,IAAI,6BAAW,SAAS,gBAAgB,SAAS,gBAAgB,oBAAoB;AAAA,MACvF;AAAA,IACF;AAEA,UAAM,kBAAkB,MAAY;AAClC,UAAI,SAAS,eAAe,WAAW;AACrC,gBAAQ,YAAY,oBAAoB,SAAS,SAAS;AAAA,MAC5D;AAAA,IACF;AAEA,gBAAY,MAAY;AACtB,UAAI,OAAO;AACT,qBAAa,KAAK;AAAA,MACpB;AACA,sBAAgB;AAChB,aAAO,cAAc;AAAA,IACvB;AAEA,QAAI,SAAS,eAAe,QAAQ,YAAY,SAAS;AACvD,aAAO,cAAc;AAAA,IACvB;AAEA,YAAQ,WAAW,MAAM;AACvB,sBAAgB;AAChB,cAAQ,KAAK;AAAA,IACf,GAAG,SAAS;AAEZ,QAAI,SAAS,aAAa;AACxB,cAAQ,YAAY,iBAAiB,SAAS,SAAS;AAAA,IACzD;AAAA,EACF,CAAC;AACH;AAMO,SAAS,yBACd,UACA,YACoB;AACpB,QAAM,QAAQ,SAAS,QAAQ,IAAI,UAAU;AAC7C,MAAI,CAAC,MAAO;AACZ,QAAM,aAAa,OAAO,KAAK;AAC/B,MAAI,OAAO,MAAM,UAAU,EAAG;AAC9B,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/inspect.common.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const custom = Symbol();\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,SAAS,uBAAO;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/inspect.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { inspect } from \"node:util\";\n\nexport const custom = inspect.custom;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAwB;AAEjB,MAAM,SAAS,yBAAQ;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/internal.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { calculateRetryDelay } from \"./delay.js\";\nexport { getRandomIntegerInclusive } from \"./random.js\";\nexport { isObject, type UnknownObject } from \"./object.js\";\nexport { isError } from \"./error.js\";\nexport { computeSha256Hash, computeSha256Hmac } from \"./sha256.js\";\nexport { randomUUID } from \"./uuidUtils.js\";\nexport {\n isBrowser,\n isBun,\n isNodeLike,\n isNodeRuntime,\n isDeno,\n isReactNative,\n isWebWorker,\n} from \"./checkEnvironment.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"./bytesEncoding.js\";\nexport { Sanitizer, type SanitizerOptions } from \"./sanitizer.js\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAoC;AACpC,oBAA0C;AAC1C,oBAA6C;AAC7C,mBAAwB;AACxB,oBAAqD;AACrD,uBAA2B;AAC3B,8BAQO;AACP,2BAA0E;AAC1E,uBAAiD;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../src/util/object.ts"],
|
|
4
4
|
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * A generic shape for a plain JS object.\n */\nexport type UnknownObject = { [s: string]: unknown };\n\n/**\n * Helper to determine when an input is a generic JS object.\n * @returns true when input is an object type that is not null, Array, RegExp, or Date.\n */\nexport function isObject(input: unknown): input is UnknownObject {\n return (\n typeof input === \"object\" &&\n input !== null &&\n !Array.isArray(input) &&\n !(input instanceof RegExp) &&\n !(input instanceof Date)\n );\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,SAAS,OAAwC;AAC/D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,EAAE,iBAAiB,WACnB,EAAE,iBAAiB;AAEvB;",
|
|
6
6
|
"names": []
|