@aws-sdk/core 3.485.0 → 3.495.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/CHANGELOG.md +22 -0
- package/dist-cjs/client/emitWarningIfUnsupportedVersion.js +1 -17
- package/dist-cjs/client/index.js +1 -4
- package/dist-cjs/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +1 -0
- package/dist-cjs/httpAuthSchemes/aws_sdk/index.js +1 -5
- package/dist-cjs/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +1 -0
- package/dist-cjs/httpAuthSchemes/index.js +1 -4
- package/dist-cjs/httpAuthSchemes/utils/getDateHeader.js +1 -6
- package/dist-cjs/httpAuthSchemes/utils/getSkewCorrectedDate.js +1 -5
- package/dist-cjs/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +1 -12
- package/dist-cjs/httpAuthSchemes/utils/index.js +1 -6
- package/dist-cjs/httpAuthSchemes/utils/isClockSkewed.js +1 -6
- package/dist-cjs/index.js +314 -6
- package/dist-cjs/protocols/coercing-serializers.js +1 -59
- package/dist-cjs/protocols/index.js +1 -5
- package/dist-cjs/protocols/json/awsExpectUnion.js +1 -14
- package/dist-es/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.js → AwsSdkSigV4Signer.js} +13 -7
- package/dist-es/httpAuthSchemes/aws_sdk/index.js +2 -2
- package/dist-es/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.js → resolveAwsSdkSigV4Config.js} +2 -1
- package/dist-types/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.d.ts → AwsSdkSigV4Signer.d.ts} +5 -1
- package/dist-types/httpAuthSchemes/aws_sdk/index.d.ts +2 -2
- package/dist-types/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.d.ts → resolveAwsSdkSigV4Config.d.ts} +27 -8
- package/dist-types/ts3.4/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.d.ts → AwsSdkSigV4Signer.d.ts} +2 -1
- package/dist-types/ts3.4/httpAuthSchemes/aws_sdk/index.d.ts +2 -2
- package/dist-types/ts3.4/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.d.ts → resolveAwsSdkSigV4Config.d.ts} +14 -5
- package/package.json +7 -7
- package/src/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.ts → AwsSdkSigV4Signer.ts} +29 -15
- package/src/httpAuthSchemes/aws_sdk/index.ts +2 -2
- package/src/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.ts → resolveAwsSdkSigV4Config.ts} +30 -10
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/tsconfig.es.tsbuildinfo +1 -1
- package/tsconfig.types.tsbuildinfo +1 -1
- package/dist-cjs/httpAuthSchemes/aws_sdk/AWSSDKSigV4Signer.js +0 -55
- package/dist-cjs/httpAuthSchemes/aws_sdk/resolveAWSSDKSigV4Config.js +0 -81
- package/dist-cjs/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.js +0 -10
- package/dist-es/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.js +0 -6
- package/dist-types/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.d.ts +0 -4
- package/dist-types/ts3.4/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.d.ts +0 -4
- package/src/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.495.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.494.0...v3.495.0) (2024-01-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* use bundled dist-cjs build ([#5687](https://github.com/aws/aws-sdk-js-v3/issues/5687)) ([5f79e22](https://github.com/aws/aws-sdk-js-v3/commit/5f79e225e32f0b2ed5b432ae4e4108663eb0acfb))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.490.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.489.0...v3.490.0) (2024-01-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **experimentalIdentityAndAuth:** rename `AWSSDKSigV4` to `AwsSdkSigV4` ([#5667](https://github.com/aws/aws-sdk-js-v3/issues/5667)) ([9c3e91a](https://github.com/aws/aws-sdk-js-v3/commit/9c3e91aeb155cad42ce56cc116aa71bc8f2457c9))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.485.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.484.0...v3.485.0) (2024-01-03)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitWarningIfUnsupportedVersion = void 0;
|
|
4
|
-
let warningEmitted = false;
|
|
5
|
-
const emitWarningIfUnsupportedVersion = (version) => {
|
|
6
|
-
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
|
|
7
|
-
warningEmitted = true;
|
|
8
|
-
process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
|
|
9
|
-
no longer support Node.js 14.x on May 1, 2024.
|
|
10
|
-
|
|
11
|
-
To continue receiving updates to AWS services, bug fixes, and security
|
|
12
|
-
updates please upgrade to an active Node.js LTS version.
|
|
13
|
-
|
|
14
|
-
More information can be found at: https://a.co/dzr2AJd`);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.emitWarningIfUnsupportedVersion = emitWarningIfUnsupportedVersion;
|
|
1
|
+
module.exports = require("../index.js");
|
package/dist-cjs/client/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./AWSSDKSigV4Signer"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./resolveAWSSDKSigV4Config"), exports);
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDateHeader = void 0;
|
|
4
|
-
const protocol_http_1 = require("@smithy/protocol-http");
|
|
5
|
-
const getDateHeader = (response) => { var _a, _b, _c; return protocol_http_1.HttpResponse.isInstance(response) ? (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : (_c = response.headers) === null || _c === void 0 ? void 0 : _c.Date : undefined; };
|
|
6
|
-
exports.getDateHeader = getDateHeader;
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSkewCorrectedDate = void 0;
|
|
4
|
-
const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
5
|
-
exports.getSkewCorrectedDate = getSkewCorrectedDate;
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUpdatedSystemClockOffset = void 0;
|
|
4
|
-
const isClockSkewed_1 = require("./isClockSkewed");
|
|
5
|
-
const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
|
|
6
|
-
const clockTimeInMs = Date.parse(clockTime);
|
|
7
|
-
if ((0, isClockSkewed_1.isClockSkewed)(clockTimeInMs, currentSystemClockOffset)) {
|
|
8
|
-
return clockTimeInMs - Date.now();
|
|
9
|
-
}
|
|
10
|
-
return currentSystemClockOffset;
|
|
11
|
-
};
|
|
12
|
-
exports.getUpdatedSystemClockOffset = getUpdatedSystemClockOffset;
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./getDateHeader"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./getSkewCorrectedDate"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./getUpdatedSystemClockOffset"), exports);
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isClockSkewed = void 0;
|
|
4
|
-
const getSkewCorrectedDate_1 = require("./getSkewCorrectedDate");
|
|
5
|
-
const isClockSkewed = (clockTime, systemClockOffset) => Math.abs((0, getSkewCorrectedDate_1.getSkewCorrectedDate)(systemClockOffset).getTime() - clockTime) >= 300000;
|
|
6
|
-
exports.isClockSkewed = isClockSkewed;
|
|
1
|
+
module.exports = require("../../index.js");
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,6 +1,314 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
AWSSDKSigV4Signer: () => AWSSDKSigV4Signer,
|
|
24
|
+
AwsSdkSigV4Signer: () => AwsSdkSigV4Signer,
|
|
25
|
+
_toBool: () => _toBool,
|
|
26
|
+
_toNum: () => _toNum,
|
|
27
|
+
_toStr: () => _toStr,
|
|
28
|
+
awsExpectUnion: () => awsExpectUnion,
|
|
29
|
+
emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion,
|
|
30
|
+
resolveAWSSDKSigV4Config: () => resolveAWSSDKSigV4Config,
|
|
31
|
+
resolveAwsSdkSigV4Config: () => resolveAwsSdkSigV4Config
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
|
|
35
|
+
// src/client/emitWarningIfUnsupportedVersion.ts
|
|
36
|
+
var warningEmitted = false;
|
|
37
|
+
var emitWarningIfUnsupportedVersion = /* @__PURE__ */ __name((version) => {
|
|
38
|
+
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
|
|
39
|
+
warningEmitted = true;
|
|
40
|
+
process.emitWarning(
|
|
41
|
+
`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
|
|
42
|
+
no longer support Node.js 14.x on May 1, 2024.
|
|
43
|
+
|
|
44
|
+
To continue receiving updates to AWS services, bug fixes, and security
|
|
45
|
+
updates please upgrade to an active Node.js LTS version.
|
|
46
|
+
|
|
47
|
+
More information can be found at: https://a.co/dzr2AJd`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}, "emitWarningIfUnsupportedVersion");
|
|
51
|
+
|
|
52
|
+
// src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// src/httpAuthSchemes/utils/getDateHeader.ts
|
|
56
|
+
var import_protocol_http = require("@smithy/protocol-http");
|
|
57
|
+
var getDateHeader = /* @__PURE__ */ __name((response) => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
return import_protocol_http.HttpResponse.isInstance(response) ? ((_a = response.headers) == null ? void 0 : _a.date) ?? ((_b = response.headers) == null ? void 0 : _b.Date) : void 0;
|
|
60
|
+
}, "getDateHeader");
|
|
61
|
+
|
|
62
|
+
// src/httpAuthSchemes/utils/getSkewCorrectedDate.ts
|
|
63
|
+
var getSkewCorrectedDate = /* @__PURE__ */ __name((systemClockOffset) => new Date(Date.now() + systemClockOffset), "getSkewCorrectedDate");
|
|
64
|
+
|
|
65
|
+
// src/httpAuthSchemes/utils/isClockSkewed.ts
|
|
66
|
+
var isClockSkewed = /* @__PURE__ */ __name((clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5, "isClockSkewed");
|
|
67
|
+
|
|
68
|
+
// src/httpAuthSchemes/utils/getUpdatedSystemClockOffset.ts
|
|
69
|
+
var getUpdatedSystemClockOffset = /* @__PURE__ */ __name((clockTime, currentSystemClockOffset) => {
|
|
70
|
+
const clockTimeInMs = Date.parse(clockTime);
|
|
71
|
+
if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
|
|
72
|
+
return clockTimeInMs - Date.now();
|
|
73
|
+
}
|
|
74
|
+
return currentSystemClockOffset;
|
|
75
|
+
}, "getUpdatedSystemClockOffset");
|
|
76
|
+
|
|
77
|
+
// src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts
|
|
78
|
+
var throwSigningPropertyError = /* @__PURE__ */ __name((name, property) => {
|
|
79
|
+
if (!property) {
|
|
80
|
+
throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
|
|
81
|
+
}
|
|
82
|
+
return property;
|
|
83
|
+
}, "throwSigningPropertyError");
|
|
84
|
+
var validateSigningProperties = /* @__PURE__ */ __name(async (signingProperties) => {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
const context = throwSigningPropertyError(
|
|
87
|
+
"context",
|
|
88
|
+
signingProperties.context
|
|
89
|
+
);
|
|
90
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
91
|
+
const authScheme = (_c = (_b = (_a = context.endpointV2) == null ? void 0 : _a.properties) == null ? void 0 : _b.authSchemes) == null ? void 0 : _c[0];
|
|
92
|
+
const signerFunction = throwSigningPropertyError(
|
|
93
|
+
"signer",
|
|
94
|
+
config.signer
|
|
95
|
+
);
|
|
96
|
+
const signer = await signerFunction(authScheme);
|
|
97
|
+
const signingRegion = signingProperties == null ? void 0 : signingProperties.signingRegion;
|
|
98
|
+
const signingName = signingProperties == null ? void 0 : signingProperties.signingName;
|
|
99
|
+
return {
|
|
100
|
+
config,
|
|
101
|
+
signer,
|
|
102
|
+
signingRegion,
|
|
103
|
+
signingName
|
|
104
|
+
};
|
|
105
|
+
}, "validateSigningProperties");
|
|
106
|
+
var _AwsSdkSigV4Signer = class _AwsSdkSigV4Signer {
|
|
107
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
108
|
+
if (!import_protocol_http.HttpRequest.isInstance(httpRequest)) {
|
|
109
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
110
|
+
}
|
|
111
|
+
const { config, signer, signingRegion, signingName } = await validateSigningProperties(signingProperties);
|
|
112
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
113
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
114
|
+
signingRegion,
|
|
115
|
+
signingService: signingName
|
|
116
|
+
});
|
|
117
|
+
return signedRequest;
|
|
118
|
+
}
|
|
119
|
+
errorHandler(signingProperties) {
|
|
120
|
+
return (error) => {
|
|
121
|
+
const serverTime = error.ServerTime ?? getDateHeader(error.$response);
|
|
122
|
+
if (serverTime) {
|
|
123
|
+
const config = throwSigningPropertyError(
|
|
124
|
+
"config",
|
|
125
|
+
signingProperties.config
|
|
126
|
+
);
|
|
127
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
successHandler(httpResponse, signingProperties) {
|
|
133
|
+
const dateHeader = getDateHeader(httpResponse);
|
|
134
|
+
if (dateHeader) {
|
|
135
|
+
const config = throwSigningPropertyError(
|
|
136
|
+
"config",
|
|
137
|
+
signingProperties.config
|
|
138
|
+
);
|
|
139
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
__name(_AwsSdkSigV4Signer, "AwsSdkSigV4Signer");
|
|
144
|
+
var AwsSdkSigV4Signer = _AwsSdkSigV4Signer;
|
|
145
|
+
var AWSSDKSigV4Signer = AwsSdkSigV4Signer;
|
|
146
|
+
|
|
147
|
+
// src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts
|
|
148
|
+
var import_core = require("@smithy/core");
|
|
149
|
+
var import_signature_v4 = require("@smithy/signature-v4");
|
|
150
|
+
var resolveAwsSdkSigV4Config = /* @__PURE__ */ __name((config) => {
|
|
151
|
+
let normalizedCreds;
|
|
152
|
+
if (config.credentials) {
|
|
153
|
+
normalizedCreds = (0, import_core.memoizeIdentityProvider)(config.credentials, import_core.isIdentityExpired, import_core.doesIdentityRequireRefresh);
|
|
154
|
+
}
|
|
155
|
+
if (!normalizedCreds) {
|
|
156
|
+
if (config.credentialDefaultProvider) {
|
|
157
|
+
normalizedCreds = (0, import_core.normalizeProvider)(config.credentialDefaultProvider(config));
|
|
158
|
+
} else {
|
|
159
|
+
normalizedCreds = /* @__PURE__ */ __name(async () => {
|
|
160
|
+
throw new Error("`credentials` is missing");
|
|
161
|
+
}, "normalizedCreds");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const {
|
|
165
|
+
// Default for signingEscapePath
|
|
166
|
+
signingEscapePath = true,
|
|
167
|
+
// Default for systemClockOffset
|
|
168
|
+
systemClockOffset = config.systemClockOffset || 0,
|
|
169
|
+
// No default for sha256 since it is platform dependent
|
|
170
|
+
sha256
|
|
171
|
+
} = config;
|
|
172
|
+
let signer;
|
|
173
|
+
if (config.signer) {
|
|
174
|
+
signer = (0, import_core.normalizeProvider)(config.signer);
|
|
175
|
+
} else if (config.regionInfoProvider) {
|
|
176
|
+
signer = /* @__PURE__ */ __name(() => (0, import_core.normalizeProvider)(config.region)().then(
|
|
177
|
+
async (region) => [
|
|
178
|
+
await config.regionInfoProvider(region, {
|
|
179
|
+
useFipsEndpoint: await config.useFipsEndpoint(),
|
|
180
|
+
useDualstackEndpoint: await config.useDualstackEndpoint()
|
|
181
|
+
}) || {},
|
|
182
|
+
region
|
|
183
|
+
]
|
|
184
|
+
).then(([regionInfo, region]) => {
|
|
185
|
+
const { signingRegion, signingService } = regionInfo;
|
|
186
|
+
config.signingRegion = config.signingRegion || signingRegion || region;
|
|
187
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
188
|
+
const params = {
|
|
189
|
+
...config,
|
|
190
|
+
credentials: normalizedCreds,
|
|
191
|
+
region: config.signingRegion,
|
|
192
|
+
service: config.signingName,
|
|
193
|
+
sha256,
|
|
194
|
+
uriEscapePath: signingEscapePath
|
|
195
|
+
};
|
|
196
|
+
const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4;
|
|
197
|
+
return new SignerCtor(params);
|
|
198
|
+
}), "signer");
|
|
199
|
+
} else {
|
|
200
|
+
signer = /* @__PURE__ */ __name(async (authScheme) => {
|
|
201
|
+
authScheme = Object.assign(
|
|
202
|
+
{},
|
|
203
|
+
{
|
|
204
|
+
name: "sigv4",
|
|
205
|
+
signingName: config.signingName || config.defaultSigningName,
|
|
206
|
+
signingRegion: await (0, import_core.normalizeProvider)(config.region)(),
|
|
207
|
+
properties: {}
|
|
208
|
+
},
|
|
209
|
+
authScheme
|
|
210
|
+
);
|
|
211
|
+
const signingRegion = authScheme.signingRegion;
|
|
212
|
+
const signingService = authScheme.signingName;
|
|
213
|
+
config.signingRegion = config.signingRegion || signingRegion;
|
|
214
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
215
|
+
const params = {
|
|
216
|
+
...config,
|
|
217
|
+
credentials: normalizedCreds,
|
|
218
|
+
region: config.signingRegion,
|
|
219
|
+
service: config.signingName,
|
|
220
|
+
sha256,
|
|
221
|
+
uriEscapePath: signingEscapePath
|
|
222
|
+
};
|
|
223
|
+
const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4;
|
|
224
|
+
return new SignerCtor(params);
|
|
225
|
+
}, "signer");
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
...config,
|
|
229
|
+
systemClockOffset,
|
|
230
|
+
signingEscapePath,
|
|
231
|
+
credentials: normalizedCreds,
|
|
232
|
+
signer
|
|
233
|
+
};
|
|
234
|
+
}, "resolveAwsSdkSigV4Config");
|
|
235
|
+
var resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
|
|
236
|
+
|
|
237
|
+
// src/protocols/coercing-serializers.ts
|
|
238
|
+
var _toStr = /* @__PURE__ */ __name((val) => {
|
|
239
|
+
if (val == null) {
|
|
240
|
+
return val;
|
|
241
|
+
}
|
|
242
|
+
if (typeof val === "number" || typeof val === "bigint") {
|
|
243
|
+
const warning = new Error(`Received number ${val} where a string was expected.`);
|
|
244
|
+
warning.name = "Warning";
|
|
245
|
+
console.warn(warning);
|
|
246
|
+
return String(val);
|
|
247
|
+
}
|
|
248
|
+
if (typeof val === "boolean") {
|
|
249
|
+
const warning = new Error(`Received boolean ${val} where a string was expected.`);
|
|
250
|
+
warning.name = "Warning";
|
|
251
|
+
console.warn(warning);
|
|
252
|
+
return String(val);
|
|
253
|
+
}
|
|
254
|
+
return val;
|
|
255
|
+
}, "_toStr");
|
|
256
|
+
var _toBool = /* @__PURE__ */ __name((val) => {
|
|
257
|
+
if (val == null) {
|
|
258
|
+
return val;
|
|
259
|
+
}
|
|
260
|
+
if (typeof val === "number") {
|
|
261
|
+
}
|
|
262
|
+
if (typeof val === "string") {
|
|
263
|
+
const lowercase = val.toLowerCase();
|
|
264
|
+
if (val !== "" && lowercase !== "false" && lowercase !== "true") {
|
|
265
|
+
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
|
|
266
|
+
warning.name = "Warning";
|
|
267
|
+
console.warn(warning);
|
|
268
|
+
}
|
|
269
|
+
return val !== "" && lowercase !== "false";
|
|
270
|
+
}
|
|
271
|
+
return val;
|
|
272
|
+
}, "_toBool");
|
|
273
|
+
var _toNum = /* @__PURE__ */ __name((val) => {
|
|
274
|
+
if (val == null) {
|
|
275
|
+
return val;
|
|
276
|
+
}
|
|
277
|
+
if (typeof val === "boolean") {
|
|
278
|
+
}
|
|
279
|
+
if (typeof val === "string") {
|
|
280
|
+
const num = Number(val);
|
|
281
|
+
if (num.toString() !== val) {
|
|
282
|
+
const warning = new Error(`Received string "${val}" where a number was expected.`);
|
|
283
|
+
warning.name = "Warning";
|
|
284
|
+
console.warn(warning);
|
|
285
|
+
return val;
|
|
286
|
+
}
|
|
287
|
+
return num;
|
|
288
|
+
}
|
|
289
|
+
return val;
|
|
290
|
+
}, "_toNum");
|
|
291
|
+
|
|
292
|
+
// src/protocols/json/awsExpectUnion.ts
|
|
293
|
+
var import_smithy_client = require("@smithy/smithy-client");
|
|
294
|
+
var awsExpectUnion = /* @__PURE__ */ __name((value) => {
|
|
295
|
+
if (value == null) {
|
|
296
|
+
return void 0;
|
|
297
|
+
}
|
|
298
|
+
if (typeof value === "object" && "__type" in value) {
|
|
299
|
+
delete value.__type;
|
|
300
|
+
}
|
|
301
|
+
return (0, import_smithy_client.expectUnion)(value);
|
|
302
|
+
}, "awsExpectUnion");
|
|
303
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
304
|
+
0 && (module.exports = {
|
|
305
|
+
AWSSDKSigV4Signer,
|
|
306
|
+
AwsSdkSigV4Signer,
|
|
307
|
+
_toBool,
|
|
308
|
+
_toNum,
|
|
309
|
+
_toStr,
|
|
310
|
+
awsExpectUnion,
|
|
311
|
+
emitWarningIfUnsupportedVersion,
|
|
312
|
+
resolveAWSSDKSigV4Config,
|
|
313
|
+
resolveAwsSdkSigV4Config
|
|
314
|
+
});
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._toNum = exports._toBool = exports._toStr = void 0;
|
|
4
|
-
const _toStr = (val) => {
|
|
5
|
-
if (val == null) {
|
|
6
|
-
return val;
|
|
7
|
-
}
|
|
8
|
-
if (typeof val === "number" || typeof val === "bigint") {
|
|
9
|
-
const warning = new Error(`Received number ${val} where a string was expected.`);
|
|
10
|
-
warning.name = "Warning";
|
|
11
|
-
console.warn(warning);
|
|
12
|
-
return String(val);
|
|
13
|
-
}
|
|
14
|
-
if (typeof val === "boolean") {
|
|
15
|
-
const warning = new Error(`Received boolean ${val} where a string was expected.`);
|
|
16
|
-
warning.name = "Warning";
|
|
17
|
-
console.warn(warning);
|
|
18
|
-
return String(val);
|
|
19
|
-
}
|
|
20
|
-
return val;
|
|
21
|
-
};
|
|
22
|
-
exports._toStr = _toStr;
|
|
23
|
-
const _toBool = (val) => {
|
|
24
|
-
if (val == null) {
|
|
25
|
-
return val;
|
|
26
|
-
}
|
|
27
|
-
if (typeof val === "number") {
|
|
28
|
-
}
|
|
29
|
-
if (typeof val === "string") {
|
|
30
|
-
const lowercase = val.toLowerCase();
|
|
31
|
-
if (val !== "" && lowercase !== "false" && lowercase !== "true") {
|
|
32
|
-
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
|
|
33
|
-
warning.name = "Warning";
|
|
34
|
-
console.warn(warning);
|
|
35
|
-
}
|
|
36
|
-
return val !== "" && lowercase !== "false";
|
|
37
|
-
}
|
|
38
|
-
return val;
|
|
39
|
-
};
|
|
40
|
-
exports._toBool = _toBool;
|
|
41
|
-
const _toNum = (val) => {
|
|
42
|
-
if (val == null) {
|
|
43
|
-
return val;
|
|
44
|
-
}
|
|
45
|
-
if (typeof val === "boolean") {
|
|
46
|
-
}
|
|
47
|
-
if (typeof val === "string") {
|
|
48
|
-
const num = Number(val);
|
|
49
|
-
if (num.toString() !== val) {
|
|
50
|
-
const warning = new Error(`Received string "${val}" where a number was expected.`);
|
|
51
|
-
warning.name = "Warning";
|
|
52
|
-
console.warn(warning);
|
|
53
|
-
return val;
|
|
54
|
-
}
|
|
55
|
-
return num;
|
|
56
|
-
}
|
|
57
|
-
return val;
|
|
58
|
-
};
|
|
59
|
-
exports._toNum = _toNum;
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./coercing-serializers"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./json/awsExpectUnion"), exports);
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.awsExpectUnion = void 0;
|
|
4
|
-
const smithy_client_1 = require("@smithy/smithy-client");
|
|
5
|
-
const awsExpectUnion = (value) => {
|
|
6
|
-
if (value == null) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === "object" && "__type" in value) {
|
|
10
|
-
delete value.__type;
|
|
11
|
-
}
|
|
12
|
-
return (0, smithy_client_1.expectUnion)(value);
|
|
13
|
-
};
|
|
14
|
-
exports.awsExpectUnion = awsExpectUnion;
|
|
1
|
+
module.exports = require("../../index.js");
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { HttpRequest } from "@smithy/protocol-http";
|
|
2
2
|
import { getDateHeader, getSkewCorrectedDate, getUpdatedSystemClockOffset } from "../utils";
|
|
3
|
-
|
|
3
|
+
const throwSigningPropertyError = (name, property) => {
|
|
4
|
+
if (!property) {
|
|
5
|
+
throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
|
|
6
|
+
}
|
|
7
|
+
return property;
|
|
8
|
+
};
|
|
4
9
|
const validateSigningProperties = async (signingProperties) => {
|
|
5
|
-
const context =
|
|
6
|
-
const config =
|
|
10
|
+
const context = throwSigningPropertyError("context", signingProperties.context);
|
|
11
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
7
12
|
const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
|
|
8
|
-
const signerFunction =
|
|
13
|
+
const signerFunction = throwSigningPropertyError("signer", config.signer);
|
|
9
14
|
const signer = await signerFunction(authScheme);
|
|
10
15
|
const signingRegion = signingProperties?.signingRegion;
|
|
11
16
|
const signingName = signingProperties?.signingName;
|
|
@@ -16,7 +21,7 @@ const validateSigningProperties = async (signingProperties) => {
|
|
|
16
21
|
signingName,
|
|
17
22
|
};
|
|
18
23
|
};
|
|
19
|
-
export class
|
|
24
|
+
export class AwsSdkSigV4Signer {
|
|
20
25
|
async sign(httpRequest, identity, signingProperties) {
|
|
21
26
|
if (!HttpRequest.isInstance(httpRequest)) {
|
|
22
27
|
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
@@ -33,7 +38,7 @@ export class AWSSDKSigV4Signer {
|
|
|
33
38
|
return (error) => {
|
|
34
39
|
const serverTime = error.ServerTime ?? getDateHeader(error.$response);
|
|
35
40
|
if (serverTime) {
|
|
36
|
-
const config =
|
|
41
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
37
42
|
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
38
43
|
}
|
|
39
44
|
throw error;
|
|
@@ -42,8 +47,9 @@ export class AWSSDKSigV4Signer {
|
|
|
42
47
|
successHandler(httpResponse, signingProperties) {
|
|
43
48
|
const dateHeader = getDateHeader(httpResponse);
|
|
44
49
|
if (dateHeader) {
|
|
45
|
-
const config =
|
|
50
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
46
51
|
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
55
|
+
export const AWSSDKSigV4Signer = AwsSdkSigV4Signer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./AwsSdkSigV4Signer";
|
|
2
|
+
export * from "./resolveAwsSdkSigV4Config";
|
package/dist-es/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.js → resolveAwsSdkSigV4Config.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { doesIdentityRequireRefresh, isIdentityExpired, memoizeIdentityProvider, normalizeProvider, } from "@smithy/core";
|
|
2
2
|
import { SignatureV4 } from "@smithy/signature-v4";
|
|
3
|
-
export const
|
|
3
|
+
export const resolveAwsSdkSigV4Config = (config) => {
|
|
4
4
|
let normalizedCreds;
|
|
5
5
|
if (config.credentials) {
|
|
6
6
|
normalizedCreds = memoizeIdentityProvider(config.credentials, isIdentityExpired, doesIdentityRequireRefresh);
|
|
@@ -75,3 +75,4 @@ export const resolveAWSSDKSigV4Config = (config) => {
|
|
|
75
75
|
signer,
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
+
export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
|
package/dist-types/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.d.ts → AwsSdkSigV4Signer.d.ts}
RENAMED
|
@@ -2,7 +2,7 @@ import { AwsCredentialIdentity, HttpRequest as IHttpRequest, HttpResponse, HttpS
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class AwsSdkSigV4Signer implements HttpSigner {
|
|
6
6
|
sign(httpRequest: IHttpRequest,
|
|
7
7
|
/**
|
|
8
8
|
* `identity` is bound in {@link resolveAWSSDKSigV4Config}
|
|
@@ -11,3 +11,7 @@ export declare class AWSSDKSigV4Signer implements HttpSigner {
|
|
|
11
11
|
errorHandler(signingProperties: Record<string, unknown>): (error: Error) => never;
|
|
12
12
|
successHandler(httpResponse: HttpResponse | unknown, signingProperties: Record<string, unknown>): void;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated renamed to {@link AwsSdkSigV4Signer}
|
|
16
|
+
*/
|
|
17
|
+
export declare const AWSSDKSigV4Signer: typeof AwsSdkSigV4Signer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./AwsSdkSigV4Signer";
|
|
2
|
+
export * from "./resolveAwsSdkSigV4Config";
|