include node_modules so release .zip is deployable
This commit is contained in:
+201
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# @smithy/smithy-client
|
||||
|
||||
[](https://www.npmjs.com/package/@smithy/smithy-client)
|
||||
[](https://www.npmjs.com/package/@smithy/smithy-client)
|
||||
|
||||
> An internal package
|
||||
|
||||
## Usage
|
||||
|
||||
You probably shouldn't, at least directly.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NoOpLogger = void 0;
|
||||
class NoOpLogger {
|
||||
trace() { }
|
||||
debug() { }
|
||||
info() { }
|
||||
warn() { }
|
||||
error() { }
|
||||
}
|
||||
exports.NoOpLogger = NoOpLogger;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Client = void 0;
|
||||
const middleware_stack_1 = require("@smithy/middleware-stack");
|
||||
class Client {
|
||||
constructor(config) {
|
||||
this.middlewareStack = (0, middleware_stack_1.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();
|
||||
}
|
||||
}
|
||||
exports.Client = Client;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.collectBody = void 0;
|
||||
const util_stream_1 = require("@smithy/util-stream");
|
||||
const collectBody = async (streamBody = new Uint8Array(), context) => {
|
||||
if (streamBody instanceof Uint8Array) {
|
||||
return util_stream_1.Uint8ArrayBlobAdapter.mutate(streamBody);
|
||||
}
|
||||
if (!streamBody) {
|
||||
return util_stream_1.Uint8ArrayBlobAdapter.mutate(new Uint8Array());
|
||||
}
|
||||
const fromContext = context.streamCollector(streamBody);
|
||||
return util_stream_1.Uint8ArrayBlobAdapter.mutate(await fromContext);
|
||||
};
|
||||
exports.collectBody = collectBody;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Command = void 0;
|
||||
const middleware_stack_1 = require("@smithy/middleware-stack");
|
||||
class Command {
|
||||
constructor() {
|
||||
this.middlewareStack = (0, middleware_stack_1.constructStack)();
|
||||
}
|
||||
}
|
||||
exports.Command = Command;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SENSITIVE_STRING = void 0;
|
||||
exports.SENSITIVE_STRING = "***SensitiveInformation***";
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createAggregatedClient = void 0;
|
||||
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;
|
||||
}
|
||||
};
|
||||
exports.createAggregatedClient = createAggregatedClient;
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseEpochTimestamp = exports.parseRfc7231DateTime = exports.parseRfc3339DateTimeWithOffset = exports.parseRfc3339DateTime = exports.dateToUtcString = void 0;
|
||||
const parse_utils_1 = require("./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"];
|
||||
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`;
|
||||
}
|
||||
exports.dateToUtcString = dateToUtcString;
|
||||
const RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
|
||||
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 = (0, parse_utils_1.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 });
|
||||
};
|
||||
exports.parseRfc3339DateTime = parseRfc3339DateTime;
|
||||
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])$/);
|
||||
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 = (0, parse_utils_1.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;
|
||||
};
|
||||
exports.parseRfc3339DateTimeWithOffset = parseRfc3339DateTimeWithOffset;
|
||||
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})$/);
|
||||
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((0, parse_utils_1.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((0, parse_utils_1.strictParseShort)(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
|
||||
}
|
||||
throw new TypeError("Invalid RFC-7231 date-time value");
|
||||
};
|
||||
exports.parseRfc7231DateTime = parseRfc7231DateTime;
|
||||
const parseEpochTimestamp = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
let valueAsDouble;
|
||||
if (typeof value === "number") {
|
||||
valueAsDouble = value;
|
||||
}
|
||||
else if (typeof value === "string") {
|
||||
valueAsDouble = (0, parse_utils_1.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));
|
||||
};
|
||||
exports.parseEpochTimestamp = parseEpochTimestamp;
|
||||
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 + (0, parse_utils_1.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 = (0, parse_utils_1.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 (0, parse_utils_1.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);
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.withBaseException = exports.throwDefaultError = void 0;
|
||||
const exceptions_1 = require("./exceptions");
|
||||
const throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => {
|
||||
const $metadata = deserializeMetadata(output);
|
||||
const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
|
||||
const response = new exceptionCtor({
|
||||
name: (parsedBody === null || parsedBody === void 0 ? void 0 : parsedBody.code) || (parsedBody === null || parsedBody === void 0 ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError",
|
||||
$fault: "client",
|
||||
$metadata,
|
||||
});
|
||||
throw (0, exceptions_1.decorateServiceException)(response, parsedBody);
|
||||
};
|
||||
exports.throwDefaultError = throwDefaultError;
|
||||
const withBaseException = (ExceptionCtor) => {
|
||||
return ({ output, parsedBody, errorCode }) => {
|
||||
(0, exports.throwDefaultError)({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode });
|
||||
};
|
||||
};
|
||||
exports.withBaseException = withBaseException;
|
||||
const deserializeMetadata = (output) => {
|
||||
var _a, _b;
|
||||
return ({
|
||||
httpStatusCode: output.statusCode,
|
||||
requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
|
||||
extendedRequestId: output.headers["x-amz-id-2"],
|
||||
cfId: output.headers["x-amz-cf-id"],
|
||||
});
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.loadConfigsForDefaultMode = void 0;
|
||||
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 {};
|
||||
}
|
||||
};
|
||||
exports.loadConfigsForDefaultMode = loadConfigsForDefaultMode;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.emitWarningIfUnsupportedVersion = void 0;
|
||||
let warningEmitted = false;
|
||||
const emitWarningIfUnsupportedVersion = (version) => {
|
||||
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 14) {
|
||||
warningEmitted = true;
|
||||
}
|
||||
};
|
||||
exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decorateServiceException = exports.ServiceException = void 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
exports.ServiceException = ServiceException;
|
||||
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;
|
||||
};
|
||||
exports.decorateServiceException = decorateServiceException;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extendedEncodeURIComponent = void 0;
|
||||
function extendedEncodeURIComponent(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
exports.extendedEncodeURIComponent = extendedEncodeURIComponent;
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveChecksumRuntimeConfig = exports.getChecksumConfiguration = exports.AlgorithmId = void 0;
|
||||
const types_1 = require("@smithy/types");
|
||||
Object.defineProperty(exports, "AlgorithmId", { enumerable: true, get: function () { return types_1.AlgorithmId; } });
|
||||
const getChecksumConfiguration = (runtimeConfig) => {
|
||||
const checksumAlgorithms = [];
|
||||
for (const id in types_1.AlgorithmId) {
|
||||
const algorithmId = types_1.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;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.getChecksumConfiguration = getChecksumConfiguration;
|
||||
const resolveChecksumRuntimeConfig = (clientConfig) => {
|
||||
const runtimeConfig = {};
|
||||
clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
|
||||
runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
|
||||
});
|
||||
return runtimeConfig;
|
||||
};
|
||||
exports.resolveChecksumRuntimeConfig = resolveChecksumRuntimeConfig;
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveDefaultRuntimeConfig = exports.getDefaultClientConfiguration = exports.getDefaultExtensionConfiguration = void 0;
|
||||
const checksum_1 = require("./checksum");
|
||||
const retry_1 = require("./retry");
|
||||
const getDefaultExtensionConfiguration = (runtimeConfig) => {
|
||||
return {
|
||||
...(0, checksum_1.getChecksumConfiguration)(runtimeConfig),
|
||||
...(0, retry_1.getRetryConfiguration)(runtimeConfig),
|
||||
};
|
||||
};
|
||||
exports.getDefaultExtensionConfiguration = getDefaultExtensionConfiguration;
|
||||
exports.getDefaultClientConfiguration = exports.getDefaultExtensionConfiguration;
|
||||
const resolveDefaultRuntimeConfig = (config) => {
|
||||
return {
|
||||
...(0, checksum_1.resolveChecksumRuntimeConfig)(config),
|
||||
...(0, retry_1.resolveRetryRuntimeConfig)(config),
|
||||
};
|
||||
};
|
||||
exports.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./defaultExtensionConfiguration"), exports);
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveRetryRuntimeConfig = exports.getRetryConfiguration = void 0;
|
||||
const getRetryConfiguration = (runtimeConfig) => {
|
||||
let _retryStrategy = runtimeConfig.retryStrategy;
|
||||
return {
|
||||
setRetryStrategy(retryStrategy) {
|
||||
_retryStrategy = retryStrategy;
|
||||
},
|
||||
retryStrategy() {
|
||||
return _retryStrategy;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.getRetryConfiguration = getRetryConfiguration;
|
||||
const resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
|
||||
const runtimeConfig = {};
|
||||
runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
|
||||
return runtimeConfig;
|
||||
};
|
||||
exports.resolveRetryRuntimeConfig = resolveRetryRuntimeConfig;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getArrayIfSingleItem = void 0;
|
||||
const getArrayIfSingleItem = (mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray];
|
||||
exports.getArrayIfSingleItem = getArrayIfSingleItem;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getValueFromTextNode = void 0;
|
||||
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] = (0, exports.getValueFromTextNode)(obj[key]);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
exports.getValueFromTextNode = getValueFromTextNode;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./NoOpLogger"), exports);
|
||||
tslib_1.__exportStar(require("./client"), exports);
|
||||
tslib_1.__exportStar(require("./collect-stream-body"), exports);
|
||||
tslib_1.__exportStar(require("./command"), exports);
|
||||
tslib_1.__exportStar(require("./constants"), exports);
|
||||
tslib_1.__exportStar(require("./create-aggregated-client"), exports);
|
||||
tslib_1.__exportStar(require("./date-utils"), exports);
|
||||
tslib_1.__exportStar(require("./default-error-handler"), exports);
|
||||
tslib_1.__exportStar(require("./defaults-mode"), exports);
|
||||
tslib_1.__exportStar(require("./emitWarningIfUnsupportedVersion"), exports);
|
||||
tslib_1.__exportStar(require("./extensions"), exports);
|
||||
tslib_1.__exportStar(require("./exceptions"), exports);
|
||||
tslib_1.__exportStar(require("./extended-encode-uri-component"), exports);
|
||||
tslib_1.__exportStar(require("./get-array-if-single-item"), exports);
|
||||
tslib_1.__exportStar(require("./get-value-from-text-node"), exports);
|
||||
tslib_1.__exportStar(require("./lazy-json"), exports);
|
||||
tslib_1.__exportStar(require("./object-mapping"), exports);
|
||||
tslib_1.__exportStar(require("./parse-utils"), exports);
|
||||
tslib_1.__exportStar(require("./resolve-path"), exports);
|
||||
tslib_1.__exportStar(require("./ser-utils"), exports);
|
||||
tslib_1.__exportStar(require("./serde-json"), exports);
|
||||
tslib_1.__exportStar(require("./split-every"), exports);
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LazyJsonString = exports.StringWrapper = void 0;
|
||||
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;
|
||||
};
|
||||
exports.StringWrapper = StringWrapper;
|
||||
exports.StringWrapper.prototype = Object.create(String.prototype, {
|
||||
constructor: {
|
||||
value: exports.StringWrapper,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
},
|
||||
});
|
||||
Object.setPrototypeOf(exports.StringWrapper, String);
|
||||
class LazyJsonString extends exports.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));
|
||||
}
|
||||
}
|
||||
exports.LazyJsonString = LazyJsonString;
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.take = exports.convertMap = exports.map = void 0;
|
||||
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;
|
||||
}
|
||||
exports.map = map;
|
||||
const convertMap = (target) => {
|
||||
const output = {};
|
||||
for (const [k, v] of Object.entries(target || {})) {
|
||||
output[k] = [, v];
|
||||
}
|
||||
return output;
|
||||
};
|
||||
exports.convertMap = convertMap;
|
||||
const take = (source, instructions) => {
|
||||
const out = {};
|
||||
for (const key in instructions) {
|
||||
applyInstruction(out, source, instructions, key);
|
||||
}
|
||||
return out;
|
||||
};
|
||||
exports.take = take;
|
||||
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 = (_) => _;
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logger = exports.strictParseByte = exports.strictParseShort = exports.strictParseInt32 = exports.strictParseInt = exports.strictParseLong = exports.limitedParseFloat32 = exports.limitedParseFloat = exports.handleFloat = exports.limitedParseDouble = exports.strictParseFloat32 = exports.strictParseFloat = exports.strictParseDouble = exports.expectUnion = exports.expectString = exports.expectObject = exports.expectNonNull = exports.expectByte = exports.expectShort = exports.expectInt32 = exports.expectInt = exports.expectLong = exports.expectFloat32 = exports.expectNumber = exports.expectBoolean = exports.parseBoolean = void 0;
|
||||
const parseBoolean = (value) => {
|
||||
switch (value) {
|
||||
case "true":
|
||||
return true;
|
||||
case "false":
|
||||
return false;
|
||||
default:
|
||||
throw new Error(`Unable to parse boolean value "${value}"`);
|
||||
}
|
||||
};
|
||||
exports.parseBoolean = parseBoolean;
|
||||
const expectBoolean = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "number") {
|
||||
if (value === 0 || value === 1) {
|
||||
exports.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") {
|
||||
exports.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}`);
|
||||
};
|
||||
exports.expectBoolean = expectBoolean;
|
||||
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)) {
|
||||
exports.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}`);
|
||||
};
|
||||
exports.expectNumber = expectNumber;
|
||||
const MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
||||
const expectFloat32 = (value) => {
|
||||
const expected = (0, exports.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;
|
||||
};
|
||||
exports.expectFloat32 = expectFloat32;
|
||||
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}`);
|
||||
};
|
||||
exports.expectLong = expectLong;
|
||||
exports.expectInt = exports.expectLong;
|
||||
const expectInt32 = (value) => expectSizedInt(value, 32);
|
||||
exports.expectInt32 = expectInt32;
|
||||
const expectShort = (value) => expectSizedInt(value, 16);
|
||||
exports.expectShort = expectShort;
|
||||
const expectByte = (value) => expectSizedInt(value, 8);
|
||||
exports.expectByte = expectByte;
|
||||
const expectSizedInt = (value, size) => {
|
||||
const expected = (0, exports.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];
|
||||
}
|
||||
};
|
||||
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;
|
||||
};
|
||||
exports.expectNonNull = expectNonNull;
|
||||
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}`);
|
||||
};
|
||||
exports.expectObject = expectObject;
|
||||
const expectString = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
if (["boolean", "number", "bigint"].includes(typeof value)) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
|
||||
return String(value);
|
||||
}
|
||||
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectString = expectString;
|
||||
const expectUnion = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const asObject = (0, exports.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;
|
||||
};
|
||||
exports.expectUnion = expectUnion;
|
||||
const strictParseDouble = (value) => {
|
||||
if (typeof value == "string") {
|
||||
return (0, exports.expectNumber)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectNumber)(value);
|
||||
};
|
||||
exports.strictParseDouble = strictParseDouble;
|
||||
exports.strictParseFloat = exports.strictParseDouble;
|
||||
const strictParseFloat32 = (value) => {
|
||||
if (typeof value == "string") {
|
||||
return (0, exports.expectFloat32)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectFloat32)(value);
|
||||
};
|
||||
exports.strictParseFloat32 = strictParseFloat32;
|
||||
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);
|
||||
};
|
||||
const limitedParseDouble = (value) => {
|
||||
if (typeof value == "string") {
|
||||
return parseFloatString(value);
|
||||
}
|
||||
return (0, exports.expectNumber)(value);
|
||||
};
|
||||
exports.limitedParseDouble = limitedParseDouble;
|
||||
exports.handleFloat = exports.limitedParseDouble;
|
||||
exports.limitedParseFloat = exports.limitedParseDouble;
|
||||
const limitedParseFloat32 = (value) => {
|
||||
if (typeof value == "string") {
|
||||
return parseFloatString(value);
|
||||
}
|
||||
return (0, exports.expectFloat32)(value);
|
||||
};
|
||||
exports.limitedParseFloat32 = limitedParseFloat32;
|
||||
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}`);
|
||||
}
|
||||
};
|
||||
const strictParseLong = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return (0, exports.expectLong)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectLong)(value);
|
||||
};
|
||||
exports.strictParseLong = strictParseLong;
|
||||
exports.strictParseInt = exports.strictParseLong;
|
||||
const strictParseInt32 = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return (0, exports.expectInt32)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectInt32)(value);
|
||||
};
|
||||
exports.strictParseInt32 = strictParseInt32;
|
||||
const strictParseShort = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return (0, exports.expectShort)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectShort)(value);
|
||||
};
|
||||
exports.strictParseShort = strictParseShort;
|
||||
const strictParseByte = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return (0, exports.expectByte)(parseNumber(value));
|
||||
}
|
||||
return (0, exports.expectByte)(value);
|
||||
};
|
||||
exports.strictParseByte = strictParseByte;
|
||||
const stackTraceWarning = (message) => {
|
||||
return String(new TypeError(message).stack || message)
|
||||
.split("\n")
|
||||
.slice(0, 5)
|
||||
.filter((s) => !s.includes("stackTraceWarning"))
|
||||
.join("\n");
|
||||
};
|
||||
exports.logger = {
|
||||
warn: console.warn,
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolvedPath = void 0;
|
||||
const extended_encode_uri_component_1 = require("./extended-encode-uri-component");
|
||||
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) => (0, extended_encode_uri_component_1.extendedEncodeURIComponent)(segment))
|
||||
.join("/")
|
||||
: (0, extended_encode_uri_component_1.extendedEncodeURIComponent)(labelValue));
|
||||
}
|
||||
else {
|
||||
throw new Error("No value provided for input HTTP label: " + memberName + ".");
|
||||
}
|
||||
return resolvedPath;
|
||||
};
|
||||
exports.resolvedPath = resolvedPath;
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.serializeFloat = void 0;
|
||||
const serializeFloat = (value) => {
|
||||
if (value !== value) {
|
||||
return "NaN";
|
||||
}
|
||||
switch (value) {
|
||||
case Infinity:
|
||||
return "Infinity";
|
||||
case -Infinity:
|
||||
return "-Infinity";
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
};
|
||||
exports.serializeFloat = serializeFloat;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports._json = void 0;
|
||||
const _json = (obj) => {
|
||||
if (obj == null) {
|
||||
return {};
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.filter((_) => _ != null);
|
||||
}
|
||||
if (typeof obj === "object") {
|
||||
const target = {};
|
||||
for (const key of Object.keys(obj)) {
|
||||
if (obj[key] == null) {
|
||||
continue;
|
||||
}
|
||||
target[key] = (0, exports._json)(obj[key]);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
exports._json = _json;
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.splitEvery = void 0;
|
||||
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;
|
||||
}
|
||||
exports.splitEvery = splitEvery;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
export class NoOpLogger {
|
||||
trace() { }
|
||||
debug() { }
|
||||
info() { }
|
||||
warn() { }
|
||||
error() { }
|
||||
}
|
||||
+24
@@ -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();
|
||||
}
|
||||
}
|
||||
+11
@@ -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);
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { constructStack } from "@smithy/middleware-stack";
|
||||
export class Command {
|
||||
constructor() {
|
||||
this.middlewareStack = constructStack();
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export const SENSITIVE_STRING = "***SensitiveInformation***";
|
||||
+21
@@ -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;
|
||||
}
|
||||
};
|
||||
+187
@@ -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);
|
||||
};
|
||||
+22
@@ -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"],
|
||||
});
|
||||
+26
@@ -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 {};
|
||||
}
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
let warningEmitted = false;
|
||||
export const emitWarningIfUnsupportedVersion = (version) => {
|
||||
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 14) {
|
||||
warningEmitted = true;
|
||||
}
|
||||
};
|
||||
+22
@@ -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;
|
||||
};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
export function extendedEncodeURIComponent(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
+31
@@ -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;
|
||||
};
|
||||
Generated
Vendored
+15
@@ -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),
|
||||
};
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export * from "./defaultExtensionConfiguration";
|
||||
+16
@@ -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;
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export const getArrayIfSingleItem = (mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray];
|
||||
+12
@@ -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;
|
||||
};
|
||||
+22
@@ -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";
|
||||
+33
@@ -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));
|
||||
}
|
||||
}
|
||||
+92
@@ -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 = (_) => _;
|
||||
+230
@@ -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,
|
||||
};
|
||||
+19
@@ -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;
|
||||
};
|
||||
+13
@@ -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;
|
||||
}
|
||||
};
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
export const _json = (obj) => {
|
||||
if (obj == null) {
|
||||
return {};
|
||||
}
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.filter((_) => _ != null);
|
||||
}
|
||||
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;
|
||||
};
|
||||
+27
@@ -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;
|
||||
}
|
||||
+11
@@ -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;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { Client as IClient, Command, MetadataBearer, MiddlewareStack, RequestHandler } from "@smithy/types";
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SmithyConfiguration<HandlerOptions> {
|
||||
requestHandler: RequestHandler<any, any, HandlerOptions>;
|
||||
/**
|
||||
* 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> = SmithyConfiguration<HandlerOptions>;
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
+10
@@ -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>;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { Command as ICommand, Handler, MetadataBearer, MiddlewareStack as IMiddlewareStack } 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>;
|
||||
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const SENSITIVE_STRING = "***SensitiveInformation***";
|
||||
+9
@@ -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;
|
||||
+73
@@ -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;
|
||||
+13
@@ -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;
|
||||
+28
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+8
@@ -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;
|
||||
+34
@@ -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;
|
||||
+7
@@ -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;
|
||||
+25
@@ -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;
|
||||
Generated
Vendored
+38
@@ -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;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export * from "./defaultExtensionConfiguration";
|
||||
+15
@@ -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;
|
||||
+7
@@ -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[];
|
||||
+7
@@ -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;
|
||||
+23
@@ -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";
|
||||
+24
@@ -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 {};
|
||||
+162
@@ -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;
|
||||
+270
@@ -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;
|
||||
};
|
||||
};
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const resolvedPath: (resolvedPath: string, input: unknown, memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean) => string;
|
||||
+9
@@ -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;
|
||||
+10
@@ -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;
|
||||
+11
@@ -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>;
|
||||
+11
@@ -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;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { Client as IClient, Command, MetadataBearer, MiddlewareStack, RequestHandler } from "@smithy/types";
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SmithyConfiguration<HandlerOptions> {
|
||||
requestHandler: RequestHandler<any, any, HandlerOptions>;
|
||||
/**
|
||||
* 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> = SmithyConfiguration<HandlerOptions>;
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
+10
@@ -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>;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { Command as ICommand, Handler, MetadataBearer, MiddlewareStack as IMiddlewareStack } 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>;
|
||||
abstract resolveMiddleware(stack: IMiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedClientConfiguration, options: any): Handler<Input, Output>;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const SENSITIVE_STRING = "***SensitiveInformation***";
|
||||
Generated
Vendored
+9
@@ -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;
|
||||
+73
@@ -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;
|
||||
+13
@@ -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;
|
||||
+28
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+8
@@ -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;
|
||||
+34
@@ -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;
|
||||
Generated
Vendored
+7
@@ -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;
|
||||
+25
@@ -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;
|
||||
Generated
Vendored
+38
@@ -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;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export * from "./defaultExtensionConfiguration";
|
||||
+15
@@ -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;
|
||||
Generated
Vendored
+7
@@ -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[];
|
||||
Generated
Vendored
+7
@@ -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;
|
||||
+23
@@ -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";
|
||||
+24
@@ -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
Reference in New Issue
Block a user