@aws-sdk/client-dynamodb 3.476.0 → 3.478.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.
Files changed (51) hide show
  1. package/dist-cjs/DynamoDBClient.js +17 -4
  2. package/dist-cjs/auth/httpAuthExtensionConfiguration.js +43 -0
  3. package/dist-cjs/auth/httpAuthSchemeProvider.js +47 -0
  4. package/dist-cjs/pagination/ListContributorInsightsPaginator.js +2 -24
  5. package/dist-cjs/pagination/ListExportsPaginator.js +2 -24
  6. package/dist-cjs/pagination/ListImportsPaginator.js +2 -24
  7. package/dist-cjs/pagination/ListTablesPaginator.js +2 -24
  8. package/dist-cjs/pagination/QueryPaginator.js +2 -24
  9. package/dist-cjs/pagination/ScanPaginator.js +2 -24
  10. package/dist-cjs/runtimeConfig.shared.js +10 -0
  11. package/dist-cjs/runtimeExtensions.js +3 -0
  12. package/dist-es/DynamoDBClient.js +17 -4
  13. package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  14. package/dist-es/auth/httpAuthSchemeProvider.js +41 -0
  15. package/dist-es/pagination/ListContributorInsightsPaginator.js +2 -23
  16. package/dist-es/pagination/ListExportsPaginator.js +2 -23
  17. package/dist-es/pagination/ListImportsPaginator.js +2 -23
  18. package/dist-es/pagination/ListTablesPaginator.js +2 -23
  19. package/dist-es/pagination/QueryPaginator.js +2 -23
  20. package/dist-es/pagination/ScanPaginator.js +2 -23
  21. package/dist-es/runtimeConfig.shared.js +10 -0
  22. package/dist-es/runtimeExtensions.js +3 -0
  23. package/dist-types/DynamoDBClient.d.ts +19 -17
  24. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  25. package/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  26. package/dist-types/extensionConfiguration.d.ts +2 -1
  27. package/dist-types/pagination/ListContributorInsightsPaginator.d.ts +1 -1
  28. package/dist-types/pagination/ListExportsPaginator.d.ts +1 -1
  29. package/dist-types/pagination/ListImportsPaginator.d.ts +1 -1
  30. package/dist-types/pagination/ListTablesPaginator.d.ts +1 -1
  31. package/dist-types/pagination/QueryPaginator.d.ts +1 -1
  32. package/dist-types/pagination/ScanPaginator.d.ts +1 -1
  33. package/dist-types/runtimeConfig.browser.d.ts +5 -3
  34. package/dist-types/runtimeConfig.d.ts +5 -3
  35. package/dist-types/runtimeConfig.native.d.ts +7 -5
  36. package/dist-types/runtimeConfig.shared.d.ts +2 -0
  37. package/dist-types/ts3.4/DynamoDBClient.d.ts +12 -10
  38. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  39. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
  40. package/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  41. package/dist-types/ts3.4/pagination/ListContributorInsightsPaginator.d.ts +3 -3
  42. package/dist-types/ts3.4/pagination/ListExportsPaginator.d.ts +3 -3
  43. package/dist-types/ts3.4/pagination/ListImportsPaginator.d.ts +3 -3
  44. package/dist-types/ts3.4/pagination/ListTablesPaginator.d.ts +3 -3
  45. package/dist-types/ts3.4/pagination/QueryPaginator.d.ts +3 -3
  46. package/dist-types/ts3.4/pagination/ScanPaginator.d.ts +3 -3
  47. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +5 -5
  48. package/dist-types/ts3.4/runtimeConfig.d.ts +5 -5
  49. package/dist-types/ts3.4/runtimeConfig.native.d.ts +11 -11
  50. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +2 -0
  51. package/package.json +8 -7
