@supabase/storage-js 1.6.4 → 1.7.1

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 (35) hide show
  1. package/README.md +136 -0
  2. package/dist/main/{SupabaseStorageClient.d.ts → StorageClient.d.ts} +2 -2
  3. package/dist/main/StorageClient.d.ts.map +1 -0
  4. package/dist/main/{SupabaseStorageClient.js → StorageClient.js} +4 -4
  5. package/dist/main/StorageClient.js.map +1 -0
  6. package/dist/main/index.d.ts +1 -2
  7. package/dist/main/index.d.ts.map +1 -1
  8. package/dist/main/index.js +4 -3
  9. package/dist/main/index.js.map +1 -1
  10. package/dist/main/lib/StorageBucketApi.d.ts +2 -2
  11. package/dist/main/lib/StorageBucketApi.js +2 -2
  12. package/dist/main/lib/types.d.ts +2 -0
  13. package/dist/main/lib/types.d.ts.map +1 -1
  14. package/dist/module/{SupabaseStorageClient.d.ts → StorageClient.d.ts} +2 -2
  15. package/dist/module/StorageClient.d.ts.map +1 -0
  16. package/dist/module/{SupabaseStorageClient.js → StorageClient.js} +2 -2
  17. package/dist/module/StorageClient.js.map +1 -0
  18. package/dist/module/index.d.ts +1 -2
  19. package/dist/module/index.d.ts.map +1 -1
  20. package/dist/module/index.js +1 -2
  21. package/dist/module/index.js.map +1 -1
  22. package/dist/module/lib/StorageBucketApi.d.ts +2 -2
  23. package/dist/module/lib/StorageBucketApi.js +2 -2
  24. package/dist/module/lib/types.d.ts +2 -0
  25. package/dist/module/lib/types.d.ts.map +1 -1
  26. package/dist/umd/supabase.js +1 -1
  27. package/package.json +2 -2
  28. package/src/{SupabaseStorageClient.ts → StorageClient.ts} +1 -1
  29. package/src/index.ts +4 -3
  30. package/src/lib/StorageBucketApi.ts +2 -2
  31. package/src/lib/types.ts +3 -0
  32. package/dist/main/SupabaseStorageClient.d.ts.map +0 -1
  33. package/dist/main/SupabaseStorageClient.js.map +0 -1
  34. package/dist/module/SupabaseStorageClient.d.ts.map +0 -1
  35. package/dist/module/SupabaseStorageClient.js.map +0 -1
package/README.md CHANGED
@@ -4,6 +4,142 @@ JS Client library to interact with Supabase Storage.
4
4
 
5
5
  - Documentation: https://supabase.io/docs/reference/javascript/storage-createbucket
6
6
 
