@aws-sdk/middleware-sdk-rds 3.901.0 → 3.910.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 (2) hide show
  1. package/dist-cjs/index.js +87 -119
  2. package/package.json +7 -7
package/dist-cjs/index.js CHANGED
@@ -1,130 +1,98 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
20
2
 
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- crossRegionPresignedUrlMiddleware: () => crossRegionPresignedUrlMiddleware,
25
- crossRegionPresignedUrlMiddlewareOptions: () => crossRegionPresignedUrlMiddlewareOptions,
26
- getCrossRegionPresignedUrlPlugin: () => getCrossRegionPresignedUrlPlugin
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
- var import_util_format_url = require("@aws-sdk/util-format-url");
30
- var import_middleware_endpoint = require("@smithy/middleware-endpoint");
31
- var import_protocol_http = require("@smithy/protocol-http");
32
- var import_signature_v4 = require("@smithy/signature-v4");
33
- var regARN = /arn:[\w+=/,.@-]+:[\w+=/,.@-]+:([\w+=/,.@-]*)?:[0-9]+:[\w+=/,.@-]+(:[\w+=/,.@-]+)?(:[\w+=/,.@-]+)?/;
34
- var sourceIdToCommandKeyMap = {
35
- SourceDBSnapshotIdentifier: "CopyDBSnapshot",
36
- SourceDBInstanceIdentifier: "CreateDBInstanceReadReplica",
37
- ReplicationSourceIdentifier: "CreateDBCluster",
38
- // This key is optional.
39
- SourceDBClusterSnapshotIdentifier: "CopyDBClusterSnapshot",
40
- SourceDBInstanceArn: "StartDBInstanceAutomatedBackupsReplication"
3
+ var utilFormatUrl = require('@aws-sdk/util-format-url');
4
+ var middlewareEndpoint = require('@smithy/middleware-endpoint');
5
+ var protocolHttp = require('@smithy/protocol-http');
6
+ var signatureV4 = require('@smithy/signature-v4');
7
+
8
+ const regARN = /arn:[\w+=/,.@-]+:[\w+=/,.@-]+:([\w+=/,.@-]*)?:[0-9]+:[\w+=/,.@-]+(:[\w+=/,.@-]+)?(:[\w+=/,.@-]+)?/;
9
+ const sourceIdToCommandKeyMap = {
10
+ SourceDBSnapshotIdentifier: "CopyDBSnapshot",
11
+ SourceDBInstanceIdentifier: "CreateDBInstanceReadReplica",
12
+ ReplicationSourceIdentifier: "CreateDBCluster",
13
+ SourceDBClusterSnapshotIdentifier: "CopyDBClusterSnapshot",
14
+ SourceDBInstanceArn: "StartDBInstanceAutomatedBackupsReplication",
41
15
  };
42
- var version = "2014-10-31";
16
+ const version = "2014-10-31";
43
17
  function crossRegionPresignedUrlMiddleware(options) {
44
- return (next, context) => async (args) => {
45
- const { input } = args;
46
- const region = await options.region();
47
- const sourceIdKey = Object.keys(sourceIdToCommandKeyMap).filter(
48
- (sourceKeyId) => input.hasOwnProperty(sourceKeyId)
49
- )[0];
50
- if (!sourceIdKey) return next(args);
51
- const command = sourceIdToCommandKeyMap[sourceIdKey];
52
- if (!input.PreSignedUrl && isARN(input[sourceIdKey]) && region !== getEndpointFromARN(input[sourceIdKey])) {
53
- const sourceRegion = getEndpointFromARN(input[sourceIdKey]);
54
- let resolvedEndpoint;
55
- if (typeof options.endpoint === "function") {
56
- resolvedEndpoint = await options.endpoint();
57
- } else {
58
- resolvedEndpoint = (0, import_middleware_endpoint.toEndpointV1)(context.endpointV2);
59
- }
60
- resolvedEndpoint.hostname = `rds.${sourceRegion}.amazonaws.com`;
61
- const request = new import_protocol_http.HttpRequest({
62
- ...resolvedEndpoint,
63
- protocol: "https",
64
- headers: {
65
- host: resolvedEndpoint.hostname
66
- },
67
- query: {
68
- Action: command,
69
- Version: version,
70
- KmsKeyId: input.KmsKeyId,
71
- DestinationRegion: region,
72
- [sourceIdKey]: input[sourceIdKey]
73
- }
74
- });
75
- const signer = new import_signature_v4.SignatureV4({
76
- credentials: options.credentials,
77
- region: sourceRegion,
78
- service: "rds",
79
- sha256: options.sha256,
80
- uriEscapePath: options.signingEscapePath
81
- });
82
- const presignedRequest = await signer.presign(request, {
83
- expiresIn: 3600
84
- });
85
- args = {
86
- ...args,
87
- input: {
88
- ...args.input,
89
- PreSignedUrl: (0, import_util_format_url.formatUrl)(presignedRequest)
18
+ return (next, context) => async (args) => {
19
+ const { input } = args;
20
+ const region = await options.region();
21
+ const sourceIdKey = Object.keys(sourceIdToCommandKeyMap).filter((sourceKeyId) => input.hasOwnProperty(sourceKeyId))[0];
22
+ if (!sourceIdKey)
23
+ return next(args);
24
+ const command = sourceIdToCommandKeyMap[sourceIdKey];
25
+ if (!input.PreSignedUrl && isARN(input[sourceIdKey]) && region !== getEndpointFromARN(input[sourceIdKey])) {
26
+ const sourceRegion = getEndpointFromARN(input[sourceIdKey]);
27
+ let resolvedEndpoint;
28
+ if (typeof options.endpoint === "function") {
29
+ resolvedEndpoint = await options.endpoint();
30
+ }
31
+ else {
32
+ resolvedEndpoint = middlewareEndpoint.toEndpointV1(context.endpointV2);
33
+ }
34
+ resolvedEndpoint.hostname = `rds.${sourceRegion}.amazonaws.com`;
35
+ const request = new protocolHttp.HttpRequest({
36
+ ...resolvedEndpoint,
37
+ protocol: "https",
38
+ headers: {
39
+ host: resolvedEndpoint.hostname,
40
+ },
41
+ query: {
42
+ Action: command,
43
+ Version: version,
44
+ KmsKeyId: input.KmsKeyId,
45
+ DestinationRegion: region,
46
+ [sourceIdKey]: input[sourceIdKey],
47
+ },
48
+ });
49
+ const signer = new signatureV4.SignatureV4({
50
+ credentials: options.credentials,
51
+ region: sourceRegion,
52
+ service: "rds",
53
+ sha256: options.sha256,
54
+ uriEscapePath: options.signingEscapePath,
55
+ });
56
+ const presignedRequest = await signer.presign(request, {
57
+ expiresIn: 3600,
58
+ });
59
+ args = {
60
+ ...args,
61
+ input: {
62
+ ...args.input,
63
+ PreSignedUrl: utilFormatUrl.formatUrl(presignedRequest),
64
+ },
65
+ };
90
66
  }
91
- };
92
- }
93
- return next(args);
94
- };
67
+ return next(args);
68
+ };
95
69
  }
96
- __name(crossRegionPresignedUrlMiddleware, "crossRegionPresignedUrlMiddleware");
97
- var crossRegionPresignedUrlMiddlewareOptions = {
98
- step: "serialize",
99
- tags: ["CROSS_REGION_PRESIGNED_URL"],
100
- name: "crossRegionPresignedUrlMiddleware",
101
- override: true,
102
- relation: "after",
103
- toMiddleware: "endpointV2Middleware"
70
+ const crossRegionPresignedUrlMiddlewareOptions = {
71
+ step: "serialize",
72
+ tags: ["CROSS_REGION_PRESIGNED_URL"],
73
+ name: "crossRegionPresignedUrlMiddleware",
74
+ override: true,
75
+ relation: "after",
76
+ toMiddleware: "endpointV2Middleware",
104
77
  };
105
- var getCrossRegionPresignedUrlPlugin = /* @__PURE__ */ __name((config) => ({
106
- applyToStack: /* @__PURE__ */ __name((clientStack) => {
107
- clientStack.addRelativeTo(crossRegionPresignedUrlMiddleware(config), crossRegionPresignedUrlMiddlewareOptions);
108
- }, "applyToStack")
109
- }), "getCrossRegionPresignedUrlPlugin");
78
+ const getCrossRegionPresignedUrlPlugin = (config) => ({
79
+ applyToStack: (clientStack) => {
80
+ clientStack.addRelativeTo(crossRegionPresignedUrlMiddleware(config), crossRegionPresignedUrlMiddlewareOptions);
81
+ },
82
+ });
110
83
  function isARN(id) {
111
- if (!id) return false;
112
- return regARN.test(id);
84
+ if (!id)
85
+ return false;
86
+ return regARN.test(id);
113
87
  }
114
- __name(isARN, "isARN");
115
88
  function getEndpointFromARN(arn) {
116
- const arnArr = arn.split(":");
117
- if (arnArr.length < 4) {
118
- throw new Error(`Cannot infer endpoint from '${arn}'`);
119
- }
120
- return arnArr[3];
89
+ const arnArr = arn.split(":");
90
+ if (arnArr.length < 4) {
91
+ throw new Error(`Cannot infer endpoint from '${arn}'`);
92
+ }
93
+ return arnArr[3];
121
94
  }
122
- __name(getEndpointFromARN, "getEndpointFromARN");
123
- // Annotate the CommonJS export names for ESM import in node:
124
-
125
- 0 && (module.exports = {
126
- crossRegionPresignedUrlMiddlewareOptions,
127
- getCrossRegionPresignedUrlPlugin,
128
- crossRegionPresignedUrlMiddleware
129
- });
130
95
 
96
+ exports.crossRegionPresignedUrlMiddleware = crossRegionPresignedUrlMiddleware;
97
+ exports.crossRegionPresignedUrlMiddlewareOptions = crossRegionPresignedUrlMiddlewareOptions;
98
+ exports.getCrossRegionPresignedUrlPlugin = getCrossRegionPresignedUrlPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-rds",
3
- "version": "3.901.0",
3
+ "version": "3.910.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-rds",
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@aws-sdk/types": "3.901.0",
28
- "@aws-sdk/util-format-url": "3.901.0",
29
- "@smithy/middleware-endpoint": "^4.3.0",
30
- "@smithy/protocol-http": "^5.3.0",
31
- "@smithy/signature-v4": "^5.3.0",
32
- "@smithy/types": "^4.6.0",
27
+ "@aws-sdk/types": "3.910.0",
28
+ "@aws-sdk/util-format-url": "3.910.0",
29
+ "@smithy/middleware-endpoint": "^4.3.3",
30
+ "@smithy/protocol-http": "^5.3.2",
31
+ "@smithy/signature-v4": "^5.3.2",
32
+ "@smithy/types": "^4.7.1",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "engines": {