@@ -5,19 +5,28 @@ const middleware_endpoint_discovery_1 = require("@aws-sdk/middleware-endpoint-di
5
5
  const middleware_host_header_1 = require("@aws-sdk/middleware-host-header");
6
6
  const middleware_logger_1 = require("@aws-sdk/middleware-logger");
7
7
  const middleware_recursion_detection_1 = require("@aws-sdk/middleware-recursion-detection");
8
- const middleware_signing_1 = require("@aws-sdk/middleware-signing");
9
8
  const middleware_user_agent_1 = require("@aws-sdk/middleware-user-agent");
10
9
  const config_resolver_1 = require("@smithy/config-resolver");
10
+ const core_1 = require("@smithy/core");
11
11
  const middleware_content_length_1 = require("@smithy/middleware-content-length");
12
12
  const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
13
13
  const middleware_retry_1 = require("@smithy/middleware-retry");
14
14
  const smithy_client_1 = require("@smithy/smithy-client");
15
15
  Object.defineProperty(exports, "__Client", { enumerable: true, get: function () { return smithy_client_1.Client; } });
16
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
16
17
  const DescribeEndpointsCommand_1 = require("./commands/DescribeEndpointsCommand");
17
18
  const EndpointParameters_1 = require("./endpoint/EndpointParameters");
18
19
  const runtimeConfig_1 = require("./runtimeConfig");
19
20
  const runtimeExtensions_1 = require("./runtimeExtensions");
20
21
  class DynamoDBClient extends smithy_client_1.Client {
22
+ getDefaultHttpAuthSchemeParametersProvider() {
23
+ return httpAuthSchemeProvider_1.defaultDynamoDBHttpAuthSchemeParametersProvider;
24
+ }
25
+ getIdentityProviderConfigProvider() {
26
+ return async (config) => new core_1.DefaultIdentityProviderConfig({
27
+ "aws.auth#sigv4": config.credentials,
28
+ });
29
+ }
21
30
  constructor(...[configuration]) {
22
31
  const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
23
32
  const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0);
@@ -25,8 +34,8 @@ class DynamoDBClient extends smithy_client_1.Client {
25
34
  const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2);
26
35
  const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3);
27
36
  const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4);
28
- const _config_6 = (0, middleware_signing_1.resolveAwsAuthConfig)(_config_5);
29
- const _config_7 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_6);
37
+ const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5);
38
+ const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6);
30
39
  const _config_8 = (0, middleware_endpoint_discovery_1.resolveEndpointDiscoveryConfig)(_config_7, {
31
40
  endpointDiscoveryCommandCtor: DescribeEndpointsCommand_1.DescribeEndpointsCommand,
32
41
  });
@@ -38,8 +47,12 @@ class DynamoDBClient extends smithy_client_1.Client {
38
47
  this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config));
39
48
  this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config));
40
49
  this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config));
41
- this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(this.config));
42
50
  this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
51
+ this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
52
+ httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
53
+ identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
54
+ }));
55
+ this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config));
43
56
  }
