@smithy/core
Advanced tools
+13
-15
@@ -1,8 +0,8 @@ | ||
| 'use strict'; | ||
| const { getSmithyContext } = require("@smithy/core/transport"); | ||
| exports.getSmithyContext = getSmithyContext; | ||
| const { HttpRequest } = require("@smithy/core/protocols"); | ||
| const { requestBuilder } = require("@smithy/core/protocols"); | ||
| exports.requestBuilder = requestBuilder; | ||
| const { HttpApiKeyAuthLocation } = require("@smithy/types"); | ||
| var transport = require('@smithy/core/transport'); | ||
| var protocols = require('@smithy/core/protocols'); | ||
| var types = require('@smithy/types'); | ||
| var client = require('@smithy/core/client'); | ||
| const resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => { | ||
@@ -41,3 +41,3 @@ if (!authSchemePreference || authSchemePreference.length === 0) { | ||
| const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes); | ||
| const smithyContext = client.getSmithyContext(context); | ||
| const smithyContext = getSmithyContext(context); | ||
| const failureReasons = []; | ||
@@ -110,6 +110,6 @@ for (const option of resolvedOptions) { | ||
| const httpSigningMiddleware = (config) => (next, context) => async (args) => { | ||
| if (!protocols.HttpRequest.isInstance(args.request)) { | ||
| if (!HttpRequest.isInstance(args.request)) { | ||
| return next(args); | ||
| } | ||
| const smithyContext = client.getSmithyContext(context); | ||
| const smithyContext = getSmithyContext(context); | ||
| const scheme = smithyContext.selectedHttpAuthScheme; | ||
@@ -233,7 +233,7 @@ if (!scheme) { | ||
| } | ||
| const clonedRequest = protocols.HttpRequest.clone(httpRequest); | ||
| if (signingProperties.in === types.HttpApiKeyAuthLocation.QUERY) { | ||
| const clonedRequest = HttpRequest.clone(httpRequest); | ||
| if (signingProperties.in === HttpApiKeyAuthLocation.QUERY) { | ||
| clonedRequest.query[signingProperties.name] = identity.apiKey; | ||
| } | ||
| else if (signingProperties.in === types.HttpApiKeyAuthLocation.HEADER) { | ||
| else if (signingProperties.in === HttpApiKeyAuthLocation.HEADER) { | ||
| clonedRequest.headers[signingProperties.name] = signingProperties.scheme | ||
@@ -255,3 +255,3 @@ ? `${signingProperties.scheme} ${identity.apiKey}` | ||
| async sign(httpRequest, identity, signingProperties) { | ||
| const clonedRequest = protocols.HttpRequest.clone(httpRequest); | ||
| const clonedRequest = HttpRequest.clone(httpRequest); | ||
| if (!identity.token) { | ||
@@ -327,4 +327,2 @@ throw new Error("request could not be signed with `token` since the `token` is not defined"); | ||
| exports.getSmithyContext = transport.getSmithyContext; | ||
| exports.requestBuilder = protocols.requestBuilder; | ||
| exports.DefaultIdentityProviderConfig = DefaultIdentityProviderConfig; | ||
@@ -331,0 +329,0 @@ exports.EXPIRATION_MS = EXPIRATION_MS; |
@@ -1,8 +0,6 @@ | ||
| 'use strict'; | ||
| const { nv, toUtf8, fromUtf8, NumericValue, calculateBodyLength, _parseEpochTimestamp, fromBase64, generateIdempotencyToken } = require("@smithy/core/serde"); | ||
| const { HttpRequest, collectBody, SerdeContext, RpcProtocol } = require("@smithy/core/protocols"); | ||
| const { NormalizedSchema, deref, TypeRegistry } = require("@smithy/core/schema"); | ||
| const { getSmithyContext } = require("@smithy/core/transport"); | ||
| var serde = require('@smithy/core/serde'); | ||
| var protocols = require('@smithy/core/protocols'); | ||
| var client = require('@smithy/core/client'); | ||
| var schema = require('@smithy/core/schema'); | ||
| const majorUint64 = 0; | ||
@@ -136,3 +134,3 @@ const majorNegativeInt64 = 1; | ||
| _offset = offset + _offset; | ||
| return serde.nv(numericString); | ||
| return nv(numericString); | ||
| } | ||
@@ -185,3 +183,3 @@ else { | ||
| } | ||
| return serde.toUtf8(bytes.subarray(at, to)); | ||
| return toUtf8(bytes.subarray(at, to)); | ||
| } | ||
@@ -530,3 +528,3 @@ function demote(bigInteger) { | ||
| else { | ||
| const bytes = serde.fromUtf8(input); | ||
| const bytes = fromUtf8(input); | ||
| encodeHeader(majorUtf8String, bytes.byteLength); | ||
@@ -647,3 +645,3 @@ data.set(bytes, cursor); | ||
| else if (typeof input === "object") { | ||
| if (input instanceof serde.NumericValue) { | ||
| if (input instanceof NumericValue) { | ||
| const decimalIndex = input.string.indexOf("."); | ||
@@ -702,3 +700,3 @@ const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1; | ||
| const parseCborBody = (streamBody, context) => { | ||
| return protocols.collectBody(streamBody, context).then(async (bytes) => { | ||
| return collectBody(streamBody, context).then(async (bytes) => { | ||
| if (bytes.length) { | ||
@@ -789,10 +787,10 @@ try { | ||
| try { | ||
| contents.headers["content-length"] = String(serde.calculateBodyLength(body)); | ||
| contents.headers["content-length"] = String(calculateBodyLength(body)); | ||
| } | ||
| catch (e) { } | ||
| } | ||
| return new protocols.HttpRequest(contents); | ||
| return new HttpRequest(contents); | ||
| }; | ||
| class CborCodec extends protocols.SerdeContext { | ||
| class CborCodec extends SerdeContext { | ||
| createSerializer() { | ||
@@ -809,3 +807,3 @@ const serializer = new CborShapeSerializer(); | ||
| } | ||
| class CborShapeSerializer extends protocols.SerdeContext { | ||
| class CborShapeSerializer extends SerdeContext { | ||
| value; | ||
@@ -815,7 +813,7 @@ write(schema, value) { | ||
| } | ||
| serialize(schema$1, source) { | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| serialize(schema, source) { | ||
| const ns = NormalizedSchema.of(schema); | ||
| if (source == null) { | ||
| if (ns.isIdempotencyToken()) { | ||
| return serde.generateIdempotencyToken(); | ||
| return generateIdempotencyToken(); | ||
| } | ||
@@ -826,3 +824,3 @@ return source; | ||
| if (typeof source === "string") { | ||
| return (this.serdeContext?.base64Decoder ?? serde.fromBase64)(source); | ||
| return (this.serdeContext?.base64Decoder ?? fromBase64)(source); | ||
| } | ||
@@ -902,3 +900,3 @@ return source; | ||
| } | ||
| class CborShapeDeserializer extends protocols.SerdeContext { | ||
| class CborShapeDeserializer extends SerdeContext { | ||
| read(schema, bytes) { | ||
@@ -909,10 +907,10 @@ const data = cbor.deserialize(bytes); | ||
| readValue(_schema, value) { | ||
| const ns = schema.NormalizedSchema.of(_schema); | ||
| const ns = NormalizedSchema.of(_schema); | ||
| if (ns.isTimestampSchema()) { | ||
| if (typeof value === "number") { | ||
| return serde._parseEpochTimestamp(value); | ||
| return _parseEpochTimestamp(value); | ||
| } | ||
| if (typeof value === "object") { | ||
| if (value.tag === 1 && "value" in value) { | ||
| return serde._parseEpochTimestamp(value.value); | ||
| return _parseEpochTimestamp(value.value); | ||
| } | ||
@@ -923,3 +921,3 @@ } | ||
| if (typeof value === "string") { | ||
| return (this.serdeContext?.base64Decoder ?? serde.fromBase64)(value); | ||
| return (this.serdeContext?.base64Decoder ?? fromBase64)(value); | ||
| } | ||
@@ -1004,3 +1002,3 @@ return value; | ||
| } | ||
| else if (value instanceof serde.NumericValue) { | ||
| else if (value instanceof NumericValue) { | ||
| return value; | ||
@@ -1016,3 +1014,3 @@ } | ||
| class SmithyRpcV2CborProtocol extends protocols.RpcProtocol { | ||
| class SmithyRpcV2CborProtocol extends RpcProtocol { | ||
| codec = new CborCodec(); | ||
@@ -1037,3 +1035,3 @@ serializer = this.codec.createSerializer(); | ||
| }); | ||
| if (schema.deref(operationSchema.input) === "unit") { | ||
| if (deref(operationSchema.input) === "unit") { | ||
| delete request.body; | ||
@@ -1052,3 +1050,3 @@ delete request.headers["content-type"]; | ||
| } | ||
| const { service, operation } = client.getSmithyContext(context); | ||
| const { service, operation } = getSmithyContext(context); | ||
| const path = `/service/${service}/operation/${operation}`; | ||
@@ -1077,3 +1075,3 @@ if (request.path.endsWith("/")) { | ||
| const registry = this.compositeErrorRegistry; | ||
| const nsRegistry = schema.TypeRegistry.for(namespace); | ||
| const nsRegistry = TypeRegistry.for(namespace); | ||
| registry.copyFrom(nsRegistry); | ||
@@ -1088,3 +1086,3 @@ let errorSchema; | ||
| } | ||
| const syntheticRegistry = schema.TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace); | ||
| const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace); | ||
| registry.copyFrom(syntheticRegistry); | ||
@@ -1098,3 +1096,3 @@ const baseExceptionSchema = registry.getBaseException(); | ||
| } | ||
| const ns = schema.NormalizedSchema.of(errorSchema); | ||
| const ns = NormalizedSchema.of(errorSchema); | ||
| const ErrorCtor = registry.getErrorCtor(errorSchema); | ||
@@ -1101,0 +1099,0 @@ const message = dataObject.message ?? dataObject.Message ?? "Unknown"; |
@@ -1,5 +0,3 @@ | ||
| 'use strict'; | ||
| const { fromUtf8 } = require("@smithy/core/serde"); | ||
| var serde = require('@smithy/core/serde'); | ||
| async function blobReader(blob, onChunk, chunkSize = 1024 * 1024) { | ||
@@ -186,3 +184,3 @@ const size = blob.size; | ||
| if (typeof data === "string") { | ||
| return serde.fromUtf8(data); | ||
| return fromUtf8(data); | ||
| } | ||
@@ -189,0 +187,0 @@ if (ArrayBuffer.isView(data)) { |
@@ -1,7 +0,5 @@ | ||
| 'use strict'; | ||
| const { createReadStream } = require("node:fs"); | ||
| const { Writable } = require("node:stream"); | ||
| const { toUint8Array, fromUtf8 } = require("@smithy/core/serde"); | ||
| var node_fs = require('node:fs'); | ||
| var node_stream = require('node:stream'); | ||
| var serde = require('@smithy/core/serde'); | ||
| async function blobReader(blob, onChunk, chunkSize = 1024 * 1024) { | ||
@@ -25,3 +23,3 @@ const size = blob.size; | ||
| class HashCalculator extends node_stream.Writable { | ||
| class HashCalculator extends Writable { | ||
| hash; | ||
@@ -34,3 +32,3 @@ constructor(hash, options) { | ||
| try { | ||
| this.hash.update(serde.toUint8Array(chunk)); | ||
| this.hash.update(toUint8Array(chunk)); | ||
| } | ||
@@ -49,3 +47,3 @@ catch (err) { | ||
| } | ||
| const fileStreamTee = node_fs.createReadStream(fileStream.path, { | ||
| const fileStreamTee = createReadStream(fileStream.path, { | ||
| start: fileStream.start, | ||
@@ -250,3 +248,3 @@ end: fileStream.end, | ||
| if (typeof data === "string") { | ||
| return serde.fromUtf8(data); | ||
| return fromUtf8(data); | ||
| } | ||
@@ -253,0 +251,0 @@ if (ArrayBuffer.isView(data)) { |
@@ -1,5 +0,3 @@ | ||
| 'use strict'; | ||
| const { fromUtf8, fromBase64 } = require("@smithy/core/serde"); | ||
| var serde = require('@smithy/core/serde'); | ||
| async function blobReader$1(blob, onChunk, chunkSize = 1024 * 1024) { | ||
@@ -186,3 +184,3 @@ const size = blob.size; | ||
| if (typeof data === "string") { | ||
| return serde.fromUtf8(data); | ||
| return fromUtf8(data); | ||
| } | ||
@@ -213,3 +211,3 @@ if (ArrayBuffer.isView(data)) { | ||
| const data = result.substring(dataOffset); | ||
| const decoded = serde.fromBase64(data); | ||
| const decoded = fromBase64(data); | ||
| onChunk(decoded); | ||
@@ -216,0 +214,0 @@ totalBytesRead += decoded.byteLength; |
@@ -1,7 +0,8 @@ | ||
| 'use strict'; | ||
| const { getSmithyContext, normalizeProvider } = require("@smithy/core/transport"); | ||
| exports.getSmithyContext = getSmithyContext; | ||
| exports.normalizeProvider = normalizeProvider; | ||
| const { SMITHY_CONTEXT_KEY, AlgorithmId } = require("@smithy/types"); | ||
| exports.AlgorithmId = AlgorithmId; | ||
| const { NormalizedSchema } = require("@smithy/core/schema"); | ||
| var transport = require('@smithy/core/transport'); | ||
| var types = require('@smithy/types'); | ||
| var schema = require('@smithy/core/schema'); | ||
| const getAllAliases = (name, aliases) => { | ||
@@ -316,3 +317,3 @@ const _aliases = []; | ||
| }; | ||
| exports.WaiterState = void 0; | ||
| var WaiterState; | ||
| (function (WaiterState) { | ||
@@ -324,5 +325,5 @@ WaiterState["ABORTED"] = "ABORTED"; | ||
| WaiterState["TIMEOUT"] = "TIMEOUT"; | ||
| })(exports.WaiterState || (exports.WaiterState = {})); | ||
| })(WaiterState || (WaiterState = {})); | ||
| const checkExceptions = (result) => { | ||
| if (result.state === exports.WaiterState.ABORTED) { | ||
| if (result.state === WaiterState.ABORTED) { | ||
| const abortError = new Error(`${JSON.stringify({ | ||
@@ -335,3 +336,3 @@ ...result, | ||
| } | ||
| else if (result.state === exports.WaiterState.TIMEOUT) { | ||
| else if (result.state === WaiterState.TIMEOUT) { | ||
| const timeoutError = new Error(`${JSON.stringify({ | ||
@@ -344,3 +345,3 @@ ...result, | ||
| } | ||
| else if (result.state !== exports.WaiterState.SUCCESS) { | ||
| else if (result.state !== WaiterState.SUCCESS) { | ||
| throw new Error(`${JSON.stringify(result, getCircularReplacer())}`); | ||
@@ -365,6 +366,6 @@ } | ||
| observedResponses[message] += 1; | ||
| return { state: exports.WaiterState.ABORTED, observedResponses }; | ||
| return { state: WaiterState.ABORTED, observedResponses }; | ||
| } | ||
| if (Date.now() + delayMs > waitUntil) { | ||
| return { state: exports.WaiterState.TIMEOUT, observedResponses }; | ||
| return { state: WaiterState.TIMEOUT, observedResponses }; | ||
| } | ||
@@ -379,3 +380,3 @@ await sleep(delayMs / 1_000); | ||
| } | ||
| if (state !== exports.WaiterState.RETRY) { | ||
| if (state !== WaiterState.RETRY) { | ||
| return { state, reason, final: reason, observedResponses }; | ||
@@ -457,3 +458,3 @@ } | ||
| const promise = new Promise((resolve) => { | ||
| onAbort = () => resolve({ state: exports.WaiterState.ABORTED }); | ||
| onAbort = () => resolve({ state: WaiterState.ABORTED }); | ||
| if (typeof abortSignal.addEventListener === "function") { | ||
@@ -553,7 +554,7 @@ abortSignal.addEventListener("abort", onAbort); | ||
| const SENSITIVE_STRING$1 = "***SensitiveInformation***"; | ||
| function schemaLogFilter(schema$1, data) { | ||
| function schemaLogFilter(schema, data) { | ||
| if (data == null) { | ||
| return data; | ||
| } | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| const ns = NormalizedSchema.of(schema); | ||
| if (ns.getMergedTraits().sensitive) { | ||
@@ -605,3 +606,3 @@ return SENSITIVE_STRING$1; | ||
| outputFilterSensitiveLog, | ||
| [types.SMITHY_CONTEXT_KEY]: { | ||
| [SMITHY_CONTEXT_KEY]: { | ||
| commandInstance: this, | ||
@@ -874,7 +875,7 @@ ...smithyContext, | ||
| const knownAlgorithms = Object.values(types.AlgorithmId); | ||
| const knownAlgorithms = Object.values(AlgorithmId); | ||
| const getChecksumConfiguration = (runtimeConfig) => { | ||
| const checksumAlgorithms = []; | ||
| for (const id in types.AlgorithmId) { | ||
| const algorithmId = types.AlgorithmId[id]; | ||
| for (const id in AlgorithmId) { | ||
| const algorithmId = AlgorithmId[id]; | ||
| if (runtimeConfig[algorithmId] === undefined) { | ||
@@ -1102,5 +1103,2 @@ continue; | ||
| exports.getSmithyContext = transport.getSmithyContext; | ||
| exports.normalizeProvider = transport.normalizeProvider; | ||
| exports.AlgorithmId = types.AlgorithmId; | ||
| exports.Client = Client; | ||
@@ -1111,2 +1109,3 @@ exports.Command = Command; | ||
| exports.ServiceException = ServiceException; | ||
| exports.WaiterState = WaiterState; | ||
| exports._json = _json; | ||
@@ -1113,0 +1112,0 @@ exports.checkExceptions = checkExceptions; |
@@ -1,6 +0,4 @@ | ||
| 'use strict'; | ||
| const { normalizeProvider } = require("@smithy/core/client"); | ||
| const { isValidHostLabel } = require("@smithy/core/transport"); | ||
| var client = require('@smithy/core/client'); | ||
| var transport = require('@smithy/core/transport'); | ||
| class ProviderError extends Error { | ||
@@ -135,7 +133,7 @@ name = "ProviderError"; | ||
| exports.SelectorType = void 0; | ||
| var SelectorType; | ||
| (function (SelectorType) { | ||
| SelectorType["ENV"] = "env"; | ||
| SelectorType["CONFIG"] = "shared config entry"; | ||
| })(exports.SelectorType || (exports.SelectorType = {})); | ||
| })(SelectorType || (SelectorType = {})); | ||
@@ -146,5 +144,5 @@ const resolveCustomEndpointsConfig = (input) => { | ||
| tls: tls ?? true, | ||
| endpoint: client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| endpoint: normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| isCustomEndpoint: true, | ||
| useDualstackEndpoint: client.normalizeProvider(useDualstackEndpoint ?? false), | ||
| useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false), | ||
| }); | ||
@@ -170,3 +168,3 @@ }; | ||
| const resolveEndpointsConfig = (input) => { | ||
| const useDualstackEndpoint = client.normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const useDualstackEndpoint = normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const { endpoint, useFipsEndpoint, urlParser, tls } = input; | ||
@@ -176,3 +174,3 @@ return Object.assign(input, { | ||
| endpoint: endpoint | ||
| ? client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| ? normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), | ||
@@ -185,3 +183,3 @@ isCustomEndpoint: !!endpoint, | ||
| const validRegions = new Set(); | ||
| const checkRegion = (region, check = transport.isValidHostLabel) => { | ||
| const checkRegion = (region, check = isValidHostLabel) => { | ||
| if (!validRegions.has(region) && !check(region)) { | ||
@@ -357,2 +355,3 @@ if (region === "*") { | ||
| exports.REGION_INI_NAME = REGION_INI_NAME; | ||
| exports.SelectorType = SelectorType; | ||
| exports.TokenProviderError = TokenProviderError; | ||
@@ -359,0 +358,0 @@ exports.booleanSelector = booleanSelector; |
@@ -1,11 +0,9 @@ | ||
| 'use strict'; | ||
| const { homedir } = require("node:os"); | ||
| const { sep, join } = require("node:path"); | ||
| const { createHash } = require("node:crypto"); | ||
| const { readFile: readFile$1 } = require("node:fs/promises"); | ||
| const { IniSectionType } = require("@smithy/types"); | ||
| const { normalizeProvider } = require("@smithy/core/client"); | ||
| const { isValidHostLabel } = require("@smithy/core/transport"); | ||
| var node_os = require('node:os'); | ||
| var node_path = require('node:path'); | ||
| var node_crypto = require('node:crypto'); | ||
| var promises = require('node:fs/promises'); | ||
| var types = require('@smithy/types'); | ||
| var client = require('@smithy/core/client'); | ||
| var transport = require('@smithy/core/transport'); | ||
| class ProviderError extends Error { | ||
@@ -140,7 +138,7 @@ name = "ProviderError"; | ||
| exports.SelectorType = void 0; | ||
| var SelectorType; | ||
| (function (SelectorType) { | ||
| SelectorType["ENV"] = "env"; | ||
| SelectorType["CONFIG"] = "shared config entry"; | ||
| })(exports.SelectorType || (exports.SelectorType = {})); | ||
| })(SelectorType || (SelectorType = {})); | ||
@@ -155,3 +153,3 @@ const homeDirCache = {}; | ||
| const getHomeDir = () => { | ||
| const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${node_path.sep}` } = process.env; | ||
| const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env; | ||
| if (HOME) | ||
@@ -165,3 +163,3 @@ return HOME; | ||
| if (!homeDirCache[homeDirCacheKey]) | ||
| homeDirCache[homeDirCacheKey] = node_os.homedir(); | ||
| homeDirCache[homeDirCacheKey] = homedir(); | ||
| return homeDirCache[homeDirCacheKey]; | ||
@@ -175,5 +173,5 @@ }; | ||
| const getSSOTokenFilepath = (id) => { | ||
| const hasher = node_crypto.createHash("sha1"); | ||
| const hasher = createHash("sha1"); | ||
| const cacheName = hasher.update(id).digest("hex"); | ||
| return node_path.join(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`); | ||
| return join(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`); | ||
| }; | ||
@@ -187,3 +185,3 @@ | ||
| const ssoTokenFilepath = getSSOTokenFilepath(id); | ||
| const ssoTokenText = await promises.readFile(ssoTokenFilepath, "utf8"); | ||
| const ssoTokenText = await readFile$1(ssoTokenFilepath, "utf8"); | ||
| return JSON.parse(ssoTokenText); | ||
@@ -200,7 +198,7 @@ }; | ||
| } | ||
| return Object.values(types.IniSectionType).includes(key.substring(0, indexOfSeparator)); | ||
| return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator)); | ||
| }) | ||
| .reduce((acc, [key, value]) => { | ||
| const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); | ||
| const updatedKey = key.substring(0, indexOfSeparator) === types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; | ||
| const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; | ||
| acc[updatedKey] = value; | ||
@@ -213,6 +211,6 @@ return acc; | ||
| const ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; | ||
| const getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || node_path.join(getHomeDir(), ".aws", "config"); | ||
| const getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join(getHomeDir(), ".aws", "config"); | ||
| const ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; | ||
| const getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || node_path.join(getHomeDir(), ".aws", "credentials"); | ||
| const getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join(getHomeDir(), ".aws", "credentials"); | ||
@@ -235,3 +233,3 @@ const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; | ||
| const [, prefix, , name] = matches; | ||
| if (Object.values(types.IniSectionType).includes(prefix)) { | ||
| if (Object.values(IniSectionType).includes(prefix)) { | ||
| currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); | ||
@@ -278,3 +276,3 @@ } | ||
| if (!filePromises[path] || options?.ignoreCache) { | ||
| filePromises[path] = promises.readFile(path, "utf8"); | ||
| filePromises[path] = readFile$1(path, "utf8"); | ||
| } | ||
@@ -291,7 +289,7 @@ return filePromises[path]; | ||
| if (filepath.startsWith(relativeHomeDirPrefix)) { | ||
| resolvedFilepath = node_path.join(homeDir, filepath.slice(2)); | ||
| resolvedFilepath = join(homeDir, filepath.slice(2)); | ||
| } | ||
| let resolvedConfigFilepath = configFilepath; | ||
| if (configFilepath.startsWith(relativeHomeDirPrefix)) { | ||
| resolvedConfigFilepath = node_path.join(homeDir, configFilepath.slice(2)); | ||
| resolvedConfigFilepath = join(homeDir, configFilepath.slice(2)); | ||
| } | ||
@@ -318,3 +316,3 @@ const parsedFiles = await Promise.all([ | ||
| const getSsoSessionData = (data) => Object.entries(data) | ||
| .filter(([key]) => key.startsWith(types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)) | ||
| .filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)) | ||
| .reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}); | ||
@@ -423,9 +421,9 @@ | ||
| const NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, exports.SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, exports.SelectorType.CONFIG), | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG), | ||
| default: false, | ||
| }; | ||
| const nodeDualstackConfigSelectors = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, exports.SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, exports.SelectorType.CONFIG), | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG), | ||
| default: undefined, | ||
@@ -438,9 +436,9 @@ }; | ||
| const NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, exports.SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, exports.SelectorType.CONFIG), | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG), | ||
| default: false, | ||
| }; | ||
| const nodeFipsConfigSelectors = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, exports.SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, exports.SelectorType.CONFIG), | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG), | ||
| default: undefined, | ||
@@ -453,5 +451,5 @@ }; | ||
| tls: tls ?? true, | ||
| endpoint: client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| endpoint: normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| isCustomEndpoint: true, | ||
| useDualstackEndpoint: client.normalizeProvider(useDualstackEndpoint ?? false), | ||
| useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false), | ||
| }); | ||
@@ -477,3 +475,3 @@ }; | ||
| const resolveEndpointsConfig = (input) => { | ||
| const useDualstackEndpoint = client.normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const useDualstackEndpoint = normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const { endpoint, useFipsEndpoint, urlParser, tls } = input; | ||
@@ -483,3 +481,3 @@ return Object.assign(input, { | ||
| endpoint: endpoint | ||
| ? client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| ? normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), | ||
@@ -505,3 +503,3 @@ isCustomEndpoint: !!endpoint, | ||
| const validRegions = new Set(); | ||
| const checkRegion = (region, check = transport.isValidHostLabel) => { | ||
| const checkRegion = (region, check = isValidHostLabel) => { | ||
| if (!validRegions.has(region) && !check(region)) { | ||
@@ -677,3 +675,3 @@ if (region === "*") { | ||
| const imdsHttpGet = async ({ hostname, path }) => { | ||
| const { request } = await import('node:http'); | ||
| const { request } = require('node:http'); | ||
| return new Promise((resolve, reject) => { | ||
@@ -730,2 +728,3 @@ const req = request({ | ||
| exports.REGION_INI_NAME = REGION_INI_NAME; | ||
| exports.SelectorType = SelectorType; | ||
| exports.TokenProviderError = TokenProviderError; | ||
@@ -732,0 +731,0 @@ exports.booleanSelector = booleanSelector; |
@@ -1,6 +0,4 @@ | ||
| 'use strict'; | ||
| const { normalizeProvider } = require("@smithy/core/client"); | ||
| const { isValidHostLabel } = require("@smithy/core/transport"); | ||
| var client = require('@smithy/core/client'); | ||
| var transport = require('@smithy/core/transport'); | ||
| class ProviderError extends Error { | ||
@@ -135,7 +133,7 @@ name = "ProviderError"; | ||
| exports.SelectorType = void 0; | ||
| var SelectorType; | ||
| (function (SelectorType) { | ||
| SelectorType["ENV"] = "env"; | ||
| SelectorType["CONFIG"] = "shared config entry"; | ||
| })(exports.SelectorType || (exports.SelectorType = {})); | ||
| })(SelectorType || (SelectorType = {})); | ||
@@ -146,5 +144,5 @@ const resolveCustomEndpointsConfig = (input) => { | ||
| tls: tls ?? true, | ||
| endpoint: client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| endpoint: normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), | ||
| isCustomEndpoint: true, | ||
| useDualstackEndpoint: client.normalizeProvider(useDualstackEndpoint ?? false), | ||
| useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false), | ||
| }); | ||
@@ -170,3 +168,3 @@ }; | ||
| const resolveEndpointsConfig = (input) => { | ||
| const useDualstackEndpoint = client.normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const useDualstackEndpoint = normalizeProvider(input.useDualstackEndpoint ?? false); | ||
| const { endpoint, useFipsEndpoint, urlParser, tls } = input; | ||
@@ -176,3 +174,3 @@ return Object.assign(input, { | ||
| endpoint: endpoint | ||
| ? client.normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| ? normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) | ||
| : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), | ||
@@ -185,3 +183,3 @@ isCustomEndpoint: !!endpoint, | ||
| const validRegions = new Set(); | ||
| const checkRegion = (region, check = transport.isValidHostLabel) => { | ||
| const checkRegion = (region, check = isValidHostLabel) => { | ||
| if (!validRegions.has(region) && !check(region)) { | ||
@@ -346,2 +344,3 @@ if (region === "*") { | ||
| exports.REGION_INI_NAME = REGION_INI_NAME; | ||
| exports.SelectorType = SelectorType; | ||
| exports.TokenProviderError = TokenProviderError; | ||
@@ -348,0 +347,0 @@ exports.booleanSelector = booleanSelector; |
@@ -1,7 +0,7 @@ | ||
| 'use strict'; | ||
| const { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel } = require("@smithy/core/transport"); | ||
| exports.isValidHostLabel = isValidHostLabel; | ||
| exports.middlewareEndpointToEndpointV1 = toEndpointV1; | ||
| exports.toEndpointV1 = toEndpointV1; | ||
| const { EndpointURLScheme } = require("@smithy/types"); | ||
| var transport = require('@smithy/core/transport'); | ||
| var client = require('@smithy/core/client'); | ||
| var types = require('@smithy/types'); | ||
| const getEndpointFromConfig = async (serviceId) => undefined; | ||
@@ -107,3 +107,3 @@ | ||
| if (endpointFromConfig) { | ||
| clientConfig.endpoint = () => Promise.resolve(transport.toEndpointV1(endpointFromConfig)); | ||
| clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); | ||
| clientConfig.isCustomEndpoint = true; | ||
@@ -187,3 +187,3 @@ } | ||
| context["signing_service"] = authScheme.signingName; | ||
| const smithyContext = client.getSmithyContext(context); | ||
| const smithyContext = getSmithyContext(context); | ||
| const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption; | ||
@@ -233,3 +233,3 @@ if (httpAuthOption) { | ||
| const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input; | ||
| const customEndpointProvider = endpoint != null ? async () => transport.toEndpointV1(await transport.normalizeProvider(endpoint)()) : undefined; | ||
| const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : undefined; | ||
| const isCustomEndpoint = !!endpoint; | ||
@@ -240,4 +240,4 @@ const resolvedConfig = Object.assign(input, { | ||
| isCustomEndpoint, | ||
| useDualstackEndpoint: transport.normalizeProvider(useDualstackEndpoint ?? false), | ||
| useFipsEndpoint: transport.normalizeProvider(useFipsEndpoint ?? false), | ||
| useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false), | ||
| useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false), | ||
| }); | ||
@@ -405,4 +405,4 @@ let configuredEndpointPromise = undefined; | ||
| const DEFAULT_PORTS = { | ||
| [types.EndpointURLScheme.HTTP]: 80, | ||
| [types.EndpointURLScheme.HTTPS]: 443, | ||
| [EndpointURLScheme.HTTP]: 80, | ||
| [EndpointURLScheme.HTTPS]: 443, | ||
| }; | ||
@@ -439,3 +439,3 @@ const parseURL = (value) => { | ||
| const scheme = protocol.slice(0, -1); | ||
| if (!Object.values(types.EndpointURLScheme).includes(scheme)) { | ||
| if (!Object.values(EndpointURLScheme).includes(scheme)) { | ||
| return null; | ||
@@ -489,3 +489,3 @@ } | ||
| isSet, | ||
| isValidHostLabel: transport.isValidHostLabel, | ||
| isValidHostLabel, | ||
| ite, | ||
@@ -820,5 +820,2 @@ not, | ||
| exports.isValidHostLabel = transport.isValidHostLabel; | ||
| exports.middlewareEndpointToEndpointV1 = transport.toEndpointV1; | ||
| exports.toEndpointV1 = transport.toEndpointV1; | ||
| exports.BinaryDecisionDiagram = BinaryDecisionDiagram; | ||
@@ -825,0 +822,0 @@ exports.EndpointCache = EndpointCache; |
@@ -1,8 +0,8 @@ | ||
| 'use strict'; | ||
| const { CONFIG_PREFIX_SEPARATOR, loadConfig } = require("@smithy/core/config"); | ||
| const { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel } = require("@smithy/core/transport"); | ||
| exports.isValidHostLabel = isValidHostLabel; | ||
| exports.middlewareEndpointToEndpointV1 = toEndpointV1; | ||
| exports.toEndpointV1 = toEndpointV1; | ||
| const { EndpointURLScheme } = require("@smithy/types"); | ||
| var config = require('@smithy/core/config'); | ||
| var transport = require('@smithy/core/transport'); | ||
| var client = require('@smithy/core/client'); | ||
| var types = require('@smithy/types'); | ||
| const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; | ||
@@ -21,8 +21,8 @@ const CONFIG_ENDPOINT_URL = "endpoint_url"; | ||
| }, | ||
| configFileSelector: (profile, config$1) => { | ||
| if (config$1 && profile.services) { | ||
| const servicesSection = config$1[["services", profile.services].join(config.CONFIG_PREFIX_SEPARATOR)]; | ||
| configFileSelector: (profile, config) => { | ||
| if (config && profile.services) { | ||
| const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)]; | ||
| if (servicesSection) { | ||
| const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); | ||
| const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(config.CONFIG_PREFIX_SEPARATOR)]; | ||
| const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)]; | ||
| if (endpointUrl) | ||
@@ -40,3 +40,3 @@ return endpointUrl; | ||
| const getEndpointFromConfig = async (serviceId) => config.loadConfig(getEndpointUrlConfig(serviceId ?? ""))(); | ||
| const getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))(); | ||
@@ -141,3 +141,3 @@ const resolveParamsForS3 = async (endpointParams) => { | ||
| if (endpointFromConfig) { | ||
| clientConfig.endpoint = () => Promise.resolve(transport.toEndpointV1(endpointFromConfig)); | ||
| clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); | ||
| clientConfig.isCustomEndpoint = true; | ||
@@ -221,3 +221,3 @@ } | ||
| context["signing_service"] = authScheme.signingName; | ||
| const smithyContext = client.getSmithyContext(context); | ||
| const smithyContext = getSmithyContext(context); | ||
| const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption; | ||
@@ -267,3 +267,3 @@ if (httpAuthOption) { | ||
| const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input; | ||
| const customEndpointProvider = endpoint != null ? async () => transport.toEndpointV1(await transport.normalizeProvider(endpoint)()) : undefined; | ||
| const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : undefined; | ||
| const isCustomEndpoint = !!endpoint; | ||
@@ -274,4 +274,4 @@ const resolvedConfig = Object.assign(input, { | ||
| isCustomEndpoint, | ||
| useDualstackEndpoint: transport.normalizeProvider(useDualstackEndpoint ?? false), | ||
| useFipsEndpoint: transport.normalizeProvider(useFipsEndpoint ?? false), | ||
| useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false), | ||
| useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false), | ||
| }); | ||
@@ -439,4 +439,4 @@ let configuredEndpointPromise = undefined; | ||
| const DEFAULT_PORTS = { | ||
| [types.EndpointURLScheme.HTTP]: 80, | ||
| [types.EndpointURLScheme.HTTPS]: 443, | ||
| [EndpointURLScheme.HTTP]: 80, | ||
| [EndpointURLScheme.HTTPS]: 443, | ||
| }; | ||
@@ -473,3 +473,3 @@ const parseURL = (value) => { | ||
| const scheme = protocol.slice(0, -1); | ||
| if (!Object.values(types.EndpointURLScheme).includes(scheme)) { | ||
| if (!Object.values(EndpointURLScheme).includes(scheme)) { | ||
| return null; | ||
@@ -523,3 +523,3 @@ } | ||
| isSet, | ||
| isValidHostLabel: transport.isValidHostLabel, | ||
| isValidHostLabel, | ||
| ite, | ||
@@ -854,5 +854,2 @@ not, | ||
| exports.isValidHostLabel = transport.isValidHostLabel; | ||
| exports.middlewareEndpointToEndpointV1 = transport.toEndpointV1; | ||
| exports.toEndpointV1 = transport.toEndpointV1; | ||
| exports.BinaryDecisionDiagram = BinaryDecisionDiagram; | ||
@@ -859,0 +856,0 @@ exports.EndpointCache = EndpointCache; |
@@ -1,6 +0,4 @@ | ||
| 'use strict'; | ||
| const { Crc32 } = require("@aws-crypto/crc32"); | ||
| const { toHex, fromHex, toUtf8, fromUtf8 } = require("@smithy/core/serde"); | ||
| var crc32 = require('@aws-crypto/crc32'); | ||
| var serde = require('@smithy/core/serde'); | ||
| class Int64 { | ||
@@ -33,3 +31,3 @@ bytes; | ||
| } | ||
| return parseInt(serde.toHex(bytes), 16) * (negative ? -1 : 1); | ||
| return parseInt(toHex(bytes), 16) * (negative ? -1 : 1); | ||
| } | ||
@@ -119,3 +117,3 @@ toString() { | ||
| uuidBytes[0] = 9; | ||
| uuidBytes.set(serde.fromHex(header.value.replace(/\-/g, "")), 1); | ||
| uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1); | ||
| return uuidBytes; | ||
@@ -201,3 +199,3 @@ } | ||
| type: UUID_TAG, | ||
| value: `${serde.toHex(uuidBytes.subarray(0, 4))}-${serde.toHex(uuidBytes.subarray(4, 6))}-${serde.toHex(uuidBytes.subarray(6, 8))}-${serde.toHex(uuidBytes.subarray(8, 10))}-${serde.toHex(uuidBytes.subarray(10))}`, | ||
| value: `${toHex(uuidBytes.subarray(0, 4))}-${toHex(uuidBytes.subarray(4, 6))}-${toHex(uuidBytes.subarray(6, 8))}-${toHex(uuidBytes.subarray(8, 10))}-${toHex(uuidBytes.subarray(10))}`, | ||
| }; | ||
@@ -252,3 +250,3 @@ break; | ||
| const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false); | ||
| const checksummer = new crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH)); | ||
| const checksummer = new Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH)); | ||
| if (expectedPreludeChecksum !== checksummer.digest()) { | ||
@@ -312,3 +310,3 @@ throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`); | ||
| const view = new DataView(out.buffer, out.byteOffset, out.byteLength); | ||
| const checksum = new crc32.Crc32(); | ||
| const checksum = new Crc32(); | ||
| view.setUint32(0, length, false); | ||
@@ -696,3 +694,3 @@ view.setUint32(4, headers.byteLength, false); | ||
| else if (member.isStringSchema()) { | ||
| out[name] = (this.serdeContext?.utf8Encoder ?? serde.toUtf8)(body); | ||
| out[name] = (this.serdeContext?.utf8Encoder ?? toUtf8)(body); | ||
| } | ||
@@ -844,3 +842,3 @@ else if (member.isStructSchema()) { | ||
| const body = typeof messageSerialization === "string" | ||
| ? (this.serdeContext?.utf8Decoder ?? serde.fromUtf8)(messageSerialization) | ||
| ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization) | ||
| : messageSerialization; | ||
@@ -847,0 +845,0 @@ return { |
@@ -1,7 +0,5 @@ | ||
| 'use strict'; | ||
| const { Crc32 } = require("@aws-crypto/crc32"); | ||
| const { toHex, fromHex, toUtf8, fromUtf8 } = require("@smithy/core/serde"); | ||
| const { Readable } = require("node:stream"); | ||
| var crc32 = require('@aws-crypto/crc32'); | ||
| var serde = require('@smithy/core/serde'); | ||
| var node_stream = require('node:stream'); | ||
| class Int64 { | ||
@@ -34,3 +32,3 @@ bytes; | ||
| } | ||
| return parseInt(serde.toHex(bytes), 16) * (negative ? -1 : 1); | ||
| return parseInt(toHex(bytes), 16) * (negative ? -1 : 1); | ||
| } | ||
@@ -120,3 +118,3 @@ toString() { | ||
| uuidBytes[0] = 9; | ||
| uuidBytes.set(serde.fromHex(header.value.replace(/\-/g, "")), 1); | ||
| uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1); | ||
| return uuidBytes; | ||
@@ -202,3 +200,3 @@ } | ||
| type: UUID_TAG, | ||
| value: `${serde.toHex(uuidBytes.subarray(0, 4))}-${serde.toHex(uuidBytes.subarray(4, 6))}-${serde.toHex(uuidBytes.subarray(6, 8))}-${serde.toHex(uuidBytes.subarray(8, 10))}-${serde.toHex(uuidBytes.subarray(10))}`, | ||
| value: `${toHex(uuidBytes.subarray(0, 4))}-${toHex(uuidBytes.subarray(4, 6))}-${toHex(uuidBytes.subarray(6, 8))}-${toHex(uuidBytes.subarray(8, 10))}-${toHex(uuidBytes.subarray(10))}`, | ||
| }; | ||
@@ -253,3 +251,3 @@ break; | ||
| const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false); | ||
| const checksummer = new crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH)); | ||
| const checksummer = new Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH)); | ||
| if (expectedPreludeChecksum !== checksummer.digest()) { | ||
@@ -313,3 +311,3 @@ throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`); | ||
| const view = new DataView(out.buffer, out.byteOffset, out.byteLength); | ||
| const checksum = new crc32.Crc32(); | ||
| const checksum = new Crc32(); | ||
| view.setUint32(0, length, false); | ||
@@ -553,3 +551,3 @@ view.setUint32(4, headers.byteLength, false); | ||
| serialize(input, serializer) { | ||
| return node_stream.Readable.from(this.universalMarshaller.serialize(input, serializer)); | ||
| return Readable.from(this.universalMarshaller.serialize(input, serializer)); | ||
| } | ||
@@ -722,3 +720,3 @@ } | ||
| else if (member.isStringSchema()) { | ||
| out[name] = (this.serdeContext?.utf8Encoder ?? serde.toUtf8)(body); | ||
| out[name] = (this.serdeContext?.utf8Encoder ?? toUtf8)(body); | ||
| } | ||
@@ -870,3 +868,3 @@ else if (member.isStructSchema()) { | ||
| const body = typeof messageSerialization === "string" | ||
| ? (this.serdeContext?.utf8Decoder ?? serde.fromUtf8)(messageSerialization) | ||
| ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization) | ||
| : messageSerialization; | ||
@@ -873,0 +871,0 @@ return { |
@@ -1,17 +0,21 @@ | ||
| 'use strict'; | ||
| const { Uint8ArrayBlobAdapter, sdkStreamMixin, splitEvery, splitHeader, fromBase64, _parseEpochTimestamp, _parseRfc7231DateTime, _parseRfc3339DateTimeWithOffset, LazyJsonString, NumericValue, toUtf8, fromUtf8, generateIdempotencyToken, toBase64, dateToUtcString, quoteHeader } = require("@smithy/core/serde"); | ||
| const { TypeRegistry, NormalizedSchema, translateTraits } = require("@smithy/core/schema"); | ||
| const { HttpRequest, HttpResponse } = require("@smithy/core/transport"); | ||
| const { isValidHostname, parseQueryString, parseUrl } = require("@smithy/core/transport"); | ||
| exports.HttpRequest = HttpRequest; | ||
| exports.HttpResponse = HttpResponse; | ||
| exports.isValidHostname = isValidHostname; | ||
| exports.parseQueryString = parseQueryString; | ||
| exports.parseUrl = parseUrl; | ||
| const { FieldPosition } = require("@smithy/types"); | ||
| var serde = require('@smithy/core/serde'); | ||
| var schema = require('@smithy/core/schema'); | ||
| var transport = require('@smithy/core/transport'); | ||
| var types = require('@smithy/types'); | ||
| const collectBody = async (streamBody = new Uint8Array(), context) => { | ||
| if (streamBody instanceof Uint8Array) { | ||
| return serde.Uint8ArrayBlobAdapter.mutate(streamBody); | ||
| return Uint8ArrayBlobAdapter.mutate(streamBody); | ||
| } | ||
| if (!streamBody) { | ||
| return serde.Uint8ArrayBlobAdapter.mutate(new Uint8Array()); | ||
| return Uint8ArrayBlobAdapter.mutate(new Uint8Array()); | ||
| } | ||
| const fromContext = context.streamCollector(streamBody); | ||
| return serde.Uint8ArrayBlobAdapter.mutate(await fromContext); | ||
| return Uint8ArrayBlobAdapter.mutate(await fromContext); | ||
| }; | ||
@@ -38,3 +42,3 @@ | ||
| this.options = options; | ||
| this.compositeErrorRegistry = schema.TypeRegistry.for(options.defaultNamespace); | ||
| this.compositeErrorRegistry = TypeRegistry.for(options.defaultNamespace); | ||
| for (const etr of options.errorTypeRegistries ?? []) { | ||
@@ -45,6 +49,6 @@ this.compositeErrorRegistry.copyFrom(etr); | ||
| getRequestType() { | ||
| return transport.HttpRequest; | ||
| return HttpRequest; | ||
| } | ||
| getResponseType() { | ||
| return transport.HttpResponse; | ||
| return HttpResponse; | ||
| } | ||
@@ -101,4 +105,4 @@ setSerdeContext(serdeContext) { | ||
| } | ||
| const inputNs = schema.NormalizedSchema.of(operationSchema.input); | ||
| const opTraits = schema.translateTraits(operationSchema.traits ?? {}); | ||
| const inputNs = NormalizedSchema.of(operationSchema.input); | ||
| const opTraits = translateTraits(operationSchema.traits ?? {}); | ||
| if (opTraits.endpoint) { | ||
@@ -146,3 +150,3 @@ let hostPrefix = opTraits.endpoint?.[0]; | ||
| async loadEventStreamCapability() { | ||
| const { EventStreamSerde } = await import('@smithy/core/event-streams'); | ||
| const { EventStreamSerde } = require('@smithy/core/event-streams'); | ||
| return new EventStreamSerde({ | ||
@@ -178,3 +182,3 @@ marshaller: this.getEventStreamMarshaller(), | ||
| const endpoint = await context.endpoint(); | ||
| const ns = schema.NormalizedSchema.of(operationSchema?.input); | ||
| const ns = NormalizedSchema.of(operationSchema?.input); | ||
| const payloadMemberNames = []; | ||
@@ -184,3 +188,3 @@ const payloadMemberSchemas = []; | ||
| let payload; | ||
| const request = new transport.HttpRequest({ | ||
| const request = new HttpRequest({ | ||
| protocol: "", | ||
@@ -198,3 +202,3 @@ hostname: "", | ||
| this.setHostPrefix(request, operationSchema, input); | ||
| const opTraits = schema.translateTraits(operationSchema.traits); | ||
| const opTraits = translateTraits(operationSchema.traits); | ||
| if (opTraits.http) { | ||
@@ -341,3 +345,3 @@ request.method = opTraits.http[0]; | ||
| const deserializer = this.deserializer; | ||
| const ns = schema.NormalizedSchema.of(operationSchema.output); | ||
| const ns = NormalizedSchema.of(operationSchema.output); | ||
| const dataObject = {}; | ||
@@ -375,3 +379,3 @@ if (response.statusCode >= 300) { | ||
| } | ||
| async deserializeHttpMessage(schema$1, context, response, arg4, arg5) { | ||
| async deserializeHttpMessage(schema, context, response, arg4, arg5) { | ||
| let dataObject; | ||
@@ -386,3 +390,3 @@ if (arg4 instanceof Set) { | ||
| const deserializer = this.deserializer; | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| const ns = NormalizedSchema.of(schema); | ||
| const nonHttpBindingMembers = []; | ||
@@ -403,3 +407,3 @@ for (const [memberName, memberSchema] of ns.structIterator()) { | ||
| else { | ||
| dataObject[memberName] = serde.sdkStreamMixin(response.body); | ||
| dataObject[memberName] = sdkStreamMixin(response.body); | ||
| } | ||
@@ -424,6 +428,6 @@ } | ||
| headerListValueSchema.getSchema() === 4) { | ||
| sections = serde.splitEvery(value, ",", 2); | ||
| sections = splitEvery(value, ",", 2); | ||
| } | ||
| else { | ||
| sections = serde.splitHeader(value); | ||
| sections = splitHeader(value); | ||
| } | ||
@@ -470,7 +474,7 @@ const list = []; | ||
| const endpoint = await context.endpoint(); | ||
| const ns = schema.NormalizedSchema.of(operationSchema?.input); | ||
| const schema$1 = ns.getSchema(); | ||
| const ns = NormalizedSchema.of(operationSchema?.input); | ||
| const schema = ns.getSchema(); | ||
| let payload; | ||
| const input = _input && typeof _input === "object" ? _input : {}; | ||
| const request = new transport.HttpRequest({ | ||
| const request = new HttpRequest({ | ||
| protocol: "", | ||
@@ -508,3 +512,3 @@ hostname: "", | ||
| else { | ||
| serializer.write(schema$1, input); | ||
| serializer.write(schema, input); | ||
| payload = serializer.flush(); | ||
@@ -521,3 +525,3 @@ } | ||
| const deserializer = this.deserializer; | ||
| const ns = schema.NormalizedSchema.of(operationSchema.output); | ||
| const ns = NormalizedSchema.of(operationSchema.output); | ||
| const dataObject = {}; | ||
@@ -598,3 +602,3 @@ if (response.statusCode >= 300) { | ||
| } | ||
| return new transport.HttpRequest({ | ||
| return new HttpRequest({ | ||
| protocol, | ||
@@ -671,8 +675,8 @@ hostname: this.hostname || hostname, | ||
| read(_schema, data) { | ||
| const ns = schema.NormalizedSchema.of(_schema); | ||
| const ns = NormalizedSchema.of(_schema); | ||
| if (ns.isListSchema()) { | ||
| return serde.splitHeader(data).map((item) => this.read(ns.getValueSchema(), item)); | ||
| return splitHeader(data).map((item) => this.read(ns.getValueSchema(), item)); | ||
| } | ||
| if (ns.isBlobSchema()) { | ||
| return (this.serdeContext?.base64Decoder ?? serde.fromBase64)(data); | ||
| return (this.serdeContext?.base64Decoder ?? fromBase64)(data); | ||
| } | ||
@@ -683,7 +687,7 @@ if (ns.isTimestampSchema()) { | ||
| case 5: | ||
| return serde._parseRfc3339DateTimeWithOffset(data); | ||
| return _parseRfc3339DateTimeWithOffset(data); | ||
| case 6: | ||
| return serde._parseRfc7231DateTime(data); | ||
| return _parseRfc7231DateTime(data); | ||
| case 7: | ||
| return serde._parseEpochTimestamp(data); | ||
| return _parseEpochTimestamp(data); | ||
| default: | ||
@@ -703,3 +707,3 @@ console.warn("Missing timestamp format, parsing value with Date constructor:", data); | ||
| if (isJson) { | ||
| intermediateValue = serde.LazyJsonString.from(intermediateValue); | ||
| intermediateValue = LazyJsonString.from(intermediateValue); | ||
| } | ||
@@ -716,3 +720,3 @@ return intermediateValue; | ||
| if (ns.isBigDecimalSchema()) { | ||
| return new serde.NumericValue(data, "bigDecimal"); | ||
| return new NumericValue(data, "bigDecimal"); | ||
| } | ||
@@ -725,3 +729,3 @@ if (ns.isBooleanSchema()) { | ||
| base64ToUtf8(base64String) { | ||
| return (this.serdeContext?.utf8Encoder ?? serde.toUtf8)((this.serdeContext?.base64Decoder ?? serde.fromBase64)(base64String)); | ||
| return (this.serdeContext?.utf8Encoder ?? toUtf8)((this.serdeContext?.base64Decoder ?? fromBase64)(base64String)); | ||
| } | ||
@@ -743,6 +747,6 @@ } | ||
| } | ||
| read(schema$1, data) { | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| read(schema, data) { | ||
| const ns = NormalizedSchema.of(schema); | ||
| const traits = ns.getMergedTraits(); | ||
| const toString = this.serdeContext?.utf8Encoder ?? serde.toUtf8; | ||
| const toString = this.serdeContext?.utf8Encoder ?? toUtf8; | ||
| if (traits.httpHeader || traits.httpResponseCode) { | ||
@@ -753,3 +757,3 @@ return this.stringDeserializer.read(ns, toString(data)); | ||
| if (ns.isBlobSchema()) { | ||
| const toBytes = this.serdeContext?.utf8Decoder ?? serde.fromUtf8; | ||
| const toBytes = this.serdeContext?.utf8Decoder ?? fromUtf8; | ||
| if (typeof data === "string") { | ||
@@ -778,4 +782,4 @@ return toBytes(data); | ||
| } | ||
| write(schema$1, value) { | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| write(schema, value) { | ||
| const ns = NormalizedSchema.of(schema); | ||
| switch (typeof value) { | ||
@@ -797,3 +801,3 @@ case "object": | ||
| case 6: | ||
| this.stringBuffer = serde.dateToUtcString(value); | ||
| this.stringBuffer = dateToUtcString(value); | ||
| break; | ||
@@ -810,3 +814,3 @@ case 7: | ||
| if (ns.isBlobSchema() && "byteLength" in value) { | ||
| this.stringBuffer = (this.serdeContext?.base64Encoder ?? serde.toBase64)(value); | ||
| this.stringBuffer = (this.serdeContext?.base64Encoder ?? toBase64)(value); | ||
| return; | ||
@@ -819,3 +823,3 @@ } | ||
| const headerItem = this.flush(); | ||
| const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : serde.quoteHeader(headerItem); | ||
| const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : quoteHeader(headerItem); | ||
| if (buffer !== "") { | ||
@@ -837,6 +841,6 @@ buffer += ", "; | ||
| if (isJson) { | ||
| intermediateValue = serde.LazyJsonString.from(intermediateValue); | ||
| intermediateValue = LazyJsonString.from(intermediateValue); | ||
| } | ||
| if (ns.getMergedTraits().httpHeader) { | ||
| this.stringBuffer = (this.serdeContext?.base64Encoder ?? serde.toBase64)(intermediateValue.toString()); | ||
| this.stringBuffer = (this.serdeContext?.base64Encoder ?? toBase64)(intermediateValue.toString()); | ||
| return; | ||
@@ -849,3 +853,3 @@ } | ||
| if (ns.isIdempotencyToken()) { | ||
| this.stringBuffer = serde.generateIdempotencyToken(); | ||
| this.stringBuffer = generateIdempotencyToken(); | ||
| } | ||
@@ -876,4 +880,4 @@ else { | ||
| } | ||
| write(schema$1, value) { | ||
| const ns = schema.NormalizedSchema.of(schema$1); | ||
| write(schema, value) { | ||
| const ns = NormalizedSchema.of(schema); | ||
| const traits = ns.getMergedTraits(); | ||
@@ -901,3 +905,3 @@ if (traits.httpHeader || traits.httpLabel || traits.httpQuery) { | ||
| values; | ||
| constructor({ name, kind = types.FieldPosition.HEADER, values = [] }) { | ||
| constructor({ name, kind = FieldPosition.HEADER, values = [] }) { | ||
| this.name = name; | ||
@@ -971,3 +975,3 @@ this.kind = kind; | ||
| const request = args.request; | ||
| if (transport.HttpRequest.isInstance(request)) { | ||
| if (HttpRequest.isInstance(request)) { | ||
| const { body, headers } = request; | ||
@@ -1033,7 +1037,2 @@ if (body && | ||
| exports.HttpRequest = transport.HttpRequest; | ||
| exports.HttpResponse = transport.HttpResponse; | ||
| exports.isValidHostname = transport.isValidHostname; | ||
| exports.parseQueryString = transport.parseQueryString; | ||
| exports.parseUrl = transport.parseUrl; | ||
| exports.Field = Field; | ||
@@ -1040,0 +1039,0 @@ exports.Fields = Fields; |
@@ -1,7 +0,5 @@ | ||
| 'use strict'; | ||
| const { NoOpLogger, normalizeProvider } = require("@smithy/core/client"); | ||
| const { HttpResponse, HttpRequest } = require("@smithy/core/protocols"); | ||
| const { parseRfc7231DateTime, v4 } = require("@smithy/core/serde"); | ||
| var client = require('@smithy/core/client'); | ||
| var protocols = require('@smithy/core/protocols'); | ||
| var serde = require('@smithy/core/serde'); | ||
| const isStreamingPayload = (request) => request?.body instanceof ReadableStream; | ||
@@ -93,3 +91,3 @@ | ||
| function parseRetryAfterHeader(response, logger) { | ||
| if (!protocols.HttpResponse.isInstance(response)) { | ||
| if (!HttpResponse.isInstance(response)) { | ||
| return; | ||
@@ -104,3 +102,3 @@ } | ||
| try { | ||
| const date = serde.parseRfc7231DateTime(retryAfter); | ||
| const date = parseRfc7231DateTime(retryAfter); | ||
| retryAfterSeconds = (date.getTime() - Date.now()) / 1000; | ||
@@ -163,5 +161,5 @@ } | ||
| const { request } = args; | ||
| const isRequest = protocols.HttpRequest.isInstance(request); | ||
| const isRequest = HttpRequest.isInstance(request); | ||
| if (isRequest) { | ||
| request.headers[INVOCATION_ID_HEADER] = serde.v4(); | ||
| request.headers[INVOCATION_ID_HEADER] = v4(); | ||
| } | ||
@@ -183,3 +181,3 @@ while (true) { | ||
| if (isRequest && isStreamingPayload(request)) { | ||
| (context.logger instanceof client.NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request."); | ||
| (context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request."); | ||
| throw lastError; | ||
@@ -427,9 +425,9 @@ } | ||
| exports.RETRY_MODES = void 0; | ||
| var RETRY_MODES; | ||
| (function (RETRY_MODES) { | ||
| RETRY_MODES["STANDARD"] = "standard"; | ||
| RETRY_MODES["ADAPTIVE"] = "adaptive"; | ||
| })(exports.RETRY_MODES || (exports.RETRY_MODES = {})); | ||
| })(RETRY_MODES || (RETRY_MODES = {})); | ||
| const DEFAULT_MAX_ATTEMPTS = 3; | ||
| const DEFAULT_RETRY_MODE = exports.RETRY_MODES.STANDARD; | ||
| const DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD; | ||
@@ -442,3 +440,3 @@ const refusal = { | ||
| let StandardRetryStrategy$1 = class StandardRetryStrategy { | ||
| mode = exports.RETRY_MODES.STANDARD; | ||
| mode = RETRY_MODES.STANDARD; | ||
| retryBackoffStrategy; | ||
@@ -531,3 +529,3 @@ capacity = INITIAL_RETRY_TOKENS; | ||
| let AdaptiveRetryStrategy$1 = class AdaptiveRetryStrategy { | ||
| mode = exports.RETRY_MODES.ADAPTIVE; | ||
| mode = RETRY_MODES.ADAPTIVE; | ||
| rateLimiter; | ||
@@ -623,3 +621,3 @@ standardRetryStrategy; | ||
| retryQuota; | ||
| mode = exports.RETRY_MODES.STANDARD; | ||
| mode = RETRY_MODES.STANDARD; | ||
| constructor(maxAttemptsProvider, options) { | ||
@@ -650,8 +648,8 @@ this.maxAttemptsProvider = maxAttemptsProvider; | ||
| const { request } = args; | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| request.headers[INVOCATION_ID_HEADER] = serde.v4(); | ||
| if (HttpRequest.isInstance(request)) { | ||
| request.headers[INVOCATION_ID_HEADER] = v4(); | ||
| } | ||
| while (true) { | ||
| try { | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| if (HttpRequest.isInstance(request)) { | ||
| request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; | ||
@@ -694,3 +692,3 @@ } | ||
| const getDelayFromRetryAfterHeader = (response) => { | ||
| if (!protocols.HttpResponse.isInstance(response)) | ||
| if (!HttpResponse.isInstance(response)) | ||
| return; | ||
@@ -714,3 +712,3 @@ const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); | ||
| this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); | ||
| this.mode = exports.RETRY_MODES.ADAPTIVE; | ||
| this.mode = RETRY_MODES.ADAPTIVE; | ||
| } | ||
@@ -732,3 +730,3 @@ async retry(next, args) { | ||
| const { defaultMaxAttempts = DEFAULT_MAX_ATTEMPTS, defaultBaseDelay = Retry.delay() } = defaults ?? {}; | ||
| const maxAttemptsProvider = client.normalizeProvider(input.maxAttempts ?? defaultMaxAttempts); | ||
| const maxAttemptsProvider = normalizeProvider(input.maxAttempts ?? defaultMaxAttempts); | ||
| let controller = retryStrategy | ||
@@ -739,3 +737,3 @@ ? Promise.resolve(retryStrategy) | ||
| const maxAttempts = await maxAttemptsProvider(); | ||
| const adaptive = (await client.normalizeProvider(retryMode)()) === exports.RETRY_MODES.ADAPTIVE; | ||
| const adaptive = (await normalizeProvider(retryMode)()) === RETRY_MODES.ADAPTIVE; | ||
| if (adaptive) { | ||
@@ -760,3 +758,3 @@ return new AdaptiveRetryStrategy$1(maxAttemptsProvider, { | ||
| const { request } = args; | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| if (HttpRequest.isInstance(request)) { | ||
| delete request.headers[INVOCATION_ID_HEADER]; | ||
@@ -810,2 +808,3 @@ delete request.headers[REQUEST_HEADER]; | ||
| exports.RETRY_COST = RETRY_COST; | ||
| exports.RETRY_MODES = RETRY_MODES; | ||
| exports.Retry = Retry; | ||
@@ -812,0 +811,0 @@ exports.StandardRetryStrategy = StandardRetryStrategy$1; |
@@ -1,9 +0,7 @@ | ||
| 'use strict'; | ||
| const { Readable } = require("node:stream"); | ||
| const { NoOpLogger, normalizeProvider } = require("@smithy/core/client"); | ||
| const { HttpResponse, HttpRequest } = require("@smithy/core/protocols"); | ||
| const { parseRfc7231DateTime, v4 } = require("@smithy/core/serde"); | ||
| var node_stream = require('node:stream'); | ||
| var client = require('@smithy/core/client'); | ||
| var protocols = require('@smithy/core/protocols'); | ||
| var serde = require('@smithy/core/serde'); | ||
| const isStreamingPayload = (request) => request?.body instanceof node_stream.Readable || | ||
| const isStreamingPayload = (request) => request?.body instanceof Readable || | ||
| (typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream); | ||
@@ -95,3 +93,3 @@ | ||
| function parseRetryAfterHeader(response, logger) { | ||
| if (!protocols.HttpResponse.isInstance(response)) { | ||
| if (!HttpResponse.isInstance(response)) { | ||
| return; | ||
@@ -106,3 +104,3 @@ } | ||
| try { | ||
| const date = serde.parseRfc7231DateTime(retryAfter); | ||
| const date = parseRfc7231DateTime(retryAfter); | ||
| retryAfterSeconds = (date.getTime() - Date.now()) / 1000; | ||
@@ -165,5 +163,5 @@ } | ||
| const { request } = args; | ||
| const isRequest = protocols.HttpRequest.isInstance(request); | ||
| const isRequest = HttpRequest.isInstance(request); | ||
| if (isRequest) { | ||
| request.headers[INVOCATION_ID_HEADER] = serde.v4(); | ||
| request.headers[INVOCATION_ID_HEADER] = v4(); | ||
| } | ||
@@ -185,3 +183,3 @@ while (true) { | ||
| if (isRequest && isStreamingPayload(request)) { | ||
| (context.logger instanceof client.NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request."); | ||
| (context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request."); | ||
| throw lastError; | ||
@@ -429,9 +427,9 @@ } | ||
| exports.RETRY_MODES = void 0; | ||
| var RETRY_MODES; | ||
| (function (RETRY_MODES) { | ||
| RETRY_MODES["STANDARD"] = "standard"; | ||
| RETRY_MODES["ADAPTIVE"] = "adaptive"; | ||
| })(exports.RETRY_MODES || (exports.RETRY_MODES = {})); | ||
| })(RETRY_MODES || (RETRY_MODES = {})); | ||
| const DEFAULT_MAX_ATTEMPTS = 3; | ||
| const DEFAULT_RETRY_MODE = exports.RETRY_MODES.STANDARD; | ||
| const DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD; | ||
@@ -444,3 +442,3 @@ const refusal = { | ||
| let StandardRetryStrategy$1 = class StandardRetryStrategy { | ||
| mode = exports.RETRY_MODES.STANDARD; | ||
| mode = RETRY_MODES.STANDARD; | ||
| retryBackoffStrategy; | ||
@@ -533,3 +531,3 @@ capacity = INITIAL_RETRY_TOKENS; | ||
| let AdaptiveRetryStrategy$1 = class AdaptiveRetryStrategy { | ||
| mode = exports.RETRY_MODES.ADAPTIVE; | ||
| mode = RETRY_MODES.ADAPTIVE; | ||
| rateLimiter; | ||
@@ -625,3 +623,3 @@ standardRetryStrategy; | ||
| retryQuota; | ||
| mode = exports.RETRY_MODES.STANDARD; | ||
| mode = RETRY_MODES.STANDARD; | ||
| constructor(maxAttemptsProvider, options) { | ||
@@ -652,8 +650,8 @@ this.maxAttemptsProvider = maxAttemptsProvider; | ||
| const { request } = args; | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| request.headers[INVOCATION_ID_HEADER] = serde.v4(); | ||
| if (HttpRequest.isInstance(request)) { | ||
| request.headers[INVOCATION_ID_HEADER] = v4(); | ||
| } | ||
| while (true) { | ||
| try { | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| if (HttpRequest.isInstance(request)) { | ||
| request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; | ||
@@ -696,3 +694,3 @@ } | ||
| const getDelayFromRetryAfterHeader = (response) => { | ||
| if (!protocols.HttpResponse.isInstance(response)) | ||
| if (!HttpResponse.isInstance(response)) | ||
| return; | ||
@@ -716,3 +714,3 @@ const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); | ||
| this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); | ||
| this.mode = exports.RETRY_MODES.ADAPTIVE; | ||
| this.mode = RETRY_MODES.ADAPTIVE; | ||
| } | ||
@@ -759,3 +757,3 @@ async retry(next, args) { | ||
| const { defaultMaxAttempts = DEFAULT_MAX_ATTEMPTS, defaultBaseDelay = Retry.delay() } = defaults ?? {}; | ||
| const maxAttemptsProvider = client.normalizeProvider(input.maxAttempts ?? defaultMaxAttempts); | ||
| const maxAttemptsProvider = normalizeProvider(input.maxAttempts ?? defaultMaxAttempts); | ||
| let controller = retryStrategy | ||
@@ -766,3 +764,3 @@ ? Promise.resolve(retryStrategy) | ||
| const maxAttempts = await maxAttemptsProvider(); | ||
| const adaptive = (await client.normalizeProvider(retryMode)()) === exports.RETRY_MODES.ADAPTIVE; | ||
| const adaptive = (await normalizeProvider(retryMode)()) === RETRY_MODES.ADAPTIVE; | ||
| if (adaptive) { | ||
@@ -794,3 +792,3 @@ return new AdaptiveRetryStrategy$1(maxAttemptsProvider, { | ||
| const { request } = args; | ||
| if (protocols.HttpRequest.isInstance(request)) { | ||
| if (HttpRequest.isInstance(request)) { | ||
| delete request.headers[INVOCATION_ID_HEADER]; | ||
@@ -837,2 +835,3 @@ delete request.headers[REQUEST_HEADER]; | ||
| exports.RETRY_COST = RETRY_COST; | ||
| exports.RETRY_MODES = RETRY_MODES; | ||
| exports.Retry = Retry; | ||
@@ -839,0 +838,0 @@ exports.StandardRetryStrategy = StandardRetryStrategy$1; |
@@ -1,5 +0,3 @@ | ||
| 'use strict'; | ||
| const { getSmithyContext, HttpResponse, toEndpointV1 } = require("@smithy/core/transport"); | ||
| var transport = require('@smithy/core/transport'); | ||
| const deref = (schemaRef) => { | ||
@@ -22,3 +20,3 @@ if (typeof schemaRef === "function") { | ||
| const { response } = await next(args); | ||
| const { operationSchema } = transport.getSmithyContext(context); | ||
| const { operationSchema } = getSmithyContext(context); | ||
| const [, ns, n, t, i, o] = operationSchema ?? []; | ||
@@ -61,3 +59,3 @@ try { | ||
| try { | ||
| if (transport.HttpResponse.isInstance(response)) { | ||
| if (HttpResponse.isInstance(response)) { | ||
| const { headers = {}, statusCode } = response; | ||
@@ -86,6 +84,6 @@ const headerEntries = Object.entries(headers); | ||
| const schemaSerializationMiddleware = (config) => (next, context) => async (args) => { | ||
| const { operationSchema } = transport.getSmithyContext(context); | ||
| const { operationSchema } = getSmithyContext(context); | ||
| const [, ns, n, t, i, o] = operationSchema ?? []; | ||
| const endpoint = context.endpointV2 | ||
| ? async () => transport.toEndpointV1(context.endpointV2) | ||
| ? async () => toEndpointV1(context.endpointV2) | ||
| : config.endpoint; | ||
@@ -92,0 +90,0 @@ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, { |
@@ -1,6 +0,4 @@ | ||
| 'use strict'; | ||
| const { HttpResponse } = require("@smithy/core/transport"); | ||
| const { toEndpointV1 } = require("@smithy/core/endpoints"); | ||
| var transport = require('@smithy/core/transport'); | ||
| var endpoints = require('@smithy/core/endpoints'); | ||
| const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`; | ||
@@ -915,3 +913,3 @@ const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => { | ||
| try { | ||
| if (transport.HttpResponse.isInstance(response)) { | ||
| if (HttpResponse.isInstance(response)) { | ||
| const { headers = {} } = response; | ||
@@ -942,3 +940,3 @@ const headerEntries = Object.entries(headers); | ||
| const endpoint = context.endpointV2 | ||
| ? async () => endpoints.toEndpointV1(context.endpointV2) | ||
| ? async () => toEndpointV1(context.endpointV2) | ||
| : endpointConfig.endpoint; | ||
@@ -945,0 +943,0 @@ if (!endpoint) { |
@@ -1,9 +0,7 @@ | ||
| 'use strict'; | ||
| const { createHmac, createHash, getRandomValues } = require("node:crypto"); | ||
| const { ReadStream, lstatSync, fstatSync } = require("node:fs"); | ||
| const { HttpResponse } = require("@smithy/core/transport"); | ||
| const { toEndpointV1 } = require("@smithy/core/endpoints"); | ||
| const { Duplex, Readable, Writable, PassThrough } = require("node:stream"); | ||
| var node_crypto = require('node:crypto'); | ||
| var node_fs = require('node:fs'); | ||
| var transport = require('@smithy/core/transport'); | ||
| var endpoints = require('@smithy/core/endpoints'); | ||
| var node_stream = require('node:stream'); | ||
| const isArrayBuffer = (arg) => (typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer) || | ||
@@ -824,8 +822,8 @@ Object.prototype.toString.call(arg) === "[object ArrayBuffer]"; | ||
| } | ||
| else if (body instanceof node_fs.ReadStream) { | ||
| else if (body instanceof ReadStream) { | ||
| if (body.path != null) { | ||
| return node_fs.lstatSync(body.path).size; | ||
| return lstatSync(body.path).size; | ||
| } | ||
| else if (typeof body.fd === "number") { | ||
| return node_fs.fstatSync(body.fd).size; | ||
| return fstatSync(body.fd).size; | ||
| } | ||
@@ -881,3 +879,3 @@ } | ||
| try { | ||
| if (transport.HttpResponse.isInstance(response)) { | ||
| if (HttpResponse.isInstance(response)) { | ||
| const { headers = {} } = response; | ||
@@ -908,3 +906,3 @@ const headerEntries = Object.entries(headers); | ||
| const endpoint = context.endpointV2 | ||
| ? async () => endpoints.toEndpointV1(context.endpointV2) | ||
| ? async () => toEndpointV1(context.endpointV2) | ||
| : endpointConfig.endpoint; | ||
@@ -959,4 +957,4 @@ if (!endpoint) { | ||
| this.hash = this.secret | ||
| ? node_crypto.createHmac(this.algorithmIdentifier, castSourceData(this.secret)) | ||
| : node_crypto.createHash(this.algorithmIdentifier); | ||
| ? createHmac(this.algorithmIdentifier, castSourceData(this.secret)) | ||
| : createHash(this.algorithmIdentifier); | ||
| } | ||
@@ -977,3 +975,3 @@ } | ||
| let ChecksumStream$1 = class ChecksumStream extends node_stream.Duplex { | ||
| let ChecksumStream$1 = class ChecksumStream extends Duplex { | ||
| expectedChecksum; | ||
@@ -1264,3 +1262,3 @@ checksumSourceLocation; | ||
| } | ||
| const downstream = new node_stream.Readable({ read() { } }); | ||
| const downstream = new Readable({ read() { } }); | ||
| let streamBufferingLoggedWarning = false; | ||
@@ -1355,3 +1353,3 @@ let bytesSeen = 0; | ||
| const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : undefined; | ||
| const awsChunkedEncodingStream = new node_stream.Readable({ | ||
| const awsChunkedEncodingStream = new Readable({ | ||
| read: () => { }, | ||
@@ -1431,3 +1429,3 @@ }); | ||
| }; | ||
| let Collector$1 = class Collector extends node_stream.Writable { | ||
| let Collector$1 = class Collector extends Writable { | ||
| buffers = []; | ||
@@ -1608,3 +1606,3 @@ limit = Infinity; | ||
| class Collector extends node_stream.Writable { | ||
| class Collector extends Writable { | ||
| bufferedBytes = []; | ||
@@ -1659,3 +1657,3 @@ _write(chunk, encoding, callback) { | ||
| const sdkStreamMixin = (stream) => { | ||
| if (!(stream instanceof node_stream.Readable)) { | ||
| if (!(stream instanceof Readable)) { | ||
| try { | ||
@@ -1696,7 +1694,7 @@ return sdkStreamMixin$1(stream); | ||
| } | ||
| if (typeof node_stream.Readable.toWeb !== "function") { | ||
| if (typeof Readable.toWeb !== "function") { | ||
| throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available."); | ||
| } | ||
| transformed = true; | ||
| return node_stream.Readable.toWeb(stream); | ||
| return Readable.toWeb(stream); | ||
| }, | ||
@@ -1718,4 +1716,4 @@ }); | ||
| } | ||
| const stream1 = new node_stream.PassThrough(); | ||
| const stream2 = new node_stream.PassThrough(); | ||
| const stream1 = new PassThrough(); | ||
| const stream2 = new PassThrough(); | ||
| stream.pipe(stream1); | ||
@@ -1728,3 +1726,3 @@ stream.pipe(stream2); | ||
| } | ||
| const _getRandomValues = node_crypto.getRandomValues; | ||
| const _getRandomValues = getRandomValues; | ||
| const v4 = bindV4(_getRandomValues); | ||
@@ -1731,0 +1729,0 @@ const generateIdempotencyToken = v4; |
@@ -1,6 +0,4 @@ | ||
| 'use strict'; | ||
| const { HttpResponse } = require("@smithy/core/transport"); | ||
| const { toEndpointV1 } = require("@smithy/core/endpoints"); | ||
| var transport = require('@smithy/core/transport'); | ||
| var endpoints = require('@smithy/core/endpoints'); | ||
| const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`; | ||
@@ -915,3 +913,3 @@ const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => { | ||
| try { | ||
| if (transport.HttpResponse.isInstance(response)) { | ||
| if (HttpResponse.isInstance(response)) { | ||
| const { headers = {} } = response; | ||
@@ -942,3 +940,3 @@ const headerEntries = Object.entries(headers); | ||
| const endpoint = context.endpointV2 | ||
| ? async () => endpoints.toEndpointV1(context.endpointV2) | ||
| ? async () => toEndpointV1(context.endpointV2) | ||
| : endpointConfig.endpoint; | ||
@@ -945,0 +943,0 @@ if (!endpoint) { |
@@ -1,7 +0,5 @@ | ||
| 'use strict'; | ||
| const { SMITHY_CONTEXT_KEY } = require("@smithy/types"); | ||
| var types = require('@smithy/types'); | ||
| const getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {}); | ||
| const getSmithyContext = (context) => context[types.SMITHY_CONTEXT_KEY] || (context[types.SMITHY_CONTEXT_KEY] = {}); | ||
| class HttpRequest { | ||
@@ -8,0 +6,0 @@ method; |
@@ -1,2 +0,2 @@ | ||
| import { getSmithyContext } from "@smithy/core/client"; | ||
| import { getSmithyContext } from "@smithy/core/transport"; | ||
| import { resolveAuthOptions } from "./resolveAuthOptions"; | ||
@@ -3,0 +3,0 @@ function convertHttpAuthSchemesToMap(httpAuthSchemes) { |
@@ -1,3 +0,3 @@ | ||
| import { getSmithyContext } from "@smithy/core/client"; | ||
| import { HttpRequest } from "@smithy/core/protocols"; | ||
| import { getSmithyContext } from "@smithy/core/transport"; | ||
| const defaultErrorHandler = (signingProperties) => (error) => { | ||
@@ -4,0 +4,0 @@ throw error; |
@@ -1,4 +0,4 @@ | ||
| import { getSmithyContext } from "@smithy/core/client"; | ||
| import { RpcProtocol } from "@smithy/core/protocols"; | ||
| import { NormalizedSchema, TypeRegistry, deref } from "@smithy/core/schema"; | ||
| import { getSmithyContext } from "@smithy/core/transport"; | ||
| import { CborCodec } from "./CborCodec"; | ||
@@ -5,0 +5,0 @@ import { loadSmithyRpcV2CborErrorCode } from "./parseCborBody"; |
@@ -1,2 +0,2 @@ | ||
| import { getSmithyContext } from "@smithy/core/client"; | ||
| import { getSmithyContext } from "@smithy/core/transport"; | ||
| import { bindGetEndpointFromInstructions } from "./adaptors/getEndpointFromInstructions"; | ||
@@ -3,0 +3,0 @@ function setFeature(context, feature, value) { |
@@ -65,3 +65,3 @@ import type { Schema as ISchema, StaticErrorSchema } from "@smithy/types"; | ||
| */ | ||
| find(predicate: (schema: ISchema) => boolean): number | import("@smithy/types").StaticSimpleSchema | import("@smithy/types").StaticListSchema | import("@smithy/types").StaticMapSchema | import("@smithy/types").StaticStructureSchema | import("@smithy/types").StaticUnionSchema | StaticErrorSchema | import("@smithy/types").StaticOperationSchema | "unit" | import("@smithy/types").NormalizedSchema | import("@smithy/types").TraitsSchema | import("@smithy/types").MemberSchema | undefined; | ||
| find(predicate: (schema: ISchema) => boolean): number | "unit" | import("@smithy/types").StaticSimpleSchema | import("@smithy/types").StaticListSchema | import("@smithy/types").StaticMapSchema | import("@smithy/types").StaticStructureSchema | import("@smithy/types").StaticUnionSchema | StaticErrorSchema | import("@smithy/types").StaticOperationSchema | import("@smithy/types").NormalizedSchema | import("@smithy/types").TraitsSchema | import("@smithy/types").MemberSchema | undefined; | ||
| /** | ||
@@ -68,0 +68,0 @@ * Unloads the current TypeRegistry. |
+7
-6
| { | ||
| "name": "@smithy/core", | ||
| "version": "3.24.7", | ||
| "version": "3.25.0", | ||
| "scripts": { | ||
| "build": "yarn lint && concurrently 'yarn:build:types' 'yarn:build:es:cjs'", | ||
| "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline", | ||
| "build:types": "yarn g:tsc -p tsconfig.types.json", | ||
| "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'", | ||
| "build:es:cjs": "premove dist-es && yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline", | ||
| "build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json", | ||
| "build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4", | ||
| "clean": "premove dist-cjs dist-es dist-types *.tsbuildinfo", | ||
| "clean": "premove dist-cjs dist-es dist-types", | ||
| "extract:docs": "api-extractor run --local", | ||
| "format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"", | ||
| "lint": "node ../../scripts/validation/submodules-linter.js", | ||
| "prebuild": "yarn lint", | ||
| "stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz", | ||
@@ -172,3 +173,3 @@ "test": "yarn g:vitest run", | ||
| "@aws-crypto/crc32": "5.2.0", | ||
| "@smithy/types": "^4.14.4", | ||
| "@smithy/types": "^4.15.0", | ||
| "tslib": "^2.6.2" | ||
@@ -175,0 +176,0 @@ }, |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1316626
-0.06%32647
-0.05%Updated