fix: 修复配额说明重复和undefined问题

- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit
- 删除重复的旧配额说明块,保留新的当前配额设置显示

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 19:39:53 +08:00
commit 4350113979
7649 changed files with 897277 additions and 0 deletions

201
backend/node_modules/@smithy/smithy-client/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

10
backend/node_modules/@smithy/smithy-client/README.md generated vendored Normal file
View File

@@ -0,0 +1,10 @@
# @smithy/smithy-client
[![NPM version](https://img.shields.io/npm/v/@smithy/smithy-client/latest.svg)](https://www.npmjs.com/package/@smithy/smithy-client)
[![NPM downloads](https://img.shields.io/npm/dm/@smithy/smithy-client.svg)](https://www.npmjs.com/package/@smithy/smithy-client)
> An internal package
## Usage
You probably shouldn't, at least directly.

View File

@@ -0,0 +1,595 @@
'use strict';
var middlewareStack = require('@smithy/middleware-stack');
var protocols = require('@smithy/core/protocols');
var types = require('@smithy/types');
var schema = require('@smithy/core/schema');
var serde = require('@smithy/core/serde');
class Client {
config;
middlewareStack = middlewareStack.constructStack();
initConfig;
handlers;
constructor(config) {
this.config = config;
const { protocol, protocolSettings } = config;
if (protocolSettings) {
if (typeof protocol === "function") {
config.protocol = new protocol(protocolSettings);
}
}
}
send(command, optionsOrCb, cb) {
const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
const useHandlerCache = options === undefined && this.config.cacheMiddleware === true;
let handler;
if (useHandlerCache) {
if (!this.handlers) {
this.handlers = new WeakMap();
}
const handlers = this.handlers;
if (handlers.has(command.constructor)) {
handler = handlers.get(command.constructor);
}
else {
handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
handlers.set(command.constructor, handler);
}
}
else {
delete this.handlers;
handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
}
if (callback) {
handler(command)
.then((result) => callback(null, result.output), (err) => callback(err))
.catch(() => { });
}
else {
return handler(command).then((result) => result.output);
}
}
destroy() {
this.config?.requestHandler?.destroy?.();
delete this.handlers;
}
}
const SENSITIVE_STRING$1 = "***SensitiveInformation***";
function schemaLogFilter(schema$1, data) {
if (data == null) {
return data;
}
const ns = schema.NormalizedSchema.of(schema$1);
if (ns.getMergedTraits().sensitive) {
return SENSITIVE_STRING$1;
}
if (ns.isListSchema()) {
const isSensitive = !!ns.getValueSchema().getMergedTraits().sensitive;
if (isSensitive) {
return SENSITIVE_STRING$1;
}
}
else if (ns.isMapSchema()) {
const isSensitive = !!ns.getKeySchema().getMergedTraits().sensitive || !!ns.getValueSchema().getMergedTraits().sensitive;
if (isSensitive) {
return SENSITIVE_STRING$1;
}
}
else if (ns.isStructSchema() && typeof data === "object") {
const object = data;
const newObject = {};
for (const [member, memberNs] of ns.structIterator()) {
if (object[member] != null) {
newObject[member] = schemaLogFilter(memberNs, object[member]);
}
}
return newObject;
}
return data;
}
class Command {
middlewareStack = middlewareStack.constructStack();
schema;
static classBuilder() {
return new ClassBuilder();
}
resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }) {
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
this.middlewareStack.use(mw);
}
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const handlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog,
outputFilterSensitiveLog,
[types.SMITHY_CONTEXT_KEY]: {
commandInstance: this,
...smithyContext,
},
...additionalContext,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
}
class ClassBuilder {
_init = () => { };
_ep = {};
_middlewareFn = () => [];
_commandName = "";
_clientName = "";
_additionalContext = {};
_smithyContext = {};
_inputFilterSensitiveLog = undefined;
_outputFilterSensitiveLog = undefined;
_serializer = null;
_deserializer = null;
_operationSchema;
init(cb) {
this._init = cb;
}
ep(endpointParameterInstructions) {
this._ep = endpointParameterInstructions;
return this;
}
m(middlewareSupplier) {
this._middlewareFn = middlewareSupplier;
return this;
}
s(service, operation, smithyContext = {}) {
this._smithyContext = {
service,
operation,
...smithyContext,
};
return this;
}
c(additionalContext = {}) {
this._additionalContext = additionalContext;
return this;
}
n(clientName, commandName) {
this._clientName = clientName;
this._commandName = commandName;
return this;
}
f(inputFilter = (_) => _, outputFilter = (_) => _) {
this._inputFilterSensitiveLog = inputFilter;
this._outputFilterSensitiveLog = outputFilter;
return this;
}
ser(serializer) {
this._serializer = serializer;
return this;
}
de(deserializer) {
this._deserializer = deserializer;
return this;
}
sc(operation) {
this._operationSchema = operation;
this._smithyContext.operationSchema = operation;
return this;
}
build() {
const closure = this;
let CommandRef;
return (CommandRef = class extends Command {
input;
static getEndpointParameterInstructions() {
return closure._ep;
}
constructor(...[input]) {
super();
this.input = input ?? {};
closure._init(this);
this.schema = closure._operationSchema;
}
resolveMiddleware(stack, configuration, options) {
const op = closure._operationSchema;
const input = op?.[4] ?? op?.input;
const output = op?.[5] ?? op?.output;
return this.resolveMiddlewareWithContext(stack, configuration, options, {
CommandCtor: CommandRef,
middlewareFn: closure._middlewareFn,
clientName: closure._clientName,
commandName: closure._commandName,
inputFilterSensitiveLog: closure._inputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, input) : (_) => _),
outputFilterSensitiveLog: closure._outputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, output) : (_) => _),
smithyContext: closure._smithyContext,
additionalContext: closure._additionalContext,
});
}
serialize = closure._serializer;
deserialize = closure._deserializer;
});
}
}
const SENSITIVE_STRING = "***SensitiveInformation***";
const createAggregatedClient = (commands, Client) => {
for (const command of Object.keys(commands)) {
const CommandCtor = commands[command];
const methodImpl = async function (args, optionsOrCb, cb) {
const command = new CommandCtor(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
}
else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object")
throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
}
else {
return this.send(command, optionsOrCb);
}
};
const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
Client.prototype[methodName] = methodImpl;
}
};
class ServiceException extends Error {
$fault;
$response;
$retryable;
$metadata;
constructor(options) {
super(options.message);
Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
this.name = options.name;
this.$fault = options.$fault;
this.$metadata = options.$metadata;
}
static isInstance(value) {
if (!value)
return false;
const candidate = value;
return (ServiceException.prototype.isPrototypeOf(candidate) ||
(Boolean(candidate.$fault) &&
Boolean(candidate.$metadata) &&
(candidate.$fault === "client" || candidate.$fault === "server")));
}
static [Symbol.hasInstance](instance) {
if (!instance)
return false;
const candidate = instance;
if (this === ServiceException) {
return ServiceException.isInstance(instance);
}
if (ServiceException.isInstance(instance)) {
if (candidate.name && this.name) {
return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
}
return this.prototype.isPrototypeOf(instance);
}
return false;
}
}
const decorateServiceException = (exception, additions = {}) => {
Object.entries(additions)
.filter(([, v]) => v !== undefined)
.forEach(([k, v]) => {
if (exception[k] == undefined || exception[k] === "") {
exception[k] = v;
}
});
const message = exception.message || exception.Message || "UnknownError";
exception.message = message;
delete exception.Message;
return exception;
};
const throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => {
const $metadata = deserializeMetadata(output);
const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
const response = new exceptionCtor({
name: parsedBody?.code || parsedBody?.Code || errorCode || statusCode || "UnknownError",
$fault: "client",
$metadata,
});
throw decorateServiceException(response, parsedBody);
};
const withBaseException = (ExceptionCtor) => {
return ({ output, parsedBody, errorCode }) => {
throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode });
};
};
const deserializeMetadata = (output) => ({
httpStatusCode: output.statusCode,
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
extendedRequestId: output.headers["x-amz-id-2"],
cfId: output.headers["x-amz-cf-id"],
});
const loadConfigsForDefaultMode = (mode) => {
switch (mode) {
case "standard":
return {
retryMode: "standard",
connectionTimeout: 3100,
};
case "in-region":
return {
retryMode: "standard",
connectionTimeout: 1100,
};
case "cross-region":
return {
retryMode: "standard",
connectionTimeout: 3100,
};
case "mobile":
return {
retryMode: "standard",
connectionTimeout: 30000,
};
default:
return {};
}
};
let warningEmitted = false;
const emitWarningIfUnsupportedVersion = (version) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
warningEmitted = true;
}
};
const getChecksumConfiguration = (runtimeConfig) => {
const checksumAlgorithms = [];
for (const id in types.AlgorithmId) {
const algorithmId = types.AlgorithmId[id];
if (runtimeConfig[algorithmId] === undefined) {
continue;
}
checksumAlgorithms.push({
algorithmId: () => algorithmId,
checksumConstructor: () => runtimeConfig[algorithmId],
});
}
return {
addChecksumAlgorithm(algo) {
checksumAlgorithms.push(algo);
},
checksumAlgorithms() {
return checksumAlgorithms;
},
};
};
const resolveChecksumRuntimeConfig = (clientConfig) => {
const runtimeConfig = {};
clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
});
return runtimeConfig;
};
const getRetryConfiguration = (runtimeConfig) => {
return {
setRetryStrategy(retryStrategy) {
runtimeConfig.retryStrategy = retryStrategy;
},
retryStrategy() {
return runtimeConfig.retryStrategy;
},
};
};
const resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
const runtimeConfig = {};
runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
return runtimeConfig;
};
const getDefaultExtensionConfiguration = (runtimeConfig) => {
return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
};
const getDefaultClientConfiguration = getDefaultExtensionConfiguration;
const resolveDefaultRuntimeConfig = (config) => {
return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
};
const getArrayIfSingleItem = (mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray];
const getValueFromTextNode = (obj) => {
const textNodeName = "#text";
for (const key in obj) {
if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== undefined) {
obj[key] = obj[key][textNodeName];
}
else if (typeof obj[key] === "object" && obj[key] !== null) {
obj[key] = getValueFromTextNode(obj[key]);
}
}
return obj;
};
const isSerializableHeaderValue = (value) => {
return value != null;
};
class NoOpLogger {
trace() { }
debug() { }
info() { }
warn() { }
error() { }
}
function map(arg0, arg1, arg2) {
let target;
let filter;
let instructions;
if (typeof arg1 === "undefined" && typeof arg2 === "undefined") {
target = {};
instructions = arg0;
}
else {
target = arg0;
if (typeof arg1 === "function") {
filter = arg1;
instructions = arg2;
return mapWithFilter(target, filter, instructions);
}
else {
instructions = arg1;
}
}
for (const key of Object.keys(instructions)) {
if (!Array.isArray(instructions[key])) {
target[key] = instructions[key];
continue;
}
applyInstruction(target, null, instructions, key);
}
return target;
}
const convertMap = (target) => {
const output = {};
for (const [k, v] of Object.entries(target || {})) {
output[k] = [, v];
}
return output;
};
const take = (source, instructions) => {
const out = {};
for (const key in instructions) {
applyInstruction(out, source, instructions, key);
}
return out;
};
const mapWithFilter = (target, filter, instructions) => {
return map(target, Object.entries(instructions).reduce((_instructions, [key, value]) => {
if (Array.isArray(value)) {
_instructions[key] = value;
}
else {
if (typeof value === "function") {
_instructions[key] = [filter, value()];
}
else {
_instructions[key] = [filter, value];
}
}
return _instructions;
}, {}));
};
const applyInstruction = (target, source, instructions, targetKey) => {
if (source !== null) {
let instruction = instructions[targetKey];
if (typeof instruction === "function") {
instruction = [, instruction];
}
const [filter = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction;
if ((typeof filter === "function" && filter(source[sourceKey])) || (typeof filter !== "function" && !!filter)) {
target[targetKey] = valueFn(source[sourceKey]);
}
return;
}
let [filter, value] = instructions[targetKey];
if (typeof value === "function") {
let _value;
const defaultFilterPassed = filter === undefined && (_value = value()) != null;
const customFilterPassed = (typeof filter === "function" && !!filter(void 0)) || (typeof filter !== "function" && !!filter);
if (defaultFilterPassed) {
target[targetKey] = _value;
}
else if (customFilterPassed) {
target[targetKey] = value();
}
}
else {
const defaultFilterPassed = filter === undefined && value != null;
const customFilterPassed = (typeof filter === "function" && !!filter(value)) || (typeof filter !== "function" && !!filter);
if (defaultFilterPassed || customFilterPassed) {
target[targetKey] = value;
}
}
};
const nonNullish = (_) => _ != null;
const pass = (_) => _;
const serializeFloat = (value) => {
if (value !== value) {
return "NaN";
}
switch (value) {
case Infinity:
return "Infinity";
case -Infinity:
return "-Infinity";
default:
return value;
}
};
const serializeDateTime = (date) => date.toISOString().replace(".000Z", "Z");
const _json = (obj) => {
if (obj == null) {
return {};
}
if (Array.isArray(obj)) {
return obj.filter((_) => _ != null).map(_json);
}
if (typeof obj === "object") {
const target = {};
for (const key of Object.keys(obj)) {
if (obj[key] == null) {
continue;
}
target[key] = _json(obj[key]);
}
return target;
}
return obj;
};
Object.defineProperty(exports, "collectBody", {
enumerable: true,
get: function () { return protocols.collectBody; }
});
Object.defineProperty(exports, "extendedEncodeURIComponent", {
enumerable: true,
get: function () { return protocols.extendedEncodeURIComponent; }
});
Object.defineProperty(exports, "resolvedPath", {
enumerable: true,
get: function () { return protocols.resolvedPath; }
});
exports.Client = Client;
exports.Command = Command;
exports.NoOpLogger = NoOpLogger;
exports.SENSITIVE_STRING = SENSITIVE_STRING;
exports.ServiceException = ServiceException;
exports._json = _json;
exports.convertMap = convertMap;
exports.createAggregatedClient = createAggregatedClient;
exports.decorateServiceException = decorateServiceException;
exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
exports.getArrayIfSingleItem = getArrayIfSingleItem;
exports.getDefaultClientConfiguration = getDefaultClientConfiguration;
exports.getDefaultExtensionConfiguration = getDefaultExtensionConfiguration;
exports.getValueFromTextNode = getValueFromTextNode;
exports.isSerializableHeaderValue = isSerializableHeaderValue;
exports.loadConfigsForDefaultMode = loadConfigsForDefaultMode;
exports.map = map;
exports.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;
exports.serializeDateTime = serializeDateTime;
exports.serializeFloat = serializeFloat;
exports.take = take;
exports.throwDefaultError = throwDefaultError;
exports.withBaseException = withBaseException;
Object.keys(serde).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return serde[k]; }
});
});