44
57
  destroy() {
45
58
  super.destroy();
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHttpAuthRuntimeConfig = exports.getHttpAuthExtensionConfiguration = void 0;
4
+ const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
5
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
6
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
7
+ let _credentials = runtimeConfig.credentials;
8
+ return {
9
+ setHttpAuthScheme(httpAuthScheme) {
10
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
11
+ if (index === -1) {
12
+ _httpAuthSchemes.push(httpAuthScheme);
13
+ }
14
+ else {
15
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
16
+ }
17
+ },
18
+ httpAuthSchemes() {
19
+ return _httpAuthSchemes;
20
+ },
21
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
22
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
23
+ },
24
+ httpAuthSchemeProvider() {
25
+ return _httpAuthSchemeProvider;
26
+ },
27
+ setCredentials(credentials) {
28
+ _credentials = credentials;
29
+ },
30
+ credentials() {
31
+ return _credentials;
32
+ },
33
+ };
34
+ };
35
+ exports.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration;
36
+ const resolveHttpAuthRuntimeConfig = (config) => {
37
+ return {
38
+ httpAuthSchemes: config.httpAuthSchemes(),
39
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
40
+ credentials: config.credentials(),
41
+ };
42
+ };
43
+ exports.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHttpAuthSchemeConfig = exports.defaultDynamoDBHttpAuthSchemeProvider = exports.defaultDynamoDBHttpAuthSchemeParametersProvider = void 0;
4
+ const core_1 = require("@aws-sdk/core");
5
+ const util_middleware_1 = require("@smithy/util-middleware");
6
+ const defaultDynamoDBHttpAuthSchemeParametersProvider = async (config, context, input) => {
7
+ return {
8
+ operation: (0, util_middleware_1.getSmithyContext)(context).operation,
9
+ region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
10
+ (() => {
11
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
12
+ })(),
13
+ };
14
+ };
15
+ exports.defaultDynamoDBHttpAuthSchemeParametersProvider = defaultDynamoDBHttpAuthSchemeParametersProvider;
16
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
17
+ return {
18
+ schemeId: "aws.auth#sigv4",
19
+ signingProperties: {
20
+ name: "dynamodb",
21
+ region: authParameters.region,
22
+ },
23
+ propertiesExtractor: (config, context) => ({
24
+ signingProperties: {
25
+ config,
26
+ context,
27
+ },
28
+ }),
29
+ };
30
+ }
31
+ const defaultDynamoDBHttpAuthSchemeProvider = (authParameters) => {
32
+ const options = [];
33
+ switch (authParameters.operation) {
34
+ default: {
35
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
36
+ }
37
+ }
38
+ return options;
39
+ };
40
+ exports.defaultDynamoDBHttpAuthSchemeProvider = defaultDynamoDBHttpAuthSchemeProvider;
41
+ const resolveHttpAuthSchemeConfig = (config) => {
42
+ const config_0 = (0, core_1.resolveAWSSDKSigV4Config)(config);
43
+ return {
44
+ ...config_0,
45
+ };
46
+ };
47
+ exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateListContributorInsights = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const ListContributorInsightsCommand_1 = require("../commands/ListContributorInsightsCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new ListContributorInsightsCommand_1.ListContributorInsightsCommand(input), ...args);
8
- };
9
- async function* paginateListContributorInsights(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.NextToken = token;
15
- input["MaxResults"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.NextToken;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateListContributorInsights = paginateListContributorInsights;
7
+ exports.paginateListContributorInsights = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, ListContributorInsightsCommand_1.ListContributorInsightsCommand, "NextToken", "NextToken", "MaxResults");
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateListExports = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const ListExportsCommand_1 = require("../commands/ListExportsCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new ListExportsCommand_1.ListExportsCommand(input), ...args);
8
- };
9
- async function* paginateListExports(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.NextToken = token;
15
- input["MaxResults"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.NextToken;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateListExports = paginateListExports;
7
+ exports.paginateListExports = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, ListExportsCommand_1.ListExportsCommand, "NextToken", "NextToken", "MaxResults");
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateListImports = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const ListImportsCommand_1 = require("../commands/ListImportsCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new ListImportsCommand_1.ListImportsCommand(input), ...args);
8
- };
9
- async function* paginateListImports(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.NextToken = token;
15
- input["PageSize"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.NextToken;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateListImports = paginateListImports;
7
+ exports.paginateListImports = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, ListImportsCommand_1.ListImportsCommand, "NextToken", "NextToken", "PageSize");
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateListTables = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const ListTablesCommand_1 = require("../commands/ListTablesCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new ListTablesCommand_1.ListTablesCommand(input), ...args);
8
- };
9
- async function* paginateListTables(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.ExclusiveStartTableName = token;
15
- input["Limit"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.LastEvaluatedTableName;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateListTables = paginateListTables;
7
+ exports.paginateListTables = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, ListTablesCommand_1.ListTablesCommand, "ExclusiveStartTableName", "LastEvaluatedTableName", "Limit");
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateQuery = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const QueryCommand_1 = require("../commands/QueryCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new QueryCommand_1.QueryCommand(input), ...args);
8
- };
9
- async function* paginateQuery(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.ExclusiveStartKey = token;
15
- input["Limit"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.LastEvaluatedKey;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateQuery = paginateQuery;
7
+ exports.paginateQuery = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, QueryCommand_1.QueryCommand, "ExclusiveStartKey", "LastEvaluatedKey", "Limit");
@@ -1,29 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paginateScan = void 0;
4
+ const core_1 = require("@smithy/core");
4
5
  const ScanCommand_1 = require("../commands/ScanCommand");
5
6
  const DynamoDBClient_1 = require("../DynamoDBClient");
6
- const makePagedClientRequest = async (client, input, ...args) => {
7
- return await client.send(new ScanCommand_1.ScanCommand(input), ...args);
8
- };
9
- async function* paginateScan(config, input, ...additionalArguments) {
10
- let token = config.startingToken || undefined;
11
- let hasNext = true;
12
- let page;
13
- while (hasNext) {
14
- input.ExclusiveStartKey = token;
15
- input["Limit"] = config.pageSize;
16
- if (config.client instanceof DynamoDBClient_1.DynamoDBClient) {
17
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
18
- }
19
- else {
20
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
21
- }
22
- yield page;
23
- const prevToken = token;
24
- token = page.LastEvaluatedKey;
25
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
26
- }
27
- return undefined;
28
- }
29
- exports.paginateScan = paginateScan;
7
+ exports.paginateScan = (0, core_1.createPaginator)(DynamoDBClient_1.DynamoDBClient, ScanCommand_1.ScanCommand, "ExclusiveStartKey", "LastEvaluatedKey", "Limit");
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
+ const core_1 = require("@aws-sdk/core");
4
5
  const smithy_client_1 = require("@smithy/smithy-client");
5
6
  const url_parser_1 = require("@smithy/url-parser");
6
7
  const util_base64_1 = require("@smithy/util-base64");
7
8
  const util_utf8_1 = require("@smithy/util-utf8");
9
+ const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
8
10
  const endpointResolver_1 = require("./endpoint/endpointResolver");
9
11
  const getRuntimeConfig = (config) => {
10
12
  return {
@@ -14,6 +16,14 @@ const getRuntimeConfig = (config) => {
14
16
  disableHostPrefix: config?.disableHostPrefix ?? false,
15
17
  endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
16
18
  extensions: config?.extensions ?? [],
19
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultDynamoDBHttpAuthSchemeProvider,
20
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
21
+ {
22
+ schemeId: "aws.auth#sigv4",
23
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
24
+ signer: new core_1.AWSSDKSigV4Signer(),
25
+ },
26
+ ],
17
27
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
18
28
  serviceId: config?.serviceId ?? "DynamoDB",
19
29
  urlParser: config?.urlParser ?? url_parser_1.parseUrl,
@@ -4,12 +4,14 @@ exports.resolveRuntimeExtensions = void 0;
4
4
  const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
5
5
  const protocol_http_1 = require("@smithy/protocol-http");
6
6
  const smithy_client_1 = require("@smithy/smithy-client");
7
+ const httpAuthExtensionConfiguration_1 = require("./auth/httpAuthExtensionConfiguration");
7
8
  const asPartial = (t) => t;
8
9
  const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
9
10
  const extensionConfiguration = {
10
11
  ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
11
12
  ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
12
13
  ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
14
+ ...asPartial((0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig)),
13
15
  };
14
16
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
15
17
  return {
@@ -17,6 +19,7 @@ const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
17
19
  ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
18
20
  ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
19
21
  ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
22
+ ...(0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration),
20
23
  };
21
24
  };
22
25
  exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
@@ -2,19 +2,28 @@ import { resolveEndpointDiscoveryConfig, } from "@aws-sdk/middleware-endpoint-di
2
2
  import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
3
3
  import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
4
4
  import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
5
- import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-signing";
6
5
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
7
6
  import { resolveRegionConfig } from "@smithy/config-resolver";
7
+ import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
8
8
  import { getContentLengthPlugin } from "@smithy/middleware-content-length";
9
9
  import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
10
10
  import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
11
11
  import { Client as __Client, } from "@smithy/smithy-client";
12
+ import { defaultDynamoDBHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
12
13
  import { DescribeEndpointsCommand, } from "./commands/DescribeEndpointsCommand";
13
14
  import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
14
15
  import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
15
16
  import { resolveRuntimeExtensions } from "./runtimeExtensions";
16
17
  export { __Client };
17
18
  export class DynamoDBClient extends __Client {
19
+ getDefaultHttpAuthSchemeParametersProvider() {
20
+ return defaultDynamoDBHttpAuthSchemeParametersProvider;
21
+ }
22
+ getIdentityProviderConfigProvider() {
23
+ return async (config) => new DefaultIdentityProviderConfig({
24
+ "aws.auth#sigv4": config.credentials,
25
+ });
26
+ }
18
27
  constructor(...[configuration]) {
19
28
  const _config_0 = __getRuntimeConfig(configuration || {});
20
29
  const _config_1 = resolveClientEndpointParameters(_config_0);
@@ -22,8 +31,8 @@ export class DynamoDBClient extends __Client {
22
31
  const _config_3 = resolveEndpointConfig(_config_2);
23
32
  const _config_4 = resolveRetryConfig(_config_3);
24
33
  const _config_5 = resolveHostHeaderConfig(_config_4);
25
- const _config_6 = resolveAwsAuthConfig(_config_5);
26
- const _config_7 = resolveUserAgentConfig(_config_6);
34
+ const _config_6 = resolveUserAgentConfig(_config_5);
35
+ const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
27
36
  const _config_8 = resolveEndpointDiscoveryConfig(_config_7, {
28
37
  endpointDiscoveryCommandCtor: DescribeEndpointsCommand,
29
38
  });
@@ -35,8 +44,12 @@ export class DynamoDBClient extends __Client {
35
44
  this.middlewareStack.use(getHostHeaderPlugin(this.config));
36
45
  this.middlewareStack.use(getLoggerPlugin(this.config));
37
46
  this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
38
- this.middlewareStack.use(getAwsAuthPlugin(this.config));
39
47
  this.middlewareStack.use(getUserAgentPlugin(this.config));
48
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
49
+ httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
50
+ identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
51
+ }));
52
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
40
53
  }
41
54
  destroy() {
42
55
  super.destroy();
@@ -0,0 +1,38 @@
1
+ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
2
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
4
+ let _credentials = runtimeConfig.credentials;
5
+ return {
6
+ setHttpAuthScheme(httpAuthScheme) {
7
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
8
+ if (index === -1) {
9
+ _httpAuthSchemes.push(httpAuthScheme);
10
+ }
11
+ else {
12
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
13
+ }
14
+ },
15
+ httpAuthSchemes() {
16
+ return _httpAuthSchemes;
17
+ },
18
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
19
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
20
+ },
21
+ httpAuthSchemeProvider() {
22
+ return _httpAuthSchemeProvider;
23
+ },
24
+ setCredentials(credentials) {
25
+ _credentials = credentials;
26
+ },
27
+ credentials() {
28
+ return _credentials;
29
+ },
30
+ };
31
+ };
32
+ export const resolveHttpAuthRuntimeConfig = (config) => {
33
+ return {
34
+ httpAuthSchemes: config.httpAuthSchemes(),
35
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
36
+ credentials: config.credentials(),
37
+ };
38
+ };
@@ -0,0 +1,41 @@
1
+ import { resolveAWSSDKSigV4Config, } from "@aws-sdk/core";
2
+ import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
3
+ export const defaultDynamoDBHttpAuthSchemeParametersProvider = async (config, context, input) => {
4
+ return {
5
+ operation: getSmithyContext(context).operation,
6
+ region: (await normalizeProvider(config.region)()) ||
7
+ (() => {
8
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
9
+ })(),
10
+ };
11
+ };
12
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
13
+ return {
14
+ schemeId: "aws.auth#sigv4",
15
+ signingProperties: {
16
+ name: "dynamodb",
17
+ region: authParameters.region,
18
+ },
19
+ propertiesExtractor: (config, context) => ({
20
+ signingProperties: {
21
+ config,
22
+ context,
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ export const defaultDynamoDBHttpAuthSchemeProvider = (authParameters) => {
28
+ const options = [];
29
+ switch (authParameters.operation) {
30
+ default: {
31
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
32
+ }
33
+ }
34
+ return options;
35
+ };
36
+ export const resolveHttpAuthSchemeConfig = (config) => {
37
+ const config_0 = resolveAWSSDKSigV4Config(config);
38
+ return {
39
+ ...config_0,
40
+ };
41
+ };
@@ -1,25 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
1
2
  import { ListContributorInsightsCommand, } from "../commands/ListContributorInsightsCommand";
2
3
  import { DynamoDBClient } from "../DynamoDBClient";
3
- const makePagedClientRequest = async (client, input, ...args) => {
4
- return await client.send(new ListContributorInsightsCommand(input), ...args);
5
- };
6
- export async function* paginateListContributorInsights(config, input, ...additionalArguments) {
7
- let token = config.startingToken || undefined;
8
- let hasNext = true;
9
- let page;
10
- while (hasNext) {
11
- input.NextToken = token;
12
- input["MaxResults"] = config.pageSize;
13
- if (config.client instanceof DynamoDBClient) {
14
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
15
- }
16
- else {
17
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
18
- }
19
- yield page;
20
- const prevToken = token;
21
- token = page.NextToken;
22
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
23
- }
24
- return undefined;
25
- }
4
+ export const paginateListContributorInsights = createPaginator(DynamoDBClient, ListContributorInsightsCommand, "NextToken", "NextToken", "MaxResults");
@@ -1,25 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
1
2
  import { ListExportsCommand } from "../commands/ListExportsCommand";
2
3
  import { DynamoDBClient } from "../DynamoDBClient";
3
- const makePagedClientRequest = async (client, input, ...args) => {
4
- return await client.send(new ListExportsCommand(input), ...args);
5
- };
6
- export async function* paginateListExports(config, input, ...additionalArguments) {
7
- let token = config.startingToken || undefined;
8
- let hasNext = true;
9
- let page;
10
- while (hasNext) {
11
- input.NextToken = token;
12
- input["MaxResults"] = config.pageSize;
13
- if (config.client instanceof DynamoDBClient) {
14
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
15
- }
16
- else {
17
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
18
- }
19
- yield page;
20
- const prevToken = token;
21
- token = page.NextToken;
22
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
23
- }
24
- return undefined;
25
- }
4
+ export const paginateListExports = createPaginator(DynamoDBClient, ListExportsCommand, "NextToken", "NextToken", "MaxResults");
@@ -1,25 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
1
2
  import { ListImportsCommand } from "../commands/ListImportsCommand";
2
3
  import { DynamoDBClient } from "../DynamoDBClient";
3
- const makePagedClientRequest = async (client, input, ...args) => {
4
- return await client.send(new ListImportsCommand(input), ...args);
5
- };
6
- export async function* paginateListImports(config, input, ...additionalArguments) {
7
- let token = config.startingToken || undefined;
8
- let hasNext = true;
9
- let page;
10
- while (hasNext) {
11
- input.NextToken = token;
12
- input["PageSize"] = config.pageSize;
13
- if (config.client instanceof DynamoDBClient) {
14
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
15
- }
16
- else {
17
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
18
- }
19
- yield page;
20
- const prevToken = token;
21
- token = page.NextToken;
22
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
23
- }
24
- return undefined;
25
- }
4
+ export const paginateListImports = createPaginator(DynamoDBClient, ListImportsCommand, "NextToken", "NextToken", "PageSize");
@@ -1,25 +1,4 @@
1
+ import { createPaginator } from "@smithy/core";
1
2
  import { ListTablesCommand } from "../commands/ListTablesCommand";
2
3
  import { DynamoDBClient } from "../DynamoDBClient";
3
- const makePagedClientRequest = async (client, input, ...args) => {
4
- return await client.send(new ListTablesCommand(input), ...args);
5
- };
6
- export async function* paginateListTables(config, input, ...additionalArguments) {
7
- let token = config.startingToken || undefined;
8
- let hasNext = true;
9
- let page;
10
- while (hasNext) {
11
- input.ExclusiveStartTableName = token;
12
- input["Limit"] = config.pageSize;
13
- if (config.client instanceof DynamoDBClient) {
14
- page = await makePagedClientRequest(config.client, input, ...additionalArguments);
15
- }
16
- else {
17
- throw new Error("Invalid client, expected DynamoDB | DynamoDBClient");
18
- }
19
- yield page;
20
- const prevToken = token;
21
- token = page.LastEvaluatedTableName;
22
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
23
- }
24
- return undefined;
25
- }
4
+ export const paginateListTables = createPaginator(DynamoDBClient, ListTablesCommand, "ExclusiveStartTableName", "LastEvaluatedTableName", "Limit");