@aws-sdk/util-endpoints 3.292.0 → 3.295.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/lib/aws/partition.js +16 -3
- package/dist-es/lib/aws/partition.js +12 -2
- package/dist-types/lib/aws/partition.d.ts +30 -0
- package/dist-types/lib/getAttr.d.ts +1 -1
- package/dist-types/ts3.4/lib/aws/partition.d.ts +26 -0
- package/dist-types/ts3.4/lib/getAttr.d.ts +1 -1
- package/dist-types/ts3.4/types/EndpointRuleObject.d.ts +4 -7
- package/dist-types/ts3.4/types/ErrorRuleObject.d.ts +1 -1
- package/dist-types/ts3.4/types/RuleSetObject.d.ts +3 -3
- package/dist-types/ts3.4/types/TreeRuleObject.d.ts +2 -2
- package/dist-types/ts3.4/types/shared.d.ts +10 -10
- package/dist-types/types/EndpointRuleObject.d.ts +4 -4
- package/dist-types/types/ErrorRuleObject.d.ts +1 -1
- package/dist-types/types/RuleSetObject.d.ts +3 -3
- package/dist-types/types/TreeRuleObject.d.ts +2 -2
- package/dist-types/types/shared.d.ts +10 -10
- package/package.json +4 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.partition = void 0;
|
|
3
|
+
exports.getUserAgentPrefix = exports.useDefaultPartitionInfo = exports.setPartitionInfo = exports.partition = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const partitions_json_1 = tslib_1.__importDefault(require("./partitions.json"));
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let selectedPartitionsInfo = partitions_json_1.default;
|
|
7
|
+
let selectedUserAgentPrefix = "";
|
|
8
8
|
const partition = (value) => {
|
|
9
|
+
const { partitions } = selectedPartitionsInfo;
|
|
9
10
|
for (const partition of partitions) {
|
|
10
11
|
const { regions, outputs } = partition;
|
|
11
12
|
for (const [region, regionData] of Object.entries(regions)) {
|
|
@@ -25,6 +26,7 @@ const partition = (value) => {
|
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws");
|
|
28
30
|
if (!DEFAULT_PARTITION) {
|
|
29
31
|
throw new Error("Provided region was not found in the partition array or regex," +
|
|
30
32
|
" and default partition with id 'aws' doesn't exist.");
|
|
@@ -34,3 +36,14 @@ const partition = (value) => {
|
|
|
34
36
|
};
|
|
35
37
|
};
|
|
36
38
|
exports.partition = partition;
|
|
39
|
+
const setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => {
|
|
40
|
+
selectedPartitionsInfo = partitionsInfo;
|
|
41
|
+
selectedUserAgentPrefix = userAgentPrefix;
|
|
42
|
+
};
|
|
43
|
+
exports.setPartitionInfo = setPartitionInfo;
|
|
44
|
+
const useDefaultPartitionInfo = () => {
|
|
45
|
+
(0, exports.setPartitionInfo)(partitions_json_1.default, "");
|
|
46
|
+
};
|
|
47
|
+
exports.useDefaultPartitionInfo = useDefaultPartitionInfo;
|
|
48
|
+
const getUserAgentPrefix = () => selectedUserAgentPrefix;
|
|
49
|
+
exports.getUserAgentPrefix = getUserAgentPrefix;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import partitionsInfo from "./partitions.json";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
let selectedPartitionsInfo = partitionsInfo;
|
|
3
|
+
let selectedUserAgentPrefix = "";
|
|
4
4
|
export const partition = (value) => {
|
|
5
|
+
const { partitions } = selectedPartitionsInfo;
|
|
5
6
|
for (const partition of partitions) {
|
|
6
7
|
const { regions, outputs } = partition;
|
|
7
8
|
for (const [region, regionData] of Object.entries(regions)) {
|
|
@@ -21,6 +22,7 @@ export const partition = (value) => {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws");
|
|
24
26
|
if (!DEFAULT_PARTITION) {
|
|
25
27
|
throw new Error("Provided region was not found in the partition array or regex," +
|
|
26
28
|
" and default partition with id 'aws' doesn't exist.");
|
|
@@ -29,3 +31,11 @@ export const partition = (value) => {
|
|
|
29
31
|
...DEFAULT_PARTITION.outputs,
|
|
30
32
|
};
|
|
31
33
|
};
|
|
34
|
+
export const setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => {
|
|
35
|
+
selectedPartitionsInfo = partitionsInfo;
|
|
36
|
+
selectedUserAgentPrefix = userAgentPrefix;
|
|
37
|
+
};
|
|
38
|
+
export const useDefaultPartitionInfo = () => {
|
|
39
|
+
setPartitionInfo(partitionsInfo, "");
|
|
40
|
+
};
|
|
41
|
+
export const getUserAgentPrefix = () => selectedUserAgentPrefix;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { EndpointPartition } from "@aws-sdk/types";
|
|
2
|
+
export type PartitionsInfo = {
|
|
3
|
+
partitions: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
outputs: {
|
|
6
|
+
dnsSuffix: string;
|
|
7
|
+
dualStackDnsSuffix: string;
|
|
8
|
+
name: string;
|
|
9
|
+
supportsDualStack: boolean;
|
|
10
|
+
supportsFIPS: boolean;
|
|
11
|
+
};
|
|
12
|
+
regionRegex: string;
|
|
13
|
+
regions: Record<string, {
|
|
14
|
+
description?: string;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
2
18
|
/**
|
|
3
19
|
* Evaluates a single string argument value as a region, and matches the
|
|
4
20
|
* string value to an AWS partition.
|
|
@@ -6,3 +22,17 @@ import { EndpointPartition } from "@aws-sdk/types";
|
|
|
6
22
|
* that the region has been determined to be a part of.
|
|
7
23
|
*/
|
|
8
24
|
export declare const partition: (value: string) => EndpointPartition;
|
|
25
|
+
/**
|
|
26
|
+
* Set custom partitions.json data.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const setPartitionInfo: (partitionsInfo: PartitionsInfo, userAgentPrefix?: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Reset to the default partitions.json data.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare const useDefaultPartitionInfo: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare const getUserAgentPrefix: () => string;
|
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import { EndpointPartition } from "@aws-sdk/types";
|
|
2
|
+
export type PartitionsInfo = {
|
|
3
|
+
partitions: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
outputs: {
|
|
6
|
+
dnsSuffix: string;
|
|
7
|
+
dualStackDnsSuffix: string;
|
|
8
|
+
name: string;
|
|
9
|
+
supportsDualStack: boolean;
|
|
10
|
+
supportsFIPS: boolean;
|
|
11
|
+
};
|
|
12
|
+
regionRegex: string;
|
|
13
|
+
regions: Record<
|
|
14
|
+
string,
|
|
15
|
+
| {
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
| undefined
|
|
19
|
+
>;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
2
22
|
export declare const partition: (value: string) => EndpointPartition;
|
|
23
|
+
export declare const setPartitionInfo: (
|
|
24
|
+
partitionsInfo: PartitionsInfo,
|
|
25
|
+
userAgentPrefix?: string
|
|
26
|
+
) => void;
|
|
27
|
+
export declare const useDefaultPartitionInfo: () => void;
|
|
28
|
+
export declare const getUserAgentPrefix: () => string;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
2
|
import { ConditionObject, Expression } from "./shared";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
>;
|
|
7
|
-
export declare type EndpointObjectHeaders = Record<string, Expression[]>;
|
|
8
|
-
export declare type EndpointObject = {
|
|
3
|
+
export type EndpointObjectProperties = Record<string, EndpointObjectProperty>;
|
|
4
|
+
export type EndpointObjectHeaders = Record<string, Expression[]>;
|
|
5
|
+
export type EndpointObject = {
|
|
9
6
|
url: Expression;
|
|
10
7
|
properties?: EndpointObjectProperties;
|
|
11
8
|
headers?: EndpointObjectHeaders;
|
|
12
9
|
};
|
|
13
|
-
export
|
|
10
|
+
export type EndpointRuleObject = {
|
|
14
11
|
type: "endpoint";
|
|
15
12
|
conditions?: ConditionObject[];
|
|
16
13
|
endpoint: EndpointObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RuleSetRules } from "./TreeRuleObject";
|
|
2
|
-
export
|
|
2
|
+
export type DeprecatedObject = {
|
|
3
3
|
message?: string;
|
|
4
4
|
since?: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ParameterObject = {
|
|
7
7
|
type: "String" | "Boolean";
|
|
8
8
|
default?: string | boolean;
|
|
9
9
|
required?: boolean;
|
|
@@ -11,7 +11,7 @@ export declare type ParameterObject = {
|
|
|
11
11
|
builtIn?: string;
|
|
12
12
|
deprecated?: DeprecatedObject;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type RuleSetObject = {
|
|
15
15
|
version: string;
|
|
16
16
|
serviceId?: string;
|
|
17
17
|
parameters: Record<string, ParameterObject>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EndpointRuleObject } from "./EndpointRuleObject";
|
|
2
2
|
import { ErrorRuleObject } from "./ErrorRuleObject";
|
|
3
3
|
import { ConditionObject } from "./shared";
|
|
4
|
-
export
|
|
4
|
+
export type RuleSetRules = Array<
|
|
5
5
|
EndpointRuleObject | ErrorRuleObject | TreeRuleObject
|
|
6
6
|
>;
|
|
7
|
-
export
|
|
7
|
+
export type TreeRuleObject = {
|
|
8
8
|
type: "tree";
|
|
9
9
|
conditions?: ConditionObject[];
|
|
10
10
|
rules: RuleSetRules;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { Logger } from "@aws-sdk/types";
|
|
2
|
-
export
|
|
2
|
+
export type ReferenceObject = {
|
|
3
3
|
ref: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type FunctionObject = {
|
|
6
6
|
fn: string;
|
|
7
7
|
argv: FunctionArgv;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type FunctionArgv = Array<Expression | boolean | number>;
|
|
10
|
+
export type FunctionReturn =
|
|
11
11
|
| string
|
|
12
12
|
| boolean
|
|
13
13
|
| number
|
|
14
14
|
| {
|
|
15
15
|
[key: string]: FunctionReturn;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type ConditionObject = FunctionObject & {
|
|
18
18
|
assign?: string;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
20
|
+
export type Expression = string | ReferenceObject | FunctionObject;
|
|
21
|
+
export type EndpointParams = Record<string, string | boolean>;
|
|
22
|
+
export type EndpointResolverOptions = {
|
|
23
23
|
endpointParams: EndpointParams;
|
|
24
24
|
logger?: Logger;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type ReferenceRecord = Record<string, FunctionReturn>;
|
|
27
|
+
export type EvaluateOptions = EndpointResolverOptions & {
|
|
28
28
|
referenceRecord: ReferenceRecord;
|
|
29
29
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
2
|
import { ConditionObject, Expression } from "./shared";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type EndpointObjectProperties = Record<string, EndpointObjectProperty>;
|
|
4
|
+
export type EndpointObjectHeaders = Record<string, Expression[]>;
|
|
5
|
+
export type EndpointObject = {
|
|
6
6
|
url: Expression;
|
|
7
7
|
properties?: EndpointObjectProperties;
|
|
8
8
|
headers?: EndpointObjectHeaders;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type EndpointRuleObject = {
|
|
11
11
|
type: "endpoint";
|
|
12
12
|
conditions?: ConditionObject[];
|
|
13
13
|
endpoint: EndpointObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RuleSetRules } from "./TreeRuleObject";
|
|
2
|
-
export
|
|
2
|
+
export type DeprecatedObject = {
|
|
3
3
|
message?: string;
|
|
4
4
|
since?: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ParameterObject = {
|
|
7
7
|
type: "String" | "Boolean";
|
|
8
8
|
default?: string | boolean;
|
|
9
9
|
required?: boolean;
|
|
@@ -11,7 +11,7 @@ export declare type ParameterObject = {
|
|
|
11
11
|
builtIn?: string;
|
|
12
12
|
deprecated?: DeprecatedObject;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type RuleSetObject = {
|
|
15
15
|
version: string;
|
|
16
16
|
serviceId?: string;
|
|
17
17
|
parameters: Record<string, ParameterObject>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EndpointRuleObject } from "./EndpointRuleObject";
|
|
2
2
|
import { ErrorRuleObject } from "./ErrorRuleObject";
|
|
3
3
|
import { ConditionObject } from "./shared";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type RuleSetRules = Array<EndpointRuleObject | ErrorRuleObject | TreeRuleObject>;
|
|
5
|
+
export type TreeRuleObject = {
|
|
6
6
|
type: "tree";
|
|
7
7
|
conditions?: ConditionObject[];
|
|
8
8
|
rules: RuleSetRules;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Logger } from "@aws-sdk/types";
|
|
2
|
-
export
|
|
2
|
+
export type ReferenceObject = {
|
|
3
3
|
ref: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type FunctionObject = {
|
|
6
6
|
fn: string;
|
|
7
7
|
argv: FunctionArgv;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type FunctionArgv = Array<Expression | boolean | number>;
|
|
10
|
+
export type FunctionReturn = string | boolean | number | {
|
|
11
11
|
[key: string]: FunctionReturn;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type ConditionObject = FunctionObject & {
|
|
14
14
|
assign?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
16
|
+
export type Expression = string | ReferenceObject | FunctionObject;
|
|
17
|
+
export type EndpointParams = Record<string, string | boolean>;
|
|
18
|
+
export type EndpointResolverOptions = {
|
|
19
19
|
endpointParams: EndpointParams;
|
|
20
20
|
logger?: Logger;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
23
|
-
export
|
|
22
|
+
export type ReferenceRecord = Record<string, FunctionReturn>;
|
|
23
|
+
export type EvaluateOptions = EndpointResolverOptions & {
|
|
24
24
|
referenceRecord: ReferenceRecord;
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-endpoints",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.295.0",
|
|
4
4
|
"description": "Utilities to help with endpoint resolution",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
25
|
-
"tslib": "^2.
|
|
24
|
+
"@aws-sdk/types": "3.295.0",
|
|
25
|
+
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=14.0.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"downlevel-dts": "0.10.1",
|
|
50
50
|
"rimraf": "3.0.2",
|
|
51
51
|
"typedoc": "0.23.23",
|
|
52
|
-
"typescript": "~4.
|
|
52
|
+
"typescript": "~4.9.5"
|
|
53
53
|
},
|
|
54
54
|
"typedoc": {
|
|
55
55
|
"entryPoint": "src/index.ts"
|