@aws-sdk/signature-v4-multi-region 3.408.0 → 3.412.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.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SignatureV4MultiRegion = void 0;
4
4
  const signature_v4_1 = require("@smithy/signature-v4");
5
+ const load_crt_1 = require("./load-crt");
6
+ const signature_v4_crt_container_1 = require("./signature-v4-crt-container");
5
7
  class SignatureV4MultiRegion {
6
8
  constructor(options) {
7
9
  this.sigv4Signer = new signature_v4_1.SignatureV4(options);
@@ -25,9 +27,10 @@ class SignatureV4MultiRegion {
25
27
  }
26
28
  getSigv4aSigner() {
27
29
  if (!this.sigv4aSigner) {
28
- let CrtSignerV4;
30
+ let CrtSignerV4 = null;
29
31
  try {
30
- CrtSignerV4 = typeof require === "function" && require("@aws-sdk/signature-v4-crt").CrtSignerV4;
32
+ (0, load_crt_1.loadCrt)();
33
+ CrtSignerV4 = signature_v4_crt_container_1.signatureV4CrtContainer.CrtSignerV4;
31
34
  if (typeof CrtSignerV4 !== "function")
32
35
  throw new Error();
33
36
  }
package/dist-cjs/index.js CHANGED
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./SignatureV4MultiRegion"), exports);
5
+ tslib_1.__exportStar(require("./signature-v4-crt-container"), exports);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadCrt = void 0;
4
+ function loadCrt() { }
5
+ exports.loadCrt = loadCrt;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadCrt = void 0;
4
+ const signature_v4_crt_container_1 = require("./signature-v4-crt-container");
5
+ function loadCrt() {
6
+ if (signature_v4_crt_container_1.signatureV4CrtContainer.CrtSignerV4) {
7
+ return;
8
+ }
9
+ try {
10
+ if (typeof require === "function") {
11
+ const __require = require;
12
+ const moduleName = "@aws-sdk/signature-v4-crt";
13
+ __require.call(null, moduleName);
14
+ }
15
+ }
16
+ catch (e) {
17
+ }
18
+ }
19
+ exports.loadCrt = loadCrt;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signatureV4CrtContainer = void 0;
4
+ exports.signatureV4CrtContainer = {
5
+ CrtSignerV4: null,
6
+ };
@@ -1,4 +1,6 @@
1
1
  import { SignatureV4 } from "@smithy/signature-v4";
2
+ import { loadCrt } from "./load-crt";
3
+ import { signatureV4CrtContainer } from "./signature-v4-crt-container";
2
4
  export class SignatureV4MultiRegion {
3
5
  constructor(options) {
4
6
  this.sigv4Signer = new SignatureV4(options);
@@ -22,9 +24,10 @@ export class SignatureV4MultiRegion {
22
24
  }
23
25
  getSigv4aSigner() {
24
26
  if (!this.sigv4aSigner) {
25
- let CrtSignerV4;
27
+ let CrtSignerV4 = null;
26
28
  try {
27
- CrtSignerV4 = typeof require === "function" && require("@aws-sdk/signature-v4-crt").CrtSignerV4;
29
+ loadCrt();
30
+ CrtSignerV4 = signatureV4CrtContainer.CrtSignerV4;
28
31
  if (typeof CrtSignerV4 !== "function")
29
32
  throw new Error();
30
33
  }
package/dist-es/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./SignatureV4MultiRegion";
2
+ export * from "./signature-v4-crt-container";
@@ -0,0 +1 @@
1
+ export function loadCrt() { }
@@ -0,0 +1,15 @@
1
+ import { signatureV4CrtContainer } from "./signature-v4-crt-container";
2
+ export function loadCrt() {
3
+ if (signatureV4CrtContainer.CrtSignerV4) {
4
+ return;
5
+ }
6
+ try {
7
+ if (typeof require === "function") {
8
+ const __require = require;
9
+ const moduleName = "@aws-sdk/signature-v4-crt";
10
+ __require.call(null, moduleName);
11
+ }
12
+ }
13
+ catch (e) {
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ export const signatureV4CrtContainer = {
2
+ CrtSignerV4: null,
3
+ };
@@ -2,3 +2,4 @@
2
2
  * @internal
3
3
  */
4
4
  export * from "./SignatureV4MultiRegion";
5
+ export * from "./signature-v4-crt-container";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function loadCrt(): void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function loadCrt(): void;
@@ -0,0 +1,25 @@
1
+ import type { RequestPresigner, RequestSigner } from "@smithy/types";
2
+ /**
3
+ * @public
4
+ */
5
+ export type OptionalCrtSignerV4 = {
6
+ /**
7
+ * This constructor is not typed so as not to require a type import
8
+ * from the signature-v4-crt package.
9
+ *
10
+ * The true type is CrtSignerV4 from \@aws-sdk/signature-v4-crt.
11
+ */
12
+ new (options: any): RequestPresigner & RequestSigner;
13
+ };
14
+ /**
15
+ * @public
16
+ *
17
+ * \@aws-sdk/signature-v4-crt will install the constructor in this
18
+ * container if it is installed.
19
+ *
20
+ * This avoids a runtime-require being interpreted statically by bundlers.
21
+ *
22
+ */
23
+ export declare const signatureV4CrtContainer: {
24
+ CrtSignerV4: null | OptionalCrtSignerV4;
25
+ };
@@ -1 +1,2 @@
1
1
  export * from "./SignatureV4MultiRegion";
2
+ export * from "./signature-v4-crt-container";
@@ -0,0 +1 @@
1
+ export declare function loadCrt(): void;
@@ -0,0 +1 @@
1
+ export declare function loadCrt(): void;
@@ -0,0 +1,7 @@
1
+ import { RequestPresigner, RequestSigner } from "@smithy/types";
2
+ export type OptionalCrtSignerV4 = {
3
+ new (options: any): RequestPresigner & RequestSigner;
4
+ };
5
+ export declare const signatureV4CrtContainer: {
6
+ CrtSignerV4: null | OptionalCrtSignerV4;
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/signature-v4-multi-region",
3
- "version": "3.408.0",
3
+ "version": "3.412.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -15,10 +15,10 @@
15
15
  "module": "./dist-es/index.js",
16
16
  "types": "./dist-types/index.d.ts",
17
17
  "browser": {
18
- "@aws-sdk/signature-v4-crt": false
18
+ "./dist-es/load-crt": "./dist-es/load-crt.browser"
19
19
  },
20
20
  "react-native": {
21
- "@aws-sdk/signature-v4-crt": false
21
+ "./dist-es/load-crt": "./dist-es/load-crt.browser"
22
22
  },
23
23
  "author": {
24
24
  "name": "AWS SDK for JavaScript Team",
@@ -26,14 +26,13 @@
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@aws-sdk/types": "3.408.0",
30
- "@smithy/protocol-http": "^2.0.5",
29
+ "@aws-sdk/types": "3.410.0",
30
+ "@smithy/protocol-http": "^3.0.2",
31
31
  "@smithy/signature-v4": "^2.0.0",
32
- "@smithy/types": "^2.2.2",
32
+ "@smithy/types": "^2.3.0",
33
33
  "tslib": "^2.5.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@aws-sdk/signature-v4-crt": "3.408.0",
37
36
  "@tsconfig/recommended": "1.0.1",
38
37
  "concurrently": "7.0.0",
39
38
  "downlevel-dts": "0.10.1",
@@ -41,14 +40,6 @@
41
40
  "typedoc": "0.23.23",
42
41
  "typescript": "~4.9.5"
43
42
  },
44
- "peerDependencies": {
45
- "@aws-sdk/signature-v4-crt": "^3.118.0"
46
- },
47
- "peerDependenciesMeta": {
48
- "@aws-sdk/signature-v4-crt": {
49
- "optional": true
50
- }
51
- },
52
43
  "engines": {
53
44
  "node": ">=14.0.0"
54
45
  },