@supabase/storage-js 1.6.5 → 1.7.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/README.md +136 -0
- package/dist/main/lib/StorageBucketApi.d.ts +2 -2
- package/dist/main/lib/StorageBucketApi.js +2 -2
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +28 -4
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +2 -0
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/module/lib/StorageBucketApi.d.ts +2 -2
- package/dist/module/lib/StorageBucketApi.js +2 -2
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +10 -2
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +2 -0
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +1 -1
- package/src/lib/StorageBucketApi.ts +2 -2
- package/src/lib/helpers.ts +1 -3
- package/src/lib/types.ts +3 -0
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.
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK,GAAG,OAAO,KAAK,CAAA;AAEzB,eAAO,MAAM,YAAY,8CAA0B,KAUlD,CAAA"}
|
package/dist/main/lib/helpers.js
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
4
29
|
};
|
|
5
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
31
|
exports.resolveFetch = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
32
|
exports.resolveFetch = (customFetch) => {
|
|
9
33
|
let _fetch;
|
|
10
34
|
if (customFetch) {
|
|
11
35
|
_fetch = customFetch;
|
|
12
36
|
}
|
|
13
37
|
else if (typeof fetch === 'undefined') {
|
|
14
|
-
_fetch =
|
|
38
|
+
_fetch = (...args) => __awaiter(void 0, void 0, void 0, function* () { return yield (yield Promise.resolve().then(() => __importStar(require('cross-fetch')))).fetch(...args); });
|
|
15
39
|
}
|
|
16
40
|
else {
|
|
17
41
|
_fetch = fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEa,QAAA,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAA;KACrB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,CAAO,GAAG,IAAI,EAAE,EAAE,kDAAC,OAAA,MAAM,CAAC,wDAAa,aAAa,GAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA,GAAA,CAAA;KAC/E;SAAM;QACL,MAAM,GAAG,KAAK,CAAA;KACf;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA"}
|
package/dist/main/lib/types.d.ts
CHANGED
|
@@ -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"}
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK,GAAG,OAAO,KAAK,CAAA;AAEzB,eAAO,MAAM,YAAY,8CAA0B,KAUlD,CAAA"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
2
10
|
export const resolveFetch = (customFetch) => {
|
|
3
11
|
let _fetch;
|
|
4
12
|
if (customFetch) {
|
|
5
13
|
_fetch = customFetch;
|
|
6
14
|
}
|
|
7
15
|
else if (typeof fetch === 'undefined') {
|
|
8
|
-
_fetch =
|
|
16
|
+
_fetch = (...args) => __awaiter(void 0, void 0, void 0, function* () { return yield (yield import('cross-fetch')).fetch(...args); });
|
|
9
17
|
}
|
|
10
18
|
else {
|
|
11
19
|
_fetch = fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;;;;AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAA;KACrB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,CAAO,GAAG,IAAI,EAAE,EAAE,kDAAC,OAAA,MAAM,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA,GAAA,CAAA;KAC/E;SAAM;QACL,MAAM,GAAG,KAAK,CAAA;KACf;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA"}
|
|
@@ -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"}
|
package/dist/umd/supabase.js
CHANGED
|
@@ -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},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}));
|
|
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.__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.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},s=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.resolveFetch=void 0,e.resolveFetch=t=>{let e;return e=t||("undefined"==typeof fetch?(...t)=>s(void 0,void 0,void 0,(function*(){return yield(yield Promise.resolve().then((()=>i(r(98))))).fetch(...t)})):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
|
@@ -15,7 +15,7 @@ export class StorageBucketApi {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Retrieves the details of all Storage buckets within an existing
|
|
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
|
|
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/helpers.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch'
|
|
2
|
-
|
|
3
1
|
type Fetch = typeof fetch
|
|
4
2
|
|
|
5
3
|
export const resolveFetch = (customFetch?: Fetch): Fetch => {
|
|
@@ -7,7 +5,7 @@ export const resolveFetch = (customFetch?: Fetch): Fetch => {
|
|
|
7
5
|
if (customFetch) {
|
|
8
6
|
_fetch = customFetch
|
|
9
7
|
} else if (typeof fetch === 'undefined') {
|
|
10
|
-
_fetch = (
|
|
8
|
+
_fetch = async (...args) => await (await import('cross-fetch')).fetch(...args)
|
|
11
9
|
} else {
|
|
12
10
|
_fetch = fetch
|
|
13
11
|
}
|
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.
|