@aws-sdk/core 3.974.20 → 3.974.22
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-cjs/index.js +45 -50
- package/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
- package/dist-cjs/submodules/client/index.browser.js +297 -23
- package/dist-cjs/submodules/client/index.js +327 -52
- package/dist-cjs/submodules/client/index.native.js +297 -23
- package/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
- package/dist-cjs/submodules/protocols/index.js +107 -109
- package/dist-cjs/submodules/util/index.js +2 -4
- package/dist-es/submodules/client/util-endpoints/lib/aws/partitions.js +276 -1
- package/package.json +8 -8
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const { Retry, RETRY_MODES } = require("@smithy/core/retry");
|
|
2
|
+
const { HttpRequest, parseUrl } = require("@smithy/core/protocols");
|
|
3
|
+
const { normalizeProvider } = require("@smithy/core");
|
|
4
|
+
const { isValidHostLabel, isIpAddress, customEndpointFunctions } = require("@smithy/core/endpoints");
|
|
5
|
+
const { EndpointError, resolveEndpoint } = require("@smithy/core/endpoints");
|
|
6
|
+
exports.EndpointError = EndpointError;
|
|
7
|
+
exports.isIpAddress = isIpAddress;
|
|
8
|
+
exports.resolveEndpoint = resolveEndpoint;
|
|
9
|
+
const { resolveRegionConfig } = require("@smithy/core/config");
|
|
10
|
+
exports.resolveRegionConfig = resolveRegionConfig;
|
|
8
11
|
|
|
9
12
|
const longPollMiddleware = () => (next, context) => async (args) => {
|
|
10
13
|
context.__retryLongPoll = true;
|
|
@@ -30,7 +33,7 @@ function setCredentialFeature(credentials, feature, value) {
|
|
|
30
33
|
return credentials;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
Retry.v2026 ||= typeof process === "object" && process.env?.AWS_NEW_RETRIES_2026 === "true";
|
|
34
37
|
function setFeature(context, feature, value) {
|
|
35
38
|
if (!context.__aws_sdk_context) {
|
|
36
39
|
context.__aws_sdk_context = {
|
|
@@ -55,7 +58,7 @@ function resolveHostHeaderConfig(input) {
|
|
|
55
58
|
return input;
|
|
56
59
|
}
|
|
57
60
|
const hostHeaderMiddleware = (options) => (next) => async (args) => {
|
|
58
|
-
if (!
|
|
61
|
+
if (!HttpRequest.isInstance(args.request))
|
|
59
62
|
return next(args);
|
|
60
63
|
const { request } = args;
|
|
61
64
|
const { handlerProtocol = "" } = options.requestHandler.metadata || {};
|
|
@@ -149,7 +152,7 @@ function isValidUserAgentAppId(appId) {
|
|
|
149
152
|
return typeof appId === "string" && appId.length <= 50;
|
|
150
153
|
}
|
|
151
154
|
function resolveUserAgentConfig(input) {
|
|
152
|
-
const normalizedAppIdProvider =
|
|
155
|
+
const normalizedAppIdProvider = normalizeProvider(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
|
|
153
156
|
const { customUserAgent } = input;
|
|
154
157
|
return Object.assign(input, {
|
|
155
158
|
customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
|
|
@@ -169,7 +172,282 @@ function resolveUserAgentConfig(input) {
|
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
|
|
172
|
-
const partitionsInfo = {
|
|
175
|
+
const partitionsInfo = {
|
|
176
|
+
"partitions": [
|
|
177
|
+
{
|
|
178
|
+
"id": "aws",
|
|
179
|
+
"outputs": {
|
|
180
|
+
"dnsSuffix": "amazonaws.com",
|
|
181
|
+
"dualStackDnsSuffix": "api.aws",
|
|
182
|
+
"implicitGlobalRegion": "us-east-1",
|
|
183
|
+
"name": "aws",
|
|
184
|
+
"supportsDualStack": true,
|
|
185
|
+
"supportsFIPS": true
|
|
186
|
+
},
|
|
187
|
+
"regionRegex": "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",
|
|
188
|
+
"regions": {
|
|
189
|
+
"af-south-1": {
|
|
190
|
+
"description": "Africa (Cape Town)"
|
|
191
|
+
},
|
|
192
|
+
"ap-east-1": {
|
|
193
|
+
"description": "Asia Pacific (Hong Kong)"
|
|
194
|
+
},
|
|
195
|
+
"ap-east-2": {
|
|
196
|
+
"description": "Asia Pacific (Taipei)"
|
|
197
|
+
},
|
|
198
|
+
"ap-northeast-1": {
|
|
199
|
+
"description": "Asia Pacific (Tokyo)"
|
|
200
|
+
},
|
|
201
|
+
"ap-northeast-2": {
|
|
202
|
+
"description": "Asia Pacific (Seoul)"
|
|
203
|
+
},
|
|
204
|
+
"ap-northeast-3": {
|
|
205
|
+
"description": "Asia Pacific (Osaka)"
|
|
206
|
+
},
|
|
207
|
+
"ap-south-1": {
|
|
208
|
+
"description": "Asia Pacific (Mumbai)"
|
|
209
|
+
},
|
|
210
|
+
"ap-south-2": {
|
|
211
|
+
"description": "Asia Pacific (Hyderabad)"
|
|
212
|
+
},
|
|
213
|
+
"ap-southeast-1": {
|
|
214
|
+
"description": "Asia Pacific (Singapore)"
|
|
215
|
+
},
|
|
216
|
+
"ap-southeast-2": {
|
|
217
|
+
"description": "Asia Pacific (Sydney)"
|
|
218
|
+
},
|
|
219
|
+
"ap-southeast-3": {
|
|
220
|
+
"description": "Asia Pacific (Jakarta)"
|
|
221
|
+
},
|
|
222
|
+
"ap-southeast-4": {
|
|
223
|
+
"description": "Asia Pacific (Melbourne)"
|
|
224
|
+
},
|
|
225
|
+
"ap-southeast-5": {
|
|
226
|
+
"description": "Asia Pacific (Malaysia)"
|
|
227
|
+
},
|
|
228
|
+
"ap-southeast-6": {
|
|
229
|
+
"description": "Asia Pacific (New Zealand)"
|
|
230
|
+
},
|
|
231
|
+
"ap-southeast-7": {
|
|
232
|
+
"description": "Asia Pacific (Thailand)"
|
|
233
|
+
},
|
|
234
|
+
"aws-global": {
|
|
235
|
+
"description": "aws global region"
|
|
236
|
+
},
|
|
237
|
+
"ca-central-1": {
|
|
238
|
+
"description": "Canada (Central)"
|
|
239
|
+
},
|
|
240
|
+
"ca-west-1": {
|
|
241
|
+
"description": "Canada West (Calgary)"
|
|
242
|
+
},
|
|
243
|
+
"eu-central-1": {
|
|
244
|
+
"description": "Europe (Frankfurt)"
|
|
245
|
+
},
|
|
246
|
+
"eu-central-2": {
|
|
247
|
+
"description": "Europe (Zurich)"
|
|
248
|
+
},
|
|
249
|
+
"eu-north-1": {
|
|
250
|
+
"description": "Europe (Stockholm)"
|
|
251
|
+
},
|
|
252
|
+
"eu-south-1": {
|
|
253
|
+
"description": "Europe (Milan)"
|
|
254
|
+
},
|
|
255
|
+
"eu-south-2": {
|
|
256
|
+
"description": "Europe (Spain)"
|
|
257
|
+
},
|
|
258
|
+
"eu-west-1": {
|
|
259
|
+
"description": "Europe (Ireland)"
|
|
260
|
+
},
|
|
261
|
+
"eu-west-2": {
|
|
262
|
+
"description": "Europe (London)"
|
|
263
|
+
},
|
|
264
|
+
"eu-west-3": {
|
|
265
|
+
"description": "Europe (Paris)"
|
|
266
|
+
},
|
|
267
|
+
"il-central-1": {
|
|
268
|
+
"description": "Israel (Tel Aviv)"
|
|
269
|
+
},
|
|
270
|
+
"me-central-1": {
|
|
271
|
+
"description": "Middle East (UAE)"
|
|
272
|
+
},
|
|
273
|
+
"me-south-1": {
|
|
274
|
+
"description": "Middle East (Bahrain)"
|
|
275
|
+
},
|
|
276
|
+
"mx-central-1": {
|
|
277
|
+
"description": "Mexico (Central)"
|
|
278
|
+
},
|
|
279
|
+
"sa-east-1": {
|
|
280
|
+
"description": "South America (Sao Paulo)"
|
|
281
|
+
},
|
|
282
|
+
"us-east-1": {
|
|
283
|
+
"description": "US East (N. Virginia)"
|
|
284
|
+
},
|
|
285
|
+
"us-east-2": {
|
|
286
|
+
"description": "US East (Ohio)"
|
|
287
|
+
},
|
|
288
|
+
"us-west-1": {
|
|
289
|
+
"description": "US West (N. California)"
|
|
290
|
+
},
|
|
291
|
+
"us-west-2": {
|
|
292
|
+
"description": "US West (Oregon)"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"id": "aws-cn",
|
|
298
|
+
"outputs": {
|
|
299
|
+
"dnsSuffix": "amazonaws.com.cn",
|
|
300
|
+
"dualStackDnsSuffix": "api.amazonwebservices.com.cn",
|
|
301
|
+
"implicitGlobalRegion": "cn-northwest-1",
|
|
302
|
+
"name": "aws-cn",
|
|
303
|
+
"supportsDualStack": true,
|
|
304
|
+
"supportsFIPS": true
|
|
305
|
+
},
|
|
306
|
+
"regionRegex": "^cn\\-\\w+\\-\\d+$",
|
|
307
|
+
"regions": {
|
|
308
|
+
"aws-cn-global": {
|
|
309
|
+
"description": "aws-cn global region"
|
|
310
|
+
},
|
|
311
|
+
"cn-north-1": {
|
|
312
|
+
"description": "China (Beijing)"
|
|
313
|
+
},
|
|
314
|
+
"cn-northwest-1": {
|
|
315
|
+
"description": "China (Ningxia)"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"id": "aws-eusc",
|
|
321
|
+
"outputs": {
|
|
322
|
+
"dnsSuffix": "amazonaws.eu",
|
|
323
|
+
"dualStackDnsSuffix": "api.amazonwebservices.eu",
|
|
324
|
+
"implicitGlobalRegion": "eusc-de-east-1",
|
|
325
|
+
"name": "aws-eusc",
|
|
326
|
+
"supportsDualStack": true,
|
|
327
|
+
"supportsFIPS": true
|
|
328
|
+
},
|
|
329
|
+
"regionRegex": "^eusc\\-(de)\\-\\w+\\-\\d+$",
|
|
330
|
+
"regions": {
|
|
331
|
+
"eusc-de-east-1": {
|
|
332
|
+
"description": "AWS European Sovereign Cloud (Germany)"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"id": "aws-iso",
|
|
338
|
+
"outputs": {
|
|
339
|
+
"dnsSuffix": "c2s.ic.gov",
|
|
340
|
+
"dualStackDnsSuffix": "api.aws.ic.gov",
|
|
341
|
+
"implicitGlobalRegion": "us-iso-east-1",
|
|
342
|
+
"name": "aws-iso",
|
|
343
|
+
"supportsDualStack": true,
|
|
344
|
+
"supportsFIPS": true
|
|
345
|
+
},
|
|
346
|
+
"regionRegex": "^us\\-iso\\-\\w+\\-\\d+$",
|
|
347
|
+
"regions": {
|
|
348
|
+
"aws-iso-global": {
|
|
349
|
+
"description": "aws-iso global region"
|
|
350
|
+
},
|
|
351
|
+
"us-iso-east-1": {
|
|
352
|
+
"description": "US ISO East"
|
|
353
|
+
},
|
|
354
|
+
"us-iso-west-1": {
|
|
355
|
+
"description": "US ISO WEST"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"id": "aws-iso-b",
|
|
361
|
+
"outputs": {
|
|
362
|
+
"dnsSuffix": "sc2s.sgov.gov",
|
|
363
|
+
"dualStackDnsSuffix": "api.aws.scloud",
|
|
364
|
+
"implicitGlobalRegion": "us-isob-east-1",
|
|
365
|
+
"name": "aws-iso-b",
|
|
366
|
+
"supportsDualStack": true,
|
|
367
|
+
"supportsFIPS": true
|
|
368
|
+
},
|
|
369
|
+
"regionRegex": "^us\\-isob\\-\\w+\\-\\d+$",
|
|
370
|
+
"regions": {
|
|
371
|
+
"aws-iso-b-global": {
|
|
372
|
+
"description": "aws-iso-b global region"
|
|
373
|
+
},
|
|
374
|
+
"us-isob-east-1": {
|
|
375
|
+
"description": "US ISOB East (Ohio)"
|
|
376
|
+
},
|
|
377
|
+
"us-isob-west-1": {
|
|
378
|
+
"description": "US ISOB West"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"id": "aws-iso-e",
|
|
384
|
+
"outputs": {
|
|
385
|
+
"dnsSuffix": "cloud.adc-e.uk",
|
|
386
|
+
"dualStackDnsSuffix": "api.cloud-aws.adc-e.uk",
|
|
387
|
+
"implicitGlobalRegion": "eu-isoe-west-1",
|
|
388
|
+
"name": "aws-iso-e",
|
|
389
|
+
"supportsDualStack": true,
|
|
390
|
+
"supportsFIPS": true
|
|
391
|
+
},
|
|
392
|
+
"regionRegex": "^eu\\-isoe\\-\\w+\\-\\d+$",
|
|
393
|
+
"regions": {
|
|
394
|
+
"aws-iso-e-global": {
|
|
395
|
+
"description": "aws-iso-e global region"
|
|
396
|
+
},
|
|
397
|
+
"eu-isoe-west-1": {
|
|
398
|
+
"description": "EU ISOE West"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"id": "aws-iso-f",
|
|
404
|
+
"outputs": {
|
|
405
|
+
"dnsSuffix": "csp.hci.ic.gov",
|
|
406
|
+
"dualStackDnsSuffix": "api.aws.hci.ic.gov",
|
|
407
|
+
"implicitGlobalRegion": "us-isof-south-1",
|
|
408
|
+
"name": "aws-iso-f",
|
|
409
|
+
"supportsDualStack": true,
|
|
410
|
+
"supportsFIPS": true
|
|
411
|
+
},
|
|
412
|
+
"regionRegex": "^us\\-isof\\-\\w+\\-\\d+$",
|
|
413
|
+
"regions": {
|
|
414
|
+
"aws-iso-f-global": {
|
|
415
|
+
"description": "aws-iso-f global region"
|
|
416
|
+
},
|
|
417
|
+
"us-isof-east-1": {
|
|
418
|
+
"description": "US ISOF EAST"
|
|
419
|
+
},
|
|
420
|
+
"us-isof-south-1": {
|
|
421
|
+
"description": "US ISOF SOUTH"
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"id": "aws-us-gov",
|
|
427
|
+
"outputs": {
|
|
428
|
+
"dnsSuffix": "amazonaws.com",
|
|
429
|
+
"dualStackDnsSuffix": "api.aws",
|
|
430
|
+
"implicitGlobalRegion": "us-gov-west-1",
|
|
431
|
+
"name": "aws-us-gov",
|
|
432
|
+
"supportsDualStack": true,
|
|
433
|
+
"supportsFIPS": true
|
|
434
|
+
},
|
|
435
|
+
"regionRegex": "^us\\-gov\\-\\w+\\-\\d+$",
|
|
436
|
+
"regions": {
|
|
437
|
+
"aws-us-gov-global": {
|
|
438
|
+
"description": "aws-us-gov global region"
|
|
439
|
+
},
|
|
440
|
+
"us-gov-east-1": {
|
|
441
|
+
"description": "AWS GovCloud (US-East)"
|
|
442
|
+
},
|
|
443
|
+
"us-gov-west-1": {
|
|
444
|
+
"description": "AWS GovCloud (US-West)"
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"version": "1.1"
|
|
450
|
+
};
|
|
173
451
|
|
|
174
452
|
let selectedPartitionsInfo = partitionsInfo;
|
|
175
453
|
let selectedUserAgentPrefix = "";
|
|
@@ -222,10 +500,10 @@ async function checkFeatures(context, config, args) {
|
|
|
222
500
|
const retryStrategy = await config.retryStrategy();
|
|
223
501
|
if (typeof retryStrategy.mode === "string") {
|
|
224
502
|
switch (retryStrategy.mode) {
|
|
225
|
-
case
|
|
503
|
+
case RETRY_MODES.ADAPTIVE:
|
|
226
504
|
setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
|
|
227
505
|
break;
|
|
228
|
-
case
|
|
506
|
+
case RETRY_MODES.STANDARD:
|
|
229
507
|
setFeature(context, "RETRY_MODE_STANDARD", "E");
|
|
230
508
|
break;
|
|
231
509
|
}
|
|
@@ -289,7 +567,7 @@ function encodeFeatures(features) {
|
|
|
289
567
|
|
|
290
568
|
const userAgentMiddleware = (options) => (next, context) => async (args) => {
|
|
291
569
|
const { request } = args;
|
|
292
|
-
if (!
|
|
570
|
+
if (!HttpRequest.isInstance(request)) {
|
|
293
571
|
return next(args);
|
|
294
572
|
}
|
|
295
573
|
const { headers } = request;
|
|
@@ -385,7 +663,7 @@ const createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => async (
|
|
|
385
663
|
const defaultUserAgent = createDefaultUserAgentProvider;
|
|
386
664
|
|
|
387
665
|
const createUserAgentStringParsingProvider = ({ serviceId, clientVersion }) => async (config) => {
|
|
388
|
-
const module =
|
|
666
|
+
const module = require('bowser');
|
|
389
667
|
const parse = module.parse ?? module.default.parse ?? (() => "");
|
|
390
668
|
const parsedUA = typeof window !== "undefined" && window?.navigator?.userAgent ? parse(window.navigator.userAgent) : undefined;
|
|
391
669
|
const sections = [
|
|
@@ -441,7 +719,7 @@ const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
|
|
|
441
719
|
}
|
|
442
720
|
return true;
|
|
443
721
|
}
|
|
444
|
-
if (!
|
|
722
|
+
if (!isValidHostLabel(value)) {
|
|
445
723
|
return false;
|
|
446
724
|
}
|
|
447
725
|
if (value.length < 3 || value.length > 63) {
|
|
@@ -450,7 +728,7 @@ const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
|
|
|
450
728
|
if (value !== value.toLowerCase()) {
|
|
451
729
|
return false;
|
|
452
730
|
}
|
|
453
|
-
if (
|
|
731
|
+
if (isIpAddress(value)) {
|
|
454
732
|
return false;
|
|
455
733
|
}
|
|
456
734
|
return true;
|
|
@@ -480,7 +758,7 @@ const awsEndpointFunctions = {
|
|
|
480
758
|
parseArn: parseArn,
|
|
481
759
|
partition: partition,
|
|
482
760
|
};
|
|
483
|
-
|
|
761
|
+
customEndpointFunctions.aws = awsEndpointFunctions;
|
|
484
762
|
|
|
485
763
|
const resolveDefaultAwsRegionalEndpointsConfig = (input) => {
|
|
486
764
|
if (typeof input.endpointProvider !== "function") {
|
|
@@ -501,7 +779,7 @@ const resolveDefaultAwsRegionalEndpointsConfig = (input) => {
|
|
|
501
779
|
}
|
|
502
780
|
return input;
|
|
503
781
|
};
|
|
504
|
-
const toEndpointV1 = (endpoint) =>
|
|
782
|
+
const toEndpointV1 = (endpoint) => parseUrl(endpoint.url);
|
|
505
783
|
|
|
506
784
|
function stsRegionDefaultResolver() {
|
|
507
785
|
return async () => "us-east-1";
|
|
@@ -536,10 +814,6 @@ const NODE_REGION_CONFIG_OPTIONS = no;
|
|
|
536
814
|
const NODE_REGION_CONFIG_FILE_OPTIONS = no;
|
|
537
815
|
const stsRegionWarning = no;
|
|
538
816
|
|
|
539
|
-
exports.EndpointError = endpoints.EndpointError;
|
|
540
|
-
exports.isIpAddress = endpoints.isIpAddress;
|
|
541
|
-
exports.resolveEndpoint = endpoints.resolveEndpoint;
|
|
542
|
-
exports.resolveRegionConfig = config.resolveRegionConfig;
|
|
543
817
|
exports.DEFAULT_UA_APP_ID = DEFAULT_UA_APP_ID;
|
|
544
818
|
exports.NODE_APP_ID_CONFIG_OPTIONS = NODE_APP_ID_CONFIG_OPTIONS;
|
|
545
819
|
exports.NODE_REGION_CONFIG_FILE_OPTIONS = NODE_REGION_CONFIG_FILE_OPTIONS;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const { HttpResponse, HttpRequest } = require("@smithy/core/protocols");
|
|
2
|
+
const { normalizeProvider, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require("@smithy/core");
|
|
3
|
+
const { ProviderError } = require("@smithy/core/config");
|
|
4
|
+
const { setCredentialFeature } = require("@aws-sdk/core/client");
|
|
5
|
+
const { SignatureV4 } = require("@smithy/signature-v4");
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
var core = require('@smithy/core');
|
|
5
|
-
var config = require('@smithy/core/config');
|
|
6
|
-
var client = require('@aws-sdk/core/client');
|
|
7
|
-
var signatureV4 = require('@smithy/signature-v4');
|
|
8
|
-
|
|
9
|
-
const getDateHeader = (response) => protocols.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
|
|
7
|
+
const getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
|
|
10
8
|
|
|
11
9
|
const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
12
10
|
|
|
@@ -45,7 +43,7 @@ const validateSigningProperties = async (signingProperties) => {
|
|
|
45
43
|
};
|
|
46
44
|
class AwsSdkSigV4Signer {
|
|
47
45
|
async sign(httpRequest, identity, signingProperties) {
|
|
48
|
-
if (!
|
|
46
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
49
47
|
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
50
48
|
}
|
|
51
49
|
const validatedProps = await validateSigningProperties(signingProperties);
|
|
@@ -98,7 +96,7 @@ const AWSSDKSigV4Signer = AwsSdkSigV4Signer;
|
|
|
98
96
|
|
|
99
97
|
class AwsSdkSigV4ASigner extends AwsSdkSigV4Signer {
|
|
100
98
|
async sign(httpRequest, identity, signingProperties) {
|
|
101
|
-
if (!
|
|
99
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
102
100
|
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
103
101
|
}
|
|
104
102
|
const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
|
|
@@ -141,7 +139,7 @@ const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
|
|
|
141
139
|
};
|
|
142
140
|
|
|
143
141
|
const resolveAwsSdkSigV4AConfig = (config) => {
|
|
144
|
-
config.sigv4aSigningRegionSet =
|
|
142
|
+
config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet);
|
|
145
143
|
return config;
|
|
146
144
|
};
|
|
147
145
|
const NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
@@ -149,7 +147,7 @@ const NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
|
149
147
|
if (env.AWS_SIGV4A_SIGNING_REGION_SET) {
|
|
150
148
|
return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
|
|
151
149
|
}
|
|
152
|
-
throw new
|
|
150
|
+
throw new ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
|
|
153
151
|
tryNextLink: true,
|
|
154
152
|
});
|
|
155
153
|
},
|
|
@@ -157,7 +155,7 @@ const NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
|
157
155
|
if (profile.sigv4a_signing_region_set) {
|
|
158
156
|
return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim());
|
|
159
157
|
}
|
|
160
|
-
throw new
|
|
158
|
+
throw new ProviderError("sigv4a_signing_region_set not set in profile.", {
|
|
161
159
|
tryNextLink: true,
|
|
162
160
|
});
|
|
163
161
|
},
|
|
@@ -185,7 +183,7 @@ const resolveAwsSdkSigV4Config = (config) => {
|
|
|
185
183
|
const creds = await boundProvider(options);
|
|
186
184
|
const attributedCreds = creds;
|
|
187
185
|
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
188
|
-
return
|
|
186
|
+
return setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
189
187
|
}
|
|
190
188
|
return attributedCreds;
|
|
191
189
|
};
|
|
@@ -207,10 +205,10 @@ const resolveAwsSdkSigV4Config = (config) => {
|
|
|
207
205
|
const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256, } = config;
|
|
208
206
|
let signer;
|
|
209
207
|
if (config.signer) {
|
|
210
|
-
signer =
|
|
208
|
+
signer = normalizeProvider(config.signer);
|
|
211
209
|
}
|
|
212
210
|
else if (config.regionInfoProvider) {
|
|
213
|
-
signer = () =>
|
|
211
|
+
signer = () => normalizeProvider(config.region)()
|
|
214
212
|
.then(async (region) => [
|
|
215
213
|
(await config.regionInfoProvider(region, {
|
|
216
214
|
useFipsEndpoint: await config.useFipsEndpoint(),
|
|
@@ -230,7 +228,7 @@ const resolveAwsSdkSigV4Config = (config) => {
|
|
|
230
228
|
sha256,
|
|
231
229
|
uriEscapePath: signingEscapePath,
|
|
232
230
|
};
|
|
233
|
-
const SignerCtor = config.signerConstructor ||
|
|
231
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
234
232
|
return new SignerCtor(params);
|
|
235
233
|
});
|
|
236
234
|
}
|
|
@@ -239,7 +237,7 @@ const resolveAwsSdkSigV4Config = (config) => {
|
|
|
239
237
|
authScheme = Object.assign({}, {
|
|
240
238
|
name: "sigv4",
|
|
241
239
|
signingName: config.signingName || config.defaultSigningName,
|
|
242
|
-
signingRegion: await
|
|
240
|
+
signingRegion: await normalizeProvider(config.region)(),
|
|
243
241
|
properties: {},
|
|
244
242
|
}, authScheme);
|
|
245
243
|
const signingRegion = authScheme.signingRegion;
|
|
@@ -254,7 +252,7 @@ const resolveAwsSdkSigV4Config = (config) => {
|
|
|
254
252
|
sha256,
|
|
255
253
|
uriEscapePath: signingEscapePath,
|
|
256
254
|
};
|
|
257
|
-
const SignerCtor = config.signerConstructor ||
|
|
255
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
258
256
|
return new SignerCtor(params);
|
|
259
257
|
};
|
|
260
258
|
}
|
|
@@ -270,7 +268,7 @@ function normalizeCredentialProvider(config, { credentials, credentialDefaultPro
|
|
|
270
268
|
let credentialsProvider;
|
|
271
269
|
if (credentials) {
|
|
272
270
|
if (!credentials?.memoized) {
|
|
273
|
-
credentialsProvider =
|
|
271
|
+
credentialsProvider = memoizeIdentityProvider(credentials, isIdentityExpired, doesIdentityRequireRefresh);
|
|
274
272
|
}
|
|
275
273
|
else {
|
|
276
274
|
credentialsProvider = credentials;
|
|
@@ -278,7 +276,7 @@ function normalizeCredentialProvider(config, { credentials, credentialDefaultPro
|
|
|
278
276
|
}
|
|
279
277
|
else {
|
|
280
278
|
if (credentialDefaultProvider) {
|
|
281
|
-
credentialsProvider =
|
|
279
|
+
credentialsProvider = normalizeProvider(credentialDefaultProvider(Object.assign({}, config, {
|
|
282
280
|
parentClientConfig: config,
|
|
283
281
|
})));
|
|
284
282
|
}
|