@stacksjs/actions 0.70.10 → 0.70.12
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/build/core.js +1 -1
- package/dist/build.js +18 -3
- package/dist/{chunk-8swsxabt.js → chunk-0w5577pa.js} +63 -3
- package/dist/{chunk-fxan91t8.js → chunk-2dvnt46s.js} +31 -31
- package/dist/chunk-38cnnp2b.js +3823 -0
- package/dist/chunk-76zhb40c.js +92 -0
- package/dist/{chunk-v1qz355d.js → chunk-7exdh0pw.js} +4 -4
- package/dist/{chunk-6jdq6549.js → chunk-7hbpybtk.js} +18 -3
- package/dist/chunk-7s5qcjkt.js +105 -0
- package/dist/chunk-9exgwfkw.js +1283 -0
- package/dist/chunk-a13x0e43.js +1180 -0
- package/dist/chunk-a7k3cdby.js +2266 -0
- package/dist/chunk-bf8bq8pc.js +205 -0
- package/dist/chunk-csa76zyn.js +658 -0
- package/dist/chunk-e7mp4xy5.js +169 -0
- package/dist/chunk-f6a9g4qa.js +902 -0
- package/dist/chunk-frw3va9v.js +69 -0
- package/dist/chunk-hp8vmq3g.js +179242 -0
- package/dist/chunk-mdj7x1vs.js +790 -0
- package/dist/chunk-mdqphqep.js +438 -0
- package/dist/chunk-p0c688mg.js +729 -0
- package/dist/chunk-pnre7439.js +2228 -0
- package/dist/chunk-q9dmga3k.js +11 -0
- package/dist/chunk-qhh0v93n.js +73 -0
- package/dist/chunk-qkm8e752.js +51 -0
- package/dist/chunk-r1ednxa6.js +311 -0
- package/dist/chunk-saqpg5nd.js +118 -0
- package/dist/chunk-t5em30ak.js +379 -0
- package/dist/chunk-veja9rez.js +5764 -0
- package/dist/chunk-xt9exr2c.js +1481 -0
- package/dist/chunk-zbqapk7v.js +212 -0
- package/dist/chunk-zsm2c35w.js +72 -0
- package/dist/chunk-zzerxbrm.js +107 -0
- package/dist/database/seed.js +18 -3
- package/dist/deploy/index.js +1 -1
- package/dist/examples.js +1 -1
- package/dist/fresh.js +1 -1
- package/dist/generate/index.js +19 -4
- package/dist/helpers/component-meta.js +10 -10
- package/dist/helpers/lib-entries.js +1 -1
- package/dist/index.js +18 -3
- package/dist/key-generate.js +1 -1
- package/dist/lint/fix.js +1 -1
- package/dist/make.js +1 -1
- package/dist/prepublish.js +1 -1
- package/dist/release.js +18 -3
- package/dist/test/feature.js +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/unit.js +1 -1
- package/dist/types.js +1 -1
- package/dist/upgrade/index.js +1 -1
- package/dist/upgrade.js +2 -2
- package/package.json +17 -17
- package/dist/chunk-8tjc3whz.js +0 -77989
|
@@ -0,0 +1,3823 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_dist,
|
|
3
|
+
require_dist_cjs as require_dist_cjs2,
|
|
4
|
+
require_dist_cjs1 as require_dist_cjs3,
|
|
5
|
+
require_dist_cjs2 as require_dist_cjs7,
|
|
6
|
+
require_dist_cjs3 as require_dist_cjs8,
|
|
7
|
+
require_dist_cjs4 as require_dist_cjs9,
|
|
8
|
+
require_dist_cjs5 as require_dist_cjs10
|
|
9
|
+
} from "./chunk-veja9rez.js";
|
|
10
|
+
import {
|
|
11
|
+
require_dist_cjs as require_dist_cjs4,
|
|
12
|
+
require_dist_cjs2 as require_dist_cjs5,
|
|
13
|
+
require_dist_cjs3 as require_dist_cjs6
|
|
14
|
+
} from "./chunk-a7k3cdby.js";
|
|
15
|
+
import {
|
|
16
|
+
require_dist_cjs
|
|
17
|
+
} from "./chunk-saqpg5nd.js";
|
|
18
|
+
import {
|
|
19
|
+
__commonJS,
|
|
20
|
+
__require
|
|
21
|
+
} from "./chunk-9v6qtbez.js";
|
|
22
|
+
|
|
23
|
+
// ../../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js
|
|
24
|
+
var require_dist_cjs11 = __commonJS((exports, module) => {
|
|
25
|
+
var __defProp = Object.defineProperty;
|
|
26
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
27
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
28
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
29
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
30
|
+
var __export = (target, all) => {
|
|
31
|
+
for (var name in all)
|
|
32
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
33
|
+
};
|
|
34
|
+
var __copyProps = (to, from, except, desc) => {
|
|
35
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
36
|
+
for (let key of __getOwnPropNames(from))
|
|
37
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
38
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
39
|
+
}
|
|
40
|
+
return to;
|
|
41
|
+
};
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
var index_exports = {};
|
|
44
|
+
__export(index_exports, {
|
|
45
|
+
getHostHeaderPlugin: () => getHostHeaderPlugin,
|
|
46
|
+
hostHeaderMiddleware: () => hostHeaderMiddleware,
|
|
47
|
+
hostHeaderMiddlewareOptions: () => hostHeaderMiddlewareOptions,
|
|
48
|
+
resolveHostHeaderConfig: () => resolveHostHeaderConfig
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(index_exports);
|
|
51
|
+
var import_protocol_http = require_dist_cjs4();
|
|
52
|
+
function resolveHostHeaderConfig(input) {
|
|
53
|
+
return input;
|
|
54
|
+
}
|
|
55
|
+
__name(resolveHostHeaderConfig, "resolveHostHeaderConfig");
|
|
56
|
+
var hostHeaderMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => {
|
|
57
|
+
if (!import_protocol_http.HttpRequest.isInstance(args.request))
|
|
58
|
+
return next(args);
|
|
59
|
+
const { request } = args;
|
|
60
|
+
const { handlerProtocol = "" } = options.requestHandler.metadata || {};
|
|
61
|
+
if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
|
|
62
|
+
delete request.headers["host"];
|
|
63
|
+
request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
|
|
64
|
+
} else if (!request.headers["host"]) {
|
|
65
|
+
let host = request.hostname;
|
|
66
|
+
if (request.port != null)
|
|
67
|
+
host += `:${request.port}`;
|
|
68
|
+
request.headers["host"] = host;
|
|
69
|
+
}
|
|
70
|
+
return next(args);
|
|
71
|
+
}, "hostHeaderMiddleware");
|
|
72
|
+
var hostHeaderMiddlewareOptions = {
|
|
73
|
+
name: "hostHeaderMiddleware",
|
|
74
|
+
step: "build",
|
|
75
|
+
priority: "low",
|
|
76
|
+
tags: ["HOST"],
|
|
77
|
+
override: true
|
|
78
|
+
};
|
|
79
|
+
var getHostHeaderPlugin = /* @__PURE__ */ __name((options) => ({
|
|
80
|
+
applyToStack: /* @__PURE__ */ __name((clientStack) => {
|
|
81
|
+
clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
|
|
82
|
+
}, "applyToStack")
|
|
83
|
+
}), "getHostHeaderPlugin");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// ../../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js
|
|
87
|
+
var require_dist_cjs12 = __commonJS((exports, module) => {
|
|
88
|
+
var __defProp = Object.defineProperty;
|
|
89
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
90
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
91
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
92
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
93
|
+
var __export = (target, all) => {
|
|
94
|
+
for (var name in all)
|
|
95
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
96
|
+
};
|
|
97
|
+
var __copyProps = (to, from, except, desc) => {
|
|
98
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
99
|
+
for (let key of __getOwnPropNames(from))
|
|
100
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
101
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
102
|
+
}
|
|
103
|
+
return to;
|
|
104
|
+
};
|
|
105
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
106
|
+
var index_exports = {};
|
|
107
|
+
__export(index_exports, {
|
|
108
|
+
getLoggerPlugin: () => getLoggerPlugin,
|
|
109
|
+
loggerMiddleware: () => loggerMiddleware,
|
|
110
|
+
loggerMiddlewareOptions: () => loggerMiddlewareOptions
|
|
111
|
+
});
|
|
112
|
+
module.exports = __toCommonJS(index_exports);
|
|
113
|
+
var loggerMiddleware = /* @__PURE__ */ __name(() => (next, context) => async (args) => {
|
|
114
|
+
try {
|
|
115
|
+
const response = await next(args);
|
|
116
|
+
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
117
|
+
const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
118
|
+
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
119
|
+
const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
|
|
120
|
+
const { $metadata, ...outputWithoutMetadata } = response.output;
|
|
121
|
+
logger?.info?.({
|
|
122
|
+
clientName,
|
|
123
|
+
commandName,
|
|
124
|
+
input: inputFilterSensitiveLog(args.input),
|
|
125
|
+
output: outputFilterSensitiveLog(outputWithoutMetadata),
|
|
126
|
+
metadata: $metadata
|
|
127
|
+
});
|
|
128
|
+
return response;
|
|
129
|
+
} catch (error) {
|
|
130
|
+
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
131
|
+
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
132
|
+
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
133
|
+
logger?.error?.({
|
|
134
|
+
clientName,
|
|
135
|
+
commandName,
|
|
136
|
+
input: inputFilterSensitiveLog(args.input),
|
|
137
|
+
error,
|
|
138
|
+
metadata: error.$metadata
|
|
139
|
+
});
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}, "loggerMiddleware");
|
|
143
|
+
var loggerMiddlewareOptions = {
|
|
144
|
+
name: "loggerMiddleware",
|
|
145
|
+
tags: ["LOGGER"],
|
|
146
|
+
step: "initialize",
|
|
147
|
+
override: true
|
|
148
|
+
};
|
|
149
|
+
var getLoggerPlugin = /* @__PURE__ */ __name((options) => ({
|
|
150
|
+
applyToStack: /* @__PURE__ */ __name((clientStack) => {
|
|
151
|
+
clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
|
|
152
|
+
}, "applyToStack")
|
|
153
|
+
}), "getLoggerPlugin");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// ../../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js
|
|
157
|
+
var require_dist_cjs13 = __commonJS((exports, module) => {
|
|
158
|
+
var __defProp = Object.defineProperty;
|
|
159
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
160
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
161
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
162
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
163
|
+
var __export = (target, all) => {
|
|
164
|
+
for (var name in all)
|
|
165
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
166
|
+
};
|
|
167
|
+
var __copyProps = (to, from, except, desc) => {
|
|
168
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
169
|
+
for (let key of __getOwnPropNames(from))
|
|
170
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
171
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
172
|
+
}
|
|
173
|
+
return to;
|
|
174
|
+
};
|
|
175
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
176
|
+
var index_exports = {};
|
|
177
|
+
__export(index_exports, {
|
|
178
|
+
addRecursionDetectionMiddlewareOptions: () => addRecursionDetectionMiddlewareOptions,
|
|
179
|
+
getRecursionDetectionPlugin: () => getRecursionDetectionPlugin,
|
|
180
|
+
recursionDetectionMiddleware: () => recursionDetectionMiddleware
|
|
181
|
+
});
|
|
182
|
+
module.exports = __toCommonJS(index_exports);
|
|
183
|
+
var import_protocol_http = require_dist_cjs4();
|
|
184
|
+
var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
|
|
185
|
+
var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
|
|
186
|
+
var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
|
|
187
|
+
var recursionDetectionMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => {
|
|
188
|
+
const { request } = args;
|
|
189
|
+
if (!import_protocol_http.HttpRequest.isInstance(request) || options.runtime !== "node") {
|
|
190
|
+
return next(args);
|
|
191
|
+
}
|
|
192
|
+
const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ?? TRACE_ID_HEADER_NAME;
|
|
193
|
+
if (request.headers.hasOwnProperty(traceIdHeader)) {
|
|
194
|
+
return next(args);
|
|
195
|
+
}
|
|
196
|
+
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
|
197
|
+
const traceId = process.env[ENV_TRACE_ID];
|
|
198
|
+
const nonEmptyString = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0, "nonEmptyString");
|
|
199
|
+
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
|
|
200
|
+
request.headers[TRACE_ID_HEADER_NAME] = traceId;
|
|
201
|
+
}
|
|
202
|
+
return next({
|
|
203
|
+
...args,
|
|
204
|
+
request
|
|
205
|
+
});
|
|
206
|
+
}, "recursionDetectionMiddleware");
|
|
207
|
+
var addRecursionDetectionMiddlewareOptions = {
|
|
208
|
+
step: "build",
|
|
209
|
+
tags: ["RECURSION_DETECTION"],
|
|
210
|
+
name: "recursionDetectionMiddleware",
|
|
211
|
+
override: true,
|
|
212
|
+
priority: "low"
|
|
213
|
+
};
|
|
214
|
+
var getRecursionDetectionPlugin = /* @__PURE__ */ __name((options) => ({
|
|
215
|
+
applyToStack: /* @__PURE__ */ __name((clientStack) => {
|
|
216
|
+
clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
|
|
217
|
+
}, "applyToStack")
|
|
218
|
+
}), "getRecursionDetectionPlugin");
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// ../../../../node_modules/@smithy/util-endpoints/dist-cjs/index.js
|
|
222
|
+
var require_dist_cjs14 = __commonJS((exports, module) => {
|
|
223
|
+
var __defProp = Object.defineProperty;
|
|
224
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
225
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
226
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
227
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
228
|
+
var __export = (target, all) => {
|
|
229
|
+
for (var name in all)
|
|
230
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
231
|
+
};
|
|
232
|
+
var __copyProps = (to, from, except, desc) => {
|
|
233
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
234
|
+
for (let key of __getOwnPropNames(from))
|
|
235
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
236
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
237
|
+
}
|
|
238
|
+
return to;
|
|
239
|
+
};
|
|
240
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
241
|
+
var src_exports = {};
|
|
242
|
+
__export(src_exports, {
|
|
243
|
+
EndpointCache: () => EndpointCache,
|
|
244
|
+
EndpointError: () => EndpointError2,
|
|
245
|
+
customEndpointFunctions: () => customEndpointFunctions,
|
|
246
|
+
isIpAddress: () => isIpAddress2,
|
|
247
|
+
isValidHostLabel: () => isValidHostLabel,
|
|
248
|
+
resolveEndpoint: () => resolveEndpoint2
|
|
249
|
+
});
|
|
250
|
+
module.exports = __toCommonJS(src_exports);
|
|
251
|
+
var EndpointCache = class {
|
|
252
|
+
constructor({ size, params }) {
|
|
253
|
+
this.data = /* @__PURE__ */ new Map;
|
|
254
|
+
this.parameters = [];
|
|
255
|
+
this.capacity = size ?? 50;
|
|
256
|
+
if (params) {
|
|
257
|
+
this.parameters = params;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
static {
|
|
261
|
+
__name(this, "EndpointCache");
|
|
262
|
+
}
|
|
263
|
+
get(endpointParams, resolver) {
|
|
264
|
+
const key = this.hash(endpointParams);
|
|
265
|
+
if (key === false) {
|
|
266
|
+
return resolver();
|
|
267
|
+
}
|
|
268
|
+
if (!this.data.has(key)) {
|
|
269
|
+
if (this.data.size > this.capacity + 10) {
|
|
270
|
+
const keys = this.data.keys();
|
|
271
|
+
let i = 0;
|
|
272
|
+
while (true) {
|
|
273
|
+
const { value, done } = keys.next();
|
|
274
|
+
this.data.delete(value);
|
|
275
|
+
if (done || ++i > 10) {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
this.data.set(key, resolver());
|
|
281
|
+
}
|
|
282
|
+
return this.data.get(key);
|
|
283
|
+
}
|
|
284
|
+
size() {
|
|
285
|
+
return this.data.size;
|
|
286
|
+
}
|
|
287
|
+
hash(endpointParams) {
|
|
288
|
+
let buffer = "";
|
|
289
|
+
const { parameters } = this;
|
|
290
|
+
if (parameters.length === 0) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
for (const param of parameters) {
|
|
294
|
+
const val = String(endpointParams[param] ?? "");
|
|
295
|
+
if (val.includes("|;")) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
buffer += val + "|;";
|
|
299
|
+
}
|
|
300
|
+
return buffer;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`);
|
|
304
|
+
var isIpAddress2 = /* @__PURE__ */ __name((value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"), "isIpAddress");
|
|
305
|
+
var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
|
|
306
|
+
var isValidHostLabel = /* @__PURE__ */ __name((value, allowSubDomains = false) => {
|
|
307
|
+
if (!allowSubDomains) {
|
|
308
|
+
return VALID_HOST_LABEL_REGEX.test(value);
|
|
309
|
+
}
|
|
310
|
+
const labels = value.split(".");
|
|
311
|
+
for (const label of labels) {
|
|
312
|
+
if (!isValidHostLabel(label)) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return true;
|
|
317
|
+
}, "isValidHostLabel");
|
|
318
|
+
var customEndpointFunctions = {};
|
|
319
|
+
var debugId = "endpoints";
|
|
320
|
+
function toDebugString(input) {
|
|
321
|
+
if (typeof input !== "object" || input == null) {
|
|
322
|
+
return input;
|
|
323
|
+
}
|
|
324
|
+
if ("ref" in input) {
|
|
325
|
+
return `$${toDebugString(input.ref)}`;
|
|
326
|
+
}
|
|
327
|
+
if ("fn" in input) {
|
|
328
|
+
return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
|
|
329
|
+
}
|
|
330
|
+
return JSON.stringify(input, null, 2);
|
|
331
|
+
}
|
|
332
|
+
__name(toDebugString, "toDebugString");
|
|
333
|
+
var EndpointError2 = class extends Error {
|
|
334
|
+
static {
|
|
335
|
+
__name(this, "EndpointError");
|
|
336
|
+
}
|
|
337
|
+
constructor(message) {
|
|
338
|
+
super(message);
|
|
339
|
+
this.name = "EndpointError";
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var booleanEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "booleanEquals");
|
|
343
|
+
var getAttrPathList = /* @__PURE__ */ __name((path) => {
|
|
344
|
+
const parts = path.split(".");
|
|
345
|
+
const pathList = [];
|
|
346
|
+
for (const part of parts) {
|
|
347
|
+
const squareBracketIndex = part.indexOf("[");
|
|
348
|
+
if (squareBracketIndex !== -1) {
|
|
349
|
+
if (part.indexOf("]") !== part.length - 1) {
|
|
350
|
+
throw new EndpointError2(`Path: '${path}' does not end with ']'`);
|
|
351
|
+
}
|
|
352
|
+
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
353
|
+
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
354
|
+
throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
|
|
355
|
+
}
|
|
356
|
+
if (squareBracketIndex !== 0) {
|
|
357
|
+
pathList.push(part.slice(0, squareBracketIndex));
|
|
358
|
+
}
|
|
359
|
+
pathList.push(arrayIndex);
|
|
360
|
+
} else {
|
|
361
|
+
pathList.push(part);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return pathList;
|
|
365
|
+
}, "getAttrPathList");
|
|
366
|
+
var getAttr = /* @__PURE__ */ __name((value, path) => getAttrPathList(path).reduce((acc, index) => {
|
|
367
|
+
if (typeof acc !== "object") {
|
|
368
|
+
throw new EndpointError2(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
|
369
|
+
} else if (Array.isArray(acc)) {
|
|
370
|
+
return acc[parseInt(index)];
|
|
371
|
+
}
|
|
372
|
+
return acc[index];
|
|
373
|
+
}, value), "getAttr");
|
|
374
|
+
var isSet = /* @__PURE__ */ __name((value) => value != null, "isSet");
|
|
375
|
+
var not = /* @__PURE__ */ __name((value) => !value, "not");
|
|
376
|
+
var import_types3 = require_dist_cjs();
|
|
377
|
+
var DEFAULT_PORTS = {
|
|
378
|
+
[import_types3.EndpointURLScheme.HTTP]: 80,
|
|
379
|
+
[import_types3.EndpointURLScheme.HTTPS]: 443
|
|
380
|
+
};
|
|
381
|
+
var parseURL = /* @__PURE__ */ __name((value) => {
|
|
382
|
+
const whatwgURL = (() => {
|
|
383
|
+
try {
|
|
384
|
+
if (value instanceof URL) {
|
|
385
|
+
return value;
|
|
386
|
+
}
|
|
387
|
+
if (typeof value === "object" && "hostname" in value) {
|
|
388
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
|
|
389
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
|
|
390
|
+
url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
|
|
391
|
+
return url;
|
|
392
|
+
}
|
|
393
|
+
return new URL(value);
|
|
394
|
+
} catch (error) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
})();
|
|
398
|
+
if (!whatwgURL) {
|
|
399
|
+
console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
const urlString = whatwgURL.href;
|
|
403
|
+
const { host, hostname, pathname, protocol, search } = whatwgURL;
|
|
404
|
+
if (search) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
const scheme = protocol.slice(0, -1);
|
|
408
|
+
if (!Object.values(import_types3.EndpointURLScheme).includes(scheme)) {
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
const isIp = isIpAddress2(hostname);
|
|
412
|
+
const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`);
|
|
413
|
+
const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
|
|
414
|
+
return {
|
|
415
|
+
scheme,
|
|
416
|
+
authority,
|
|
417
|
+
path: pathname,
|
|
418
|
+
normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
|
|
419
|
+
isIp
|
|
420
|
+
};
|
|
421
|
+
}, "parseURL");
|
|
422
|
+
var stringEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "stringEquals");
|
|
423
|
+
var substring = /* @__PURE__ */ __name((input, start, stop, reverse) => {
|
|
424
|
+
if (start >= stop || input.length < stop) {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
if (!reverse) {
|
|
428
|
+
return input.substring(start, stop);
|
|
429
|
+
}
|
|
430
|
+
return input.substring(input.length - stop, input.length - start);
|
|
431
|
+
}, "substring");
|
|
432
|
+
var uriEncode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`), "uriEncode");
|
|
433
|
+
var endpointFunctions = {
|
|
434
|
+
booleanEquals,
|
|
435
|
+
getAttr,
|
|
436
|
+
isSet,
|
|
437
|
+
isValidHostLabel,
|
|
438
|
+
not,
|
|
439
|
+
parseURL,
|
|
440
|
+
stringEquals,
|
|
441
|
+
substring,
|
|
442
|
+
uriEncode
|
|
443
|
+
};
|
|
444
|
+
var evaluateTemplate = /* @__PURE__ */ __name((template, options) => {
|
|
445
|
+
const evaluatedTemplateArr = [];
|
|
446
|
+
const templateContext = {
|
|
447
|
+
...options.endpointParams,
|
|
448
|
+
...options.referenceRecord
|
|
449
|
+
};
|
|
450
|
+
let currentIndex = 0;
|
|
451
|
+
while (currentIndex < template.length) {
|
|
452
|
+
const openingBraceIndex = template.indexOf("{", currentIndex);
|
|
453
|
+
if (openingBraceIndex === -1) {
|
|
454
|
+
evaluatedTemplateArr.push(template.slice(currentIndex));
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex));
|
|
458
|
+
const closingBraceIndex = template.indexOf("}", openingBraceIndex);
|
|
459
|
+
if (closingBraceIndex === -1) {
|
|
460
|
+
evaluatedTemplateArr.push(template.slice(openingBraceIndex));
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") {
|
|
464
|
+
evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex));
|
|
465
|
+
currentIndex = closingBraceIndex + 2;
|
|
466
|
+
}
|
|
467
|
+
const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex);
|
|
468
|
+
if (parameterName.includes("#")) {
|
|
469
|
+
const [refName, attrName] = parameterName.split("#");
|
|
470
|
+
evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName));
|
|
471
|
+
} else {
|
|
472
|
+
evaluatedTemplateArr.push(templateContext[parameterName]);
|
|
473
|
+
}
|
|
474
|
+
currentIndex = closingBraceIndex + 1;
|
|
475
|
+
}
|
|
476
|
+
return evaluatedTemplateArr.join("");
|
|
477
|
+
}, "evaluateTemplate");
|
|
478
|
+
var getReferenceValue = /* @__PURE__ */ __name(({ ref }, options) => {
|
|
479
|
+
const referenceRecord = {
|
|
480
|
+
...options.endpointParams,
|
|
481
|
+
...options.referenceRecord
|
|
482
|
+
};
|
|
483
|
+
return referenceRecord[ref];
|
|
484
|
+
}, "getReferenceValue");
|
|
485
|
+
var evaluateExpression = /* @__PURE__ */ __name((obj, keyName, options) => {
|
|
486
|
+
if (typeof obj === "string") {
|
|
487
|
+
return evaluateTemplate(obj, options);
|
|
488
|
+
} else if (obj["fn"]) {
|
|
489
|
+
return callFunction(obj, options);
|
|
490
|
+
} else if (obj["ref"]) {
|
|
491
|
+
return getReferenceValue(obj, options);
|
|
492
|
+
}
|
|
493
|
+
throw new EndpointError2(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
|
|
494
|
+
}, "evaluateExpression");
|
|
495
|
+
var callFunction = /* @__PURE__ */ __name(({ fn, argv }, options) => {
|
|
496
|
+
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
|
|
497
|
+
const fnSegments = fn.split(".");
|
|
498
|
+
if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) {
|
|
499
|
+
return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
|
|
500
|
+
}
|
|
501
|
+
return endpointFunctions[fn](...evaluatedArgs);
|
|
502
|
+
}, "callFunction");
|
|
503
|
+
var evaluateCondition = /* @__PURE__ */ __name(({ assign, ...fnArgs }, options) => {
|
|
504
|
+
if (assign && assign in options.referenceRecord) {
|
|
505
|
+
throw new EndpointError2(`'${assign}' is already defined in Reference Record.`);
|
|
506
|
+
}
|
|
507
|
+
const value = callFunction(fnArgs, options);
|
|
508
|
+
options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
|
|
509
|
+
return {
|
|
510
|
+
result: value === "" ? true : !!value,
|
|
511
|
+
...assign != null && { toAssign: { name: assign, value } }
|
|
512
|
+
};
|
|
513
|
+
}, "evaluateCondition");
|
|
514
|
+
var evaluateConditions = /* @__PURE__ */ __name((conditions = [], options) => {
|
|
515
|
+
const conditionsReferenceRecord = {};
|
|
516
|
+
for (const condition of conditions) {
|
|
517
|
+
const { result, toAssign } = evaluateCondition(condition, {
|
|
518
|
+
...options,
|
|
519
|
+
referenceRecord: {
|
|
520
|
+
...options.referenceRecord,
|
|
521
|
+
...conditionsReferenceRecord
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
if (!result) {
|
|
525
|
+
return { result };
|
|
526
|
+
}
|
|
527
|
+
if (toAssign) {
|
|
528
|
+
conditionsReferenceRecord[toAssign.name] = toAssign.value;
|
|
529
|
+
options.logger?.debug?.(`${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return { result: true, referenceRecord: conditionsReferenceRecord };
|
|
533
|
+
}, "evaluateConditions");
|
|
534
|
+
var getEndpointHeaders = /* @__PURE__ */ __name((headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({
|
|
535
|
+
...acc,
|
|
536
|
+
[headerKey]: headerVal.map((headerValEntry) => {
|
|
537
|
+
const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
|
|
538
|
+
if (typeof processedExpr !== "string") {
|
|
539
|
+
throw new EndpointError2(`Header '${headerKey}' value '${processedExpr}' is not a string`);
|
|
540
|
+
}
|
|
541
|
+
return processedExpr;
|
|
542
|
+
})
|
|
543
|
+
}), {}), "getEndpointHeaders");
|
|
544
|
+
var getEndpointProperty = /* @__PURE__ */ __name((property, options) => {
|
|
545
|
+
if (Array.isArray(property)) {
|
|
546
|
+
return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
|
|
547
|
+
}
|
|
548
|
+
switch (typeof property) {
|
|
549
|
+
case "string":
|
|
550
|
+
return evaluateTemplate(property, options);
|
|
551
|
+
case "object":
|
|
552
|
+
if (property === null) {
|
|
553
|
+
throw new EndpointError2(`Unexpected endpoint property: ${property}`);
|
|
554
|
+
}
|
|
555
|
+
return getEndpointProperties(property, options);
|
|
556
|
+
case "boolean":
|
|
557
|
+
return property;
|
|
558
|
+
default:
|
|
559
|
+
throw new EndpointError2(`Unexpected endpoint property type: ${typeof property}`);
|
|
560
|
+
}
|
|
561
|
+
}, "getEndpointProperty");
|
|
562
|
+
var getEndpointProperties = /* @__PURE__ */ __name((properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
|
|
563
|
+
...acc,
|
|
564
|
+
[propertyKey]: getEndpointProperty(propertyVal, options)
|
|
565
|
+
}), {}), "getEndpointProperties");
|
|
566
|
+
var getEndpointUrl = /* @__PURE__ */ __name((endpointUrl, options) => {
|
|
567
|
+
const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
|
|
568
|
+
if (typeof expression === "string") {
|
|
569
|
+
try {
|
|
570
|
+
return new URL(expression);
|
|
571
|
+
} catch (error) {
|
|
572
|
+
console.error(`Failed to construct URL with ${expression}`, error);
|
|
573
|
+
throw error;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
throw new EndpointError2(`Endpoint URL must be a string, got ${typeof expression}`);
|
|
577
|
+
}, "getEndpointUrl");
|
|
578
|
+
var evaluateEndpointRule = /* @__PURE__ */ __name((endpointRule, options) => {
|
|
579
|
+
const { conditions, endpoint } = endpointRule;
|
|
580
|
+
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
581
|
+
if (!result) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const endpointRuleOptions = {
|
|
585
|
+
...options,
|
|
586
|
+
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
587
|
+
};
|
|
588
|
+
const { url, properties, headers } = endpoint;
|
|
589
|
+
options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
|
|
590
|
+
return {
|
|
591
|
+
...headers != null && {
|
|
592
|
+
headers: getEndpointHeaders(headers, endpointRuleOptions)
|
|
593
|
+
},
|
|
594
|
+
...properties != null && {
|
|
595
|
+
properties: getEndpointProperties(properties, endpointRuleOptions)
|
|
596
|
+
},
|
|
597
|
+
url: getEndpointUrl(url, endpointRuleOptions)
|
|
598
|
+
};
|
|
599
|
+
}, "evaluateEndpointRule");
|
|
600
|
+
var evaluateErrorRule = /* @__PURE__ */ __name((errorRule, options) => {
|
|
601
|
+
const { conditions, error } = errorRule;
|
|
602
|
+
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
603
|
+
if (!result) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
throw new EndpointError2(evaluateExpression(error, "Error", {
|
|
607
|
+
...options,
|
|
608
|
+
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
609
|
+
}));
|
|
610
|
+
}, "evaluateErrorRule");
|
|
611
|
+
var evaluateTreeRule = /* @__PURE__ */ __name((treeRule, options) => {
|
|
612
|
+
const { conditions, rules } = treeRule;
|
|
613
|
+
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
614
|
+
if (!result) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
return evaluateRules(rules, {
|
|
618
|
+
...options,
|
|
619
|
+
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
620
|
+
});
|
|
621
|
+
}, "evaluateTreeRule");
|
|
622
|
+
var evaluateRules = /* @__PURE__ */ __name((rules, options) => {
|
|
623
|
+
for (const rule of rules) {
|
|
624
|
+
if (rule.type === "endpoint") {
|
|
625
|
+
const endpointOrUndefined = evaluateEndpointRule(rule, options);
|
|
626
|
+
if (endpointOrUndefined) {
|
|
627
|
+
return endpointOrUndefined;
|
|
628
|
+
}
|
|
629
|
+
} else if (rule.type === "error") {
|
|
630
|
+
evaluateErrorRule(rule, options);
|
|
631
|
+
} else if (rule.type === "tree") {
|
|
632
|
+
const endpointOrUndefined = evaluateTreeRule(rule, options);
|
|
633
|
+
if (endpointOrUndefined) {
|
|
634
|
+
return endpointOrUndefined;
|
|
635
|
+
}
|
|
636
|
+
} else {
|
|
637
|
+
throw new EndpointError2(`Unknown endpoint rule: ${rule}`);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
throw new EndpointError2(`Rules evaluation failed`);
|
|
641
|
+
}, "evaluateRules");
|
|
642
|
+
var resolveEndpoint2 = /* @__PURE__ */ __name((ruleSetObject, options) => {
|
|
643
|
+
const { endpointParams, logger } = options;
|
|
644
|
+
const { parameters, rules } = ruleSetObject;
|
|
645
|
+
options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
|
|
646
|
+
const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]);
|
|
647
|
+
if (paramsWithDefault.length > 0) {
|
|
648
|
+
for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
|
|
649
|
+
endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k);
|
|
653
|
+
for (const requiredParam of requiredParams) {
|
|
654
|
+
if (endpointParams[requiredParam] == null) {
|
|
655
|
+
throw new EndpointError2(`Missing required parameter: '${requiredParam}'`);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
|
|
659
|
+
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
|
660
|
+
return endpoint;
|
|
661
|
+
}, "resolveEndpoint");
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// ../../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js
|
|
665
|
+
var require_dist_cjs15 = __commonJS((exports, module) => {
|
|
666
|
+
var __defProp = Object.defineProperty;
|
|
667
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
668
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
669
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
670
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
671
|
+
var __export = (target, all) => {
|
|
672
|
+
for (var name in all)
|
|
673
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
674
|
+
};
|
|
675
|
+
var __copyProps = (to, from, except, desc) => {
|
|
676
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
677
|
+
for (let key of __getOwnPropNames(from))
|
|
678
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
679
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
680
|
+
}
|
|
681
|
+
return to;
|
|
682
|
+
};
|
|
683
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
684
|
+
var index_exports = {};
|
|
685
|
+
__export(index_exports, {
|
|
686
|
+
ConditionObject: () => import_util_endpoints.ConditionObject,
|
|
687
|
+
DeprecatedObject: () => import_util_endpoints.DeprecatedObject,
|
|
688
|
+
EndpointError: () => import_util_endpoints.EndpointError,
|
|
689
|
+
EndpointObject: () => import_util_endpoints.EndpointObject,
|
|
690
|
+
EndpointObjectHeaders: () => import_util_endpoints.EndpointObjectHeaders,
|
|
691
|
+
EndpointObjectProperties: () => import_util_endpoints.EndpointObjectProperties,
|
|
692
|
+
EndpointParams: () => import_util_endpoints.EndpointParams,
|
|
693
|
+
EndpointResolverOptions: () => import_util_endpoints.EndpointResolverOptions,
|
|
694
|
+
EndpointRuleObject: () => import_util_endpoints.EndpointRuleObject,
|
|
695
|
+
ErrorRuleObject: () => import_util_endpoints.ErrorRuleObject,
|
|
696
|
+
EvaluateOptions: () => import_util_endpoints.EvaluateOptions,
|
|
697
|
+
Expression: () => import_util_endpoints.Expression,
|
|
698
|
+
FunctionArgv: () => import_util_endpoints.FunctionArgv,
|
|
699
|
+
FunctionObject: () => import_util_endpoints.FunctionObject,
|
|
700
|
+
FunctionReturn: () => import_util_endpoints.FunctionReturn,
|
|
701
|
+
ParameterObject: () => import_util_endpoints.ParameterObject,
|
|
702
|
+
ReferenceObject: () => import_util_endpoints.ReferenceObject,
|
|
703
|
+
ReferenceRecord: () => import_util_endpoints.ReferenceRecord,
|
|
704
|
+
RuleSetObject: () => import_util_endpoints.RuleSetObject,
|
|
705
|
+
RuleSetRules: () => import_util_endpoints.RuleSetRules,
|
|
706
|
+
TreeRuleObject: () => import_util_endpoints.TreeRuleObject,
|
|
707
|
+
awsEndpointFunctions: () => awsEndpointFunctions,
|
|
708
|
+
getUserAgentPrefix: () => getUserAgentPrefix,
|
|
709
|
+
isIpAddress: () => import_util_endpoints.isIpAddress,
|
|
710
|
+
partition: () => partition,
|
|
711
|
+
resolveEndpoint: () => import_util_endpoints.resolveEndpoint,
|
|
712
|
+
setPartitionInfo: () => setPartitionInfo,
|
|
713
|
+
useDefaultPartitionInfo: () => useDefaultPartitionInfo
|
|
714
|
+
});
|
|
715
|
+
module.exports = __toCommonJS(index_exports);
|
|
716
|
+
var import_util_endpoints = require_dist_cjs14();
|
|
717
|
+
var isVirtualHostableS3Bucket = /* @__PURE__ */ __name((value, allowSubDomains = false) => {
|
|
718
|
+
if (allowSubDomains) {
|
|
719
|
+
for (const label of value.split(".")) {
|
|
720
|
+
if (!isVirtualHostableS3Bucket(label)) {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
if (!(0, import_util_endpoints.isValidHostLabel)(value)) {
|
|
727
|
+
return false;
|
|
728
|
+
}
|
|
729
|
+
if (value.length < 3 || value.length > 63) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
if (value !== value.toLowerCase()) {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
if ((0, import_util_endpoints.isIpAddress)(value)) {
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
return true;
|
|
739
|
+
}, "isVirtualHostableS3Bucket");
|
|
740
|
+
var ARN_DELIMITER = ":";
|
|
741
|
+
var RESOURCE_DELIMITER = "/";
|
|
742
|
+
var parseArn = /* @__PURE__ */ __name((value) => {
|
|
743
|
+
const segments = value.split(ARN_DELIMITER);
|
|
744
|
+
if (segments.length < 6)
|
|
745
|
+
return null;
|
|
746
|
+
const [arn, partition2, service, region, accountId, ...resourcePath] = segments;
|
|
747
|
+
if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
|
|
748
|
+
return null;
|
|
749
|
+
const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
|
|
750
|
+
return {
|
|
751
|
+
partition: partition2,
|
|
752
|
+
service,
|
|
753
|
+
region,
|
|
754
|
+
accountId,
|
|
755
|
+
resourceId
|
|
756
|
+
};
|
|
757
|
+
}, "parseArn");
|
|
758
|
+
var partitions_default = {
|
|
759
|
+
partitions: [{
|
|
760
|
+
id: "aws",
|
|
761
|
+
outputs: {
|
|
762
|
+
dnsSuffix: "amazonaws.com",
|
|
763
|
+
dualStackDnsSuffix: "api.aws",
|
|
764
|
+
implicitGlobalRegion: "us-east-1",
|
|
765
|
+
name: "aws",
|
|
766
|
+
supportsDualStack: true,
|
|
767
|
+
supportsFIPS: true
|
|
768
|
+
},
|
|
769
|
+
regionRegex: "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",
|
|
770
|
+
regions: {
|
|
771
|
+
"af-south-1": {
|
|
772
|
+
description: "Africa (Cape Town)"
|
|
773
|
+
},
|
|
774
|
+
"ap-east-1": {
|
|
775
|
+
description: "Asia Pacific (Hong Kong)"
|
|
776
|
+
},
|
|
777
|
+
"ap-northeast-1": {
|
|
778
|
+
description: "Asia Pacific (Tokyo)"
|
|
779
|
+
},
|
|
780
|
+
"ap-northeast-2": {
|
|
781
|
+
description: "Asia Pacific (Seoul)"
|
|
782
|
+
},
|
|
783
|
+
"ap-northeast-3": {
|
|
784
|
+
description: "Asia Pacific (Osaka)"
|
|
785
|
+
},
|
|
786
|
+
"ap-south-1": {
|
|
787
|
+
description: "Asia Pacific (Mumbai)"
|
|
788
|
+
},
|
|
789
|
+
"ap-south-2": {
|
|
790
|
+
description: "Asia Pacific (Hyderabad)"
|
|
791
|
+
},
|
|
792
|
+
"ap-southeast-1": {
|
|
793
|
+
description: "Asia Pacific (Singapore)"
|
|
794
|
+
},
|
|
795
|
+
"ap-southeast-2": {
|
|
796
|
+
description: "Asia Pacific (Sydney)"
|
|
797
|
+
},
|
|
798
|
+
"ap-southeast-3": {
|
|
799
|
+
description: "Asia Pacific (Jakarta)"
|
|
800
|
+
},
|
|
801
|
+
"ap-southeast-4": {
|
|
802
|
+
description: "Asia Pacific (Melbourne)"
|
|
803
|
+
},
|
|
804
|
+
"ap-southeast-5": {
|
|
805
|
+
description: "Asia Pacific (Malaysia)"
|
|
806
|
+
},
|
|
807
|
+
"ap-southeast-7": {
|
|
808
|
+
description: "Asia Pacific (Thailand)"
|
|
809
|
+
},
|
|
810
|
+
"aws-global": {
|
|
811
|
+
description: "AWS Standard global region"
|
|
812
|
+
},
|
|
813
|
+
"ca-central-1": {
|
|
814
|
+
description: "Canada (Central)"
|
|
815
|
+
},
|
|
816
|
+
"ca-west-1": {
|
|
817
|
+
description: "Canada West (Calgary)"
|
|
818
|
+
},
|
|
819
|
+
"eu-central-1": {
|
|
820
|
+
description: "Europe (Frankfurt)"
|
|
821
|
+
},
|
|
822
|
+
"eu-central-2": {
|
|
823
|
+
description: "Europe (Zurich)"
|
|
824
|
+
},
|
|
825
|
+
"eu-north-1": {
|
|
826
|
+
description: "Europe (Stockholm)"
|
|
827
|
+
},
|
|
828
|
+
"eu-south-1": {
|
|
829
|
+
description: "Europe (Milan)"
|
|
830
|
+
},
|
|
831
|
+
"eu-south-2": {
|
|
832
|
+
description: "Europe (Spain)"
|
|
833
|
+
},
|
|
834
|
+
"eu-west-1": {
|
|
835
|
+
description: "Europe (Ireland)"
|
|
836
|
+
},
|
|
837
|
+
"eu-west-2": {
|
|
838
|
+
description: "Europe (London)"
|
|
839
|
+
},
|
|
840
|
+
"eu-west-3": {
|
|
841
|
+
description: "Europe (Paris)"
|
|
842
|
+
},
|
|
843
|
+
"il-central-1": {
|
|
844
|
+
description: "Israel (Tel Aviv)"
|
|
845
|
+
},
|
|
846
|
+
"me-central-1": {
|
|
847
|
+
description: "Middle East (UAE)"
|
|
848
|
+
},
|
|
849
|
+
"me-south-1": {
|
|
850
|
+
description: "Middle East (Bahrain)"
|
|
851
|
+
},
|
|
852
|
+
"mx-central-1": {
|
|
853
|
+
description: "Mexico (Central)"
|
|
854
|
+
},
|
|
855
|
+
"sa-east-1": {
|
|
856
|
+
description: "South America (Sao Paulo)"
|
|
857
|
+
},
|
|
858
|
+
"us-east-1": {
|
|
859
|
+
description: "US East (N. Virginia)"
|
|
860
|
+
},
|
|
861
|
+
"us-east-2": {
|
|
862
|
+
description: "US East (Ohio)"
|
|
863
|
+
},
|
|
864
|
+
"us-west-1": {
|
|
865
|
+
description: "US West (N. California)"
|
|
866
|
+
},
|
|
867
|
+
"us-west-2": {
|
|
868
|
+
description: "US West (Oregon)"
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}, {
|
|
872
|
+
id: "aws-cn",
|
|
873
|
+
outputs: {
|
|
874
|
+
dnsSuffix: "amazonaws.com.cn",
|
|
875
|
+
dualStackDnsSuffix: "api.amazonwebservices.com.cn",
|
|
876
|
+
implicitGlobalRegion: "cn-northwest-1",
|
|
877
|
+
name: "aws-cn",
|
|
878
|
+
supportsDualStack: true,
|
|
879
|
+
supportsFIPS: true
|
|
880
|
+
},
|
|
881
|
+
regionRegex: "^cn\\-\\w+\\-\\d+$",
|
|
882
|
+
regions: {
|
|
883
|
+
"aws-cn-global": {
|
|
884
|
+
description: "AWS China global region"
|
|
885
|
+
},
|
|
886
|
+
"cn-north-1": {
|
|
887
|
+
description: "China (Beijing)"
|
|
888
|
+
},
|
|
889
|
+
"cn-northwest-1": {
|
|
890
|
+
description: "China (Ningxia)"
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}, {
|
|
894
|
+
id: "aws-us-gov",
|
|
895
|
+
outputs: {
|
|
896
|
+
dnsSuffix: "amazonaws.com",
|
|
897
|
+
dualStackDnsSuffix: "api.aws",
|
|
898
|
+
implicitGlobalRegion: "us-gov-west-1",
|
|
899
|
+
name: "aws-us-gov",
|
|
900
|
+
supportsDualStack: true,
|
|
901
|
+
supportsFIPS: true
|
|
902
|
+
},
|
|
903
|
+
regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
|
|
904
|
+
regions: {
|
|
905
|
+
"aws-us-gov-global": {
|
|
906
|
+
description: "AWS GovCloud (US) global region"
|
|
907
|
+
},
|
|
908
|
+
"us-gov-east-1": {
|
|
909
|
+
description: "AWS GovCloud (US-East)"
|
|
910
|
+
},
|
|
911
|
+
"us-gov-west-1": {
|
|
912
|
+
description: "AWS GovCloud (US-West)"
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}, {
|
|
916
|
+
id: "aws-iso",
|
|
917
|
+
outputs: {
|
|
918
|
+
dnsSuffix: "c2s.ic.gov",
|
|
919
|
+
dualStackDnsSuffix: "c2s.ic.gov",
|
|
920
|
+
implicitGlobalRegion: "us-iso-east-1",
|
|
921
|
+
name: "aws-iso",
|
|
922
|
+
supportsDualStack: false,
|
|
923
|
+
supportsFIPS: true
|
|
924
|
+
},
|
|
925
|
+
regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
|
|
926
|
+
regions: {
|
|
927
|
+
"aws-iso-global": {
|
|
928
|
+
description: "AWS ISO (US) global region"
|
|
929
|
+
},
|
|
930
|
+
"us-iso-east-1": {
|
|
931
|
+
description: "US ISO East"
|
|
932
|
+
},
|
|
933
|
+
"us-iso-west-1": {
|
|
934
|
+
description: "US ISO WEST"
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}, {
|
|
938
|
+
id: "aws-iso-b",
|
|
939
|
+
outputs: {
|
|
940
|
+
dnsSuffix: "sc2s.sgov.gov",
|
|
941
|
+
dualStackDnsSuffix: "sc2s.sgov.gov",
|
|
942
|
+
implicitGlobalRegion: "us-isob-east-1",
|
|
943
|
+
name: "aws-iso-b",
|
|
944
|
+
supportsDualStack: false,
|
|
945
|
+
supportsFIPS: true
|
|
946
|
+
},
|
|
947
|
+
regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
|
|
948
|
+
regions: {
|
|
949
|
+
"aws-iso-b-global": {
|
|
950
|
+
description: "AWS ISOB (US) global region"
|
|
951
|
+
},
|
|
952
|
+
"us-isob-east-1": {
|
|
953
|
+
description: "US ISOB East (Ohio)"
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}, {
|
|
957
|
+
id: "aws-iso-e",
|
|
958
|
+
outputs: {
|
|
959
|
+
dnsSuffix: "cloud.adc-e.uk",
|
|
960
|
+
dualStackDnsSuffix: "cloud.adc-e.uk",
|
|
961
|
+
implicitGlobalRegion: "eu-isoe-west-1",
|
|
962
|
+
name: "aws-iso-e",
|
|
963
|
+
supportsDualStack: false,
|
|
964
|
+
supportsFIPS: true
|
|
965
|
+
},
|
|
966
|
+
regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$",
|
|
967
|
+
regions: {
|
|
968
|
+
"eu-isoe-west-1": {
|
|
969
|
+
description: "EU ISOE West"
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}, {
|
|
973
|
+
id: "aws-iso-f",
|
|
974
|
+
outputs: {
|
|
975
|
+
dnsSuffix: "csp.hci.ic.gov",
|
|
976
|
+
dualStackDnsSuffix: "csp.hci.ic.gov",
|
|
977
|
+
implicitGlobalRegion: "us-isof-south-1",
|
|
978
|
+
name: "aws-iso-f",
|
|
979
|
+
supportsDualStack: false,
|
|
980
|
+
supportsFIPS: true
|
|
981
|
+
},
|
|
982
|
+
regionRegex: "^us\\-isof\\-\\w+\\-\\d+$",
|
|
983
|
+
regions: {
|
|
984
|
+
"aws-iso-f-global": {
|
|
985
|
+
description: "AWS ISOF global region"
|
|
986
|
+
},
|
|
987
|
+
"us-isof-east-1": {
|
|
988
|
+
description: "US ISOF EAST"
|
|
989
|
+
},
|
|
990
|
+
"us-isof-south-1": {
|
|
991
|
+
description: "US ISOF SOUTH"
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}],
|
|
995
|
+
version: "1.1"
|
|
996
|
+
};
|
|
997
|
+
var selectedPartitionsInfo = partitions_default;
|
|
998
|
+
var selectedUserAgentPrefix = "";
|
|
999
|
+
var partition = /* @__PURE__ */ __name((value) => {
|
|
1000
|
+
const { partitions } = selectedPartitionsInfo;
|
|
1001
|
+
for (const partition2 of partitions) {
|
|
1002
|
+
const { regions, outputs } = partition2;
|
|
1003
|
+
for (const [region, regionData] of Object.entries(regions)) {
|
|
1004
|
+
if (region === value) {
|
|
1005
|
+
return {
|
|
1006
|
+
...outputs,
|
|
1007
|
+
...regionData
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
for (const partition2 of partitions) {
|
|
1013
|
+
const { regionRegex, outputs } = partition2;
|
|
1014
|
+
if (new RegExp(regionRegex).test(value)) {
|
|
1015
|
+
return {
|
|
1016
|
+
...outputs
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws");
|
|
1021
|
+
if (!DEFAULT_PARTITION) {
|
|
1022
|
+
throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");
|
|
1023
|
+
}
|
|
1024
|
+
return {
|
|
1025
|
+
...DEFAULT_PARTITION.outputs
|
|
1026
|
+
};
|
|
1027
|
+
}, "partition");
|
|
1028
|
+
var setPartitionInfo = /* @__PURE__ */ __name((partitionsInfo, userAgentPrefix = "") => {
|
|
1029
|
+
selectedPartitionsInfo = partitionsInfo;
|
|
1030
|
+
selectedUserAgentPrefix = userAgentPrefix;
|
|
1031
|
+
}, "setPartitionInfo");
|
|
1032
|
+
var useDefaultPartitionInfo = /* @__PURE__ */ __name(() => {
|
|
1033
|
+
setPartitionInfo(partitions_default, "");
|
|
1034
|
+
}, "useDefaultPartitionInfo");
|
|
1035
|
+
var getUserAgentPrefix = /* @__PURE__ */ __name(() => selectedUserAgentPrefix, "getUserAgentPrefix");
|
|
1036
|
+
var awsEndpointFunctions = {
|
|
1037
|
+
isVirtualHostableS3Bucket,
|
|
1038
|
+
parseArn,
|
|
1039
|
+
partition
|
|
1040
|
+
};
|
|
1041
|
+
import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions;
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
// ../../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js
|
|
1045
|
+
var require_dist_cjs16 = __commonJS((exports, module) => {
|
|
1046
|
+
var __defProp = Object.defineProperty;
|
|
1047
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1048
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1049
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1050
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1051
|
+
var __export = (target, all) => {
|
|
1052
|
+
for (var name in all)
|
|
1053
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1054
|
+
};
|
|
1055
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1056
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1057
|
+
for (let key of __getOwnPropNames(from))
|
|
1058
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1059
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1060
|
+
}
|
|
1061
|
+
return to;
|
|
1062
|
+
};
|
|
1063
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1064
|
+
var index_exports = {};
|
|
1065
|
+
__export(index_exports, {
|
|
1066
|
+
DEFAULT_UA_APP_ID: () => DEFAULT_UA_APP_ID,
|
|
1067
|
+
getUserAgentMiddlewareOptions: () => getUserAgentMiddlewareOptions,
|
|
1068
|
+
getUserAgentPlugin: () => getUserAgentPlugin,
|
|
1069
|
+
resolveUserAgentConfig: () => resolveUserAgentConfig,
|
|
1070
|
+
userAgentMiddleware: () => userAgentMiddleware
|
|
1071
|
+
});
|
|
1072
|
+
module.exports = __toCommonJS(index_exports);
|
|
1073
|
+
var import_core = require_dist_cjs7();
|
|
1074
|
+
var DEFAULT_UA_APP_ID = undefined;
|
|
1075
|
+
function isValidUserAgentAppId(appId) {
|
|
1076
|
+
if (appId === undefined) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
return typeof appId === "string" && appId.length <= 50;
|
|
1080
|
+
}
|
|
1081
|
+
__name(isValidUserAgentAppId, "isValidUserAgentAppId");
|
|
1082
|
+
function resolveUserAgentConfig(input) {
|
|
1083
|
+
const normalizedAppIdProvider = (0, import_core.normalizeProvider)(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
|
|
1084
|
+
const { customUserAgent } = input;
|
|
1085
|
+
return Object.assign(input, {
|
|
1086
|
+
customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
|
|
1087
|
+
userAgentAppId: /* @__PURE__ */ __name(async () => {
|
|
1088
|
+
const appId = await normalizedAppIdProvider();
|
|
1089
|
+
if (!isValidUserAgentAppId(appId)) {
|
|
1090
|
+
const logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
|
|
1091
|
+
if (typeof appId !== "string") {
|
|
1092
|
+
logger?.warn("userAgentAppId must be a string or undefined.");
|
|
1093
|
+
} else if (appId.length > 50) {
|
|
1094
|
+
logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return appId;
|
|
1098
|
+
}, "userAgentAppId")
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
__name(resolveUserAgentConfig, "resolveUserAgentConfig");
|
|
1102
|
+
var import_util_endpoints = require_dist_cjs15();
|
|
1103
|
+
var import_protocol_http = require_dist_cjs4();
|
|
1104
|
+
var import_core2 = require_dist_cjs10();
|
|
1105
|
+
var ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
|
|
1106
|
+
async function checkFeatures(context, config, args) {
|
|
1107
|
+
const request = args.request;
|
|
1108
|
+
if (request?.headers?.["smithy-protocol"] === "rpc-v2-cbor") {
|
|
1109
|
+
(0, import_core2.setFeature)(context, "PROTOCOL_RPC_V2_CBOR", "M");
|
|
1110
|
+
}
|
|
1111
|
+
if (typeof config.retryStrategy === "function") {
|
|
1112
|
+
const retryStrategy = await config.retryStrategy();
|
|
1113
|
+
if (typeof retryStrategy.acquireInitialRetryToken === "function") {
|
|
1114
|
+
if (retryStrategy.constructor?.name?.includes("Adaptive")) {
|
|
1115
|
+
(0, import_core2.setFeature)(context, "RETRY_MODE_ADAPTIVE", "F");
|
|
1116
|
+
} else {
|
|
1117
|
+
(0, import_core2.setFeature)(context, "RETRY_MODE_STANDARD", "E");
|
|
1118
|
+
}
|
|
1119
|
+
} else {
|
|
1120
|
+
(0, import_core2.setFeature)(context, "RETRY_MODE_LEGACY", "D");
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
if (typeof config.accountIdEndpointMode === "function") {
|
|
1124
|
+
const endpointV2 = context.endpointV2;
|
|
1125
|
+
if (String(endpointV2?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
|
|
1126
|
+
(0, import_core2.setFeature)(context, "ACCOUNT_ID_ENDPOINT", "O");
|
|
1127
|
+
}
|
|
1128
|
+
switch (await config.accountIdEndpointMode?.()) {
|
|
1129
|
+
case "disabled":
|
|
1130
|
+
(0, import_core2.setFeature)(context, "ACCOUNT_ID_MODE_DISABLED", "Q");
|
|
1131
|
+
break;
|
|
1132
|
+
case "preferred":
|
|
1133
|
+
(0, import_core2.setFeature)(context, "ACCOUNT_ID_MODE_PREFERRED", "P");
|
|
1134
|
+
break;
|
|
1135
|
+
case "required":
|
|
1136
|
+
(0, import_core2.setFeature)(context, "ACCOUNT_ID_MODE_REQUIRED", "R");
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
const identity = context.__smithy_context?.selectedHttpAuthScheme?.identity;
|
|
1141
|
+
if (identity?.$source) {
|
|
1142
|
+
const credentials = identity;
|
|
1143
|
+
if (credentials.accountId) {
|
|
1144
|
+
(0, import_core2.setFeature)(context, "RESOLVED_ACCOUNT_ID", "T");
|
|
1145
|
+
}
|
|
1146
|
+
for (const [key, value] of Object.entries(credentials.$source ?? {})) {
|
|
1147
|
+
(0, import_core2.setFeature)(context, key, value);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
__name(checkFeatures, "checkFeatures");
|
|
1152
|
+
var USER_AGENT = "user-agent";
|
|
1153
|
+
var X_AMZ_USER_AGENT = "x-amz-user-agent";
|
|
1154
|
+
var SPACE = " ";
|
|
1155
|
+
var UA_NAME_SEPARATOR = "/";
|
|
1156
|
+
var UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g;
|
|
1157
|
+
var UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g;
|
|
1158
|
+
var UA_ESCAPE_CHAR = "-";
|
|
1159
|
+
var BYTE_LIMIT = 1024;
|
|
1160
|
+
function encodeFeatures(features) {
|
|
1161
|
+
let buffer = "";
|
|
1162
|
+
for (const key in features) {
|
|
1163
|
+
const val = features[key];
|
|
1164
|
+
if (buffer.length + val.length + 1 <= BYTE_LIMIT) {
|
|
1165
|
+
if (buffer.length) {
|
|
1166
|
+
buffer += "," + val;
|
|
1167
|
+
} else {
|
|
1168
|
+
buffer += val;
|
|
1169
|
+
}
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
break;
|
|
1173
|
+
}
|
|
1174
|
+
return buffer;
|
|
1175
|
+
}
|
|
1176
|
+
__name(encodeFeatures, "encodeFeatures");
|
|
1177
|
+
var userAgentMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => {
|
|
1178
|
+
const { request } = args;
|
|
1179
|
+
if (!import_protocol_http.HttpRequest.isInstance(request)) {
|
|
1180
|
+
return next(args);
|
|
1181
|
+
}
|
|
1182
|
+
const { headers } = request;
|
|
1183
|
+
const userAgent = context?.userAgent?.map(escapeUserAgent) || [];
|
|
1184
|
+
const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent);
|
|
1185
|
+
await checkFeatures(context, options, args);
|
|
1186
|
+
const awsContext = context;
|
|
1187
|
+
defaultUserAgent.push(`m/${encodeFeatures(Object.assign({}, context.__smithy_context?.features, awsContext.__aws_sdk_context?.features))}`);
|
|
1188
|
+
const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
|
|
1189
|
+
const appId = await options.userAgentAppId();
|
|
1190
|
+
if (appId) {
|
|
1191
|
+
defaultUserAgent.push(escapeUserAgent([`app/${appId}`]));
|
|
1192
|
+
}
|
|
1193
|
+
const prefix = (0, import_util_endpoints.getUserAgentPrefix)();
|
|
1194
|
+
const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(SPACE);
|
|
1195
|
+
const normalUAValue = [
|
|
1196
|
+
...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")),
|
|
1197
|
+
...customUserAgent
|
|
1198
|
+
].join(SPACE);
|
|
1199
|
+
if (options.runtime !== "browser") {
|
|
1200
|
+
if (normalUAValue) {
|
|
1201
|
+
headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue;
|
|
1202
|
+
}
|
|
1203
|
+
headers[USER_AGENT] = sdkUserAgentValue;
|
|
1204
|
+
} else {
|
|
1205
|
+
headers[X_AMZ_USER_AGENT] = sdkUserAgentValue;
|
|
1206
|
+
}
|
|
1207
|
+
return next({
|
|
1208
|
+
...args,
|
|
1209
|
+
request
|
|
1210
|
+
});
|
|
1211
|
+
}, "userAgentMiddleware");
|
|
1212
|
+
var escapeUserAgent = /* @__PURE__ */ __name((userAgentPair) => {
|
|
1213
|
+
const name = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR);
|
|
1214
|
+
const version = userAgentPair[1]?.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR);
|
|
1215
|
+
const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR);
|
|
1216
|
+
const prefix = name.substring(0, prefixSeparatorIndex);
|
|
1217
|
+
let uaName = name.substring(prefixSeparatorIndex + 1);
|
|
1218
|
+
if (prefix === "api") {
|
|
1219
|
+
uaName = uaName.toLowerCase();
|
|
1220
|
+
}
|
|
1221
|
+
return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item, index) => {
|
|
1222
|
+
switch (index) {
|
|
1223
|
+
case 0:
|
|
1224
|
+
return item;
|
|
1225
|
+
case 1:
|
|
1226
|
+
return `${acc}/${item}`;
|
|
1227
|
+
default:
|
|
1228
|
+
return `${acc}#${item}`;
|
|
1229
|
+
}
|
|
1230
|
+
}, "");
|
|
1231
|
+
}, "escapeUserAgent");
|
|
1232
|
+
var getUserAgentMiddlewareOptions = {
|
|
1233
|
+
name: "getUserAgentMiddleware",
|
|
1234
|
+
step: "build",
|
|
1235
|
+
priority: "low",
|
|
1236
|
+
tags: ["SET_USER_AGENT", "USER_AGENT"],
|
|
1237
|
+
override: true
|
|
1238
|
+
};
|
|
1239
|
+
var getUserAgentPlugin = /* @__PURE__ */ __name((config) => ({
|
|
1240
|
+
applyToStack: /* @__PURE__ */ __name((clientStack) => {
|
|
1241
|
+
clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);
|
|
1242
|
+
}, "applyToStack")
|
|
1243
|
+
}), "getUserAgentPlugin");
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
// ../../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js
|
|
1247
|
+
var require_dist_cjs17 = __commonJS((exports, module) => {
|
|
1248
|
+
var __defProp = Object.defineProperty;
|
|
1249
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1250
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1251
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1252
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1253
|
+
var __export = (target, all) => {
|
|
1254
|
+
for (var name in all)
|
|
1255
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1256
|
+
};
|
|
1257
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1258
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1259
|
+
for (let key of __getOwnPropNames(from))
|
|
1260
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1261
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1262
|
+
}
|
|
1263
|
+
return to;
|
|
1264
|
+
};
|
|
1265
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1266
|
+
var src_exports = {};
|
|
1267
|
+
__export(src_exports, {
|
|
1268
|
+
SelectorType: () => SelectorType,
|
|
1269
|
+
booleanSelector: () => booleanSelector,
|
|
1270
|
+
numberSelector: () => numberSelector
|
|
1271
|
+
});
|
|
1272
|
+
module.exports = __toCommonJS(src_exports);
|
|
1273
|
+
var booleanSelector = /* @__PURE__ */ __name((obj, key, type) => {
|
|
1274
|
+
if (!(key in obj))
|
|
1275
|
+
return;
|
|
1276
|
+
if (obj[key] === "true")
|
|
1277
|
+
return true;
|
|
1278
|
+
if (obj[key] === "false")
|
|
1279
|
+
return false;
|
|
1280
|
+
throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
|
|
1281
|
+
}, "booleanSelector");
|
|
1282
|
+
var numberSelector = /* @__PURE__ */ __name((obj, key, type) => {
|
|
1283
|
+
if (!(key in obj))
|
|
1284
|
+
return;
|
|
1285
|
+
const numberValue = parseInt(obj[key], 10);
|
|
1286
|
+
if (Number.isNaN(numberValue)) {
|
|
1287
|
+
throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`);
|
|
1288
|
+
}
|
|
1289
|
+
return numberValue;
|
|
1290
|
+
}, "numberSelector");
|
|
1291
|
+
var SelectorType = /* @__PURE__ */ ((SelectorType2) => {
|
|
1292
|
+
SelectorType2["ENV"] = "env";
|
|
1293
|
+
SelectorType2["CONFIG"] = "shared config entry";
|
|
1294
|
+
return SelectorType2;
|
|
1295
|
+
})(SelectorType || {});
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
// ../../../../node_modules/@smithy/config-resolver/dist-cjs/index.js
|
|
1299
|
+
var require_dist_cjs18 = __commonJS((exports, module) => {
|
|
1300
|
+
var __defProp = Object.defineProperty;
|
|
1301
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1302
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1303
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1304
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1305
|
+
var __export = (target, all) => {
|
|
1306
|
+
for (var name in all)
|
|
1307
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1308
|
+
};
|
|
1309
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1310
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1311
|
+
for (let key of __getOwnPropNames(from))
|
|
1312
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1313
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1314
|
+
}
|
|
1315
|
+
return to;
|
|
1316
|
+
};
|
|
1317
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1318
|
+
var src_exports = {};
|
|
1319
|
+
__export(src_exports, {
|
|
1320
|
+
CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT,
|
|
1321
|
+
CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT,
|
|
1322
|
+
DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT,
|
|
1323
|
+
DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT,
|
|
1324
|
+
ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT,
|
|
1325
|
+
ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT,
|
|
1326
|
+
NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS,
|
|
1327
|
+
NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS,
|
|
1328
|
+
NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
|
|
1329
|
+
NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
|
|
1330
|
+
REGION_ENV_NAME: () => REGION_ENV_NAME,
|
|
1331
|
+
REGION_INI_NAME: () => REGION_INI_NAME,
|
|
1332
|
+
getRegionInfo: () => getRegionInfo,
|
|
1333
|
+
resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig,
|
|
1334
|
+
resolveEndpointsConfig: () => resolveEndpointsConfig,
|
|
1335
|
+
resolveRegionConfig: () => resolveRegionConfig
|
|
1336
|
+
});
|
|
1337
|
+
module.exports = __toCommonJS(src_exports);
|
|
1338
|
+
var import_util_config_provider = require_dist_cjs17();
|
|
1339
|
+
var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
|
|
1340
|
+
var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
|
|
1341
|
+
var DEFAULT_USE_DUALSTACK_ENDPOINT = false;
|
|
1342
|
+
var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
|
|
1343
|
+
environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV),
|
|
1344
|
+
configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG),
|
|
1345
|
+
default: false
|
|
1346
|
+
};
|
|
1347
|
+
var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
|
|
1348
|
+
var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
|
|
1349
|
+
var DEFAULT_USE_FIPS_ENDPOINT = false;
|
|
1350
|
+
var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
|
|
1351
|
+
environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV),
|
|
1352
|
+
configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG),
|
|
1353
|
+
default: false
|
|
1354
|
+
};
|
|
1355
|
+
var import_util_middleware = require_dist_cjs2();
|
|
1356
|
+
var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => {
|
|
1357
|
+
const { tls, endpoint, urlParser, useDualstackEndpoint } = input;
|
|
1358
|
+
return Object.assign(input, {
|
|
1359
|
+
tls: tls ?? true,
|
|
1360
|
+
endpoint: (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint),
|
|
1361
|
+
isCustomEndpoint: true,
|
|
1362
|
+
useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(useDualstackEndpoint ?? false)
|
|
1363
|
+
});
|
|
1364
|
+
}, "resolveCustomEndpointsConfig");
|
|
1365
|
+
var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => {
|
|
1366
|
+
const { tls = true } = input;
|
|
1367
|
+
const region = await input.region();
|
|
1368
|
+
const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
|
|
1369
|
+
if (!dnsHostRegex.test(region)) {
|
|
1370
|
+
throw new Error("Invalid region in client config");
|
|
1371
|
+
}
|
|
1372
|
+
const useDualstackEndpoint = await input.useDualstackEndpoint();
|
|
1373
|
+
const useFipsEndpoint = await input.useFipsEndpoint();
|
|
1374
|
+
const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {};
|
|
1375
|
+
if (!hostname) {
|
|
1376
|
+
throw new Error("Cannot resolve hostname from client config");
|
|
1377
|
+
}
|
|
1378
|
+
return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`);
|
|
1379
|
+
}, "getEndpointFromRegion");
|
|
1380
|
+
var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => {
|
|
1381
|
+
const useDualstackEndpoint = (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false);
|
|
1382
|
+
const { endpoint, useFipsEndpoint, urlParser, tls } = input;
|
|
1383
|
+
return Object.assign(input, {
|
|
1384
|
+
tls: tls ?? true,
|
|
1385
|
+
endpoint: endpoint ? (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }),
|
|
1386
|
+
isCustomEndpoint: !!endpoint,
|
|
1387
|
+
useDualstackEndpoint
|
|
1388
|
+
});
|
|
1389
|
+
}, "resolveEndpointsConfig");
|
|
1390
|
+
var REGION_ENV_NAME = "AWS_REGION";
|
|
1391
|
+
var REGION_INI_NAME = "region";
|
|
1392
|
+
var NODE_REGION_CONFIG_OPTIONS = {
|
|
1393
|
+
environmentVariableSelector: (env) => env[REGION_ENV_NAME],
|
|
1394
|
+
configFileSelector: (profile) => profile[REGION_INI_NAME],
|
|
1395
|
+
default: () => {
|
|
1396
|
+
throw new Error("Region is missing");
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
var NODE_REGION_CONFIG_FILE_OPTIONS = {
|
|
1400
|
+
preferredFile: "credentials"
|
|
1401
|
+
};
|
|
1402
|
+
var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion");
|
|
1403
|
+
var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion");
|
|
1404
|
+
var resolveRegionConfig = /* @__PURE__ */ __name((input) => {
|
|
1405
|
+
const { region, useFipsEndpoint } = input;
|
|
1406
|
+
if (!region) {
|
|
1407
|
+
throw new Error("Region is missing");
|
|
1408
|
+
}
|
|
1409
|
+
return Object.assign(input, {
|
|
1410
|
+
region: async () => {
|
|
1411
|
+
if (typeof region === "string") {
|
|
1412
|
+
return getRealRegion(region);
|
|
1413
|
+
}
|
|
1414
|
+
const providedRegion = await region();
|
|
1415
|
+
return getRealRegion(providedRegion);
|
|
1416
|
+
},
|
|
1417
|
+
useFipsEndpoint: async () => {
|
|
1418
|
+
const providedRegion = typeof region === "string" ? region : await region();
|
|
1419
|
+
if (isFipsRegion(providedRegion)) {
|
|
1420
|
+
return true;
|
|
1421
|
+
}
|
|
1422
|
+
return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
}, "resolveRegionConfig");
|
|
1426
|
+
var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => variants.find(({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack"))?.hostname, "getHostnameFromVariants");
|
|
1427
|
+
var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : undefined, "getResolvedHostname");
|
|
1428
|
+
var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition");
|
|
1429
|
+
var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => {
|
|
1430
|
+
if (signingRegion) {
|
|
1431
|
+
return signingRegion;
|
|
1432
|
+
} else if (useFipsEndpoint) {
|
|
1433
|
+
const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\.");
|
|
1434
|
+
const regionRegexmatchArray = hostname.match(regionRegexJs);
|
|
1435
|
+
if (regionRegexmatchArray) {
|
|
1436
|
+
return regionRegexmatchArray[0].slice(1, -1);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}, "getResolvedSigningRegion");
|
|
1440
|
+
var getRegionInfo = /* @__PURE__ */ __name((region, {
|
|
1441
|
+
useFipsEndpoint = false,
|
|
1442
|
+
useDualstackEndpoint = false,
|
|
1443
|
+
signingService,
|
|
1444
|
+
regionHash,
|
|
1445
|
+
partitionHash
|
|
1446
|
+
}) => {
|
|
1447
|
+
const partition = getResolvedPartition(region, { partitionHash });
|
|
1448
|
+
const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
|
|
1449
|
+
const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
|
|
1450
|
+
const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
|
|
1451
|
+
const partitionHostname = getHostnameFromVariants(partitionHash[partition]?.variants, hostnameOptions);
|
|
1452
|
+
const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname });
|
|
1453
|
+
if (hostname === undefined) {
|
|
1454
|
+
throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`);
|
|
1455
|
+
}
|
|
1456
|
+
const signingRegion = getResolvedSigningRegion(hostname, {
|
|
1457
|
+
signingRegion: regionHash[resolvedRegion]?.signingRegion,
|
|
1458
|
+
regionRegex: partitionHash[partition].regionRegex,
|
|
1459
|
+
useFipsEndpoint
|
|
1460
|
+
});
|
|
1461
|
+
return {
|
|
1462
|
+
partition,
|
|
1463
|
+
signingService,
|
|
1464
|
+
hostname,
|
|
1465
|
+
...signingRegion && { signingRegion },
|
|
1466
|
+
...regionHash[resolvedRegion]?.signingService && {
|
|
1467
|
+
signingService: regionHash[resolvedRegion].signingService
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
}, "getRegionInfo");
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
// ../../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js
|
|
1474
|
+
var require_dist_cjs19 = __commonJS((exports, module) => {
|
|
1475
|
+
var __defProp = Object.defineProperty;
|
|
1476
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1477
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1478
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1479
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1480
|
+
var __export = (target, all) => {
|
|
1481
|
+
for (var name in all)
|
|
1482
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1483
|
+
};
|
|
1484
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1485
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1486
|
+
for (let key of __getOwnPropNames(from))
|
|
1487
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1488
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1489
|
+
}
|
|
1490
|
+
return to;
|
|
1491
|
+
};
|
|
1492
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1493
|
+
var src_exports = {};
|
|
1494
|
+
__export(src_exports, {
|
|
1495
|
+
contentLengthMiddleware: () => contentLengthMiddleware,
|
|
1496
|
+
contentLengthMiddlewareOptions: () => contentLengthMiddlewareOptions,
|
|
1497
|
+
getContentLengthPlugin: () => getContentLengthPlugin
|
|
1498
|
+
});
|
|
1499
|
+
module.exports = __toCommonJS(src_exports);
|
|
1500
|
+
var import_protocol_http = require_dist_cjs4();
|
|
1501
|
+
var CONTENT_LENGTH_HEADER = "content-length";
|
|
1502
|
+
function contentLengthMiddleware(bodyLengthChecker) {
|
|
1503
|
+
return (next) => async (args) => {
|
|
1504
|
+
const request = args.request;
|
|
1505
|
+
if (import_protocol_http.HttpRequest.isInstance(request)) {
|
|
1506
|
+
const { body, headers } = request;
|
|
1507
|
+
if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) {
|
|
1508
|
+
try {
|
|
1509
|
+
const length = bodyLengthChecker(body);
|
|
1510
|
+
request.headers = {
|
|
1511
|
+
...request.headers,
|
|
1512
|
+
[CONTENT_LENGTH_HEADER]: String(length)
|
|
1513
|
+
};
|
|
1514
|
+
} catch (error) {}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
return next({
|
|
1518
|
+
...args,
|
|
1519
|
+
request
|
|
1520
|
+
});
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
__name(contentLengthMiddleware, "contentLengthMiddleware");
|
|
1524
|
+
var contentLengthMiddlewareOptions = {
|
|
1525
|
+
step: "build",
|
|
1526
|
+
tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
|
|
1527
|
+
name: "contentLengthMiddleware",
|
|
1528
|
+
override: true
|
|
1529
|
+
};
|
|
1530
|
+
var getContentLengthPlugin = /* @__PURE__ */ __name((options) => ({
|
|
1531
|
+
applyToStack: (clientStack) => {
|
|
1532
|
+
clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
|
|
1533
|
+
}
|
|
1534
|
+
}), "getContentLengthPlugin");
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
// ../../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js
|
|
1538
|
+
var require_getHomeDir = __commonJS((exports) => {
|
|
1539
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1540
|
+
exports.getHomeDir = undefined;
|
|
1541
|
+
var os_1 = __require("node:os");
|
|
1542
|
+
var path_1 = __require("node:path");
|
|
1543
|
+
var homeDirCache = {};
|
|
1544
|
+
var getHomeDirCacheKey = () => {
|
|
1545
|
+
if (process && process.geteuid) {
|
|
1546
|
+
return `${process.geteuid()}`;
|
|
1547
|
+
}
|
|
1548
|
+
return "DEFAULT";
|
|
1549
|
+
};
|
|
1550
|
+
var getHomeDir2 = () => {
|
|
1551
|
+
const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env;
|
|
1552
|
+
if (HOME)
|
|
1553
|
+
return HOME;
|
|
1554
|
+
if (USERPROFILE)
|
|
1555
|
+
return USERPROFILE;
|
|
1556
|
+
if (HOMEPATH)
|
|
1557
|
+
return `${HOMEDRIVE}${HOMEPATH}`;
|
|
1558
|
+
const homeDirCacheKey = getHomeDirCacheKey();
|
|
1559
|
+
if (!homeDirCache[homeDirCacheKey])
|
|
1560
|
+
homeDirCache[homeDirCacheKey] = (0, os_1.homedir)();
|
|
1561
|
+
return homeDirCache[homeDirCacheKey];
|
|
1562
|
+
};
|
|
1563
|
+
exports.getHomeDir = getHomeDir2;
|
|
1564
|
+
});
|
|
1565
|
+
|
|
1566
|
+
// ../../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js
|
|
1567
|
+
var require_getSSOTokenFilepath = __commonJS((exports) => {
|
|
1568
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1569
|
+
exports.getSSOTokenFilepath = undefined;
|
|
1570
|
+
var crypto_1 = __require("node:crypto");
|
|
1571
|
+
var path_1 = __require("node:path");
|
|
1572
|
+
var getHomeDir_1 = require_getHomeDir();
|
|
1573
|
+
var getSSOTokenFilepath2 = (id) => {
|
|
1574
|
+
const hasher = (0, crypto_1.createHash)("sha1");
|
|
1575
|
+
const cacheName = hasher.update(id).digest("hex");
|
|
1576
|
+
return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`);
|
|
1577
|
+
};
|
|
1578
|
+
exports.getSSOTokenFilepath = getSSOTokenFilepath2;
|
|
1579
|
+
});
|
|
1580
|
+
|
|
1581
|
+
// ../../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js
|
|
1582
|
+
var require_getSSOTokenFromFile = __commonJS((exports) => {
|
|
1583
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1584
|
+
exports.getSSOTokenFromFile = undefined;
|
|
1585
|
+
var fs_1 = __require("node:fs");
|
|
1586
|
+
var getSSOTokenFilepath_1 = require_getSSOTokenFilepath();
|
|
1587
|
+
var { readFile } = fs_1.promises;
|
|
1588
|
+
var getSSOTokenFromFile2 = async (id) => {
|
|
1589
|
+
const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id);
|
|
1590
|
+
const ssoTokenText = await readFile(ssoTokenFilepath, "utf8");
|
|
1591
|
+
return JSON.parse(ssoTokenText);
|
|
1592
|
+
};
|
|
1593
|
+
exports.getSSOTokenFromFile = getSSOTokenFromFile2;
|
|
1594
|
+
});
|
|
1595
|
+
|
|
1596
|
+
// ../../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js
|
|
1597
|
+
var require_slurpFile = __commonJS((exports) => {
|
|
1598
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1599
|
+
exports.slurpFile = undefined;
|
|
1600
|
+
var fs_1 = __require("node:fs");
|
|
1601
|
+
var { readFile } = fs_1.promises;
|
|
1602
|
+
var filePromisesHash = {};
|
|
1603
|
+
var slurpFile = (path, options) => {
|
|
1604
|
+
if (!filePromisesHash[path] || (options === null || options === undefined ? undefined : options.ignoreCache)) {
|
|
1605
|
+
filePromisesHash[path] = readFile(path, "utf8");
|
|
1606
|
+
}
|
|
1607
|
+
return filePromisesHash[path];
|
|
1608
|
+
};
|
|
1609
|
+
exports.slurpFile = slurpFile;
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
// ../../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js
|
|
1613
|
+
var require_dist_cjs20 = __commonJS((exports, module) => {
|
|
1614
|
+
var __defProp = Object.defineProperty;
|
|
1615
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1616
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1617
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1618
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1619
|
+
var __export = (target, all) => {
|
|
1620
|
+
for (var name in all)
|
|
1621
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1622
|
+
};
|
|
1623
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1624
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1625
|
+
for (let key of __getOwnPropNames(from))
|
|
1626
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1627
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1628
|
+
}
|
|
1629
|
+
return to;
|
|
1630
|
+
};
|
|
1631
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
1632
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1633
|
+
var src_exports = {};
|
|
1634
|
+
__export(src_exports, {
|
|
1635
|
+
CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR,
|
|
1636
|
+
DEFAULT_PROFILE: () => DEFAULT_PROFILE,
|
|
1637
|
+
ENV_PROFILE: () => ENV_PROFILE,
|
|
1638
|
+
getProfileName: () => getProfileName,
|
|
1639
|
+
loadSharedConfigFiles: () => loadSharedConfigFiles,
|
|
1640
|
+
loadSsoSessionData: () => loadSsoSessionData,
|
|
1641
|
+
parseKnownFiles: () => parseKnownFiles
|
|
1642
|
+
});
|
|
1643
|
+
module.exports = __toCommonJS(src_exports);
|
|
1644
|
+
__reExport(src_exports, require_getHomeDir(), module.exports);
|
|
1645
|
+
var ENV_PROFILE = "AWS_PROFILE";
|
|
1646
|
+
var DEFAULT_PROFILE = "default";
|
|
1647
|
+
var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName");
|
|
1648
|
+
__reExport(src_exports, require_getSSOTokenFilepath(), module.exports);
|
|
1649
|
+
__reExport(src_exports, require_getSSOTokenFromFile(), module.exports);
|
|
1650
|
+
var import_types = require_dist_cjs();
|
|
1651
|
+
var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => {
|
|
1652
|
+
const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
|
|
1653
|
+
if (indexOfSeparator === -1) {
|
|
1654
|
+
return false;
|
|
1655
|
+
}
|
|
1656
|
+
return Object.values(import_types.IniSectionType).includes(key.substring(0, indexOfSeparator));
|
|
1657
|
+
}).reduce((acc, [key, value]) => {
|
|
1658
|
+
const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
|
|
1659
|
+
const updatedKey = key.substring(0, indexOfSeparator) === import_types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
|
|
1660
|
+
acc[updatedKey] = value;
|
|
1661
|
+
return acc;
|
|
1662
|
+
}, {
|
|
1663
|
+
...data.default && { default: data.default }
|
|
1664
|
+
}), "getConfigData");
|
|
1665
|
+
var import_path = __require("node:path");
|
|
1666
|
+
var import_getHomeDir = require_getHomeDir();
|
|
1667
|
+
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
1668
|
+
var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath");
|
|
1669
|
+
var import_getHomeDir2 = require_getHomeDir();
|
|
1670
|
+
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
1671
|
+
var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath");
|
|
1672
|
+
var import_getHomeDir3 = require_getHomeDir();
|
|
1673
|
+
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
1674
|
+
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
1675
|
+
var parseIni = /* @__PURE__ */ __name((iniData) => {
|
|
1676
|
+
const map = {};
|
|
1677
|
+
let currentSection;
|
|
1678
|
+
let currentSubSection;
|
|
1679
|
+
for (const iniLine of iniData.split(/\r?\n/)) {
|
|
1680
|
+
const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
|
|
1681
|
+
const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
|
|
1682
|
+
if (isSection) {
|
|
1683
|
+
currentSection = undefined;
|
|
1684
|
+
currentSubSection = undefined;
|
|
1685
|
+
const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
|
|
1686
|
+
const matches = prefixKeyRegex.exec(sectionName);
|
|
1687
|
+
if (matches) {
|
|
1688
|
+
const [, prefix, , name] = matches;
|
|
1689
|
+
if (Object.values(import_types.IniSectionType).includes(prefix)) {
|
|
1690
|
+
currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
|
|
1691
|
+
}
|
|
1692
|
+
} else {
|
|
1693
|
+
currentSection = sectionName;
|
|
1694
|
+
}
|
|
1695
|
+
if (profileNameBlockList.includes(sectionName)) {
|
|
1696
|
+
throw new Error(`Found invalid profile name "${sectionName}"`);
|
|
1697
|
+
}
|
|
1698
|
+
} else if (currentSection) {
|
|
1699
|
+
const indexOfEqualsSign = trimmedLine.indexOf("=");
|
|
1700
|
+
if (![0, -1].includes(indexOfEqualsSign)) {
|
|
1701
|
+
const [name, value] = [
|
|
1702
|
+
trimmedLine.substring(0, indexOfEqualsSign).trim(),
|
|
1703
|
+
trimmedLine.substring(indexOfEqualsSign + 1).trim()
|
|
1704
|
+
];
|
|
1705
|
+
if (value === "") {
|
|
1706
|
+
currentSubSection = name;
|
|
1707
|
+
} else {
|
|
1708
|
+
if (currentSubSection && iniLine.trimStart() === iniLine) {
|
|
1709
|
+
currentSubSection = undefined;
|
|
1710
|
+
}
|
|
1711
|
+
map[currentSection] = map[currentSection] || {};
|
|
1712
|
+
const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
|
|
1713
|
+
map[currentSection][key] = value;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return map;
|
|
1719
|
+
}, "parseIni");
|
|
1720
|
+
var import_slurpFile = require_slurpFile();
|
|
1721
|
+
var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError");
|
|
1722
|
+
var CONFIG_PREFIX_SEPARATOR = ".";
|
|
1723
|
+
var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => {
|
|
1724
|
+
const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
|
|
1725
|
+
const homeDir = (0, import_getHomeDir3.getHomeDir)();
|
|
1726
|
+
const relativeHomeDirPrefix = "~/";
|
|
1727
|
+
let resolvedFilepath = filepath;
|
|
1728
|
+
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
1729
|
+
resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2));
|
|
1730
|
+
}
|
|
1731
|
+
let resolvedConfigFilepath = configFilepath;
|
|
1732
|
+
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
1733
|
+
resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2));
|
|
1734
|
+
}
|
|
1735
|
+
const parsedFiles = await Promise.all([
|
|
1736
|
+
(0, import_slurpFile.slurpFile)(resolvedConfigFilepath, {
|
|
1737
|
+
ignoreCache: init.ignoreCache
|
|
1738
|
+
}).then(parseIni).then(getConfigData).catch(swallowError),
|
|
1739
|
+
(0, import_slurpFile.slurpFile)(resolvedFilepath, {
|
|
1740
|
+
ignoreCache: init.ignoreCache
|
|
1741
|
+
}).then(parseIni).catch(swallowError)
|
|
1742
|
+
]);
|
|
1743
|
+
return {
|
|
1744
|
+
configFile: parsedFiles[0],
|
|
1745
|
+
credentialsFile: parsedFiles[1]
|
|
1746
|
+
};
|
|
1747
|
+
}, "loadSharedConfigFiles");
|
|
1748
|
+
var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData");
|
|
1749
|
+
var import_slurpFile2 = require_slurpFile();
|
|
1750
|
+
var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError");
|
|
1751
|
+
var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData");
|
|
1752
|
+
var mergeConfigFiles = /* @__PURE__ */ __name((...files) => {
|
|
1753
|
+
const merged = {};
|
|
1754
|
+
for (const file of files) {
|
|
1755
|
+
for (const [key, values] of Object.entries(file)) {
|
|
1756
|
+
if (merged[key] !== undefined) {
|
|
1757
|
+
Object.assign(merged[key], values);
|
|
1758
|
+
} else {
|
|
1759
|
+
merged[key] = values;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
return merged;
|
|
1764
|
+
}, "mergeConfigFiles");
|
|
1765
|
+
var parseKnownFiles = /* @__PURE__ */ __name(async (init) => {
|
|
1766
|
+
const parsedFiles = await loadSharedConfigFiles(init);
|
|
1767
|
+
return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
|
|
1768
|
+
}, "parseKnownFiles");
|
|
1769
|
+
});
|
|
1770
|
+
|
|
1771
|
+
// ../../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js
|
|
1772
|
+
var require_dist_cjs21 = __commonJS((exports, module) => {
|
|
1773
|
+
var __defProp = Object.defineProperty;
|
|
1774
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1775
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1776
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1777
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1778
|
+
var __export = (target, all) => {
|
|
1779
|
+
for (var name in all)
|
|
1780
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1781
|
+
};
|
|
1782
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1783
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1784
|
+
for (let key of __getOwnPropNames(from))
|
|
1785
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1786
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1787
|
+
}
|
|
1788
|
+
return to;
|
|
1789
|
+
};
|
|
1790
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1791
|
+
var src_exports = {};
|
|
1792
|
+
__export(src_exports, {
|
|
1793
|
+
loadConfig: () => loadConfig
|
|
1794
|
+
});
|
|
1795
|
+
module.exports = __toCommonJS(src_exports);
|
|
1796
|
+
var import_property_provider = require_dist_cjs8();
|
|
1797
|
+
function getSelectorName(functionString) {
|
|
1798
|
+
try {
|
|
1799
|
+
const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
|
|
1800
|
+
constants.delete("CONFIG");
|
|
1801
|
+
constants.delete("CONFIG_PREFIX_SEPARATOR");
|
|
1802
|
+
constants.delete("ENV");
|
|
1803
|
+
return [...constants].join(", ");
|
|
1804
|
+
} catch (e) {
|
|
1805
|
+
return functionString;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
__name(getSelectorName, "getSelectorName");
|
|
1809
|
+
var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => {
|
|
1810
|
+
try {
|
|
1811
|
+
const config = envVarSelector(process.env);
|
|
1812
|
+
if (config === undefined) {
|
|
1813
|
+
throw new Error;
|
|
1814
|
+
}
|
|
1815
|
+
return config;
|
|
1816
|
+
} catch (e) {
|
|
1817
|
+
throw new import_property_provider.CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger });
|
|
1818
|
+
}
|
|
1819
|
+
}, "fromEnv");
|
|
1820
|
+
var import_shared_ini_file_loader = require_dist_cjs20();
|
|
1821
|
+
var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => {
|
|
1822
|
+
const profile = (0, import_shared_ini_file_loader.getProfileName)(init);
|
|
1823
|
+
const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init);
|
|
1824
|
+
const profileFromCredentials = credentialsFile[profile] || {};
|
|
1825
|
+
const profileFromConfig = configFile[profile] || {};
|
|
1826
|
+
const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
|
|
1827
|
+
try {
|
|
1828
|
+
const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
|
|
1829
|
+
const configValue = configSelector(mergedProfile, cfgFile);
|
|
1830
|
+
if (configValue === undefined) {
|
|
1831
|
+
throw new Error;
|
|
1832
|
+
}
|
|
1833
|
+
return configValue;
|
|
1834
|
+
} catch (e) {
|
|
1835
|
+
throw new import_property_provider.CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
|
|
1836
|
+
}
|
|
1837
|
+
}, "fromSharedConfigFiles");
|
|
1838
|
+
var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction");
|
|
1839
|
+
var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider.fromStatic)(defaultValue), "fromStatic");
|
|
1840
|
+
var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider.memoize)((0, import_property_provider.chain)(fromEnv(environmentVariableSelector), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue))), "loadConfig");
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
// ../../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js
|
|
1844
|
+
var require_getEndpointUrlConfig = __commonJS((exports) => {
|
|
1845
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1846
|
+
exports.getEndpointUrlConfig = undefined;
|
|
1847
|
+
var shared_ini_file_loader_1 = require_dist_cjs20();
|
|
1848
|
+
var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
|
|
1849
|
+
var CONFIG_ENDPOINT_URL = "endpoint_url";
|
|
1850
|
+
var getEndpointUrlConfig = (serviceId) => ({
|
|
1851
|
+
environmentVariableSelector: (env) => {
|
|
1852
|
+
const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
|
|
1853
|
+
const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
|
|
1854
|
+
if (serviceEndpointUrl)
|
|
1855
|
+
return serviceEndpointUrl;
|
|
1856
|
+
const endpointUrl = env[ENV_ENDPOINT_URL];
|
|
1857
|
+
if (endpointUrl)
|
|
1858
|
+
return endpointUrl;
|
|
1859
|
+
return;
|
|
1860
|
+
},
|
|
1861
|
+
configFileSelector: (profile, config) => {
|
|
1862
|
+
if (config && profile.services) {
|
|
1863
|
+
const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
|
1864
|
+
if (servicesSection) {
|
|
1865
|
+
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
|
|
1866
|
+
const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
|
1867
|
+
if (endpointUrl2)
|
|
1868
|
+
return endpointUrl2;
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
|
|
1872
|
+
if (endpointUrl)
|
|
1873
|
+
return endpointUrl;
|
|
1874
|
+
return;
|
|
1875
|
+
},
|
|
1876
|
+
default: undefined
|
|
1877
|
+
});
|
|
1878
|
+
exports.getEndpointUrlConfig = getEndpointUrlConfig;
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
// ../../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js
|
|
1882
|
+
var require_getEndpointFromConfig = __commonJS((exports) => {
|
|
1883
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1884
|
+
exports.getEndpointFromConfig = undefined;
|
|
1885
|
+
var node_config_provider_1 = require_dist_cjs21();
|
|
1886
|
+
var getEndpointUrlConfig_1 = require_getEndpointUrlConfig();
|
|
1887
|
+
var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId !== null && serviceId !== undefined ? serviceId : ""))();
|
|
1888
|
+
exports.getEndpointFromConfig = getEndpointFromConfig;
|
|
1889
|
+
});
|
|
1890
|
+
|
|
1891
|
+
// ../../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js
|
|
1892
|
+
var require_dist_cjs22 = __commonJS((exports, module) => {
|
|
1893
|
+
var __defProp = Object.defineProperty;
|
|
1894
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1895
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1896
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1897
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1898
|
+
var __export = (target, all) => {
|
|
1899
|
+
for (var name in all)
|
|
1900
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1901
|
+
};
|
|
1902
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1903
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1904
|
+
for (let key of __getOwnPropNames(from))
|
|
1905
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1906
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1907
|
+
}
|
|
1908
|
+
return to;
|
|
1909
|
+
};
|
|
1910
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1911
|
+
var src_exports = {};
|
|
1912
|
+
__export(src_exports, {
|
|
1913
|
+
parseQueryString: () => parseQueryString
|
|
1914
|
+
});
|
|
1915
|
+
module.exports = __toCommonJS(src_exports);
|
|
1916
|
+
function parseQueryString(querystring) {
|
|
1917
|
+
const query = {};
|
|
1918
|
+
querystring = querystring.replace(/^\?/, "");
|
|
1919
|
+
if (querystring) {
|
|
1920
|
+
for (const pair of querystring.split("&")) {
|
|
1921
|
+
let [key, value = null] = pair.split("=");
|
|
1922
|
+
key = decodeURIComponent(key);
|
|
1923
|
+
if (value) {
|
|
1924
|
+
value = decodeURIComponent(value);
|
|
1925
|
+
}
|
|
1926
|
+
if (!(key in query)) {
|
|
1927
|
+
query[key] = value;
|
|
1928
|
+
} else if (Array.isArray(query[key])) {
|
|
1929
|
+
query[key].push(value);
|
|
1930
|
+
} else {
|
|
1931
|
+
query[key] = [query[key], value];
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return query;
|
|
1936
|
+
}
|
|
1937
|
+
__name(parseQueryString, "parseQueryString");
|
|
1938
|
+
});
|
|
1939
|
+
|
|
1940
|
+
// ../../../../node_modules/@smithy/url-parser/dist-cjs/index.js
|
|
1941
|
+
var require_dist_cjs23 = __commonJS((exports, module) => {
|
|
1942
|
+
var __defProp = Object.defineProperty;
|
|
1943
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1944
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1945
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1946
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1947
|
+
var __export = (target, all) => {
|
|
1948
|
+
for (var name in all)
|
|
1949
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1950
|
+
};
|
|
1951
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1952
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1953
|
+
for (let key of __getOwnPropNames(from))
|
|
1954
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1955
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1956
|
+
}
|
|
1957
|
+
return to;
|
|
1958
|
+
};
|
|
1959
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1960
|
+
var src_exports = {};
|
|
1961
|
+
__export(src_exports, {
|
|
1962
|
+
parseUrl: () => parseUrl
|
|
1963
|
+
});
|
|
1964
|
+
module.exports = __toCommonJS(src_exports);
|
|
1965
|
+
var import_querystring_parser = require_dist_cjs22();
|
|
1966
|
+
var parseUrl = /* @__PURE__ */ __name((url) => {
|
|
1967
|
+
if (typeof url === "string") {
|
|
1968
|
+
return parseUrl(new URL(url));
|
|
1969
|
+
}
|
|
1970
|
+
const { hostname, pathname, port, protocol, search } = url;
|
|
1971
|
+
let query;
|
|
1972
|
+
if (search) {
|
|
1973
|
+
query = (0, import_querystring_parser.parseQueryString)(search);
|
|
1974
|
+
}
|
|
1975
|
+
return {
|
|
1976
|
+
hostname,
|
|
1977
|
+
port: port ? parseInt(port) : undefined,
|
|
1978
|
+
protocol,
|
|
1979
|
+
path: pathname,
|
|
1980
|
+
query
|
|
1981
|
+
};
|
|
1982
|
+
}, "parseUrl");
|
|
1983
|
+
});
|
|
1984
|
+
|
|
1985
|
+
// ../../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js
|
|
1986
|
+
var require_dist_cjs24 = __commonJS((exports, module) => {
|
|
1987
|
+
var __defProp = Object.defineProperty;
|
|
1988
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1989
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1990
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1991
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1992
|
+
var __export = (target, all) => {
|
|
1993
|
+
for (var name in all)
|
|
1994
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1995
|
+
};
|
|
1996
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1997
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1998
|
+
for (let key of __getOwnPropNames(from))
|
|
1999
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2000
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2001
|
+
}
|
|
2002
|
+
return to;
|
|
2003
|
+
};
|
|
2004
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2005
|
+
var src_exports = {};
|
|
2006
|
+
__export(src_exports, {
|
|
2007
|
+
endpointMiddleware: () => endpointMiddleware,
|
|
2008
|
+
endpointMiddlewareOptions: () => endpointMiddlewareOptions,
|
|
2009
|
+
getEndpointFromInstructions: () => getEndpointFromInstructions,
|
|
2010
|
+
getEndpointPlugin: () => getEndpointPlugin,
|
|
2011
|
+
resolveEndpointConfig: () => resolveEndpointConfig,
|
|
2012
|
+
resolveParams: () => resolveParams,
|
|
2013
|
+
toEndpointV1: () => toEndpointV1
|
|
2014
|
+
});
|
|
2015
|
+
module.exports = __toCommonJS(src_exports);
|
|
2016
|
+
var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => {
|
|
2017
|
+
const bucket = endpointParams?.Bucket || "";
|
|
2018
|
+
if (typeof endpointParams.Bucket === "string") {
|
|
2019
|
+
endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
|
|
2020
|
+
}
|
|
2021
|
+
if (isArnBucketName(bucket)) {
|
|
2022
|
+
if (endpointParams.ForcePathStyle === true) {
|
|
2023
|
+
throw new Error("Path-style addressing cannot be used with ARN buckets");
|
|
2024
|
+
}
|
|
2025
|
+
} else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
|
|
2026
|
+
endpointParams.ForcePathStyle = true;
|
|
2027
|
+
}
|
|
2028
|
+
if (endpointParams.DisableMultiRegionAccessPoints) {
|
|
2029
|
+
endpointParams.disableMultiRegionAccessPoints = true;
|
|
2030
|
+
endpointParams.DisableMRAP = true;
|
|
2031
|
+
}
|
|
2032
|
+
return endpointParams;
|
|
2033
|
+
}, "resolveParamsForS3");
|
|
2034
|
+
var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
|
|
2035
|
+
var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
|
|
2036
|
+
var DOTS_PATTERN = /\.\./;
|
|
2037
|
+
var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName");
|
|
2038
|
+
var isArnBucketName = /* @__PURE__ */ __name((bucketName) => {
|
|
2039
|
+
const [arn, partition, service, , , bucket] = bucketName.split(":");
|
|
2040
|
+
const isArn = arn === "arn" && bucketName.split(":").length >= 6;
|
|
2041
|
+
const isValidArn = Boolean(isArn && partition && service && bucket);
|
|
2042
|
+
if (isArn && !isValidArn) {
|
|
2043
|
+
throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
|
|
2044
|
+
}
|
|
2045
|
+
return isValidArn;
|
|
2046
|
+
}, "isArnBucketName");
|
|
2047
|
+
var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => {
|
|
2048
|
+
const configProvider = /* @__PURE__ */ __name(async () => {
|
|
2049
|
+
const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
|
|
2050
|
+
if (typeof configValue === "function") {
|
|
2051
|
+
return configValue();
|
|
2052
|
+
}
|
|
2053
|
+
return configValue;
|
|
2054
|
+
}, "configProvider");
|
|
2055
|
+
if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
|
|
2056
|
+
return async () => {
|
|
2057
|
+
const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
|
|
2058
|
+
const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
|
|
2059
|
+
return configValue;
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
|
|
2063
|
+
return async () => {
|
|
2064
|
+
const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
|
|
2065
|
+
const configValue = credentials?.accountId ?? credentials?.AccountId;
|
|
2066
|
+
return configValue;
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
|
|
2070
|
+
return async () => {
|
|
2071
|
+
const endpoint = await configProvider();
|
|
2072
|
+
if (endpoint && typeof endpoint === "object") {
|
|
2073
|
+
if ("url" in endpoint) {
|
|
2074
|
+
return endpoint.url.href;
|
|
2075
|
+
}
|
|
2076
|
+
if ("hostname" in endpoint) {
|
|
2077
|
+
const { protocol, hostname, port, path } = endpoint;
|
|
2078
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
return endpoint;
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
return configProvider;
|
|
2085
|
+
}, "createConfigValueProvider");
|
|
2086
|
+
var import_getEndpointFromConfig = require_getEndpointFromConfig();
|
|
2087
|
+
var import_url_parser = require_dist_cjs23();
|
|
2088
|
+
var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => {
|
|
2089
|
+
if (typeof endpoint === "object") {
|
|
2090
|
+
if ("url" in endpoint) {
|
|
2091
|
+
return (0, import_url_parser.parseUrl)(endpoint.url);
|
|
2092
|
+
}
|
|
2093
|
+
return endpoint;
|
|
2094
|
+
}
|
|
2095
|
+
return (0, import_url_parser.parseUrl)(endpoint);
|
|
2096
|
+
}, "toEndpointV1");
|
|
2097
|
+
var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => {
|
|
2098
|
+
if (!clientConfig.endpoint) {
|
|
2099
|
+
let endpointFromConfig;
|
|
2100
|
+
if (clientConfig.serviceConfiguredEndpoint) {
|
|
2101
|
+
endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
|
|
2102
|
+
} else {
|
|
2103
|
+
endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId);
|
|
2104
|
+
}
|
|
2105
|
+
if (endpointFromConfig) {
|
|
2106
|
+
clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
|
|
2110
|
+
if (typeof clientConfig.endpointProvider !== "function") {
|
|
2111
|
+
throw new Error("config.endpointProvider is not set.");
|
|
2112
|
+
}
|
|
2113
|
+
const endpoint = clientConfig.endpointProvider(endpointParams, context);
|
|
2114
|
+
return endpoint;
|
|
2115
|
+
}, "getEndpointFromInstructions");
|
|
2116
|
+
var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => {
|
|
2117
|
+
const endpointParams = {};
|
|
2118
|
+
const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
|
|
2119
|
+
for (const [name, instruction] of Object.entries(instructions)) {
|
|
2120
|
+
switch (instruction.type) {
|
|
2121
|
+
case "staticContextParams":
|
|
2122
|
+
endpointParams[name] = instruction.value;
|
|
2123
|
+
break;
|
|
2124
|
+
case "contextParams":
|
|
2125
|
+
endpointParams[name] = commandInput[instruction.name];
|
|
2126
|
+
break;
|
|
2127
|
+
case "clientContextParams":
|
|
2128
|
+
case "builtInParams":
|
|
2129
|
+
endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)();
|
|
2130
|
+
break;
|
|
2131
|
+
case "operationContextParams":
|
|
2132
|
+
endpointParams[name] = instruction.get(commandInput);
|
|
2133
|
+
break;
|
|
2134
|
+
default:
|
|
2135
|
+
throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
if (Object.keys(instructions).length === 0) {
|
|
2139
|
+
Object.assign(endpointParams, clientConfig);
|
|
2140
|
+
}
|
|
2141
|
+
if (String(clientConfig.serviceId).toLowerCase() === "s3") {
|
|
2142
|
+
await resolveParamsForS3(endpointParams);
|
|
2143
|
+
}
|
|
2144
|
+
return endpointParams;
|
|
2145
|
+
}, "resolveParams");
|
|
2146
|
+
var import_core = require_dist_cjs7();
|
|
2147
|
+
var import_util_middleware = require_dist_cjs2();
|
|
2148
|
+
var endpointMiddleware = /* @__PURE__ */ __name(({
|
|
2149
|
+
config,
|
|
2150
|
+
instructions
|
|
2151
|
+
}) => {
|
|
2152
|
+
return (next, context) => async (args) => {
|
|
2153
|
+
if (config.endpoint) {
|
|
2154
|
+
(0, import_core.setFeature)(context, "ENDPOINT_OVERRIDE", "N");
|
|
2155
|
+
}
|
|
2156
|
+
const endpoint = await getEndpointFromInstructions(args.input, {
|
|
2157
|
+
getEndpointParameterInstructions() {
|
|
2158
|
+
return instructions;
|
|
2159
|
+
}
|
|
2160
|
+
}, { ...config }, context);
|
|
2161
|
+
context.endpointV2 = endpoint;
|
|
2162
|
+
context.authSchemes = endpoint.properties?.authSchemes;
|
|
2163
|
+
const authScheme = context.authSchemes?.[0];
|
|
2164
|
+
if (authScheme) {
|
|
2165
|
+
context["signing_region"] = authScheme.signingRegion;
|
|
2166
|
+
context["signing_service"] = authScheme.signingName;
|
|
2167
|
+
const smithyContext = (0, import_util_middleware.getSmithyContext)(context);
|
|
2168
|
+
const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption;
|
|
2169
|
+
if (httpAuthOption) {
|
|
2170
|
+
httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
|
|
2171
|
+
signing_region: authScheme.signingRegion,
|
|
2172
|
+
signingRegion: authScheme.signingRegion,
|
|
2173
|
+
signing_service: authScheme.signingName,
|
|
2174
|
+
signingName: authScheme.signingName,
|
|
2175
|
+
signingRegionSet: authScheme.signingRegionSet
|
|
2176
|
+
}, authScheme.properties);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
return next({
|
|
2180
|
+
...args
|
|
2181
|
+
});
|
|
2182
|
+
};
|
|
2183
|
+
}, "endpointMiddleware");
|
|
2184
|
+
var import_middleware_serde = require_dist_cjs3();
|
|
2185
|
+
var endpointMiddlewareOptions = {
|
|
2186
|
+
step: "serialize",
|
|
2187
|
+
tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
|
|
2188
|
+
name: "endpointV2Middleware",
|
|
2189
|
+
override: true,
|
|
2190
|
+
relation: "before",
|
|
2191
|
+
toMiddleware: import_middleware_serde.serializerMiddlewareOption.name
|
|
2192
|
+
};
|
|
2193
|
+
var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({
|
|
2194
|
+
applyToStack: (clientStack) => {
|
|
2195
|
+
clientStack.addRelativeTo(endpointMiddleware({
|
|
2196
|
+
config,
|
|
2197
|
+
instructions
|
|
2198
|
+
}), endpointMiddlewareOptions);
|
|
2199
|
+
}
|
|
2200
|
+
}), "getEndpointPlugin");
|
|
2201
|
+
var import_getEndpointFromConfig2 = require_getEndpointFromConfig();
|
|
2202
|
+
var resolveEndpointConfig = /* @__PURE__ */ __name((input) => {
|
|
2203
|
+
const tls = input.tls ?? true;
|
|
2204
|
+
const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
|
|
2205
|
+
const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware.normalizeProvider)(endpoint)()) : undefined;
|
|
2206
|
+
const isCustomEndpoint = !!endpoint;
|
|
2207
|
+
const resolvedConfig = Object.assign(input, {
|
|
2208
|
+
endpoint: customEndpointProvider,
|
|
2209
|
+
tls,
|
|
2210
|
+
isCustomEndpoint,
|
|
2211
|
+
useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(useDualstackEndpoint ?? false),
|
|
2212
|
+
useFipsEndpoint: (0, import_util_middleware.normalizeProvider)(useFipsEndpoint ?? false)
|
|
2213
|
+
});
|
|
2214
|
+
let configuredEndpointPromise = undefined;
|
|
2215
|
+
resolvedConfig.serviceConfiguredEndpoint = async () => {
|
|
2216
|
+
if (input.serviceId && !configuredEndpointPromise) {
|
|
2217
|
+
configuredEndpointPromise = (0, import_getEndpointFromConfig2.getEndpointFromConfig)(input.serviceId);
|
|
2218
|
+
}
|
|
2219
|
+
return configuredEndpointPromise;
|
|
2220
|
+
};
|
|
2221
|
+
return resolvedConfig;
|
|
2222
|
+
}, "resolveEndpointConfig");
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
// ../../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js
|
|
2226
|
+
var require_dist_cjs25 = __commonJS((exports, module) => {
|
|
2227
|
+
var __defProp = Object.defineProperty;
|
|
2228
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2229
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2230
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2231
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2232
|
+
var __export = (target, all) => {
|
|
2233
|
+
for (var name in all)
|
|
2234
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2235
|
+
};
|
|
2236
|
+
var __copyProps = (to, from, except, desc) => {
|
|
2237
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
2238
|
+
for (let key of __getOwnPropNames(from))
|
|
2239
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2240
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2241
|
+
}
|
|
2242
|
+
return to;
|
|
2243
|
+
};
|
|
2244
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2245
|
+
var src_exports = {};
|
|
2246
|
+
__export(src_exports, {
|
|
2247
|
+
isClockSkewCorrectedError: () => isClockSkewCorrectedError,
|
|
2248
|
+
isClockSkewError: () => isClockSkewError,
|
|
2249
|
+
isRetryableByTrait: () => isRetryableByTrait,
|
|
2250
|
+
isServerError: () => isServerError,
|
|
2251
|
+
isThrottlingError: () => isThrottlingError,
|
|
2252
|
+
isTransientError: () => isTransientError
|
|
2253
|
+
});
|
|
2254
|
+
module.exports = __toCommonJS(src_exports);
|
|
2255
|
+
var CLOCK_SKEW_ERROR_CODES = [
|
|
2256
|
+
"AuthFailure",
|
|
2257
|
+
"InvalidSignatureException",
|
|
2258
|
+
"RequestExpired",
|
|
2259
|
+
"RequestInTheFuture",
|
|
2260
|
+
"RequestTimeTooSkewed",
|
|
2261
|
+
"SignatureDoesNotMatch"
|
|
2262
|
+
];
|
|
2263
|
+
var THROTTLING_ERROR_CODES = [
|
|
2264
|
+
"BandwidthLimitExceeded",
|
|
2265
|
+
"EC2ThrottledException",
|
|
2266
|
+
"LimitExceededException",
|
|
2267
|
+
"PriorRequestNotComplete",
|
|
2268
|
+
"ProvisionedThroughputExceededException",
|
|
2269
|
+
"RequestLimitExceeded",
|
|
2270
|
+
"RequestThrottled",
|
|
2271
|
+
"RequestThrottledException",
|
|
2272
|
+
"SlowDown",
|
|
2273
|
+
"ThrottledException",
|
|
2274
|
+
"Throttling",
|
|
2275
|
+
"ThrottlingException",
|
|
2276
|
+
"TooManyRequestsException",
|
|
2277
|
+
"TransactionInProgressException"
|
|
2278
|
+
];
|
|
2279
|
+
var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
|
|
2280
|
+
var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
|
|
2281
|
+
var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
|
|
2282
|
+
var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== undefined, "isRetryableByTrait");
|
|
2283
|
+
var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError");
|
|
2284
|
+
var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => error.$metadata?.clockSkewCorrected, "isClockSkewCorrectedError");
|
|
2285
|
+
var isThrottlingError = /* @__PURE__ */ __name((error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true, "isThrottlingError");
|
|
2286
|
+
var isTransientError = /* @__PURE__ */ __name((error, depth = 0) => isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || error.cause !== undefined && depth <= 10 && isTransientError(error.cause, depth + 1), "isTransientError");
|
|
2287
|
+
var isServerError = /* @__PURE__ */ __name((error) => {
|
|
2288
|
+
if (error.$metadata?.httpStatusCode !== undefined) {
|
|
2289
|
+
const statusCode = error.$metadata.httpStatusCode;
|
|
2290
|
+
if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) {
|
|
2291
|
+
return true;
|
|
2292
|
+
}
|
|
2293
|
+
return false;
|
|
2294
|
+
}
|
|
2295
|
+
return false;
|
|
2296
|
+
}, "isServerError");
|
|
2297
|
+
});
|
|
2298
|
+
|
|
2299
|
+
// ../../../../node_modules/@smithy/util-retry/dist-cjs/index.js
|
|
2300
|
+
var require_dist_cjs26 = __commonJS((exports, module) => {
|
|
2301
|
+
var __defProp = Object.defineProperty;
|
|
2302
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2303
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2304
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2305
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2306
|
+
var __export = (target, all) => {
|
|
2307
|
+
for (var name in all)
|
|
2308
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2309
|
+
};
|
|
2310
|
+
var __copyProps = (to, from, except, desc) => {
|
|
2311
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
2312
|
+
for (let key of __getOwnPropNames(from))
|
|
2313
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2314
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2315
|
+
}
|
|
2316
|
+
return to;
|
|
2317
|
+
};
|
|
2318
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2319
|
+
var src_exports = {};
|
|
2320
|
+
__export(src_exports, {
|
|
2321
|
+
AdaptiveRetryStrategy: () => AdaptiveRetryStrategy,
|
|
2322
|
+
ConfiguredRetryStrategy: () => ConfiguredRetryStrategy,
|
|
2323
|
+
DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS,
|
|
2324
|
+
DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE,
|
|
2325
|
+
DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE,
|
|
2326
|
+
DefaultRateLimiter: () => DefaultRateLimiter,
|
|
2327
|
+
INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS,
|
|
2328
|
+
INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER,
|
|
2329
|
+
MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY,
|
|
2330
|
+
NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT,
|
|
2331
|
+
REQUEST_HEADER: () => REQUEST_HEADER,
|
|
2332
|
+
RETRY_COST: () => RETRY_COST,
|
|
2333
|
+
RETRY_MODES: () => RETRY_MODES,
|
|
2334
|
+
StandardRetryStrategy: () => StandardRetryStrategy,
|
|
2335
|
+
THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE,
|
|
2336
|
+
TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST
|
|
2337
|
+
});
|
|
2338
|
+
module.exports = __toCommonJS(src_exports);
|
|
2339
|
+
var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => {
|
|
2340
|
+
RETRY_MODES2["STANDARD"] = "standard";
|
|
2341
|
+
RETRY_MODES2["ADAPTIVE"] = "adaptive";
|
|
2342
|
+
return RETRY_MODES2;
|
|
2343
|
+
})(RETRY_MODES || {});
|
|
2344
|
+
var DEFAULT_MAX_ATTEMPTS = 3;
|
|
2345
|
+
var DEFAULT_RETRY_MODE = "standard";
|
|
2346
|
+
var import_service_error_classification = require_dist_cjs25();
|
|
2347
|
+
var DefaultRateLimiter = class _DefaultRateLimiter {
|
|
2348
|
+
constructor(options) {
|
|
2349
|
+
this.currentCapacity = 0;
|
|
2350
|
+
this.enabled = false;
|
|
2351
|
+
this.lastMaxRate = 0;
|
|
2352
|
+
this.measuredTxRate = 0;
|
|
2353
|
+
this.requestCount = 0;
|
|
2354
|
+
this.lastTimestamp = 0;
|
|
2355
|
+
this.timeWindow = 0;
|
|
2356
|
+
this.beta = options?.beta ?? 0.7;
|
|
2357
|
+
this.minCapacity = options?.minCapacity ?? 1;
|
|
2358
|
+
this.minFillRate = options?.minFillRate ?? 0.5;
|
|
2359
|
+
this.scaleConstant = options?.scaleConstant ?? 0.4;
|
|
2360
|
+
this.smooth = options?.smooth ?? 0.8;
|
|
2361
|
+
const currentTimeInSeconds = this.getCurrentTimeInSeconds();
|
|
2362
|
+
this.lastThrottleTime = currentTimeInSeconds;
|
|
2363
|
+
this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
|
|
2364
|
+
this.fillRate = this.minFillRate;
|
|
2365
|
+
this.maxCapacity = this.minCapacity;
|
|
2366
|
+
}
|
|
2367
|
+
static {
|
|
2368
|
+
__name(this, "DefaultRateLimiter");
|
|
2369
|
+
}
|
|
2370
|
+
static {
|
|
2371
|
+
this.setTimeoutFn = setTimeout;
|
|
2372
|
+
}
|
|
2373
|
+
getCurrentTimeInSeconds() {
|
|
2374
|
+
return Date.now() / 1000;
|
|
2375
|
+
}
|
|
2376
|
+
async getSendToken() {
|
|
2377
|
+
return this.acquireTokenBucket(1);
|
|
2378
|
+
}
|
|
2379
|
+
async acquireTokenBucket(amount) {
|
|
2380
|
+
if (!this.enabled) {
|
|
2381
|
+
return;
|
|
2382
|
+
}
|
|
2383
|
+
this.refillTokenBucket();
|
|
2384
|
+
if (amount > this.currentCapacity) {
|
|
2385
|
+
const delay = (amount - this.currentCapacity) / this.fillRate * 1000;
|
|
2386
|
+
await new Promise((resolve) => _DefaultRateLimiter.setTimeoutFn(resolve, delay));
|
|
2387
|
+
}
|
|
2388
|
+
this.currentCapacity = this.currentCapacity - amount;
|
|
2389
|
+
}
|
|
2390
|
+
refillTokenBucket() {
|
|
2391
|
+
const timestamp = this.getCurrentTimeInSeconds();
|
|
2392
|
+
if (!this.lastTimestamp) {
|
|
2393
|
+
this.lastTimestamp = timestamp;
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
|
|
2397
|
+
this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
|
|
2398
|
+
this.lastTimestamp = timestamp;
|
|
2399
|
+
}
|
|
2400
|
+
updateClientSendingRate(response) {
|
|
2401
|
+
let calculatedRate;
|
|
2402
|
+
this.updateMeasuredRate();
|
|
2403
|
+
if ((0, import_service_error_classification.isThrottlingError)(response)) {
|
|
2404
|
+
const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
|
|
2405
|
+
this.lastMaxRate = rateToUse;
|
|
2406
|
+
this.calculateTimeWindow();
|
|
2407
|
+
this.lastThrottleTime = this.getCurrentTimeInSeconds();
|
|
2408
|
+
calculatedRate = this.cubicThrottle(rateToUse);
|
|
2409
|
+
this.enableTokenBucket();
|
|
2410
|
+
} else {
|
|
2411
|
+
this.calculateTimeWindow();
|
|
2412
|
+
calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
|
|
2413
|
+
}
|
|
2414
|
+
const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
|
|
2415
|
+
this.updateTokenBucketRate(newRate);
|
|
2416
|
+
}
|
|
2417
|
+
calculateTimeWindow() {
|
|
2418
|
+
this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3));
|
|
2419
|
+
}
|
|
2420
|
+
cubicThrottle(rateToUse) {
|
|
2421
|
+
return this.getPrecise(rateToUse * this.beta);
|
|
2422
|
+
}
|
|
2423
|
+
cubicSuccess(timestamp) {
|
|
2424
|
+
return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
|
|
2425
|
+
}
|
|
2426
|
+
enableTokenBucket() {
|
|
2427
|
+
this.enabled = true;
|
|
2428
|
+
}
|
|
2429
|
+
updateTokenBucketRate(newRate) {
|
|
2430
|
+
this.refillTokenBucket();
|
|
2431
|
+
this.fillRate = Math.max(newRate, this.minFillRate);
|
|
2432
|
+
this.maxCapacity = Math.max(newRate, this.minCapacity);
|
|
2433
|
+
this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
|
|
2434
|
+
}
|
|
2435
|
+
updateMeasuredRate() {
|
|
2436
|
+
const t = this.getCurrentTimeInSeconds();
|
|
2437
|
+
const timeBucket = Math.floor(t * 2) / 2;
|
|
2438
|
+
this.requestCount++;
|
|
2439
|
+
if (timeBucket > this.lastTxRateBucket) {
|
|
2440
|
+
const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
|
|
2441
|
+
this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
|
|
2442
|
+
this.requestCount = 0;
|
|
2443
|
+
this.lastTxRateBucket = timeBucket;
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
getPrecise(num) {
|
|
2447
|
+
return parseFloat(num.toFixed(8));
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
var DEFAULT_RETRY_DELAY_BASE = 100;
|
|
2451
|
+
var MAXIMUM_RETRY_DELAY = 20 * 1000;
|
|
2452
|
+
var THROTTLING_RETRY_DELAY_BASE = 500;
|
|
2453
|
+
var INITIAL_RETRY_TOKENS = 500;
|
|
2454
|
+
var RETRY_COST = 5;
|
|
2455
|
+
var TIMEOUT_RETRY_COST = 10;
|
|
2456
|
+
var NO_RETRY_INCREMENT = 1;
|
|
2457
|
+
var INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
|
|
2458
|
+
var REQUEST_HEADER = "amz-sdk-request";
|
|
2459
|
+
var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => {
|
|
2460
|
+
let delayBase = DEFAULT_RETRY_DELAY_BASE;
|
|
2461
|
+
const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => {
|
|
2462
|
+
return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
|
|
2463
|
+
}, "computeNextBackoffDelay");
|
|
2464
|
+
const setDelayBase = /* @__PURE__ */ __name((delay) => {
|
|
2465
|
+
delayBase = delay;
|
|
2466
|
+
}, "setDelayBase");
|
|
2467
|
+
return {
|
|
2468
|
+
computeNextBackoffDelay,
|
|
2469
|
+
setDelayBase
|
|
2470
|
+
};
|
|
2471
|
+
}, "getDefaultRetryBackoffStrategy");
|
|
2472
|
+
var createDefaultRetryToken = /* @__PURE__ */ __name(({
|
|
2473
|
+
retryDelay,
|
|
2474
|
+
retryCount,
|
|
2475
|
+
retryCost
|
|
2476
|
+
}) => {
|
|
2477
|
+
const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount");
|
|
2478
|
+
const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay");
|
|
2479
|
+
const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost");
|
|
2480
|
+
return {
|
|
2481
|
+
getRetryCount,
|
|
2482
|
+
getRetryDelay,
|
|
2483
|
+
getRetryCost
|
|
2484
|
+
};
|
|
2485
|
+
}, "createDefaultRetryToken");
|
|
2486
|
+
var StandardRetryStrategy = class {
|
|
2487
|
+
constructor(maxAttempts) {
|
|
2488
|
+
this.maxAttempts = maxAttempts;
|
|
2489
|
+
this.mode = "standard";
|
|
2490
|
+
this.capacity = INITIAL_RETRY_TOKENS;
|
|
2491
|
+
this.retryBackoffStrategy = getDefaultRetryBackoffStrategy();
|
|
2492
|
+
this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
|
|
2493
|
+
}
|
|
2494
|
+
static {
|
|
2495
|
+
__name(this, "StandardRetryStrategy");
|
|
2496
|
+
}
|
|
2497
|
+
async acquireInitialRetryToken(retryTokenScope) {
|
|
2498
|
+
return createDefaultRetryToken({
|
|
2499
|
+
retryDelay: DEFAULT_RETRY_DELAY_BASE,
|
|
2500
|
+
retryCount: 0
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
async refreshRetryTokenForRetry(token, errorInfo) {
|
|
2504
|
+
const maxAttempts = await this.getMaxAttempts();
|
|
2505
|
+
if (this.shouldRetry(token, errorInfo, maxAttempts)) {
|
|
2506
|
+
const errorType = errorInfo.errorType;
|
|
2507
|
+
this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
|
|
2508
|
+
const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
|
|
2509
|
+
const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType;
|
|
2510
|
+
const capacityCost = this.getCapacityCost(errorType);
|
|
2511
|
+
this.capacity -= capacityCost;
|
|
2512
|
+
return createDefaultRetryToken({
|
|
2513
|
+
retryDelay,
|
|
2514
|
+
retryCount: token.getRetryCount() + 1,
|
|
2515
|
+
retryCost: capacityCost
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
throw new Error("No retry token available");
|
|
2519
|
+
}
|
|
2520
|
+
recordSuccess(token) {
|
|
2521
|
+
this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
|
|
2522
|
+
}
|
|
2523
|
+
getCapacity() {
|
|
2524
|
+
return this.capacity;
|
|
2525
|
+
}
|
|
2526
|
+
async getMaxAttempts() {
|
|
2527
|
+
try {
|
|
2528
|
+
return await this.maxAttemptsProvider();
|
|
2529
|
+
} catch (error) {
|
|
2530
|
+
console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
|
|
2531
|
+
return DEFAULT_MAX_ATTEMPTS;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
|
|
2535
|
+
const attempts = tokenToRenew.getRetryCount() + 1;
|
|
2536
|
+
return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType);
|
|
2537
|
+
}
|
|
2538
|
+
getCapacityCost(errorType) {
|
|
2539
|
+
return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
|
|
2540
|
+
}
|
|
2541
|
+
isRetryableError(errorType) {
|
|
2542
|
+
return errorType === "THROTTLING" || errorType === "TRANSIENT";
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
var AdaptiveRetryStrategy = class {
|
|
2546
|
+
constructor(maxAttemptsProvider, options) {
|
|
2547
|
+
this.maxAttemptsProvider = maxAttemptsProvider;
|
|
2548
|
+
this.mode = "adaptive";
|
|
2549
|
+
const { rateLimiter } = options ?? {};
|
|
2550
|
+
this.rateLimiter = rateLimiter ?? new DefaultRateLimiter;
|
|
2551
|
+
this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
|
|
2552
|
+
}
|
|
2553
|
+
static {
|
|
2554
|
+
__name(this, "AdaptiveRetryStrategy");
|
|
2555
|
+
}
|
|
2556
|
+
async acquireInitialRetryToken(retryTokenScope) {
|
|
2557
|
+
await this.rateLimiter.getSendToken();
|
|
2558
|
+
return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
|
|
2559
|
+
}
|
|
2560
|
+
async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
|
|
2561
|
+
this.rateLimiter.updateClientSendingRate(errorInfo);
|
|
2562
|
+
return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
|
|
2563
|
+
}
|
|
2564
|
+
recordSuccess(token) {
|
|
2565
|
+
this.rateLimiter.updateClientSendingRate({});
|
|
2566
|
+
this.standardRetryStrategy.recordSuccess(token);
|
|
2567
|
+
}
|
|
2568
|
+
};
|
|
2569
|
+
var ConfiguredRetryStrategy = class extends StandardRetryStrategy {
|
|
2570
|
+
static {
|
|
2571
|
+
__name(this, "ConfiguredRetryStrategy");
|
|
2572
|
+
}
|
|
2573
|
+
constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) {
|
|
2574
|
+
super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts);
|
|
2575
|
+
if (typeof computeNextBackoffDelay === "number") {
|
|
2576
|
+
this.computeNextBackoffDelay = () => computeNextBackoffDelay;
|
|
2577
|
+
} else {
|
|
2578
|
+
this.computeNextBackoffDelay = computeNextBackoffDelay;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
|
|
2582
|
+
const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
|
|
2583
|
+
token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount());
|
|
2584
|
+
return token;
|
|
2585
|
+
}
|
|
2586
|
+
};
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
// ../../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js
|
|
2590
|
+
var require_isStreamingPayload = __commonJS((exports) => {
|
|
2591
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2592
|
+
exports.isStreamingPayload = undefined;
|
|
2593
|
+
var stream_1 = __require("node:stream");
|
|
2594
|
+
var isStreamingPayload = (request) => (request === null || request === undefined ? undefined : request.body) instanceof stream_1.Readable || typeof ReadableStream !== "undefined" && (request === null || request === undefined ? undefined : request.body) instanceof ReadableStream;
|
|
2595
|
+
exports.isStreamingPayload = isStreamingPayload;
|
|
2596
|
+
});
|
|
2597
|
+
|
|
2598
|
+
// ../../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js
|
|
2599
|
+
var require_dist_cjs27 = __commonJS((exports, module) => {
|
|
2600
|
+
var __defProp = Object.defineProperty;
|
|
2601
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2602
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2603
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2604
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2605
|
+
var __export = (target, all) => {
|
|
2606
|
+
for (var name in all)
|
|
2607
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2608
|
+
};
|
|
2609
|
+
var __copyProps = (to, from, except, desc) => {
|
|
2610
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
2611
|
+
for (let key of __getOwnPropNames(from))
|
|
2612
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2613
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2614
|
+
}
|
|
2615
|
+
return to;
|
|
2616
|
+
};
|
|
2617
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2618
|
+
var src_exports = {};
|
|
2619
|
+
__export(src_exports, {
|
|
2620
|
+
AdaptiveRetryStrategy: () => AdaptiveRetryStrategy,
|
|
2621
|
+
CONFIG_MAX_ATTEMPTS: () => CONFIG_MAX_ATTEMPTS,
|
|
2622
|
+
CONFIG_RETRY_MODE: () => CONFIG_RETRY_MODE,
|
|
2623
|
+
ENV_MAX_ATTEMPTS: () => ENV_MAX_ATTEMPTS,
|
|
2624
|
+
ENV_RETRY_MODE: () => ENV_RETRY_MODE,
|
|
2625
|
+
NODE_MAX_ATTEMPT_CONFIG_OPTIONS: () => NODE_MAX_ATTEMPT_CONFIG_OPTIONS,
|
|
2626
|
+
NODE_RETRY_MODE_CONFIG_OPTIONS: () => NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
2627
|
+
StandardRetryStrategy: () => StandardRetryStrategy,
|
|
2628
|
+
defaultDelayDecider: () => defaultDelayDecider,
|
|
2629
|
+
defaultRetryDecider: () => defaultRetryDecider,
|
|
2630
|
+
getOmitRetryHeadersPlugin: () => getOmitRetryHeadersPlugin,
|
|
2631
|
+
getRetryAfterHint: () => getRetryAfterHint,
|
|
2632
|
+
getRetryPlugin: () => getRetryPlugin,
|
|
2633
|
+
omitRetryHeadersMiddleware: () => omitRetryHeadersMiddleware,
|
|
2634
|
+
omitRetryHeadersMiddlewareOptions: () => omitRetryHeadersMiddlewareOptions,
|
|
2635
|
+
resolveRetryConfig: () => resolveRetryConfig,
|
|
2636
|
+
retryMiddleware: () => retryMiddleware,
|
|
2637
|
+
retryMiddlewareOptions: () => retryMiddlewareOptions
|
|
2638
|
+
});
|
|
2639
|
+
module.exports = __toCommonJS(src_exports);
|
|
2640
|
+
var import_protocol_http = require_dist_cjs4();
|
|
2641
|
+
var import_uuid = require_dist();
|
|
2642
|
+
var import_util_retry = require_dist_cjs26();
|
|
2643
|
+
var getDefaultRetryQuota = /* @__PURE__ */ __name((initialRetryTokens, options) => {
|
|
2644
|
+
const MAX_CAPACITY = initialRetryTokens;
|
|
2645
|
+
const noRetryIncrement = options?.noRetryIncrement ?? import_util_retry.NO_RETRY_INCREMENT;
|
|
2646
|
+
const retryCost = options?.retryCost ?? import_util_retry.RETRY_COST;
|
|
2647
|
+
const timeoutRetryCost = options?.timeoutRetryCost ?? import_util_retry.TIMEOUT_RETRY_COST;
|
|
2648
|
+
let availableCapacity = initialRetryTokens;
|
|
2649
|
+
const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount");
|
|
2650
|
+
const hasRetryTokens = /* @__PURE__ */ __name((error) => getCapacityAmount(error) <= availableCapacity, "hasRetryTokens");
|
|
2651
|
+
const retrieveRetryTokens = /* @__PURE__ */ __name((error) => {
|
|
2652
|
+
if (!hasRetryTokens(error)) {
|
|
2653
|
+
throw new Error("No retry token available");
|
|
2654
|
+
}
|
|
2655
|
+
const capacityAmount = getCapacityAmount(error);
|
|
2656
|
+
availableCapacity -= capacityAmount;
|
|
2657
|
+
return capacityAmount;
|
|
2658
|
+
}, "retrieveRetryTokens");
|
|
2659
|
+
const releaseRetryTokens = /* @__PURE__ */ __name((capacityReleaseAmount) => {
|
|
2660
|
+
availableCapacity += capacityReleaseAmount ?? noRetryIncrement;
|
|
2661
|
+
availableCapacity = Math.min(availableCapacity, MAX_CAPACITY);
|
|
2662
|
+
}, "releaseRetryTokens");
|
|
2663
|
+
return Object.freeze({
|
|
2664
|
+
hasRetryTokens,
|
|
2665
|
+
retrieveRetryTokens,
|
|
2666
|
+
releaseRetryTokens
|
|
2667
|
+
});
|
|
2668
|
+
}, "getDefaultRetryQuota");
|
|
2669
|
+
var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider");
|
|
2670
|
+
var import_service_error_classification = require_dist_cjs25();
|
|
2671
|
+
var defaultRetryDecider = /* @__PURE__ */ __name((error) => {
|
|
2672
|
+
if (!error) {
|
|
2673
|
+
return false;
|
|
2674
|
+
}
|
|
2675
|
+
return (0, import_service_error_classification.isRetryableByTrait)(error) || (0, import_service_error_classification.isClockSkewError)(error) || (0, import_service_error_classification.isThrottlingError)(error) || (0, import_service_error_classification.isTransientError)(error);
|
|
2676
|
+
}, "defaultRetryDecider");
|
|
2677
|
+
var asSdkError = /* @__PURE__ */ __name((error) => {
|
|
2678
|
+
if (error instanceof Error)
|
|
2679
|
+
return error;
|
|
2680
|
+
if (error instanceof Object)
|
|
2681
|
+
return Object.assign(new Error, error);
|
|
2682
|
+
if (typeof error === "string")
|
|
2683
|
+
return new Error(error);
|
|
2684
|
+
return new Error(`AWS SDK error wrapper for ${error}`);
|
|
2685
|
+
}, "asSdkError");
|
|
2686
|
+
var StandardRetryStrategy = class {
|
|
2687
|
+
constructor(maxAttemptsProvider, options) {
|
|
2688
|
+
this.maxAttemptsProvider = maxAttemptsProvider;
|
|
2689
|
+
this.mode = import_util_retry.RETRY_MODES.STANDARD;
|
|
2690
|
+
this.retryDecider = options?.retryDecider ?? defaultRetryDecider;
|
|
2691
|
+
this.delayDecider = options?.delayDecider ?? defaultDelayDecider;
|
|
2692
|
+
this.retryQuota = options?.retryQuota ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS);
|
|
2693
|
+
}
|
|
2694
|
+
static {
|
|
2695
|
+
__name(this, "StandardRetryStrategy");
|
|
2696
|
+
}
|
|
2697
|
+
shouldRetry(error, attempts, maxAttempts) {
|
|
2698
|
+
return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error);
|
|
2699
|
+
}
|
|
2700
|
+
async getMaxAttempts() {
|
|
2701
|
+
let maxAttempts;
|
|
2702
|
+
try {
|
|
2703
|
+
maxAttempts = await this.maxAttemptsProvider();
|
|
2704
|
+
} catch (error) {
|
|
2705
|
+
maxAttempts = import_util_retry.DEFAULT_MAX_ATTEMPTS;
|
|
2706
|
+
}
|
|
2707
|
+
return maxAttempts;
|
|
2708
|
+
}
|
|
2709
|
+
async retry(next, args, options) {
|
|
2710
|
+
let retryTokenAmount;
|
|
2711
|
+
let attempts = 0;
|
|
2712
|
+
let totalDelay = 0;
|
|
2713
|
+
const maxAttempts = await this.getMaxAttempts();
|
|
2714
|
+
const { request } = args;
|
|
2715
|
+
if (import_protocol_http.HttpRequest.isInstance(request)) {
|
|
2716
|
+
request.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)();
|
|
2717
|
+
}
|
|
2718
|
+
while (true) {
|
|
2719
|
+
try {
|
|
2720
|
+
if (import_protocol_http.HttpRequest.isInstance(request)) {
|
|
2721
|
+
request.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
|
|
2722
|
+
}
|
|
2723
|
+
if (options?.beforeRequest) {
|
|
2724
|
+
await options.beforeRequest();
|
|
2725
|
+
}
|
|
2726
|
+
const { response, output } = await next(args);
|
|
2727
|
+
if (options?.afterRequest) {
|
|
2728
|
+
options.afterRequest(response);
|
|
2729
|
+
}
|
|
2730
|
+
this.retryQuota.releaseRetryTokens(retryTokenAmount);
|
|
2731
|
+
output.$metadata.attempts = attempts + 1;
|
|
2732
|
+
output.$metadata.totalRetryDelay = totalDelay;
|
|
2733
|
+
return { response, output };
|
|
2734
|
+
} catch (e) {
|
|
2735
|
+
const err = asSdkError(e);
|
|
2736
|
+
attempts++;
|
|
2737
|
+
if (this.shouldRetry(err, attempts, maxAttempts)) {
|
|
2738
|
+
retryTokenAmount = this.retryQuota.retrieveRetryTokens(err);
|
|
2739
|
+
const delayFromDecider = this.delayDecider((0, import_service_error_classification.isThrottlingError)(err) ? import_util_retry.THROTTLING_RETRY_DELAY_BASE : import_util_retry.DEFAULT_RETRY_DELAY_BASE, attempts);
|
|
2740
|
+
const delayFromResponse = getDelayFromRetryAfterHeader(err.$response);
|
|
2741
|
+
const delay = Math.max(delayFromResponse || 0, delayFromDecider);
|
|
2742
|
+
totalDelay += delay;
|
|
2743
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
2744
|
+
continue;
|
|
2745
|
+
}
|
|
2746
|
+
if (!err.$metadata) {
|
|
2747
|
+
err.$metadata = {};
|
|
2748
|
+
}
|
|
2749
|
+
err.$metadata.attempts = attempts;
|
|
2750
|
+
err.$metadata.totalRetryDelay = totalDelay;
|
|
2751
|
+
throw err;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
};
|
|
2756
|
+
var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => {
|
|
2757
|
+
if (!import_protocol_http.HttpResponse.isInstance(response))
|
|
2758
|
+
return;
|
|
2759
|
+
const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
|
|
2760
|
+
if (!retryAfterHeaderName)
|
|
2761
|
+
return;
|
|
2762
|
+
const retryAfter = response.headers[retryAfterHeaderName];
|
|
2763
|
+
const retryAfterSeconds = Number(retryAfter);
|
|
2764
|
+
if (!Number.isNaN(retryAfterSeconds))
|
|
2765
|
+
return retryAfterSeconds * 1000;
|
|
2766
|
+
const retryAfterDate = new Date(retryAfter);
|
|
2767
|
+
return retryAfterDate.getTime() - Date.now();
|
|
2768
|
+
}, "getDelayFromRetryAfterHeader");
|
|
2769
|
+
var AdaptiveRetryStrategy = class extends StandardRetryStrategy {
|
|
2770
|
+
static {
|
|
2771
|
+
__name(this, "AdaptiveRetryStrategy");
|
|
2772
|
+
}
|
|
2773
|
+
constructor(maxAttemptsProvider, options) {
|
|
2774
|
+
const { rateLimiter, ...superOptions } = options ?? {};
|
|
2775
|
+
super(maxAttemptsProvider, superOptions);
|
|
2776
|
+
this.rateLimiter = rateLimiter ?? new import_util_retry.DefaultRateLimiter;
|
|
2777
|
+
this.mode = import_util_retry.RETRY_MODES.ADAPTIVE;
|
|
2778
|
+
}
|
|
2779
|
+
async retry(next, args) {
|
|
2780
|
+
return super.retry(next, args, {
|
|
2781
|
+
beforeRequest: async () => {
|
|
2782
|
+
return this.rateLimiter.getSendToken();
|
|
2783
|
+
},
|
|
2784
|
+
afterRequest: (response) => {
|
|
2785
|
+
this.rateLimiter.updateClientSendingRate(response);
|
|
2786
|
+
}
|
|
2787
|
+
});
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
var import_util_middleware = require_dist_cjs2();
|
|
2791
|
+
var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
|
|
2792
|
+
var CONFIG_MAX_ATTEMPTS = "max_attempts";
|
|
2793
|
+
var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
|
|
2794
|
+
environmentVariableSelector: (env) => {
|
|
2795
|
+
const value = env[ENV_MAX_ATTEMPTS];
|
|
2796
|
+
if (!value)
|
|
2797
|
+
return;
|
|
2798
|
+
const maxAttempt = parseInt(value);
|
|
2799
|
+
if (Number.isNaN(maxAttempt)) {
|
|
2800
|
+
throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
|
|
2801
|
+
}
|
|
2802
|
+
return maxAttempt;
|
|
2803
|
+
},
|
|
2804
|
+
configFileSelector: (profile) => {
|
|
2805
|
+
const value = profile[CONFIG_MAX_ATTEMPTS];
|
|
2806
|
+
if (!value)
|
|
2807
|
+
return;
|
|
2808
|
+
const maxAttempt = parseInt(value);
|
|
2809
|
+
if (Number.isNaN(maxAttempt)) {
|
|
2810
|
+
throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
|
|
2811
|
+
}
|
|
2812
|
+
return maxAttempt;
|
|
2813
|
+
},
|
|
2814
|
+
default: import_util_retry.DEFAULT_MAX_ATTEMPTS
|
|
2815
|
+
};
|
|
2816
|
+
var resolveRetryConfig = /* @__PURE__ */ __name((input) => {
|
|
2817
|
+
const { retryStrategy, retryMode: _retryMode, maxAttempts: _maxAttempts } = input;
|
|
2818
|
+
const maxAttempts = (0, import_util_middleware.normalizeProvider)(_maxAttempts ?? import_util_retry.DEFAULT_MAX_ATTEMPTS);
|
|
2819
|
+
return Object.assign(input, {
|
|
2820
|
+
maxAttempts,
|
|
2821
|
+
retryStrategy: async () => {
|
|
2822
|
+
if (retryStrategy) {
|
|
2823
|
+
return retryStrategy;
|
|
2824
|
+
}
|
|
2825
|
+
const retryMode = await (0, import_util_middleware.normalizeProvider)(_retryMode)();
|
|
2826
|
+
if (retryMode === import_util_retry.RETRY_MODES.ADAPTIVE) {
|
|
2827
|
+
return new import_util_retry.AdaptiveRetryStrategy(maxAttempts);
|
|
2828
|
+
}
|
|
2829
|
+
return new import_util_retry.StandardRetryStrategy(maxAttempts);
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
}, "resolveRetryConfig");
|
|
2833
|
+
var ENV_RETRY_MODE = "AWS_RETRY_MODE";
|
|
2834
|
+
var CONFIG_RETRY_MODE = "retry_mode";
|
|
2835
|
+
var NODE_RETRY_MODE_CONFIG_OPTIONS = {
|
|
2836
|
+
environmentVariableSelector: (env) => env[ENV_RETRY_MODE],
|
|
2837
|
+
configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
|
|
2838
|
+
default: import_util_retry.DEFAULT_RETRY_MODE
|
|
2839
|
+
};
|
|
2840
|
+
var omitRetryHeadersMiddleware = /* @__PURE__ */ __name(() => (next) => async (args) => {
|
|
2841
|
+
const { request } = args;
|
|
2842
|
+
if (import_protocol_http.HttpRequest.isInstance(request)) {
|
|
2843
|
+
delete request.headers[import_util_retry.INVOCATION_ID_HEADER];
|
|
2844
|
+
delete request.headers[import_util_retry.REQUEST_HEADER];
|
|
2845
|
+
}
|
|
2846
|
+
return next(args);
|
|
2847
|
+
}, "omitRetryHeadersMiddleware");
|
|
2848
|
+
var omitRetryHeadersMiddlewareOptions = {
|
|
2849
|
+
name: "omitRetryHeadersMiddleware",
|
|
2850
|
+
tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"],
|
|
2851
|
+
relation: "before",
|
|
2852
|
+
toMiddleware: "awsAuthMiddleware",
|
|
2853
|
+
override: true
|
|
2854
|
+
};
|
|
2855
|
+
var getOmitRetryHeadersPlugin = /* @__PURE__ */ __name((options) => ({
|
|
2856
|
+
applyToStack: (clientStack) => {
|
|
2857
|
+
clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions);
|
|
2858
|
+
}
|
|
2859
|
+
}), "getOmitRetryHeadersPlugin");
|
|
2860
|
+
var import_smithy_client = require_dist_cjs9();
|
|
2861
|
+
var import_isStreamingPayload = require_isStreamingPayload();
|
|
2862
|
+
var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => {
|
|
2863
|
+
let retryStrategy = await options.retryStrategy();
|
|
2864
|
+
const maxAttempts = await options.maxAttempts();
|
|
2865
|
+
if (isRetryStrategyV2(retryStrategy)) {
|
|
2866
|
+
retryStrategy = retryStrategy;
|
|
2867
|
+
let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]);
|
|
2868
|
+
let lastError = new Error;
|
|
2869
|
+
let attempts = 0;
|
|
2870
|
+
let totalRetryDelay = 0;
|
|
2871
|
+
const { request } = args;
|
|
2872
|
+
const isRequest = import_protocol_http.HttpRequest.isInstance(request);
|
|
2873
|
+
if (isRequest) {
|
|
2874
|
+
request.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)();
|
|
2875
|
+
}
|
|
2876
|
+
while (true) {
|
|
2877
|
+
try {
|
|
2878
|
+
if (isRequest) {
|
|
2879
|
+
request.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
|
|
2880
|
+
}
|
|
2881
|
+
const { response, output } = await next(args);
|
|
2882
|
+
retryStrategy.recordSuccess(retryToken);
|
|
2883
|
+
output.$metadata.attempts = attempts + 1;
|
|
2884
|
+
output.$metadata.totalRetryDelay = totalRetryDelay;
|
|
2885
|
+
return { response, output };
|
|
2886
|
+
} catch (e) {
|
|
2887
|
+
const retryErrorInfo = getRetryErrorInfo(e);
|
|
2888
|
+
lastError = asSdkError(e);
|
|
2889
|
+
if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request)) {
|
|
2890
|
+
(context.logger instanceof import_smithy_client.NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
|
|
2891
|
+
throw lastError;
|
|
2892
|
+
}
|
|
2893
|
+
try {
|
|
2894
|
+
retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
|
|
2895
|
+
} catch (refreshError) {
|
|
2896
|
+
if (!lastError.$metadata) {
|
|
2897
|
+
lastError.$metadata = {};
|
|
2898
|
+
}
|
|
2899
|
+
lastError.$metadata.attempts = attempts + 1;
|
|
2900
|
+
lastError.$metadata.totalRetryDelay = totalRetryDelay;
|
|
2901
|
+
throw lastError;
|
|
2902
|
+
}
|
|
2903
|
+
attempts = retryToken.getRetryCount();
|
|
2904
|
+
const delay = retryToken.getRetryDelay();
|
|
2905
|
+
totalRetryDelay += delay;
|
|
2906
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
} else {
|
|
2910
|
+
retryStrategy = retryStrategy;
|
|
2911
|
+
if (retryStrategy?.mode)
|
|
2912
|
+
context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
|
|
2913
|
+
return retryStrategy.retry(next, args);
|
|
2914
|
+
}
|
|
2915
|
+
}, "retryMiddleware");
|
|
2916
|
+
var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2");
|
|
2917
|
+
var getRetryErrorInfo = /* @__PURE__ */ __name((error) => {
|
|
2918
|
+
const errorInfo = {
|
|
2919
|
+
error,
|
|
2920
|
+
errorType: getRetryErrorType(error)
|
|
2921
|
+
};
|
|
2922
|
+
const retryAfterHint = getRetryAfterHint(error.$response);
|
|
2923
|
+
if (retryAfterHint) {
|
|
2924
|
+
errorInfo.retryAfterHint = retryAfterHint;
|
|
2925
|
+
}
|
|
2926
|
+
return errorInfo;
|
|
2927
|
+
}, "getRetryErrorInfo");
|
|
2928
|
+
var getRetryErrorType = /* @__PURE__ */ __name((error) => {
|
|
2929
|
+
if ((0, import_service_error_classification.isThrottlingError)(error))
|
|
2930
|
+
return "THROTTLING";
|
|
2931
|
+
if ((0, import_service_error_classification.isTransientError)(error))
|
|
2932
|
+
return "TRANSIENT";
|
|
2933
|
+
if ((0, import_service_error_classification.isServerError)(error))
|
|
2934
|
+
return "SERVER_ERROR";
|
|
2935
|
+
return "CLIENT_ERROR";
|
|
2936
|
+
}, "getRetryErrorType");
|
|
2937
|
+
var retryMiddlewareOptions = {
|
|
2938
|
+
name: "retryMiddleware",
|
|
2939
|
+
tags: ["RETRY"],
|
|
2940
|
+
step: "finalizeRequest",
|
|
2941
|
+
priority: "high",
|
|
2942
|
+
override: true
|
|
2943
|
+
};
|
|
2944
|
+
var getRetryPlugin = /* @__PURE__ */ __name((options) => ({
|
|
2945
|
+
applyToStack: (clientStack) => {
|
|
2946
|
+
clientStack.add(retryMiddleware(options), retryMiddlewareOptions);
|
|
2947
|
+
}
|
|
2948
|
+
}), "getRetryPlugin");
|
|
2949
|
+
var getRetryAfterHint = /* @__PURE__ */ __name((response) => {
|
|
2950
|
+
if (!import_protocol_http.HttpResponse.isInstance(response))
|
|
2951
|
+
return;
|
|
2952
|
+
const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
|
|
2953
|
+
if (!retryAfterHeaderName)
|
|
2954
|
+
return;
|
|
2955
|
+
const retryAfter = response.headers[retryAfterHeaderName];
|
|
2956
|
+
const retryAfterSeconds = Number(retryAfter);
|
|
2957
|
+
if (!Number.isNaN(retryAfterSeconds))
|
|
2958
|
+
return new Date(retryAfterSeconds * 1000);
|
|
2959
|
+
const retryAfterDate = new Date(retryAfter);
|
|
2960
|
+
return retryAfterDate;
|
|
2961
|
+
}, "getRetryAfterHint");
|
|
2962
|
+
});
|
|
2963
|
+
|
|
2964
|
+
// ../../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js
|
|
2965
|
+
var require_dist_cjs28 = __commonJS((exports, module) => {
|
|
2966
|
+
var __defProp = Object.defineProperty;
|
|
2967
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2968
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2969
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2970
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2971
|
+
var __export = (target, all) => {
|
|
2972
|
+
for (var name in all)
|
|
2973
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2974
|
+
};
|
|
2975
|
+
var __copyProps = (to, from, except, desc) => {
|
|
2976
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
2977
|
+
for (let key of __getOwnPropNames(from))
|
|
2978
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2979
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2980
|
+
}
|
|
2981
|
+
return to;
|
|
2982
|
+
};
|
|
2983
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2984
|
+
var index_exports = {};
|
|
2985
|
+
__export(index_exports, {
|
|
2986
|
+
NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS,
|
|
2987
|
+
NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS,
|
|
2988
|
+
REGION_ENV_NAME: () => REGION_ENV_NAME,
|
|
2989
|
+
REGION_INI_NAME: () => REGION_INI_NAME,
|
|
2990
|
+
getAwsRegionExtensionConfiguration: () => getAwsRegionExtensionConfiguration,
|
|
2991
|
+
resolveAwsRegionExtensionConfiguration: () => resolveAwsRegionExtensionConfiguration,
|
|
2992
|
+
resolveRegionConfig: () => resolveRegionConfig
|
|
2993
|
+
});
|
|
2994
|
+
module.exports = __toCommonJS(index_exports);
|
|
2995
|
+
var getAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
|
|
2996
|
+
return {
|
|
2997
|
+
setRegion(region) {
|
|
2998
|
+
runtimeConfig.region = region;
|
|
2999
|
+
},
|
|
3000
|
+
region() {
|
|
3001
|
+
return runtimeConfig.region;
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
}, "getAwsRegionExtensionConfiguration");
|
|
3005
|
+
var resolveAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((awsRegionExtensionConfiguration) => {
|
|
3006
|
+
return {
|
|
3007
|
+
region: awsRegionExtensionConfiguration.region()
|
|
3008
|
+
};
|
|
3009
|
+
}, "resolveAwsRegionExtensionConfiguration");
|
|
3010
|
+
var REGION_ENV_NAME = "AWS_REGION";
|
|
3011
|
+
var REGION_INI_NAME = "region";
|
|
3012
|
+
var NODE_REGION_CONFIG_OPTIONS = {
|
|
3013
|
+
environmentVariableSelector: /* @__PURE__ */ __name((env) => env[REGION_ENV_NAME], "environmentVariableSelector"),
|
|
3014
|
+
configFileSelector: /* @__PURE__ */ __name((profile) => profile[REGION_INI_NAME], "configFileSelector"),
|
|
3015
|
+
default: /* @__PURE__ */ __name(() => {
|
|
3016
|
+
throw new Error("Region is missing");
|
|
3017
|
+
}, "default")
|
|
3018
|
+
};
|
|
3019
|
+
var NODE_REGION_CONFIG_FILE_OPTIONS = {
|
|
3020
|
+
preferredFile: "credentials"
|
|
3021
|
+
};
|
|
3022
|
+
var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion");
|
|
3023
|
+
var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion");
|
|
3024
|
+
var resolveRegionConfig = /* @__PURE__ */ __name((input) => {
|
|
3025
|
+
const { region, useFipsEndpoint } = input;
|
|
3026
|
+
if (!region) {
|
|
3027
|
+
throw new Error("Region is missing");
|
|
3028
|
+
}
|
|
3029
|
+
return Object.assign(input, {
|
|
3030
|
+
region: /* @__PURE__ */ __name(async () => {
|
|
3031
|
+
if (typeof region === "string") {
|
|
3032
|
+
return getRealRegion(region);
|
|
3033
|
+
}
|
|
3034
|
+
const providedRegion = await region();
|
|
3035
|
+
return getRealRegion(providedRegion);
|
|
3036
|
+
}, "region"),
|
|
3037
|
+
useFipsEndpoint: /* @__PURE__ */ __name(async () => {
|
|
3038
|
+
const providedRegion = typeof region === "string" ? region : await region();
|
|
3039
|
+
if (isFipsRegion(providedRegion)) {
|
|
3040
|
+
return true;
|
|
3041
|
+
}
|
|
3042
|
+
return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
|
|
3043
|
+
}, "useFipsEndpoint")
|
|
3044
|
+
});
|
|
3045
|
+
}, "resolveRegionConfig");
|
|
3046
|
+
});
|
|
3047
|
+
|
|
3048
|
+
// ../../../../node_modules/@aws-sdk/nested-clients/package.json
|
|
3049
|
+
var require_package = __commonJS((exports, module) => {
|
|
3050
|
+
module.exports = {
|
|
3051
|
+
name: "@aws-sdk/nested-clients",
|
|
3052
|
+
version: "3.775.0",
|
|
3053
|
+
description: "Nested clients for AWS SDK packages.",
|
|
3054
|
+
main: "./dist-cjs/index.js",
|
|
3055
|
+
module: "./dist-es/index.js",
|
|
3056
|
+
types: "./dist-types/index.d.ts",
|
|
3057
|
+
scripts: {
|
|
3058
|
+
build: "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
3059
|
+
"build:cjs": "node ../../scripts/compilation/inline nested-clients",
|
|
3060
|
+
"build:es": "tsc -p tsconfig.es.json",
|
|
3061
|
+
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
3062
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
3063
|
+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
3064
|
+
clean: "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
3065
|
+
lint: "node ../../scripts/validation/submodules-linter.js --pkg nested-clients",
|
|
3066
|
+
test: "yarn g:vitest run",
|
|
3067
|
+
"test:watch": "yarn g:vitest watch"
|
|
3068
|
+
},
|
|
3069
|
+
engines: {
|
|
3070
|
+
node: ">=18.0.0"
|
|
3071
|
+
},
|
|
3072
|
+
author: {
|
|
3073
|
+
name: "AWS SDK for JavaScript Team",
|
|
3074
|
+
url: "https://aws.amazon.com/javascript/"
|
|
3075
|
+
},
|
|
3076
|
+
license: "Apache-2.0",
|
|
3077
|
+
dependencies: {
|
|
3078
|
+
"@aws-crypto/sha256-browser": "5.2.0",
|
|
3079
|
+
"@aws-crypto/sha256-js": "5.2.0",
|
|
3080
|
+
"@aws-sdk/core": "3.775.0",
|
|
3081
|
+
"@aws-sdk/middleware-host-header": "3.775.0",
|
|
3082
|
+
"@aws-sdk/middleware-logger": "3.775.0",
|
|
3083
|
+
"@aws-sdk/middleware-recursion-detection": "3.775.0",
|
|
3084
|
+
"@aws-sdk/middleware-user-agent": "3.775.0",
|
|
3085
|
+
"@aws-sdk/region-config-resolver": "3.775.0",
|
|
3086
|
+
"@aws-sdk/types": "3.775.0",
|
|
3087
|
+
"@aws-sdk/util-endpoints": "3.775.0",
|
|
3088
|
+
"@aws-sdk/util-user-agent-browser": "3.775.0",
|
|
3089
|
+
"@aws-sdk/util-user-agent-node": "3.775.0",
|
|
3090
|
+
"@smithy/config-resolver": "^4.1.0",
|
|
3091
|
+
"@smithy/core": "^3.2.0",
|
|
3092
|
+
"@smithy/fetch-http-handler": "^5.0.2",
|
|
3093
|
+
"@smithy/hash-node": "^4.0.2",
|
|
3094
|
+
"@smithy/invalid-dependency": "^4.0.2",
|
|
3095
|
+
"@smithy/middleware-content-length": "^4.0.2",
|
|
3096
|
+
"@smithy/middleware-endpoint": "^4.1.0",
|
|
3097
|
+
"@smithy/middleware-retry": "^4.1.0",
|
|
3098
|
+
"@smithy/middleware-serde": "^4.0.3",
|
|
3099
|
+
"@smithy/middleware-stack": "^4.0.2",
|
|
3100
|
+
"@smithy/node-config-provider": "^4.0.2",
|
|
3101
|
+
"@smithy/node-http-handler": "^4.0.4",
|
|
3102
|
+
"@smithy/protocol-http": "^5.1.0",
|
|
3103
|
+
"@smithy/smithy-client": "^4.2.0",
|
|
3104
|
+
"@smithy/types": "^4.2.0",
|
|
3105
|
+
"@smithy/url-parser": "^4.0.2",
|
|
3106
|
+
"@smithy/util-base64": "^4.0.0",
|
|
3107
|
+
"@smithy/util-body-length-browser": "^4.0.0",
|
|
3108
|
+
"@smithy/util-body-length-node": "^4.0.0",
|
|
3109
|
+
"@smithy/util-defaults-mode-browser": "^4.0.8",
|
|
3110
|
+
"@smithy/util-defaults-mode-node": "^4.0.8",
|
|
3111
|
+
"@smithy/util-endpoints": "^3.0.2",
|
|
3112
|
+
"@smithy/util-middleware": "^4.0.2",
|
|
3113
|
+
"@smithy/util-retry": "^4.0.2",
|
|
3114
|
+
"@smithy/util-utf8": "^4.0.0",
|
|
3115
|
+
tslib: "^2.6.2"
|
|
3116
|
+
},
|
|
3117
|
+
devDependencies: {
|
|
3118
|
+
concurrently: "7.0.0",
|
|
3119
|
+
"downlevel-dts": "0.10.1",
|
|
3120
|
+
rimraf: "3.0.2",
|
|
3121
|
+
typescript: "~5.2.2"
|
|
3122
|
+
},
|
|
3123
|
+
typesVersions: {
|
|
3124
|
+
"<4.0": {
|
|
3125
|
+
"dist-types/*": [
|
|
3126
|
+
"dist-types/ts3.4/*"
|
|
3127
|
+
]
|
|
3128
|
+
}
|
|
3129
|
+
},
|
|
3130
|
+
files: [
|
|
3131
|
+
"./sso-oidc.d.ts",
|
|
3132
|
+
"./sso-oidc.js",
|
|
3133
|
+
"./sts.d.ts",
|
|
3134
|
+
"./sts.js",
|
|
3135
|
+
"dist-*/**"
|
|
3136
|
+
],
|
|
3137
|
+
browser: {
|
|
3138
|
+
"./dist-es/submodules/sso-oidc/runtimeConfig": "./dist-es/submodules/sso-oidc/runtimeConfig.browser",
|
|
3139
|
+
"./dist-es/submodules/sts/runtimeConfig": "./dist-es/submodules/sts/runtimeConfig.browser"
|
|
3140
|
+
},
|
|
3141
|
+
"react-native": {},
|
|
3142
|
+
homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",
|
|
3143
|
+
repository: {
|
|
3144
|
+
type: "git",
|
|
3145
|
+
url: "https://github.com/aws/aws-sdk-js-v3.git",
|
|
3146
|
+
directory: "packages/nested-clients"
|
|
3147
|
+
},
|
|
3148
|
+
exports: {
|
|
3149
|
+
"./sso-oidc": {
|
|
3150
|
+
types: "./dist-types/submodules/sso-oidc/index.d.ts",
|
|
3151
|
+
module: "./dist-es/submodules/sso-oidc/index.js",
|
|
3152
|
+
node: "./dist-cjs/submodules/sso-oidc/index.js",
|
|
3153
|
+
import: "./dist-es/submodules/sso-oidc/index.js",
|
|
3154
|
+
require: "./dist-cjs/submodules/sso-oidc/index.js"
|
|
3155
|
+
},
|
|
3156
|
+
"./sts": {
|
|
3157
|
+
types: "./dist-types/submodules/sts/index.d.ts",
|
|
3158
|
+
module: "./dist-es/submodules/sts/index.js",
|
|
3159
|
+
node: "./dist-cjs/submodules/sts/index.js",
|
|
3160
|
+
import: "./dist-es/submodules/sts/index.js",
|
|
3161
|
+
require: "./dist-cjs/submodules/sts/index.js"
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
});
|
|
3166
|
+
|
|
3167
|
+
// ../../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
|
|
3168
|
+
var require_dist_cjs29 = __commonJS((exports, module) => {
|
|
3169
|
+
var __defProp = Object.defineProperty;
|
|
3170
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3171
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3172
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3173
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3174
|
+
var __export = (target, all) => {
|
|
3175
|
+
for (var name in all)
|
|
3176
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
3177
|
+
};
|
|
3178
|
+
var __copyProps = (to, from, except, desc) => {
|
|
3179
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3180
|
+
for (let key of __getOwnPropNames(from))
|
|
3181
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
3182
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3183
|
+
}
|
|
3184
|
+
return to;
|
|
3185
|
+
};
|
|
3186
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3187
|
+
var index_exports = {};
|
|
3188
|
+
__export(index_exports, {
|
|
3189
|
+
NODE_APP_ID_CONFIG_OPTIONS: () => NODE_APP_ID_CONFIG_OPTIONS,
|
|
3190
|
+
UA_APP_ID_ENV_NAME: () => UA_APP_ID_ENV_NAME,
|
|
3191
|
+
UA_APP_ID_INI_NAME: () => UA_APP_ID_INI_NAME,
|
|
3192
|
+
createDefaultUserAgentProvider: () => createDefaultUserAgentProvider,
|
|
3193
|
+
crtAvailability: () => crtAvailability,
|
|
3194
|
+
defaultUserAgent: () => defaultUserAgent
|
|
3195
|
+
});
|
|
3196
|
+
module.exports = __toCommonJS(index_exports);
|
|
3197
|
+
var import_os = __require("node:os");
|
|
3198
|
+
var import_process = __require("node:process");
|
|
3199
|
+
var crtAvailability = {
|
|
3200
|
+
isCrtAvailable: false
|
|
3201
|
+
};
|
|
3202
|
+
var isCrtAvailable = /* @__PURE__ */ __name(() => {
|
|
3203
|
+
if (crtAvailability.isCrtAvailable) {
|
|
3204
|
+
return ["md/crt-avail"];
|
|
3205
|
+
}
|
|
3206
|
+
return null;
|
|
3207
|
+
}, "isCrtAvailable");
|
|
3208
|
+
var createDefaultUserAgentProvider = /* @__PURE__ */ __name(({ serviceId, clientVersion }) => {
|
|
3209
|
+
return async (config) => {
|
|
3210
|
+
const sections = [
|
|
3211
|
+
["aws-sdk-js", clientVersion],
|
|
3212
|
+
["ua", "2.1"],
|
|
3213
|
+
[`os/${(0, import_os.platform)()}`, (0, import_os.release)()],
|
|
3214
|
+
["lang/js"],
|
|
3215
|
+
["md/nodejs", `${import_process.versions.node}`]
|
|
3216
|
+
];
|
|
3217
|
+
const crtAvailable = isCrtAvailable();
|
|
3218
|
+
if (crtAvailable) {
|
|
3219
|
+
sections.push(crtAvailable);
|
|
3220
|
+
}
|
|
3221
|
+
if (serviceId) {
|
|
3222
|
+
sections.push([`api/${serviceId}`, clientVersion]);
|
|
3223
|
+
}
|
|
3224
|
+
if (import_process.env.AWS_EXECUTION_ENV) {
|
|
3225
|
+
sections.push([`exec-env/${import_process.env.AWS_EXECUTION_ENV}`]);
|
|
3226
|
+
}
|
|
3227
|
+
const appId = await config?.userAgentAppId?.();
|
|
3228
|
+
const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
|
|
3229
|
+
return resolvedUserAgent;
|
|
3230
|
+
};
|
|
3231
|
+
}, "createDefaultUserAgentProvider");
|
|
3232
|
+
var defaultUserAgent = createDefaultUserAgentProvider;
|
|
3233
|
+
var import_middleware_user_agent = require_dist_cjs16();
|
|
3234
|
+
var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
|
|
3235
|
+
var UA_APP_ID_INI_NAME = "sdk_ua_app_id";
|
|
3236
|
+
var UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
|
|
3237
|
+
var NODE_APP_ID_CONFIG_OPTIONS = {
|
|
3238
|
+
environmentVariableSelector: /* @__PURE__ */ __name((env2) => env2[UA_APP_ID_ENV_NAME], "environmentVariableSelector"),
|
|
3239
|
+
configFileSelector: /* @__PURE__ */ __name((profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED], "configFileSelector"),
|
|
3240
|
+
default: import_middleware_user_agent.DEFAULT_UA_APP_ID
|
|
3241
|
+
};
|
|
3242
|
+
});
|
|
3243
|
+
|
|
3244
|
+
// ../../../../node_modules/@smithy/hash-node/dist-cjs/index.js
|
|
3245
|
+
var require_dist_cjs30 = __commonJS((exports, module) => {
|
|
3246
|
+
var __defProp = Object.defineProperty;
|
|
3247
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3248
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3249
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3250
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3251
|
+
var __export = (target, all) => {
|
|
3252
|
+
for (var name in all)
|
|
3253
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
3254
|
+
};
|
|
3255
|
+
var __copyProps = (to, from, except, desc) => {
|
|
3256
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3257
|
+
for (let key of __getOwnPropNames(from))
|
|
3258
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
3259
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3260
|
+
}
|
|
3261
|
+
return to;
|
|
3262
|
+
};
|
|
3263
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3264
|
+
var src_exports = {};
|
|
3265
|
+
__export(src_exports, {
|
|
3266
|
+
Hash: () => Hash
|
|
3267
|
+
});
|
|
3268
|
+
module.exports = __toCommonJS(src_exports);
|
|
3269
|
+
var import_util_buffer_from = require_dist_cjs5();
|
|
3270
|
+
var import_util_utf8 = require_dist_cjs6();
|
|
3271
|
+
var import_buffer = __require("node:buffer");
|
|
3272
|
+
var import_crypto = __require("node:crypto");
|
|
3273
|
+
var Hash = class {
|
|
3274
|
+
static {
|
|
3275
|
+
__name(this, "Hash");
|
|
3276
|
+
}
|
|
3277
|
+
constructor(algorithmIdentifier, secret) {
|
|
3278
|
+
this.algorithmIdentifier = algorithmIdentifier;
|
|
3279
|
+
this.secret = secret;
|
|
3280
|
+
this.reset();
|
|
3281
|
+
}
|
|
3282
|
+
update(toHash, encoding) {
|
|
3283
|
+
this.hash.update((0, import_util_utf8.toUint8Array)(castSourceData(toHash, encoding)));
|
|
3284
|
+
}
|
|
3285
|
+
digest() {
|
|
3286
|
+
return Promise.resolve(this.hash.digest());
|
|
3287
|
+
}
|
|
3288
|
+
reset() {
|
|
3289
|
+
this.hash = this.secret ? (0, import_crypto.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) : (0, import_crypto.createHash)(this.algorithmIdentifier);
|
|
3290
|
+
}
|
|
3291
|
+
};
|
|
3292
|
+
function castSourceData(toCast, encoding) {
|
|
3293
|
+
if (import_buffer.Buffer.isBuffer(toCast)) {
|
|
3294
|
+
return toCast;
|
|
3295
|
+
}
|
|
3296
|
+
if (typeof toCast === "string") {
|
|
3297
|
+
return (0, import_util_buffer_from.fromString)(toCast, encoding);
|
|
3298
|
+
}
|
|
3299
|
+
if (ArrayBuffer.isView(toCast)) {
|
|
3300
|
+
return (0, import_util_buffer_from.fromArrayBuffer)(toCast.buffer, toCast.byteOffset, toCast.byteLength);
|
|
3301
|
+
}
|
|
3302
|
+
return (0, import_util_buffer_from.fromArrayBuffer)(toCast);
|
|
3303
|
+
}
|
|
3304
|
+
__name(castSourceData, "castSourceData");
|
|
3305
|
+
});
|
|
3306
|
+
|
|
3307
|
+
// ../../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js
|
|
3308
|
+
var require_dist_cjs31 = __commonJS((exports, module) => {
|
|
3309
|
+
var __defProp = Object.defineProperty;
|
|
3310
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3311
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3312
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3313
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3314
|
+
var __export = (target, all) => {
|
|
3315
|
+
for (var name in all)
|
|
3316
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
3317
|
+
};
|
|
3318
|
+
var __copyProps = (to, from, except, desc) => {
|
|
3319
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3320
|
+
for (let key of __getOwnPropNames(from))
|
|
3321
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
3322
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3323
|
+
}
|
|
3324
|
+
return to;
|
|
3325
|
+
};
|
|
3326
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3327
|
+
var src_exports = {};
|
|
3328
|
+
__export(src_exports, {
|
|
3329
|
+
calculateBodyLength: () => calculateBodyLength
|
|
3330
|
+
});
|
|
3331
|
+
module.exports = __toCommonJS(src_exports);
|
|
3332
|
+
var import_fs = __require("node:fs");
|
|
3333
|
+
var calculateBodyLength = /* @__PURE__ */ __name((body) => {
|
|
3334
|
+
if (!body) {
|
|
3335
|
+
return 0;
|
|
3336
|
+
}
|
|
3337
|
+
if (typeof body === "string") {
|
|
3338
|
+
return Buffer.byteLength(body);
|
|
3339
|
+
} else if (typeof body.byteLength === "number") {
|
|
3340
|
+
return body.byteLength;
|
|
3341
|
+
} else if (typeof body.size === "number") {
|
|
3342
|
+
return body.size;
|
|
3343
|
+
} else if (typeof body.start === "number" && typeof body.end === "number") {
|
|
3344
|
+
return body.end + 1 - body.start;
|
|
3345
|
+
} else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
|
|
3346
|
+
return (0, import_fs.lstatSync)(body.path).size;
|
|
3347
|
+
} else if (typeof body.fd === "number") {
|
|
3348
|
+
return (0, import_fs.fstatSync)(body.fd).size;
|
|
3349
|
+
}
|
|
3350
|
+
throw new Error(`Body Length computation failed for ${body}`);
|
|
3351
|
+
}, "calculateBodyLength");
|
|
3352
|
+
});
|
|
3353
|
+
|
|
3354
|
+
// ../../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js
|
|
3355
|
+
var require_dist_cjs32 = __commonJS((exports, module) => {
|
|
3356
|
+
var __defProp = Object.defineProperty;
|
|
3357
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3358
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3359
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3360
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3361
|
+
var __export = (target, all) => {
|
|
3362
|
+
for (var name in all)
|
|
3363
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
3364
|
+
};
|
|
3365
|
+
var __copyProps = (to, from, except, desc) => {
|
|
3366
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3367
|
+
for (let key of __getOwnPropNames(from))
|
|
3368
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
3369
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3370
|
+
}
|
|
3371
|
+
return to;
|
|
3372
|
+
};
|
|
3373
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3374
|
+
var src_exports = {};
|
|
3375
|
+
__export(src_exports, {
|
|
3376
|
+
DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES,
|
|
3377
|
+
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
3378
|
+
ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN,
|
|
3379
|
+
ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI,
|
|
3380
|
+
ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI,
|
|
3381
|
+
Endpoint: () => Endpoint,
|
|
3382
|
+
fromContainerMetadata: () => fromContainerMetadata,
|
|
3383
|
+
fromInstanceMetadata: () => fromInstanceMetadata,
|
|
3384
|
+
getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint,
|
|
3385
|
+
httpRequest: () => httpRequest,
|
|
3386
|
+
providerConfigFromInit: () => providerConfigFromInit
|
|
3387
|
+
});
|
|
3388
|
+
module.exports = __toCommonJS(src_exports);
|
|
3389
|
+
var import_url = __require("node:url");
|
|
3390
|
+
var import_property_provider = require_dist_cjs8();
|
|
3391
|
+
var import_buffer = __require("node:buffer");
|
|
3392
|
+
var import_http = __require("node:http");
|
|
3393
|
+
function httpRequest(options) {
|
|
3394
|
+
return new Promise((resolve, reject) => {
|
|
3395
|
+
const req = (0, import_http.request)({
|
|
3396
|
+
method: "GET",
|
|
3397
|
+
...options,
|
|
3398
|
+
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
|
|
3399
|
+
});
|
|
3400
|
+
req.on("error", (err) => {
|
|
3401
|
+
reject(Object.assign(new import_property_provider.ProviderError("Unable to connect to instance metadata service"), err));
|
|
3402
|
+
req.destroy();
|
|
3403
|
+
});
|
|
3404
|
+
req.on("timeout", () => {
|
|
3405
|
+
reject(new import_property_provider.ProviderError("TimeoutError from instance metadata service"));
|
|
3406
|
+
req.destroy();
|
|
3407
|
+
});
|
|
3408
|
+
req.on("response", (res) => {
|
|
3409
|
+
const { statusCode = 400 } = res;
|
|
3410
|
+
if (statusCode < 200 || 300 <= statusCode) {
|
|
3411
|
+
reject(Object.assign(new import_property_provider.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
3412
|
+
req.destroy();
|
|
3413
|
+
}
|
|
3414
|
+
const chunks = [];
|
|
3415
|
+
res.on("data", (chunk) => {
|
|
3416
|
+
chunks.push(chunk);
|
|
3417
|
+
});
|
|
3418
|
+
res.on("end", () => {
|
|
3419
|
+
resolve(import_buffer.Buffer.concat(chunks));
|
|
3420
|
+
req.destroy();
|
|
3421
|
+
});
|
|
3422
|
+
});
|
|
3423
|
+
req.end();
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
__name(httpRequest, "httpRequest");
|
|
3427
|
+
var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials");
|
|
3428
|
+
var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({
|
|
3429
|
+
accessKeyId: creds.AccessKeyId,
|
|
3430
|
+
secretAccessKey: creds.SecretAccessKey,
|
|
3431
|
+
sessionToken: creds.Token,
|
|
3432
|
+
expiration: new Date(creds.Expiration),
|
|
3433
|
+
...creds.AccountId && { accountId: creds.AccountId }
|
|
3434
|
+
}), "fromImdsCredentials");
|
|
3435
|
+
var DEFAULT_TIMEOUT = 1000;
|
|
3436
|
+
var DEFAULT_MAX_RETRIES = 0;
|
|
3437
|
+
var providerConfigFromInit = /* @__PURE__ */ __name(({
|
|
3438
|
+
maxRetries = DEFAULT_MAX_RETRIES,
|
|
3439
|
+
timeout = DEFAULT_TIMEOUT
|
|
3440
|
+
}) => ({ maxRetries, timeout }), "providerConfigFromInit");
|
|
3441
|
+
var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => {
|
|
3442
|
+
let promise = toRetry();
|
|
3443
|
+
for (let i = 0;i < maxRetries; i++) {
|
|
3444
|
+
promise = promise.catch(toRetry);
|
|
3445
|
+
}
|
|
3446
|
+
return promise;
|
|
3447
|
+
}, "retry");
|
|
3448
|
+
var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
3449
|
+
var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
3450
|
+
var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
3451
|
+
var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => {
|
|
3452
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
3453
|
+
return () => retry(async () => {
|
|
3454
|
+
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
3455
|
+
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
3456
|
+
if (!isImdsCredentials(credsResponse)) {
|
|
3457
|
+
throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
3458
|
+
logger: init.logger
|
|
3459
|
+
});
|
|
3460
|
+
}
|
|
3461
|
+
return fromImdsCredentials(credsResponse);
|
|
3462
|
+
}, maxRetries);
|
|
3463
|
+
}, "fromContainerMetadata");
|
|
3464
|
+
var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => {
|
|
3465
|
+
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
|
3466
|
+
options.headers = {
|
|
3467
|
+
...options.headers,
|
|
3468
|
+
Authorization: process.env[ENV_CMDS_AUTH_TOKEN]
|
|
3469
|
+
};
|
|
3470
|
+
}
|
|
3471
|
+
const buffer = await httpRequest({
|
|
3472
|
+
...options,
|
|
3473
|
+
timeout
|
|
3474
|
+
});
|
|
3475
|
+
return buffer.toString();
|
|
3476
|
+
}, "requestFromEcsImds");
|
|
3477
|
+
var CMDS_IP = "169.254.170.2";
|
|
3478
|
+
var GREENGRASS_HOSTS = {
|
|
3479
|
+
localhost: true,
|
|
3480
|
+
"127.0.0.1": true
|
|
3481
|
+
};
|
|
3482
|
+
var GREENGRASS_PROTOCOLS = {
|
|
3483
|
+
"http:": true,
|
|
3484
|
+
"https:": true
|
|
3485
|
+
};
|
|
3486
|
+
var getCmdsUri = /* @__PURE__ */ __name(async ({ logger }) => {
|
|
3487
|
+
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
3488
|
+
return {
|
|
3489
|
+
hostname: CMDS_IP,
|
|
3490
|
+
path: process.env[ENV_CMDS_RELATIVE_URI]
|
|
3491
|
+
};
|
|
3492
|
+
}
|
|
3493
|
+
if (process.env[ENV_CMDS_FULL_URI]) {
|
|
3494
|
+
const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]);
|
|
3495
|
+
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
|
3496
|
+
throw new import_property_provider.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
3497
|
+
tryNextLink: false,
|
|
3498
|
+
logger
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
|
3502
|
+
throw new import_property_provider.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
3503
|
+
tryNextLink: false,
|
|
3504
|
+
logger
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
return {
|
|
3508
|
+
...parsed,
|
|
3509
|
+
port: parsed.port ? parseInt(parsed.port, 10) : undefined
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
throw new import_property_provider.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, {
|
|
3513
|
+
tryNextLink: false,
|
|
3514
|
+
logger
|
|
3515
|
+
});
|
|
3516
|
+
}, "getCmdsUri");
|
|
3517
|
+
var InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError extends import_property_provider.CredentialsProviderError {
|
|
3518
|
+
constructor(message, tryNextLink = true) {
|
|
3519
|
+
super(message, tryNextLink);
|
|
3520
|
+
this.tryNextLink = tryNextLink;
|
|
3521
|
+
this.name = "InstanceMetadataV1FallbackError";
|
|
3522
|
+
Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError.prototype);
|
|
3523
|
+
}
|
|
3524
|
+
static {
|
|
3525
|
+
__name(this, "InstanceMetadataV1FallbackError");
|
|
3526
|
+
}
|
|
3527
|
+
};
|
|
3528
|
+
var import_node_config_provider = require_dist_cjs21();
|
|
3529
|
+
var import_url_parser = require_dist_cjs23();
|
|
3530
|
+
var Endpoint = /* @__PURE__ */ ((Endpoint2) => {
|
|
3531
|
+
Endpoint2["IPv4"] = "http://169.254.169.254";
|
|
3532
|
+
Endpoint2["IPv6"] = "http://[fd00:ec2::254]";
|
|
3533
|
+
return Endpoint2;
|
|
3534
|
+
})(Endpoint || {});
|
|
3535
|
+
var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
3536
|
+
var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
3537
|
+
var ENDPOINT_CONFIG_OPTIONS = {
|
|
3538
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
|
3539
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
|
3540
|
+
default: undefined
|
|
3541
|
+
};
|
|
3542
|
+
var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => {
|
|
3543
|
+
EndpointMode2["IPv4"] = "IPv4";
|
|
3544
|
+
EndpointMode2["IPv6"] = "IPv6";
|
|
3545
|
+
return EndpointMode2;
|
|
3546
|
+
})(EndpointMode || {});
|
|
3547
|
+
var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
|
3548
|
+
var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
|
3549
|
+
var ENDPOINT_MODE_CONFIG_OPTIONS = {
|
|
3550
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
|
3551
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
|
3552
|
+
default: "IPv4"
|
|
3553
|
+
};
|
|
3554
|
+
var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint");
|
|
3555
|
+
var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig");
|
|
3556
|
+
var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => {
|
|
3557
|
+
const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
3558
|
+
switch (endpointMode) {
|
|
3559
|
+
case "IPv4":
|
|
3560
|
+
return "http://169.254.169.254";
|
|
3561
|
+
case "IPv6":
|
|
3562
|
+
return "http://[fd00:ec2::254]";
|
|
3563
|
+
default:
|
|
3564
|
+
throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`);
|
|
3565
|
+
}
|
|
3566
|
+
}, "getFromEndpointModeConfig");
|
|
3567
|
+
var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
3568
|
+
var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
3569
|
+
var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
|
3570
|
+
var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => {
|
|
3571
|
+
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
3572
|
+
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
|
3573
|
+
logger.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}.
|
|
3574
|
+
For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
3575
|
+
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
3576
|
+
return {
|
|
3577
|
+
...credentials,
|
|
3578
|
+
...originalExpiration ? { originalExpiration } : {},
|
|
3579
|
+
expiration: newExpiration
|
|
3580
|
+
};
|
|
3581
|
+
}, "getExtendedInstanceMetadataCredentials");
|
|
3582
|
+
var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => {
|
|
3583
|
+
const logger = options?.logger || console;
|
|
3584
|
+
let pastCredentials;
|
|
3585
|
+
return async () => {
|
|
3586
|
+
let credentials;
|
|
3587
|
+
try {
|
|
3588
|
+
credentials = await provider();
|
|
3589
|
+
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
3590
|
+
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
|
3591
|
+
}
|
|
3592
|
+
} catch (e) {
|
|
3593
|
+
if (pastCredentials) {
|
|
3594
|
+
logger.warn("Credential renew failed: ", e);
|
|
3595
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
|
3596
|
+
} else {
|
|
3597
|
+
throw e;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
pastCredentials = credentials;
|
|
3601
|
+
return credentials;
|
|
3602
|
+
};
|
|
3603
|
+
}, "staticStabilityProvider");
|
|
3604
|
+
var IMDS_PATH = "/latest/meta-data/iam/security-credentials/";
|
|
3605
|
+
var IMDS_TOKEN_PATH = "/latest/api/token";
|
|
3606
|
+
var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED";
|
|
3607
|
+
var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled";
|
|
3608
|
+
var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
|
|
3609
|
+
var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata");
|
|
3610
|
+
var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => {
|
|
3611
|
+
let disableFetchToken = false;
|
|
3612
|
+
const { logger, profile } = init;
|
|
3613
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
3614
|
+
const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => {
|
|
3615
|
+
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
3616
|
+
if (isImdsV1Fallback) {
|
|
3617
|
+
let fallbackBlockedFromProfile = false;
|
|
3618
|
+
let fallbackBlockedFromProcessEnv = false;
|
|
3619
|
+
const configValue = await (0, import_node_config_provider.loadConfig)({
|
|
3620
|
+
environmentVariableSelector: (env) => {
|
|
3621
|
+
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
3622
|
+
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
3623
|
+
if (envValue === undefined) {
|
|
3624
|
+
throw new import_property_provider.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
3625
|
+
}
|
|
3626
|
+
return fallbackBlockedFromProcessEnv;
|
|
3627
|
+
},
|
|
3628
|
+
configFileSelector: (profile2) => {
|
|
3629
|
+
const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
|
3630
|
+
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
|
3631
|
+
return fallbackBlockedFromProfile;
|
|
3632
|
+
},
|
|
3633
|
+
default: false
|
|
3634
|
+
}, {
|
|
3635
|
+
profile
|
|
3636
|
+
})();
|
|
3637
|
+
if (init.ec2MetadataV1Disabled || configValue) {
|
|
3638
|
+
const causes = [];
|
|
3639
|
+
if (init.ec2MetadataV1Disabled)
|
|
3640
|
+
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
|
3641
|
+
if (fallbackBlockedFromProfile)
|
|
3642
|
+
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
|
3643
|
+
if (fallbackBlockedFromProcessEnv)
|
|
3644
|
+
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
|
3645
|
+
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
const imdsProfile = (await retry(async () => {
|
|
3649
|
+
let profile2;
|
|
3650
|
+
try {
|
|
3651
|
+
profile2 = await getProfile(options);
|
|
3652
|
+
} catch (err) {
|
|
3653
|
+
if (err.statusCode === 401) {
|
|
3654
|
+
disableFetchToken = false;
|
|
3655
|
+
}
|
|
3656
|
+
throw err;
|
|
3657
|
+
}
|
|
3658
|
+
return profile2;
|
|
3659
|
+
}, maxRetries2)).trim();
|
|
3660
|
+
return retry(async () => {
|
|
3661
|
+
let creds;
|
|
3662
|
+
try {
|
|
3663
|
+
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
|
3664
|
+
} catch (err) {
|
|
3665
|
+
if (err.statusCode === 401) {
|
|
3666
|
+
disableFetchToken = false;
|
|
3667
|
+
}
|
|
3668
|
+
throw err;
|
|
3669
|
+
}
|
|
3670
|
+
return creds;
|
|
3671
|
+
}, maxRetries2);
|
|
3672
|
+
}, "getCredentials");
|
|
3673
|
+
return async () => {
|
|
3674
|
+
const endpoint = await getInstanceMetadataEndpoint();
|
|
3675
|
+
if (disableFetchToken) {
|
|
3676
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
3677
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
3678
|
+
} else {
|
|
3679
|
+
let token;
|
|
3680
|
+
try {
|
|
3681
|
+
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
|
3682
|
+
} catch (error) {
|
|
3683
|
+
if (error?.statusCode === 400) {
|
|
3684
|
+
throw Object.assign(error, {
|
|
3685
|
+
message: "EC2 Metadata token request returned error"
|
|
3686
|
+
});
|
|
3687
|
+
} else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
|
3688
|
+
disableFetchToken = true;
|
|
3689
|
+
}
|
|
3690
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
3691
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
3692
|
+
}
|
|
3693
|
+
return getCredentials(maxRetries, {
|
|
3694
|
+
...endpoint,
|
|
3695
|
+
headers: {
|
|
3696
|
+
[X_AWS_EC2_METADATA_TOKEN]: token
|
|
3697
|
+
},
|
|
3698
|
+
timeout
|
|
3699
|
+
});
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
}, "getInstanceMetadataProvider");
|
|
3703
|
+
var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({
|
|
3704
|
+
...options,
|
|
3705
|
+
path: IMDS_TOKEN_PATH,
|
|
3706
|
+
method: "PUT",
|
|
3707
|
+
headers: {
|
|
3708
|
+
"x-aws-ec2-metadata-token-ttl-seconds": "21600"
|
|
3709
|
+
}
|
|
3710
|
+
}), "getMetadataToken");
|
|
3711
|
+
var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile");
|
|
3712
|
+
var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options, init) => {
|
|
3713
|
+
const credentialsResponse = JSON.parse((await httpRequest({
|
|
3714
|
+
...options,
|
|
3715
|
+
path: IMDS_PATH + profile
|
|
3716
|
+
})).toString());
|
|
3717
|
+
if (!isImdsCredentials(credentialsResponse)) {
|
|
3718
|
+
throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
3719
|
+
logger: init.logger
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3722
|
+
return fromImdsCredentials(credentialsResponse);
|
|
3723
|
+
}, "getCredentialsFromProfile");
|
|
3724
|
+
});
|
|
3725
|
+
|
|
3726
|
+
// ../../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js
|
|
3727
|
+
var require_dist_cjs33 = __commonJS((exports, module) => {
|
|
3728
|
+
var __create = Object.create;
|
|
3729
|
+
var __defProp = Object.defineProperty;
|
|
3730
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3731
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3732
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3733
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3734
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3735
|
+
var __export = (target, all) => {
|
|
3736
|
+
for (var name in all)
|
|
3737
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
3738
|
+
};
|
|
3739
|
+
var __copyProps = (to, from, except, desc) => {
|
|
3740
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
3741
|
+
for (let key of __getOwnPropNames(from))
|
|
3742
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
3743
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
3744
|
+
}
|
|
3745
|
+
return to;
|
|
3746
|
+
};
|
|
3747
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
3748
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
3749
|
+
var src_exports = {};
|
|
3750
|
+
__export(src_exports, {
|
|
3751
|
+
resolveDefaultsModeConfig: () => resolveDefaultsModeConfig
|
|
3752
|
+
});
|
|
3753
|
+
module.exports = __toCommonJS(src_exports);
|
|
3754
|
+
var import_config_resolver = require_dist_cjs18();
|
|
3755
|
+
var import_node_config_provider = require_dist_cjs21();
|
|
3756
|
+
var import_property_provider = require_dist_cjs8();
|
|
3757
|
+
var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
|
|
3758
|
+
var AWS_REGION_ENV = "AWS_REGION";
|
|
3759
|
+
var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
|
|
3760
|
+
var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
|
|
3761
|
+
var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
|
|
3762
|
+
var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
|
|
3763
|
+
var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
|
|
3764
|
+
var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
|
|
3765
|
+
var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
|
|
3766
|
+
environmentVariableSelector: (env) => {
|
|
3767
|
+
return env[AWS_DEFAULTS_MODE_ENV];
|
|
3768
|
+
},
|
|
3769
|
+
configFileSelector: (profile) => {
|
|
3770
|
+
return profile[AWS_DEFAULTS_MODE_CONFIG];
|
|
3771
|
+
},
|
|
3772
|
+
default: "legacy"
|
|
3773
|
+
};
|
|
3774
|
+
var resolveDefaultsModeConfig = /* @__PURE__ */ __name(({
|
|
3775
|
+
region = (0, import_node_config_provider.loadConfig)(import_config_resolver.NODE_REGION_CONFIG_OPTIONS),
|
|
3776
|
+
defaultsMode = (0, import_node_config_provider.loadConfig)(NODE_DEFAULTS_MODE_CONFIG_OPTIONS)
|
|
3777
|
+
} = {}) => (0, import_property_provider.memoize)(async () => {
|
|
3778
|
+
const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
|
|
3779
|
+
switch (mode?.toLowerCase()) {
|
|
3780
|
+
case "auto":
|
|
3781
|
+
return resolveNodeDefaultsModeAuto(region);
|
|
3782
|
+
case "in-region":
|
|
3783
|
+
case "cross-region":
|
|
3784
|
+
case "mobile":
|
|
3785
|
+
case "standard":
|
|
3786
|
+
case "legacy":
|
|
3787
|
+
return Promise.resolve(mode?.toLocaleLowerCase());
|
|
3788
|
+
case undefined:
|
|
3789
|
+
return Promise.resolve("legacy");
|
|
3790
|
+
default:
|
|
3791
|
+
throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}`);
|
|
3792
|
+
}
|
|
3793
|
+
}), "resolveDefaultsModeConfig");
|
|
3794
|
+
var resolveNodeDefaultsModeAuto = /* @__PURE__ */ __name(async (clientRegion) => {
|
|
3795
|
+
if (clientRegion) {
|
|
3796
|
+
const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion;
|
|
3797
|
+
const inferredRegion = await inferPhysicalRegion();
|
|
3798
|
+
if (!inferredRegion) {
|
|
3799
|
+
return "standard";
|
|
3800
|
+
}
|
|
3801
|
+
if (resolvedRegion === inferredRegion) {
|
|
3802
|
+
return "in-region";
|
|
3803
|
+
} else {
|
|
3804
|
+
return "cross-region";
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
return "standard";
|
|
3808
|
+
}, "resolveNodeDefaultsModeAuto");
|
|
3809
|
+
var inferPhysicalRegion = /* @__PURE__ */ __name(async () => {
|
|
3810
|
+
if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) {
|
|
3811
|
+
return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV];
|
|
3812
|
+
}
|
|
3813
|
+
if (!process.env[ENV_IMDS_DISABLED]) {
|
|
3814
|
+
try {
|
|
3815
|
+
const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM(require_dist_cjs32()));
|
|
3816
|
+
const endpoint = await getInstanceMetadataEndpoint();
|
|
3817
|
+
return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString();
|
|
3818
|
+
} catch (e) {}
|
|
3819
|
+
}
|
|
3820
|
+
}, "inferPhysicalRegion");
|
|
3821
|
+
});
|
|
3822
|
+
|
|
3823
|
+
export { require_dist_cjs11 as require_dist_cjs, require_dist_cjs12 as require_dist_cjs1, require_dist_cjs13 as require_dist_cjs2, require_dist_cjs14 as require_dist_cjs3, require_dist_cjs15 as require_dist_cjs4, require_dist_cjs16 as require_dist_cjs5, require_dist_cjs18 as require_dist_cjs6, require_dist_cjs19 as require_dist_cjs7, require_dist_cjs21 as require_dist_cjs8, require_dist_cjs23 as require_dist_cjs9, require_dist_cjs24 as require_dist_cjs10, require_dist_cjs26 as require_dist_cjs11, require_dist_cjs27 as require_dist_cjs12, require_package, require_dist_cjs29 as require_dist_cjs13, require_dist_cjs30 as require_dist_cjs14, require_dist_cjs31 as require_dist_cjs15, require_dist_cjs33 as require_dist_cjs16, require_dist_cjs28 as require_dist_cjs17 };
|