@cdk8s/awscdk-resolver 0.0.101 → 0.0.102

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.
Files changed (137) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/package.json +5 -5
  4. package/node_modules/@aws-sdk/client-sso/package.json +2 -2
  5. package/node_modules/@aws-sdk/client-sso-oidc/package.json +4 -4
  6. package/node_modules/@aws-sdk/client-sts/package.json +4 -4
  7. package/node_modules/@aws-sdk/core/README.md +35 -1
  8. package/node_modules/@aws-sdk/core/client.js +5 -0
  9. package/node_modules/@aws-sdk/core/dist-cjs/index.js +5 -437
  10. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +38 -0
  11. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +226 -0
  12. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +228 -0
  13. package/node_modules/@aws-sdk/core/dist-es/index.js +3 -3
  14. package/node_modules/@aws-sdk/core/dist-types/index.d.ts +22 -3
  15. package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +3 -3
  16. package/node_modules/@aws-sdk/core/httpAuthSchemes.js +5 -0
  17. package/node_modules/@aws-sdk/core/package.json +39 -2
  18. package/node_modules/@aws-sdk/core/protocols.js +5 -0
  19. package/node_modules/@aws-sdk/credential-provider-ini/package.json +3 -3
  20. package/node_modules/@aws-sdk/credential-provider-node/package.json +3 -3
  21. package/node_modules/@aws-sdk/credential-provider-sso/package.json +2 -2
  22. package/node_modules/@smithy/core/package.json +3 -3
  23. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +10 -3
  24. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +10 -3
  25. package/node_modules/@smithy/fetch-http-handler/package.json +1 -1
  26. package/node_modules/@smithy/middleware-retry/package.json +2 -2
  27. package/node_modules/@smithy/smithy-client/package.json +2 -2
  28. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  29. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  30. package/node_modules/@smithy/util-stream/package.json +2 -2
  31. package/package.json +4 -4
  32. package/node_modules/@aws-sdk/core/CHANGELOG.md +0 -323
  33. package/node_modules/@aws-sdk/core/api-extractor.json +0 -4
  34. package/node_modules/@aws-sdk/core/dist-cjs/client/emitWarningIfUnsupportedVersion.js +0 -1
  35. package/node_modules/@aws-sdk/core/dist-cjs/client/index.js +0 -1
  36. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +0 -1
  37. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/aws_sdk/index.js +0 -1
  38. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +0 -1
  39. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/index.js +0 -1
  40. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/utils/getDateHeader.js +0 -1
  41. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/utils/getSkewCorrectedDate.js +0 -1
  42. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +0 -1
  43. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/utils/index.js +0 -1
  44. package/node_modules/@aws-sdk/core/dist-cjs/httpAuthSchemes/utils/isClockSkewed.js +0 -1
  45. package/node_modules/@aws-sdk/core/dist-cjs/protocols/coercing-serializers.js +0 -1
  46. package/node_modules/@aws-sdk/core/dist-cjs/protocols/common.js +0 -1
  47. package/node_modules/@aws-sdk/core/dist-cjs/protocols/index.js +0 -1
  48. package/node_modules/@aws-sdk/core/dist-cjs/protocols/json/awsExpectUnion.js +0 -1
  49. package/node_modules/@aws-sdk/core/dist-cjs/protocols/json/parseJsonBody.js +0 -1
  50. package/node_modules/@aws-sdk/core/dist-cjs/protocols/xml/parseXmlBody.js +0 -1
  51. package/node_modules/@aws-sdk/core/integ/request-handlers/request-handlers.integ.spec.ts +0 -158
  52. package/node_modules/@aws-sdk/core/jest.config.integ.js +0 -4
  53. package/node_modules/@aws-sdk/core/jest.config.js +0 -6
  54. package/node_modules/@aws-sdk/core/scripts/lint.js +0 -24
  55. package/node_modules/@aws-sdk/core/src/client/emitWarningIfUnsupportedVersion.spec.ts +0 -70
  56. package/node_modules/@aws-sdk/core/src/client/emitWarningIfUnsupportedVersion.ts +0 -26
  57. package/node_modules/@aws-sdk/core/src/client/index.ts +0 -1
  58. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.spec.ts +0 -30
  59. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts +0 -134
  60. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/aws_sdk/index.ts +0 -2
  61. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts +0 -244
  62. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/index.ts +0 -1
  63. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/getDateHeader.ts +0 -7
  64. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/getSkewCorrectedDate.spec.ts +0 -17
  65. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/getSkewCorrectedDate.ts +0 -8
  66. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/getUpdatedSystemClockOffset.spec.ts +0 -37
  67. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/getUpdatedSystemClockOffset.ts +0 -18
  68. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/index.ts +0 -3
  69. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/isClockSkewed.spec.ts +0 -32
  70. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/utils/isClockSkewed.ts +0 -12
  71. package/node_modules/@aws-sdk/core/src/index.ts +0 -3
  72. package/node_modules/@aws-sdk/core/src/protocols/coercing-serializers.spec.ts +0 -76
  73. package/node_modules/@aws-sdk/core/src/protocols/coercing-serializers.ts +0 -72
  74. package/node_modules/@aws-sdk/core/src/protocols/common.ts +0 -5
  75. package/node_modules/@aws-sdk/core/src/protocols/index.ts +0 -4
  76. package/node_modules/@aws-sdk/core/src/protocols/json/awsExpectUnion.spec.ts +0 -30
  77. package/node_modules/@aws-sdk/core/src/protocols/json/awsExpectUnion.ts +0 -17
  78. package/node_modules/@aws-sdk/core/src/protocols/json/parseJsonBody.ts +0 -60
  79. package/node_modules/@aws-sdk/core/src/protocols/xml/parseXmlBody.spec.ts +0 -60
  80. package/node_modules/@aws-sdk/core/src/protocols/xml/parseXmlBody.ts +0 -64
  81. package/node_modules/@aws-sdk/core/tsconfig.cjs.json +0 -9
  82. package/node_modules/@aws-sdk/core/tsconfig.cjs.tsbuildinfo +0 -1
  83. package/node_modules/@aws-sdk/core/tsconfig.es.json +0 -9
  84. package/node_modules/@aws-sdk/core/tsconfig.es.tsbuildinfo +0 -1
  85. package/node_modules/@aws-sdk/core/tsconfig.types.json +0 -9
  86. package/node_modules/@aws-sdk/core/tsconfig.types.tsbuildinfo +0 -1
  87. /package/node_modules/@aws-sdk/core/dist-es/{client → submodules/client}/emitWarningIfUnsupportedVersion.js +0 -0
  88. /package/node_modules/@aws-sdk/core/dist-es/{client → submodules/client}/index.js +0 -0
  89. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/AwsSdkSigV4Signer.js +0 -0
  90. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/index.js +0 -0
  91. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/resolveAwsSdkSigV4Config.js +0 -0
  92. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/index.js +0 -0
  93. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getDateHeader.js +0 -0
  94. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getSkewCorrectedDate.js +0 -0
  95. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getUpdatedSystemClockOffset.js +0 -0
  96. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/index.js +0 -0
  97. /package/node_modules/@aws-sdk/core/dist-es/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/isClockSkewed.js +0 -0
  98. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/coercing-serializers.js +0 -0
  99. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/common.js +0 -0
  100. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/index.js +0 -0
  101. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/json/awsExpectUnion.js +0 -0
  102. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/json/parseJsonBody.js +0 -0
  103. /package/node_modules/@aws-sdk/core/dist-es/{protocols → submodules/protocols}/xml/parseXmlBody.js +0 -0
  104. /package/node_modules/@aws-sdk/core/dist-types/{client → submodules/client}/emitWarningIfUnsupportedVersion.d.ts +0 -0
  105. /package/node_modules/@aws-sdk/core/dist-types/{client → submodules/client}/index.d.ts +0 -0
  106. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/AwsSdkSigV4Signer.d.ts +0 -0
  107. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/index.d.ts +0 -0
  108. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/resolveAwsSdkSigV4Config.d.ts +0 -0
  109. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/index.d.ts +0 -0
  110. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getDateHeader.d.ts +0 -0
  111. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getSkewCorrectedDate.d.ts +0 -0
  112. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getUpdatedSystemClockOffset.d.ts +0 -0
  113. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/index.d.ts +0 -0
  114. /package/node_modules/@aws-sdk/core/dist-types/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/isClockSkewed.d.ts +0 -0
  115. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/coercing-serializers.d.ts +0 -0
  116. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/common.d.ts +0 -0
  117. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/index.d.ts +0 -0
  118. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/json/awsExpectUnion.d.ts +0 -0
  119. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/json/parseJsonBody.d.ts +0 -0
  120. /package/node_modules/@aws-sdk/core/dist-types/{protocols → submodules/protocols}/xml/parseXmlBody.d.ts +0 -0
  121. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{client → submodules/client}/emitWarningIfUnsupportedVersion.d.ts +0 -0
  122. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{client → submodules/client}/index.d.ts +0 -0
  123. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/AwsSdkSigV4Signer.d.ts +0 -0
  124. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/index.d.ts +0 -0
  125. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/aws_sdk/resolveAwsSdkSigV4Config.d.ts +0 -0
  126. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/index.d.ts +0 -0
  127. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getDateHeader.d.ts +0 -0
  128. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getSkewCorrectedDate.d.ts +0 -0
  129. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/getUpdatedSystemClockOffset.d.ts +0 -0
  130. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/index.d.ts +0 -0
  131. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{httpAuthSchemes → submodules/httpAuthSchemes}/utils/isClockSkewed.d.ts +0 -0
  132. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/coercing-serializers.d.ts +0 -0
  133. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/common.d.ts +0 -0
  134. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/index.d.ts +0 -0
  135. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/json/awsExpectUnion.d.ts +0 -0
  136. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/json/parseJsonBody.d.ts +0 -0
  137. /package/node_modules/@aws-sdk/core/dist-types/ts3.4/{protocols → submodules/protocols}/xml/parseXmlBody.d.ts +0 -0