View File

@@ -0,0 +1,7 @@
export class NoOpLogger {
trace() { }
debug() { }
info() { }
warn() { }
error() { }
}

View File

@@ -0,0 +1,51 @@
import { constructStack } from "@smithy/middleware-stack";
export class Client {
config;
middlewareStack = constructStack();
initConfig;
handlers;
constructor(config) {
this.config = config;
const { protocol, protocolSettings } = config;
if (protocolSettings) {
if (typeof protocol === "function") {
config.protocol = new protocol(protocolSettings);
}
}
}
send(command, optionsOrCb, cb) {
const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
const useHandlerCache = options === undefined && this.config.cacheMiddleware === true;
let handler;
if (useHandlerCache) {
if (!this.handlers) {
this.handlers = new WeakMap();
}
const handlers = this.handlers;
if (handlers.has(command.constructor)) {
handler = handlers.get(command.constructor);
}
else {
handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
handlers.set(command.constructor, handler);
}
}
else {
delete this.handlers;
handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
}
if (callback) {
handler(command)
.then((result) => callback(null, result.output), (err) => callback(err))
.catch(() => { });
}
else {
return handler(command).then((result) => result.output);
}
}
destroy() {
this.config?.requestHandler?.destroy?.();
delete this.handlers;
}
}

View File

@@ -0,0 +1 @@
export { collectBody } from "@smithy/core/protocols";

View File

@@ -0,0 +1,124 @@
import { constructStack } from "@smithy/middleware-stack";
import { SMITHY_CONTEXT_KEY } from "@smithy/types";
import { schemaLogFilter } from "./schemaLogFilter";
export class Command {
middlewareStack = constructStack();
schema;
static classBuilder() {
return new ClassBuilder();
}
resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }) {
for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
this.middlewareStack.use(mw);
}
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const handlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog,
outputFilterSensitiveLog,
[SMITHY_CONTEXT_KEY]: {
commandInstance: this,
...smithyContext,
},
...additionalContext,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
}
class ClassBuilder {
_init = () => { };
_ep = {};
_middlewareFn = () => [];
_commandName = "";
_clientName = "";
_additionalContext = {};
_smithyContext = {};
_inputFilterSensitiveLog = undefined;
_outputFilterSensitiveLog = undefined;
_serializer = null;
_deserializer = null;
_operationSchema;
init(cb) {
this._init = cb;
}
ep(endpointParameterInstructions) {
this._ep = endpointParameterInstructions;
return this;
}
m(middlewareSupplier) {
this._middlewareFn = middlewareSupplier;
return this;
}
s(service, operation, smithyContext = {}) {
this._smithyContext = {
service,
operation,
...smithyContext,
};
return this;
}
c(additionalContext = {}) {
this._additionalContext = additionalContext;
return this;
}
n(clientName, commandName) {
this._clientName = clientName;
this._commandName = commandName;
return this;
}
f(inputFilter = (_) => _, outputFilter = (_) => _) {
this._inputFilterSensitiveLog = inputFilter;
this._outputFilterSensitiveLog = outputFilter;
return this;
}
ser(serializer) {
this._serializer = serializer;
return this;
}
de(deserializer) {
this._deserializer = deserializer;
return this;
}
sc(operation) {
this._operationSchema = operation;
this._smithyContext.operationSchema = operation;
return this;
}
build() {
const closure = this;
let CommandRef;
return (CommandRef = class extends Command {
input;
static getEndpointParameterInstructions() {
return closure._ep;
}
constructor(...[input]) {
super();
this.input = input ?? {};
closure._init(this);
this.schema = closure._operationSchema;
}
resolveMiddleware(stack, configuration, options) {
const op = closure._operationSchema;
const input = op?.[4] ?? op?.input;
const output = op?.[5] ?? op?.output;
return this.resolveMiddlewareWithContext(stack, configuration, options, {
CommandCtor: CommandRef,
middlewareFn: closure._middlewareFn,
clientName: closure._clientName,
commandName: closure._commandName,
inputFilterSensitiveLog: closure._inputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, input) : (_) => _),
outputFilterSensitiveLog: closure._outputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, output) : (_) => _),
smithyContext: closure._smithyContext,
additionalContext: closure._additionalContext,
});
}
serialize = closure._serializer;
deserialize = closure._deserializer;
});
}
}

