@aws-sdk/core 3.974.8 → 3.974.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.js +65 -51
- package/dist-cjs/submodules/account-id-endpoint/index.js +2 -2
- package/dist-cjs/submodules/client/index.js +2 -2
- package/dist-cjs/submodules/httpAuthSchemes/index.js +7 -7
- package/dist-cjs/submodules/protocols/index.js +56 -41
- package/dist-cjs/submodules/util/index.js +59 -0
- package/dist-es/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.js +1 -1
- package/dist-es/submodules/client/setFeature.js +1 -1
- package/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +1 -1
- package/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +1 -1
- package/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js +1 -1
- package/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js +1 -1
- package/dist-es/submodules/protocols/ProtocolLib.js +1 -1
- package/dist-es/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.js +1 -1
- package/dist-es/submodules/protocols/common.js +2 -2
- package/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +7 -6
- package/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -1
- package/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +1 -1
- package/dist-es/submodules/protocols/json/JsonShapeSerializer.js +1 -2
- package/dist-es/submodules/protocols/json/awsExpectUnion.js +1 -1
- package/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +1 -2
- package/dist-es/submodules/protocols/json/parseJsonBody.js +28 -13
- package/dist-es/submodules/protocols/query/AwsQueryProtocol.js +1 -1
- package/dist-es/submodules/protocols/query/QueryShapeSerializer.js +2 -3
- package/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +1 -1
- package/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js +2 -2
- package/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +2 -3
- package/dist-es/submodules/protocols/xml/parseXmlBody.js +1 -1
- package/dist-es/submodules/util/index.js +2 -0
- package/dist-es/submodules/util/util-arn-parser/arn.js +21 -0
- package/dist-es/submodules/util/util-format-url/format-url.js +29 -0
- package/dist-types/api-extractor-type-index.d.ts +1 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts +1 -1
- package/dist-types/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +1 -1
- package/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/dist-types/submodules/protocols/ProtocolLib.d.ts +1 -1
- package/dist-types/submodules/protocols/json/parseJsonBody.d.ts +4 -0
- package/dist-types/submodules/util/index.d.ts +2 -0
- package/dist-types/submodules/util/util-arn-parser/arn.d.ts +32 -0
- package/dist-types/submodules/util/util-format-url/format-url.d.ts +2 -0
- package/dist-types/ts3.4/api-extractor-type-index.d.ts +1 -0
- package/dist-types/ts3.4/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts +1 -1
- package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +1 -1
- package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/ProtocolLib.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +6 -0
- package/dist-types/ts3.4/submodules/util/index.d.ts +2 -0
- package/dist-types/ts3.4/submodules/util/util-arn-parser/arn.d.ts +14 -0
- package/dist-types/ts3.4/submodules/util/util-format-url/format-url.d.ts +4 -0
- package/package.json +16 -13
- package/util.d.ts +7 -0
- package/util.js +5 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
2
|
+
export const parse = (arn) => {
|
|
3
|
+
const segments = arn.split(":");
|
|
4
|
+
if (segments.length < 6 || segments[0] !== "arn")
|
|
5
|
+
throw new Error("Malformed ARN");
|
|
6
|
+
const [, partition, service, region, accountId, ...resource] = segments;
|
|
7
|
+
return {
|
|
8
|
+
partition,
|
|
9
|
+
service,
|
|
10
|
+
region,
|
|
11
|
+
accountId,
|
|
12
|
+
resource: resource.join(":"),
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const build = (arnObject) => {
|
|
16
|
+
const { partition = "aws", service, region, accountId, resource } = arnObject;
|
|
17
|
+
if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
|
|
18
|
+
throw new Error("Input ARN object is invalid");
|
|
19
|
+
}
|
|
20
|
+
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
21
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { buildQueryString } from "@smithy/core/protocols";
|
|
2
|
+
export function formatUrl(request) {
|
|
3
|
+
const { port, query } = request;
|
|
4
|
+
let { protocol, path, hostname } = request;
|
|
5
|
+
if (protocol && protocol.slice(-1) !== ":") {
|
|
6
|
+
protocol += ":";
|
|
7
|
+
}
|
|
8
|
+
if (port) {
|
|
9
|
+
hostname += `:${port}`;
|
|
10
|
+
}
|
|
11
|
+
if (path && path.charAt(0) !== "/") {
|
|
12
|
+
path = `/${path}`;
|
|
13
|
+
}
|
|
14
|
+
let queryString = query ? buildQueryString(query) : "";
|
|
15
|
+
if (queryString && queryString[0] !== "?") {
|
|
16
|
+
queryString = `?${queryString}`;
|
|
17
|
+
}
|
|
18
|
+
let auth = "";
|
|
19
|
+
if (request.username != null || request.password != null) {
|
|
20
|
+
const username = request.username ?? "";
|
|
21
|
+
const password = request.password ?? "";
|
|
22
|
+
auth = `${username}:${password}@`;
|
|
23
|
+
}
|
|
24
|
+
let fragment = "";
|
|
25
|
+
if (request.fragment) {
|
|
26
|
+
fragment = `#${request.fragment}`;
|
|
27
|
+
}
|
|
28
|
+
return `${protocol}//${auth}${hostname}${path}${queryString}${fragment}`;
|
|
29
|
+
}
|
package/dist-types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* They are exported from the package's root index to preserve backwards compatibility.
|
|
4
4
|
*
|
|
5
5
|
* New development should go in a proper submodule and not be exported from the root index.
|
|
6
|
+
* There is an eslint rule banning imports from `@aws-sdk/core` without a submodule e.g. `@aws-sdk/core/protocols`.
|
|
6
7
|
*/
|
|
7
8
|
/**
|
|
8
9
|
* Legacy submodule.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ServiceException as SDKBaseServiceException } from "@smithy/core/client";
|
|
1
2
|
import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
|
|
2
|
-
import type { ServiceException as SDKBaseServiceException } from "@smithy/smithy-client";
|
|
3
3
|
import type { HttpResponse as IHttpResponse, MetadataBearer, ResponseMetadata, StaticErrorSchema } from "@smithy/types";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -11,3 +11,7 @@ export declare const parseJsonErrorBody: (errorBody: any, context: SerdeFunction
|
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export declare const loadRestJsonErrorCode: (output: HttpResponse, data: any) => string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const loadJsonRpcErrorCode: (output: HttpResponse, data: any, removeNamespace: boolean, queryCompat?: boolean) => string | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export interface ARN {
|
|
5
|
+
partition: string;
|
|
6
|
+
service: string;
|
|
7
|
+
region: string;
|
|
8
|
+
accountId: string;
|
|
9
|
+
resource: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validate whether a string is an ARN.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const validate: (str: any) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Parse an ARN string into structure with partition, service, region, accountId and resource values
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const parse: (arn: string) => ARN;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
type buildOptions = Omit<ARN, "partition"> & {
|
|
25
|
+
partition?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Build an ARN with service, partition, region, accountId, and resources strings
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const build: (arnObject: buildOptions) => string;
|
|
32
|
+
export {};
|
package/dist-types/ts3.4/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
2
|
import { AccountIdEndpointMode } from "./AccountIdEndpointModeConstants";
|
|
3
3
|
export declare const ENV_ACCOUNT_ID_ENDPOINT_MODE =
|
|
4
4
|
"AWS_ACCOUNT_ID_ENDPOINT_MODE";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ServiceException as SDKBaseServiceException } from "@smithy/core/client";
|
|
1
2
|
import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
|
|
2
|
-
import { ServiceException as SDKBaseServiceException } from "@smithy/smithy-client";
|
|
3
3
|
import {
|
|
4
4
|
HttpResponse as IHttpResponse,
|
|
5
5
|
MetadataBearer,
|
|
@@ -11,3 +11,9 @@ export declare const loadRestJsonErrorCode: (
|
|
|
11
11
|
output: HttpResponse,
|
|
12
12
|
data: any
|
|
13
13
|
) => string | undefined;
|
|
14
|
+
export declare const loadJsonRpcErrorCode: (
|
|
15
|
+
output: HttpResponse,
|
|
16
|
+
data: any,
|
|
17
|
+
removeNamespace: boolean,
|
|
18
|
+
queryCompat?: boolean
|
|
19
|
+
) => string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ARN {
|
|
2
|
+
partition: string;
|
|
3
|
+
service: string;
|
|
4
|
+
region: string;
|
|
5
|
+
accountId: string;
|
|
6
|
+
resource: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const validate: (str: any) => boolean;
|
|
9
|
+
export declare const parse: (arn: string) => ARN;
|
|
10
|
+
type buildOptions = Pick<ARN, Exclude<keyof ARN, "partition">> & {
|
|
11
|
+
partition?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const build: (arnObject: buildOptions) => string;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/core",
|
|
3
|
-
"version": "3.974.
|
|
3
|
+
"version": "3.974.9",
|
|
4
4
|
"description": "Core functions & classes shared by multiple AWS SDK clients.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline core && premove ./dist-cjs/api-extractor-type-index.js",
|
|
8
8
|
"build:es": "tsc -p tsconfig.es.json && premove ./dist-es/api-extractor-type-index.js",
|
|
9
9
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
10
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
10
|
+
"build:types": "premove dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json",
|
|
11
11
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
12
12
|
"lint": "node ../../scripts/validation/submodules-linter.js --pkg core",
|
|
13
13
|
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
@@ -62,8 +62,17 @@
|
|
|
62
62
|
"node": "./dist-cjs/submodules/protocols/index.js",
|
|
63
63
|
"import": "./dist-es/submodules/protocols/index.js",
|
|
64
64
|
"require": "./dist-cjs/submodules/protocols/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./util": {
|
|
67
|
+
"types": "./dist-types/submodules/util/index.d.ts",
|
|
68
|
+
"module": "./dist-es/submodules/util/index.js",
|
|
69
|
+
"node": "./dist-cjs/submodules/util/index.js",
|
|
70
|
+
"import": "./dist-es/submodules/util/index.js",
|
|
71
|
+
"require": "./dist-cjs/submodules/util/index.js"
|
|
65
72
|
}
|
|
66
73
|
},
|
|
74
|
+
"browser": {},
|
|
75
|
+
"react-native": {},
|
|
67
76
|
"files": [
|
|
68
77
|
"./account-id-endpoint.d.ts",
|
|
69
78
|
"./account-id-endpoint.js",
|
|
@@ -73,6 +82,8 @@
|
|
|
73
82
|
"./httpAuthSchemes.js",
|
|
74
83
|
"./protocols.d.ts",
|
|
75
84
|
"./protocols.js",
|
|
85
|
+
"./util.d.ts",
|
|
86
|
+
"./util.js",
|
|
76
87
|
"dist-*/**"
|
|
77
88
|
],
|
|
78
89
|
"sideEffects": false,
|
|
@@ -83,18 +94,10 @@
|
|
|
83
94
|
"license": "Apache-2.0",
|
|
84
95
|
"dependencies": {
|
|
85
96
|
"@aws-sdk/types": "^3.973.8",
|
|
86
|
-
"@aws-sdk/xml-builder": "^3.972.
|
|
87
|
-
"@smithy/core": "^3.
|
|
88
|
-
"@smithy/
|
|
89
|
-
"@smithy/property-provider": "^4.2.14",
|
|
90
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
91
|
-
"@smithy/signature-v4": "^5.3.14",
|
|
92
|
-
"@smithy/smithy-client": "^4.12.13",
|
|
97
|
+
"@aws-sdk/xml-builder": "^3.972.23",
|
|
98
|
+
"@smithy/core": "^3.24.1",
|
|
99
|
+
"@smithy/signature-v4": "^5.4.1",
|
|
93
100
|
"@smithy/types": "^4.14.1",
|
|
94
|
-
"@smithy/util-base64": "^4.3.2",
|
|
95
|
-
"@smithy/util-middleware": "^4.2.14",
|
|
96
|
-
"@smithy/util-retry": "^4.3.6",
|
|
97
|
-
"@smithy/util-utf8": "^4.2.2",
|
|
98
101
|
"tslib": "^2.6.2"
|
|
99
102
|
},
|
|
100
103
|
"devDependencies": {
|
package/util.d.ts
ADDED