@aws-sdk/s3-presigned-post 3.262.0 → 3.266.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.
@@ -9,7 +9,6 @@ const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
9
9
  const util_utf8_1 = require("@aws-sdk/util-utf8");
10
10
  const constants_1 = require("./constants");
11
11
  const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Fields = {}, Expires = 3600 }) => {
12
- var _a, _b;
13
12
  const { systemClockOffset, base64Encoder, utf8Decoder, sha256 } = client.config;
14
13
  const now = new Date(Date.now() + systemClockOffset);
15
14
  const signingDate = iso8601(now).replace(/[\-:]/g, "");
@@ -40,17 +39,11 @@ const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Field
40
39
  })));
41
40
  const signingKey = await (0, signature_v4_1.getSigningKey)(sha256, clientCredentials, shortDate, clientRegion, "s3");
42
41
  const signature = await hmac(sha256, signingKey, encodedPolicy);
43
- let endpoint = await ((_b = (_a = client.config) === null || _a === void 0 ? void 0 : _a.endpoint) === null || _b === void 0 ? void 0 : _b.call(_a));
44
- let isEndpointV2 = false;
45
- if (!endpoint) {
46
- isEndpointV2 = true;
47
- endpoint = (0, middleware_endpoint_1.toEndpointV1)(await (0, middleware_endpoint_1.getEndpointFromInstructions)({ Bucket, Key }, client_s3_1.PutObjectCommand, {
48
- ...client.config,
49
- }));
50
- }
51
- if (endpoint && !client.config.isCustomEndpoint && !isEndpointV2) {
52
- endpoint.path = `/${Bucket}`;
53
- }
42
+ const endpoint = (0, middleware_endpoint_1.toEndpointV1)(await (0, middleware_endpoint_1.getEndpointFromInstructions)({ Bucket, Key }, client_s3_1.PutObjectCommand, {
43
+ ...client.config,
44
+ }, {
45
+ logger: client.config.logger,
46
+ }));
54
47
  return {
55
48
  url: (0, util_format_url_1.formatUrl)(endpoint),
56
49
  fields: {
@@ -36,17 +36,11 @@ export const createPresignedPost = async (client, { Bucket, Key, Conditions = []
36
36
  })));
37
37
  const signingKey = await getSigningKey(sha256, clientCredentials, shortDate, clientRegion, "s3");
38
38
  const signature = await hmac(sha256, signingKey, encodedPolicy);
39
- let endpoint = await client.config?.endpoint?.();
40
- let isEndpointV2 = false;
41
- if (!endpoint) {
42
- isEndpointV2 = true;
43
- endpoint = toEndpointV1(await getEndpointFromInstructions({ Bucket, Key }, PutObjectCommand, {
44
- ...client.config,
45
- }));
46
- }
47
- if (endpoint && !client.config.isCustomEndpoint && !isEndpointV2) {
48
- endpoint.path = `/${Bucket}`;
49
- }
39
+ const endpoint = toEndpointV1(await getEndpointFromInstructions({ Bucket, Key }, PutObjectCommand, {
40
+ ...client.config,
41
+ }, {
42
+ logger: client.config.logger,
43
+ }));
50
44
  return {
51
45
  url: formatUrl(endpoint),
52
46
  fields: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/s3-presigned-post",
3
- "version": "3.262.0",
3
+ "version": "3.266.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",
@@ -20,22 +20,23 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/middleware-endpoint": "3.257.0",
24
- "@aws-sdk/signature-v4": "3.257.0",
25
- "@aws-sdk/types": "3.257.0",
26
- "@aws-sdk/util-format-url": "3.257.0",
23
+ "@aws-sdk/middleware-endpoint": "3.266.0",
24
+ "@aws-sdk/signature-v4": "3.266.0",
25
+ "@aws-sdk/types": "3.266.0",
26
+ "@aws-sdk/util-format-url": "3.266.0",
27
27
  "@aws-sdk/util-hex-encoding": "3.201.0",
28
28
  "@aws-sdk/util-utf8": "3.254.0",
29
29
  "tslib": "^2.3.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@aws-sdk/client-s3": "3.262.0",
33
- "@aws-sdk/hash-node": "3.257.0",
34
- "@aws-sdk/protocol-http": "3.257.0",
32
+ "@aws-sdk/client-s3": "3.266.0",
33
+ "@aws-sdk/hash-node": "3.266.0",
34
+ "@aws-sdk/protocol-http": "3.266.0",
35
35
  "@tsconfig/recommended": "1.0.1",
36
36
  "@types/node": "^14.14.31",
37
37
  "concurrently": "7.0.0",
38
38
  "downlevel-dts": "0.10.1",
39
+ "form-data": "^4.0.0",
39
40
  "rimraf": "3.0.2",
40
41
  "typedoc": "0.19.2",
41
42
  "typescript": "~4.6.2"