feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

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.

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 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("../index.js");

View File

@@ -0,0 +1 @@
module.exports = require("../index.js");

View File

@@ -0,0 +1 @@
module.exports = require("../index.js");

View File

@@ -0,0 +1 @@
module.exports = require("../index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

@@ -0,0 +1 @@
module.exports = require("./index.js");

View File

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

View File

@@ -0,0 +1,24 @@
import { constructStack } from "@smithy/middleware-stack";
export class Client {
constructor(config) {
this.middlewareStack = constructStack();
this.config = config;
}
send(command, optionsOrCb, cb) {
const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
const 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() {
if (this.config.requestHandler.destroy)
this.config.requestHandler.destroy();
}
}

View File

@@ -0,0 +1,11 @@
import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
export const collectBody = async (streamBody = new Uint8Array(), context) => {
if (streamBody instanceof Uint8Array) {
return Uint8ArrayBlobAdapter.mutate(streamBody);
}
if (!streamBody) {
return Uint8ArrayBlobAdapter.mutate(new Uint8Array());
}
const fromContext = context.streamCollector(streamBody);
return Uint8ArrayBlobAdapter.mutate(await fromContext);
};

View File

@@ -0,0 +1,114 @@
import { constructStack } from "@smithy/middleware-stack";
import { SMITHY_CONTEXT_KEY } from "@smithy/types";
export class Command {
constructor() {
this.middlewareStack = constructStack();
}
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]: {
...smithyContext,
},
...additionalContext,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
}
class ClassBuilder {
constructor() {
this._init = () => { };
this._ep = {};
this._middlewareFn = () => [];
this._commandName = "";
this._clientName = "";
this._additionalContext = {};
this._smithyContext = {};
this._inputFilterSensitiveLog = (_) => _;
this._outputFilterSensitiveLog = (_) => _;
this._serializer = null;
this._deserializer = null;
}
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;
}
build() {
const closure = this;
let CommandRef;
return (CommandRef = class extends Command {
static getEndpointParameterInstructions() {
return closure._ep;
}
constructor(...[input]) {
super();
this.serialize = closure._serializer;
this.deserialize = closure._deserializer;
this.input = input ?? {};
closure._init(this);
}
resolveMiddleware(stack, configuration, options) {
return this.resolveMiddlewareWithContext(stack, configuration, options, {
CommandCtor: CommandRef,
middlewareFn: closure._middlewareFn,
clientName: closure._clientName,
commandName: closure._commandName,
inputFilterSensitiveLog: closure._inputFilterSensitiveLog,
outputFilterSensitiveLog: closure._outputFilterSensitiveLog,
smithyContext: closure._smithyContext,
additionalContext: closure._additionalContext,
});
}
});
}
}

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,187 @@
import { strictParseByte, strictParseDouble, strictParseFloat32, strictParseShort } from "./parse-utils";
const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
export function dateToUtcString(date) {
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const dayOfWeek = date.getUTCDay();
const dayOfMonthInt = date.getUTCDate();
const hoursInt = date.getUTCHours();
const minutesInt = date.getUTCMinutes();
const secondsInt = date.getUTCSeconds();
const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`;
const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`;
const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`;
const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`;
return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`;
}
const RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
export const parseRfc3339DateTime = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value !== "string") {
throw new TypeError("RFC-3339 date-times must be expressed as strings");
}
const match = RFC3339.exec(value);
if (!match) {
throw new TypeError("Invalid RFC-3339 date-time value");
}
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
const year = strictParseShort(stripLeadingZeroes(yearStr));
const month = parseDateValue(monthStr, "month", 1, 12);
const day = parseDateValue(dayStr, "day", 1, 31);
return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
};
const RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
export const parseRfc3339DateTimeWithOffset = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value !== "string") {
throw new TypeError("RFC-3339 date-times must be expressed as strings");
}
const match = RFC3339_WITH_OFFSET.exec(value);
if (!match) {
throw new TypeError("Invalid RFC-3339 date-time value");
}
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match;
const year = strictParseShort(stripLeadingZeroes(yearStr));
const month = parseDateValue(monthStr, "month", 1, 12);
const day = parseDateValue(dayStr, "day", 1, 31);
const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
if (offsetStr.toUpperCase() != "Z") {
date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr));
}
return date;
};
const IMF_FIXDATE = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
const RFC_850_DATE = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
const ASC_TIME = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
export const parseRfc7231DateTime = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value !== "string") {
throw new TypeError("RFC-7231 date-times must be expressed as strings");
}
let match = IMF_FIXDATE.exec(value);
if (match) {
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
}
match = RFC_850_DATE.exec(value);
if (match) {
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
hours,
minutes,
seconds,
fractionalMilliseconds,
}));
}
match = ASC_TIME.exec(value);
if (match) {
const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
}
throw new TypeError("Invalid RFC-7231 date-time value");
};
export const parseEpochTimestamp = (value) => {
if (value === null || value === undefined) {
return undefined;
}
let valueAsDouble;
if (typeof value === "number") {
valueAsDouble = value;
}
else if (typeof value === "string") {
valueAsDouble = strictParseDouble(value);
}
else {
throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
}
if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) {
throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
}
return new Date(Math.round(valueAsDouble * 1000));
};
const buildDate = (year, month, day, time) => {
const adjustedMonth = month - 1;
validateDayOfMonth(year, adjustedMonth, day);
return new Date(Date.UTC(year, adjustedMonth, day, parseDateValue(time.hours, "hour", 0, 23), parseDateValue(time.minutes, "minute", 0, 59), parseDateValue(time.seconds, "seconds", 0, 60), parseMilliseconds(time.fractionalMilliseconds)));
};
const parseTwoDigitYear = (value) => {
const thisYear = new Date().getUTCFullYear();
const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value));
if (valueInThisCentury < thisYear) {
return valueInThisCentury + 100;
}
return valueInThisCentury;
};
const FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1000;
const adjustRfc850Year = (input) => {
if (input.getTime() - new Date().getTime() > FIFTY_YEARS_IN_MILLIS) {
return new Date(Date.UTC(input.getUTCFullYear() - 100, input.getUTCMonth(), input.getUTCDate(), input.getUTCHours(), input.getUTCMinutes(), input.getUTCSeconds(), input.getUTCMilliseconds()));
}
return input;
};
const parseMonthByShortName = (value) => {
const monthIdx = MONTHS.indexOf(value);
if (monthIdx < 0) {
throw new TypeError(`Invalid month: ${value}`);
}
return monthIdx + 1;
};
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const validateDayOfMonth = (year, month, day) => {
let maxDays = DAYS_IN_MONTH[month];
if (month === 1 && isLeapYear(year)) {
maxDays = 29;
}
if (day > maxDays) {
throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`);
}
};
const isLeapYear = (year) => {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
};
const parseDateValue = (value, type, lower, upper) => {
const dateVal = strictParseByte(stripLeadingZeroes(value));
if (dateVal < lower || dateVal > upper) {
throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
}
return dateVal;
};
const parseMilliseconds = (value) => {
if (value === null || value === undefined) {
return 0;
}
return strictParseFloat32("0." + value) * 1000;
};
const parseOffsetToMilliseconds = (value) => {
const directionStr = value[0];
let direction = 1;
if (directionStr == "+") {
direction = 1;
}
else if (directionStr == "-") {
direction = -1;
}
else {
throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);
}
const hour = Number(value.substring(1, 3));
const minute = Number(value.substring(4, 6));
return direction * (hour * 60 + minute) * 60 * 1000;
};
const stripLeadingZeroes = (value) => {
let idx = 0;
while (idx < value.length - 1 && value.charAt(idx) === "0") {
idx++;
}
if (idx === 0) {
return value;
}
return value.slice(idx);
};

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("."))) < 14) {
warningEmitted = true;
}
};

