replicas-mcp 0.2.7 → 0.2.9
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/index.js +307 -7633
- package/package.json +1 -2
- package/src/index.ts +7 -3
- package/tsup.config.ts +0 -6
- package/dist/bowser-QNXG5MCF.js +0 -2822
- package/dist/chunk-3X3IL2A6.js +0 -2094
- package/dist/chunk-C6IOMGXW.js +0 -1052
- package/dist/chunk-FIMT2XWG.js +0 -576
- package/dist/chunk-KEOQGGM5.js +0 -1490
- package/dist/chunk-NWBPSHNL.js +0 -2865
- package/dist/chunk-Q6JESX2O.js +0 -42
- package/dist/chunk-QIOBV22I.js +0 -436
- package/dist/dist-es-3DLRX4SC.js +0 -170
- package/dist/dist-es-7DMTLQRJ.js +0 -70
- package/dist/dist-es-B6XNMCQ4.js +0 -48
- package/dist/dist-es-KLEKEXIP.js +0 -88
- package/dist/dist-es-MAMFGWZS.js +0 -377
- package/dist/dist-es-V7ZJXG3C.js +0 -315
- package/dist/dist-es-VBWSM7AX.js +0 -485
- package/dist/event-streams-D47TMH7D.js +0 -1377
- package/dist/loadSso-4NJATGLO.js +0 -575
- package/dist/signin-HB5KQSHQ.js +0 -661
- package/dist/sso-oidc-7AKRONOU.js +0 -828
- package/dist/sts-WSDR725H.js +0 -5979
package/dist/chunk-Q6JESX2O.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
-
try {
|
|
16
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
-
} catch (e) {
|
|
18
|
-
throw mod = 0, e;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
__require,
|
|
40
|
-
__commonJS,
|
|
41
|
-
__toESM
|
|
42
|
-
};
|
package/dist/chunk-QIOBV22I.js
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
HttpResponse,
|
|
4
|
-
buildQueryString
|
|
5
|
-
} from "./chunk-3X3IL2A6.js";
|
|
6
|
-
|
|
7
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js
|
|
8
|
-
function buildAbortError(abortSignal) {
|
|
9
|
-
const reason = abortSignal && typeof abortSignal === "object" && "reason" in abortSignal ? abortSignal.reason : void 0;
|
|
10
|
-
if (reason) {
|
|
11
|
-
if (reason instanceof Error) {
|
|
12
|
-
const abortError3 = new Error("Request aborted");
|
|
13
|
-
abortError3.name = "AbortError";
|
|
14
|
-
abortError3.cause = reason;
|
|
15
|
-
return abortError3;
|
|
16
|
-
}
|
|
17
|
-
const abortError2 = new Error(String(reason));
|
|
18
|
-
abortError2.name = "AbortError";
|
|
19
|
-
return abortError2;
|
|
20
|
-
}
|
|
21
|
-
const abortError = new Error("Request aborted");
|
|
22
|
-
abortError.name = "AbortError";
|
|
23
|
-
return abortError;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/constants.js
|
|
27
|
-
var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
|
|
28
|
-
|
|
29
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
|
|
30
|
-
var getTransformedHeaders = (headers) => {
|
|
31
|
-
const transformedHeaders = {};
|
|
32
|
-
for (const name in headers) {
|
|
33
|
-
const headerValues = headers[name];
|
|
34
|
-
transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
|
|
35
|
-
}
|
|
36
|
-
return transformedHeaders;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/node-https.js
|
|
40
|
-
import node_https from "https";
|
|
41
|
-
|
|
42
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/timing.js
|
|
43
|
-
var timing = {
|
|
44
|
-
setTimeout: (cb, ms) => setTimeout(cb, ms),
|
|
45
|
-
clearTimeout: (timeoutId) => clearTimeout(timeoutId)
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
|
|
49
|
-
var DEFER_EVENT_LISTENER_TIME = 1e3;
|
|
50
|
-
var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
51
|
-
if (!timeoutInMs) {
|
|
52
|
-
return -1;
|
|
53
|
-
}
|
|
54
|
-
const registerTimeout = (offset) => {
|
|
55
|
-
const timeoutId = timing.setTimeout(() => {
|
|
56
|
-
request.destroy();
|
|
57
|
-
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.`), {
|
|
58
|
-
name: "TimeoutError"
|
|
59
|
-
}));
|
|
60
|
-
}, timeoutInMs - offset);
|
|
61
|
-
const doWithSocket = (socket) => {
|
|
62
|
-
if (socket?.connecting) {
|
|
63
|
-
socket.on("connect", () => {
|
|
64
|
-
timing.clearTimeout(timeoutId);
|
|
65
|
-
});
|
|
66
|
-
} else {
|
|
67
|
-
timing.clearTimeout(timeoutId);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
if (request.socket) {
|
|
71
|
-
doWithSocket(request.socket);
|
|
72
|
-
} else {
|
|
73
|
-
request.on("socket", doWithSocket);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
if (timeoutInMs < 2e3) {
|
|
77
|
-
registerTimeout(0);
|
|
78
|
-
return 0;
|
|
79
|
-
}
|
|
80
|
-
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js
|
|
84
|
-
var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
|
|
85
|
-
if (timeoutInMs) {
|
|
86
|
-
return timing.setTimeout(() => {
|
|
87
|
-
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
88
|
-
if (throwOnRequestTimeout) {
|
|
89
|
-
const error = Object.assign(new Error(msg), {
|
|
90
|
-
name: "TimeoutError",
|
|
91
|
-
code: "ETIMEDOUT"
|
|
92
|
-
});
|
|
93
|
-
req.destroy(error);
|
|
94
|
-
reject(error);
|
|
95
|
-
} else {
|
|
96
|
-
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
97
|
-
logger?.warn?.(msg);
|
|
98
|
-
}
|
|
99
|
-
}, timeoutInMs);
|
|
100
|
-
}
|
|
101
|
-
return -1;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
|
|
105
|
-
var DEFER_EVENT_LISTENER_TIME2 = 3e3;
|
|
106
|
-
var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
|
|
107
|
-
if (keepAlive !== true) {
|
|
108
|
-
return -1;
|
|
109
|
-
}
|
|
110
|
-
const registerListener = () => {
|
|
111
|
-
if (request.socket) {
|
|
112
|
-
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
113
|
-
} else {
|
|
114
|
-
request.on("socket", (socket) => {
|
|
115
|
-
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
if (deferTimeMs === 0) {
|
|
120
|
-
registerListener();
|
|
121
|
-
return 0;
|
|
122
|
-
}
|
|
123
|
-
return timing.setTimeout(registerListener, deferTimeMs);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
|
|
127
|
-
var DEFER_EVENT_LISTENER_TIME3 = 3e3;
|
|
128
|
-
var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
129
|
-
const registerTimeout = (offset) => {
|
|
130
|
-
const timeout = timeoutInMs - offset;
|
|
131
|
-
const onTimeout = () => {
|
|
132
|
-
request.destroy();
|
|
133
|
-
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" }));
|
|
134
|
-
};
|
|
135
|
-
if (request.socket) {
|
|
136
|
-
request.socket.setTimeout(timeout, onTimeout);
|
|
137
|
-
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
138
|
-
} else {
|
|
139
|
-
request.setTimeout(timeout, onTimeout);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
if (0 < timeoutInMs && timeoutInMs < 6e3) {
|
|
143
|
-
registerTimeout(0);
|
|
144
|
-
return 0;
|
|
145
|
-
}
|
|
146
|
-
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
|
|
150
|
-
import { Readable } from "stream";
|
|
151
|
-
var MIN_WAIT_TIME = 6e3;
|
|
152
|
-
async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
|
|
153
|
-
const headers = request.headers;
|
|
154
|
-
const expect = headers ? headers.Expect || headers.expect : void 0;
|
|
155
|
-
let timeoutId = -1;
|
|
156
|
-
let sendBody = true;
|
|
157
|
-
if (!externalAgent && expect === "100-continue") {
|
|
158
|
-
sendBody = await Promise.race([
|
|
159
|
-
new Promise((resolve) => {
|
|
160
|
-
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
161
|
-
}),
|
|
162
|
-
new Promise((resolve) => {
|
|
163
|
-
httpRequest.on("continue", () => {
|
|
164
|
-
timing.clearTimeout(timeoutId);
|
|
165
|
-
resolve(true);
|
|
166
|
-
});
|
|
167
|
-
httpRequest.on("response", () => {
|
|
168
|
-
timing.clearTimeout(timeoutId);
|
|
169
|
-
resolve(false);
|
|
170
|
-
});
|
|
171
|
-
httpRequest.on("error", () => {
|
|
172
|
-
timing.clearTimeout(timeoutId);
|
|
173
|
-
resolve(false);
|
|
174
|
-
});
|
|
175
|
-
})
|
|
176
|
-
]);
|
|
177
|
-
}
|
|
178
|
-
if (sendBody) {
|
|
179
|
-
writeBody(httpRequest, request.body);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function writeBody(httpRequest, body) {
|
|
183
|
-
if (body instanceof Readable) {
|
|
184
|
-
body.pipe(httpRequest);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (body) {
|
|
188
|
-
const isBuffer = Buffer.isBuffer(body);
|
|
189
|
-
const isString = typeof body === "string";
|
|
190
|
-
if (isBuffer || isString) {
|
|
191
|
-
if (isBuffer && body.byteLength === 0) {
|
|
192
|
-
httpRequest.end();
|
|
193
|
-
} else {
|
|
194
|
-
httpRequest.end(body);
|
|
195
|
-
}
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const uint8 = body;
|
|
199
|
-
if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
|
|
200
|
-
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
httpRequest.end(Buffer.from(body));
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
httpRequest.end();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// ../node_modules/.bun/@smithy+node-http-handler@4.7.7/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
|
|
210
|
-
var hAgent = void 0;
|
|
211
|
-
var hRequest = void 0;
|
|
212
|
-
var NodeHttpHandler = class _NodeHttpHandler {
|
|
213
|
-
config;
|
|
214
|
-
configProvider;
|
|
215
|
-
socketWarningTimestamp = 0;
|
|
216
|
-
externalAgent = false;
|
|
217
|
-
metadata = { handlerProtocol: "http/1.1" };
|
|
218
|
-
static create(instanceOrOptions) {
|
|
219
|
-
if (typeof instanceOrOptions?.handle === "function") {
|
|
220
|
-
return instanceOrOptions;
|
|
221
|
-
}
|
|
222
|
-
return new _NodeHttpHandler(instanceOrOptions);
|
|
223
|
-
}
|
|
224
|
-
static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
|
|
225
|
-
const { sockets, requests, maxSockets } = agent;
|
|
226
|
-
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
227
|
-
return socketWarningTimestamp;
|
|
228
|
-
}
|
|
229
|
-
const interval = 15e3;
|
|
230
|
-
if (Date.now() - interval < socketWarningTimestamp) {
|
|
231
|
-
return socketWarningTimestamp;
|
|
232
|
-
}
|
|
233
|
-
if (sockets && requests) {
|
|
234
|
-
for (const origin in sockets) {
|
|
235
|
-
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
236
|
-
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
237
|
-
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
238
|
-
logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
239
|
-
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
240
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
241
|
-
return Date.now();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return socketWarningTimestamp;
|
|
246
|
-
}
|
|
247
|
-
constructor(options) {
|
|
248
|
-
this.configProvider = new Promise((resolve, reject) => {
|
|
249
|
-
if (typeof options === "function") {
|
|
250
|
-
options().then((_options) => {
|
|
251
|
-
resolve(this.resolveDefaultConfig(_options));
|
|
252
|
-
}).catch(reject);
|
|
253
|
-
} else {
|
|
254
|
-
resolve(this.resolveDefaultConfig(options));
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
destroy() {
|
|
259
|
-
this.config?.httpAgent?.destroy();
|
|
260
|
-
this.config?.httpsAgent?.destroy();
|
|
261
|
-
}
|
|
262
|
-
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
263
|
-
if (!this.config) {
|
|
264
|
-
this.config = await this.configProvider;
|
|
265
|
-
}
|
|
266
|
-
const config = this.config;
|
|
267
|
-
const isSSL = request.protocol === "https:";
|
|
268
|
-
if (!isSSL && !this.config.httpAgent) {
|
|
269
|
-
this.config.httpAgent = await this.config.httpAgentProvider();
|
|
270
|
-
}
|
|
271
|
-
return new Promise((_resolve, _reject) => {
|
|
272
|
-
let writeRequestBodyPromise = void 0;
|
|
273
|
-
let socketWarningTimeoutId = -1;
|
|
274
|
-
let connectionTimeoutId = -1;
|
|
275
|
-
let requestTimeoutId = -1;
|
|
276
|
-
let socketTimeoutId = -1;
|
|
277
|
-
let keepAliveTimeoutId = -1;
|
|
278
|
-
const clearTimeouts = () => {
|
|
279
|
-
timing.clearTimeout(socketWarningTimeoutId);
|
|
280
|
-
timing.clearTimeout(connectionTimeoutId);
|
|
281
|
-
timing.clearTimeout(requestTimeoutId);
|
|
282
|
-
timing.clearTimeout(socketTimeoutId);
|
|
283
|
-
timing.clearTimeout(keepAliveTimeoutId);
|
|
284
|
-
};
|
|
285
|
-
const resolve = async (arg) => {
|
|
286
|
-
await writeRequestBodyPromise;
|
|
287
|
-
clearTimeouts();
|
|
288
|
-
_resolve(arg);
|
|
289
|
-
};
|
|
290
|
-
const reject = async (arg) => {
|
|
291
|
-
await writeRequestBodyPromise;
|
|
292
|
-
clearTimeouts();
|
|
293
|
-
_reject(arg);
|
|
294
|
-
};
|
|
295
|
-
if (abortSignal?.aborted) {
|
|
296
|
-
const abortError = buildAbortError(abortSignal);
|
|
297
|
-
reject(abortError);
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
const headers = request.headers;
|
|
301
|
-
const expectContinue = headers ? (headers.Expect ?? headers.expect) === "100-continue" : false;
|
|
302
|
-
let agent = isSSL ? config.httpsAgent : config.httpAgent;
|
|
303
|
-
if (expectContinue && !this.externalAgent) {
|
|
304
|
-
agent = new (isSSL ? node_https.Agent : hAgent)({
|
|
305
|
-
keepAlive: false,
|
|
306
|
-
maxSockets: Infinity
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
socketWarningTimeoutId = timing.setTimeout(() => {
|
|
310
|
-
this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, config.logger);
|
|
311
|
-
}, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2e3) + (config.connectionTimeout ?? 1e3));
|
|
312
|
-
const queryString = request.query ? buildQueryString(request.query) : "";
|
|
313
|
-
let auth = void 0;
|
|
314
|
-
if (request.username != null || request.password != null) {
|
|
315
|
-
const username = request.username ?? "";
|
|
316
|
-
const password = request.password ?? "";
|
|
317
|
-
auth = `${username}:${password}`;
|
|
318
|
-
}
|
|
319
|
-
let path = request.path;
|
|
320
|
-
if (queryString) {
|
|
321
|
-
path += `?${queryString}`;
|
|
322
|
-
}
|
|
323
|
-
if (request.fragment) {
|
|
324
|
-
path += `#${request.fragment}`;
|
|
325
|
-
}
|
|
326
|
-
let hostname = request.hostname ?? "";
|
|
327
|
-
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
328
|
-
hostname = request.hostname.slice(1, -1);
|
|
329
|
-
} else {
|
|
330
|
-
hostname = request.hostname;
|
|
331
|
-
}
|
|
332
|
-
const nodeHttpsOptions = {
|
|
333
|
-
headers: request.headers,
|
|
334
|
-
host: hostname,
|
|
335
|
-
method: request.method,
|
|
336
|
-
path,
|
|
337
|
-
port: request.port,
|
|
338
|
-
agent,
|
|
339
|
-
auth
|
|
340
|
-
};
|
|
341
|
-
const requestFunc = isSSL ? node_https.request : hRequest;
|
|
342
|
-
const req = requestFunc(nodeHttpsOptions, (res) => {
|
|
343
|
-
const httpResponse = new HttpResponse({
|
|
344
|
-
statusCode: res.statusCode || -1,
|
|
345
|
-
reason: res.statusMessage,
|
|
346
|
-
headers: getTransformedHeaders(res.headers),
|
|
347
|
-
body: res
|
|
348
|
-
});
|
|
349
|
-
resolve({ response: httpResponse });
|
|
350
|
-
});
|
|
351
|
-
req.on("error", (err) => {
|
|
352
|
-
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
353
|
-
reject(Object.assign(err, { name: "TimeoutError" }));
|
|
354
|
-
} else {
|
|
355
|
-
reject(err);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
if (abortSignal) {
|
|
359
|
-
const onAbort = () => {
|
|
360
|
-
req.destroy();
|
|
361
|
-
const abortError = buildAbortError(abortSignal);
|
|
362
|
-
reject(abortError);
|
|
363
|
-
};
|
|
364
|
-
if (typeof abortSignal.addEventListener === "function") {
|
|
365
|
-
const signal = abortSignal;
|
|
366
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
367
|
-
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
368
|
-
} else {
|
|
369
|
-
abortSignal.onabort = onAbort;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
373
|
-
connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
|
|
374
|
-
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, config.logger ?? console);
|
|
375
|
-
socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
|
|
376
|
-
const httpAgent = nodeHttpsOptions.agent;
|
|
377
|
-
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
378
|
-
keepAliveTimeoutId = setSocketKeepAlive(req, {
|
|
379
|
-
keepAlive: httpAgent.keepAlive,
|
|
380
|
-
keepAliveMsecs: httpAgent.keepAliveMsecs
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout, this.externalAgent).catch((e) => {
|
|
384
|
-
clearTimeouts();
|
|
385
|
-
return _reject(e);
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
updateHttpClientConfig(key, value) {
|
|
390
|
-
this.config = void 0;
|
|
391
|
-
this.configProvider = this.configProvider.then((config) => {
|
|
392
|
-
return {
|
|
393
|
-
...config,
|
|
394
|
-
[key]: value
|
|
395
|
-
};
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
httpHandlerConfigs() {
|
|
399
|
-
return this.config ?? {};
|
|
400
|
-
}
|
|
401
|
-
resolveDefaultConfig(options) {
|
|
402
|
-
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger } = options || {};
|
|
403
|
-
const keepAlive = true;
|
|
404
|
-
const maxSockets = 50;
|
|
405
|
-
return {
|
|
406
|
-
connectionTimeout,
|
|
407
|
-
requestTimeout,
|
|
408
|
-
socketTimeout,
|
|
409
|
-
socketAcquisitionWarningTimeout,
|
|
410
|
-
throwOnRequestTimeout,
|
|
411
|
-
httpAgentProvider: async () => {
|
|
412
|
-
const node_http = await import("http");
|
|
413
|
-
const { Agent, request } = node_http.default ?? node_http;
|
|
414
|
-
hRequest = request;
|
|
415
|
-
hAgent = Agent;
|
|
416
|
-
if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
|
|
417
|
-
this.externalAgent = true;
|
|
418
|
-
return httpAgent;
|
|
419
|
-
}
|
|
420
|
-
return new hAgent({ keepAlive, maxSockets, ...httpAgent });
|
|
421
|
-
},
|
|
422
|
-
httpsAgent: (() => {
|
|
423
|
-
if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
|
|
424
|
-
this.externalAgent = true;
|
|
425
|
-
return httpsAgent;
|
|
426
|
-
}
|
|
427
|
-
return new node_https.Agent({ keepAlive, maxSockets, ...httpsAgent });
|
|
428
|
-
})(),
|
|
429
|
-
logger
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
export {
|
|
435
|
-
NodeHttpHandler
|
|
436
|
-
};
|
package/dist/dist-es-3DLRX4SC.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
NodeHttpHandler
|
|
4
|
-
} from "./chunk-QIOBV22I.js";
|
|
5
|
-
import {
|
|
6
|
-
setCredentialFeature
|
|
7
|
-
} from "./chunk-NWBPSHNL.js";
|
|
8
|
-
import {
|
|
9
|
-
CredentialsProviderError,
|
|
10
|
-
HttpRequest
|
|
11
|
-
} from "./chunk-3X3IL2A6.js";
|
|
12
|
-
import {
|
|
13
|
-
parseRfc3339DateTime,
|
|
14
|
-
sdkStreamMixin
|
|
15
|
-
} from "./chunk-C6IOMGXW.js";
|
|
16
|
-
import "./chunk-Q6JESX2O.js";
|
|
17
|
-
|
|
18
|
-
// ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.46/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
|
19
|
-
import fs from "fs/promises";
|
|
20
|
-
|
|
21
|
-
// ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.46/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
|
|
22
|
-
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
23
|
-
var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
|
24
|
-
var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
|
25
|
-
var checkUrl = (url, logger) => {
|
|
26
|
-
if (url.protocol === "https:") {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (url.hostname === ECS_CONTAINER_HOST || url.hostname === EKS_CONTAINER_HOST_IPv4 || url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (url.hostname.includes("[")) {
|
|
33
|
-
if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
if (url.hostname === "localhost") {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const ipComponents = url.hostname.split(".");
|
|
41
|
-
const inRange = (component) => {
|
|
42
|
-
const num = parseInt(component, 10);
|
|
43
|
-
return 0 <= num && num <= 255;
|
|
44
|
-
};
|
|
45
|
-
if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
throw new CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
50
|
-
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
51
|
-
- ECS container host 169.254.170.2
|
|
52
|
-
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.46/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
|
|
56
|
-
function createGetRequest(url) {
|
|
57
|
-
return new HttpRequest({
|
|
58
|
-
protocol: url.protocol,
|
|
59
|
-
hostname: url.hostname,
|
|
60
|
-
port: Number(url.port),
|
|
61
|
-
path: url.pathname,
|
|
62
|
-
query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
|
|
63
|
-
acc[k] = v;
|
|
64
|
-
return acc;
|
|
65
|
-
}, {}),
|
|
66
|
-
fragment: url.hash
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
async function getCredentials(response, logger) {
|
|
70
|
-
const stream = sdkStreamMixin(response.body);
|
|
71
|
-
const str = await stream.transformToString();
|
|
72
|
-
if (response.statusCode === 200) {
|
|
73
|
-
const parsed = JSON.parse(str);
|
|
74
|
-
if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
|
|
75
|
-
throw new CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
accessKeyId: parsed.AccessKeyId,
|
|
79
|
-
secretAccessKey: parsed.SecretAccessKey,
|
|
80
|
-
sessionToken: parsed.Token,
|
|
81
|
-
expiration: parseRfc3339DateTime(parsed.Expiration)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
if (response.statusCode >= 400 && response.statusCode < 500) {
|
|
85
|
-
let parsedBody = {};
|
|
86
|
-
try {
|
|
87
|
-
parsedBody = JSON.parse(str);
|
|
88
|
-
} catch (e) {
|
|
89
|
-
}
|
|
90
|
-
throw Object.assign(new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
91
|
-
Code: parsedBody.Code,
|
|
92
|
-
Message: parsedBody.Message
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
throw new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.46/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
|
|
99
|
-
var retryWrapper = (toRetry, maxRetries, delayMs) => {
|
|
100
|
-
return async () => {
|
|
101
|
-
for (let i = 0; i < maxRetries; ++i) {
|
|
102
|
-
try {
|
|
103
|
-
return await toRetry();
|
|
104
|
-
} catch (e) {
|
|
105
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return await toRetry();
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.46/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
|
113
|
-
var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
114
|
-
var DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
|
|
115
|
-
var AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
116
|
-
var AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
|
|
117
|
-
var AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
118
|
-
var fromHttp = (options = {}) => {
|
|
119
|
-
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
120
|
-
let host;
|
|
121
|
-
const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
122
|
-
const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
|
123
|
-
const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
|
124
|
-
const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
|
125
|
-
const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn ? console.warn : options.logger.warn.bind(options.logger);
|
|
126
|
-
if (relative && full) {
|
|
127
|
-
warn("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
|
128
|
-
warn("awsContainerCredentialsFullUri will take precedence.");
|
|
129
|
-
}
|
|
130
|
-
if (token && tokenFile) {
|
|
131
|
-
warn("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
|
132
|
-
warn("awsContainerAuthorizationToken will take precedence.");
|
|
133
|
-
}
|
|
134
|
-
if (full) {
|
|
135
|
-
host = full;
|
|
136
|
-
} else if (relative) {
|
|
137
|
-
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
|
138
|
-
} else {
|
|
139
|
-
throw new CredentialsProviderError(`No HTTP credential provider host provided.
|
|
140
|
-
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
|
141
|
-
}
|
|
142
|
-
const url = new URL(host);
|
|
143
|
-
checkUrl(url, options.logger);
|
|
144
|
-
const requestHandler = NodeHttpHandler.create({ connectionTimeout: options.timeout ?? 1e3 });
|
|
145
|
-
const requestTimeout = options.timeout ?? 1e3;
|
|
146
|
-
const provider = retryWrapper(async () => {
|
|
147
|
-
const request = createGetRequest(url);
|
|
148
|
-
if (token) {
|
|
149
|
-
request.headers.Authorization = token;
|
|
150
|
-
} else if (tokenFile) {
|
|
151
|
-
request.headers.Authorization = (await fs.readFile(tokenFile)).toString();
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
const result = await requestHandler.handle(request, { requestTimeout });
|
|
155
|
-
return getCredentials(result.response).then((creds) => setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
|
|
156
|
-
} catch (e) {
|
|
157
|
-
throw new CredentialsProviderError(String(e), { logger: options.logger });
|
|
158
|
-
}
|
|
159
|
-
}, options.maxRetries ?? 3, options.timeout ?? 1e3);
|
|
160
|
-
return async () => {
|
|
161
|
-
try {
|
|
162
|
-
return await provider();
|
|
163
|
-
} finally {
|
|
164
|
-
requestHandler.destroy?.();
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
export {
|
|
169
|
-
fromHttp
|
|
170
|
-
};
|