@pi-r/aws-v3 0.8.0 → 0.8.2

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.
package/client/index.js CHANGED
@@ -157,9 +157,19 @@ async function createBucketV2(credential, Bucket, ACL, options, service = "aws-v
157
157
  })
158
158
  .catch(async () => {
159
159
  const input = { ...options, Bucket };
160
- const region = credential.region;
161
- if ((0, types_1.isString)(region) && region !== "us-east-1") {
162
- input.CreateBucketConfiguration ||= { LocationConstraint: region };
160
+ const config = input.CreateBucketConfiguration ||= {};
161
+ if (!config.Location) {
162
+ const match = /^.+--([\w\d-]+)--x-s3$/.exec(Bucket);
163
+ if (match) {
164
+ config.Location = { Type: 'AvailabilityZone', Name: match[1] };
165
+ config.Bucket = { Type: 'Directory', DataRedundancy: 'SingleAvailabilityZone' };
166
+ }
167
+ }
168
+ if (!config.LocationConstraint) {
169
+ const region = credential.region;
170
+ if ((0, types_1.isString)(region) && region !== "us-east-1") {
171
+ config.LocationConstraint = region;
172
+ }
163
173
  }
164
174
  return client.send(new AWS.CreateBucketCommand(input))
165
175
  .then(async () => {
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "@pi-r/aws-v3",
3
- "version": "0.8.0",
4
- "description": "AWS cloud functions for E-mc.",
5
- "main": "client/index.js",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/anpham6/pi-r.git",
12
- "directory": "src/cloud/aws-v3"
13
- },
14
- "keywords": [
15
- "squared",
16
- "e-mc",
17
- "squared-functions"
18
- ],
19
- "author": "An Pham <anpham6@gmail.com>",
20
- "license": "MIT",
21
- "homepage": "https://github.com/anpham6/pi-r#readme",
22
- "dependencies": {
23
- "@e-mc/cloud": "^0.10.0",
24
- "@e-mc/module": "^0.10.0",
25
- "@e-mc/types": "^0.10.0",
26
- "@pi-r/aws-lib": "^0.8.0",
27
- "@aws-sdk/client-dynamodb": "3.623.0",
28
- "@aws-sdk/client-s3": "3.623.0",
29
- "@aws-sdk/credential-providers": "3.623.0",
30
- "@aws-sdk/lib-dynamodb": "3.623.0",
31
- "@aws-sdk/lib-storage": "3.623.0"
32
- }
33
- }
1
+ {
2
+ "name": "@pi-r/aws-v3",
3
+ "version": "0.8.2",
4
+ "description": "AWS cloud functions for E-mc.",
5
+ "main": "client/index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/anpham6/pi-r.git",
12
+ "directory": "src/cloud/aws-v3"
13
+ },
14
+ "keywords": [
15
+ "squared",
16
+ "e-mc",
17
+ "squared-functions"
18
+ ],
19
+ "author": "An Pham <anpham6@gmail.com>",
20
+ "license": "MIT",
21
+ "homepage": "https://github.com/anpham6/pi-r#readme",
22
+ "dependencies": {
23
+ "@e-mc/cloud": "^0.10.2",
24
+ "@e-mc/module": "^0.10.2",
25
+ "@e-mc/types": "^0.10.2",
26
+ "@pi-r/aws-lib": "^0.8.2",
27
+ "@aws-sdk/client-dynamodb": "^3.645.0",
28
+ "@aws-sdk/client-s3": "^3.645.0",
29
+ "@aws-sdk/credential-providers": "^3.645.0",
30
+ "@aws-sdk/lib-dynamodb": "^3.645.0",
31
+ "@aws-sdk/lib-storage": "^3.645.0"
32
+ }
33
+ }
package/types/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { CloudDatabase, CloudStorage } from '@e-mc/types/lib/cloud';
2
2
 
3
- import type { AwsAuthInputConfig } from '@aws-sdk/middleware-signing';
3
+ import type { AwsSdkSigV4AuthInputConfig } from '@aws-sdk/core';
4
4
  import type { DynamoDBClientConfig, QueryCommandInput, ScanCommandInput } from '@aws-sdk/client-dynamodb';
5
5
  import type { BatchGetCommandInput, NativeAttributeValue, TranslateConfig, UpdateCommandInput } from '@aws-sdk/lib-dynamodb';
6
6
  import type { S3ClientConfig } from '@aws-sdk/client-s3';
7
7
 
8
- export interface AWSBaseCredential extends AwsAuthInputConfig {
8
+ export interface AWSBaseCredential extends AwsSdkSigV4AuthInputConfig {
9
9
  provider?: {
10
10
  http?: unknown;
11
11
  ini?: unknown;