View File

@@ -0,0 +1 @@
export const SENSITIVE_STRING = "***SensitiveInformation***";

View File

@@ -0,0 +1,21 @@
export const createAggregatedClient = (commands, Client) => {
for (const command of Object.keys(commands)) {
const CommandCtor = commands[command];
const methodImpl = async function (args, optionsOrCb, cb) {
const command = new CommandCtor(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
}
else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object")
throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
}
else {
return this.send(command, optionsOrCb);
}
};
const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
Client.prototype[methodName] = methodImpl;
}
};

View File

@@ -0,0 +1,22 @@
import { decorateServiceException } from "./exceptions";
export const throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => {
const $metadata = deserializeMetadata(output);
const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
const response = new exceptionCtor({
name: parsedBody?.code || parsedBody?.Code || errorCode || statusCode || "UnknownError",
$fault: "client",
$metadata,
});
throw decorateServiceException(response, parsedBody);
};
export const withBaseException = (ExceptionCtor) => {
return ({ output, parsedBody, errorCode }) => {
throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode });
};
};
const deserializeMetadata = (output) => ({
httpStatusCode: output.statusCode,
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
extendedRequestId: output.headers["x-amz-id-2"],
cfId: output.headers["x-amz-cf-id"],
});

View File

@@ -0,0 +1,26 @@
export const loadConfigsForDefaultMode = (mode) => {
switch (mode) {
case "standard":
return {
retryMode: "standard",
connectionTimeout: 3100,
};
case "in-region":
return {
retryMode: "standard",
connectionTimeout: 1100,
};
case "cross-region":
return {
retryMode: "standard",
connectionTimeout: 3100,
};
case "mobile":
return {
retryMode: "standard",
connectionTimeout: 30000,
};
default:
return {};
}
};

View File

@@ -0,0 +1,6 @@
let warningEmitted = false;
export const emitWarningIfUnsupportedVersion = (version) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
warningEmitted = true;
}
};

View File

@@ -0,0 +1,50 @@
export class ServiceException extends Error {
$fault;
$response;
$retryable;
$metadata;
constructor(options) {
super(options.message);
Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
this.name = options.name;
this.$fault = options.$fault;
this.$metadata = options.$metadata;
}
static isInstance(value) {
if (!value)
return false;
const candidate = value;
return (ServiceException.prototype.isPrototypeOf(candidate) ||
(Boolean(candidate.$fault) &&
Boolean(candidate.$metadata) &&
(candidate.$fault === "client" || candidate.$fault === "server")));
}
static [Symbol.hasInstance](instance) {
if (!instance)
return false;
const candidate = instance;
if (this === ServiceException) {
return ServiceException.isInstance(instance);
}
if (ServiceException.isInstance(instance)) {
if (candidate.name && this.name) {
return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
}
return this.prototype.isPrototypeOf(instance);
}
return false;
}
}
export const decorateServiceException = (exception, additions = {}) => {
Object.entries(additions)
.filter(([, v]) => v !== undefined)
.forEach(([k, v]) => {
if (exception[k] == undefined || exception[k] === "") {
exception[k] = v;
}
});
const message = exception.message || exception.Message || "UnknownError";
exception.message = message;
delete exception.Message;
return exception;
};

View File

@@ -0,0 +1 @@
export { extendedEncodeURIComponent } from "@smithy/core/protocols";

View File

@@ -0,0 +1,30 @@
import { AlgorithmId } from "@smithy/types";
export { AlgorithmId };
export const getChecksumConfiguration = (runtimeConfig) => {
const checksumAlgorithms = [];
for (const id in AlgorithmId) {
const algorithmId = AlgorithmId[id];
if (runtimeConfig[algorithmId] === undefined) {
continue;
}
checksumAlgorithms.push({
algorithmId: () => algorithmId,
checksumConstructor: () => runtimeConfig[algorithmId],
});
}
return {
addChecksumAlgorithm(algo) {
checksumAlgorithms.push(algo);
},
checksumAlgorithms() {
return checksumAlgorithms;
},
};
};
export const resolveChecksumRuntimeConfig = (clientConfig) => {
const runtimeConfig = {};
clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
});
return runtimeConfig;
};

View File

@@ -0,0 +1,9 @@
import { getChecksumConfiguration, resolveChecksumRuntimeConfig } from "./checksum";
import { getRetryConfiguration, resolveRetryRuntimeConfig } from "./retry";
export const getDefaultExtensionConfiguration = (runtimeConfig) => {
return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
};
export const getDefaultClientConfiguration = getDefaultExtensionConfiguration;
export const resolveDefaultRuntimeConfig = (config) => {
return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
};

View File

@@ -0,0 +1 @@
export * from "./defaultExtensionConfiguration";

View File

@@ -0,0 +1,15 @@
export const getRetryConfiguration = (runtimeConfig) => {
return {
setRetryStrategy(retryStrategy) {
runtimeConfig.retryStrategy = retryStrategy;
},
retryStrategy() {
return runtimeConfig.retryStrategy;
},
};
};
export const resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
const runtimeConfig = {};
runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
return runtimeConfig;
};

View File

@@ -0,0 +1 @@
export const getArrayIfSingleItem = (mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray];

View File

@@ -0,0 +1,12 @@
export const getValueFromTextNode = (obj) => {
const textNodeName = "#text";
for (const key in obj) {
if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== undefined) {
obj[key] = obj[key][textNodeName];
}
else if (typeof obj[key] === "object" && obj[key] !== null) {
obj[key] = getValueFromTextNode(obj[key]);
}
}
return obj;
};

View File

@@ -0,0 +1,20 @@
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./extensions";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./is-serializable-header-value";
export * from "./NoOpLogger";
export * from "./object-mapping";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "@smithy/core/serde";

View File

@@ -0,0 +1,3 @@
export const isSerializableHeaderValue = (value) => {
return value != null;
};

View File

