ag-common 0.0.739 → 0.0.740

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.
@@ -14,6 +14,8 @@ export type StorageConfig = {
14
14
  accountId: string;
15
15
  accessKeyId?: string;
16
16
  secretAccessKey?: string;
17
+ /** region to use. default auto */
18
+ region?: string;
17
19
  };
18
20
  export declare const createStorageClient: (config: StorageConfig) => S3Client;
19
21
  export declare const setS3: (config: StorageConfig) => void;
@@ -48,6 +48,7 @@ const getCacheKey = (config) => {
48
48
  });
49
49
  };
50
50
  const createStorageClient = (config) => {
51
+ var _a;
51
52
  const cacheKey = getCacheKey(config);
52
53
  const cachedClient = clientCache.get(cacheKey);
53
54
  if (cachedClient) {
@@ -59,14 +60,14 @@ const createStorageClient = (config) => {
59
60
  if (!accountId) {
60
61
  throw new Error('Account ID is required for R2. Set CLOUDFLARE_ACCOUNT_ID env var or provide accountId in config');
61
62
  }
62
- client = new client_s3_1.S3Client(Object.assign({ endpoint: `https://${accountId}.r2.cloudflarestorage.com`, forcePathStyle: true }, (config.accessKeyId && config.secretAccessKey
63
+ client = new client_s3_1.S3Client(Object.assign(Object.assign({ endpoint: `https://${accountId}.r2.cloudflarestorage.com`, forcePathStyle: true }, (config.accessKeyId && config.secretAccessKey
63
64
  ? {
64
65
  credentials: {
65
66
  accessKeyId: config.accessKeyId,
66
67
  secretAccessKey: config.secretAccessKey,
67
68
  },
68
69
  }
69
- : {})));
70
+ : {})), { region: (_a = config.region) !== null && _a !== void 0 ? _a : 'auto' }));
70
71
  }
71
72
  else {
72
73
  client = new client_s3_1.S3Client({
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.739",
2
+ "version": "0.0.740",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",