@etainabl/nodejs-sdk 1.3.192 → 1.3.196
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/dist/esm/index.js +1546 -9430
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +7745 -31978
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/esm/chunk-3G3VXGQN.js +0 -164
- package/dist/esm/chunk-3G3VXGQN.js.map +0 -1
- package/dist/esm/chunk-4JDZJVKZ.js +0 -29
- package/dist/esm/chunk-4JDZJVKZ.js.map +0 -1
- package/dist/esm/chunk-4QSQRVYQ.js +0 -4408
- package/dist/esm/chunk-4QSQRVYQ.js.map +0 -1
- package/dist/esm/chunk-7QBJXGSP.js +0 -143
- package/dist/esm/chunk-7QBJXGSP.js.map +0 -1
- package/dist/esm/chunk-CRX53WMM.js +0 -222
- package/dist/esm/chunk-CRX53WMM.js.map +0 -1
- package/dist/esm/chunk-D74LA2XQ.js +0 -773
- package/dist/esm/chunk-D74LA2XQ.js.map +0 -1
- package/dist/esm/chunk-G3PMV62Z.js +0 -36
- package/dist/esm/chunk-G3PMV62Z.js.map +0 -1
- package/dist/esm/chunk-IX2LY325.js +0 -38
- package/dist/esm/chunk-IX2LY325.js.map +0 -1
- package/dist/esm/chunk-KWPO3OOT.js +0 -180
- package/dist/esm/chunk-KWPO3OOT.js.map +0 -1
- package/dist/esm/chunk-MCSCBMNG.js +0 -1424
- package/dist/esm/chunk-MCSCBMNG.js.map +0 -1
- package/dist/esm/chunk-RREOR7G6.js +0 -9
- package/dist/esm/chunk-RREOR7G6.js.map +0 -1
- package/dist/esm/chunk-UQAJZJ7E.js +0 -11
- package/dist/esm/chunk-UQAJZJ7E.js.map +0 -1
- package/dist/esm/chunk-UZGMBQZB.js +0 -13
- package/dist/esm/chunk-UZGMBQZB.js.map +0 -1
- package/dist/esm/chunk-XARQOPCZ.js +0 -47
- package/dist/esm/chunk-XARQOPCZ.js.map +0 -1
- package/dist/esm/chunk-YCRW5ZB7.js +0 -257
- package/dist/esm/chunk-YCRW5ZB7.js.map +0 -1
- package/dist/esm/chunk-YLT3BSXS.js +0 -180
- package/dist/esm/chunk-YLT3BSXS.js.map +0 -1
- package/dist/esm/chunk-Z63CAAFL.js +0 -43
- package/dist/esm/chunk-Z63CAAFL.js.map +0 -1
- package/dist/esm/dist-es-4VSEUPMG.js +0 -168
- package/dist/esm/dist-es-4VSEUPMG.js.map +0 -1
- package/dist/esm/dist-es-5G2D4IRG.js +0 -88
- package/dist/esm/dist-es-5G2D4IRG.js.map +0 -1
- package/dist/esm/dist-es-6PYQFA7S.js +0 -68
- package/dist/esm/dist-es-6PYQFA7S.js.map +0 -1
- package/dist/esm/dist-es-O7YXE2TO.js +0 -381
- package/dist/esm/dist-es-O7YXE2TO.js.map +0 -1
- package/dist/esm/dist-es-RVUNLU7U.js +0 -314
- package/dist/esm/dist-es-RVUNLU7U.js.map +0 -1
- package/dist/esm/dist-es-UEBBJXWA.js +0 -22
- package/dist/esm/dist-es-UEBBJXWA.js.map +0 -1
- package/dist/esm/dist-es-XS4DOSVC.js +0 -202
- package/dist/esm/dist-es-XS4DOSVC.js.map +0 -1
- package/dist/esm/event-streams-OE4R7Y65.js +0 -238
- package/dist/esm/event-streams-OE4R7Y65.js.map +0 -1
- package/dist/esm/loadSso-3FHKR3DN.js +0 -662
- package/dist/esm/loadSso-3FHKR3DN.js.map +0 -1
- package/dist/esm/sso-oidc-EORQ3JVU.js +0 -832
- package/dist/esm/sso-oidc-EORQ3JVU.js.map +0 -1
- package/dist/esm/sts-VPLY2J63.js +0 -1169
- package/dist/esm/sts-VPLY2J63.js.map +0 -1
|
@@ -1,773 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fromArrayBuffer,
|
|
3
|
-
fromString,
|
|
4
|
-
fromUtf8
|
|
5
|
-
} from "./chunk-Z63CAAFL.js";
|
|
6
|
-
|
|
7
|
-
// node_modules/@smithy/protocol-http/dist-es/httpRequest.js
|
|
8
|
-
var HttpRequest = class _HttpRequest {
|
|
9
|
-
method;
|
|
10
|
-
protocol;
|
|
11
|
-
hostname;
|
|
12
|
-
port;
|
|
13
|
-
path;
|
|
14
|
-
query;
|
|
15
|
-
headers;
|
|
16
|
-
username;
|
|
17
|
-
password;
|
|
18
|
-
fragment;
|
|
19
|
-
body;
|
|
20
|
-
constructor(options) {
|
|
21
|
-
this.method = options.method || "GET";
|
|
22
|
-
this.hostname = options.hostname || "localhost";
|
|
23
|
-
this.port = options.port;
|
|
24
|
-
this.query = options.query || {};
|
|
25
|
-
this.headers = options.headers || {};
|
|
26
|
-
this.body = options.body;
|
|
27
|
-
this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
|
|
28
|
-
this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
|
|
29
|
-
this.username = options.username;
|
|
30
|
-
this.password = options.password;
|
|
31
|
-
this.fragment = options.fragment;
|
|
32
|
-
}
|
|
33
|
-
static clone(request) {
|
|
34
|
-
const cloned = new _HttpRequest({
|
|
35
|
-
...request,
|
|
36
|
-
headers: { ...request.headers }
|
|
37
|
-
});
|
|
38
|
-
if (cloned.query) {
|
|
39
|
-
cloned.query = cloneQuery(cloned.query);
|
|
40
|
-
}
|
|
41
|
-
return cloned;
|
|
42
|
-
}
|
|
43
|
-
static isInstance(request) {
|
|
44
|
-
if (!request) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
const req = request;
|
|
48
|
-
return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
|
|
49
|
-
}
|
|
50
|
-
clone() {
|
|
51
|
-
return _HttpRequest.clone(this);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
function cloneQuery(query) {
|
|
55
|
-
return Object.keys(query).reduce((carry, paramName) => {
|
|
56
|
-
const param = query[paramName];
|
|
57
|
-
return {
|
|
58
|
-
...carry,
|
|
59
|
-
[paramName]: Array.isArray(param) ? [...param] : param
|
|
60
|
-
};
|
|
61
|
-
}, {});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// node_modules/@smithy/protocol-http/dist-es/httpResponse.js
|
|
65
|
-
var HttpResponse = class {
|
|
66
|
-
statusCode;
|
|
67
|
-
reason;
|
|
68
|
-
headers;
|
|
69
|
-
body;
|
|
70
|
-
constructor(options) {
|
|
71
|
-
this.statusCode = options.statusCode;
|
|
72
|
-
this.reason = options.reason;
|
|
73
|
-
this.headers = options.headers || {};
|
|
74
|
-
this.body = options.body;
|
|
75
|
-
}
|
|
76
|
-
static isInstance(response) {
|
|
77
|
-
if (!response)
|
|
78
|
-
return false;
|
|
79
|
-
const resp = response;
|
|
80
|
-
return typeof resp.statusCode === "number" && typeof resp.headers === "object";
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
|
|
85
|
-
var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
|
|
86
|
-
var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
87
|
-
|
|
88
|
-
// node_modules/@smithy/querystring-builder/dist-es/index.js
|
|
89
|
-
function buildQueryString(query) {
|
|
90
|
-
const parts = [];
|
|
91
|
-
for (let key of Object.keys(query).sort()) {
|
|
92
|
-
const value = query[key];
|
|
93
|
-
key = escapeUri(key);
|
|
94
|
-
if (Array.isArray(value)) {
|
|
95
|
-
for (let i = 0, iLen = value.length; i < iLen; i++) {
|
|
96
|
-
parts.push(`${key}=${escapeUri(value[i])}`);
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
let qsEntry = key;
|
|
100
|
-
if (value || typeof value === "string") {
|
|
101
|
-
qsEntry += `=${escapeUri(value)}`;
|
|
102
|
-
}
|
|
103
|
-
parts.push(qsEntry);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return parts.join("&");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
|
|
110
|
-
import { Agent as hAgent, request as hRequest } from "http";
|
|
111
|
-
import { Agent as hsAgent, request as hsRequest } from "https";
|
|
112
|
-
|
|
113
|
-
// node_modules/@smithy/node-http-handler/dist-es/constants.js
|
|
114
|
-
var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
|
|
115
|
-
|
|
116
|
-
// node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
|
|
117
|
-
var getTransformedHeaders = (headers) => {
|
|
118
|
-
const transformedHeaders = {};
|
|
119
|
-
for (const name of Object.keys(headers)) {
|
|
120
|
-
const headerValues = headers[name];
|
|
121
|
-
transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
|
|
122
|
-
}
|
|
123
|
-
return transformedHeaders;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// node_modules/@smithy/node-http-handler/dist-es/timing.js
|
|
127
|
-
var timing = {
|
|
128
|
-
setTimeout: (cb, ms) => setTimeout(cb, ms),
|
|
129
|
-
clearTimeout: (timeoutId) => clearTimeout(timeoutId)
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
|
|
133
|
-
var DEFER_EVENT_LISTENER_TIME = 1e3;
|
|
134
|
-
var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
135
|
-
if (!timeoutInMs) {
|
|
136
|
-
return -1;
|
|
137
|
-
}
|
|
138
|
-
const registerTimeout = (offset) => {
|
|
139
|
-
const timeoutId = timing.setTimeout(() => {
|
|
140
|
-
request.destroy();
|
|
141
|
-
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.`), {
|
|
142
|
-
name: "TimeoutError"
|
|
143
|
-
}));
|
|
144
|
-
}, timeoutInMs - offset);
|
|
145
|
-
const doWithSocket = (socket) => {
|
|
146
|
-
if (socket?.connecting) {
|
|
147
|
-
socket.on("connect", () => {
|
|
148
|
-
timing.clearTimeout(timeoutId);
|
|
149
|
-
});
|
|
150
|
-
} else {
|
|
151
|
-
timing.clearTimeout(timeoutId);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
if (request.socket) {
|
|
155
|
-
doWithSocket(request.socket);
|
|
156
|
-
} else {
|
|
157
|
-
request.on("socket", doWithSocket);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
if (timeoutInMs < 2e3) {
|
|
161
|
-
registerTimeout(0);
|
|
162
|
-
return 0;
|
|
163
|
-
}
|
|
164
|
-
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js
|
|
168
|
-
var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger2) => {
|
|
169
|
-
if (timeoutInMs) {
|
|
170
|
-
return timing.setTimeout(() => {
|
|
171
|
-
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
172
|
-
if (throwOnRequestTimeout) {
|
|
173
|
-
const error = Object.assign(new Error(msg), {
|
|
174
|
-
name: "TimeoutError",
|
|
175
|
-
code: "ETIMEDOUT"
|
|
176
|
-
});
|
|
177
|
-
req.destroy(error);
|
|
178
|
-
reject(error);
|
|
179
|
-
} else {
|
|
180
|
-
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
181
|
-
logger2?.warn?.(msg);
|
|
182
|
-
}
|
|
183
|
-
}, timeoutInMs);
|
|
184
|
-
}
|
|
185
|
-
return -1;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
|
|
189
|
-
var DEFER_EVENT_LISTENER_TIME2 = 3e3;
|
|
190
|
-
var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
|
|
191
|
-
if (keepAlive !== true) {
|
|
192
|
-
return -1;
|
|
193
|
-
}
|
|
194
|
-
const registerListener = () => {
|
|
195
|
-
if (request.socket) {
|
|
196
|
-
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
197
|
-
} else {
|
|
198
|
-
request.on("socket", (socket) => {
|
|
199
|
-
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
if (deferTimeMs === 0) {
|
|
204
|
-
registerListener();
|
|
205
|
-
return 0;
|
|
206
|
-
}
|
|
207
|
-
return timing.setTimeout(registerListener, deferTimeMs);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
// node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
|
|
211
|
-
var DEFER_EVENT_LISTENER_TIME3 = 3e3;
|
|
212
|
-
var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
213
|
-
const registerTimeout = (offset) => {
|
|
214
|
-
const timeout = timeoutInMs - offset;
|
|
215
|
-
const onTimeout = () => {
|
|
216
|
-
request.destroy();
|
|
217
|
-
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" }));
|
|
218
|
-
};
|
|
219
|
-
if (request.socket) {
|
|
220
|
-
request.socket.setTimeout(timeout, onTimeout);
|
|
221
|
-
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
222
|
-
} else {
|
|
223
|
-
request.setTimeout(timeout, onTimeout);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
if (0 < timeoutInMs && timeoutInMs < 6e3) {
|
|
227
|
-
registerTimeout(0);
|
|
228
|
-
return 0;
|
|
229
|
-
}
|
|
230
|
-
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
// node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
|
|
234
|
-
import { Readable } from "stream";
|
|
235
|
-
var MIN_WAIT_TIME = 6e3;
|
|
236
|
-
async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
|
|
237
|
-
const headers = request.headers ?? {};
|
|
238
|
-
const expect = headers.Expect || headers.expect;
|
|
239
|
-
let timeoutId = -1;
|
|
240
|
-
let sendBody = true;
|
|
241
|
-
if (!externalAgent && expect === "100-continue") {
|
|
242
|
-
sendBody = await Promise.race([
|
|
243
|
-
new Promise((resolve) => {
|
|
244
|
-
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
245
|
-
}),
|
|
246
|
-
new Promise((resolve) => {
|
|
247
|
-
httpRequest.on("continue", () => {
|
|
248
|
-
timing.clearTimeout(timeoutId);
|
|
249
|
-
resolve(true);
|
|
250
|
-
});
|
|
251
|
-
httpRequest.on("response", () => {
|
|
252
|
-
timing.clearTimeout(timeoutId);
|
|
253
|
-
resolve(false);
|
|
254
|
-
});
|
|
255
|
-
httpRequest.on("error", () => {
|
|
256
|
-
timing.clearTimeout(timeoutId);
|
|
257
|
-
resolve(false);
|
|
258
|
-
});
|
|
259
|
-
})
|
|
260
|
-
]);
|
|
261
|
-
}
|
|
262
|
-
if (sendBody) {
|
|
263
|
-
writeBody(httpRequest, request.body);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function writeBody(httpRequest, body) {
|
|
267
|
-
if (body instanceof Readable) {
|
|
268
|
-
body.pipe(httpRequest);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
if (body) {
|
|
272
|
-
if (Buffer.isBuffer(body) || typeof body === "string") {
|
|
273
|
-
httpRequest.end(body);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
const uint8 = body;
|
|
277
|
-
if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
|
|
278
|
-
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
httpRequest.end(Buffer.from(body));
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
httpRequest.end();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
|
|
288
|
-
var NodeHttpHandler = class _NodeHttpHandler {
|
|
289
|
-
config;
|
|
290
|
-
configProvider;
|
|
291
|
-
socketWarningTimestamp = 0;
|
|
292
|
-
externalAgent = false;
|
|
293
|
-
metadata = { handlerProtocol: "http/1.1" };
|
|
294
|
-
static create(instanceOrOptions) {
|
|
295
|
-
if (typeof instanceOrOptions?.handle === "function") {
|
|
296
|
-
return instanceOrOptions;
|
|
297
|
-
}
|
|
298
|
-
return new _NodeHttpHandler(instanceOrOptions);
|
|
299
|
-
}
|
|
300
|
-
static checkSocketUsage(agent, socketWarningTimestamp, logger2 = console) {
|
|
301
|
-
const { sockets, requests, maxSockets } = agent;
|
|
302
|
-
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
303
|
-
return socketWarningTimestamp;
|
|
304
|
-
}
|
|
305
|
-
const interval = 15e3;
|
|
306
|
-
if (Date.now() - interval < socketWarningTimestamp) {
|
|
307
|
-
return socketWarningTimestamp;
|
|
308
|
-
}
|
|
309
|
-
if (sockets && requests) {
|
|
310
|
-
for (const origin in sockets) {
|
|
311
|
-
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
312
|
-
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
313
|
-
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
314
|
-
logger2?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
315
|
-
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
316
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
317
|
-
return Date.now();
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return socketWarningTimestamp;
|
|
322
|
-
}
|
|
323
|
-
constructor(options) {
|
|
324
|
-
this.configProvider = new Promise((resolve, reject) => {
|
|
325
|
-
if (typeof options === "function") {
|
|
326
|
-
options().then((_options) => {
|
|
327
|
-
resolve(this.resolveDefaultConfig(_options));
|
|
328
|
-
}).catch(reject);
|
|
329
|
-
} else {
|
|
330
|
-
resolve(this.resolveDefaultConfig(options));
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
resolveDefaultConfig(options) {
|
|
335
|
-
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout } = options || {};
|
|
336
|
-
const keepAlive = true;
|
|
337
|
-
const maxSockets = 50;
|
|
338
|
-
return {
|
|
339
|
-
connectionTimeout,
|
|
340
|
-
requestTimeout,
|
|
341
|
-
socketTimeout,
|
|
342
|
-
socketAcquisitionWarningTimeout,
|
|
343
|
-
throwOnRequestTimeout,
|
|
344
|
-
httpAgent: (() => {
|
|
345
|
-
if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
|
|
346
|
-
this.externalAgent = true;
|
|
347
|
-
return httpAgent;
|
|
348
|
-
}
|
|
349
|
-
return new hAgent({ keepAlive, maxSockets, ...httpAgent });
|
|
350
|
-
})(),
|
|
351
|
-
httpsAgent: (() => {
|
|
352
|
-
if (httpsAgent instanceof hsAgent || typeof httpsAgent?.destroy === "function") {
|
|
353
|
-
this.externalAgent = true;
|
|
354
|
-
return httpsAgent;
|
|
355
|
-
}
|
|
356
|
-
return new hsAgent({ keepAlive, maxSockets, ...httpsAgent });
|
|
357
|
-
})(),
|
|
358
|
-
logger: console
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
destroy() {
|
|
362
|
-
this.config?.httpAgent?.destroy();
|
|
363
|
-
this.config?.httpsAgent?.destroy();
|
|
364
|
-
}
|
|
365
|
-
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
366
|
-
if (!this.config) {
|
|
367
|
-
this.config = await this.configProvider;
|
|
368
|
-
}
|
|
369
|
-
return new Promise((_resolve, _reject) => {
|
|
370
|
-
const config = this.config;
|
|
371
|
-
let writeRequestBodyPromise = void 0;
|
|
372
|
-
const timeouts = [];
|
|
373
|
-
const resolve = async (arg) => {
|
|
374
|
-
await writeRequestBodyPromise;
|
|
375
|
-
timeouts.forEach(timing.clearTimeout);
|
|
376
|
-
_resolve(arg);
|
|
377
|
-
};
|
|
378
|
-
const reject = async (arg) => {
|
|
379
|
-
await writeRequestBodyPromise;
|
|
380
|
-
timeouts.forEach(timing.clearTimeout);
|
|
381
|
-
_reject(arg);
|
|
382
|
-
};
|
|
383
|
-
if (abortSignal?.aborted) {
|
|
384
|
-
const abortError = new Error("Request aborted");
|
|
385
|
-
abortError.name = "AbortError";
|
|
386
|
-
reject(abortError);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
const isSSL = request.protocol === "https:";
|
|
390
|
-
const headers = request.headers ?? {};
|
|
391
|
-
const expectContinue = (headers.Expect ?? headers.expect) === "100-continue";
|
|
392
|
-
let agent = isSSL ? config.httpsAgent : config.httpAgent;
|
|
393
|
-
if (expectContinue && !this.externalAgent) {
|
|
394
|
-
agent = new (isSSL ? hsAgent : hAgent)({
|
|
395
|
-
keepAlive: false,
|
|
396
|
-
maxSockets: Infinity
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
timeouts.push(timing.setTimeout(() => {
|
|
400
|
-
this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, config.logger);
|
|
401
|
-
}, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2e3) + (config.connectionTimeout ?? 1e3)));
|
|
402
|
-
const queryString = buildQueryString(request.query || {});
|
|
403
|
-
let auth = void 0;
|
|
404
|
-
if (request.username != null || request.password != null) {
|
|
405
|
-
const username = request.username ?? "";
|
|
406
|
-
const password = request.password ?? "";
|
|
407
|
-
auth = `${username}:${password}`;
|
|
408
|
-
}
|
|
409
|
-
let path = request.path;
|
|
410
|
-
if (queryString) {
|
|
411
|
-
path += `?${queryString}`;
|
|
412
|
-
}
|
|
413
|
-
if (request.fragment) {
|
|
414
|
-
path += `#${request.fragment}`;
|
|
415
|
-
}
|
|
416
|
-
let hostname = request.hostname ?? "";
|
|
417
|
-
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
418
|
-
hostname = request.hostname.slice(1, -1);
|
|
419
|
-
} else {
|
|
420
|
-
hostname = request.hostname;
|
|
421
|
-
}
|
|
422
|
-
const nodeHttpsOptions = {
|
|
423
|
-
headers: request.headers,
|
|
424
|
-
host: hostname,
|
|
425
|
-
method: request.method,
|
|
426
|
-
path,
|
|
427
|
-
port: request.port,
|
|
428
|
-
agent,
|
|
429
|
-
auth
|
|
430
|
-
};
|
|
431
|
-
const requestFunc = isSSL ? hsRequest : hRequest;
|
|
432
|
-
const req = requestFunc(nodeHttpsOptions, (res) => {
|
|
433
|
-
const httpResponse = new HttpResponse({
|
|
434
|
-
statusCode: res.statusCode || -1,
|
|
435
|
-
reason: res.statusMessage,
|
|
436
|
-
headers: getTransformedHeaders(res.headers),
|
|
437
|
-
body: res
|
|
438
|
-
});
|
|
439
|
-
resolve({ response: httpResponse });
|
|
440
|
-
});
|
|
441
|
-
req.on("error", (err) => {
|
|
442
|
-
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
443
|
-
reject(Object.assign(err, { name: "TimeoutError" }));
|
|
444
|
-
} else {
|
|
445
|
-
reject(err);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
if (abortSignal) {
|
|
449
|
-
const onAbort = () => {
|
|
450
|
-
req.destroy();
|
|
451
|
-
const abortError = new Error("Request aborted");
|
|
452
|
-
abortError.name = "AbortError";
|
|
453
|
-
reject(abortError);
|
|
454
|
-
};
|
|
455
|
-
if (typeof abortSignal.addEventListener === "function") {
|
|
456
|
-
const signal = abortSignal;
|
|
457
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
458
|
-
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
459
|
-
} else {
|
|
460
|
-
abortSignal.onabort = onAbort;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
464
|
-
timeouts.push(setConnectionTimeout(req, reject, config.connectionTimeout));
|
|
465
|
-
timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, config.logger ?? console));
|
|
466
|
-
timeouts.push(setSocketTimeout(req, reject, config.socketTimeout));
|
|
467
|
-
const httpAgent = nodeHttpsOptions.agent;
|
|
468
|
-
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
469
|
-
timeouts.push(setSocketKeepAlive(req, {
|
|
470
|
-
keepAlive: httpAgent.keepAlive,
|
|
471
|
-
keepAliveMsecs: httpAgent.keepAliveMsecs
|
|
472
|
-
}));
|
|
473
|
-
}
|
|
474
|
-
writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout, this.externalAgent).catch((e) => {
|
|
475
|
-
timeouts.forEach(timing.clearTimeout);
|
|
476
|
-
return _reject(e);
|
|
477
|
-
});
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
updateHttpClientConfig(key, value) {
|
|
481
|
-
this.config = void 0;
|
|
482
|
-
this.configProvider = this.configProvider.then((config) => {
|
|
483
|
-
return {
|
|
484
|
-
...config,
|
|
485
|
-
[key]: value
|
|
486
|
-
};
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
httpHandlerConfigs() {
|
|
490
|
-
return this.config ?? {};
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js
|
|
495
|
-
import { Writable } from "stream";
|
|
496
|
-
var Collector = class extends Writable {
|
|
497
|
-
bufferedBytes = [];
|
|
498
|
-
_write(chunk, encoding, callback) {
|
|
499
|
-
this.bufferedBytes.push(chunk);
|
|
500
|
-
callback();
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
// node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js
|
|
505
|
-
var streamCollector = (stream) => {
|
|
506
|
-
if (isReadableStreamInstance(stream)) {
|
|
507
|
-
return collectReadableStream(stream);
|
|
508
|
-
}
|
|
509
|
-
return new Promise((resolve, reject) => {
|
|
510
|
-
const collector = new Collector();
|
|
511
|
-
stream.pipe(collector);
|
|
512
|
-
stream.on("error", (err) => {
|
|
513
|
-
collector.end();
|
|
514
|
-
reject(err);
|
|
515
|
-
});
|
|
516
|
-
collector.on("error", reject);
|
|
517
|
-
collector.on("finish", function() {
|
|
518
|
-
const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
519
|
-
resolve(bytes);
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
};
|
|
523
|
-
var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
524
|
-
async function collectReadableStream(stream) {
|
|
525
|
-
const chunks = [];
|
|
526
|
-
const reader = stream.getReader();
|
|
527
|
-
let isDone = false;
|
|
528
|
-
let length = 0;
|
|
529
|
-
while (!isDone) {
|
|
530
|
-
const { done, value } = await reader.read();
|
|
531
|
-
if (value) {
|
|
532
|
-
chunks.push(value);
|
|
533
|
-
length += value.length;
|
|
534
|
-
}
|
|
535
|
-
isDone = done;
|
|
536
|
-
}
|
|
537
|
-
const collected = new Uint8Array(length);
|
|
538
|
-
let offset = 0;
|
|
539
|
-
for (const chunk of chunks) {
|
|
540
|
-
collected.set(chunk, offset);
|
|
541
|
-
offset += chunk.length;
|
|
542
|
-
}
|
|
543
|
-
return collected;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js
|
|
547
|
-
var parseBoolean = (value) => {
|
|
548
|
-
switch (value) {
|
|
549
|
-
case "true":
|
|
550
|
-
return true;
|
|
551
|
-
case "false":
|
|
552
|
-
return false;
|
|
553
|
-
default:
|
|
554
|
-
throw new Error(`Unable to parse boolean value "${value}"`);
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
var expectNumber = (value) => {
|
|
558
|
-
if (value === null || value === void 0) {
|
|
559
|
-
return void 0;
|
|
560
|
-
}
|
|
561
|
-
if (typeof value === "string") {
|
|
562
|
-
const parsed = parseFloat(value);
|
|
563
|
-
if (!Number.isNaN(parsed)) {
|
|
564
|
-
if (String(parsed) !== String(value)) {
|
|
565
|
-
logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
|
566
|
-
}
|
|
567
|
-
return parsed;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
if (typeof value === "number") {
|
|
571
|
-
return value;
|
|
572
|
-
}
|
|
573
|
-
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
|
|
574
|
-
};
|
|
575
|
-
var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
|
576
|
-
var expectFloat32 = (value) => {
|
|
577
|
-
const expected = expectNumber(value);
|
|
578
|
-
if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
|
|
579
|
-
if (Math.abs(expected) > MAX_FLOAT) {
|
|
580
|
-
throw new TypeError(`Expected 32-bit float, got ${value}`);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return expected;
|
|
584
|
-
};
|
|
585
|
-
var expectLong = (value) => {
|
|
586
|
-
if (value === null || value === void 0) {
|
|
587
|
-
return void 0;
|
|
588
|
-
}
|
|
589
|
-
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
|
590
|
-
return value;
|
|
591
|
-
}
|
|
592
|
-
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
|
|
593
|
-
};
|
|
594
|
-
var expectInt32 = (value) => expectSizedInt(value, 32);
|
|
595
|
-
var expectShort = (value) => expectSizedInt(value, 16);
|
|
596
|
-
var expectByte = (value) => expectSizedInt(value, 8);
|
|
597
|
-
var expectSizedInt = (value, size) => {
|
|
598
|
-
const expected = expectLong(value);
|
|
599
|
-
if (expected !== void 0 && castInt(expected, size) !== expected) {
|
|
600
|
-
throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
|
|
601
|
-
}
|
|
602
|
-
return expected;
|
|
603
|
-
};
|
|
604
|
-
var castInt = (value, size) => {
|
|
605
|
-
switch (size) {
|
|
606
|
-
case 32:
|
|
607
|
-
return Int32Array.of(value)[0];
|
|
608
|
-
case 16:
|
|
609
|
-
return Int16Array.of(value)[0];
|
|
610
|
-
case 8:
|
|
611
|
-
return Int8Array.of(value)[0];
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
var expectNonNull = (value, location) => {
|
|
615
|
-
if (value === null || value === void 0) {
|
|
616
|
-
if (location) {
|
|
617
|
-
throw new TypeError(`Expected a non-null value for ${location}`);
|
|
618
|
-
}
|
|
619
|
-
throw new TypeError("Expected a non-null value");
|
|
620
|
-
}
|
|
621
|
-
return value;
|
|
622
|
-
};
|
|
623
|
-
var expectObject = (value) => {
|
|
624
|
-
if (value === null || value === void 0) {
|
|
625
|
-
return void 0;
|
|
626
|
-
}
|
|
627
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
628
|
-
return value;
|
|
629
|
-
}
|
|
630
|
-
const receivedType = Array.isArray(value) ? "array" : typeof value;
|
|
631
|
-
throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
|
|
632
|
-
};
|
|
633
|
-
var expectString = (value) => {
|
|
634
|
-
if (value === null || value === void 0) {
|
|
635
|
-
return void 0;
|
|
636
|
-
}
|
|
637
|
-
if (typeof value === "string") {
|
|
638
|
-
return value;
|
|
639
|
-
}
|
|
640
|
-
if (["boolean", "number", "bigint"].includes(typeof value)) {
|
|
641
|
-
logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
|
|
642
|
-
return String(value);
|
|
643
|
-
}
|
|
644
|
-
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
|
|
645
|
-
};
|
|
646
|
-
var strictParseFloat32 = (value) => {
|
|
647
|
-
if (typeof value == "string") {
|
|
648
|
-
return expectFloat32(parseNumber(value));
|
|
649
|
-
}
|
|
650
|
-
return expectFloat32(value);
|
|
651
|
-
};
|
|
652
|
-
var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
|
|
653
|
-
var parseNumber = (value) => {
|
|
654
|
-
const matches = value.match(NUMBER_REGEX);
|
|
655
|
-
if (matches === null || matches[0].length !== value.length) {
|
|
656
|
-
throw new TypeError(`Expected real number, got implicit NaN`);
|
|
657
|
-
}
|
|
658
|
-
return parseFloat(value);
|
|
659
|
-
};
|
|
660
|
-
var strictParseLong = (value) => {
|
|
661
|
-
if (typeof value === "string") {
|
|
662
|
-
return expectLong(parseNumber(value));
|
|
663
|
-
}
|
|
664
|
-
return expectLong(value);
|
|
665
|
-
};
|
|
666
|
-
var strictParseInt32 = (value) => {
|
|
667
|
-
if (typeof value === "string") {
|
|
668
|
-
return expectInt32(parseNumber(value));
|
|
669
|
-
}
|
|
670
|
-
return expectInt32(value);
|
|
671
|
-
};
|
|
672
|
-
var strictParseShort = (value) => {
|
|
673
|
-
if (typeof value === "string") {
|
|
674
|
-
return expectShort(parseNumber(value));
|
|
675
|
-
}
|
|
676
|
-
return expectShort(value);
|
|
677
|
-
};
|
|
678
|
-
var strictParseByte = (value) => {
|
|
679
|
-
if (typeof value === "string") {
|
|
680
|
-
return expectByte(parseNumber(value));
|
|
681
|
-
}
|
|
682
|
-
return expectByte(value);
|
|
683
|
-
};
|
|
684
|
-
var stackTraceWarning = (message) => {
|
|
685
|
-
return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n");
|
|
686
|
-
};
|
|
687
|
-
var logger = {
|
|
688
|
-
warn: console.warn
|
|
689
|
-
};
|
|
690
|
-
|
|
691
|
-
// node_modules/@smithy/util-base64/dist-es/fromBase64.js
|
|
692
|
-
var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
693
|
-
var fromBase64 = (input) => {
|
|
694
|
-
if (input.length * 3 % 4 !== 0) {
|
|
695
|
-
throw new TypeError(`Incorrect padding on base64 string.`);
|
|
696
|
-
}
|
|
697
|
-
if (!BASE64_REGEX.exec(input)) {
|
|
698
|
-
throw new TypeError(`Invalid base64 string.`);
|
|
699
|
-
}
|
|
700
|
-
const buffer = fromString(input, "base64");
|
|
701
|
-
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
702
|
-
};
|
|
703
|
-
|
|
704
|
-
// node_modules/@smithy/util-base64/dist-es/toBase64.js
|
|
705
|
-
var toBase64 = (_input) => {
|
|
706
|
-
let input;
|
|
707
|
-
if (typeof _input === "string") {
|
|
708
|
-
input = fromUtf8(_input);
|
|
709
|
-
} else {
|
|
710
|
-
input = _input;
|
|
711
|
-
}
|
|
712
|
-
if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
|
|
713
|
-
throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
|
|
714
|
-
}
|
|
715
|
-
return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("base64");
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
// node_modules/@smithy/util-hex-encoding/dist-es/index.js
|
|
719
|
-
var SHORT_TO_HEX = {};
|
|
720
|
-
var HEX_TO_SHORT = {};
|
|
721
|
-
for (let i = 0; i < 256; i++) {
|
|
722
|
-
let encodedByte = i.toString(16).toLowerCase();
|
|
723
|
-
if (encodedByte.length === 1) {
|
|
724
|
-
encodedByte = `0${encodedByte}`;
|
|
725
|
-
}
|
|
726
|
-
SHORT_TO_HEX[i] = encodedByte;
|
|
727
|
-
HEX_TO_SHORT[encodedByte] = i;
|
|
728
|
-
}
|
|
729
|
-
function fromHex(encoded) {
|
|
730
|
-
if (encoded.length % 2 !== 0) {
|
|
731
|
-
throw new Error("Hex encoded strings must have an even number length");
|
|
732
|
-
}
|
|
733
|
-
const out = new Uint8Array(encoded.length / 2);
|
|
734
|
-
for (let i = 0; i < encoded.length; i += 2) {
|
|
735
|
-
const encodedByte = encoded.slice(i, i + 2).toLowerCase();
|
|
736
|
-
if (encodedByte in HEX_TO_SHORT) {
|
|
737
|
-
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
738
|
-
} else {
|
|
739
|
-
throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
return out;
|
|
743
|
-
}
|
|
744
|
-
function toHex(bytes) {
|
|
745
|
-
let out = "";
|
|
746
|
-
for (let i = 0; i < bytes.byteLength; i++) {
|
|
747
|
-
out += SHORT_TO_HEX[bytes[i]];
|
|
748
|
-
}
|
|
749
|
-
return out;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
export {
|
|
753
|
-
HttpRequest,
|
|
754
|
-
HttpResponse,
|
|
755
|
-
fromBase64,
|
|
756
|
-
toBase64,
|
|
757
|
-
escapeUri,
|
|
758
|
-
NodeHttpHandler,
|
|
759
|
-
streamCollector,
|
|
760
|
-
fromHex,
|
|
761
|
-
toHex,
|
|
762
|
-
parseBoolean,
|
|
763
|
-
expectInt32,
|
|
764
|
-
expectNonNull,
|
|
765
|
-
expectObject,
|
|
766
|
-
expectString,
|
|
767
|
-
strictParseFloat32,
|
|
768
|
-
strictParseLong,
|
|
769
|
-
strictParseInt32,
|
|
770
|
-
strictParseShort,
|
|
771
|
-
strictParseByte
|
|
772
|
-
};
|
|
773
|
-
//# sourceMappingURL=chunk-D74LA2XQ.js.map
|