@@ -0,0 +1,92 @@
export function map(arg0, arg1, arg2) {
let target;
let filter;
let instructions;
if (typeof arg1 === "undefined" && typeof arg2 === "undefined") {
target = {};
instructions = arg0;
}
else {
target = arg0;
if (typeof arg1 === "function") {
filter = arg1;
instructions = arg2;
return mapWithFilter(target, filter, instructions);
}
else {
instructions = arg1;
}
}
for (const key of Object.keys(instructions)) {
if (!Array.isArray(instructions[key])) {
target[key] = instructions[key];
continue;
}
applyInstruction(target, null, instructions, key);
}
return target;
}
export const convertMap = (target) => {
const output = {};
for (const [k, v] of Object.entries(target || {})) {
output[k] = [, v];
}
return output;
};
export const take = (source, instructions) => {
const out = {};
for (const key in instructions) {
applyInstruction(out, source, instructions, key);
}
return out;
};
const mapWithFilter = (target, filter, instructions) => {
return map(target, Object.entries(instructions).reduce((_instructions, [key, value]) => {
if (Array.isArray(value)) {
_instructions[key] = value;
}
else {
if (typeof value === "function") {
_instructions[key] = [filter, value()];
}
else {
_instructions[key] = [filter, value];
}
}
return _instructions;
}, {}));
};
const applyInstruction = (target, source, instructions, targetKey) => {
if (source !== null) {
let instruction = instructions[targetKey];
if (typeof instruction === "function") {
instruction = [, instruction];
}
const [filter = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction;
if ((typeof filter === "function" && filter(source[sourceKey])) || (typeof filter !== "function" && !!filter)) {
target[targetKey] = valueFn(source[sourceKey]);
}
return;
}
let [filter, value] = instructions[targetKey];
if (typeof value === "function") {
let _value;
const defaultFilterPassed = filter === undefined && (_value = value()) != null;
const customFilterPassed = (typeof filter === "function" && !!filter(void 0)) || (typeof filter !== "function" && !!filter);
if (defaultFilterPassed) {
target[targetKey] = _value;
}
else if (customFilterPassed) {
target[targetKey] = value();
}
}
else {
const defaultFilterPassed = filter === undefined && value != null;
const customFilterPassed = (typeof filter === "function" && !!filter(value)) || (typeof filter !== "function" && !!filter);
if (defaultFilterPassed || customFilterPassed) {
target[targetKey] = value;
}
}
};
const nonNullish = (_) => _ != null;
const pass = (_) => _;

View File

@@ -0,0 +1 @@
export { resolvedPath } from "@smithy/core/protocols";

View File

@@ -0,0 +1,34 @@
import { NormalizedSchema } from "@smithy/core/schema";
const SENSITIVE_STRING = "***SensitiveInformation***";
export function schemaLogFilter(schema, data) {
if (data == null) {
return data;
}
const ns = NormalizedSchema.of(schema);
if (ns.getMergedTraits().sensitive) {
return SENSITIVE_STRING;
}
if (ns.isListSchema()) {
const isSensitive = !!ns.getValueSchema().getMergedTraits().sensitive;
if (isSensitive) {
return SENSITIVE_STRING;
}
}
else if (ns.isMapSchema()) {
const isSensitive = !!ns.getKeySchema().getMergedTraits().sensitive || !!ns.getValueSchema().getMergedTraits().sensitive;
if (isSensitive) {
return SENSITIVE_STRING;
}
}
else if (ns.isStructSchema() && typeof data === "object") {
const object = data;
const newObject = {};
for (const [member, memberNs] of ns.structIterator()) {
if (object[member] != null) {
newObject[member] = schemaLogFilter(memberNs, object[member]);
}
}
return newObject;
}
return data;
}

View File

@@ -0,0 +1,14 @@
export const serializeFloat = (value) => {
if (value !== value) {
return "NaN";
}
switch (value) {
case Infinity:
return "Infinity";
case -Infinity:
return "-Infinity";
default:
return value;
}
};
export const serializeDateTime = (date) => date.toISOString().replace(".000Z", "Z");

View File

@@ -0,0 +1,19 @@
export const _json = (obj) => {
if (obj == null) {
return {};
}
if (Array.isArray(obj)) {
return obj.filter((_) => _ != null).map(_json);
}
if (typeof obj === "object") {
const target = {};
for (const key of Object.keys(obj)) {
if (obj[key] == null) {
continue;
}
target[key] = _json(obj[key]);
}
return target;
}
return obj;
};

View File

@@ -0,0 +1,11 @@
import type { Logger } from "@smithy/types";
/**
* @internal
*/
export declare class NoOpLogger implements Logger {
trace(): void;
debug(): void;
info(): void;
warn(): void;
error(): void;
}

View File

@@ -0,0 +1,87 @@
import type { $ClientProtocol, $ClientProtocolCtor, Client as IClient, ClientProtocol, ClientProtocolCtor, Command, FetchHttpHandlerOptions, MetadataBearer, MiddlewareStack, NodeHttpHandlerOptions, RequestHandler } from "@smithy/types";
/**
* @public
*/
export interface SmithyConfiguration<HandlerOptions> {
/**
* @public
*/
requestHandler: RequestHandler<any, any, HandlerOptions> | NodeHttpHandlerOptions | FetchHttpHandlerOptions | Record<string, unknown>;
/**
* @public
*
* Default false.
*
* When true, the client will only resolve the middleware stack once per
* Command class. This means modifying the middlewareStack of the
* command or client after requests have been made will not be
* recognized.
*
* Calling client.destroy() also clears this cache.
*
* Enable this only if needing the additional time saved (0-1ms per request)
* and not needing middleware modifications between requests.
*/
cacheMiddleware?: boolean;
/**
* A client request/response protocol or constructor of one.
* A protocol in this context is not e.g. https.
* It is the combined implementation of how to (de)serialize and create
* the messages (e.g. http requests/responses) that are being exchanged.
*
* @public
*/
protocol?: ClientProtocol<any, any> | $ClientProtocol<any, any> | ClientProtocolCtor<any, any> | $ClientProtocolCtor<any, any>;
/**
* These are automatically generated and will be passed to the
* config.protocol if given as a constructor.
* @internal
*/
protocolSettings?: {
defaultNamespace?: string;
[setting: string]: unknown;
};
/**
* The API version set internally by the SDK, and is
* not planned to be used by customer code.
* @internal
*/
readonly apiVersion: string;
}
/**
* @internal
*/
export type SmithyResolvedConfiguration<HandlerOptions> = {
requestHandler: RequestHandler<any, any, HandlerOptions>;
cacheMiddleware?: boolean;
protocol?: ClientProtocol<any, any> | $ClientProtocol<any, any>;
protocolSettings?: {
defaultNamespace?: string;
[setting: string]: unknown;
};
readonly apiVersion: string;
};
/**
* @public
*/
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
readonly config: ResolvedClientConfiguration;
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
/**
* Holds an object reference to the initial configuration object.
* Used to check that the config resolver stack does not create
* dangling instances of an intermediate form of the configuration object.
*
* @internal
*/
initConfig?: object;
/**
* May be used to cache the resolved handler function for a Command class.
*/
private handlers?;
constructor(config: ResolvedClientConfiguration);
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options: HandlerOptions, cb: (err: any, data?: OutputType) => void): void;
destroy(): void;
}

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { collectBody } from "@smithy/core/protocols";

View File