7
+ ## Quick Start Guide
8
+
9
+ ### Installing the module
10
+
11
+ ```bash
12
+ npm install @supabase/storage-js
13
+ ```
14
+
15
+ ### Connecting to the storage backend
16
+
17
+ ```js
18
+ import { SupabaseStorageClient } from '@supabase/storage-js'
19
+
20
+ const STORAGE_URL = 'https://<project_ref>.supabase.co/storage/v1'
21
+ const SERVICE_KEY = '<service_role>' //! service key, not anon key
22
+
23
+ const storageClient = new SupabaseStorageClient(STORAGE_URL, {
24
+ apikey: SERVICE_KEY,
25
+ Authorization: `Bearer ${SERVICE_KEY}`,
26
+ })
27
+ ```
28
+
29
+ ### Handling resources
30
+
31
+ #### Handling Storage Buckets
32
+
33
+ - Create a new Storage bucket:
34
+
35
+ ```js
36
+ const { data, error } = await storageClient.createBucket(
37
+ 'test_bucket', // Bucket name (must be unique)
38
+ { public: false } // Bucket options
39
+ )
40
+ ```
41
+
42
+ - Retrieve the details of an existing Storage bucket:
43
+
44
+ ```js
45
+ const { data, error } = await storageClient.getBucket('test_bucket')
46
+ ```
47
+
48
+ - Update a new Storage bucket:
49
+
50
+ ```js
51
+ const { data, error } = await storageClient.updateBucket(
52
+ 'test_bucket', // Bucket name
53
+ { public: false } // Bucket options
54
+ )
55
+ ```
56
+
57
+ - Remove all objects inside a single bucket:
58
+
59
+ ```js
60
+ const { data, error } = await storageClient.emptyBucket('test_bucket')
61
+ ```
62
+
63
+ - Delete an existing bucket (a bucket can't be deleted with existing objects inside it):
64
+
65
+ ```js
66
+ const { data, error } = await storageClient.deleteBucket('test_bucket')
67
+ ```
68
+
69
+ - Retrieve the details of all Storage buckets within an existing project:
70
+
71
+ ```js
72
+ const { data, error } = await storageClient.listBuckets()
73
+ ```
74
+
75
+ #### Handling Files
76
+
77
+ - Upload a file to an existing bucket:
78
+
79
+ ```js
80
+ const fileBody = ... // load your file here
81
+
82
+ const { data, error } = await storageClient.from('bucket').upload('path/to/file', fileBody)
83
+ ```
84
+
85
+ > Note: The `upload` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-upload).
86
+
87
+ - Download a file from an exisiting bucket:
88
+
89
+ ```js
90
+ const { data, error } = await storageClient.from('bucket').download('path/to/file')
91
+ ```
92
+
93
+ - List all the files within a bucket:
94
+
95
+ ```js
96
+ const { data, error } = await storageClient.from('bucket').list('folder')
97
+ ```
98
+
99
+ > Note: The `list` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-list).
100
+
101
+ - Replace an existing file at the specified path with a new one:
102
+
103
+ ```js
104
+ const fileBody = ... // load your file here
105
+
106
+ const { data, error } = await storageClient
107
+ .from('bucket')
108
+ .update('path/to/file', fileBody)
109
+ ```
110
+
111
+ > Note: The `upload` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-upload).
112
+
113
+ - Move an existing file:
114
+
115
+ ```js
116
+ const { data, error } = await storageClient
117
+ .from('bucket')
118
+ .move('old/path/to/file', 'new/path/to/file')
119
+ ```
120
+
121
+ - Delete files within the same bucket:
122
+
123
+ ```js
124
+ const { data, error } = await storageClient.from('bucket').remove(['path/to/file'])
125
+ ```
126
+
127
+ - Create signed URL to download file without requiring permissions:
128
+
129
+ ```js
130
+ const expireIn = 60
131
+
132
+ const { data, error } = await storageClient
133
+ .from('bucket')
134
+ .createSignedUrl('path/to/file', expireIn)
135
+ ```
136
+
137
+ - Retrieve URLs for assets in public buckets:
138
+
139
+ ```js
140
+ const { data, error } = await storageClient.from('public-bucket').getPublicUrl('path/to/file')
141
+ ```
142
+
7
143
  ## Sponsors
8
144
 
9
145
  We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
@@ -1,6 +1,6 @@
1
1
  import { StorageBucketApi, StorageFileApi } from './lib';
2
2
  import { Fetch } from './lib/fetch';