@@ -1,244 +0,0 @@
1
- import {
2
- doesIdentityRequireRefresh,
3
- isIdentityExpired,
4
- memoizeIdentityProvider,
5
- normalizeProvider,
6
- } from "@smithy/core";
7
- import { SignatureV4, SignatureV4CryptoInit, SignatureV4Init } from "@smithy/signature-v4";
8
- import {
9
- AuthScheme,
10
- AwsCredentialIdentity,
11
- AwsCredentialIdentityProvider,
12
- ChecksumConstructor,
13
- HashConstructor,
14
- MemoizedProvider,
15
- Provider,
16
- RegionInfo,
17
- RegionInfoProvider,
18
- RequestSigner,
19
- } from "@smithy/types";
20
-
21
- /**
22
- * @internal
23
- */
24
- export interface AwsSdkSigV4AuthInputConfig {
25
- /**
26
- * The credentials used to sign requests.
27
- */
28
- credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
29
-
30
- /**
31
- * The signer to use when signing requests.
32
- */
33
- signer?: RequestSigner | ((authScheme?: AuthScheme) => Promise<RequestSigner>);
34
-
35
- /**
36
- * Whether to escape request path when signing the request.
37
- */
38
- signingEscapePath?: boolean;
39
-
40
- /**
41
- * An offset value in milliseconds to apply to all signing times.
42
- */
43
- systemClockOffset?: number;
44
-
45
- /**
46
- * The region where you want to sign your request against. This
47
- * can be different to the region in the endpoint.
48
- */
49
- signingRegion?: string;
50
-
51
- /**
52
- * The injectable SigV4-compatible signer class constructor. If not supplied,
53
- * regular SignatureV4 constructor will be used.
54
- *
55
- * @internal
56
- */
57
- signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner;
58
- }
59
-
60
- /**
61
- * @internal
62
- */
63
- export interface AwsSdkSigV4PreviouslyResolved {
64
- credentialDefaultProvider?: (input: any) => MemoizedProvider<AwsCredentialIdentity>;
65
- region: string | Provider<string>;
66
- sha256: ChecksumConstructor | HashConstructor;
67
- signingName?: string;
68
- regionInfoProvider?: RegionInfoProvider;
69
- defaultSigningName?: string;
70
- serviceId: string;
71
- useFipsEndpoint: Provider<boolean>;
72
- useDualstackEndpoint: Provider<boolean>;
73
- }
74
-
75
- /**
76
- * @internal
77
- */
78
- export interface AwsSdkSigV4AuthResolvedConfig {
79
- /**
80
- * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.credentials}
81
- * This provider MAY memoize the loaded credentials for certain period.
82
- * See {@link MemoizedProvider} for more information.
83
- */
84
- credentials: AwsCredentialIdentityProvider;
85
- /**
86
- * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.signer}
87
- */
88
- signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
89
- /**
90
- * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.signingEscapePath}
91
- */
92
- signingEscapePath: boolean;
93
- /**
94
- * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.systemClockOffset}
95
- */
96
- systemClockOffset: number;
97
- }
98
-
99
- /**
100
- * @internal
101
- */
102
- export const resolveAwsSdkSigV4Config = <T>(
103
- config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved
104
- ): T & AwsSdkSigV4AuthResolvedConfig => {
105
- // Normalize credentials
106
- let normalizedCreds: AwsCredentialIdentityProvider | undefined;
107
- if (config.credentials) {
108
- normalizedCreds = memoizeIdentityProvider(config.credentials, isIdentityExpired, doesIdentityRequireRefresh);
109
- }
110
- if (!normalizedCreds) {
111
- // credentialDefaultProvider should always be populated, but in case
112
- // it isn't, set a default identity provider that throws an error
113
- if (config.credentialDefaultProvider) {
114
- normalizedCreds = normalizeProvider(
115
- config.credentialDefaultProvider(
116
- Object.assign({}, config as any, {
117
- parentClientConfig: config,
118
- })
119
- )
120
- );
121
- } else {
122
- normalizedCreds = async () => {
123
- throw new Error("`credentials` is missing");
124
- };
125
- }
126
- }
127
-
128
- // Populate sigv4 arguments
129
- const {
130
- // Default for signingEscapePath
131
- signingEscapePath = true,
132
- // Default for systemClockOffset
133
- systemClockOffset = config.systemClockOffset || 0,
134
- // No default for sha256 since it is platform dependent
135
- sha256,
136
- } = config;
137
-
138
- // Resolve signer
139
- let signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
140
- if (config.signer) {
141
- // if signer is supplied by user, normalize it to a function returning a promise for signer.
142
- signer = normalizeProvider(config.signer);
143
- } else if (config.regionInfoProvider) {
144
- // This branch is for endpoints V1.
145
- // construct a provider inferring signing from region.
146
- signer = () =>
147
- normalizeProvider(config.region)()
148
- .then(
149
- async (region) =>
150
- [
151
- (await config.regionInfoProvider!(region, {
152
- useFipsEndpoint: await config.useFipsEndpoint(),
153
- useDualstackEndpoint: await config.useDualstackEndpoint(),
154
- })) || {},
155
- region,
156
- ] as [RegionInfo, string]
157
- )
158
- .then(([regionInfo, region]) => {
159
- const { signingRegion, signingService } = regionInfo;
160
- // update client's singing region and signing service config if they are resolved.
161
- // signing region resolving order: user supplied signingRegion -> endpoints.json inferred region -> client region
162
- config.signingRegion = config.signingRegion || signingRegion || region;
163
- // signing name resolving order:
164
- // user supplied signingName -> endpoints.json inferred (credential scope -> model arnNamespace) -> model service id
165
- config.signingName = config.signingName || signingService || config.serviceId;
166
-
167
- const params: SignatureV4Init & SignatureV4CryptoInit = {
168
- ...config,
169
- credentials: normalizedCreds!,
170
- region: config.signingRegion,
171
- service: config.signingName,
172
- sha256,
173
- uriEscapePath: signingEscapePath,
174
- };
175
- const SignerCtor = config.signerConstructor || SignatureV4;
176
- return new SignerCtor(params);
177
- });
178
- } else {
179
- // This branch is for endpoints V2.
180
- // Handle endpoints v2 that resolved per-command
181
- // TODO: need total refactor for reference auth architecture.
182
- signer = async (authScheme?: AuthScheme) => {
183
- authScheme = Object.assign(
184
- {},
185
- {
186
- name: "sigv4",
187
- signingName: config.signingName || config.defaultSigningName!,
188
- signingRegion: await normalizeProvider(config.region)(),
189
- properties: {},
190
- },
191
- authScheme
192
- );
193
-
194
- const signingRegion = authScheme.signingRegion;
195
- const signingService = authScheme.signingName;
196
- // update client's singing region and signing service config if they are resolved.
197
- // signing region resolving order: user supplied signingRegion -> endpoints.json inferred region -> client region
198
- config.signingRegion = config.signingRegion || signingRegion;
199
- // signing name resolving order:
200
- // user supplied signingName -> endpoints.json inferred (credential scope -> model arnNamespace) -> model service id
201
- config.signingName = config.signingName || signingService || config.serviceId;
202
-
203
- const params: SignatureV4Init & SignatureV4CryptoInit = {
204
- ...config,
205
- credentials: normalizedCreds!,
206
- region: config.signingRegion,
207
- service: config.signingName,
208
- sha256,
209
- uriEscapePath: signingEscapePath,
210
- };
211
-
212
- const SignerCtor = config.signerConstructor || SignatureV4;
213
- return new SignerCtor(params);
214
- };
215
- }
216
-
217
- return {
218
- ...config,
219
- systemClockOffset,
220
- signingEscapePath,
221
- credentials: normalizedCreds!,
222
- signer,
223
- };
224
- };
225
-
226
- /**
227
- * @deprecated renamed to {@link AwsSdkSigV4AuthInputConfig}
228
- */
229
- export interface AWSSDKSigV4AuthInputConfig extends AwsSdkSigV4AuthInputConfig {}
230
-
231
- /**
232
- * @deprecated renamed to {@link AwsSdkSigV4PreviouslyResolved}
233
- */
234
- export interface AWSSDKSigV4PreviouslyResolved extends AwsSdkSigV4PreviouslyResolved {}
235
-
236
- /**
237
- * @deprecated renamed to {@link AwsSdkSigV4AuthResolvedConfig}
238
- */
239
- export interface AWSSDKSigV4AuthResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {}
240
-
241
- /**
242
- * @deprecated renamed to {@link resolveAwsSdkSigV4Config}
243
- */
244
- export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config;
@@ -1 +0,0 @@
1
- export * from "./aws_sdk";
@@ -1,7 +0,0 @@
1
- import { HttpResponse } from "@smithy/protocol-http";
2
-
3
- /**
4
- * @internal
5
- */
6
- export const getDateHeader = (response: unknown): string | undefined =>
7
- HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
@@ -1,17 +0,0 @@
1
- import { getSkewCorrectedDate } from "./getSkewCorrectedDate";
2
-
3
- describe(getSkewCorrectedDate.name, () => {
4
- const mockDateNow = Date.now();
5
-
6
- beforeEach(() => {
7
- jest.spyOn(Date, "now").mockReturnValue(mockDateNow);
8
- });
9
-
10
- afterEach(() => {
11
- jest.clearAllMocks();
12
- });
13
-
14
- it.each([-100000, -100, 0, 100, 100000])("systemClockOffset: %d", (systemClockOffset) => {
15
- expect(getSkewCorrectedDate(systemClockOffset)).toStrictEqual(new Date(mockDateNow + systemClockOffset));
16
- });
17
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * @internal
3
- *
4
- * Returns a date that is corrected for clock skew.
5
- *
6
- * @param systemClockOffset The offset of the system clock in milliseconds.
7
- */
8
- export const getSkewCorrectedDate = (systemClockOffset: number) => new Date(Date.now() + systemClockOffset);
@@ -1,37 +0,0 @@
1
- import { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset";
2
- import { isClockSkewed } from "./isClockSkewed";
3
-
4
- jest.mock("./isClockSkewed");
5
-
6
- describe(getUpdatedSystemClockOffset.name, () => {
7
- // Mock ServerTime is accurate to last second, to remove milliseconds information.
8
- const mockClockTime = new Date(Math.floor(Date.now() / 1000) * 1000);
9
- const mockSystemClockOffset = 100;
10
-
11
- afterEach(() => {
12
- jest.clearAllMocks();
13
- });
14
-
15
- it("returns passed systemClockOffset when clock is not skewed", () => {
16
- (isClockSkewed as jest.Mock).mockReturnValue(false);
17
- expect(getUpdatedSystemClockOffset(mockClockTime.toString(), mockSystemClockOffset)).toEqual(mockSystemClockOffset);
18
- });
19
-
20
- describe("returns difference between serverTime and current time when clock is skewed", () => {
21
- const dateDotNowFn = Date.now;
22
-
23
- beforeEach(() => {
24
- (isClockSkewed as jest.Mock).mockReturnValue(true);
25
- jest.spyOn(Date, "now").mockReturnValueOnce(mockClockTime.getTime());
26
- });
27
-
28
- afterEach(() => {
29
- Date.now = dateDotNowFn;
30
- });
31
-
32
- it.each([1000, 100000])("difference: %d", (difference) => {
33
- const updatedClockTime = new Date(mockClockTime.getTime() + difference);
34
- expect(getUpdatedSystemClockOffset(updatedClockTime.toString(), mockSystemClockOffset)).toEqual(difference);
35
- });
36
- });
37
- });
@@ -1,18 +0,0 @@
1
- import { isClockSkewed } from "./isClockSkewed";
2
-
3
- /**
4
- * @internal
5
- *
6
- * If clock is skewed, it returns the difference between serverTime and current time.
7
- * If clock is not skewed, it returns currentSystemClockOffset.
8
- *
9
- * @param clockTime The string value of the server time.
10
- * @param currentSystemClockOffset The current system clock offset.
11
- */
12
- export const getUpdatedSystemClockOffset = (clockTime: string, currentSystemClockOffset: number): number => {
13
- const clockTimeInMs = Date.parse(clockTime);
14
- if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
15
- return clockTimeInMs - Date.now();
16
- }
17
- return currentSystemClockOffset;
18
- };
@@ -1,3 +0,0 @@
1
- export * from "./getDateHeader";
2
- export * from "./getSkewCorrectedDate";
3
- export * from "./getUpdatedSystemClockOffset";
@@ -1,32 +0,0 @@
1
- import { getSkewCorrectedDate } from "./getSkewCorrectedDate";
2
- import { isClockSkewed } from "./isClockSkewed";
3
-
4
- jest.mock("./getSkewCorrectedDate");
5
-
6
- describe(isClockSkewed.name, () => {
7
- const mockSystemClockOffset = 100;
8
- const mockSkewCorrectedDate = new Date();
9
-
10
- beforeEach(() => {
11
- (getSkewCorrectedDate as jest.Mock).mockReturnValue(mockSkewCorrectedDate);
12
- });
13
-
14
- afterEach(() => {
15
- expect(getSkewCorrectedDate).toHaveBeenCalledWith(mockSystemClockOffset);
16
- jest.clearAllMocks();
17
- });
18
-
19
- describe("returns true for time difference >=300000", () => {
20
- it.each([300000, 500000])("difference: %d", (difference) => {
21
- expect(isClockSkewed(mockSkewCorrectedDate.getTime() + difference, mockSystemClockOffset)).toBe(true);
22
- expect(isClockSkewed(mockSkewCorrectedDate.getTime() - difference, mockSystemClockOffset)).toBe(true);
23
- });
24
- });
25
-
26
- describe("returns false for time difference <300000", () => {
27
- it.each([299999, 100000, 0])("difference: %d", (difference) => {
28
- expect(isClockSkewed(mockSkewCorrectedDate.getTime() + difference, mockSystemClockOffset)).toBe(false);
29
- expect(isClockSkewed(mockSkewCorrectedDate.getTime() - difference, mockSystemClockOffset)).toBe(false);
30
- });
31
- });
32
- });
@@ -1,12 +0,0 @@
1
- import { getSkewCorrectedDate } from "./getSkewCorrectedDate";
2
-
3
- /**
4
- * @internal
5
- *
6
- * Checks if the provided date is within the skew window of 300000ms.
7
- *
8
- * @param clockTime - The time to check for skew in milliseconds.
9
- * @param systemClockOffset - The offset of the system clock in milliseconds.
10
- */
11
- export const isClockSkewed = (clockTime: number, systemClockOffset: number) =>
12
- Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000;
@@ -1,3 +0,0 @@
1
- export * from "./client/index";
2
- export * from "./httpAuthSchemes/index";
3
- export * from "./protocols/index";
@@ -1,76 +0,0 @@
1
- import { _toBool, _toNum, _toStr } from "./coercing-serializers";
2
-
3
- const consoleWarn = console.warn;
4
-
5
- beforeAll(() => {
6
- console.warn = () => {};
7
- });
8
-
9
- afterAll(() => {
10
- console.warn = consoleWarn;
11
- });
12
-
13
- describe(_toBool.name, () => {
14
- it("ignores nullish", () => {
15
- expect(_toBool(null)).toBe(null);
16
- expect(_toBool(undefined)).toBe(undefined);
17
- });
18
-
19
- it("converts strings", () => {
20
- expect(_toBool("false")).toEqual(false);
21
- expect(_toBool("true")).toEqual(true);
22
-
23
- expect(_toBool("False")).toEqual(false);
24
- expect(_toBool("True")).toEqual(true);
25
-
26
- expect(_toBool("")).toEqual(false);
27
- expect(_toBool("a")).toEqual(true); // warns
28
- });
29
-
30
- it("does not convert numbers", () => {
31
- expect(_toBool(0)).toEqual(0);
32
- expect(_toBool(1)).toEqual(1);
33
- });
34
- });
35
-
36
- describe(_toStr.name, () => {
37
- it("ignores nullish", () => {
38
- expect(_toStr(null)).toBe(null);
39
- expect(_toStr(undefined)).toBe(undefined);
40
- });
41
-
42
- it("converts numbers", () => {
43
- expect(_toStr(0)).toEqual("0");
44
- expect(_toStr(1)).toEqual("1");
45
- });
46
-
47
- it("converts booleans", () => {
48
- expect(_toStr(false)).toEqual("false");
49
- expect(_toStr(true)).toEqual("true");
50
- });
51
- });
52
-
53
- describe(_toNum.name, () => {
54
- it("ignores nullish", () => {
55
- expect(_toNum(null)).toBe(null);
56
- expect(_toNum(undefined)).toBe(undefined);
57
- });
58
-
59
- it("converts numeric strings", () => {
60
- expect(_toNum("1234")).toEqual(1234);
61
- expect(_toNum("1234.56")).toEqual(1234.56);
62
- });
63
-
64
- it("does not convert prefix-numeric strings", () => {
65
- expect(_toNum("1234abc")).toEqual("1234abc");
66
- expect(_toNum("1234.56abc")).toEqual("1234.56abc");
67
- });
68
-
69
- it("does not convert non-numeric strings", () => {
70
- expect(_toNum("abcdef")).toEqual("abcdef");
71
- });
72
- it("does not convert bools", () => {
73
- expect(_toNum(false)).toEqual(false);
74
- expect(_toNum(true)).toEqual(true);
75
- });
76
- });
@@ -1,72 +0,0 @@
1
- /**
2
- * @internal
3
- *
4
- * Used for awsQueryCompatibility trait.
5
- */
6
- export const _toStr = (val: unknown): string | undefined => {
7
- if (val == null) {
8
- return val as undefined;
9
- }
10
- if (typeof val === "number" || typeof val === "bigint") {
11
- const warning = new Error(`Received number ${val} where a string was expected.`);
12
- warning.name = "Warning";
13
- console.warn(warning);
14
- return String(val);
15
- }
16
- if (typeof val === "boolean") {
17
- const warning = new Error(`Received boolean ${val} where a string was expected.`);
18
- warning.name = "Warning";
19
- console.warn(warning);
20
- return String(val);
21
- }
22
- return val as string;
23
- };
24
-
25
- /**
26
- * @internal
27
- *
28
- * Used for awsQueryCompatibility trait.
29
- */
30
- export const _toBool = (val: unknown): boolean | undefined => {
31
- if (val == null) {
32
- return val as undefined;
33
- }
34
- if (typeof val === "number") {
35
- // transmit to service to be rejected.
36
- }
37
- if (typeof val === "string") {
38
- const lowercase = val.toLowerCase();
39
- if (val !== "" && lowercase !== "false" && lowercase !== "true") {
40
- const warning = new Error(`Received string "${val}" where a boolean was expected.`);
41
- warning.name = "Warning";
42
- console.warn(warning);
43
- }
44
- return val !== "" && lowercase !== "false";
45
- }
46
- return val as boolean;
47
- };
48
-
49
- /**
50
- * @internal
51
- *
52
- * Used for awsQueryCompatibility trait.
53
- */
54
- export const _toNum = (val: unknown): number | undefined => {
55
- if (val == null) {
56
- return val as undefined;
57
- }
58
- if (typeof val === "boolean") {
59
- // transmit to service to be rejected.
60
- }
61
- if (typeof val === "string") {
62
- const num = Number(val);
63
- if (num.toString() !== val) {
64
- const warning = new Error(`Received string "${val}" where a number was expected.`);
65
- warning.name = "Warning";
66
- console.warn(warning);
67
- return val as unknown as undefined;
68
- }
69
- return num;
70
- }
71
- return val as number;
72
- };
@@ -1,5 +0,0 @@
1
- import { collectBody } from "@smithy/smithy-client";
2
- import type { HttpResponse, SerdeContext } from "@smithy/types";
3
-
4
- export const collectBodyString = (streamBody: any, context: SerdeContext): Promise<string> =>
5
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
@@ -1,4 +0,0 @@
1
- export * from "./coercing-serializers";
2
- export * from "./json/awsExpectUnion";
3
- export * from "./json/parseJsonBody";
4
- export * from "./xml/parseXmlBody";
@@ -1,30 +0,0 @@
1
- import { awsExpectUnion } from "./awsExpectUnion";
2
-
3
- describe(awsExpectUnion.name, () => {
4
- it("ignores the __type field", () => {
5
- expect(
6
- awsExpectUnion({
7
- K: "V",
8
- __type: "X",
9
- })
10
- ).toEqual({
11
- K: "V",
12
- });
13
- });
14
-
15
- it("throws when there are extra keys or no keys", () => {
16
- expect(() =>
17
- awsExpectUnion({
18
- __type: "X",
19
- })
20
- ).toThrowError();
21
-
22
- expect(() =>
23
- awsExpectUnion({
24
- K: "V",
25
- I: "S",
26
- __type: "X",
27
- })
28
- ).toThrowError();
29
- });
30
- });
@@ -1,17 +0,0 @@
1
- import { expectUnion } from "@smithy/smithy-client";
2
-
3
- /**
4
- * @internal
5
- *
6
- * Forwards to Smithy's expectUnion function, but also ignores
7
- * the `__type` field if it is present.
8
- */
9
- export const awsExpectUnion = (value: unknown): Record<string, any> | undefined => {
10
- if (value == null) {
11
- return undefined;
12
- }
13
- if (typeof value === "object" && "__type" in value) {
14
- delete value.__type;
15
- }
16
- return expectUnion(value);
17
- };
@@ -1,60 +0,0 @@
1
- import type { HttpResponse, SerdeContext } from "@smithy/types";
2
-
3
- import { collectBodyString } from "../common";
4
-
5
- export const parseJsonBody = (streamBody: any, context: SerdeContext): any =>
6
- collectBodyString(streamBody, context).then((encoded) => {
7
- if (encoded.length) {
8
- try {
9
- return JSON.parse(encoded);
10
- } catch (e: any) {
11
- if (e?.name === "SyntaxError") {
12
- Object.defineProperty(e, "$responseBodyText", {
13
- value: encoded,
14
- });
15
- }
16
- throw e;
17
- }
18
- }
19
- return {};
20
- });
21
-
22
- export const parseJsonErrorBody = async (errorBody: any, context: SerdeContext) => {
23
- const value = await parseJsonBody(errorBody, context);
24
- value.message = value.message ?? value.Message;
25
- return value;
26
- };
27
-
28
- export const loadRestJsonErrorCode = (output: HttpResponse, data: any): string | undefined => {
29
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
30
-
31
- const sanitizeErrorCode = (rawValue: string | number): string => {
32
- let cleanValue = rawValue;
33
- if (typeof cleanValue === "number") {
34
- cleanValue = cleanValue.toString();
35
- }
36
- if (cleanValue.indexOf(",") >= 0) {
37
- cleanValue = cleanValue.split(",")[0];
38
- }
39
- if (cleanValue.indexOf(":") >= 0) {
40
- cleanValue = cleanValue.split(":")[0];
41
- }
42
- if (cleanValue.indexOf("#") >= 0) {
43
- cleanValue = cleanValue.split("#")[1];
44
- }
45
- return cleanValue;
46
- };
47
-
48
- const headerKey = findKey(output.headers, "x-amzn-errortype");
49
- if (headerKey !== undefined) {
50
- return sanitizeErrorCode(output.headers[headerKey]);
51
- }
52
-
53
- if (data.code !== undefined) {
54
- return sanitizeErrorCode(data.code);
55
- }
56
-
57
- if (data["__type"] !== undefined) {
58
- return sanitizeErrorCode(data["__type"]);
59
- }
60
- };