@aws-sdk/s3-presigned-post 3.1067.0 → 3.1069.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 +11 -13
  2. package/package.json +7 -7
package/dist-cjs/index.js CHANGED
@@ -1,10 +1,8 @@
1
- 'use strict';
2
-
3
- var clientS3 = require('@aws-sdk/client-s3');
4
- var util = require('@aws-sdk/core/util');
5
- var endpoints = require('@smithy/core/endpoints');
6
- var serde = require('@smithy/core/serde');
7
- var signatureV4 = require('@smithy/signature-v4');
1
+ const { PutObjectCommand } = require("@aws-sdk/client-s3");
2
+ const { formatUrl } = require("@aws-sdk/core/util");
3
+ const { toEndpointV1, getEndpointFromInstructions } = require("@smithy/core/endpoints");
4
+ const { toHex, toUint8Array } = require("@smithy/core/serde");
5
+ const { createScope, getSigningKey } = require("@smithy/signature-v4");
8
6
 
9
7
  const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
10
8
  const CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
@@ -19,7 +17,7 @@ const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Field
19
17
  const signingDate = iso8601(now).replace(/[\-:]/g, "");
20
18
  const shortDate = signingDate.slice(0, 8);
21
19
  const clientRegion = await client.config.region();
22
- const credentialScope = signatureV4.createScope(shortDate, clientRegion, "s3");
20
+ const credentialScope = createScope(shortDate, clientRegion, "s3");
23
21
  const clientCredentials = await client.config.credentials();
24
22
  const credential = `${clientCredentials.accessKeyId}/${credentialScope}`;
25
23
  const fields = {
@@ -50,27 +48,27 @@ const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Field
50
48
  expiration: iso8601(expiration),
51
49
  conditions,
52
50
  })));
53
- const signingKey = await signatureV4.getSigningKey(sha256, clientCredentials, shortDate, clientRegion, "s3");
51
+ const signingKey = await getSigningKey(sha256, clientCredentials, shortDate, clientRegion, "s3");
54
52
  const signature = await hmac(sha256, signingKey, encodedPolicy);
55
- const endpoint = endpoints.toEndpointV1(await endpoints.getEndpointFromInstructions({ Bucket, Key }, clientS3.PutObjectCommand, {
53
+ const endpoint = toEndpointV1(await getEndpointFromInstructions({ Bucket, Key }, PutObjectCommand, {
56
54
  ...client.config,
57
55
  }, {
58
56
  logger: client.config.logger,
59
57
  }));
60
58
  return {
61
- url: util.formatUrl(endpoint),
59
+ url: formatUrl(endpoint),
62
60
  fields: {
63
61
  ...fields,
64
62
  key: Key,
65
63
  Policy: encodedPolicy,
66
- [SIGNATURE_QUERY_PARAM]: serde.toHex(signature),
64
+ [SIGNATURE_QUERY_PARAM]: toHex(signature),
67
65
  },
68
66
  };
69
67
  };
70
68
  const iso8601 = (date) => date.toISOString().replace(/\.\d{3}Z$/, "Z");
71
69
  const hmac = (ctor, secret, data) => {
72
70
  const hash = new ctor(secret);
73
- hash.update(serde.toUint8Array(data));
71
+ hash.update(toUint8Array(data));
74
72
  return hash.digest();
75
73
  };
76
74
 
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aws-sdk/s3-presigned-post",
3
- "version": "3.1067.0",
3
+ "version": "3.1069.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline",
7
- "build:es": "tsc -p tsconfig.es.json",
7
+ "build:es": "premove dist-es && tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
- "build:types": "tsc -p tsconfig.types.json",
9
+ "build:types": "premove dist-types && tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
11
+ "clean": "premove dist-cjs dist-es dist-types",
12
12
  "extract:docs": "api-extractor run --local",
13
13
  "test": "yarn g:vitest run",
14
14
  "test:watch": "yarn g:vitest watch",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@aws-sdk/client-s3": "3.1067.0",
29
- "@aws-sdk/core": "^3.974.20",
30
- "@aws-sdk/types": "^3.973.12",
28
+ "@aws-sdk/client-s3": "3.1069.0",
29
+ "@aws-sdk/core": "^3.974.21",
30
+ "@aws-sdk/types": "^3.973.13",
31
31
  "@smithy/core": "^3.24.6",
32
32
  "@smithy/signature-v4": "^5.4.6",
33
33
  "@smithy/types": "^4.14.3",