nowbackup 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +392 -0
- package/dist/bin.cjs +36571 -0
- package/dist/bin.js +53 -0
- package/dist/chunk-57ZU5VQ4.js +2994 -0
- package/dist/chunk-6QIWSQ6Y.js +574 -0
- package/dist/chunk-APZ4HNNC.js +1428 -0
- package/dist/chunk-BBB75FHV.js +11988 -0
- package/dist/chunk-FLLLYAHH.js +13 -0
- package/dist/chunk-KKIIHNPF.js +440 -0
- package/dist/chunk-LZQGIK32.js +1388 -0
- package/dist/chunk-SSPSJLWK.js +140 -0
- package/dist/chunk-T7W5F6M2.js +47 -0
- package/dist/chunk-V5IHRGZ2.js +12 -0
- package/dist/chunk-YMVDJI7O.js +3578 -0
- package/dist/chunk-ZHQB65KV.js +4726 -0
- package/dist/dist-es-3KJE4GI3.js +377 -0
- package/dist/dist-es-C4NCVBOK.js +21 -0
- package/dist/dist-es-FJYDFRNF.js +493 -0
- package/dist/dist-es-GOKCIKU2.js +319 -0
- package/dist/dist-es-GYBVDBEN.js +70 -0
- package/dist/dist-es-NQIG67M4.js +164 -0
- package/dist/dist-es-TJCQA2TA.js +89 -0
- package/dist/event-streams-CYRJEQX4.js +41 -0
- package/dist/index.cjs +36537 -0
- package/dist/index.js +15 -0
- package/dist/loadSso-S6XBGQED.js +548 -0
- package/dist/signin-YKKM2Q24.js +643 -0
- package/dist/sso-oidc-YLLTNKNX.js +783 -0
- package/dist/sts-WXTYIV32.js +1387 -0
- package/package.json +64 -0
|
@@ -0,0 +1,1428 @@
|
|
|
1
|
+
// ../../node_modules/tsup/assets/esm_shims.js
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
5
|
+
var getDirname = () => path.dirname(getFilename());
|
|
6
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/is-array-buffer/is-array-buffer.js
|
|
9
|
+
var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-buffer-from/buffer-from.js
|
|
12
|
+
var fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => {
|
|
13
|
+
if (!isArrayBuffer(input)) {
|
|
14
|
+
throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
|
|
15
|
+
}
|
|
16
|
+
return Buffer.from(input, offset, length);
|
|
17
|
+
};
|
|
18
|
+
var fromString = (input, encoding) => {
|
|
19
|
+
if (typeof input !== "string") {
|
|
20
|
+
throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
|
|
21
|
+
}
|
|
22
|
+
return encoding ? Buffer.from(input, encoding) : Buffer.from(input);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/fromUtf8.js
|
|
26
|
+
var fromUtf8 = (input) => {
|
|
27
|
+
const buf = fromString(input, "utf8");
|
|
28
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUtf8.js
|
|
32
|
+
var toUtf8 = (input) => {
|
|
33
|
+
if (typeof input === "string") {
|
|
34
|
+
return input;
|
|
35
|
+
}
|
|
36
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
37
|
+
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
|
|
38
|
+
}
|
|
39
|
+
return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-hex-encoding/hex-encoding.js
|
|
43
|
+
var SHORT_TO_HEX = {};
|
|
44
|
+
var HEX_TO_SHORT = {};
|
|
45
|
+
for (let i = 0; i < 256; i++) {
|
|
46
|
+
let encodedByte = i.toString(16).toLowerCase();
|
|
47
|
+
if (encodedByte.length === 1) {
|
|
48
|
+
encodedByte = `0${encodedByte}`;
|
|
49
|
+
}
|
|
50
|
+
SHORT_TO_HEX[i] = encodedByte;
|
|
51
|
+
HEX_TO_SHORT[encodedByte] = i;
|
|
52
|
+
}
|
|
53
|
+
function fromHex(encoded) {
|
|
54
|
+
if (encoded.length % 2 !== 0) {
|
|
55
|
+
throw new Error("Hex encoded strings must have an even number length");
|
|
56
|
+
}
|
|
57
|
+
const out = new Uint8Array(encoded.length / 2);
|
|
58
|
+
for (let i = 0; i < encoded.length; i += 2) {
|
|
59
|
+
const encodedByte = encoded.slice(i, i + 2).toLowerCase();
|
|
60
|
+
if (encodedByte in HEX_TO_SHORT) {
|
|
61
|
+
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
62
|
+
} else {
|
|
63
|
+
throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
function toHex(bytes) {
|
|
69
|
+
let out = "";
|
|
70
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
71
|
+
out += SHORT_TO_HEX[bytes[i]];
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/index.js
|
|
77
|
+
import { getRandomValues } from "crypto";
|
|
78
|
+
|
|
79
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.js
|
|
80
|
+
var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
81
|
+
var fromBase64 = (input) => {
|
|
82
|
+
if (input.length * 3 % 4 !== 0) {
|
|
83
|
+
throw new TypeError(`Incorrect padding on base64 string.`);
|
|
84
|
+
}
|
|
85
|
+
if (!BASE64_REGEX.exec(input)) {
|
|
86
|
+
throw new TypeError(`Invalid base64 string.`);
|
|
87
|
+
}
|
|
88
|
+
const buffer = fromString(input, "base64");
|
|
89
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/toBase64.js
|
|
93
|
+
var toBase64 = (_input) => {
|
|
94
|
+
let input;
|
|
95
|
+
if (typeof _input === "string") {
|
|
96
|
+
input = fromUtf8(_input);
|
|
97
|
+
} else {
|
|
98
|
+
input = _input;
|
|
99
|
+
}
|
|
100
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
101
|
+
throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
|
|
102
|
+
}
|
|
103
|
+
return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("base64");
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/blob/Uint8ArrayBlobAdapter.js
|
|
107
|
+
function bindUint8ArrayBlobAdapter(toUtf83, fromUtf83, toBase643, fromBase643) {
|
|
108
|
+
return class Uint8ArrayBlobAdapter2 extends Uint8Array {
|
|
109
|
+
static fromString(source, encoding = "utf-8") {
|
|
110
|
+
if (typeof source === "string") {
|
|
111
|
+
if (encoding === "base64") {
|
|
112
|
+
return Uint8ArrayBlobAdapter2.mutate(fromBase643(source));
|
|
113
|
+
}
|
|
114
|
+
return Uint8ArrayBlobAdapter2.mutate(fromUtf83(source));
|
|
115
|
+
}
|
|
116
|
+
throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
|
|
117
|
+
}
|
|
118
|
+
static mutate(source) {
|
|
119
|
+
Object.setPrototypeOf(source, Uint8ArrayBlobAdapter2.prototype);
|
|
120
|
+
return source;
|
|
121
|
+
}
|
|
122
|
+
transformToString(encoding = "utf-8") {
|
|
123
|
+
if (encoding === "base64") {
|
|
124
|
+
return toBase643(this);
|
|
125
|
+
}
|
|
126
|
+
return toUtf83(this);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/uuid/v4.js
|
|
132
|
+
var decimalToHex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
133
|
+
function bindV4(getRandomValues2) {
|
|
134
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
135
|
+
return () => crypto.randomUUID();
|
|
136
|
+
}
|
|
137
|
+
return () => {
|
|
138
|
+
const rnds = new Uint8Array(16);
|
|
139
|
+
getRandomValues2(rnds);
|
|
140
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
141
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
142
|
+
return decimalToHex[rnds[0]] + decimalToHex[rnds[1]] + decimalToHex[rnds[2]] + decimalToHex[rnds[3]] + "-" + decimalToHex[rnds[4]] + decimalToHex[rnds[5]] + "-" + decimalToHex[rnds[6]] + decimalToHex[rnds[7]] + "-" + decimalToHex[rnds[8]] + decimalToHex[rnds[9]] + "-" + decimalToHex[rnds[10]] + decimalToHex[rnds[11]] + decimalToHex[rnds[12]] + decimalToHex[rnds[13]] + decimalToHex[rnds[14]] + decimalToHex[rnds[15]];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js
|
|
147
|
+
var expectNumber = (value) => {
|
|
148
|
+
if (value === null || value === void 0) {
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
if (typeof value === "string") {
|
|
152
|
+
const parsed = parseFloat(value);
|
|
153
|
+
if (!Number.isNaN(parsed)) {
|
|
154
|
+
if (String(parsed) !== String(value)) {
|
|
155
|
+
logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
|
156
|
+
}
|
|
157
|
+
return parsed;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (typeof value === "number") {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
|
|
164
|
+
};
|
|
165
|
+
var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
|
166
|
+
var expectFloat32 = (value) => {
|
|
167
|
+
const expected = expectNumber(value);
|
|
168
|
+
if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
|
|
169
|
+
if (Math.abs(expected) > MAX_FLOAT) {
|
|
170
|
+
throw new TypeError(`Expected 32-bit float, got ${value}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return expected;
|
|
174
|
+
};
|
|
175
|
+
var expectLong = (value) => {
|
|
176
|
+
if (value === null || value === void 0) {
|
|
177
|
+
return void 0;
|
|
178
|
+
}
|
|
179
|
+
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
|
|
183
|
+
};
|
|
184
|
+
var expectShort = (value) => expectSizedInt(value, 16);
|
|
185
|
+
var expectByte = (value) => expectSizedInt(value, 8);
|
|
186
|
+
var expectSizedInt = (value, size) => {
|
|
187
|
+
const expected = expectLong(value);
|
|
188
|
+
if (expected !== void 0 && castInt(expected, size) !== expected) {
|
|
189
|
+
throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
|
|
190
|
+
}
|
|
191
|
+
return expected;
|
|
192
|
+
};
|
|
193
|
+
var castInt = (value, size) => {
|
|
194
|
+
switch (size) {
|
|
195
|
+
case 32:
|
|
196
|
+
return Int32Array.of(value)[0];
|
|
197
|
+
case 16:
|
|
198
|
+
return Int16Array.of(value)[0];
|
|
199
|
+
case 8:
|
|
200
|
+
return Int8Array.of(value)[0];
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var strictParseDouble = (value) => {
|
|
204
|
+
if (typeof value == "string") {
|
|
205
|
+
return expectNumber(parseNumber(value));
|
|
206
|
+
}
|
|
207
|
+
return expectNumber(value);
|
|
208
|
+
};
|
|
209
|
+
var strictParseFloat32 = (value) => {
|
|
210
|
+
if (typeof value == "string") {
|
|
211
|
+
return expectFloat32(parseNumber(value));
|
|
212
|
+
}
|
|
213
|
+
return expectFloat32(value);
|
|
214
|
+
};
|
|
215
|
+
var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
|
|
216
|
+
var parseNumber = (value) => {
|
|
217
|
+
const matches = value.match(NUMBER_REGEX);
|
|
218
|
+
if (matches === null || matches[0].length !== value.length) {
|
|
219
|
+
throw new TypeError(`Expected real number, got implicit NaN`);
|
|
220
|
+
}
|
|
221
|
+
return parseFloat(value);
|
|
222
|
+
};
|
|
223
|
+
var strictParseShort = (value) => {
|
|
224
|
+
if (typeof value === "string") {
|
|
225
|
+
return expectShort(parseNumber(value));
|
|
226
|
+
}
|
|
227
|
+
return expectShort(value);
|
|
228
|
+
};
|
|
229
|
+
var strictParseByte = (value) => {
|
|
230
|
+
if (typeof value === "string") {
|
|
231
|
+
return expectByte(parseNumber(value));
|
|
232
|
+
}
|
|
233
|
+
return expectByte(value);
|
|
234
|
+
};
|
|
235
|
+
var stackTraceWarning = (message) => {
|
|
236
|
+
return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n");
|
|
237
|
+
};
|
|
238
|
+
var logger = {
|
|
239
|
+
warn: console.warn
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/date-utils.js
|
|
243
|
+
var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
244
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
245
|
+
function dateToUtcString(date2) {
|
|
246
|
+
const year2 = date2.getUTCFullYear();
|
|
247
|
+
const month = date2.getUTCMonth();
|
|
248
|
+
const dayOfWeek = date2.getUTCDay();
|
|
249
|
+
const dayOfMonthInt = date2.getUTCDate();
|
|
250
|
+
const hoursInt = date2.getUTCHours();
|
|
251
|
+
const minutesInt = date2.getUTCMinutes();
|
|
252
|
+
const secondsInt = date2.getUTCSeconds();
|
|
253
|
+
const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`;
|
|
254
|
+
const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`;
|
|
255
|
+
const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`;
|
|
256
|
+
const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`;
|
|
257
|
+
return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year2} ${hoursString}:${minutesString}:${secondsString} GMT`;
|
|
258
|
+
}
|
|
259
|
+
var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
|
|
260
|
+
var parseRfc3339DateTime = (value) => {
|
|
261
|
+
if (value === null || value === void 0) {
|
|
262
|
+
return void 0;
|
|
263
|
+
}
|
|
264
|
+
if (typeof value !== "string") {
|
|
265
|
+
throw new TypeError("RFC-3339 date-times must be expressed as strings");
|
|
266
|
+
}
|
|
267
|
+
const match = RFC3339.exec(value);
|
|
268
|
+
if (!match) {
|
|
269
|
+
throw new TypeError("Invalid RFC-3339 date-time value");
|
|
270
|
+
}
|
|
271
|
+
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
272
|
+
const year2 = strictParseShort(stripLeadingZeroes(yearStr));
|
|
273
|
+
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
274
|
+
const day = parseDateValue(dayStr, "day", 1, 31);
|
|
275
|
+
return buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
|
|
276
|
+
};
|
|
277
|
+
var RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
|
|
278
|
+
var parseRfc3339DateTimeWithOffset = (value) => {
|
|
279
|
+
if (value === null || value === void 0) {
|
|
280
|
+
return void 0;
|
|
281
|
+
}
|
|
282
|
+
if (typeof value !== "string") {
|
|
283
|
+
throw new TypeError("RFC-3339 date-times must be expressed as strings");
|
|
284
|
+
}
|
|
285
|
+
const match = RFC3339_WITH_OFFSET.exec(value);
|
|
286
|
+
if (!match) {
|
|
287
|
+
throw new TypeError("Invalid RFC-3339 date-time value");
|
|
288
|
+
}
|
|
289
|
+
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match;
|
|
290
|
+
const year2 = strictParseShort(stripLeadingZeroes(yearStr));
|
|
291
|
+
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
292
|
+
const day = parseDateValue(dayStr, "day", 1, 31);
|
|
293
|
+
const date2 = buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
|
|
294
|
+
if (offsetStr.toUpperCase() != "Z") {
|
|
295
|
+
date2.setTime(date2.getTime() - parseOffsetToMilliseconds(offsetStr));
|
|
296
|
+
}
|
|
297
|
+
return date2;
|
|
298
|
+
};
|
|
299
|
+
var 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$/);
|
|
300
|
+
var 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$/);
|
|
301
|
+
var 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})$/);
|
|
302
|
+
var parseRfc7231DateTime = (value) => {
|
|
303
|
+
if (value === null || value === void 0) {
|
|
304
|
+
return void 0;
|
|
305
|
+
}
|
|
306
|
+
if (typeof value !== "string") {
|
|
307
|
+
throw new TypeError("RFC-7231 date-times must be expressed as strings");
|
|
308
|
+
}
|
|
309
|
+
let match = IMF_FIXDATE.exec(value);
|
|
310
|
+
if (match) {
|
|
311
|
+
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
312
|
+
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
|
|
313
|
+
}
|
|
314
|
+
match = RFC_850_DATE.exec(value);
|
|
315
|
+
if (match) {
|
|
316
|
+
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
317
|
+
return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
|
|
318
|
+
hours,
|
|
319
|
+
minutes,
|
|
320
|
+
seconds,
|
|
321
|
+
fractionalMilliseconds
|
|
322
|
+
}));
|
|
323
|
+
}
|
|
324
|
+
match = ASC_TIME.exec(value);
|
|
325
|
+
if (match) {
|
|
326
|
+
const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
|
|
327
|
+
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
|
|
328
|
+
}
|
|
329
|
+
throw new TypeError("Invalid RFC-7231 date-time value");
|
|
330
|
+
};
|
|
331
|
+
var parseEpochTimestamp = (value) => {
|
|
332
|
+
if (value === null || value === void 0) {
|
|
333
|
+
return void 0;
|
|
334
|
+
}
|
|
335
|
+
let valueAsDouble;
|
|
336
|
+
if (typeof value === "number") {
|
|
337
|
+
valueAsDouble = value;
|
|
338
|
+
} else if (typeof value === "string") {
|
|
339
|
+
valueAsDouble = strictParseDouble(value);
|
|
340
|
+
} else if (typeof value === "object" && value.tag === 1) {
|
|
341
|
+
valueAsDouble = value.value;
|
|
342
|
+
} else {
|
|
343
|
+
throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
|
|
344
|
+
}
|
|
345
|
+
if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) {
|
|
346
|
+
throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
|
|
347
|
+
}
|
|
348
|
+
return new Date(Math.round(valueAsDouble * 1e3));
|
|
349
|
+
};
|
|
350
|
+
var buildDate = (year2, month, day, time2) => {
|
|
351
|
+
const adjustedMonth = month - 1;
|
|
352
|
+
validateDayOfMonth(year2, adjustedMonth, day);
|
|
353
|
+
return new Date(Date.UTC(year2, adjustedMonth, day, parseDateValue(time2.hours, "hour", 0, 23), parseDateValue(time2.minutes, "minute", 0, 59), parseDateValue(time2.seconds, "seconds", 0, 60), parseMilliseconds(time2.fractionalMilliseconds)));
|
|
354
|
+
};
|
|
355
|
+
var parseTwoDigitYear = (value) => {
|
|
356
|
+
const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
357
|
+
const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value));
|
|
358
|
+
if (valueInThisCentury < thisYear) {
|
|
359
|
+
return valueInThisCentury + 100;
|
|
360
|
+
}
|
|
361
|
+
return valueInThisCentury;
|
|
362
|
+
};
|
|
363
|
+
var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3;
|
|
364
|
+
var adjustRfc850Year = (input) => {
|
|
365
|
+
if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) {
|
|
366
|
+
return new Date(Date.UTC(input.getUTCFullYear() - 100, input.getUTCMonth(), input.getUTCDate(), input.getUTCHours(), input.getUTCMinutes(), input.getUTCSeconds(), input.getUTCMilliseconds()));
|
|
367
|
+
}
|
|
368
|
+
return input;
|
|
369
|
+
};
|
|
370
|
+
var parseMonthByShortName = (value) => {
|
|
371
|
+
const monthIdx = MONTHS.indexOf(value);
|
|
372
|
+
if (monthIdx < 0) {
|
|
373
|
+
throw new TypeError(`Invalid month: ${value}`);
|
|
374
|
+
}
|
|
375
|
+
return monthIdx + 1;
|
|
376
|
+
};
|
|
377
|
+
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
378
|
+
var validateDayOfMonth = (year2, month, day) => {
|
|
379
|
+
let maxDays = DAYS_IN_MONTH[month];
|
|
380
|
+
if (month === 1 && isLeapYear(year2)) {
|
|
381
|
+
maxDays = 29;
|
|
382
|
+
}
|
|
383
|
+
if (day > maxDays) {
|
|
384
|
+
throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year2}: ${day}`);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
var isLeapYear = (year2) => {
|
|
388
|
+
return year2 % 4 === 0 && (year2 % 100 !== 0 || year2 % 400 === 0);
|
|
389
|
+
};
|
|
390
|
+
var parseDateValue = (value, type, lower, upper) => {
|
|
391
|
+
const dateVal = strictParseByte(stripLeadingZeroes(value));
|
|
392
|
+
if (dateVal < lower || dateVal > upper) {
|
|
393
|
+
throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
|
|
394
|
+
}
|
|
395
|
+
return dateVal;
|
|
396
|
+
};
|
|
397
|
+
var parseMilliseconds = (value) => {
|
|
398
|
+
if (value === null || value === void 0) {
|
|
399
|
+
return 0;
|
|
400
|
+
}
|
|
401
|
+
return strictParseFloat32("0." + value) * 1e3;
|
|
402
|
+
};
|
|
403
|
+
var parseOffsetToMilliseconds = (value) => {
|
|
404
|
+
const directionStr = value[0];
|
|
405
|
+
let direction = 1;
|
|
406
|
+
if (directionStr == "+") {
|
|
407
|
+
direction = 1;
|
|
408
|
+
} else if (directionStr == "-") {
|
|
409
|
+
direction = -1;
|
|
410
|
+
} else {
|
|
411
|
+
throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);
|
|
412
|
+
}
|
|
413
|
+
const hour = Number(value.substring(1, 3));
|
|
414
|
+
const minute = Number(value.substring(4, 6));
|
|
415
|
+
return direction * (hour * 60 + minute) * 60 * 1e3;
|
|
416
|
+
};
|
|
417
|
+
var stripLeadingZeroes = (value) => {
|
|
418
|
+
let idx = 0;
|
|
419
|
+
while (idx < value.length - 1 && value.charAt(idx) === "0") {
|
|
420
|
+
idx++;
|
|
421
|
+
}
|
|
422
|
+
if (idx === 0) {
|
|
423
|
+
return value;
|
|
424
|
+
}
|
|
425
|
+
return value.slice(idx);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/lazy-json.js
|
|
429
|
+
var LazyJsonString = function LazyJsonString2(val) {
|
|
430
|
+
const str = Object.assign(new String(val), {
|
|
431
|
+
deserializeJSON() {
|
|
432
|
+
return JSON.parse(String(val));
|
|
433
|
+
},
|
|
434
|
+
toString() {
|
|
435
|
+
return String(val);
|
|
436
|
+
},
|
|
437
|
+
toJSON() {
|
|
438
|
+
return String(val);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
return str;
|
|
442
|
+
};
|
|
443
|
+
LazyJsonString.from = (object) => {
|
|
444
|
+
if (object && typeof object === "object" && (object instanceof LazyJsonString || "deserializeJSON" in object)) {
|
|
445
|
+
return object;
|
|
446
|
+
} else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
|
|
447
|
+
return LazyJsonString(String(object));
|
|
448
|
+
}
|
|
449
|
+
return LazyJsonString(JSON.stringify(object));
|
|
450
|
+
};
|
|
451
|
+
LazyJsonString.fromObject = LazyJsonString.from;
|
|
452
|
+
|
|
453
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/quote-header.js
|
|
454
|
+
function quoteHeader(part) {
|
|
455
|
+
if (part.includes(",") || part.includes('"')) {
|
|
456
|
+
part = `"${part.replace(/"/g, '\\"')}"`;
|
|
457
|
+
}
|
|
458
|
+
return part;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js
|
|
462
|
+
var ddd = `(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;
|
|
463
|
+
var mmm = `(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;
|
|
464
|
+
var time = `(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;
|
|
465
|
+
var date = `(\\d?\\d)`;
|
|
466
|
+
var year = `(\\d{4})`;
|
|
467
|
+
var RFC3339_WITH_OFFSET2 = new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);
|
|
468
|
+
var IMF_FIXDATE2 = new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`);
|
|
469
|
+
var RFC_850_DATE2 = new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`);
|
|
470
|
+
var ASC_TIME2 = new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`);
|
|
471
|
+
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
472
|
+
var _parseEpochTimestamp = (value) => {
|
|
473
|
+
if (value == null) {
|
|
474
|
+
return void 0;
|
|
475
|
+
}
|
|
476
|
+
let num = NaN;
|
|
477
|
+
if (typeof value === "number") {
|
|
478
|
+
num = value;
|
|
479
|
+
} else if (typeof value === "string") {
|
|
480
|
+
if (!/^-?\d*\.?\d+$/.test(value)) {
|
|
481
|
+
throw new TypeError(`parseEpochTimestamp - numeric string invalid.`);
|
|
482
|
+
}
|
|
483
|
+
num = Number.parseFloat(value);
|
|
484
|
+
} else if (typeof value === "object" && value.tag === 1) {
|
|
485
|
+
num = value.value;
|
|
486
|
+
}
|
|
487
|
+
if (isNaN(num) || Math.abs(num) === Infinity) {
|
|
488
|
+
throw new TypeError("Epoch timestamps must be valid finite numbers.");
|
|
489
|
+
}
|
|
490
|
+
return new Date(Math.round(num * 1e3));
|
|
491
|
+
};
|
|
492
|
+
var _parseRfc3339DateTimeWithOffset = (value) => {
|
|
493
|
+
if (value == null) {
|
|
494
|
+
return void 0;
|
|
495
|
+
}
|
|
496
|
+
if (typeof value !== "string") {
|
|
497
|
+
throw new TypeError("RFC3339 timestamps must be strings");
|
|
498
|
+
}
|
|
499
|
+
const matches = RFC3339_WITH_OFFSET2.exec(value);
|
|
500
|
+
if (!matches) {
|
|
501
|
+
throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
|
|
502
|
+
}
|
|
503
|
+
const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
|
|
504
|
+
range(monthStr, 1, 12);
|
|
505
|
+
range(dayStr, 1, 31);
|
|
506
|
+
range(hours, 0, 23);
|
|
507
|
+
range(minutes, 0, 59);
|
|
508
|
+
range(seconds, 0, 60);
|
|
509
|
+
const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1e3) : 0));
|
|
510
|
+
date2.setUTCFullYear(Number(yearStr));
|
|
511
|
+
if (offsetStr.toUpperCase() != "Z") {
|
|
512
|
+
const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [void 0, "+", 0, 0];
|
|
513
|
+
const scalar = sign === "-" ? 1 : -1;
|
|
514
|
+
date2.setTime(date2.getTime() + scalar * (Number(offsetH) * 60 * 60 * 1e3 + Number(offsetM) * 60 * 1e3));
|
|
515
|
+
}
|
|
516
|
+
return date2;
|
|
517
|
+
};
|
|
518
|
+
var _parseRfc7231DateTime = (value) => {
|
|
519
|
+
if (value == null) {
|
|
520
|
+
return void 0;
|
|
521
|
+
}
|
|
522
|
+
if (typeof value !== "string") {
|
|
523
|
+
throw new TypeError("RFC7231 timestamps must be strings.");
|
|
524
|
+
}
|
|
525
|
+
let day;
|
|
526
|
+
let month;
|
|
527
|
+
let year2;
|
|
528
|
+
let hour;
|
|
529
|
+
let minute;
|
|
530
|
+
let second;
|
|
531
|
+
let fraction;
|
|
532
|
+
let matches;
|
|
533
|
+
if (matches = IMF_FIXDATE2.exec(value)) {
|
|
534
|
+
[, day, month, year2, hour, minute, second, fraction] = matches;
|
|
535
|
+
} else if (matches = RFC_850_DATE2.exec(value)) {
|
|
536
|
+
[, day, month, year2, hour, minute, second, fraction] = matches;
|
|
537
|
+
year2 = (Number(year2) + 1900).toString();
|
|
538
|
+
} else if (matches = ASC_TIME2.exec(value)) {
|
|
539
|
+
[, month, day, hour, minute, second, fraction, year2] = matches;
|
|
540
|
+
}
|
|
541
|
+
if (year2 && second) {
|
|
542
|
+
const timestamp = Date.UTC(Number(year2), months.indexOf(month), Number(day), Number(hour), Number(minute), Number(second), fraction ? Math.round(parseFloat(`0.${fraction}`) * 1e3) : 0);
|
|
543
|
+
range(day, 1, 31);
|
|
544
|
+
range(hour, 0, 23);
|
|
545
|
+
range(minute, 0, 59);
|
|
546
|
+
range(second, 0, 60);
|
|
547
|
+
const date2 = new Date(timestamp);
|
|
548
|
+
date2.setUTCFullYear(Number(year2));
|
|
549
|
+
return date2;
|
|
550
|
+
}
|
|
551
|
+
throw new TypeError(`Invalid RFC7231 date-time value ${value}.`);
|
|
552
|
+
};
|
|
553
|
+
function range(v, min, max) {
|
|
554
|
+
const _v = Number(v);
|
|
555
|
+
if (_v < min || _v > max) {
|
|
556
|
+
throw new Error(`Value ${_v} out of range [${min}, ${max}]`);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/split-every.js
|
|
561
|
+
function splitEvery(value, delimiter, numDelimiters) {
|
|
562
|
+
if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) {
|
|
563
|
+
throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery.");
|
|
564
|
+
}
|
|
565
|
+
const segments = value.split(delimiter);
|
|
566
|
+
if (numDelimiters === 1) {
|
|
567
|
+
return segments;
|
|
568
|
+
}
|
|
569
|
+
const compoundSegments = [];
|
|
570
|
+
let currentSegment = "";
|
|
571
|
+
for (let i = 0; i < segments.length; i++) {
|
|
572
|
+
if (currentSegment === "") {
|
|
573
|
+
currentSegment = segments[i];
|
|
574
|
+
} else {
|
|
575
|
+
currentSegment += delimiter + segments[i];
|
|
576
|
+
}
|
|
577
|
+
if ((i + 1) % numDelimiters === 0) {
|
|
578
|
+
compoundSegments.push(currentSegment);
|
|
579
|
+
currentSegment = "";
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (currentSegment !== "") {
|
|
583
|
+
compoundSegments.push(currentSegment);
|
|
584
|
+
}
|
|
585
|
+
return compoundSegments;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js
|
|
589
|
+
var splitHeader = (value) => {
|
|
590
|
+
const z = value.length;
|
|
591
|
+
const values = [];
|
|
592
|
+
let withinQuotes = false;
|
|
593
|
+
let prevChar = void 0;
|
|
594
|
+
let anchor = 0;
|
|
595
|
+
for (let i = 0; i < z; ++i) {
|
|
596
|
+
const char = value[i];
|
|
597
|
+
switch (char) {
|
|
598
|
+
case `"`:
|
|
599
|
+
if (prevChar !== "\\") {
|
|
600
|
+
withinQuotes = !withinQuotes;
|
|
601
|
+
}
|
|
602
|
+
break;
|
|
603
|
+
case ",":
|
|
604
|
+
if (!withinQuotes) {
|
|
605
|
+
values.push(value.slice(anchor, i));
|
|
606
|
+
anchor = i + 1;
|
|
607
|
+
}
|
|
608
|
+
break;
|
|
609
|
+
default:
|
|
610
|
+
}
|
|
611
|
+
prevChar = char;
|
|
612
|
+
}
|
|
613
|
+
values.push(value.slice(anchor));
|
|
614
|
+
return values.map((v) => {
|
|
615
|
+
v = v.trim();
|
|
616
|
+
const z2 = v.length;
|
|
617
|
+
if (z2 < 2) {
|
|
618
|
+
return v;
|
|
619
|
+
}
|
|
620
|
+
if (v[0] === `"` && v[z2 - 1] === `"`) {
|
|
621
|
+
v = v.slice(1, z2 - 1);
|
|
622
|
+
}
|
|
623
|
+
return v.replace(/\\"/g, '"');
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js
|
|
628
|
+
var format = /^-?\d*(\.\d+)?$/;
|
|
629
|
+
var NumericValue = class _NumericValue {
|
|
630
|
+
string;
|
|
631
|
+
type;
|
|
632
|
+
constructor(string, type) {
|
|
633
|
+
this.string = string;
|
|
634
|
+
this.type = type;
|
|
635
|
+
if (!format.test(string)) {
|
|
636
|
+
throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
toString() {
|
|
640
|
+
return this.string;
|
|
641
|
+
}
|
|
642
|
+
static [Symbol.hasInstance](object) {
|
|
643
|
+
if (!object || typeof object !== "object") {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
const _nv = object;
|
|
647
|
+
return _NumericValue.prototype.isPrototypeOf(object) || _nv.type === "bigDecimal" && format.test(_nv.string);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js
|
|
652
|
+
import { ReadStream, fstatSync, lstatSync } from "fs";
|
|
653
|
+
var calculateBodyLength = (body) => {
|
|
654
|
+
if (!body) {
|
|
655
|
+
return 0;
|
|
656
|
+
}
|
|
657
|
+
if (typeof body === "string") {
|
|
658
|
+
return Buffer.byteLength(body);
|
|
659
|
+
} else if (typeof body.byteLength === "number") {
|
|
660
|
+
return body.byteLength;
|
|
661
|
+
} else if (typeof body.size === "number") {
|
|
662
|
+
return body.size;
|
|
663
|
+
} else if (typeof body.start === "number" && typeof body.end === "number") {
|
|
664
|
+
return body.end + 1 - body.start;
|
|
665
|
+
} else if (body instanceof ReadStream) {
|
|
666
|
+
if (body.path != null) {
|
|
667
|
+
return lstatSync(body.path).size;
|
|
668
|
+
} else if (typeof body.fd === "number") {
|
|
669
|
+
return fstatSync(body.fd).size;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
throw new Error(`Body Length computation failed for ${body}`);
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.js
|
|
676
|
+
var toUint8Array = (data) => {
|
|
677
|
+
if (typeof data === "string") {
|
|
678
|
+
return fromUtf8(data);
|
|
679
|
+
}
|
|
680
|
+
if (ArrayBuffer.isView(data)) {
|
|
681
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
|
682
|
+
}
|
|
683
|
+
return new Uint8Array(data);
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/hash-node/hash-node.js
|
|
687
|
+
import { createHash, createHmac } from "crypto";
|
|
688
|
+
var Hash = class {
|
|
689
|
+
algorithmIdentifier;
|
|
690
|
+
secret;
|
|
691
|
+
hash;
|
|
692
|
+
constructor(algorithmIdentifier, secret) {
|
|
693
|
+
this.algorithmIdentifier = algorithmIdentifier;
|
|
694
|
+
this.secret = secret;
|
|
695
|
+
this.reset();
|
|
696
|
+
}
|
|
697
|
+
update(toHash, encoding) {
|
|
698
|
+
this.hash.update(toUint8Array(castSourceData(toHash, encoding)));
|
|
699
|
+
}
|
|
700
|
+
digest() {
|
|
701
|
+
return Promise.resolve(this.hash.digest());
|
|
702
|
+
}
|
|
703
|
+
reset() {
|
|
704
|
+
this.hash = this.secret ? createHmac(this.algorithmIdentifier, castSourceData(this.secret)) : createHash(this.algorithmIdentifier);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
function castSourceData(toCast, encoding) {
|
|
708
|
+
if (Buffer.isBuffer(toCast)) {
|
|
709
|
+
return toCast;
|
|
710
|
+
}
|
|
711
|
+
if (typeof toCast === "string") {
|
|
712
|
+
return fromString(toCast, encoding);
|
|
713
|
+
}
|
|
714
|
+
if (ArrayBuffer.isView(toCast)) {
|
|
715
|
+
return fromArrayBuffer(toCast.buffer, toCast.byteOffset, toCast.byteLength);
|
|
716
|
+
}
|
|
717
|
+
return fromArrayBuffer(toCast);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js
|
|
721
|
+
import { Duplex } from "stream";
|
|
722
|
+
var ChecksumStream = class extends Duplex {
|
|
723
|
+
expectedChecksum;
|
|
724
|
+
checksumSourceLocation;
|
|
725
|
+
checksum;
|
|
726
|
+
source;
|
|
727
|
+
base64Encoder;
|
|
728
|
+
pendingCallback = null;
|
|
729
|
+
constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) {
|
|
730
|
+
var _a;
|
|
731
|
+
super();
|
|
732
|
+
if (typeof source.pipe === "function") {
|
|
733
|
+
this.source = source;
|
|
734
|
+
} else {
|
|
735
|
+
throw new Error(`@smithy/util-stream: unsupported source type ${((_a = source == null ? void 0 : source.constructor) == null ? void 0 : _a.name) ?? source} in ChecksumStream.`);
|
|
736
|
+
}
|
|
737
|
+
this.base64Encoder = base64Encoder ?? toBase64;
|
|
738
|
+
this.expectedChecksum = expectedChecksum;
|
|
739
|
+
this.checksum = checksum;
|
|
740
|
+
this.checksumSourceLocation = checksumSourceLocation;
|
|
741
|
+
this.source.pipe(this);
|
|
742
|
+
}
|
|
743
|
+
_read(size) {
|
|
744
|
+
if (this.pendingCallback) {
|
|
745
|
+
const callback = this.pendingCallback;
|
|
746
|
+
this.pendingCallback = null;
|
|
747
|
+
callback();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
_write(chunk, encoding, callback) {
|
|
751
|
+
try {
|
|
752
|
+
this.checksum.update(chunk);
|
|
753
|
+
const canPushMore = this.push(chunk);
|
|
754
|
+
if (!canPushMore) {
|
|
755
|
+
this.pendingCallback = callback;
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
} catch (e) {
|
|
759
|
+
return callback(e);
|
|
760
|
+
}
|
|
761
|
+
return callback();
|
|
762
|
+
}
|
|
763
|
+
async _final(callback) {
|
|
764
|
+
try {
|
|
765
|
+
const digest = await this.checksum.digest();
|
|
766
|
+
const received = this.base64Encoder(digest);
|
|
767
|
+
if (this.expectedChecksum !== received) {
|
|
768
|
+
return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}" in response header "${this.checksumSourceLocation}".`));
|
|
769
|
+
}
|
|
770
|
+
} catch (e) {
|
|
771
|
+
return callback(e);
|
|
772
|
+
}
|
|
773
|
+
this.push(null);
|
|
774
|
+
return callback();
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-type-check.js
|
|
779
|
+
var isReadableStream = (stream) => {
|
|
780
|
+
var _a;
|
|
781
|
+
return typeof ReadableStream === "function" && (((_a = stream == null ? void 0 : stream.constructor) == null ? void 0 : _a.name) === ReadableStream.name || stream instanceof ReadableStream);
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/fromUtf8.browser.js
|
|
785
|
+
var fromUtf82 = (input) => new TextEncoder().encode(input);
|
|
786
|
+
|
|
787
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/constants-for-browser.js
|
|
788
|
+
var chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
|
|
789
|
+
var alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
|
|
790
|
+
acc[c] = Number(i);
|
|
791
|
+
return acc;
|
|
792
|
+
}, {});
|
|
793
|
+
var alphabetByValue = chars.split("");
|
|
794
|
+
var bitsPerLetter = 6;
|
|
795
|
+
var bitsPerByte = 8;
|
|
796
|
+
var maxLetterValue = 63;
|
|
797
|
+
|
|
798
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/toBase64.browser.js
|
|
799
|
+
function toBase642(_input) {
|
|
800
|
+
let input;
|
|
801
|
+
if (typeof _input === "string") {
|
|
802
|
+
input = fromUtf82(_input);
|
|
803
|
+
} else {
|
|
804
|
+
input = _input;
|
|
805
|
+
}
|
|
806
|
+
const isArrayLike = typeof input === "object" && typeof input.length === "number";
|
|
807
|
+
const isUint8Array = typeof input === "object" && typeof input.byteOffset === "number" && typeof input.byteLength === "number";
|
|
808
|
+
if (!isArrayLike && !isUint8Array) {
|
|
809
|
+
throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
|
|
810
|
+
}
|
|
811
|
+
let str = "";
|
|
812
|
+
for (let i = 0; i < input.length; i += 3) {
|
|
813
|
+
let bits = 0;
|
|
814
|
+
let bitLength = 0;
|
|
815
|
+
for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
|
|
816
|
+
bits |= input[j] << (limit - j - 1) * bitsPerByte;
|
|
817
|
+
bitLength += bitsPerByte;
|
|
818
|
+
}
|
|
819
|
+
const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
|
|
820
|
+
bits <<= bitClusterCount * bitsPerLetter - bitLength;
|
|
821
|
+
for (let k = 1; k <= bitClusterCount; k++) {
|
|
822
|
+
const offset = (bitClusterCount - k) * bitsPerLetter;
|
|
823
|
+
str += alphabetByValue[(bits & maxLetterValue << offset) >> offset];
|
|
824
|
+
}
|
|
825
|
+
str += "==".slice(0, 4 - bitClusterCount);
|
|
826
|
+
}
|
|
827
|
+
return str;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.browser.js
|
|
831
|
+
var ReadableStreamRef = typeof ReadableStream === "function" ? ReadableStream : function() {
|
|
832
|
+
};
|
|
833
|
+
var ChecksumStream2 = class extends ReadableStreamRef {
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/createChecksumStream.browser.js
|
|
837
|
+
var createChecksumStream = ({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) => {
|
|
838
|
+
var _a;
|
|
839
|
+
if (!isReadableStream(source)) {
|
|
840
|
+
throw new Error(`@smithy/util-stream: unsupported source type ${((_a = source == null ? void 0 : source.constructor) == null ? void 0 : _a.name) ?? source} in ChecksumStream.`);
|
|
841
|
+
}
|
|
842
|
+
const encoder = base64Encoder ?? toBase642;
|
|
843
|
+
if (typeof TransformStream !== "function") {
|
|
844
|
+
throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");
|
|
845
|
+
}
|
|
846
|
+
const transform = new TransformStream({
|
|
847
|
+
start() {
|
|
848
|
+
},
|
|
849
|
+
async transform(chunk, controller) {
|
|
850
|
+
checksum.update(chunk);
|
|
851
|
+
controller.enqueue(chunk);
|
|
852
|
+
},
|
|
853
|
+
async flush(controller) {
|
|
854
|
+
const digest = await checksum.digest();
|
|
855
|
+
const received = encoder(digest);
|
|
856
|
+
if (expectedChecksum !== received) {
|
|
857
|
+
const error = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}" in response header "${checksumSourceLocation}".`);
|
|
858
|
+
controller.error(error);
|
|
859
|
+
} else {
|
|
860
|
+
controller.terminate();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
source.pipeThrough(transform);
|
|
865
|
+
const readable = transform.readable;
|
|
866
|
+
Object.setPrototypeOf(readable, ChecksumStream2.prototype);
|
|
867
|
+
return readable;
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/createChecksumStream.js
|
|
871
|
+
function createChecksumStream2(init) {
|
|
872
|
+
if (typeof ReadableStream === "function" && isReadableStream(init.source)) {
|
|
873
|
+
return createChecksumStream(init);
|
|
874
|
+
}
|
|
875
|
+
return new ChecksumStream(init);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.js
|
|
879
|
+
import { Readable } from "stream";
|
|
880
|
+
|
|
881
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/ByteArrayCollector.js
|
|
882
|
+
var ByteArrayCollector = class {
|
|
883
|
+
allocByteArray;
|
|
884
|
+
byteLength = 0;
|
|
885
|
+
byteArrays = [];
|
|
886
|
+
constructor(allocByteArray) {
|
|
887
|
+
this.allocByteArray = allocByteArray;
|
|
888
|
+
}
|
|
889
|
+
push(byteArray) {
|
|
890
|
+
this.byteArrays.push(byteArray);
|
|
891
|
+
this.byteLength += byteArray.byteLength;
|
|
892
|
+
}
|
|
893
|
+
flush() {
|
|
894
|
+
if (this.byteArrays.length === 1) {
|
|
895
|
+
const bytes = this.byteArrays[0];
|
|
896
|
+
this.reset();
|
|
897
|
+
return bytes;
|
|
898
|
+
}
|
|
899
|
+
const aggregation = this.allocByteArray(this.byteLength);
|
|
900
|
+
let cursor = 0;
|
|
901
|
+
for (let i = 0; i < this.byteArrays.length; ++i) {
|
|
902
|
+
const bytes = this.byteArrays[i];
|
|
903
|
+
aggregation.set(bytes, cursor);
|
|
904
|
+
cursor += bytes.byteLength;
|
|
905
|
+
}
|
|
906
|
+
this.reset();
|
|
907
|
+
return aggregation;
|
|
908
|
+
}
|
|
909
|
+
reset() {
|
|
910
|
+
this.byteArrays = [];
|
|
911
|
+
this.byteLength = 0;
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.browser.js
|
|
916
|
+
function createBufferedReadableStream(upstream, size, logger2) {
|
|
917
|
+
const reader = upstream.getReader();
|
|
918
|
+
let streamBufferingLoggedWarning = false;
|
|
919
|
+
let bytesSeen = 0;
|
|
920
|
+
const buffers = ["", new ByteArrayCollector((size2) => new Uint8Array(size2))];
|
|
921
|
+
let mode = -1;
|
|
922
|
+
const pull = async (controller) => {
|
|
923
|
+
const { value, done } = await reader.read();
|
|
924
|
+
const chunk = value;
|
|
925
|
+
if (done) {
|
|
926
|
+
if (mode !== -1) {
|
|
927
|
+
const remainder = flush(buffers, mode);
|
|
928
|
+
if (sizeOf(remainder) > 0) {
|
|
929
|
+
controller.enqueue(remainder);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
controller.close();
|
|
933
|
+
} else {
|
|
934
|
+
const chunkMode = modeOf(chunk, false);
|
|
935
|
+
if (mode !== chunkMode) {
|
|
936
|
+
if (mode >= 0) {
|
|
937
|
+
controller.enqueue(flush(buffers, mode));
|
|
938
|
+
}
|
|
939
|
+
mode = chunkMode;
|
|
940
|
+
}
|
|
941
|
+
if (mode === -1) {
|
|
942
|
+
controller.enqueue(chunk);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
const chunkSize = sizeOf(chunk);
|
|
946
|
+
bytesSeen += chunkSize;
|
|
947
|
+
const bufferSize = sizeOf(buffers[mode]);
|
|
948
|
+
if (chunkSize >= size && bufferSize === 0) {
|
|
949
|
+
controller.enqueue(chunk);
|
|
950
|
+
} else {
|
|
951
|
+
const newSize = merge(buffers, mode, chunk);
|
|
952
|
+
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
953
|
+
streamBufferingLoggedWarning = true;
|
|
954
|
+
logger2 == null ? void 0 : logger2.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
955
|
+
}
|
|
956
|
+
if (newSize >= size) {
|
|
957
|
+
controller.enqueue(flush(buffers, mode));
|
|
958
|
+
} else {
|
|
959
|
+
await pull(controller);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
return new ReadableStream({
|
|
965
|
+
pull
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
function merge(buffers, mode, chunk) {
|
|
969
|
+
switch (mode) {
|
|
970
|
+
case 0:
|
|
971
|
+
buffers[0] += chunk;
|
|
972
|
+
return sizeOf(buffers[0]);
|
|
973
|
+
case 1:
|
|
974
|
+
case 2:
|
|
975
|
+
buffers[mode].push(chunk);
|
|
976
|
+
return sizeOf(buffers[mode]);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
function flush(buffers, mode) {
|
|
980
|
+
switch (mode) {
|
|
981
|
+
case 0:
|
|
982
|
+
const s = buffers[0];
|
|
983
|
+
buffers[0] = "";
|
|
984
|
+
return s;
|
|
985
|
+
case 1:
|
|
986
|
+
case 2:
|
|
987
|
+
return buffers[mode].flush();
|
|
988
|
+
}
|
|
989
|
+
throw new Error(`@smithy/util-stream - invalid index ${mode} given to flush()`);
|
|
990
|
+
}
|
|
991
|
+
function sizeOf(chunk) {
|
|
992
|
+
return (chunk == null ? void 0 : chunk.byteLength) ?? (chunk == null ? void 0 : chunk.length) ?? 0;
|
|
993
|
+
}
|
|
994
|
+
function modeOf(chunk, allowBuffer = true) {
|
|
995
|
+
if (allowBuffer && typeof Buffer !== "undefined" && chunk instanceof Buffer) {
|
|
996
|
+
return 2;
|
|
997
|
+
}
|
|
998
|
+
if (chunk instanceof Uint8Array) {
|
|
999
|
+
return 1;
|
|
1000
|
+
}
|
|
1001
|
+
if (typeof chunk === "string") {
|
|
1002
|
+
return 0;
|
|
1003
|
+
}
|
|
1004
|
+
return -1;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.js
|
|
1008
|
+
function createBufferedReadable(upstream, size, logger2) {
|
|
1009
|
+
if (isReadableStream(upstream)) {
|
|
1010
|
+
return createBufferedReadableStream(upstream, size, logger2);
|
|
1011
|
+
}
|
|
1012
|
+
const downstream = new Readable({ read() {
|
|
1013
|
+
} });
|
|
1014
|
+
let streamBufferingLoggedWarning = false;
|
|
1015
|
+
let bytesSeen = 0;
|
|
1016
|
+
const buffers = [
|
|
1017
|
+
"",
|
|
1018
|
+
new ByteArrayCollector((size2) => new Uint8Array(size2)),
|
|
1019
|
+
new ByteArrayCollector((size2) => Buffer.from(new Uint8Array(size2)))
|
|
1020
|
+
];
|
|
1021
|
+
let mode = -1;
|
|
1022
|
+
upstream.on("data", (chunk) => {
|
|
1023
|
+
const chunkMode = modeOf(chunk, true);
|
|
1024
|
+
if (mode !== chunkMode) {
|
|
1025
|
+
if (mode >= 0) {
|
|
1026
|
+
downstream.push(flush(buffers, mode));
|
|
1027
|
+
}
|
|
1028
|
+
mode = chunkMode;
|
|
1029
|
+
}
|
|
1030
|
+
if (mode === -1) {
|
|
1031
|
+
downstream.push(chunk);
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
const chunkSize = sizeOf(chunk);
|
|
1035
|
+
bytesSeen += chunkSize;
|
|
1036
|
+
const bufferSize = sizeOf(buffers[mode]);
|
|
1037
|
+
if (chunkSize >= size && bufferSize === 0) {
|
|
1038
|
+
downstream.push(chunk);
|
|
1039
|
+
} else {
|
|
1040
|
+
const newSize = merge(buffers, mode, chunk);
|
|
1041
|
+
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
1042
|
+
streamBufferingLoggedWarning = true;
|
|
1043
|
+
logger2 == null ? void 0 : logger2.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
1044
|
+
}
|
|
1045
|
+
if (newSize >= size) {
|
|
1046
|
+
downstream.push(flush(buffers, mode));
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
upstream.on("end", () => {
|
|
1051
|
+
if (mode !== -1) {
|
|
1052
|
+
const remainder = flush(buffers, mode);
|
|
1053
|
+
if (sizeOf(remainder) > 0) {
|
|
1054
|
+
downstream.push(remainder);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
downstream.push(null);
|
|
1058
|
+
});
|
|
1059
|
+
return downstream;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js
|
|
1063
|
+
import { Readable as Readable2 } from "stream";
|
|
1064
|
+
|
|
1065
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js
|
|
1066
|
+
var getAwsChunkedEncodingStream = (readableStream, options) => {
|
|
1067
|
+
const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options;
|
|
1068
|
+
const checksumRequired = base64Encoder !== void 0 && bodyLengthChecker !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0;
|
|
1069
|
+
const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0;
|
|
1070
|
+
const reader = readableStream.getReader();
|
|
1071
|
+
return new ReadableStream({
|
|
1072
|
+
async pull(controller) {
|
|
1073
|
+
const { value, done } = await reader.read();
|
|
1074
|
+
if (done) {
|
|
1075
|
+
controller.enqueue(`0\r
|
|
1076
|
+
`);
|
|
1077
|
+
if (checksumRequired) {
|
|
1078
|
+
const checksum = base64Encoder(await digest);
|
|
1079
|
+
controller.enqueue(`${checksumLocationName}:${checksum}\r
|
|
1080
|
+
`);
|
|
1081
|
+
controller.enqueue(`\r
|
|
1082
|
+
`);
|
|
1083
|
+
}
|
|
1084
|
+
controller.close();
|
|
1085
|
+
} else {
|
|
1086
|
+
controller.enqueue(`${(bodyLengthChecker(value) || 0).toString(16)}\r
|
|
1087
|
+
${value}\r
|
|
1088
|
+
`);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js
|
|
1095
|
+
function getAwsChunkedEncodingStream2(stream, options) {
|
|
1096
|
+
const readable = stream;
|
|
1097
|
+
const readableStream = stream;
|
|
1098
|
+
if (isReadableStream(readableStream)) {
|
|
1099
|
+
return getAwsChunkedEncodingStream(readableStream, options);
|
|
1100
|
+
}
|
|
1101
|
+
const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options;
|
|
1102
|
+
const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0;
|
|
1103
|
+
const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : void 0;
|
|
1104
|
+
const awsChunkedEncodingStream = new Readable2({
|
|
1105
|
+
read: () => {
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
readable.on("data", (data) => {
|
|
1109
|
+
const length = bodyLengthChecker(data) || 0;
|
|
1110
|
+
if (length === 0) {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
awsChunkedEncodingStream.push(`${length.toString(16)}\r
|
|
1114
|
+
`);
|
|
1115
|
+
awsChunkedEncodingStream.push(data);
|
|
1116
|
+
awsChunkedEncodingStream.push("\r\n");
|
|
1117
|
+
});
|
|
1118
|
+
readable.on("end", async () => {
|
|
1119
|
+
awsChunkedEncodingStream.push(`0\r
|
|
1120
|
+
`);
|
|
1121
|
+
if (checksumRequired) {
|
|
1122
|
+
const checksum = base64Encoder(await digest);
|
|
1123
|
+
awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r
|
|
1124
|
+
`);
|
|
1125
|
+
awsChunkedEncodingStream.push(`\r
|
|
1126
|
+
`);
|
|
1127
|
+
}
|
|
1128
|
+
awsChunkedEncodingStream.push(null);
|
|
1129
|
+
});
|
|
1130
|
+
return awsChunkedEncodingStream;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js
|
|
1134
|
+
import { Readable as Readable3 } from "stream";
|
|
1135
|
+
|
|
1136
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUtf8.browser.js
|
|
1137
|
+
var toUtf82 = (input) => {
|
|
1138
|
+
if (typeof input === "string") {
|
|
1139
|
+
return input;
|
|
1140
|
+
}
|
|
1141
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
1142
|
+
throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
|
|
1143
|
+
}
|
|
1144
|
+
return new TextDecoder("utf-8").decode(input);
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js
|
|
1148
|
+
var fromBase642 = (input) => {
|
|
1149
|
+
let totalByteLength = input.length / 4 * 3;
|
|
1150
|
+
if (input.slice(-2) === "==") {
|
|
1151
|
+
totalByteLength -= 2;
|
|
1152
|
+
} else if (input.slice(-1) === "=") {
|
|
1153
|
+
totalByteLength--;
|
|
1154
|
+
}
|
|
1155
|
+
const out = new ArrayBuffer(totalByteLength);
|
|
1156
|
+
const dataView = new DataView(out);
|
|
1157
|
+
for (let i = 0; i < input.length; i += 4) {
|
|
1158
|
+
let bits = 0;
|
|
1159
|
+
let bitLength = 0;
|
|
1160
|
+
for (let j = i, limit = i + 3; j <= limit; j++) {
|
|
1161
|
+
if (input[j] !== "=") {
|
|
1162
|
+
if (!(input[j] in alphabetByEncoding)) {
|
|
1163
|
+
throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
|
|
1164
|
+
}
|
|
1165
|
+
bits |= alphabetByEncoding[input[j]] << (limit - j) * bitsPerLetter;
|
|
1166
|
+
bitLength += bitsPerLetter;
|
|
1167
|
+
} else {
|
|
1168
|
+
bits >>= bitsPerLetter;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
const chunkOffset = i / 4 * 3;
|
|
1172
|
+
bits >>= bitLength % bitsPerByte;
|
|
1173
|
+
const byteLength = Math.floor(bitLength / bitsPerByte);
|
|
1174
|
+
for (let k = 0; k < byteLength; k++) {
|
|
1175
|
+
const offset = (byteLength - k - 1) * bitsPerByte;
|
|
1176
|
+
dataView.setUint8(chunkOffset + k, (bits & 255 << offset) >> offset);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return new Uint8Array(out);
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js
|
|
1183
|
+
var streamCollector = async (stream) => {
|
|
1184
|
+
var _a;
|
|
1185
|
+
if (typeof Blob === "function" && stream instanceof Blob || ((_a = stream.constructor) == null ? void 0 : _a.name) === "Blob") {
|
|
1186
|
+
if (Blob.prototype.arrayBuffer !== void 0) {
|
|
1187
|
+
return new Uint8Array(await stream.arrayBuffer());
|
|
1188
|
+
}
|
|
1189
|
+
return collectBlob(stream);
|
|
1190
|
+
}
|
|
1191
|
+
return collectStream(stream);
|
|
1192
|
+
};
|
|
1193
|
+
async function collectBlob(blob) {
|
|
1194
|
+
const base64 = await readToBase64(blob);
|
|
1195
|
+
const arrayBuffer = fromBase642(base64);
|
|
1196
|
+
return new Uint8Array(arrayBuffer);
|
|
1197
|
+
}
|
|
1198
|
+
async function collectStream(stream) {
|
|
1199
|
+
const chunks = [];
|
|
1200
|
+
const reader = stream.getReader();
|
|
1201
|
+
let isDone = false;
|
|
1202
|
+
let length = 0;
|
|
1203
|
+
while (!isDone) {
|
|
1204
|
+
const { done, value } = await reader.read();
|
|
1205
|
+
if (value) {
|
|
1206
|
+
chunks.push(value);
|
|
1207
|
+
length += value.length;
|
|
1208
|
+
}
|
|
1209
|
+
isDone = done;
|
|
1210
|
+
}
|
|
1211
|
+
const collected = new Uint8Array(length);
|
|
1212
|
+
let offset = 0;
|
|
1213
|
+
for (const chunk of chunks) {
|
|
1214
|
+
collected.set(chunk, offset);
|
|
1215
|
+
offset += chunk.length;
|
|
1216
|
+
}
|
|
1217
|
+
return collected;
|
|
1218
|
+
}
|
|
1219
|
+
function readToBase64(blob) {
|
|
1220
|
+
return new Promise((resolve, reject) => {
|
|
1221
|
+
const reader = new FileReader();
|
|
1222
|
+
reader.onloadend = () => {
|
|
1223
|
+
if (reader.readyState !== 2) {
|
|
1224
|
+
return reject(new Error("Reader aborted too early"));
|
|
1225
|
+
}
|
|
1226
|
+
const result = reader.result ?? "";
|
|
1227
|
+
const commaIndex = result.indexOf(",");
|
|
1228
|
+
const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
|
|
1229
|
+
resolve(result.substring(dataOffset));
|
|
1230
|
+
};
|
|
1231
|
+
reader.onabort = () => reject(new Error("Read aborted"));
|
|
1232
|
+
reader.onerror = () => reject(reader.error);
|
|
1233
|
+
reader.readAsDataURL(blob);
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.browser.js
|
|
1238
|
+
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
|
|
1239
|
+
var sdkStreamMixin = (stream) => {
|
|
1240
|
+
var _a, _b;
|
|
1241
|
+
if (!isBlobInstance(stream) && !isReadableStream(stream)) {
|
|
1242
|
+
const name = ((_b = (_a = stream == null ? void 0 : stream.__proto__) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) || stream;
|
|
1243
|
+
throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
|
|
1244
|
+
}
|
|
1245
|
+
let transformed = false;
|
|
1246
|
+
const transformToByteArray = async () => {
|
|
1247
|
+
if (transformed) {
|
|
1248
|
+
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
1249
|
+
}
|
|
1250
|
+
transformed = true;
|
|
1251
|
+
return await streamCollector(stream);
|
|
1252
|
+
};
|
|
1253
|
+
const blobToWebStream = (blob) => {
|
|
1254
|
+
if (typeof blob.stream !== "function") {
|
|
1255
|
+
throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
|
|
1256
|
+
}
|
|
1257
|
+
return blob.stream();
|
|
1258
|
+
};
|
|
1259
|
+
return Object.assign(stream, {
|
|
1260
|
+
transformToByteArray,
|
|
1261
|
+
transformToString: async (encoding) => {
|
|
1262
|
+
const buf = await transformToByteArray();
|
|
1263
|
+
if (encoding === "base64") {
|
|
1264
|
+
return toBase642(buf);
|
|
1265
|
+
} else if (encoding === "hex") {
|
|
1266
|
+
return toHex(buf);
|
|
1267
|
+
} else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") {
|
|
1268
|
+
return toUtf82(buf);
|
|
1269
|
+
} else if (typeof TextDecoder === "function") {
|
|
1270
|
+
return new TextDecoder(encoding).decode(buf);
|
|
1271
|
+
} else {
|
|
1272
|
+
throw new Error("TextDecoder is not available, please make sure polyfill is provided.");
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
transformToWebStream: () => {
|
|
1276
|
+
if (transformed) {
|
|
1277
|
+
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
1278
|
+
}
|
|
1279
|
+
transformed = true;
|
|
1280
|
+
if (isBlobInstance(stream)) {
|
|
1281
|
+
return blobToWebStream(stream);
|
|
1282
|
+
} else if (isReadableStream(stream)) {
|
|
1283
|
+
return stream;
|
|
1284
|
+
} else {
|
|
1285
|
+
throw new Error(`Cannot transform payload to web stream, got ${stream}`);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
};
|
|
1290
|
+
var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
|
|
1291
|
+
|
|
1292
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js
|
|
1293
|
+
import { Writable } from "stream";
|
|
1294
|
+
var Collector = class extends Writable {
|
|
1295
|
+
bufferedBytes = [];
|
|
1296
|
+
_write(chunk, encoding, callback) {
|
|
1297
|
+
this.bufferedBytes.push(chunk);
|
|
1298
|
+
callback();
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
1302
|
+
async function collectReadableStream(stream) {
|
|
1303
|
+
const chunks = [];
|
|
1304
|
+
const reader = stream.getReader();
|
|
1305
|
+
let isDone = false;
|
|
1306
|
+
let length = 0;
|
|
1307
|
+
while (!isDone) {
|
|
1308
|
+
const { done, value } = await reader.read();
|
|
1309
|
+
if (value) {
|
|
1310
|
+
chunks.push(value);
|
|
1311
|
+
length += value.length;
|
|
1312
|
+
}
|
|
1313
|
+
isDone = done;
|
|
1314
|
+
}
|
|
1315
|
+
const collected = new Uint8Array(length);
|
|
1316
|
+
let offset = 0;
|
|
1317
|
+
for (const chunk of chunks) {
|
|
1318
|
+
collected.set(chunk, offset);
|
|
1319
|
+
offset += chunk.length;
|
|
1320
|
+
}
|
|
1321
|
+
return collected;
|
|
1322
|
+
}
|
|
1323
|
+
var streamCollector2 = (stream) => {
|
|
1324
|
+
if (isReadableStreamInstance(stream)) {
|
|
1325
|
+
return collectReadableStream(stream);
|
|
1326
|
+
}
|
|
1327
|
+
return new Promise((resolve, reject) => {
|
|
1328
|
+
const collector = new Collector();
|
|
1329
|
+
stream.pipe(collector);
|
|
1330
|
+
stream.on("error", (err) => {
|
|
1331
|
+
collector.end();
|
|
1332
|
+
reject(err);
|
|
1333
|
+
});
|
|
1334
|
+
collector.on("error", reject);
|
|
1335
|
+
collector.on("finish", function() {
|
|
1336
|
+
const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
1337
|
+
resolve(bytes);
|
|
1338
|
+
});
|
|
1339
|
+
});
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js
|
|
1343
|
+
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2 = "The stream has already been transformed.";
|
|
1344
|
+
var sdkStreamMixin2 = (stream) => {
|
|
1345
|
+
var _a, _b;
|
|
1346
|
+
if (!(stream instanceof Readable3)) {
|
|
1347
|
+
try {
|
|
1348
|
+
return sdkStreamMixin(stream);
|
|
1349
|
+
} catch (e) {
|
|
1350
|
+
const name = ((_b = (_a = stream == null ? void 0 : stream.__proto__) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) || stream;
|
|
1351
|
+
throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
let transformed = false;
|
|
1355
|
+
const transformToByteArray = async () => {
|
|
1356
|
+
if (transformed) {
|
|
1357
|
+
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2);
|
|
1358
|
+
}
|
|
1359
|
+
transformed = true;
|
|
1360
|
+
return await streamCollector2(stream);
|
|
1361
|
+
};
|
|
1362
|
+
return Object.assign(stream, {
|
|
1363
|
+
transformToByteArray,
|
|
1364
|
+
transformToString: async (encoding) => {
|
|
1365
|
+
const buf = await transformToByteArray();
|
|
1366
|
+
if (encoding === void 0 || Buffer.isEncoding(encoding)) {
|
|
1367
|
+
return fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding);
|
|
1368
|
+
} else {
|
|
1369
|
+
const decoder = new TextDecoder(encoding);
|
|
1370
|
+
return decoder.decode(buf);
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
transformToWebStream: () => {
|
|
1374
|
+
if (transformed) {
|
|
1375
|
+
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2);
|
|
1376
|
+
}
|
|
1377
|
+
if (stream.readableFlowing !== null) {
|
|
1378
|
+
throw new Error("The stream has been consumed by other callbacks.");
|
|
1379
|
+
}
|
|
1380
|
+
if (typeof Readable3.toWeb !== "function") {
|
|
1381
|
+
throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
|
|
1382
|
+
}
|
|
1383
|
+
transformed = true;
|
|
1384
|
+
return Readable3.toWeb(stream);
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
// ../../node_modules/@smithy/core/dist-es/submodules/serde/index.js
|
|
1390
|
+
var Uint8ArrayBlobAdapter = class extends bindUint8ArrayBlobAdapter(toUtf8, fromUtf8, toBase64, fromBase64) {
|
|
1391
|
+
};
|
|
1392
|
+
var _getRandomValues = getRandomValues;
|
|
1393
|
+
var v4 = bindV4(_getRandomValues);
|
|
1394
|
+
var generateIdempotencyToken = v4;
|
|
1395
|
+
|
|
1396
|
+
export {
|
|
1397
|
+
__dirname,
|
|
1398
|
+
isArrayBuffer,
|
|
1399
|
+
fromBase64,
|
|
1400
|
+
fromUtf8,
|
|
1401
|
+
toBase64,
|
|
1402
|
+
toUtf8,
|
|
1403
|
+
dateToUtcString,
|
|
1404
|
+
parseRfc3339DateTime,
|
|
1405
|
+
parseRfc3339DateTimeWithOffset,
|
|
1406
|
+
parseRfc7231DateTime,
|
|
1407
|
+
parseEpochTimestamp,
|
|
1408
|
+
LazyJsonString,
|
|
1409
|
+
quoteHeader,
|
|
1410
|
+
_parseEpochTimestamp,
|
|
1411
|
+
_parseRfc3339DateTimeWithOffset,
|
|
1412
|
+
_parseRfc7231DateTime,
|
|
1413
|
+
splitEvery,
|
|
1414
|
+
splitHeader,
|
|
1415
|
+
NumericValue,
|
|
1416
|
+
fromHex,
|
|
1417
|
+
toHex,
|
|
1418
|
+
calculateBodyLength,
|
|
1419
|
+
toUint8Array,
|
|
1420
|
+
Hash,
|
|
1421
|
+
createChecksumStream2 as createChecksumStream,
|
|
1422
|
+
createBufferedReadable,
|
|
1423
|
+
getAwsChunkedEncodingStream2 as getAwsChunkedEncodingStream,
|
|
1424
|
+
sdkStreamMixin2 as sdkStreamMixin,
|
|
1425
|
+
Uint8ArrayBlobAdapter,
|
|
1426
|
+
v4,
|
|
1427
|
+
generateIdempotencyToken
|
|
1428
|
+
};
|