View File

@@ -0,0 +1,22 @@
export class ServiceException extends Error {
constructor(options) {
super(options.message);
Object.setPrototypeOf(this, ServiceException.prototype);
this.name = options.name;
this.$fault = options.$fault;
this.$metadata = options.$metadata;
}
}
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,5 @@
export function extendedEncodeURIComponent(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
});
}

View File

@@ -0,0 +1,31 @@
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 {
_checksumAlgorithms: checksumAlgorithms,
addChecksumAlgorithm(algo) {
this._checksumAlgorithms.push(algo);
},
checksumAlgorithms() {
return this._checksumAlgorithms;
},
};
};
export const resolveChecksumRuntimeConfig = (clientConfig) => {
const runtimeConfig = {};
clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
});
return runtimeConfig;
};

View File

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

View File

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

View File

@@ -0,0 +1,16 @@
export const getRetryConfiguration = (runtimeConfig) => {
let _retryStrategy = runtimeConfig.retryStrategy;
return {
setRetryStrategy(retryStrategy) {
_retryStrategy = retryStrategy;
},
retryStrategy() {
return _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,22 @@
export * from "./NoOpLogger";
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./date-utils";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./extensions";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./lazy-json";
export * from "./object-mapping";
export * from "./parse-utils";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "./split-every";

View File

@@ -0,0 +1,33 @@
export const StringWrapper = function () {
const Class = Object.getPrototypeOf(this).constructor;
const Constructor = Function.bind.apply(String, [null, ...arguments]);
const instance = new Constructor();
Object.setPrototypeOf(instance, Class.prototype);
return instance;
};
StringWrapper.prototype = Object.create(String.prototype, {
constructor: {
value: StringWrapper,
enumerable: false,
writable: true,
configurable: true,
},
});
Object.setPrototypeOf(StringWrapper, String);
export class LazyJsonString extends StringWrapper {
deserializeJSON() {
return JSON.parse(super.toString());
}
toJSON() {
return super.toString();
}
static fromObject(object) {
if (object instanceof LazyJsonString) {
return object;
}
else if (object instanceof String || typeof object === "string") {
return new LazyJsonString(object);
}
return new LazyJsonString(JSON.stringify(object));
}
}

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,230 @@
export const parseBoolean = (value) => {
switch (value) {
case "true":
return true;
case "false":
return false;
default:
throw new Error(`Unable to parse boolean value "${value}"`);
}
};
export const expectBoolean = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value === "number") {
if (value === 0 || value === 1) {
logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
}
if (value === 0) {
return false;
}
if (value === 1) {
return true;
}
}
if (typeof value === "string") {
const lower = value.toLowerCase();
if (lower === "false" || lower === "true") {
logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
}
if (lower === "false") {
return false;
}
if (lower === "true") {
return true;
}
}
if (typeof value === "boolean") {
return value;
}
throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`);
};
export const expectNumber = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value === "string") {
const parsed = parseFloat(value);
if (!Number.isNaN(parsed)) {
if (String(parsed) !== String(value)) {
logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
}
return parsed;
}
}
if (typeof value === "number") {
return value;
}
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
};
const MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
export const expectFloat32 = (value) => {
const expected = expectNumber(value);
if (expected !== undefined && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
if (Math.abs(expected) > MAX_FLOAT) {
throw new TypeError(`Expected 32-bit float, got ${value}`);
}
}
return expected;
};
export const expectLong = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (Number.isInteger(value) && !Number.isNaN(value)) {
return value;
}
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
};
export const expectInt = expectLong;
export const expectInt32 = (value) => expectSizedInt(value, 32);
export const expectShort = (value) => expectSizedInt(value, 16);
export const expectByte = (value) => expectSizedInt(value, 8);
const expectSizedInt = (value, size) => {
const expected = expectLong(value);
if (expected !== undefined && castInt(expected, size) !== expected) {
throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
}
return expected;
};
const castInt = (value, size) => {
switch (size) {
case 32:
return Int32Array.of(value)[0];
case 16:
return Int16Array.of(value)[0];
case 8:
return Int8Array.of(value)[0];
}
};
export const expectNonNull = (value, location) => {
if (value === null || value === undefined) {
if (location) {
throw new TypeError(`Expected a non-null value for ${location}`);
}
throw new TypeError("Expected a non-null value");
}
return value;
};
export const expectObject = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value === "object" && !Array.isArray(value)) {
return value;
}
const receivedType = Array.isArray(value) ? "array" : typeof value;
throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
};
export const expectString = (value) => {
if (value === null || value === undefined) {
return undefined;
}
if (typeof value === "string") {
return value;
}
if (["boolean", "number", "bigint"].includes(typeof value)) {
logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
return String(value);
}
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
};
export const expectUnion = (value) => {
if (value === null || value === undefined) {
return undefined;
}
const asObject = expectObject(value);
const setKeys = Object.entries(asObject)
.filter(([, v]) => v != null)
.map(([k]) => k);
if (setKeys.length === 0) {
throw new TypeError(`Unions must have exactly one non-null member. None were found.`);
}
if (setKeys.length > 1) {
throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`);
}
return asObject;
};
export const strictParseDouble = (value) => {
if (typeof value == "string") {
return expectNumber(parseNumber(value));
}
return expectNumber(value);
};
export const strictParseFloat = strictParseDouble;
export const strictParseFloat32 = (value) => {
if (typeof value == "string") {
return expectFloat32(parseNumber(value));
}
return expectFloat32(value);
};
const NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
const parseNumber = (value) => {
const matches = value.match(NUMBER_REGEX);
if (matches === null || matches[0].length !== value.length) {
throw new TypeError(`Expected real number, got implicit NaN`);
}
return parseFloat(value);
};
export const limitedParseDouble = (value) => {
if (typeof value == "string") {
return parseFloatString(value);
}
return expectNumber(value);
};
export const handleFloat = limitedParseDouble;
export const limitedParseFloat = limitedParseDouble;
export const limitedParseFloat32 = (value) => {
if (typeof value == "string") {
return parseFloatString(value);
}
return expectFloat32(value);
};
const parseFloatString = (value) => {
switch (value) {
case "NaN":
return NaN;
case "Infinity":
return Infinity;
case "-Infinity":
return -Infinity;
default:
throw new Error(`Unable to parse float value: ${value}`);
}
};
export const strictParseLong = (value) => {
if (typeof value === "string") {
return expectLong(parseNumber(value));
}
return expectLong(value);
};
export const strictParseInt = strictParseLong;
export const strictParseInt32 = (value) => {
if (typeof value === "string") {
return expectInt32(parseNumber(value));
}
return expectInt32(value);
};
export const strictParseShort = (value) => {
if (typeof value === "string") {
return expectShort(parseNumber(value));
}
return expectShort(value);
};
export const strictParseByte = (value) => {
if (typeof value === "string") {
return expectByte(parseNumber(value));
}
return expectByte(value);
};
const stackTraceWarning = (message) => {
return String(new TypeError(message).stack || message)
.split("\n")
.slice(0, 5)
.filter((s) => !s.includes("stackTraceWarning"))
.join("\n");
};
export const logger = {
warn: console.warn,
};

