ag-common 0.0.737 → 0.0.738

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.
@@ -7,9 +7,13 @@ export type StorageConfig = {
7
7
  region?: string;
8
8
  endpoint?: string;
9
9
  accountId?: string;
10
+ accessKeyId?: string;
11
+ secretAccessKey?: string;
10
12
  } | {
11
13
  provider: 'r2';
12
14
  accountId: string;
15
+ accessKeyId?: string;
16
+ secretAccessKey?: string;
13
17
  };
14
18
  export declare const createStorageClient: (config: StorageConfig) => S3Client;
15
19
  export declare const setS3: (config: StorageConfig) => S3Client;
@@ -59,10 +59,14 @@ const createStorageClient = (config) => {
59
59
  if (!accountId) {
60
60
  throw new Error('Account ID is required for R2. Set CLOUDFLARE_ACCOUNT_ID env var or provide accountId in config');
61
61
  }
62
- client = new client_s3_1.S3Client({
63
- endpoint: `https://${accountId}.r2.cloudflarestorage.com`,
64
- forcePathStyle: true,
65
- });
62
+ client = new client_s3_1.S3Client(Object.assign({ endpoint: `https://${accountId}.r2.cloudflarestorage.com`, forcePathStyle: true }, (config.accessKeyId && config.secretAccessKey
63
+ ? {
64
+ credentials: {
65
+ accessKeyId: config.accessKeyId,
66
+ secretAccessKey: config.secretAccessKey,
67
+ },
68
+ }
69
+ : {})));
66
70
  }
67
71
  else {
68
72
  client = new client_s3_1.S3Client({
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.737",
2
+ "version": "0.0.738",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",