3
- export declare class SupabaseStorageClient extends StorageBucketApi {
3
+ export declare class StorageClient extends StorageBucketApi {
4
4
  constructor(url: string, headers?: {
5
5
  [key: string]: string;
6
6
  }, fetch?: Fetch);
@@ -11,4 +11,4 @@ export declare class SupabaseStorageClient extends StorageBucketApi {
11
11
  */
12
12
  from(id: string): StorageFileApi;
13
13
  }
14
- //# sourceMappingURL=SupabaseStorageClient.d.ts.map
14
+ //# sourceMappingURL=StorageClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageClient.d.ts","sourceRoot":"","sources":["../../src/StorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,qBAAa,aAAc,SAAQ,gBAAgB;gBACrC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI/E;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc;CAGjC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SupabaseStorageClient = void 0;
3
+ exports.StorageClient = void 0;
4
4
  const lib_1 = require("./lib");
5
- class SupabaseStorageClient extends lib_1.StorageBucketApi {
5
+ class StorageClient extends lib_1.StorageBucketApi {
6
6
  constructor(url, headers = {}, fetch) {
7
7
  super(url, headers, fetch);
8
8
  }
@@ -15,5 +15,5 @@ class SupabaseStorageClient extends lib_1.StorageBucketApi {
15
15
  return new lib_1.StorageFileApi(this.url, this.headers, id, this.fetch);
16
16
  }
17
17
  }
18
- exports.SupabaseStorageClient = SupabaseStorageClient;
19
- //# sourceMappingURL=SupabaseStorageClient.js.map
18
+ exports.StorageClient = StorageClient;
19
+ //# sourceMappingURL=StorageClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageClient.js","sourceRoot":"","sources":["../../src/StorageClient.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAGxD,MAAa,aAAc,SAAQ,sBAAgB;IACjD,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAC7E,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;CACF;AAbD,sCAaC"}
@@ -1,4 +1,3 @@
1
- import { SupabaseStorageClient } from './SupabaseStorageClient';
2
- export { SupabaseStorageClient };
1
+ export { StorageClient as StorageClient, StorageClient as SupabaseStorageClient, } from './StorageClient';
3
2
  export * from './lib/types';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAChC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,aAAa,IAAI,qBAAqB,GACvC,MAAM,iBAAiB,CAAA;AACxB,cAAc,aAAa,CAAA"}
@@ -10,8 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.SupabaseStorageClient = void 0;
14
- const SupabaseStorageClient_1 = require("./SupabaseStorageClient");
15
- Object.defineProperty(exports, "SupabaseStorageClient", { enumerable: true, get: function () { return SupabaseStorageClient_1.SupabaseStorageClient; } });
13
+ exports.SupabaseStorageClient = exports.StorageClient = void 0;
14
+ var StorageClient_1 = require("./StorageClient");
15
+ Object.defineProperty(exports, "StorageClient", { enumerable: true, get: function () { return StorageClient_1.StorageClient; } });
16
+ Object.defineProperty(exports, "SupabaseStorageClient", { enumerable: true, get: function () { return StorageClient_1.StorageClient; } });
16
17
  __exportStar(require("./lib/types"), exports);
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mEAA+D;AAEtD,sGAFA,6CAAqB,OAEA;AAC9B,8CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAGwB;AAFtB,8GAAA,aAAa,OAAiB;AAC9B,sHAAA,aAAa,OAAyB;AAExC,8CAA2B"}
@@ -10,7 +10,7 @@ export declare class StorageBucketApi {
10
10
  [key: string]: string;
11
11
  }, fetch?: Fetch);
12
12
  /**
13
- * Retrieves the details of all Storage buckets within an existing product.
13
+ * Retrieves the details of all Storage buckets within an existing project.
14
14
  */
15
15
  listBuckets(): Promise<{
16
16
  data: Bucket[] | null;
@@ -40,7 +40,7 @@ export declare class StorageBucketApi {
40
40
  /**
41
41
  * Updates a new Storage bucket
42
42
  *
43
- * @param id A unique identifier for the bucket you are creating.
43
+ * @param id A unique identifier for the bucket you are updating.
44
44
  */
45
45
  updateBucket(id: string, options: {
46
46
  public: boolean;
@@ -20,7 +20,7 @@ class StorageBucketApi {
20
20
  this.fetch = helpers_1.resolveFetch(fetch);
21
21
  }
22
22
  /**
23
- * Retrieves the details of all Storage buckets within an existing product.
23
+ * Retrieves the details of all Storage buckets within an existing project.
24
24
  */
25
25
  listBuckets() {
26
26
  return __awaiter(this, void 0, void 0, function* () {
@@ -69,7 +69,7 @@ class StorageBucketApi {
69
69
  /**
70
70
  * Updates a new Storage bucket
71
71
  *
72
- * @param id A unique identifier for the bucket you are creating.
72
+ * @param id A unique identifier for the bucket you are updating.
73
73
  */
74
74
  updateBucket(id, options) {
75
75
  return __awaiter(this, void 0, void 0, function* () {
@@ -33,6 +33,8 @@ export interface SearchOptions {
33
33
  offset?: number;
34
34
  /** The column to sort by. Can be any column inside a FileObject. */
35
35
  sortBy?: SortBy;
36
+ /** The search string to filter files by. */
37
+ search?: string;
36
38
  }
37
39
  export interface Metadata {
38
40
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,EAAE,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,EAAE,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb"}
@@ -1,6 +1,6 @@
1
1
  import { StorageBucketApi, StorageFileApi } from './lib';
2
2
  import { Fetch } from './lib/fetch';
3
- export declare class SupabaseStorageClient extends StorageBucketApi {
3
+ export declare class StorageClient extends StorageBucketApi {
4
4
  constructor(url: string, headers?: {
5
5
  [key: string]: string;
6
6
  }, fetch?: Fetch);
@@ -11,4 +11,4 @@ export declare class SupabaseStorageClient extends StorageBucketApi {
11
11
  */
12
12
  from(id: string): StorageFileApi;
13
13
  }
14
- //# sourceMappingURL=SupabaseStorageClient.d.ts.map
14
+ //# sourceMappingURL=StorageClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageClient.d.ts","sourceRoot":"","sources":["../../src/StorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,qBAAa,aAAc,SAAQ,gBAAgB;gBACrC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI/E;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc;CAGjC"}
@@ -1,5 +1,5 @@
1
1
  import { StorageBucketApi, StorageFileApi } from './lib';
2
- export class SupabaseStorageClient extends StorageBucketApi {
2
+ export class StorageClient extends StorageBucketApi {
3
3
  constructor(url, headers = {}, fetch) {
4
4
  super(url, headers, fetch);
5
5
  }
@@ -12,4 +12,4 @@ export class SupabaseStorageClient extends StorageBucketApi {
12
12
  return new StorageFileApi(this.url, this.headers, id, this.fetch);
13
13
  }
14
14
  }
15
- //# sourceMappingURL=SupabaseStorageClient.js.map
15
+ //# sourceMappingURL=StorageClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageClient.js","sourceRoot":"","sources":["../../src/StorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGxD,MAAM,OAAO,aAAc,SAAQ,gBAAgB;IACjD,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAC7E,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;CACF"}
@@ -1,4 +1,3 @@
1
- import { SupabaseStorageClient } from './SupabaseStorageClient';
2
- export { SupabaseStorageClient };
1
+ export { StorageClient as StorageClient, StorageClient as SupabaseStorageClient, } from './StorageClient';
3
2
  export * from './lib/types';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAChC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,aAAa,IAAI,qBAAqB,GACvC,MAAM,iBAAiB,CAAA;AACxB,cAAc,aAAa,CAAA"}
@@ -1,4 +1,3 @@
1
- import { SupabaseStorageClient } from './SupabaseStorageClient';
2
- export { SupabaseStorageClient };
1
+ export { StorageClient as StorageClient, StorageClient as SupabaseStorageClient, } from './StorageClient';
3
2
  export * from './lib/types';
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAChC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,aAAa,IAAI,qBAAqB,GACvC,MAAM,iBAAiB,CAAA;AACxB,cAAc,aAAa,CAAA"}
@@ -10,7 +10,7 @@ export declare class StorageBucketApi {
10
10
  [key: string]: string;
11
11
  }, fetch?: Fetch);
12
12
  /**
13
- * Retrieves the details of all Storage buckets within an existing product.
13
+ * Retrieves the details of all Storage buckets within an existing project.
14
14
  */
15
15
  listBuckets(): Promise<{
16
16
  data: Bucket[] | null;
@@ -40,7 +40,7 @@ export declare class StorageBucketApi {
40
40
  /**
41
41
  * Updates a new Storage bucket
42
42
  *
43
- * @param id A unique identifier for the bucket you are creating.
43
+ * @param id A unique identifier for the bucket you are updating.
44
44
  */
45
45
  updateBucket(id: string, options: {
46
46
  public: boolean;
@@ -17,7 +17,7 @@ export class StorageBucketApi {
17
17
  this.fetch = resolveFetch(fetch);
18
18
  }
19
19
  /**
20
- * Retrieves the details of all Storage buckets within an existing product.
20
+ * Retrieves the details of all Storage buckets within an existing project.
21
21
  */
22
22
  listBuckets() {
23
23
  return __awaiter(this, void 0, void 0, function* () {
@@ -66,7 +66,7 @@ export class StorageBucketApi {
66
66
  /**
67
67
  * Updates a new Storage bucket
68
68
  *
69
- * @param id A unique identifier for the bucket you are creating.
69
+ * @param id A unique identifier for the bucket you are updating.
70
70
  */
71
71
  updateBucket(id, options) {
72
72
  return __awaiter(this, void 0, void 0, function* () {
@@ -33,6 +33,8 @@ export interface SearchOptions {
33
33
  offset?: number;
34
34
  /** The column to sort by. Can be any column inside a FileObject. */
35
35
  sortBy?: SortBy;
36
+ /** The search string to filter files by. */
37
+ search?: string;
36
38
  }
37
39
  export interface Metadata {
38
40
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,EAAE,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,EAAE,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb"}
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.supabase=e():t.supabase=e()}(self,(function(){return t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=f(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,n,o=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},v.call(g.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];w.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function j(t,r){return new Promise((function(n,i){var s=new g(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new w(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}j.polyfill=!0,t.fetch||(t.fetch=j,t.Headers=l,t.Request=g,t.Response=w),e.Headers=l,e.Request=g,e.Response=w,e.fetch=j,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e},215:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SupabaseStorageClient=void 0;const n=r(965);class o extends n.StorageBucketApi{constructor(t,e={},r){super(t,e,r)}from(t){return new n.StorageFileApi(this.url,this.headers,t,this.fetch)}}e.SupabaseStorageClient=o},341:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupabaseStorageClient=void 0;const i=r(215);Object.defineProperty(e,"SupabaseStorageClient",{enumerable:!0,get:function(){return i.SupabaseStorageClient}}),o(r(717),e)},150:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageBucketApi=void 0;const o=r(678),i=r(716),s=r(610);e.StorageBucketApi=class{constructor(t,e={},r){this.url=t,this.headers=Object.assign(Object.assign({},o.DEFAULT_HEADERS),e),this.fetch=s.resolveFetch(r)}listBuckets(){return n(this,void 0,void 0,(function*(){try{return{data:yield i.get(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}getBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.get(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}createBucket(t,e={public:!1}){return n(this,void 0,void 0,(function*(){try{return{data:(yield i.post(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:e.public},{headers:this.headers})).name,error:null}}catch(t){return{data:null,error:t}}}))}updateBucket(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield i.put(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:e.public},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}emptyBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.post(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}deleteBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.remove(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}}},948:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageFileApi=void 0;const o=r(716),i=r(610),s={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},a={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};e.StorageFileApi=class{constructor(t,e={},r,n){this.url=t,this.headers=e,this.bucketId=r,this.fetch=i.resolveFetch(n)}uploadOrUpdate(t,e,r,o){return n(this,void 0,void 0,(function*(){try{let n;const i=Object.assign(Object.assign({},a),o),s=Object.assign(Object.assign({},this.headers),"POST"===t&&{"x-upsert":String(i.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?(n=new FormData,n.append("cacheControl",i.cacheControl),n.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(n=r,n.append("cacheControl",i.cacheControl)):(n=r,s["cache-control"]=`max-age=${i.cacheControl}`,s["content-type"]=i.contentType);const u=this._removeEmptyFolders(e),c=this._getFinalPath(u),h=yield this.fetch(`${this.url}/object/${c}`,{method:t,body:n,headers:s});return h.ok?{data:{Key:c},error:null}:{data:null,error:yield h.json()}}catch(t){return{data:null,error:t}}}))}upload(t,e,r){return n(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",t,e,r)}))}update(t,e,r){return n(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",t,e,r)}))}move(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield o.post(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:e},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}copy(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield o.post(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:e},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}createSignedUrl(t,e){return n(this,void 0,void 0,(function*(){try{const r=this._getFinalPath(t);let n=yield o.post(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:e},{headers:this.headers});const i=`${this.url}${n.signedURL}`;return n={signedURL:i},{data:n,error:null,signedURL:i}}catch(t){return{data:null,error:t,signedURL:null}}}))}createSignedUrls(t,e){return n(this,void 0,void 0,(function*(){try{return{data:(yield o.post(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:e,paths:t},{headers:this.headers})).map((t=>Object.assign(Object.assign({},t),{signedURL:t.signedURL?`${this.url}${t.signedURL}`:null}))),error:null}}catch(t){return{data:null,error:t}}}))}download(t){return n(this,void 0,void 0,(function*(){try{const e=this._getFinalPath(t),r=yield o.get(this.fetch,`${this.url}/object/${e}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(t){return{data:null,error:t}}}))}getPublicUrl(t){try{const e=this._getFinalPath(t),r=`${this.url}/object/public/${e}`;return{data:{publicURL:r},error:null,publicURL:r}}catch(t){return{data:null,error:t,publicURL:null}}}remove(t){return n(this,void 0,void 0,(function*(){try{return{data:yield o.remove(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}list(t,e,r){return n(this,void 0,void 0,(function*(){try{const n=Object.assign(Object.assign(Object.assign({},s),e),{prefix:t||""});return{data:yield o.post(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(t){return{data:null,error:t}}}))}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}}},678:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_HEADERS=void 0;const n=r(506);e.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${n.version}`}},716:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.remove=e.put=e.post=e.get=void 0;const n=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t);function o(t,e,o,i,s,a){return r(this,void 0,void 0,(function*(){return new Promise(((r,u)=>{t(o,((t,e,r,n)=>{const o={method:t,headers:(null==e?void 0:e.headers)||{}};return"GET"===t?o:(o.headers=Object.assign({"Content-Type":"application/json"},null==e?void 0:e.headers),o.body=JSON.stringify(n),Object.assign(Object.assign({},o),r))})(e,i,s,a)).then((t=>{if(!t.ok)throw t;return(null==i?void 0:i.noResolveJson)?r(t):t.json()})).then((t=>r(t))).catch((t=>((t,e)=>{if("function"!=typeof t.json)return e(t);t.json().then((r=>e({message:n(r),status:(null==t?void 0:t.status)||500})))})(t,u)))}))}))}e.get=function(t,e,n,i){return r(this,void 0,void 0,(function*(){return o(t,"GET",e,n,i)}))},e.post=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"POST",e,i,s,n)}))},e.put=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"PUT",e,i,s,n)}))},e.remove=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"DELETE",e,i,s,n)}))}},610:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveFetch=void 0;const o=n(r(98));e.resolveFetch=t=>{let e;return e=t||("undefined"==typeof fetch?o.default:fetch),(...t)=>e(...t)}},965:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(150),e),o(r(948),e),o(r(717),e),o(r(678),e)},717:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},506:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version="0.0.0"}},e={},function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(341);var t,e}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.supabase=e():t.supabase=e()}(self,(function(){return t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=f(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,n,o=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},v.call(g.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];w.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function j(t,r){return new Promise((function(n,i){var s=new g(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new w(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}j.polyfill=!0,t.fetch||(t.fetch=j,t.Headers=l,t.Request=g,t.Response=w),e.Headers=l,e.Request=g,e.Response=w,e.fetch=j,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e},274:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StorageClient=void 0;const n=r(965);class o extends n.StorageBucketApi{constructor(t,e={},r){super(t,e,r)}from(t){return new n.StorageFileApi(this.url,this.headers,t,this.fetch)}}e.StorageClient=o},341:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupabaseStorageClient=e.StorageClient=void 0;var i=r(274);Object.defineProperty(e,"StorageClient",{enumerable:!0,get:function(){return i.StorageClient}}),Object.defineProperty(e,"SupabaseStorageClient",{enumerable:!0,get:function(){return i.StorageClient}}),o(r(717),e)},150:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageBucketApi=void 0;const o=r(678),i=r(716),s=r(610);e.StorageBucketApi=class{constructor(t,e={},r){this.url=t,this.headers=Object.assign(Object.assign({},o.DEFAULT_HEADERS),e),this.fetch=s.resolveFetch(r)}listBuckets(){return n(this,void 0,void 0,(function*(){try{return{data:yield i.get(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}getBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.get(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}createBucket(t,e={public:!1}){return n(this,void 0,void 0,(function*(){try{return{data:(yield i.post(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:e.public},{headers:this.headers})).name,error:null}}catch(t){return{data:null,error:t}}}))}updateBucket(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield i.put(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:e.public},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}emptyBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.post(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}deleteBucket(t){return n(this,void 0,void 0,(function*(){try{return{data:yield i.remove(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}}},948:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageFileApi=void 0;const o=r(716),i=r(610),s={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},a={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};e.StorageFileApi=class{constructor(t,e={},r,n){this.url=t,this.headers=e,this.bucketId=r,this.fetch=i.resolveFetch(n)}uploadOrUpdate(t,e,r,o){return n(this,void 0,void 0,(function*(){try{let n;const i=Object.assign(Object.assign({},a),o),s=Object.assign(Object.assign({},this.headers),"POST"===t&&{"x-upsert":String(i.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?(n=new FormData,n.append("cacheControl",i.cacheControl),n.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(n=r,n.append("cacheControl",i.cacheControl)):(n=r,s["cache-control"]=`max-age=${i.cacheControl}`,s["content-type"]=i.contentType);const u=this._removeEmptyFolders(e),c=this._getFinalPath(u),h=yield this.fetch(`${this.url}/object/${c}`,{method:t,body:n,headers:s});return h.ok?{data:{Key:c},error:null}:{data:null,error:yield h.json()}}catch(t){return{data:null,error:t}}}))}upload(t,e,r){return n(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",t,e,r)}))}update(t,e,r){return n(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",t,e,r)}))}move(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield o.post(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:e},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}copy(t,e){return n(this,void 0,void 0,(function*(){try{return{data:yield o.post(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:e},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}createSignedUrl(t,e){return n(this,void 0,void 0,(function*(){try{const r=this._getFinalPath(t);let n=yield o.post(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:e},{headers:this.headers});const i=`${this.url}${n.signedURL}`;return n={signedURL:i},{data:n,error:null,signedURL:i}}catch(t){return{data:null,error:t,signedURL:null}}}))}createSignedUrls(t,e){return n(this,void 0,void 0,(function*(){try{return{data:(yield o.post(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:e,paths:t},{headers:this.headers})).map((t=>Object.assign(Object.assign({},t),{signedURL:t.signedURL?`${this.url}${t.signedURL}`:null}))),error:null}}catch(t){return{data:null,error:t}}}))}download(t){return n(this,void 0,void 0,(function*(){try{const e=this._getFinalPath(t),r=yield o.get(this.fetch,`${this.url}/object/${e}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(t){return{data:null,error:t}}}))}getPublicUrl(t){try{const e=this._getFinalPath(t),r=`${this.url}/object/public/${e}`;return{data:{publicURL:r},error:null,publicURL:r}}catch(t){return{data:null,error:t,publicURL:null}}}remove(t){return n(this,void 0,void 0,(function*(){try{return{data:yield o.remove(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}}))}list(t,e,r){return n(this,void 0,void 0,(function*(){try{const n=Object.assign(Object.assign(Object.assign({},s),e),{prefix:t||""});return{data:yield o.post(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(t){return{data:null,error:t}}}))}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}}},678:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_HEADERS=void 0;const n=r(506);e.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${n.version}`}},716:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.remove=e.put=e.post=e.get=void 0;const n=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t);function o(t,e,o,i,s,a){return r(this,void 0,void 0,(function*(){return new Promise(((r,u)=>{t(o,((t,e,r,n)=>{const o={method:t,headers:(null==e?void 0:e.headers)||{}};return"GET"===t?o:(o.headers=Object.assign({"Content-Type":"application/json"},null==e?void 0:e.headers),o.body=JSON.stringify(n),Object.assign(Object.assign({},o),r))})(e,i,s,a)).then((t=>{if(!t.ok)throw t;return(null==i?void 0:i.noResolveJson)?r(t):t.json()})).then((t=>r(t))).catch((t=>((t,e)=>{if("function"!=typeof t.json)return e(t);t.json().then((r=>e({message:n(r),status:(null==t?void 0:t.status)||500})))})(t,u)))}))}))}e.get=function(t,e,n,i){return r(this,void 0,void 0,(function*(){return o(t,"GET",e,n,i)}))},e.post=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"POST",e,i,s,n)}))},e.put=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"PUT",e,i,s,n)}))},e.remove=function(t,e,n,i,s){return r(this,void 0,void 0,(function*(){return o(t,"DELETE",e,i,s,n)}))}},610:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveFetch=void 0;const o=n(r(98));e.resolveFetch=t=>{let e;return e=t||("undefined"==typeof fetch?o.default:fetch),(...t)=>e(...t)}},965:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(150),e),o(r(948),e),o(r(717),e),o(r(678),e)},717:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},506:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version="0.0.0"}},e={},function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(341);var t,e}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/storage-js",
3
- "version": "1.6.4",
3
+ "version": "1.7.1",
4
4
  "description": "Isomorphic storage client for Supabase.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "main": "dist/main/index.js",
19
19
  "module": "dist/module/index.js",
20
- "types": "dist/main/index.d.ts",
20
+ "types": "dist/module/index.d.ts",
21
21
  "sideEffects": false,
22
22
  "repository": "supabase/storage-js",
23
23
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  import { StorageBucketApi, StorageFileApi } from './lib'
2
2
  import { Fetch } from './lib/fetch'
3
3
 
4
- export class SupabaseStorageClient extends StorageBucketApi {
4
+ export class StorageClient extends StorageBucketApi {
5
5
  constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {
6
6
  super(url, headers, fetch)
7
7
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { SupabaseStorageClient } from './SupabaseStorageClient'
2
-
3
- export { SupabaseStorageClient }
1
+ export {
2
+ StorageClient as StorageClient,
3
+ StorageClient as SupabaseStorageClient,
4
+ } from './StorageClient'
4
5
  export * from './lib/types'
@@ -15,7 +15,7 @@ export class StorageBucketApi {
15
15
  }
16
16
 
17
17
  /**
18
- * Retrieves the details of all Storage buckets within an existing product.
18
+ * Retrieves the details of all Storage buckets within an existing project.
19
19
  */
20
20
  async listBuckets(): Promise<{ data: Bucket[] | null; error: Error | null }> {
21
21
  try {
@@ -66,7 +66,7 @@ export class StorageBucketApi {
66
66
  /**
67
67
  * Updates a new Storage bucket
68
68
  *
69
- * @param id A unique identifier for the bucket you are creating.
69
+ * @param id A unique identifier for the bucket you are updating.
70
70
  */
71
71
  async updateBucket(
72
72
  id: string,
package/src/lib/types.ts CHANGED
@@ -39,6 +39,9 @@ export interface SearchOptions {
39
39
 
40
40
  /** The column to sort by. Can be any column inside a FileObject. */
41
41
  sortBy?: SortBy
42
+
43
+ /** The search string to filter files by. */
44
+ search?: string
42
45
  }
43
46
 
44
47
  // TODO: need to check for metadata props. The api swagger doesnt have.
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseStorageClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI/E;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc;CAGjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseStorageClient.js","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;AAGxD,MAAa,qBAAsB,SAAQ,sBAAgB;IACzD,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAC7E,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;CACF;AAbD,sDAaC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseStorageClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI/E;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc;CAGjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseStorageClient.js","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGxD,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IACzD,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAC7E,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;CACF"}