View File

@@ -0,0 +1,19 @@
import { extendedEncodeURIComponent } from "./extended-encode-uri-component";
export const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
if (input != null && input[memberName] !== undefined) {
const labelValue = labelValueProvider();
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
}
resolvedPath = resolvedPath.replace(uriLabel, isGreedyLabel
? labelValue
.split("/")
.map((segment) => extendedEncodeURIComponent(segment))
.join("/")
: extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: " + memberName + ".");
}
return resolvedPath;
};

View File

@@ -0,0 +1,13 @@
export const serializeFloat = (value) => {
if (value !== value) {
return "NaN";
}
switch (value) {
case Infinity:
return "Infinity";
case -Infinity:
return "-Infinity";
default:
return value;
}
};

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,27 @@
export function splitEvery(value, delimiter, numDelimiters) {
if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) {
throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery.");
}
const segments = value.split(delimiter);
if (numDelimiters === 1) {
return segments;
}
const compoundSegments = [];
let currentSegment = "";
for (let i = 0; i < segments.length; i++) {
if (currentSegment === "") {
currentSegment = segments[i];
}
else {
currentSegment += delimiter + segments[i];
}
if ((i + 1) % numDelimiters === 0) {
compoundSegments.push(currentSegment);
currentSegment = "";
}
}
if (currentSegment !== "") {
compoundSegments.push(currentSegment);
}
return compoundSegments;
}

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,32 @@
import { Client as IClient, Command, FetchHttpHandlerOptions, MetadataBearer, MiddlewareStack, NodeHttpHandlerOptions, RequestHandler } from "@smithy/types";
/**
* @public
*/
export interface SmithyConfiguration<HandlerOptions> {
requestHandler: RequestHandler<any, any, HandlerOptions> | NodeHttpHandlerOptions | FetchHttpHandlerOptions | Record<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>;
readonly apiVersion: string;
};
/**
* @public
*/
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
readonly config: ResolvedClientConfiguration;
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,10 @@
import { SerdeContext } from "@smithy/types";
import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
/**
* @internal
*
* Collect low-level response body stream to Uint8Array.
*/
export declare const collectBody: (streamBody: any, context: {
streamCollector: SerdeContext["streamCollector"];
}) => Promise<Uint8ArrayBlobAdapter>;