@@ -0,0 +1,119 @@
import type { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
import type { Command as ICommand, Handler, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, Logger, MetadataBearer, MiddlewareStack as IMiddlewareStack, OperationSchema, OptionalParameter, Pluggable, RequestHandler, SerdeContext, StaticOperationSchema } from "@smithy/types";
/**
* @public
*/
export declare abstract class Command<Input extends ClientInput, Output extends ClientOutput, ResolvedClientConfiguration, ClientInput extends object = any, ClientOutput extends MetadataBearer = any> implements ICommand<ClientInput, Input, ClientOutput, Output, ResolvedClientConfiguration> {
abstract input: Input;
readonly middlewareStack: IMiddlewareStack<Input, Output>;
readonly schema?: OperationSchema | StaticOperationSchema;
/**
* Factory for Command ClassBuilder.
* @internal
*/
static classBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>;
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
/**
* @internal
*/
resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>;
}
/**
* @internal
*/
type ResolveMiddlewareContextArgs = {
middlewareFn: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[];
clientName: string;
commandName: string;
smithyContext: Record<string, unknown>;
additionalContext: HandlerExecutionContext;
inputFilterSensitiveLog: (_: any) => any;
outputFilterSensitiveLog: (_: any) => any;
CommandCtor: any;
};
/**
* @internal
*/
declare class ClassBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> {
private _init;
private _ep;
private _middlewareFn;
private _commandName;
private _clientName;
private _additionalContext;
private _smithyContext;
private _inputFilterSensitiveLog;
private _outputFilterSensitiveLog;
private _serializer;
private _deserializer;
private _operationSchema?;
/**
* Optional init callback.
*/
init(cb: (_: Command<I, O, C, SI, SO>) => void): void;
/**
* Set the endpoint parameter instructions.
*/
ep(endpointParameterInstructions: EndpointParameterInstructions): ClassBuilder<I, O, C, SI, SO>;
/**
* Add any number of middleware.
*/
m(middlewareSupplier: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[]): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context Smithy field.
*/
s(service: string, operation: string, smithyContext?: Record<string, unknown>): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context.
*/
c(additionalContext?: HandlerExecutionContext): ClassBuilder<I, O, C, SI, SO>;
/**
* Set constant string identifiers for the operation.
*/
n(clientName: string, commandName: string): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the input and output sensistive log filters.
*/
f(inputFilter?: (_: any) => any, outputFilter?: (_: any) => any): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the serializer.
*/
ser(serializer: (input: I, context?: SerdeContext | any) => Promise<IHttpRequest>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the deserializer.
*/
de(deserializer: (output: IHttpResponse, context?: SerdeContext | any) => Promise<O>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets input/output schema for the operation.
*/
sc(operation: OperationSchema | StaticOperationSchema): ClassBuilder<I, O, C, SI, SO>;
/**
* @returns a Command class with the classBuilder properties.
*/
build(): {
new (input: I): CommandImpl<I, O, C, SI, SO>;
new (...[input]: OptionalParameter<I>): CommandImpl<I, O, C, SI, SO>;
getEndpointParameterInstructions(): EndpointParameterInstructions;
};
}
/**
* A concrete implementation of ICommand with no abstract members.
* @public
*/
export interface CommandImpl<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> {
readonly input: I;
resolveMiddleware(stack: IMiddlewareStack<SI, SO>, configuration: C, options: any): Handler<I, O>;
}
export {};

View File

@@ -0,0 +1,4 @@
/**
* @internal
*/
export declare const SENSITIVE_STRING = "***SensitiveInformation***";

View File

@@ -0,0 +1,11 @@
import type { Client } from "./client";
/**
* @internal
*
* @param commands - command lookup container.
* @param client - client instance on which to add aggregated methods.
* @returns an aggregated client with dynamically created methods.
*/
export declare const createAggregatedClient: (commands: Record<string, any>, Client: {
new (...args: any): Client<any, any, any, any>;
}) => void;

View File

@@ -0,0 +1,15 @@
/**
* Always throws an error with the given `exceptionCtor` and other arguments.
* This is only called from an error handling code path.
*
* @internal
*/
export declare const throwDefaultError: ({ output, parsedBody, exceptionCtor, errorCode }: any) => never;
/**
* @internal
*
* Creates {@link throwDefaultError} with bound ExceptionCtor.
*/
export declare const withBaseException: (ExceptionCtor: {
new (...args: any): any;
}) => any;

View File

@@ -0,0 +1,28 @@
/**
* @internal
*/
export declare const loadConfigsForDefaultMode: (mode: ResolvedDefaultsMode) => DefaultsModeConfigs;
/**
* Option determining how certain default configuration options are resolved in the SDK. It can be one of the value listed below:
* * `"standard"`: <p>The STANDARD mode provides the latest recommended default values that should be safe to run in most scenarios</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"in-region"`: <p>The IN_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services from within the same AWS region</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"cross-region"`: <p>The CROSS_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services in a different region</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"mobile"`: <p>The MOBILE mode builds on the standard mode and includes optimization tailored for mobile applications</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"auto"`: <p>The AUTO mode is an experimental mode that builds on the standard mode. The SDK will attempt to discover the execution environment to determine the appropriate settings automatically.</p><p>Note that the auto detection is heuristics-based and does not guarantee 100% accuracy. STANDARD mode will be used if the execution environment cannot be determined. The auto detection might query <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">EC2 Instance Metadata service</a>, which might introduce latency. Therefore we recommend choosing an explicit defaults_mode instead if startup latency is critical to your application</p>
* * `"legacy"`: <p>The LEGACY mode provides default settings that vary per SDK and were used prior to establishment of defaults_mode</p>
*
* @defaultValue "legacy"
*/
export type DefaultsMode = "standard" | "in-region" | "cross-region" | "mobile" | "auto" | "legacy";
/**
* @internal
*/
export type ResolvedDefaultsMode = Exclude<DefaultsMode, "auto">;
/**
* @internal
*/
export interface DefaultsModeConfigs {
retryMode?: string;
connectionTimeout?: number;
requestTimeout?: number;
}

View File

@@ -0,0 +1,8 @@
/**
* @internal
*
* Emits warning if the provided Node.js version string is pending deprecation.
*
* @param version - The Node.js version string.
*/
export declare const emitWarningIfUnsupportedVersion: (version: string) => void;

View File

@@ -0,0 +1,42 @@
import type { HttpResponse, MetadataBearer, ResponseMetadata, RetryableTrait, SmithyException } from "@smithy/types";
/**
* The type of the exception class constructor parameter. The returned type contains the properties
* in the `ExceptionType` but not in the `BaseExceptionType`. If the `BaseExceptionType` contains
* `$metadata` and `message` properties, it's also included in the returned type.
* @internal
*/
export type ExceptionOptionType<ExceptionType extends Error, BaseExceptionType extends Error> = Omit<ExceptionType, Exclude<keyof BaseExceptionType, "$metadata" | "message">>;
/**
* @public
*/
export interface ServiceExceptionOptions extends SmithyException, MetadataBearer {
message?: string;
}
/**
* @public
*
* Base exception class for the exceptions from the server-side.
*/
export declare class ServiceException extends Error implements SmithyException, MetadataBearer {
readonly $fault: "client" | "server";
$response?: HttpResponse;
$retryable?: RetryableTrait;
$metadata: ResponseMetadata;
constructor(options: ServiceExceptionOptions);
/**
* Checks if a value is an instance of ServiceException (duck typed)
*/
static isInstance(value: unknown): value is ServiceException;
/**
* Custom instanceof check to support the operator for ServiceException base class
*/
static [Symbol.hasInstance](instance: unknown): boolean;
}
/**
* This method inject unmodeled member to a deserialized SDK exception,
* and load the error message from different possible keys('message',
* 'Message').
*
* @internal
*/
export declare const decorateServiceException: <E extends ServiceException>(exception: E, additions?: Record<string, any>) => E;

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { extendedEncodeURIComponent } from "@smithy/core/protocols";

View File

@@ -0,0 +1,24 @@
import type { ChecksumAlgorithm, ChecksumConfiguration, ChecksumConstructor, HashConstructor } from "@smithy/types";
import { AlgorithmId } from "@smithy/types";
export { AlgorithmId, ChecksumAlgorithm, ChecksumConfiguration };
/**
* @internal
*/
export type PartialChecksumRuntimeConfigType = Partial<{
sha256: ChecksumConstructor | HashConstructor;
md5: ChecksumConstructor | HashConstructor;
crc32: ChecksumConstructor | HashConstructor;
crc32c: ChecksumConstructor | HashConstructor;
sha1: ChecksumConstructor | HashConstructor;
}>;
/**
* @internal
*/
export declare const getChecksumConfiguration: (runtimeConfig: PartialChecksumRuntimeConfigType) => {
addChecksumAlgorithm(algo: ChecksumAlgorithm): void;
checksumAlgorithms(): ChecksumAlgorithm[];
};
/**
* @internal
*/
export declare const resolveChecksumRuntimeConfig: (clientConfig: ChecksumConfiguration) => PartialChecksumRuntimeConfigType;

View File

@@ -0,0 +1,38 @@
import type { DefaultExtensionConfiguration } from "@smithy/types";
import type { PartialChecksumRuntimeConfigType } from "./checksum";
import type { PartialRetryRuntimeConfigType } from "./retry";
/**
* @internal
*/
export type DefaultExtensionRuntimeConfigType = PartialRetryRuntimeConfigType & PartialChecksumRuntimeConfigType;
/**
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultExtensionConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
} & {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>;
};
/**
* @deprecated use getDefaultExtensionConfiguration
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultClientConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
} & {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>;
};
/**
* @internal
*
* Helper function to resolve runtime config from default extension configuration
*/
export declare const resolveDefaultRuntimeConfig: (config: DefaultExtensionConfiguration) => DefaultExtensionRuntimeConfigType;

View File

@@ -0,0 +1 @@
export * from "./defaultExtensionConfiguration";

View File

@@ -0,0 +1,18 @@
import type { Provider, RetryStrategy, RetryStrategyConfiguration, RetryStrategyV2 } from "@smithy/types";
/**
* @internal
*/
export type PartialRetryRuntimeConfigType = Partial<{
retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>;
}>;
/**
* @internal
*/
export declare const getRetryConfiguration: (runtimeConfig: PartialRetryRuntimeConfigType) => {
setRetryStrategy(retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>): void;
retryStrategy(): Provider<RetryStrategyV2 | RetryStrategy>;
};
/**
* @internal
*/
export declare const resolveRetryRuntimeConfig: (retryStrategyConfiguration: RetryStrategyConfiguration) => PartialRetryRuntimeConfigType;

View File

@@ -0,0 +1,7 @@
/**
* @internal
*
* The XML parser will set one K:V for a member that could
* return multiple entries but only has one.
*/
export declare const getArrayIfSingleItem: <T>(mayBeArray: T) => T | T[];

View File

@@ -0,0 +1,7 @@
/**
* @internal
*
* Recursively parses object and populates value is node from
* "#text" key if it's available
*/
export declare const getValueFromTextNode: (obj: any) => any;

View File

@@ -0,0 +1,21 @@
export type { DocumentType, SdkError, SmithyException } from "@smithy/types";
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./extensions";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./is-serializable-header-value";
export * from "./NoOpLogger";
export * from "./object-mapping";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "@smithy/core/serde";

View File

@@ -0,0 +1,5 @@
/**
* @internal
* @returns whether the header value is serializable.
*/
export declare const isSerializableHeaderValue: (value: any) => boolean;

View File

@@ -0,0 +1,162 @@
/**
* @internal
*
* A set of instructions for multiple keys.
* The aim is to provide a concise yet readable way to map and filter values
* onto a target object.
*
* @example
* ```javascript
* const example: ObjectMappingInstructions = {
* lazyValue1: [, () => 1],
* lazyValue2: [, () => 2],
* lazyValue3: [, () => 3],
* lazyConditionalValue1: [() => true, () => 4],
* lazyConditionalValue2: [() => true, () => 5],
* lazyConditionalValue3: [true, () => 6],
* lazyConditionalValue4: [false, () => 44],
* lazyConditionalValue5: [() => false, () => 55],
* lazyConditionalValue6: ["", () => 66],
* simpleValue1: [, 7],
* simpleValue2: [, 8],
* simpleValue3: [, 9],
* conditionalValue1: [() => true, 10],
* conditionalValue2: [() => true, 11],
* conditionalValue3: [{}, 12],
* conditionalValue4: [false, 110],
* conditionalValue5: [() => false, 121],
* conditionalValue6: ["", 132],
* };
*
* const exampleResult: Record<string, any> = {
* lazyValue1: 1,
* lazyValue2: 2,
* lazyValue3: 3,
* lazyConditionalValue1: 4,
* lazyConditionalValue2: 5,
* lazyConditionalValue3: 6,
* simpleValue1: 7,
* simpleValue2: 8,
* simpleValue3: 9,
* conditionalValue1: 10,
* conditionalValue2: 11,
* conditionalValue3: 12,
* };
* ```
*/
export type ObjectMappingInstructions = Record<string, ObjectMappingInstruction>;
/**
* @internal
*
* A variant of the object mapping instruction for the `take` function.
* In this case, the source value is provided to the value function, turning it
* from a supplier into a mapper.
*/
export type SourceMappingInstructions = Record<string, ValueMapper | SourceMappingInstruction>;
/**
* @internal
*
* An instruction set for assigning a value to a target object.
*/
export type ObjectMappingInstruction = LazyValueInstruction | ConditionalLazyValueInstruction | SimpleValueInstruction | ConditionalValueInstruction | UnfilteredValue;
/**
* @internal
*
* non-array
*/
export type UnfilteredValue = any;
/**
* @internal
*/
export type LazyValueInstruction = [FilterStatus, ValueSupplier];
/**
* @internal
*/
export type ConditionalLazyValueInstruction = [FilterStatusSupplier, ValueSupplier];
/**
* @internal
*/
export type SimpleValueInstruction = [FilterStatus, Value];
/**
* @internal
*/
export type ConditionalValueInstruction = [ValueFilteringFunction, Value];
/**
* @internal
*/
export type SourceMappingInstruction = [(ValueFilteringFunction | FilterStatus)?, ValueMapper?, string?];
/**
* @internal
*
* Filter is considered passed if
* 1. It is a boolean true.
* 2. It is not undefined and is itself truthy.
* 3. It is undefined and the corresponding _value_ is neither null nor undefined.
*/
export type FilterStatus = boolean | unknown | void;
/**
* @internal
*
* Supplies the filter check but not against any value as input.
*/
export type FilterStatusSupplier = () => boolean;
/**
* @internal
*
* Filter check with the given value.
*/
export type ValueFilteringFunction = (value: any) => boolean;
/**
* @internal
*
* Supplies the value for lazy evaluation.
*/
export type ValueSupplier = () => any;
/**
* @internal
*
* A function that maps the source value to the target value.
* Defaults to pass-through with nullish check.
*/
export type ValueMapper = (value: any) => any;
/**
* @internal
*
* A non-function value.
*/
export type Value = any;
/**
* @internal
* Internal/Private, for codegen use only.
*
* Transfer a set of keys from [instructions] to [target].
*
* For each instruction in the record, the target key will be the instruction key.
* The target assignment will be conditional on the instruction's filter.
* The target assigned value will be supplied by the instructions as an evaluable function or non-function value.
*
* @see ObjectMappingInstructions for an example.
*/
export declare function map(target: any, filter: (value: any) => boolean, instructions: Record<string, ValueSupplier | Value>): typeof target;
/**
* @internal
*/
export declare function map(instructions: ObjectMappingInstructions): any;
/**
* @internal
*/
export declare function map(target: any, instructions: ObjectMappingInstructions): typeof target;
/**
* Convert a regular object `{ k: v }` to `{ k: [, v] }` mapping instruction set with default
* filter.
*
* @internal
*/
export declare const convertMap: (target: any) => Record<string, any>;
/**
* @param source - original object with data.
* @param instructions - how to map the data.
* @returns new object mapped from the source object.
* @internal
*/
export declare const take: (source: any, instructions: SourceMappingInstructions) => any;

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { resolvedPath } from "@smithy/core/protocols";

View File

@@ -0,0 +1,9 @@
import type { SchemaRef } from "@smithy/types";
/**
* Redacts sensitive parts of any data object using its schema, for logging.
*
* @internal
* @param schema - with filtering traits.
* @param data - to be logged.
*/
export declare function schemaLogFilter(schema: SchemaRef, data: unknown): any;

View File

@@ -0,0 +1,15 @@
/**
* @internal
*
* Serializes a number, turning non-numeric values into strings.
*
* @param value - The number to serialize.
* @returns A number, or a string if the given number was non-numeric.
*/
export declare const serializeFloat: (value: number) => string | number;
/**
* @internal
* @param date - to be serialized.
* @returns https://smithy.io/2.0/spec/protocol-traits.html#timestampformat-trait date-time format.
*/
export declare const serializeDateTime: (date: Date) => string;

View File

@@ -0,0 +1,12 @@
/**
* @internal
*
* Maps an object through the default JSON serde behavior.
* This means removing nullish fields and un-sparsifying lists.
*
* This is also used by Smithy RPCv2 CBOR as the default serde behavior.
*
* @param obj - to be checked.
* @returns same object with default serde behavior applied.
*/
export declare const _json: (obj: any) => any;

View File

@@ -0,0 +1,11 @@
import { Logger } from "@smithy/types";
/**
* @internal
*/
export declare class NoOpLogger implements Logger {
trace(): void;
debug(): void;
info(): void;
warn(): void;
error(): void;
}

View File

@@ -0,0 +1,87 @@
import { $ClientProtocol, $ClientProtocolCtor, Client as IClient, ClientProtocol, ClientProtocolCtor, Command, FetchHttpHandlerOptions, MetadataBearer, MiddlewareStack, NodeHttpHandlerOptions, RequestHandler } from "@smithy/types";
/**
* @public
*/
export interface SmithyConfiguration<HandlerOptions> {
/**
* @public
*/
requestHandler: RequestHandler<any, any, HandlerOptions> | NodeHttpHandlerOptions | FetchHttpHandlerOptions | Record<string, unknown>;
/**
* @public
*
* Default false.
*
* When true, the client will only resolve the middleware stack once per
* Command class. This means modifying the middlewareStack of the
* command or client after requests have been made will not be
* recognized.
*
* Calling client.destroy() also clears this cache.
*
* Enable this only if needing the additional time saved (0-1ms per request)
* and not needing middleware modifications between requests.
*/
cacheMiddleware?: boolean;
/**
* A client request/response protocol or constructor of one.
* A protocol in this context is not e.g. https.
* It is the combined implementation of how to (de)serialize and create
* the messages (e.g. http requests/responses) that are being exchanged.
*
* @public
*/
protocol?: ClientProtocol<any, any> | $ClientProtocol<any, any> | ClientProtocolCtor<any, any> | $ClientProtocolCtor<any, any>;
/**
* These are automatically generated and will be passed to the
* config.protocol if given as a constructor.
* @internal
*/
protocolSettings?: {
defaultNamespace?: string;
[setting: string]: unknown;
};
/**
* The API version set internally by the SDK, and is
* not planned to be used by customer code.
* @internal
*/
readonly apiVersion: string;
}
/**
* @internal
*/
export type SmithyResolvedConfiguration<HandlerOptions> = {
requestHandler: RequestHandler<any, any, HandlerOptions>;
cacheMiddleware?: boolean;
protocol?: ClientProtocol<any, any> | $ClientProtocol<any, any>;
protocolSettings?: {
defaultNamespace?: string;
[setting: string]: unknown;
};
readonly apiVersion: string;
};
/**
* @public
*/
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
readonly config: ResolvedClientConfiguration;
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
/**
* Holds an object reference to the initial configuration object.
* Used to check that the config resolver stack does not create
* dangling instances of an intermediate form of the configuration object.
*
* @internal
*/
initConfig?: object;
/**
* May be used to cache the resolved handler function for a Command class.
*/
private handlers?;
constructor(config: ResolvedClientConfiguration);
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options: HandlerOptions, cb: (err: any, data?: OutputType) => void): void;
destroy(): void;
}

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { collectBody } from "@smithy/core/protocols";

View File

@@ -0,0 +1,119 @@
import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
import { Command as ICommand, Handler, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, Logger, MetadataBearer, MiddlewareStack as IMiddlewareStack, OperationSchema, OptionalParameter, Pluggable, RequestHandler, SerdeContext, StaticOperationSchema } from "@smithy/types";
/**
* @public
*/
export declare abstract class Command<Input extends ClientInput, Output extends ClientOutput, ResolvedClientConfiguration, ClientInput extends object = any, ClientOutput extends MetadataBearer = any> implements ICommand<ClientInput, Input, ClientOutput, Output, ResolvedClientConfiguration> {
abstract input: Input;
readonly middlewareStack: IMiddlewareStack<Input, Output>;
readonly schema?: OperationSchema | StaticOperationSchema;
/**
* Factory for Command ClassBuilder.
* @internal
*/
static classBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any>(): ClassBuilder<I, O, C, SI, SO>;
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
/**
* @internal
*/
resolveMiddlewareWithContext(clientStack: IMiddlewareStack<any, any>, configuration: {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, options: any, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor, }: ResolveMiddlewareContextArgs): import("@smithy/types").InitializeHandler<any, Output>;
}
/**
* @internal
*/
type ResolveMiddlewareContextArgs = {
middlewareFn: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[];
clientName: string;
commandName: string;
smithyContext: Record<string, unknown>;
additionalContext: HandlerExecutionContext;
inputFilterSensitiveLog: (_: any) => any;
outputFilterSensitiveLog: (_: any) => any;
CommandCtor: any;
};
/**
* @internal
*/
declare class ClassBuilder<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> {
private _init;
private _ep;
private _middlewareFn;
private _commandName;
private _clientName;
private _additionalContext;
private _smithyContext;
private _inputFilterSensitiveLog;
private _outputFilterSensitiveLog;
private _serializer;
private _deserializer;
private _operationSchema?;
/**
* Optional init callback.
*/
init(cb: (_: Command<I, O, C, SI, SO>) => void): void;
/**
* Set the endpoint parameter instructions.
*/
ep(endpointParameterInstructions: EndpointParameterInstructions): ClassBuilder<I, O, C, SI, SO>;
/**
* Add any number of middleware.
*/
m(middlewareSupplier: (CommandCtor: any, clientStack: any, config: any, options: any) => Pluggable<any, any>[]): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context Smithy field.
*/
s(service: string, operation: string, smithyContext?: Record<string, unknown>): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the initial handler execution context.
*/
c(additionalContext?: HandlerExecutionContext): ClassBuilder<I, O, C, SI, SO>;
/**
* Set constant string identifiers for the operation.
*/
n(clientName: string, commandName: string): ClassBuilder<I, O, C, SI, SO>;
/**
* Set the input and output sensistive log filters.
*/
f(inputFilter?: (_: any) => any, outputFilter?: (_: any) => any): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the serializer.
*/
ser(serializer: (input: I, context?: SerdeContext | any) => Promise<IHttpRequest>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets the deserializer.
*/
de(deserializer: (output: IHttpResponse, context?: SerdeContext | any) => Promise<O>): ClassBuilder<I, O, C, SI, SO>;
/**
* Sets input/output schema for the operation.
*/
sc(operation: OperationSchema | StaticOperationSchema): ClassBuilder<I, O, C, SI, SO>;
/**
* @returns a Command class with the classBuilder properties.
*/
build(): {
new (input: I): CommandImpl<I, O, C, SI, SO>;
new (...[input]: OptionalParameter<I>): CommandImpl<I, O, C, SI, SO>;
getEndpointParameterInstructions(): EndpointParameterInstructions;
};
}
/**
* A concrete implementation of ICommand with no abstract members.
* @public
*/
export interface CommandImpl<I extends SI, O extends SO, C extends {
logger: Logger;
requestHandler: RequestHandler<any, any, any>;
}, SI extends object = any, SO extends MetadataBearer = any> extends Command<I, O, C, SI, SO> {
readonly input: I;
resolveMiddleware(stack: IMiddlewareStack<SI, SO>, configuration: C, options: any): Handler<I, O>;
}
export {};

View File

@@ -0,0 +1,4 @@
/**
* @internal
*/
export declare const SENSITIVE_STRING = "***SensitiveInformation***";

View File

@@ -0,0 +1,11 @@
import { Client } from "./client";
/**
* @internal
*
* @param commands - command lookup container.
* @param client - client instance on which to add aggregated methods.
* @returns an aggregated client with dynamically created methods.
*/
export declare const createAggregatedClient: (commands: Record<string, any>, Client: {
new (...args: any): Client<any, any, any, any>;
}) => void;

View File

@@ -0,0 +1,15 @@
/**
* Always throws an error with the given `exceptionCtor` and other arguments.
* This is only called from an error handling code path.
*
* @internal
*/
export declare const throwDefaultError: ({ output, parsedBody, exceptionCtor, errorCode }: any) => never;
/**
* @internal
*
* Creates {@link throwDefaultError} with bound ExceptionCtor.
*/
export declare const withBaseException: (ExceptionCtor: {
new (...args: any): any;
}) => any;

View File

@@ -0,0 +1,28 @@
/**
* @internal
*/
export declare const loadConfigsForDefaultMode: (mode: ResolvedDefaultsMode) => DefaultsModeConfigs;
/**
* Option determining how certain default configuration options are resolved in the SDK. It can be one of the value listed below:
* * `"standard"`: <p>The STANDARD mode provides the latest recommended default values that should be safe to run in most scenarios</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"in-region"`: <p>The IN_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services from within the same AWS region</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"cross-region"`: <p>The CROSS_REGION mode builds on the standard mode and includes optimization tailored for applications which call AWS services in a different region</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"mobile"`: <p>The MOBILE mode builds on the standard mode and includes optimization tailored for mobile applications</p><p>Note that the default values vended from this mode might change as best practices may evolve. As a result, it is encouraged to perform tests when upgrading the SDK</p>
* * `"auto"`: <p>The AUTO mode is an experimental mode that builds on the standard mode. The SDK will attempt to discover the execution environment to determine the appropriate settings automatically.</p><p>Note that the auto detection is heuristics-based and does not guarantee 100% accuracy. STANDARD mode will be used if the execution environment cannot be determined. The auto detection might query <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">EC2 Instance Metadata service</a>, which might introduce latency. Therefore we recommend choosing an explicit defaults_mode instead if startup latency is critical to your application</p>
* * `"legacy"`: <p>The LEGACY mode provides default settings that vary per SDK and were used prior to establishment of defaults_mode</p>
*
* @defaultValue "legacy"
*/
export type DefaultsMode = "standard" | "in-region" | "cross-region" | "mobile" | "auto" | "legacy";
/**
* @internal
*/
export type ResolvedDefaultsMode = Exclude<DefaultsMode, "auto">;
/**
* @internal
*/
export interface DefaultsModeConfigs {
retryMode?: string;
connectionTimeout?: number;
requestTimeout?: number;
}

View File

@@ -0,0 +1,8 @@
/**
* @internal
*
* Emits warning if the provided Node.js version string is pending deprecation.
*
* @param version - The Node.js version string.
*/
export declare const emitWarningIfUnsupportedVersion: (version: string) => void;

View File

@@ -0,0 +1,42 @@
import { HttpResponse, MetadataBearer, ResponseMetadata, RetryableTrait, SmithyException } from "@smithy/types";
/**
* The type of the exception class constructor parameter. The returned type contains the properties
* in the `ExceptionType` but not in the `BaseExceptionType`. If the `BaseExceptionType` contains
* `$metadata` and `message` properties, it's also included in the returned type.
* @internal
*/
export type ExceptionOptionType<ExceptionType extends Error, BaseExceptionType extends Error> = Pick<ExceptionType, Exclude<keyof ExceptionType, Exclude<keyof BaseExceptionType, "$metadata" | "message">>>;
/**
* @public
*/
export interface ServiceExceptionOptions extends SmithyException, MetadataBearer {
message?: string;
}
/**
* @public
*
* Base exception class for the exceptions from the server-side.
*/
export declare class ServiceException extends Error implements SmithyException, MetadataBearer {
readonly $fault: "client" | "server";
$response?: HttpResponse;
$retryable?: RetryableTrait;
$metadata: ResponseMetadata;
constructor(options: ServiceExceptionOptions);
/**
* Checks if a value is an instance of ServiceException (duck typed)
*/
static isInstance(value: unknown): value is ServiceException;
/**
* Custom instanceof check to support the operator for ServiceException base class
*/
static [Symbol.hasInstance](instance: unknown): boolean;
}
/**
* This method inject unmodeled member to a deserialized SDK exception,
* and load the error message from different possible keys('message',
* 'Message').
*
* @internal
*/
export declare const decorateServiceException: <E extends ServiceException>(exception: E, additions?: Record<string, any>) => E;

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { extendedEncodeURIComponent } from "@smithy/core/protocols";

View File

@@ -0,0 +1,24 @@
import { ChecksumAlgorithm, ChecksumConfiguration, ChecksumConstructor, HashConstructor } from "@smithy/types";
import { AlgorithmId } from "@smithy/types";
export { AlgorithmId, ChecksumAlgorithm, ChecksumConfiguration };
/**
* @internal
*/
export type PartialChecksumRuntimeConfigType = Partial<{
sha256: ChecksumConstructor | HashConstructor;
md5: ChecksumConstructor | HashConstructor;
crc32: ChecksumConstructor | HashConstructor;
crc32c: ChecksumConstructor | HashConstructor;
sha1: ChecksumConstructor | HashConstructor;
}>;
/**
* @internal
*/
export declare const getChecksumConfiguration: (runtimeConfig: PartialChecksumRuntimeConfigType) => {
addChecksumAlgorithm(algo: ChecksumAlgorithm): void;
checksumAlgorithms(): ChecksumAlgorithm[];
};
/**
* @internal
*/
export declare const resolveChecksumRuntimeConfig: (clientConfig: ChecksumConfiguration) => PartialChecksumRuntimeConfigType;

View File

@@ -0,0 +1,38 @@
import { DefaultExtensionConfiguration } from "@smithy/types";
import { PartialChecksumRuntimeConfigType } from "./checksum";
import { PartialRetryRuntimeConfigType } from "./retry";
/**
* @internal
*/
export type DefaultExtensionRuntimeConfigType = PartialRetryRuntimeConfigType & PartialChecksumRuntimeConfigType;
/**
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultExtensionConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
} & {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>;
};
/**
* @deprecated use getDefaultExtensionConfiguration
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultClientConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
} & {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategyV2 | import("@smithy/types").RetryStrategy>;
};
/**
* @internal
*
* Helper function to resolve runtime config from default extension configuration
*/
export declare const resolveDefaultRuntimeConfig: (config: DefaultExtensionConfiguration) => DefaultExtensionRuntimeConfigType;

View File

@@ -0,0 +1 @@
export * from "./defaultExtensionConfiguration";

View File

@@ -0,0 +1,18 @@
import { Provider, RetryStrategy, RetryStrategyConfiguration, RetryStrategyV2 } from "@smithy/types";
/**
* @internal
*/
export type PartialRetryRuntimeConfigType = Partial<{
retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>;
}>;
/**
* @internal
*/
export declare const getRetryConfiguration: (runtimeConfig: PartialRetryRuntimeConfigType) => {
setRetryStrategy(retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>): void;
retryStrategy(): Provider<RetryStrategyV2 | RetryStrategy>;
};
/**
* @internal
*/
export declare const resolveRetryRuntimeConfig: (retryStrategyConfiguration: RetryStrategyConfiguration) => PartialRetryRuntimeConfigType;

View File

@@ -0,0 +1,7 @@
/**
* @internal
*
* The XML parser will set one K:V for a member that could
* return multiple entries but only has one.
*/
export declare const getArrayIfSingleItem: <T>(mayBeArray: T) => T | T[];

View File

@@ -0,0 +1,7 @@
/**
* @internal
*
* Recursively parses object and populates value is node from
* "#text" key if it's available
*/
export declare const getValueFromTextNode: (obj: any) => any;

View File

@@ -0,0 +1,21 @@
export { DocumentType, SdkError, SmithyException } from "@smithy/types";
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./extensions";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./is-serializable-header-value";
export * from "./NoOpLogger";
export * from "./object-mapping";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "@smithy/core/serde";

View File

@@ -0,0 +1,5 @@
/**
* @internal
* @returns whether the header value is serializable.
*/
export declare const isSerializableHeaderValue: (value: any) => boolean;

View File

@@ -0,0 +1,178 @@
/**
* @internal
*
* A set of instructions for multiple keys.
* The aim is to provide a concise yet readable way to map and filter values
* onto a target object.
*
* @example
* ```javascript
* const example: ObjectMappingInstructions = {
* lazyValue1: [, () => 1],
* lazyValue2: [, () => 2],
* lazyValue3: [, () => 3],
* lazyConditionalValue1: [() => true, () => 4],
* lazyConditionalValue2: [() => true, () => 5],
* lazyConditionalValue3: [true, () => 6],
* lazyConditionalValue4: [false, () => 44],
* lazyConditionalValue5: [() => false, () => 55],
* lazyConditionalValue6: ["", () => 66],
* simpleValue1: [, 7],
* simpleValue2: [, 8],
* simpleValue3: [, 9],
* conditionalValue1: [() => true, 10],
* conditionalValue2: [() => true, 11],
* conditionalValue3: [{}, 12],
* conditionalValue4: [false, 110],
* conditionalValue5: [() => false, 121],
* conditionalValue6: ["", 132],
* };
*
* const exampleResult: Record<string, any> = {
* lazyValue1: 1,
* lazyValue2: 2,
* lazyValue3: 3,
* lazyConditionalValue1: 4,
* lazyConditionalValue2: 5,
* lazyConditionalValue3: 6,
* simpleValue1: 7,
* simpleValue2: 8,
* simpleValue3: 9,
* conditionalValue1: 10,
* conditionalValue2: 11,
* conditionalValue3: 12,
* };
* ```
*/
export type ObjectMappingInstructions = Record<string, ObjectMappingInstruction>;
/**
* @internal
*
* A variant of the object mapping instruction for the `take` function.
* In this case, the source value is provided to the value function, turning it
* from a supplier into a mapper.
*/
export type SourceMappingInstructions = Record<string, ValueMapper | SourceMappingInstruction>;
/**
* @internal
*
* An instruction set for assigning a value to a target object.
*/
export type ObjectMappingInstruction = LazyValueInstruction | ConditionalLazyValueInstruction | SimpleValueInstruction | ConditionalValueInstruction | UnfilteredValue;
/**
* @internal
*
* non-array
*/
export type UnfilteredValue = any;
/**
* @internal
*/
export type LazyValueInstruction = [
FilterStatus,
ValueSupplier
];
/**
* @internal
*/
export type ConditionalLazyValueInstruction = [
FilterStatusSupplier,
ValueSupplier
];
/**
* @internal
*/
export type SimpleValueInstruction = [
FilterStatus,
Value
];
/**
* @internal
*/
export type ConditionalValueInstruction = [
ValueFilteringFunction,
Value
];
/**
* @internal
*/
export type SourceMappingInstruction = [
(ValueFilteringFunction | FilterStatus)?,
ValueMapper?,
string?
];
/**
* @internal
*
* Filter is considered passed if
* 1. It is a boolean true.
* 2. It is not undefined and is itself truthy.
* 3. It is undefined and the corresponding _value_ is neither null nor undefined.
*/
export type FilterStatus = boolean | unknown | void;
/**
* @internal
*
* Supplies the filter check but not against any value as input.
*/
export type FilterStatusSupplier = () => boolean;
/**
* @internal
*
* Filter check with the given value.
*/
export type ValueFilteringFunction = (value: any) => boolean;
/**
* @internal
*
* Supplies the value for lazy evaluation.
*/
export type ValueSupplier = () => any;
/**
* @internal
*
* A function that maps the source value to the target value.
* Defaults to pass-through with nullish check.
*/
export type ValueMapper = (value: any) => any;
/**
* @internal
*
* A non-function value.
*/
export type Value = any;
/**
* @internal
* Internal/Private, for codegen use only.
*
* Transfer a set of keys from [instructions] to [target].
*
* For each instruction in the record, the target key will be the instruction key.
* The target assignment will be conditional on the instruction's filter.
* The target assigned value will be supplied by the instructions as an evaluable function or non-function value.
*
* @see ObjectMappingInstructions for an example.
*/
export declare function map(target: any, filter: (value: any) => boolean, instructions: Record<string, ValueSupplier | Value>): typeof target;
/**
* @internal
*/
export declare function map(instructions: ObjectMappingInstructions): any;
/**
* @internal
*/
export declare function map(target: any, instructions: ObjectMappingInstructions): typeof target;
/**
* Convert a regular object `{ k: v }` to `{ k: [, v] }` mapping instruction set with default
* filter.
*
* @internal
*/
export declare const convertMap: (target: any) => Record<string, any>;
/**
* @param source - original object with data.
* @param instructions - how to map the data.
* @returns new object mapped from the source object.
* @internal
*/
export declare const take: (source: any, instructions: SourceMappingInstructions) => any;

View File

@@ -0,0 +1,5 @@
/**
* @internal
* Backwards compatibility re-export.
*/
export { resolvedPath } from "@smithy/core/protocols";

View File

@@ -0,0 +1,9 @@
import { SchemaRef } from "@smithy/types";
/**
* Redacts sensitive parts of any data object using its schema, for logging.
*
* @internal
* @param schema - with filtering traits.
* @param data - to be logged.
*/
export declare function schemaLogFilter(schema: SchemaRef, data: unknown): any;

View File

@@ -0,0 +1,15 @@
/**
* @internal
*
* Serializes a number, turning non-numeric values into strings.
*
* @param value - The number to serialize.
* @returns A number, or a string if the given number was non-numeric.
*/
export declare const serializeFloat: (value: number) => string | number;
/**
* @internal
* @param date - to be serialized.
* @returns https://smithy.io/2.0/spec/protocol-traits.html#timestampformat-trait date-time format.
*/
export declare const serializeDateTime: (date: Date) => string;

View File

@@ -0,0 +1,12 @@
/**
* @internal
*
* Maps an object through the default JSON serde behavior.
* This means removing nullish fields and un-sparsifying lists.
*
* This is also used by Smithy RPCv2 CBOR as the default serde behavior.
*
* @param obj - to be checked.
* @returns same object with default serde behavior applied.
*/
export declare const _json: (obj: any) => any;

View File

@@ -0,0 +1,68 @@
{
"name": "@smithy/smithy-client",
"version": "4.10.9",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "node ../../scripts/inline smithy-client",
"build:es": "yarn g:tsc -p tsconfig.es.json",
"build:types": "yarn g:tsc -p tsconfig.types.json",
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
"extract:docs": "node ./scripts/fix-api-extractor && api-extractor run --local && node ./scripts/fix-api-extractor --unset",
"test": "yarn g:vitest run",
"test:watch": "yarn g:vitest watch"
},
"main": "./dist-cjs/index.js",
"module": "./dist-es/index.js",
"types": "./dist-types/index.d.ts",
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0",
"sideEffects": false,
"dependencies": {
"@smithy/core": "^3.20.7",
"@smithy/middleware-endpoint": "^4.4.8",
"@smithy/middleware-stack": "^4.2.8",
"@smithy/protocol-http": "^5.3.8",
"@smithy/types": "^4.12.0",
"@smithy/util-stream": "^4.5.10",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=18.0.0"
},
"typesVersions": {
"<4.0": {
"dist-types/*": [
"dist-types/ts3.4/*"
]
}
},
"files": [
"dist-*/**"
],
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/smithy-client",
"repository": {
"type": "git",
"url": "https://github.com/smithy-lang/smithy-typescript.git",
"directory": "packages/smithy-client"
},
"devDependencies": {
"@types/node": "^18.11.9",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"premove": "4.0.0",
"typedoc": "0.23.23"
},
"typedoc": {
"entryPoint": "src/index.ts"
},
"publishConfig": {
"directory": ".release/package"
}
}