@awsless/cli 0.0.1
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 +487 -0
- package/dist/app.json +1 -0
- package/dist/app.stage.json +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +49025 -0
- package/dist/build-json-schema.js +1925 -0
- package/dist/chunk-2TBBLACH.js +37 -0
- package/dist/chunk-3YEPERYO.js +1021 -0
- package/dist/chunk-4JFIJMQ6.js +46 -0
- package/dist/chunk-5TWBDDXS.js +60 -0
- package/dist/chunk-7NRPMOO4.js +876 -0
- package/dist/chunk-7XIGSOF4.js +100 -0
- package/dist/chunk-DSXFE5X2.js +174 -0
- package/dist/chunk-E7FQOYML.js +12 -0
- package/dist/chunk-GH475CSF.js +5005 -0
- package/dist/chunk-JHYKYQ5P.js +163 -0
- package/dist/chunk-LBISIOIM.js +28 -0
- package/dist/chunk-RCNT4C4P.js +50 -0
- package/dist/chunk-SIAA4J6H.js +21 -0
- package/dist/chunk-XNYTWFP6.js +241 -0
- package/dist/chunk-Z37AK4IA.js +546 -0
- package/dist/chunk-ZKH7AMP3.js +42 -0
- package/dist/dist-es-GXHCNXAC.js +489 -0
- package/dist/dist-es-J7SL4PXO.js +88 -0
- package/dist/dist-es-LL3VAI2X.js +70 -0
- package/dist/dist-es-QND3CYLI.js +380 -0
- package/dist/dist-es-STVZUSZG.js +21 -0
- package/dist/dist-es-TCFHB4OF.js +324 -0
- package/dist/dist-es-YFQTZTNE.js +167 -0
- package/dist/event-streams-74K5M656.js +244 -0
- package/dist/layers/sharp-arm.zip +0 -0
- package/dist/loadSso-O7PM54HL.js +592 -0
- package/dist/prebuild/icon/HASH +1 -0
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/HASH +1 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/HASH +1 -0
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/HASH +1 -0
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/rpc/HASH +1 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +159 -0
- package/dist/signin-6SPMGGJN.js +704 -0
- package/dist/sso-oidc-5IIWGKXY.js +829 -0
- package/dist/stack.json +1 -0
- package/dist/stack.stage.json +1 -0
- package/dist/sts-6SQWH4BL.js +3788 -0
- package/dist/test-global-setup.js +22 -0
- package/package.json +120 -0
|
@@ -0,0 +1,876 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fromArrayBuffer,
|
|
3
|
+
fromString,
|
|
4
|
+
fromUtf8
|
|
5
|
+
} from "./chunk-ZKH7AMP3.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/.pnpm/@smithy+protocol-http@5.3.12/node_modules/@smithy/protocol-http/dist-es/httpResponse.js
|
|
8
|
+
var HttpResponse = class {
|
|
9
|
+
statusCode;
|
|
10
|
+
reason;
|
|
11
|
+
headers;
|
|
12
|
+
body;
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.statusCode = options.statusCode;
|
|
15
|
+
this.reason = options.reason;
|
|
16
|
+
this.headers = options.headers || {};
|
|
17
|
+
this.body = options.body;
|
|
18
|
+
}
|
|
19
|
+
static isInstance(response) {
|
|
20
|
+
if (!response)
|
|
21
|
+
return false;
|
|
22
|
+
const resp = response;
|
|
23
|
+
return typeof resp.statusCode === "number" && typeof resp.headers === "object";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.pnpm/@smithy+util-uri-escape@4.2.2/node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
|
|
28
|
+
var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
|
|
29
|
+
var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
30
|
+
|
|
31
|
+
// ../../node_modules/.pnpm/@smithy+querystring-builder@4.2.12/node_modules/@smithy/querystring-builder/dist-es/index.js
|
|
32
|
+
function buildQueryString(query) {
|
|
33
|
+
const parts = [];
|
|
34
|
+
for (let key of Object.keys(query).sort()) {
|
|
35
|
+
const value = query[key];
|
|
36
|
+
key = escapeUri(key);
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
for (let i = 0, iLen = value.length; i < iLen; i++) {
|
|
39
|
+
parts.push(`${key}=${escapeUri(value[i])}`);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
let qsEntry = key;
|
|
43
|
+
if (value || typeof value === "string") {
|
|
44
|
+
qsEntry += `=${escapeUri(value)}`;
|
|
45
|
+
}
|
|
46
|
+
parts.push(qsEntry);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return parts.join("&");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
|
|
53
|
+
import { Agent as hsAgent, request as hsRequest } from "https";
|
|
54
|
+
|
|
55
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js
|
|
56
|
+
function buildAbortError(abortSignal) {
|
|
57
|
+
const reason = abortSignal && typeof abortSignal === "object" && "reason" in abortSignal ? abortSignal.reason : void 0;
|
|
58
|
+
if (reason) {
|
|
59
|
+
if (reason instanceof Error) {
|
|
60
|
+
const abortError3 = new Error("Request aborted");
|
|
61
|
+
abortError3.name = "AbortError";
|
|
62
|
+
abortError3.cause = reason;
|
|
63
|
+
return abortError3;
|
|
64
|
+
}
|
|
65
|
+
const abortError2 = new Error(String(reason));
|
|
66
|
+
abortError2.name = "AbortError";
|
|
67
|
+
return abortError2;
|
|
68
|
+
}
|
|
69
|
+
const abortError = new Error("Request aborted");
|
|
70
|
+
abortError.name = "AbortError";
|
|
71
|
+
return abortError;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/constants.js
|
|
75
|
+
var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
|
|
76
|
+
|
|
77
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
|
|
78
|
+
var getTransformedHeaders = (headers) => {
|
|
79
|
+
const transformedHeaders = {};
|
|
80
|
+
for (const name of Object.keys(headers)) {
|
|
81
|
+
const headerValues = headers[name];
|
|
82
|
+
transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
|
|
83
|
+
}
|
|
84
|
+
return transformedHeaders;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/timing.js
|
|
88
|
+
var timing = {
|
|
89
|
+
setTimeout: (cb, ms) => setTimeout(cb, ms),
|
|
90
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId)
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
|
|
94
|
+
var DEFER_EVENT_LISTENER_TIME = 1e3;
|
|
95
|
+
var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
96
|
+
if (!timeoutInMs) {
|
|
97
|
+
return -1;
|
|
98
|
+
}
|
|
99
|
+
const registerTimeout = (offset) => {
|
|
100
|
+
const timeoutId = timing.setTimeout(() => {
|
|
101
|
+
request.destroy();
|
|
102
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
|
|
103
|
+
name: "TimeoutError"
|
|
104
|
+
}));
|
|
105
|
+
}, timeoutInMs - offset);
|
|
106
|
+
const doWithSocket = (socket) => {
|
|
107
|
+
if (socket?.connecting) {
|
|
108
|
+
socket.on("connect", () => {
|
|
109
|
+
timing.clearTimeout(timeoutId);
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
timing.clearTimeout(timeoutId);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
if (request.socket) {
|
|
116
|
+
doWithSocket(request.socket);
|
|
117
|
+
} else {
|
|
118
|
+
request.on("socket", doWithSocket);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
if (timeoutInMs < 2e3) {
|
|
122
|
+
registerTimeout(0);
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js
|
|
129
|
+
var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger2) => {
|
|
130
|
+
if (timeoutInMs) {
|
|
131
|
+
return timing.setTimeout(() => {
|
|
132
|
+
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
133
|
+
if (throwOnRequestTimeout) {
|
|
134
|
+
const error = Object.assign(new Error(msg), {
|
|
135
|
+
name: "TimeoutError",
|
|
136
|
+
code: "ETIMEDOUT"
|
|
137
|
+
});
|
|
138
|
+
req.destroy(error);
|
|
139
|
+
reject(error);
|
|
140
|
+
} else {
|
|
141
|
+
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
142
|
+
logger2?.warn?.(msg);
|
|
143
|
+
}
|
|
144
|
+
}, timeoutInMs);
|
|
145
|
+
}
|
|
146
|
+
return -1;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
|
|
150
|
+
var DEFER_EVENT_LISTENER_TIME2 = 3e3;
|
|
151
|
+
var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
|
|
152
|
+
if (keepAlive !== true) {
|
|
153
|
+
return -1;
|
|
154
|
+
}
|
|
155
|
+
const registerListener = () => {
|
|
156
|
+
if (request.socket) {
|
|
157
|
+
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
158
|
+
} else {
|
|
159
|
+
request.on("socket", (socket) => {
|
|
160
|
+
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
if (deferTimeMs === 0) {
|
|
165
|
+
registerListener();
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
return timing.setTimeout(registerListener, deferTimeMs);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
|
|
172
|
+
var DEFER_EVENT_LISTENER_TIME3 = 3e3;
|
|
173
|
+
var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
174
|
+
const registerTimeout = (offset) => {
|
|
175
|
+
const timeout = timeoutInMs - offset;
|
|
176
|
+
const onTimeout = () => {
|
|
177
|
+
request.destroy();
|
|
178
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
|
|
179
|
+
};
|
|
180
|
+
if (request.socket) {
|
|
181
|
+
request.socket.setTimeout(timeout, onTimeout);
|
|
182
|
+
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
183
|
+
} else {
|
|
184
|
+
request.setTimeout(timeout, onTimeout);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
if (0 < timeoutInMs && timeoutInMs < 6e3) {
|
|
188
|
+
registerTimeout(0);
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
|
|
195
|
+
import { Readable } from "stream";
|
|
196
|
+
var MIN_WAIT_TIME = 6e3;
|
|
197
|
+
async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
|
|
198
|
+
const headers = request.headers ?? {};
|
|
199
|
+
const expect = headers.Expect || headers.expect;
|
|
200
|
+
let timeoutId = -1;
|
|
201
|
+
let sendBody = true;
|
|
202
|
+
if (!externalAgent && expect === "100-continue") {
|
|
203
|
+
sendBody = await Promise.race([
|
|
204
|
+
new Promise((resolve) => {
|
|
205
|
+
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
206
|
+
}),
|
|
207
|
+
new Promise((resolve) => {
|
|
208
|
+
httpRequest.on("continue", () => {
|
|
209
|
+
timing.clearTimeout(timeoutId);
|
|
210
|
+
resolve(true);
|
|
211
|
+
});
|
|
212
|
+
httpRequest.on("response", () => {
|
|
213
|
+
timing.clearTimeout(timeoutId);
|
|
214
|
+
resolve(false);
|
|
215
|
+
});
|
|
216
|
+
httpRequest.on("error", () => {
|
|
217
|
+
timing.clearTimeout(timeoutId);
|
|
218
|
+
resolve(false);
|
|
219
|
+
});
|
|
220
|
+
})
|
|
221
|
+
]);
|
|
222
|
+
}
|
|
223
|
+
if (sendBody) {
|
|
224
|
+
writeBody(httpRequest, request.body);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function writeBody(httpRequest, body) {
|
|
228
|
+
if (body instanceof Readable) {
|
|
229
|
+
body.pipe(httpRequest);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (body) {
|
|
233
|
+
const isBuffer = Buffer.isBuffer(body);
|
|
234
|
+
const isString = typeof body === "string";
|
|
235
|
+
if (isBuffer || isString) {
|
|
236
|
+
if (isBuffer && body.byteLength === 0) {
|
|
237
|
+
httpRequest.end();
|
|
238
|
+
} else {
|
|
239
|
+
httpRequest.end(body);
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const uint8 = body;
|
|
244
|
+
if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
|
|
245
|
+
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
httpRequest.end(Buffer.from(body));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
httpRequest.end();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
|
|
255
|
+
var hAgent = void 0;
|
|
256
|
+
var hRequest = void 0;
|
|
257
|
+
var NodeHttpHandler = class _NodeHttpHandler {
|
|
258
|
+
config;
|
|
259
|
+
configProvider;
|
|
260
|
+
socketWarningTimestamp = 0;
|
|
261
|
+
externalAgent = false;
|
|
262
|
+
metadata = { handlerProtocol: "http/1.1" };
|
|
263
|
+
static create(instanceOrOptions) {
|
|
264
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
265
|
+
return instanceOrOptions;
|
|
266
|
+
}
|
|
267
|
+
return new _NodeHttpHandler(instanceOrOptions);
|
|
268
|
+
}
|
|
269
|
+
static checkSocketUsage(agent, socketWarningTimestamp, logger2 = console) {
|
|
270
|
+
const { sockets, requests, maxSockets } = agent;
|
|
271
|
+
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
272
|
+
return socketWarningTimestamp;
|
|
273
|
+
}
|
|
274
|
+
const interval = 15e3;
|
|
275
|
+
if (Date.now() - interval < socketWarningTimestamp) {
|
|
276
|
+
return socketWarningTimestamp;
|
|
277
|
+
}
|
|
278
|
+
if (sockets && requests) {
|
|
279
|
+
for (const origin in sockets) {
|
|
280
|
+
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
281
|
+
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
282
|
+
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
283
|
+
logger2?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
284
|
+
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
285
|
+
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
286
|
+
return Date.now();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return socketWarningTimestamp;
|
|
291
|
+
}
|
|
292
|
+
constructor(options) {
|
|
293
|
+
this.configProvider = new Promise((resolve, reject) => {
|
|
294
|
+
if (typeof options === "function") {
|
|
295
|
+
options().then((_options) => {
|
|
296
|
+
resolve(this.resolveDefaultConfig(_options));
|
|
297
|
+
}).catch(reject);
|
|
298
|
+
} else {
|
|
299
|
+
resolve(this.resolveDefaultConfig(options));
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
destroy() {
|
|
304
|
+
this.config?.httpAgent?.destroy();
|
|
305
|
+
this.config?.httpsAgent?.destroy();
|
|
306
|
+
}
|
|
307
|
+
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
308
|
+
if (!this.config) {
|
|
309
|
+
this.config = await this.configProvider;
|
|
310
|
+
}
|
|
311
|
+
const config = this.config;
|
|
312
|
+
const isSSL = request.protocol === "https:";
|
|
313
|
+
if (!isSSL && !this.config.httpAgent) {
|
|
314
|
+
this.config.httpAgent = await this.config.httpAgentProvider();
|
|
315
|
+
}
|
|
316
|
+
return new Promise((_resolve, _reject) => {
|
|
317
|
+
let writeRequestBodyPromise = void 0;
|
|
318
|
+
const timeouts = [];
|
|
319
|
+
const resolve = async (arg) => {
|
|
320
|
+
await writeRequestBodyPromise;
|
|
321
|
+
timeouts.forEach(timing.clearTimeout);
|
|
322
|
+
_resolve(arg);
|
|
323
|
+
};
|
|
324
|
+
const reject = async (arg) => {
|
|
325
|
+
await writeRequestBodyPromise;
|
|
326
|
+
timeouts.forEach(timing.clearTimeout);
|
|
327
|
+
_reject(arg);
|
|
328
|
+
};
|
|
329
|
+
if (abortSignal?.aborted) {
|
|
330
|
+
const abortError = buildAbortError(abortSignal);
|
|
331
|
+
reject(abortError);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const headers = request.headers ?? {};
|
|
335
|
+
const expectContinue = (headers.Expect ?? headers.expect) === "100-continue";
|
|
336
|
+
let agent = isSSL ? config.httpsAgent : config.httpAgent;
|
|
337
|
+
if (expectContinue && !this.externalAgent) {
|
|
338
|
+
agent = new (isSSL ? hsAgent : hAgent)({
|
|
339
|
+
keepAlive: false,
|
|
340
|
+
maxSockets: Infinity
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
timeouts.push(timing.setTimeout(() => {
|
|
344
|
+
this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, config.logger);
|
|
345
|
+
}, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2e3) + (config.connectionTimeout ?? 1e3)));
|
|
346
|
+
const queryString = buildQueryString(request.query || {});
|
|
347
|
+
let auth = void 0;
|
|
348
|
+
if (request.username != null || request.password != null) {
|
|
349
|
+
const username = request.username ?? "";
|
|
350
|
+
const password = request.password ?? "";
|
|
351
|
+
auth = `${username}:${password}`;
|
|
352
|
+
}
|
|
353
|
+
let path = request.path;
|
|
354
|
+
if (queryString) {
|
|
355
|
+
path += `?${queryString}`;
|
|
356
|
+
}
|
|
357
|
+
if (request.fragment) {
|
|
358
|
+
path += `#${request.fragment}`;
|
|
359
|
+
}
|
|
360
|
+
let hostname = request.hostname ?? "";
|
|
361
|
+
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
362
|
+
hostname = request.hostname.slice(1, -1);
|
|
363
|
+
} else {
|
|
364
|
+
hostname = request.hostname;
|
|
365
|
+
}
|
|
366
|
+
const nodeHttpsOptions = {
|
|
367
|
+
headers: request.headers,
|
|
368
|
+
host: hostname,
|
|
369
|
+
method: request.method,
|
|
370
|
+
path,
|
|
371
|
+
port: request.port,
|
|
372
|
+
agent,
|
|
373
|
+
auth
|
|
374
|
+
};
|
|
375
|
+
const requestFunc = isSSL ? hsRequest : hRequest;
|
|
376
|
+
const req = requestFunc(nodeHttpsOptions, (res) => {
|
|
377
|
+
const httpResponse = new HttpResponse({
|
|
378
|
+
statusCode: res.statusCode || -1,
|
|
379
|
+
reason: res.statusMessage,
|
|
380
|
+
headers: getTransformedHeaders(res.headers),
|
|
381
|
+
body: res
|
|
382
|
+
});
|
|
383
|
+
resolve({ response: httpResponse });
|
|
384
|
+
});
|
|
385
|
+
req.on("error", (err) => {
|
|
386
|
+
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
387
|
+
reject(Object.assign(err, { name: "TimeoutError" }));
|
|
388
|
+
} else {
|
|
389
|
+
reject(err);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
if (abortSignal) {
|
|
393
|
+
const onAbort = () => {
|
|
394
|
+
req.destroy();
|
|
395
|
+
const abortError = buildAbortError(abortSignal);
|
|
396
|
+
reject(abortError);
|
|
397
|
+
};
|
|
398
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
399
|
+
const signal = abortSignal;
|
|
400
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
401
|
+
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
402
|
+
} else {
|
|
403
|
+
abortSignal.onabort = onAbort;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
407
|
+
timeouts.push(setConnectionTimeout(req, reject, config.connectionTimeout));
|
|
408
|
+
timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, config.logger ?? console));
|
|
409
|
+
timeouts.push(setSocketTimeout(req, reject, config.socketTimeout));
|
|
410
|
+
const httpAgent = nodeHttpsOptions.agent;
|
|
411
|
+
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
412
|
+
timeouts.push(setSocketKeepAlive(req, {
|
|
413
|
+
keepAlive: httpAgent.keepAlive,
|
|
414
|
+
keepAliveMsecs: httpAgent.keepAliveMsecs
|
|
415
|
+
}));
|
|
416
|
+
}
|
|
417
|
+
writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout, this.externalAgent).catch((e) => {
|
|
418
|
+
timeouts.forEach(timing.clearTimeout);
|
|
419
|
+
return _reject(e);
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
updateHttpClientConfig(key, value) {
|
|
424
|
+
this.config = void 0;
|
|
425
|
+
this.configProvider = this.configProvider.then((config) => {
|
|
426
|
+
return {
|
|
427
|
+
...config,
|
|
428
|
+
[key]: value
|
|
429
|
+
};
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
httpHandlerConfigs() {
|
|
433
|
+
return this.config ?? {};
|
|
434
|
+
}
|
|
435
|
+
resolveDefaultConfig(options) {
|
|
436
|
+
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger: logger2 } = options || {};
|
|
437
|
+
const keepAlive = true;
|
|
438
|
+
const maxSockets = 50;
|
|
439
|
+
return {
|
|
440
|
+
connectionTimeout,
|
|
441
|
+
requestTimeout,
|
|
442
|
+
socketTimeout,
|
|
443
|
+
socketAcquisitionWarningTimeout,
|
|
444
|
+
throwOnRequestTimeout,
|
|
445
|
+
httpAgentProvider: async () => {
|
|
446
|
+
const { Agent, request } = await import("http");
|
|
447
|
+
hRequest = request;
|
|
448
|
+
hAgent = Agent;
|
|
449
|
+
if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
|
|
450
|
+
this.externalAgent = true;
|
|
451
|
+
return httpAgent;
|
|
452
|
+
}
|
|
453
|
+
return new hAgent({ keepAlive, maxSockets, ...httpAgent });
|
|
454
|
+
},
|
|
455
|
+
httpsAgent: (() => {
|
|
456
|
+
if (httpsAgent instanceof hsAgent || typeof httpsAgent?.destroy === "function") {
|
|
457
|
+
this.externalAgent = true;
|
|
458
|
+
return httpsAgent;
|
|
459
|
+
}
|
|
460
|
+
return new hsAgent({ keepAlive, maxSockets, ...httpsAgent });
|
|
461
|
+
})(),
|
|
462
|
+
logger: logger2
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js
|
|
468
|
+
import { Writable } from "stream";
|
|
469
|
+
var Collector = class extends Writable {
|
|
470
|
+
bufferedBytes = [];
|
|
471
|
+
_write(chunk, encoding, callback) {
|
|
472
|
+
this.bufferedBytes.push(chunk);
|
|
473
|
+
callback();
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.5.1/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js
|
|
478
|
+
var streamCollector = (stream) => {
|
|
479
|
+
if (isReadableStreamInstance(stream)) {
|
|
480
|
+
return collectReadableStream(stream);
|
|
481
|
+
}
|
|
482
|
+
return new Promise((resolve, reject) => {
|
|
483
|
+
const collector = new Collector();
|
|
484
|
+
stream.pipe(collector);
|
|
485
|
+
stream.on("error", (err) => {
|
|
486
|
+
collector.end();
|
|
487
|
+
reject(err);
|
|
488
|
+
});
|
|
489
|
+
collector.on("error", reject);
|
|
490
|
+
collector.on("finish", function() {
|
|
491
|
+
const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
492
|
+
resolve(bytes);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
497
|
+
async function collectReadableStream(stream) {
|
|
498
|
+
const chunks = [];
|
|
499
|
+
const reader = stream.getReader();
|
|
500
|
+
let isDone = false;
|
|
501
|
+
let length = 0;
|
|
502
|
+
while (!isDone) {
|
|
503
|
+
const { done, value } = await reader.read();
|
|
504
|
+
if (value) {
|
|
505
|
+
chunks.push(value);
|
|
506
|
+
length += value.length;
|
|
507
|
+
}
|
|
508
|
+
isDone = done;
|
|
509
|
+
}
|
|
510
|
+
const collected = new Uint8Array(length);
|
|
511
|
+
let offset = 0;
|
|
512
|
+
for (const chunk of chunks) {
|
|
513
|
+
collected.set(chunk, offset);
|
|
514
|
+
offset += chunk.length;
|
|
515
|
+
}
|
|
516
|
+
return collected;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// ../../node_modules/.pnpm/@smithy+core@3.23.13/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js
|
|
520
|
+
var expectNumber = (value) => {
|
|
521
|
+
if (value === null || value === void 0) {
|
|
522
|
+
return void 0;
|
|
523
|
+
}
|
|
524
|
+
if (typeof value === "string") {
|
|
525
|
+
const parsed = parseFloat(value);
|
|
526
|
+
if (!Number.isNaN(parsed)) {
|
|
527
|
+
if (String(parsed) !== String(value)) {
|
|
528
|
+
logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
|
529
|
+
}
|
|
530
|
+
return parsed;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (typeof value === "number") {
|
|
534
|
+
return value;
|
|
535
|
+
}
|
|
536
|
+
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
|
|
537
|
+
};
|
|
538
|
+
var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
|
539
|
+
var expectFloat32 = (value) => {
|
|
540
|
+
const expected = expectNumber(value);
|
|
541
|
+
if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
|
|
542
|
+
if (Math.abs(expected) > MAX_FLOAT) {
|
|
543
|
+
throw new TypeError(`Expected 32-bit float, got ${value}`);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return expected;
|
|
547
|
+
};
|
|
548
|
+
var expectLong = (value) => {
|
|
549
|
+
if (value === null || value === void 0) {
|
|
550
|
+
return void 0;
|
|
551
|
+
}
|
|
552
|
+
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
|
553
|
+
return value;
|
|
554
|
+
}
|
|
555
|
+
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
|
|
556
|
+
};
|
|
557
|
+
var expectShort = (value) => expectSizedInt(value, 16);
|
|
558
|
+
var expectByte = (value) => expectSizedInt(value, 8);
|
|
559
|
+
var expectSizedInt = (value, size) => {
|
|
560
|
+
const expected = expectLong(value);
|
|
561
|
+
if (expected !== void 0 && castInt(expected, size) !== expected) {
|
|
562
|
+
throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
|
|
563
|
+
}
|
|
564
|
+
return expected;
|
|
565
|
+
};
|
|
566
|
+
var castInt = (value, size) => {
|
|
567
|
+
switch (size) {
|
|
568
|
+
case 32:
|
|
569
|
+
return Int32Array.of(value)[0];
|
|
570
|
+
case 16:
|
|
571
|
+
return Int16Array.of(value)[0];
|
|
572
|
+
case 8:
|
|
573
|
+
return Int8Array.of(value)[0];
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
var strictParseDouble = (value) => {
|
|
577
|
+
if (typeof value == "string") {
|
|
578
|
+
return expectNumber(parseNumber(value));
|
|
579
|
+
}
|
|
580
|
+
return expectNumber(value);
|
|
581
|
+
};
|
|
582
|
+
var strictParseFloat32 = (value) => {
|
|
583
|
+
if (typeof value == "string") {
|
|
584
|
+
return expectFloat32(parseNumber(value));
|
|
585
|
+
}
|
|
586
|
+
return expectFloat32(value);
|
|
587
|
+
};
|
|
588
|
+
var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
|
|
589
|
+
var parseNumber = (value) => {
|
|
590
|
+
const matches = value.match(NUMBER_REGEX);
|
|
591
|
+
if (matches === null || matches[0].length !== value.length) {
|
|
592
|
+
throw new TypeError(`Expected real number, got implicit NaN`);
|
|
593
|
+
}
|
|
594
|
+
return parseFloat(value);
|
|
595
|
+
};
|
|
596
|
+
var strictParseShort = (value) => {
|
|
597
|
+
if (typeof value === "string") {
|
|
598
|
+
return expectShort(parseNumber(value));
|
|
599
|
+
}
|
|
600
|
+
return expectShort(value);
|
|
601
|
+
};
|
|
602
|
+
var strictParseByte = (value) => {
|
|
603
|
+
if (typeof value === "string") {
|
|
604
|
+
return expectByte(parseNumber(value));
|
|
605
|
+
}
|
|
606
|
+
return expectByte(value);
|
|
607
|
+
};
|
|
608
|
+
var stackTraceWarning = (message) => {
|
|
609
|
+
return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n");
|
|
610
|
+
};
|
|
611
|
+
var logger = {
|
|
612
|
+
warn: console.warn
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
// ../../node_modules/.pnpm/@smithy+core@3.23.13/node_modules/@smithy/core/dist-es/submodules/serde/date-utils.js
|
|
616
|
+
var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
617
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
618
|
+
function dateToUtcString(date) {
|
|
619
|
+
const year = date.getUTCFullYear();
|
|
620
|
+
const month = date.getUTCMonth();
|
|
621
|
+
const dayOfWeek = date.getUTCDay();
|
|
622
|
+
const dayOfMonthInt = date.getUTCDate();
|
|
623
|
+
const hoursInt = date.getUTCHours();
|
|
624
|
+
const minutesInt = date.getUTCMinutes();
|
|
625
|
+
const secondsInt = date.getUTCSeconds();
|
|
626
|
+
const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`;
|
|
627
|
+
const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`;
|
|
628
|
+
const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`;
|
|
629
|
+
const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`;
|
|
630
|
+
return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`;
|
|
631
|
+
}
|
|
632
|
+
var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
|
|
633
|
+
var parseRfc3339DateTime = (value) => {
|
|
634
|
+
if (value === null || value === void 0) {
|
|
635
|
+
return void 0;
|
|
636
|
+
}
|
|
637
|
+
if (typeof value !== "string") {
|
|
638
|
+
throw new TypeError("RFC-3339 date-times must be expressed as strings");
|
|
639
|
+
}
|
|
640
|
+
const match = RFC3339.exec(value);
|
|
641
|
+
if (!match) {
|
|
642
|
+
throw new TypeError("Invalid RFC-3339 date-time value");
|
|
643
|
+
}
|
|
644
|
+
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
645
|
+
const year = strictParseShort(stripLeadingZeroes(yearStr));
|
|
646
|
+
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
647
|
+
const day = parseDateValue(dayStr, "day", 1, 31);
|
|
648
|
+
return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
|
|
649
|
+
};
|
|
650
|
+
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])$/);
|
|
651
|
+
var parseRfc3339DateTimeWithOffset = (value) => {
|
|
652
|
+
if (value === null || value === void 0) {
|
|
653
|
+
return void 0;
|
|
654
|
+
}
|
|
655
|
+
if (typeof value !== "string") {
|
|
656
|
+
throw new TypeError("RFC-3339 date-times must be expressed as strings");
|
|
657
|
+
}
|
|
658
|
+
const match = RFC3339_WITH_OFFSET.exec(value);
|
|
659
|
+
if (!match) {
|
|
660
|
+
throw new TypeError("Invalid RFC-3339 date-time value");
|
|
661
|
+
}
|
|
662
|
+
const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match;
|
|
663
|
+
const year = strictParseShort(stripLeadingZeroes(yearStr));
|
|
664
|
+
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
665
|
+
const day = parseDateValue(dayStr, "day", 1, 31);
|
|
666
|
+
const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
|
|
667
|
+
if (offsetStr.toUpperCase() != "Z") {
|
|
668
|
+
date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr));
|
|
669
|
+
}
|
|
670
|
+
return date;
|
|
671
|
+
};
|
|
672
|
+
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$/);
|
|
673
|
+
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$/);
|
|
674
|
+
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})$/);
|
|
675
|
+
var parseRfc7231DateTime = (value) => {
|
|
676
|
+
if (value === null || value === void 0) {
|
|
677
|
+
return void 0;
|
|
678
|
+
}
|
|
679
|
+
if (typeof value !== "string") {
|
|
680
|
+
throw new TypeError("RFC-7231 date-times must be expressed as strings");
|
|
681
|
+
}
|
|
682
|
+
let match = IMF_FIXDATE.exec(value);
|
|
683
|
+
if (match) {
|
|
684
|
+
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
685
|
+
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
|
|
686
|
+
}
|
|
687
|
+
match = RFC_850_DATE.exec(value);
|
|
688
|
+
if (match) {
|
|
689
|
+
const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
|
|
690
|
+
return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
|
|
691
|
+
hours,
|
|
692
|
+
minutes,
|
|
693
|
+
seconds,
|
|
694
|
+
fractionalMilliseconds
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
match = ASC_TIME.exec(value);
|
|
698
|
+
if (match) {
|
|
699
|
+
const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
|
|
700
|
+
return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
|
|
701
|
+
}
|
|
702
|
+
throw new TypeError("Invalid RFC-7231 date-time value");
|
|
703
|
+
};
|
|
704
|
+
var parseEpochTimestamp = (value) => {
|
|
705
|
+
if (value === null || value === void 0) {
|
|
706
|
+
return void 0;
|
|
707
|
+
}
|
|
708
|
+
let valueAsDouble;
|
|
709
|
+
if (typeof value === "number") {
|
|
710
|
+
valueAsDouble = value;
|
|
711
|
+
} else if (typeof value === "string") {
|
|
712
|
+
valueAsDouble = strictParseDouble(value);
|
|
713
|
+
} else if (typeof value === "object" && value.tag === 1) {
|
|
714
|
+
valueAsDouble = value.value;
|
|
715
|
+
} else {
|
|
716
|
+
throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
|
|
717
|
+
}
|
|
718
|
+
if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) {
|
|
719
|
+
throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
|
|
720
|
+
}
|
|
721
|
+
return new Date(Math.round(valueAsDouble * 1e3));
|
|
722
|
+
};
|
|
723
|
+
var buildDate = (year, month, day, time) => {
|
|
724
|
+
const adjustedMonth = month - 1;
|
|
725
|
+
validateDayOfMonth(year, adjustedMonth, day);
|
|
726
|
+
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)));
|
|
727
|
+
};
|
|
728
|
+
var parseTwoDigitYear = (value) => {
|
|
729
|
+
const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
730
|
+
const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value));
|
|
731
|
+
if (valueInThisCentury < thisYear) {
|
|
732
|
+
return valueInThisCentury + 100;
|
|
733
|
+
}
|
|
734
|
+
return valueInThisCentury;
|
|
735
|
+
};
|
|
736
|
+
var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3;
|
|
737
|
+
var adjustRfc850Year = (input) => {
|
|
738
|
+
if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) {
|
|
739
|
+
return new Date(Date.UTC(input.getUTCFullYear() - 100, input.getUTCMonth(), input.getUTCDate(), input.getUTCHours(), input.getUTCMinutes(), input.getUTCSeconds(), input.getUTCMilliseconds()));
|
|
740
|
+
}
|
|
741
|
+
return input;
|
|
742
|
+
};
|
|
743
|
+
var parseMonthByShortName = (value) => {
|
|
744
|
+
const monthIdx = MONTHS.indexOf(value);
|
|
745
|
+
if (monthIdx < 0) {
|
|
746
|
+
throw new TypeError(`Invalid month: ${value}`);
|
|
747
|
+
}
|
|
748
|
+
return monthIdx + 1;
|
|
749
|
+
};
|
|
750
|
+
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
751
|
+
var validateDayOfMonth = (year, month, day) => {
|
|
752
|
+
let maxDays = DAYS_IN_MONTH[month];
|
|
753
|
+
if (month === 1 && isLeapYear(year)) {
|
|
754
|
+
maxDays = 29;
|
|
755
|
+
}
|
|
756
|
+
if (day > maxDays) {
|
|
757
|
+
throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`);
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
var isLeapYear = (year) => {
|
|
761
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
762
|
+
};
|
|
763
|
+
var parseDateValue = (value, type, lower, upper) => {
|
|
764
|
+
const dateVal = strictParseByte(stripLeadingZeroes(value));
|
|
765
|
+
if (dateVal < lower || dateVal > upper) {
|
|
766
|
+
throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
|
|
767
|
+
}
|
|
768
|
+
return dateVal;
|
|
769
|
+
};
|
|
770
|
+
var parseMilliseconds = (value) => {
|
|
771
|
+
if (value === null || value === void 0) {
|
|
772
|
+
return 0;
|
|
773
|
+
}
|
|
774
|
+
return strictParseFloat32("0." + value) * 1e3;
|
|
775
|
+
};
|
|
776
|
+
var parseOffsetToMilliseconds = (value) => {
|
|
777
|
+
const directionStr = value[0];
|
|
778
|
+
let direction = 1;
|
|
779
|
+
if (directionStr == "+") {
|
|
780
|
+
direction = 1;
|
|
781
|
+
} else if (directionStr == "-") {
|
|
782
|
+
direction = -1;
|
|
783
|
+
} else {
|
|
784
|
+
throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);
|
|
785
|
+
}
|
|
786
|
+
const hour = Number(value.substring(1, 3));
|
|
787
|
+
const minute = Number(value.substring(4, 6));
|
|
788
|
+
return direction * (hour * 60 + minute) * 60 * 1e3;
|
|
789
|
+
};
|
|
790
|
+
var stripLeadingZeroes = (value) => {
|
|
791
|
+
let idx = 0;
|
|
792
|
+
while (idx < value.length - 1 && value.charAt(idx) === "0") {
|
|
793
|
+
idx++;
|
|
794
|
+
}
|
|
795
|
+
if (idx === 0) {
|
|
796
|
+
return value;
|
|
797
|
+
}
|
|
798
|
+
return value.slice(idx);
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
// ../../node_modules/.pnpm/@smithy+util-base64@4.3.2/node_modules/@smithy/util-base64/dist-es/fromBase64.js
|
|
802
|
+
var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
803
|
+
var fromBase64 = (input) => {
|
|
804
|
+
if (input.length * 3 % 4 !== 0) {
|
|
805
|
+
throw new TypeError(`Incorrect padding on base64 string.`);
|
|
806
|
+
}
|
|
807
|
+
if (!BASE64_REGEX.exec(input)) {
|
|
808
|
+
throw new TypeError(`Invalid base64 string.`);
|
|
809
|
+
}
|
|
810
|
+
const buffer = fromString(input, "base64");
|
|
811
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
// ../../node_modules/.pnpm/@smithy+util-base64@4.3.2/node_modules/@smithy/util-base64/dist-es/toBase64.js
|
|
815
|
+
var toBase64 = (_input) => {
|
|
816
|
+
let input;
|
|
817
|
+
if (typeof _input === "string") {
|
|
818
|
+
input = fromUtf8(_input);
|
|
819
|
+
} else {
|
|
820
|
+
input = _input;
|
|
821
|
+
}
|
|
822
|
+
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
823
|
+
throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
|
|
824
|
+
}
|
|
825
|
+
return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("base64");
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// ../../node_modules/.pnpm/@smithy+util-hex-encoding@4.2.2/node_modules/@smithy/util-hex-encoding/dist-es/index.js
|
|
829
|
+
var SHORT_TO_HEX = {};
|
|
830
|
+
var HEX_TO_SHORT = {};
|
|
831
|
+
for (let i = 0; i < 256; i++) {
|
|
832
|
+
let encodedByte = i.toString(16).toLowerCase();
|
|
833
|
+
if (encodedByte.length === 1) {
|
|
834
|
+
encodedByte = `0${encodedByte}`;
|
|
835
|
+
}
|
|
836
|
+
SHORT_TO_HEX[i] = encodedByte;
|
|
837
|
+
HEX_TO_SHORT[encodedByte] = i;
|
|
838
|
+
}
|
|
839
|
+
function fromHex(encoded) {
|
|
840
|
+
if (encoded.length % 2 !== 0) {
|
|
841
|
+
throw new Error("Hex encoded strings must have an even number length");
|
|
842
|
+
}
|
|
843
|
+
const out = new Uint8Array(encoded.length / 2);
|
|
844
|
+
for (let i = 0; i < encoded.length; i += 2) {
|
|
845
|
+
const encodedByte = encoded.slice(i, i + 2).toLowerCase();
|
|
846
|
+
if (encodedByte in HEX_TO_SHORT) {
|
|
847
|
+
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
848
|
+
} else {
|
|
849
|
+
throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return out;
|
|
853
|
+
}
|
|
854
|
+
function toHex(bytes) {
|
|
855
|
+
let out = "";
|
|
856
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
857
|
+
out += SHORT_TO_HEX[bytes[i]];
|
|
858
|
+
}
|
|
859
|
+
return out;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export {
|
|
863
|
+
HttpResponse,
|
|
864
|
+
fromBase64,
|
|
865
|
+
toBase64,
|
|
866
|
+
escapeUri,
|
|
867
|
+
NodeHttpHandler,
|
|
868
|
+
streamCollector,
|
|
869
|
+
fromHex,
|
|
870
|
+
toHex,
|
|
871
|
+
dateToUtcString,
|
|
872
|
+
parseRfc3339DateTime,
|
|
873
|
+
parseRfc3339DateTimeWithOffset,
|
|
874
|
+
parseRfc7231DateTime,
|
|
875
|
+
parseEpochTimestamp
|
|
876
|
+
};
|