View File

@@ -0,0 +1,113 @@
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, OptionalParameter, Pluggable, RequestHandler, SerdeContext } 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>;
/**
* 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;
/**
* 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>;
/**
* @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,9 @@
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,73 @@
/**
* @internal
*
* Builds a proper UTC HttpDate timestamp from a Date object
* since not all environments will have this as the expected
* format.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString}
* - Prior to ECMAScript 2018, the format of the return value
* - varied according to the platform. The most common return
* - value was an RFC-1123 formatted date stamp, which is a
* - slightly updated version of RFC-822 date stamps.
*/
export declare function dateToUtcString(date: Date): string;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 3339 date.
*
* Input strings must conform to RFC3339 section 5.6, and cannot have a UTC
* offset. Fractional precision is supported.
*
* @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc3339DateTime: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 3339 date.
*
* Input strings must conform to RFC3339 section 5.6, and can have a UTC
* offset. Fractional precision is supported.
*
* @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc3339DateTimeWithOffset: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 7231 IMF-fixdate or obs-date.
*
* Input strings must conform to RFC7231 section 7.1.1.1. Fractional seconds are supported.
*
* @see {@link https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc7231DateTime: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a number or a parseable string.
*
* Input strings must be an integer or floating point number. Fractional seconds are supported.
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseEpochTimestamp: (value: unknown) => Date | undefined;

View File

@@ -0,0 +1,13 @@
/**
* 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,34 @@
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> = 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);
}
/**
* 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,7 @@
/**
* @internal
*
* Function that wraps encodeURIComponent to encode additional characters
* to fully adhere to RFC 3986.
*/
export declare function extendedEncodeURIComponent(str: string): string;

View File

@@ -0,0 +1,25 @@
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) => {
_checksumAlgorithms: ChecksumAlgorithm[];
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 { 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) => {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>;
_checksumAlgorithms: import("@smithy/types").ChecksumAlgorithm[];
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
};
/**
* @deprecated use getDefaultExtensionConfiguration
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultClientConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>;
_checksumAlgorithms: import("@smithy/types").ChecksumAlgorithm[];
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
};
/**
* @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,15 @@
import { Provider, RetryStrategy, RetryStrategyConfiguration, RetryStrategyV2 } from "@smithy/types";
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,23 @@
export * from "./NoOpLogger";
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./date-utils";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./extensions";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./lazy-json";
export * from "./object-mapping";
export * from "./parse-utils";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "./split-every";
export type { DocumentType, SdkError, SmithyException } from "@smithy/types";

View File

@@ -0,0 +1,24 @@
/**
* Lazy String holder for JSON typed contents.
*/
interface StringWrapper {
new (arg: any): String;
}
/**
* Because of https://github.com/microsoft/tslib/issues/95,
* TS 'extends' shim doesn't support extending native types like String.
* So here we create StringWrapper that duplicate everything from String
* class including its prototype chain. So we can extend from here.
*
* @internal
*/
export declare const StringWrapper: StringWrapper;
/**
* @internal
*/
export declare class LazyJsonString extends StringWrapper {
deserializeJSON(): any;
toJSON(): string;
static fromObject(object: any): LazyJsonString;
}
export {};

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,270 @@
/**
* @internal
*
* Give an input string, strictly parses a boolean value.
*
* @param value - The boolean string to parse.
* @returns true for "true", false for "false", otherwise an error is thrown.
*/
export declare const parseBoolean: (value: string) => boolean;
/**
* @internal
*
* Asserts a value is a boolean and returns it.
* Casts strings and numbers with a warning if there is evidence that they were
* intended to be booleans.
*
* @param value - A value that is expected to be a boolean.
* @returns The value if it's a boolean, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectBoolean: (value: any) => boolean | undefined;
/**
* @internal
*
* Asserts a value is a number and returns it.
* Casts strings with a warning if the string is a parseable number.
* This is to unblock slight API definition/implementation inconsistencies.
*
* @param value - A value that is expected to be a number.
* @returns The value if it's a number, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectNumber: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is a 32-bit float and returns it.
*
* @param value - A value that is expected to be a 32-bit float.
* @returns The value if it's a float, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectFloat32: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is an integer and returns it.
*
* @param value - A value that is expected to be an integer.
* @returns The value if it's an integer, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectLong: (value: any) => number | undefined;
/**
* @internal
*
* @deprecated Use expectLong
*/
export declare const expectInt: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is a 32-bit integer and returns it.
*
* @param value - A value that is expected to be an integer.
* @returns The value if it's an integer, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectInt32: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is a 16-bit integer and returns it.
*
* @param value - A value that is expected to be an integer.
* @returns The value if it's an integer, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectShort: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is an 8-bit integer and returns it.
*
* @param value - A value that is expected to be an integer.
* @returns The value if it's an integer, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectByte: (value: any) => number | undefined;
/**
* @internal
*
* Asserts a value is not null or undefined and returns it, or throws an error.
*
* @param value - A value that is expected to be defined
* @param location - The location where we're expecting to find a defined object (optional)
* @returns The value if it's not undefined, otherwise throws an error
*/
export declare const expectNonNull: <T>(value: T | null | undefined, location?: string) => T;
/**
* @internal
*
* Asserts a value is an JSON-like object and returns it. This is expected to be used
* with values parsed from JSON (arrays, objects, numbers, strings, booleans).
*
* @param value - A value that is expected to be an object
* @returns The value if it's an object, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectObject: (value: any) => Record<string, any> | undefined;
/**
* @internal
*
* Asserts a value is a string and returns it.
* Numbers and boolean will be cast to strings with a warning.
*
* @param value - A value that is expected to be a string.
* @returns The value if it's a string, undefined if it's null/undefined,
* otherwise an error is thrown.
*/
export declare const expectString: (value: any) => string | undefined;
/**
* @internal
*
* Asserts a value is a JSON-like object with only one non-null/non-undefined key and
* returns it.
*
* @param value - A value that is expected to be an object with exactly one non-null,
* non-undefined key.
* @returns the value if it's a union, undefined if it's null/undefined, otherwise
* an error is thrown.
*/
export declare const expectUnion: (value: unknown) => Record<string, any> | undefined;
/**
* @internal
*
* Parses a value into a double. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by the standard
* parseFloat with one exception: NaN may only be explicitly set as the string
* "NaN", any implicit Nan values will result in an error being thrown. If any
* other type is provided, an exception will be thrown.
*
* @param value - A number or string representation of a double.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseDouble: (value: string | number) => number | undefined;
/**
* @internal
*
* @deprecated Use strictParseDouble
*/
export declare const strictParseFloat: (value: string | number) => number | undefined;
/**
* @internal
*
* Parses a value into a float. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by the standard
* parseFloat with one exception: NaN may only be explicitly set as the string
* "NaN", any implicit Nan values will result in an error being thrown. If any
* other type is provided, an exception will be thrown.
*
* @param value - A number or string representation of a float.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseFloat32: (value: string | number) => number | undefined;
/**
* @internal
*
* Asserts a value is a number and returns it. If the value is a string
* representation of a non-numeric number type (NaN, Infinity, -Infinity),
* the value will be parsed. Any other string value will result in an exception
* being thrown. Null or undefined will be returned as undefined. Any other
* type will result in an exception being thrown.
*
* @param value - A number or string representation of a non-numeric float.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const limitedParseDouble: (value: string | number) => number | undefined;
/**
* @internal
*
* @deprecated Use limitedParseDouble
*/
export declare const handleFloat: (value: string | number) => number | undefined;
/**
* @internal
*
* @deprecated Use limitedParseDouble
*/
export declare const limitedParseFloat: (value: string | number) => number | undefined;
/**
* @internal
*
* Asserts a value is a 32-bit float and returns it. If the value is a string
* representation of a non-numeric number type (NaN, Infinity, -Infinity),
* the value will be parsed. Any other string value will result in an exception
* being thrown. Null or undefined will be returned as undefined. Any other
* type will result in an exception being thrown.
*
* @param value - A number or string representation of a non-numeric float.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const limitedParseFloat32: (value: string | number) => number | undefined;
/**
* @internal
*
* Parses a value into an integer. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by parseFloat
* and the result will be asserted to be an integer. If the parsed value is not
* an integer, or the raw value is any type other than a string or number, an
* exception will be thrown.
*
* @param value - A number or string representation of an integer.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseLong: (value: string | number) => number | undefined;
/**
* @internal
*
* @deprecated Use strictParseLong
*/
export declare const strictParseInt: (value: string | number) => number | undefined;
/**
* @internal
*
* Parses a value into a 32-bit integer. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by parseFloat
* and the result will be asserted to be an integer. If the parsed value is not
* an integer, or the raw value is any type other than a string or number, an
* exception will be thrown.
*
* @param value - A number or string representation of a 32-bit integer.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseInt32: (value: string | number) => number | undefined;
/**
* @internal
*
* Parses a value into a 16-bit integer. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by parseFloat
* and the result will be asserted to be an integer. If the parsed value is not
* an integer, or the raw value is any type other than a string or number, an
* exception will be thrown.
*
* @param value - A number or string representation of a 16-bit integer.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseShort: (value: string | number) => number | undefined;
/**
* @internal
*
* Parses a value into an 8-bit integer. If the value is null or undefined, undefined
* will be returned. If the value is a string, it will be parsed by parseFloat
* and the result will be asserted to be an integer. If the parsed value is not
* an integer, or the raw value is any type other than a string or number, an
* exception will be thrown.
*
* @param value - A number or string representation of an 8-bit integer.
* @returns The value as a number, or undefined if it's null/undefined.
*/
export declare const strictParseByte: (value: string | number) => number | undefined;
/**
* @internal
*/
export declare const logger: {
warn: {
(...data: any[]): void;
(message?: any, ...optionalParams: any[]): void;
};
};

View File

@@ -0,0 +1,4 @@
/**
* @internal
*/
export declare const resolvedPath: (resolvedPath: string, input: unknown, memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean) => string;

View File

@@ -0,0 +1,9 @@
/**
* @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;

View File

@@ -0,0 +1,10 @@
/**
* @internal
*
* Maps an object through the default JSON serde behavior.
* This means removing nullish fields and un-sparsifying lists.
*
* @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 @@
/**
* @internal
*
* Given an input string, splits based on the delimiter after a given
* number of delimiters has been encountered.
*
* @param value - The input string to split.
* @param delimiter - The delimiter to split on.
* @param numDelimiters - The number of delimiters to have encountered to split.
*/
export declare function splitEvery(value: string, delimiter: string, numDelimiters: number): Array<string>;

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,32 @@
import { Client as IClient, Command, FetchHttpHandlerOptions, MetadataBearer, MiddlewareStack, NodeHttpHandlerOptions, RequestHandler } from "@smithy/types";
/**
* @public
*/
export interface SmithyConfiguration<HandlerOptions> {
requestHandler: RequestHandler<any, any, HandlerOptions> | NodeHttpHandlerOptions | FetchHttpHandlerOptions | Record<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>;
readonly apiVersion: string;
};
/**
* @public
*/
export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
readonly config: ResolvedClientConfiguration;
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,10 @@
import { SerdeContext } from "@smithy/types";
import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
/**
* @internal
*
* Collect low-level response body stream to Uint8Array.
*/
export declare const collectBody: (streamBody: any, context: {
streamCollector: SerdeContext["streamCollector"];
}) => Promise<Uint8ArrayBlobAdapter>;

View File

@@ -0,0 +1,113 @@
import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
import { Command as ICommand, Handler, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, Logger, MetadataBearer, MiddlewareStack as IMiddlewareStack, OptionalParameter, Pluggable, RequestHandler, SerdeContext } 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>;
/**
* 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;
/**
* 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>;
/**
* @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,9 @@
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,73 @@
/**
* @internal
*
* Builds a proper UTC HttpDate timestamp from a Date object
* since not all environments will have this as the expected
* format.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString}
* - Prior to ECMAScript 2018, the format of the return value
* - varied according to the platform. The most common return
* - value was an RFC-1123 formatted date stamp, which is a
* - slightly updated version of RFC-822 date stamps.
*/
export declare function dateToUtcString(date: Date): string;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 3339 date.
*
* Input strings must conform to RFC3339 section 5.6, and cannot have a UTC
* offset. Fractional precision is supported.
*
* @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc3339DateTime: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 3339 date.
*
* Input strings must conform to RFC3339 section 5.6, and can have a UTC
* offset. Fractional precision is supported.
*
* @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc3339DateTimeWithOffset: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a string that can be parsed
* as an RFC 7231 IMF-fixdate or obs-date.
*
* Input strings must conform to RFC7231 section 7.1.1.1. Fractional seconds are supported.
*
* @see {@link https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1}
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseRfc7231DateTime: (value: unknown) => Date | undefined;
/**
* @internal
*
* Parses a value into a Date. Returns undefined if the input is null or
* undefined, throws an error if the input is not a number or a parseable string.
*
* Input strings must be an integer or floating point number. Fractional seconds are supported.
*
* @param value - the value to parse
* @returns a Date or undefined
*/
export declare const parseEpochTimestamp: (value: unknown) => Date | undefined;

View File

@@ -0,0 +1,13 @@
/**
* 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,34 @@
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);
}
/**
* 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,7 @@
/**
* @internal
*
* Function that wraps encodeURIComponent to encode additional characters
* to fully adhere to RFC 3986.
*/
export declare function extendedEncodeURIComponent(str: string): string;

View File

@@ -0,0 +1,25 @@
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) => {
_checksumAlgorithms: ChecksumAlgorithm[];
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) => {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>;
_checksumAlgorithms: import("@smithy/types").ChecksumAlgorithm[];
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
};
/**
* @deprecated use getDefaultExtensionConfiguration
* @internal
*
* Helper function to resolve default extension configuration from runtime config
*/
export declare const getDefaultClientConfiguration: (runtimeConfig: DefaultExtensionRuntimeConfigType) => {
setRetryStrategy(retryStrategy: import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>): void;
retryStrategy(): import("@smithy/types").Provider<import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2>;
_checksumAlgorithms: import("@smithy/types").ChecksumAlgorithm[];
addChecksumAlgorithm(algo: import("@smithy/types").ChecksumAlgorithm): void;
checksumAlgorithms(): import("@smithy/types").ChecksumAlgorithm[];
};
/**
* @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,15 @@
import { Provider, RetryStrategy, RetryStrategyConfiguration, RetryStrategyV2 } from "@smithy/types";
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,23 @@
export * from "./NoOpLogger";
export * from "./client";
export * from "./collect-stream-body";
export * from "./command";
export * from "./constants";
export * from "./create-aggregated-client";
export * from "./date-utils";
export * from "./default-error-handler";
export * from "./defaults-mode";
export * from "./emitWarningIfUnsupportedVersion";
export * from "./extensions";
export * from "./exceptions";
export * from "./extended-encode-uri-component";
export * from "./get-array-if-single-item";
export * from "./get-value-from-text-node";
export * from "./lazy-json";
export * from "./object-mapping";
export * from "./parse-utils";
export * from "./resolve-path";
export * from "./ser-utils";
export * from "./serde-json";
export * from "./split-every";
export { DocumentType, SdkError, SmithyException } from "@smithy/types";

View File

@@ -0,0 +1,24 @@
/**
* Lazy String holder for JSON typed contents.
*/
interface StringWrapper {
new (arg: any): String;
}
/**
* Because of https://github.com/microsoft/tslib/issues/95,
* TS 'extends' shim doesn't support extending native types like String.
* So here we create StringWrapper that duplicate everything from String
* class including its prototype chain. So we can extend from here.
*
* @internal
*/
export declare const StringWrapper: StringWrapper;
/**
* @internal
*/
export declare class LazyJsonString extends StringWrapper {
deserializeJSON(): any;
toJSON(): string;
static fromObject(object: any): LazyJsonString;
}
export {};

Some files were not shown because too many files have changed in this diff Show More