@aws-sdk/util-endpoints 3.840.0 → 3.844.0
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 +30 -0
- package/dist-es/index.js +1 -0
- package/dist-es/resolveDefaultAwsRegionalEndpointsConfig.js +21 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -0
- package/dist-types/ts3.4/index.d.ts +1 -0
- package/dist-types/ts3.4/resolveDefaultAwsRegionalEndpointsConfig.d.ts +35 -0
- package/package.json +2 -1
package/dist-cjs/index.js
CHANGED
|
@@ -46,8 +46,10 @@ __export(index_exports, {
|
|
|
46
46
|
getUserAgentPrefix: () => getUserAgentPrefix,
|
|
47
47
|
isIpAddress: () => import_util_endpoints.isIpAddress,
|
|
48
48
|
partition: () => partition,
|
|
49
|
+
resolveDefaultAwsRegionalEndpointsConfig: () => resolveDefaultAwsRegionalEndpointsConfig,
|
|
49
50
|
resolveEndpoint: () => import_util_endpoints.resolveEndpoint,
|
|
50
51
|
setPartitionInfo: () => setPartitionInfo,
|
|
52
|
+
toEndpointV1: () => toEndpointV1,
|
|
51
53
|
useDefaultPartitionInfo: () => useDefaultPartitionInfo
|
|
52
54
|
});
|
|
53
55
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -418,6 +420,32 @@ var awsEndpointFunctions = {
|
|
|
418
420
|
};
|
|
419
421
|
import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions;
|
|
420
422
|
|
|
423
|
+
// src/resolveDefaultAwsRegionalEndpointsConfig.ts
|
|
424
|
+
var import_url_parser = require("@smithy/url-parser");
|
|
425
|
+
var resolveDefaultAwsRegionalEndpointsConfig = /* @__PURE__ */ __name((input) => {
|
|
426
|
+
if (typeof input.endpointProvider !== "function") {
|
|
427
|
+
throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");
|
|
428
|
+
}
|
|
429
|
+
const { endpoint } = input;
|
|
430
|
+
if (endpoint === void 0) {
|
|
431
|
+
input.endpoint = async () => {
|
|
432
|
+
return toEndpointV1(
|
|
433
|
+
input.endpointProvider(
|
|
434
|
+
{
|
|
435
|
+
Region: typeof input.region === "function" ? await input.region() : input.region,
|
|
436
|
+
UseDualStack: typeof input.useDualstackEndpoint === "function" ? await input.useDualstackEndpoint() : input.useDualstackEndpoint,
|
|
437
|
+
UseFIPS: typeof input.useFipsEndpoint === "function" ? await input.useFipsEndpoint() : input.useFipsEndpoint,
|
|
438
|
+
Endpoint: void 0
|
|
439
|
+
},
|
|
440
|
+
{ logger: input.logger }
|
|
441
|
+
)
|
|
442
|
+
);
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
return input;
|
|
446
|
+
}, "resolveDefaultAwsRegionalEndpointsConfig");
|
|
447
|
+
var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => (0, import_url_parser.parseUrl)(endpoint.url), "toEndpointV1");
|
|
448
|
+
|
|
421
449
|
// src/resolveEndpoint.ts
|
|
422
450
|
|
|
423
451
|
|
|
@@ -447,6 +475,8 @@ import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions;
|
|
|
447
475
|
useDefaultPartitionInfo,
|
|
448
476
|
getUserAgentPrefix,
|
|
449
477
|
isIpAddress,
|
|
478
|
+
resolveDefaultAwsRegionalEndpointsConfig,
|
|
479
|
+
toEndpointV1,
|
|
450
480
|
resolveEndpoint,
|
|
451
481
|
EndpointError
|
|
452
482
|
});
|
package/dist-es/index.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseUrl } from "@smithy/url-parser";
|
|
2
|
+
export const resolveDefaultAwsRegionalEndpointsConfig = (input) => {
|
|
3
|
+
if (typeof input.endpointProvider !== "function") {
|
|
4
|
+
throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");
|
|
5
|
+
}
|
|
6
|
+
const { endpoint } = input;
|
|
7
|
+
if (endpoint === undefined) {
|
|
8
|
+
input.endpoint = async () => {
|
|
9
|
+
return toEndpointV1(input.endpointProvider({
|
|
10
|
+
Region: typeof input.region === "function" ? await input.region() : input.region,
|
|
11
|
+
UseDualStack: typeof input.useDualstackEndpoint === "function"
|
|
12
|
+
? await input.useDualstackEndpoint()
|
|
13
|
+
: input.useDualstackEndpoint,
|
|
14
|
+
UseFIPS: typeof input.useFipsEndpoint === "function" ? await input.useFipsEndpoint() : input.useFipsEndpoint,
|
|
15
|
+
Endpoint: undefined,
|
|
16
|
+
}, { logger: input.logger }));
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return input;
|
|
20
|
+
};
|
|
21
|
+
export const toEndpointV1 = (endpoint) => parseUrl(endpoint.url);
|
package/dist-types/index.d.ts
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Endpoint, EndpointParameters, EndpointV2, Logger, Provider } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* This is an additional config resolver layer for clients using the default
|
|
4
|
+
* AWS regional endpoints ruleset. It makes the *resolved* config guarantee the presence of an
|
|
5
|
+
* endpoint provider function. This differs from the base behavior of the Endpoint
|
|
6
|
+
* config resolver, which only normalizes config.endpoint IFF one is provided by the caller.
|
|
7
|
+
*
|
|
8
|
+
* This is not used by AWS SDK clients, but rather
|
|
9
|
+
* generated clients that have the aws.api#service trait. This includes protocol tests
|
|
10
|
+
* and other customers.
|
|
11
|
+
*
|
|
12
|
+
* This resolver is MUTUALLY EXCLUSIVE with the EndpointRequired config resolver from
|
|
13
|
+
* |@smithy/middleware-endpoint.
|
|
14
|
+
*
|
|
15
|
+
* It must be placed after the `resolveEndpointConfig`
|
|
16
|
+
* resolver. This replaces the endpoints.json-based default endpoint provider.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export type DefaultAwsRegionalEndpointsInputConfig = {
|
|
21
|
+
endpoint?: unknown;
|
|
22
|
+
};
|
|
23
|
+
type PreviouslyResolved = {
|
|
24
|
+
logger?: Logger;
|
|
25
|
+
region?: undefined | string | Provider<string | undefined>;
|
|
26
|
+
useFipsEndpoint?: undefined | boolean | Provider<string | boolean>;
|
|
27
|
+
useDualstackEndpoint?: undefined | boolean | Provider<string | boolean>;
|
|
28
|
+
endpointProvider: (endpointParams: EndpointParameters | DefaultRegionalEndpointParameters, context?: {
|
|
29
|
+
logger?: Logger;
|
|
30
|
+
}) => EndpointV2;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
type DefaultRegionalEndpointParameters = {
|
|
36
|
+
Region?: string | undefined;
|
|
37
|
+
UseDualStack?: boolean | undefined;
|
|
38
|
+
UseFIPS?: boolean | undefined;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export interface DefaultAwsRegionalEndpointsResolvedConfig {
|
|
44
|
+
endpoint: Provider<Endpoint>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* MUST resolve after `\@smithy/middleware-endpoint`::`resolveEndpointConfig`.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const resolveDefaultAwsRegionalEndpointsConfig: <T>(input: T & DefaultAwsRegionalEndpointsInputConfig & PreviouslyResolved) => T & DefaultAwsRegionalEndpointsResolvedConfig;
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export declare const toEndpointV1: (endpoint: EndpointV2) => Endpoint;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Endpoint,
|
|
3
|
+
EndpointParameters,
|
|
4
|
+
EndpointV2,
|
|
5
|
+
Logger,
|
|
6
|
+
Provider,
|
|
7
|
+
} from "@smithy/types";
|
|
8
|
+
export type DefaultAwsRegionalEndpointsInputConfig = {
|
|
9
|
+
endpoint?: unknown;
|
|
10
|
+
};
|
|
11
|
+
type PreviouslyResolved = {
|
|
12
|
+
logger?: Logger;
|
|
13
|
+
region?: undefined | string | Provider<string | undefined>;
|
|
14
|
+
useFipsEndpoint?: undefined | boolean | Provider<string | boolean>;
|
|
15
|
+
useDualstackEndpoint?: undefined | boolean | Provider<string | boolean>;
|
|
16
|
+
endpointProvider: (
|
|
17
|
+
endpointParams: EndpointParameters | DefaultRegionalEndpointParameters,
|
|
18
|
+
context?: {
|
|
19
|
+
logger?: Logger;
|
|
20
|
+
}
|
|
21
|
+
) => EndpointV2;
|
|
22
|
+
};
|
|
23
|
+
type DefaultRegionalEndpointParameters = {
|
|
24
|
+
Region?: string | undefined;
|
|
25
|
+
UseDualStack?: boolean | undefined;
|
|
26
|
+
UseFIPS?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
export interface DefaultAwsRegionalEndpointsResolvedConfig {
|
|
29
|
+
endpoint: Provider<Endpoint>;
|
|
30
|
+
}
|
|
31
|
+
export declare const resolveDefaultAwsRegionalEndpointsConfig: <T>(
|
|
32
|
+
input: T & DefaultAwsRegionalEndpointsInputConfig & PreviouslyResolved
|
|
33
|
+
) => T & DefaultAwsRegionalEndpointsResolvedConfig;
|
|
34
|
+
export declare const toEndpointV1: (endpoint: EndpointV2) => Endpoint;
|
|
35
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-endpoints",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.844.0",
|
|
4
4
|
"description": "Utilities to help with endpoint resolution",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aws-sdk/types": "3.840.0",
|
|
28
28
|
"@smithy/types": "^4.3.1",
|
|
29
|
+
"@smithy/url-parser": "^4.0.4",
|
|
29
30
|
"@smithy/util-endpoints": "^3.0.6",
|
|
30
31
|
"tslib": "^2.6.2"
|
|
31
32
|
},
|