diff --git a/THIRD-PARTY b/THIRD-PARTY index 26de187f..e085b133 100644 --- a/THIRD-PARTY +++ b/THIRD-PARTY @@ -433,8 +433,8 @@ Apache License The following npm packages may be included in this product: - @aws-sdk/signature-v4-multi-region@3.996.46 - - @smithy/core@3.33.3 - - @smithy/types@4.18.0 + - @smithy/core@3.35.0 + - @smithy/types@4.19.0 These packages each contain the following license: @@ -832,7 +832,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The following npm package may be included in this product: - - @aws-sdk/core@3.978.0 + - @aws-sdk/core@3.978.1 This package contains the following license: @@ -1042,16 +1042,16 @@ Apache License The following npm packages may be included in this product: - - @aws-sdk/credential-provider-env@3.972.71 + - @aws-sdk/credential-provider-env@3.972.72 - @aws-sdk/credential-provider-ini@3.973.16 - @aws-sdk/credential-provider-node@3.972.83 - @aws-sdk/token-providers@3.1129.0 - - @aws-sdk/types@3.974.5 - - @aws-sdk/xml-builder@3.972.40 + - @aws-sdk/types@3.974.6 + - @aws-sdk/xml-builder@3.972.41 - @smithy/credential-provider-imds@4.5.2 - @smithy/fetch-http-handler@5.7.2 - @smithy/node-http-handler@4.12.1 - - @smithy/signature-v4@5.6.12 + - @smithy/signature-v4@5.7.4 These packages each contain the following license: diff --git a/dist/index.js b/dist/index.js index f4d193e9..af4d0336 100644 --- a/dist/index.js +++ b/dist/index.js @@ -20488,12 +20488,12 @@ var init_TypeRegistry = __esm({ this.namespace = namespace; this.schemas = schemas; this.exceptions = exceptions; + if (!_TypeRegistry.registries.has(namespace)) { + _TypeRegistry.registries.set(namespace, this); + } } static for(namespace) { - if (!_TypeRegistry.registries.has(namespace)) { - _TypeRegistry.registries.set(namespace, new _TypeRegistry(namespace)); - } - return _TypeRegistry.registries.get(namespace); + return _TypeRegistry.registries.get(namespace) ?? new _TypeRegistry(namespace); } copyFrom(other) { const { schemas, exceptions } = this; @@ -20511,7 +20511,9 @@ var init_TypeRegistry = __esm({ register(shapeId, schema) { const qualifiedName = this.normalizeShapeId(shapeId); for (const r5 of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) { - r5.schemas.set(qualifiedName, schema); + if (!r5.schemas.has(qualifiedName)) { + r5.schemas.set(qualifiedName, schema); + } } } getSchema(shapeId) { @@ -20536,9 +20538,12 @@ var init_TypeRegistry = __esm({ registerError(es, ctor) { const $error = es; const ns = $error[1]; + const qualifiedName = ns + "#" + $error[2]; for (const r5 of [this, _TypeRegistry.for(ns)]) { - r5.schemas.set(ns + "#" + $error[2], $error); - r5.exceptions.set($error, ctor); + if (!r5.schemas.has(qualifiedName) && !r5.exceptions.has($error)) { + r5.schemas.set(qualifiedName, $error); + r5.exceptions.set($error, ctor); + } } } getErrorCtor(es) { @@ -20691,20 +20696,27 @@ var init_command = __esm({ } const stack = clientStack.concat(this.middlewareStack); const { logger: logger2 } = configuration; + const additionalSmithyContext = additionalContext[import_types2.SMITHY_CONTEXT_KEY]; const handlerExecutionContext = { logger: logger2, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, + ...additionalContext, [import_types2.SMITHY_CONTEXT_KEY]: { + ...additionalSmithyContext, commandInstance: this, - ...smithyContext - }, - ...additionalContext + ...smithyContext, + ...options?.metricsRecorder === void 0 ? {} : { metricsRecorder: options.metricsRecorder } + } }; const { requestHandler } = configuration; let requestOptions = options ?? {}; + if (requestOptions.metricsRecorder) { + requestOptions = { ...requestOptions }; + delete requestOptions.metricsRecorder; + } if (smithyContext.eventStream) { requestOptions = { isEventStream: true, @@ -20901,10 +20913,25 @@ var init_exceptions = __esm({ return _ServiceException.isInstance(instance); } if (_ServiceException.isInstance(instance)) { - if (candidate.name && this.name) { - return this.prototype.isPrototypeOf(instance) || candidate.name === this.name; + if (this.prototype.isPrototypeOf(instance)) { + return true; } - return this.prototype.isPrototypeOf(instance); + const targetName = this.name; + if (!targetName || !candidate.name) { + return false; + } + if (candidate.name === targetName) { + return true; + } + let proto = Object.getPrototypeOf(candidate); + while (proto && proto !== Object.prototype) { + const ctorName = proto.constructor?.name; + if (ctorName && ctorName !== "Error" && ctorName === targetName) { + return true; + } + proto = Object.getPrototypeOf(proto); + } + return false; } return false; } @@ -25302,6 +25329,8 @@ var init_getAwsChunkedEncodingStream_browser = __esm({ const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; const checksumRequired = base64Encoder !== void 0 && bodyLengthChecker !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; const digest2 = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; + Promise.resolve(digest2).catch(() => { + }); const reader = readableStream.getReader(); return new ReadableStream({ async pull(controller) { @@ -25338,8 +25367,11 @@ function getAwsChunkedEncodingStream2(stream, options) { const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; const digest2 = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : void 0; + Promise.resolve(digest2).catch(() => { + }); const awsChunkedEncodingStream = new import_node_stream4.Readable({ - read: () => { + read() { + readable.resume(); } }); readable.on("data", (data2) => { @@ -25350,19 +25382,29 @@ function getAwsChunkedEncodingStream2(stream, options) { awsChunkedEncodingStream.push(`${length.toString(16)}\r `); awsChunkedEncodingStream.push(data2); - awsChunkedEncodingStream.push("\r\n"); + if (!awsChunkedEncodingStream.push("\r\n")) { + readable.pause(); + } }); + readable.on("error", (err) => { + awsChunkedEncodingStream.destroy(err); + }); + readable.pause(); readable.on("end", async () => { - awsChunkedEncodingStream.push(`0\r + try { + awsChunkedEncodingStream.push(`0\r `); - if (checksumRequired) { - const checksum = base64Encoder(await digest2); - awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r + if (checksumRequired) { + const checksum = base64Encoder(await digest2); + awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r `); - awsChunkedEncodingStream.push(`\r + awsChunkedEncodingStream.push(`\r `); + } + awsChunkedEncodingStream.push(null); + } catch (err) { + awsChunkedEncodingStream.destroy(err); } - awsChunkedEncodingStream.push(null); }); return awsChunkedEncodingStream; } @@ -27620,7 +27662,7 @@ var init_HttpProtocol = __esm({ constructor(options) { super(); this.options = options; - this.compositeErrorRegistry = TypeRegistry.for(options.defaultNamespace); + this.compositeErrorRegistry = new TypeRegistry(options.defaultNamespace); for (const etr of options.errorTypeRegistries ?? []) { this.compositeErrorRegistry.copyFrom(etr); } @@ -27714,6 +27756,44 @@ var init_HttpProtocol = __esm({ cfId: output.headers["x-amz-cf-id"] }; } + resolveError(name, namespaces, registries) { + const defaultErrorSchema = [-3, "", "Error", 0, [], [], 0]; + let schema; + for (const registry of registries) { + for (const ns of namespaces) { + try { + if (ns === "*") { + schema = registry.getSchema(name); + } else { + schema = registry.getSchema(ns + "#" + name); + } + const errorCtor = registry.getErrorCtor(schema); + if (errorCtor) { + return [schema, errorCtor, "modeled"]; + } else { + const syntheticErrorSchema = registry.getBaseException(); + if (syntheticErrorSchema) { + const syntheticErrorCtor = registry.getErrorCtor(syntheticErrorSchema); + if (syntheticErrorCtor) { + return [schema, syntheticErrorCtor, "synthetic"]; + } + } + } + } catch (ignored) { + } + } + } + for (const registry of registries) { + const syntheticErrorSchema = registry.getBaseException(); + if (syntheticErrorSchema) { + const syntheticErrorCtor = registry.getErrorCtor(syntheticErrorSchema); + if (syntheticErrorCtor) { + return [syntheticErrorSchema, syntheticErrorCtor, "synthetic"]; + } + } + } + return [defaultErrorSchema, Error, "native"]; + } async serializeEventStream({ eventStream, requestSchema, initialRequest }) { const eventStreamSerde = await this.loadEventStreamCapability(); return eventStreamSerde.serializeEventStream({ @@ -27742,13 +27822,6 @@ var init_HttpProtocol = __esm({ compositeErrorRegistry: this.compositeErrorRegistry }); } - resolveEventStreamMarshaller(importedProvider) { - const context = this.serdeContext; - if (context.eventStreamMarshaller) { - return context.eventStreamMarshaller; - } - return importedProvider(this.serdeContext); - } getDefaultContentType() { throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`); } @@ -27767,6 +27840,13 @@ var init_HttpProtocol = __esm({ } return context.eventStreamMarshaller; } + resolveEventStreamMarshaller(importedProvider) { + const context = this.serdeContext; + if (context.eventStreamMarshaller) { + return context.eventStreamMarshaller; + } + return importedProvider(this.serdeContext); + } }; } }); @@ -28825,7 +28905,7 @@ var init_service_error_classification = __esm({ return errorMessages.has(error3.message); }; isThrottlingError = (error3) => error3.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error3.name) || error3.$retryable?.throttling == true; - isTransientError = (error3, depth = 0) => isRetryableByTrait(error3) || isClockSkewCorrectedError(error3) || error3.name === "InvalidSignatureException" && error3.message?.includes("Signature expired") || TRANSIENT_ERROR_CODES.includes(error3.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error3?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error3?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error3.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error3) || isNodeJsHttp2TransientError(error3) || error3.cause !== void 0 && depth <= 10 && isTransientError(error3.cause, depth + 1); + isTransientError = (error3, depth = 0) => error3?.name !== "AbortError" && (isRetryableByTrait(error3) || isClockSkewCorrectedError(error3) || error3.name === "InvalidSignatureException" && error3.message?.includes("Signature expired") || TRANSIENT_ERROR_CODES.includes(error3.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error3?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error3?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error3.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error3) || isNodeJsHttp2TransientError(error3) || error3.cause !== void 0 && depth <= 10 && isTransientError(error3.cause, depth + 1)); isServerError = (error3) => { if (error3.$metadata?.httpStatusCode !== void 0) { const statusCode = error3.$metadata.httpStatusCode; @@ -32602,13 +32682,15 @@ var init_resolveAwsSdkSigV4AConfig = __esm({ // node_modules/@smithy/signature-v4/dist-cjs/index.js var require_dist_cjs2 = __commonJS({ "node_modules/@smithy/signature-v4/dist-cjs/index.js"(exports2) { - var { fromUtf8: fromUtf83, fromHex: fromHex2, toHex: toHex2, toUint8Array: toUint8Array2, isArrayBuffer: isArrayBuffer2 } = (init_serde(), __toCommonJS(serde_exports)); + var { hasOwn: hasOwn2, fromUtf8: fromUtf83, fromHex: fromHex2, toHex: toHex2, toUint8Array: toUint8Array2, isArrayBuffer: isArrayBuffer2 } = (init_serde(), __toCommonJS(serde_exports)); var { normalizeProvider: normalizeProvider3 } = (init_client2(), __toCommonJS(client_exports)); var { escapeUri: escapeUri2, HttpRequest: HttpRequest2 } = (init_protocols(), __toCommonJS(protocols_exports)); var HeaderFormatter = class { format(headers) { const chunks = []; - for (const headerName of Object.keys(headers)) { + for (const headerName in headers) { + if (!hasOwn2(headers, headerName)) + continue; const bytes = fromUtf83(headerName); chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName])); } @@ -32623,27 +32705,27 @@ var require_dist_cjs2 = __commonJS({ formatHeaderValue(header) { switch (header.type) { case "boolean": - return Uint8Array.from([header.value ? HEADER_VALUE_TYPE2.boolTrue : HEADER_VALUE_TYPE2.boolFalse]); + return Uint8Array.from([header.value ? 0 : 1]); case "byte": - return Uint8Array.from([HEADER_VALUE_TYPE2.byte, header.value]); + return Uint8Array.from([2, header.value]); case "short": const shortView = new DataView(new ArrayBuffer(3)); - shortView.setUint8(0, HEADER_VALUE_TYPE2.short); + shortView.setUint8(0, 3); shortView.setInt16(1, header.value, false); return new Uint8Array(shortView.buffer); case "integer": const intView = new DataView(new ArrayBuffer(5)); - intView.setUint8(0, HEADER_VALUE_TYPE2.integer); + intView.setUint8(0, 4); intView.setInt32(1, header.value, false); return new Uint8Array(intView.buffer); case "long": const longBytes = new Uint8Array(9); - longBytes[0] = HEADER_VALUE_TYPE2.long; + longBytes[0] = 5; longBytes.set(header.value.bytes, 1); return longBytes; case "binary": const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); - binView.setUint8(0, HEADER_VALUE_TYPE2.byteArray); + binView.setUint8(0, 6); binView.setUint16(1, header.value.byteLength, false); const binBytes = new Uint8Array(binView.buffer); binBytes.set(header.value, 3); @@ -32651,14 +32733,14 @@ var require_dist_cjs2 = __commonJS({ case "string": const utf8Bytes = fromUtf83(header.value); const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); - strView.setUint8(0, HEADER_VALUE_TYPE2.string); + strView.setUint8(0, 7); strView.setUint16(1, utf8Bytes.byteLength, false); const strBytes = new Uint8Array(strView.buffer); strBytes.set(utf8Bytes, 3); return strBytes; case "timestamp": const tsBytes = new Uint8Array(9); - tsBytes[0] = HEADER_VALUE_TYPE2.timestamp; + tsBytes[0] = 8; tsBytes.set(Int642.fromNumber(header.value.valueOf()).bytes, 1); return tsBytes; case "uuid": @@ -32666,7 +32748,7 @@ var require_dist_cjs2 = __commonJS({ throw new Error(`Invalid UUID received: ${header.value}`); } const uuidBytes = new Uint8Array(17); - uuidBytes[0] = HEADER_VALUE_TYPE2.uuid; + uuidBytes[0] = 9; uuidBytes.set(fromHex2(header.value.replace(/-/g, "")), 1); return uuidBytes; } @@ -32775,7 +32857,9 @@ var require_dist_cjs2 = __commonJS({ var getCanonicalQuery = ({ query = {} }) => { const keys = []; const serialized = {}; - for (const key of Object.keys(query)) { + for (const key in query) { + if (!hasOwn2(query, key)) + continue; if (key.toLowerCase() === SIGNATURE_HEADER) { continue; } @@ -32915,12 +32999,14 @@ ${toHex2(hashedRequest)}`; continue; } } - canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); + canonical[canonicalHeaderName] = headers[headerName].replace(/[\r\n]/g, " ").replace(/[ \t]+/g, " ").replace(/^ | $/g, ""); } return canonical; }; var getPayloadHash = async ({ headers, body }, hashConstructor) => { - for (const headerName of Object.keys(headers)) { + for (const headerName in headers) { + if (!hasOwn2(headers, headerName)) + continue; if (headerName.toLowerCase() === SHA256_HEADER) { return headers[headerName]; } @@ -32936,7 +33022,9 @@ ${toHex2(hashedRequest)}`; }; var hasHeader = (soughtHeader, headers) => { soughtHeader = soughtHeader.toLowerCase(); - for (const headerName of Object.keys(headers)) { + for (const headerName in headers) { + if (!hasOwn2(headers, headerName)) + continue; if (soughtHeader === headerName.toLowerCase()) { return true; } @@ -32945,7 +33033,9 @@ ${toHex2(hashedRequest)}`; }; var moveHeadersToQuery = (request, options = {}) => { const { headers, query = {} } = HttpRequest2.clone(request); - for (const name of Object.keys(headers)) { + for (const name in headers) { + if (!hasOwn2(headers, name)) + continue; const lname = name.toLowerCase(); if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) { query[name] = headers[name]; @@ -32960,7 +33050,9 @@ ${toHex2(hashedRequest)}`; }; var prepareRequest = (request) => { request = HttpRequest2.clone(request); - for (const headerName of Object.keys(request.headers)) { + for (const headerName in request.headers) { + if (!hasOwn2(request.headers, headerName)) + continue; if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { delete request.headers[headerName]; } @@ -35071,7 +35163,6 @@ var init_cbor_types = __esm({ var loadSmithyRpcV2CborErrorCode; var init_parseCborBody = __esm({ "node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js"() { - init_transport(); loadSmithyRpcV2CborErrorCode = (output, data2) => { const sanitizeErrorCode2 = (rawValue) => { let cleanValue = rawValue; @@ -35084,26 +35175,11 @@ var init_parseCborBody = __esm({ if (cleanValue.indexOf(":") >= 0) { cleanValue = cleanValue.split(":")[0]; } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } return cleanValue; }; if (data2["__type"] !== void 0) { return sanitizeErrorCode2(data2["__type"]); } - let codeKey; - for (const key in data2) { - if (!hasOwn(data2, key)) - continue; - if (key.toLowerCase() === "code") { - codeKey = key; - break; - } - } - if (codeKey && data2[codeKey] !== void 0) { - return sanitizeErrorCode2(data2[codeKey]); - } }; } }); @@ -36417,36 +36493,37 @@ var init_SmithyRpcV2CborProtocol = __esm({ return super.deserializeResponse(operationSchema, context, response); } async handleError(operationSchema, context, response, dataObject, metadata) { - const errorName = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown"; + const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown"; + const preferredNamespaces = ["*"]; + const { defaultNamespace } = this.options; + preferredNamespaces.unshift(defaultNamespace); + const [namespace, errorShapeName] = (() => { + if (errorIdentifier.includes("#")) { + return errorIdentifier.split("#"); + } + return [void 0, errorIdentifier]; + })(); + if (namespace) { + preferredNamespaces.unshift(namespace); + } const errorMetadata = { $metadata: metadata, - $fault: response.statusCode <= 500 ? "client" : "server" + $fault: response.statusCode < 500 ? "client" : "server" }; - let namespace = this.options.defaultNamespace; - if (errorName.includes("#")) { - [namespace] = errorName.split("#"); + const preferredRegistries = [this.compositeErrorRegistry]; + if (namespace) { + preferredRegistries.push(TypeRegistry.for(namespace)); } - const registry = this.compositeErrorRegistry; - const nsRegistry = TypeRegistry.for(namespace); - registry.copyFrom(nsRegistry); - let errorSchema; - try { - errorSchema = registry.getSchema(errorName); - } catch (ignored) { + preferredRegistries.push(TypeRegistry.for(defaultNamespace)); + const [errorSchema, ErrorCtor, errorMode] = this.resolveError(errorShapeName, preferredNamespaces, preferredRegistries); + if (errorMode === "native" || errorMode === "synthetic") { if (dataObject.Message) { dataObject.message = dataObject.Message; } - const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace); - registry.copyFrom(syntheticRegistry); - const baseExceptionSchema = registry.getBaseException(); - if (baseExceptionSchema) { - const ErrorCtor2 = registry.getErrorCtor(baseExceptionSchema); - throw Object.assign(new ErrorCtor2({ name: errorName }), errorMetadata, dataObject); - } - throw Object.assign(new Error(errorName), errorMetadata, dataObject); + const error3 = errorMode === "synthetic" ? new ErrorCtor({ name: errorShapeName }) : new Error(errorShapeName); + throw Object.assign(error3, errorMetadata, dataObject); } const ns = NormalizedSchema.of(errorSchema); - const ErrorCtor = registry.getErrorCtor(errorSchema); const message = dataObject.message ?? dataObject.Message ?? "Unknown"; const exception = new ErrorCtor({}); const output = {};