@supabase/storage-js 1.4.1 → 1.6.0
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/dist/main/SupabaseStorageClient.d.ts +2 -1
- package/dist/main/SupabaseStorageClient.d.ts.map +1 -1
- package/dist/main/SupabaseStorageClient.js +3 -3
- package/dist/main/SupabaseStorageClient.js.map +1 -1
- package/dist/main/lib/StorageBucketApi.d.ts +3 -1
- package/dist/main/lib/StorageBucketApi.d.ts.map +1 -1
- package/dist/main/lib/StorageBucketApi.js +8 -7
- package/dist/main/lib/StorageBucketApi.js.map +1 -1
- package/dist/main/lib/StorageFileApi.d.ts +33 -6
- package/dist/main/lib/StorageFileApi.d.ts.map +1 -1
- package/dist/main/lib/StorageFileApi.js +53 -12
- package/dist/main/lib/StorageFileApi.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +5 -4
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +10 -10
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/module/SupabaseStorageClient.d.ts +2 -1
- package/dist/module/SupabaseStorageClient.d.ts.map +1 -1
- package/dist/module/SupabaseStorageClient.js +3 -3
- package/dist/module/SupabaseStorageClient.js.map +1 -1
- package/dist/module/lib/StorageBucketApi.d.ts +3 -1
- package/dist/module/lib/StorageBucketApi.d.ts.map +1 -1
- package/dist/module/lib/StorageBucketApi.js +8 -7
- package/dist/module/lib/StorageBucketApi.js.map +1 -1
- package/dist/module/lib/StorageFileApi.d.ts +33 -6
- package/dist/module/lib/StorageFileApi.d.ts.map +1 -1
- package/dist/module/lib/StorageFileApi.js +53 -12
- package/dist/module/lib/StorageFileApi.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +5 -4
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +11 -11
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +2 -2
- package/src/SupabaseStorageClient.ts +4 -3
- package/src/lib/StorageBucketApi.ts +20 -6
- package/src/lib/StorageFileApi.ts +75 -9
- package/src/lib/fetch.ts +13 -6
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { StorageBucketApi, StorageFileApi } from './lib';
|
|
2
|
+
import { Fetch } from './lib/fetch';
|
|
2
3
|
export declare class SupabaseStorageClient extends StorageBucketApi {
|
|
3
4
|
constructor(url: string, headers?: {
|
|
4
5
|
[key: string]: string;
|
|
5
|
-
});
|
|
6
|
+
}, fetch?: Fetch);
|
|
6
7
|
/**
|
|
7
8
|
* Perform file operation in a bucket.
|
|
8
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseStorageClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
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"}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SupabaseStorageClient = void 0;
|
|
4
4
|
const lib_1 = require("./lib");
|
|
5
5
|
class SupabaseStorageClient extends lib_1.StorageBucketApi {
|
|
6
|
-
constructor(url, headers = {}) {
|
|
7
|
-
super(url, headers);
|
|
6
|
+
constructor(url, headers = {}, fetch) {
|
|
7
|
+
super(url, headers, fetch);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Perform file operation in a bucket.
|
|
@@ -12,7 +12,7 @@ class SupabaseStorageClient extends lib_1.StorageBucketApi {
|
|
|
12
12
|
* @param id The bucket id to operate on.
|
|
13
13
|
*/
|
|
14
14
|
from(id) {
|
|
15
|
-
return new lib_1.StorageFileApi(this.url, this.headers, id);
|
|
15
|
+
return new lib_1.StorageFileApi(this.url, this.headers, id, this.fetch);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.SupabaseStorageClient = SupabaseStorageClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseStorageClient.js","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":";;;AAAA,+BAAwD;
|
|
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,12 +1,14 @@
|
|
|
1
|
+
import { Fetch } from './fetch';
|
|
1
2
|
import { Bucket } from './types';
|
|
2
3
|
export declare class StorageBucketApi {
|
|
3
4
|
protected url: string;
|
|
4
5
|
protected headers: {
|
|
5
6
|
[key: string]: string;
|
|
6
7
|
};
|
|
8
|
+
protected fetch?: Fetch;
|
|
7
9
|
constructor(url: string, headers?: {
|
|
8
10
|
[key: string]: string;
|
|
9
|
-
});
|
|
11
|
+
}, fetch?: Fetch);
|
|
10
12
|
/**
|
|
11
13
|
* Retrieves the details of all Storage buckets within an existing product.
|
|
12
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageBucketApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageBucketApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA0B,MAAM,SAAS,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGhC,qBAAa,gBAAgB;IAC3B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;gBAEX,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAM/E;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;IAS5E;;;;OAIG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;IASlF;;;;;OAKG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAsB,GAC/C,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;IAcxD;;;;OAIG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAC3B,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;IAcrE;;;;OAIG;IACG,WAAW,CACf,EAAE,EAAE,MAAM,GACT,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;IAcrE;;;;;OAKG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC;CAatE"}
|
|
@@ -13,9 +13,10 @@ exports.StorageBucketApi = void 0;
|
|
|
13
13
|
const fetch_1 = require("./fetch");
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
15
|
class StorageBucketApi {
|
|
16
|
-
constructor(url, headers = {}) {
|
|
16
|
+
constructor(url, headers = {}, fetch) {
|
|
17
17
|
this.url = url;
|
|
18
18
|
this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
|
|
19
|
+
this.fetch = fetch;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Retrieves the details of all Storage buckets within an existing product.
|
|
@@ -23,7 +24,7 @@ class StorageBucketApi {
|
|
|
23
24
|
listBuckets() {
|
|
24
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
26
|
try {
|
|
26
|
-
const data = yield fetch_1.get(`${this.url}/bucket`, { headers: this.headers });
|
|
27
|
+
const data = yield fetch_1.get(this.fetch, `${this.url}/bucket`, { headers: this.headers });
|
|
27
28
|
return { data, error: null };
|
|
28
29
|
}
|
|
29
30
|
catch (error) {
|
|
@@ -39,7 +40,7 @@ class StorageBucketApi {
|
|
|
39
40
|
getBucket(id) {
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
42
|
try {
|
|
42
|
-
const data = yield fetch_1.get(`${this.url}/bucket/${id}`, { headers: this.headers });
|
|
43
|
+
const data = yield fetch_1.get(this.fetch, `${this.url}/bucket/${id}`, { headers: this.headers });
|
|
43
44
|
return { data, error: null };
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
@@ -56,7 +57,7 @@ class StorageBucketApi {
|
|
|
56
57
|
createBucket(id, options = { public: false }) {
|
|
57
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
59
|
try {
|
|
59
|
-
const data = yield fetch_1.post(`${this.url}/bucket`, { id, name: id, public: options.public }, { headers: this.headers });
|
|
60
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/bucket`, { id, name: id, public: options.public }, { headers: this.headers });
|
|
60
61
|
return { data: data.name, error: null };
|
|
61
62
|
}
|
|
62
63
|
catch (error) {
|
|
@@ -72,7 +73,7 @@ class StorageBucketApi {
|
|
|
72
73
|
updateBucket(id, options) {
|
|
73
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
75
|
try {
|
|
75
|
-
const data = yield fetch_1.put(`${this.url}/bucket/${id}`, { id, name: id, public: options.public }, { headers: this.headers });
|
|
76
|
+
const data = yield fetch_1.put(this.fetch, `${this.url}/bucket/${id}`, { id, name: id, public: options.public }, { headers: this.headers });
|
|
76
77
|
return { data, error: null };
|
|
77
78
|
}
|
|
78
79
|
catch (error) {
|
|
@@ -88,7 +89,7 @@ class StorageBucketApi {
|
|
|
88
89
|
emptyBucket(id) {
|
|
89
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
91
|
try {
|
|
91
|
-
const data = yield fetch_1.post(`${this.url}/bucket/${id}/empty`, {}, { headers: this.headers });
|
|
92
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/bucket/${id}/empty`, {}, { headers: this.headers });
|
|
92
93
|
return { data, error: null };
|
|
93
94
|
}
|
|
94
95
|
catch (error) {
|
|
@@ -105,7 +106,7 @@ class StorageBucketApi {
|
|
|
105
106
|
deleteBucket(id) {
|
|
106
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
108
|
try {
|
|
108
|
-
const data = yield fetch_1.remove(`${this.url}/bucket/${id}`, {}, { headers: this.headers });
|
|
109
|
+
const data = yield fetch_1.remove(this.fetch, `${this.url}/bucket/${id}`, {}, { headers: this.headers });
|
|
109
110
|
return { data, error: null };
|
|
110
111
|
}
|
|
111
112
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageBucketApi.js","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"StorageBucketApi.js","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAuD;AAEvD,2CAA6C;AAE7C,MAAa,gBAAgB;IAK3B,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAC7E,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;OAEG;IACG,WAAW;;YACf,IAAI;gBACF,MAAM,IAAI,GAAG,MAAM,WAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAA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 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { FetchParameters } from './fetch';
|
|
2
|
+
import { Fetch, FetchParameters } from './fetch';
|
|
3
3
|
import { FileObject, FileOptions, SearchOptions } from './types';
|
|
4
4
|
export declare class StorageFileApi {
|
|
5
5
|
protected url: string;
|
|
@@ -7,9 +7,10 @@ export declare class StorageFileApi {
|
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|
|
9
9
|
protected bucketId?: string;
|
|
10
|
+
protected fetch?: Fetch;
|
|
10
11
|
constructor(url: string, headers?: {
|
|
11
12
|
[key: string]: string;
|
|
12
|
-
}, bucketId?: string);
|
|
13
|
+
}, bucketId?: string, fetch?: Fetch);
|
|
13
14
|
/**
|
|
14
15
|
* Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
|
|
15
16
|
*
|
|
@@ -55,10 +56,10 @@ export declare class StorageFileApi {
|
|
|
55
56
|
error: Error | null;
|
|
56
57
|
}>;
|
|
57
58
|
/**
|
|
58
|
-
* Moves an existing file
|
|
59
|
+
* Moves an existing file.
|
|
59
60
|
*
|
|
60
61
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
61
|
-
* @param toPath The new file path, including the new file name. For example `folder/image-
|
|
62
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
|
|
62
63
|
*/
|
|
63
64
|
move(fromPath: string, toPath: string): Promise<{
|
|
64
65
|
data: {
|
|
@@ -67,7 +68,19 @@ export declare class StorageFileApi {
|
|
|
67
68
|
error: Error | null;
|
|
68
69
|
}>;
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Copies an existing file.
|
|
72
|
+
*
|
|
73
|
+
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
74
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
|
|
75
|
+
*/
|
|
76
|
+
copy(fromPath: string, toPath: string): Promise<{
|
|
77
|
+
data: {
|
|
78
|
+
message: string;
|
|
79
|
+
} | null;
|
|
80
|
+
error: Error | null;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Create signed URL to download file without requiring permissions. This URL can be valid for a set number of seconds.
|
|
71
84
|
*
|
|
72
85
|
* @param path The file path to be downloaded, including the current file name. For example `folder/image.png`.
|
|
73
86
|
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
@@ -79,6 +92,19 @@ export declare class StorageFileApi {
|
|
|
79
92
|
error: Error | null;
|
|
80
93
|
signedURL: string | null;
|
|
81
94
|
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Create signed URLs to download files without requiring permissions. These URLs can be valid for a set number of seconds.
|
|
97
|
+
*
|
|
98
|
+
* @param paths The file paths to be downloaded, including the current file names. For example [`folder/image.png`, 'folder2/image2.png'].
|
|
99
|
+
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
100
|
+
*/
|
|
101
|
+
createSignedUrls(paths: string[], expiresIn: number): Promise<{
|
|
102
|
+
data: {
|
|
103
|
+
path: string;
|
|
104
|
+
signedURL: string;
|
|
105
|
+
}[] | null;
|
|
106
|
+
error: Error | null;
|
|
107
|
+
}>;
|
|
82
108
|
/**
|
|
83
109
|
* Downloads a file.
|
|
84
110
|
*
|
|
@@ -103,7 +129,7 @@ export declare class StorageFileApi {
|
|
|
103
129
|
/**
|
|
104
130
|
* Deletes files within the same bucket
|
|
105
131
|
*
|
|
106
|
-
* @param paths An array of files to be
|
|
132
|
+
* @param paths An array of files to be deleted, including the path and file name. For example [`folder/image.png`].
|
|
107
133
|
*/
|
|
108
134
|
remove(paths: string[]): Promise<{
|
|
109
135
|
data: FileObject[] | null;
|
|
@@ -129,5 +155,6 @@ export declare class StorageFileApi {
|
|
|
129
155
|
error: Error | null;
|
|
130
156
|
}>;
|
|
131
157
|
_getFinalPath(path: string): string;
|
|
158
|
+
_removeEmptyFolders(path: string): string;
|
|
132
159
|
}
|
|
133
160
|
//# sourceMappingURL=StorageFileApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageFileApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageFileApi.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"StorageFileApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageFileApi.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAkBhE,qBAAa,cAAc;IACzB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;gBAGrB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,KAAK;IAQf;;;;;;;;;;OAUG;YACW,cAAc;IA2D5B;;;;;;;;;OASG;IACG,MAAM,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EACJ,WAAW,GACX,eAAe,GACf,IAAI,GACJ,MAAM,GACN,IAAI,GACJ,QAAQ,GACR,MAAM,CAAC,cAAc,GACrB,cAAc,CAAC,UAAU,CAAC,GAC1B,eAAe,GACf,MAAM,EACV,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,I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, bucketId, fetch) {
|
|
33
33
|
this.url = url;
|
|
34
34
|
this.headers = headers;
|
|
35
35
|
this.bucketId = bucketId;
|
|
36
|
+
this.fetch = fetch;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
|
|
@@ -46,6 +47,7 @@ class StorageFileApi {
|
|
|
46
47
|
* `upsert`: boolean, whether to perform an upsert.
|
|
47
48
|
*/
|
|
48
49
|
uploadOrUpdate(method, path, fileBody, fileOptions) {
|
|
50
|
+
var _a;
|
|
49
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
52
|
try {
|
|
51
53
|
let body;
|
|
@@ -65,8 +67,10 @@ class StorageFileApi {
|
|
|
65
67
|
headers['cache-control'] = `max-age=${options.cacheControl}`;
|
|
66
68
|
headers['content-type'] = options.contentType;
|
|
67
69
|
}
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
+
const cleanPath = this._removeEmptyFolders(path);
|
|
71
|
+
const _path = this._getFinalPath(cleanPath);
|
|
72
|
+
const fetcher = (_a = this.fetch) !== null && _a !== void 0 ? _a : cross_fetch_1.default;
|
|
73
|
+
const res = yield fetcher(`${this.url}/object/${_path}`, {
|
|
70
74
|
method,
|
|
71
75
|
body: body,
|
|
72
76
|
headers,
|
|
@@ -117,15 +121,15 @@ class StorageFileApi {
|
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
123
|
/**
|
|
120
|
-
* Moves an existing file
|
|
124
|
+
* Moves an existing file.
|
|
121
125
|
*
|
|
122
126
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
123
|
-
* @param toPath The new file path, including the new file name. For example `folder/image-
|
|
127
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
|
|
124
128
|
*/
|
|
125
129
|
move(fromPath, toPath) {
|
|
126
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
131
|
try {
|
|
128
|
-
const data = yield fetch_1.post(`${this.url}/object/move`, { bucketId: this.bucketId, sourceKey: fromPath, destinationKey: toPath }, { headers: this.headers });
|
|
132
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/object/move`, { bucketId: this.bucketId, sourceKey: fromPath, destinationKey: toPath }, { headers: this.headers });
|
|
129
133
|
return { data, error: null };
|
|
130
134
|
}
|
|
131
135
|
catch (error) {
|
|
@@ -134,7 +138,24 @@ class StorageFileApi {
|
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
140
|
/**
|
|
137
|
-
*
|
|
141
|
+
* Copies an existing file.
|
|
142
|
+
*
|
|
143
|
+
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
144
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
|
|
145
|
+
*/
|
|
146
|
+
copy(fromPath, toPath) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
try {
|
|
149
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/object/copy`, { bucketId: this.bucketId, sourceKey: fromPath, destinationKey: toPath }, { headers: this.headers });
|
|
150
|
+
return { data, error: null };
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
return { data: null, error };
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create signed URL to download file without requiring permissions. This URL can be valid for a set number of seconds.
|
|
138
159
|
*
|
|
139
160
|
* @param path The file path to be downloaded, including the current file name. For example `folder/image.png`.
|
|
140
161
|
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
@@ -143,7 +164,7 @@ class StorageFileApi {
|
|
|
143
164
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
165
|
try {
|
|
145
166
|
const _path = this._getFinalPath(path);
|
|
146
|
-
let data = yield fetch_1.post(`${this.url}/object/sign/${_path}`, { expiresIn }, { headers: this.headers });
|
|
167
|
+
let data = yield fetch_1.post(this.fetch, `${this.url}/object/sign/${_path}`, { expiresIn }, { headers: this.headers });
|
|
147
168
|
const signedURL = `${this.url}${data.signedURL}`;
|
|
148
169
|
data = { signedURL };
|
|
149
170
|
return { data, error: null, signedURL };
|
|
@@ -153,6 +174,23 @@ class StorageFileApi {
|
|
|
153
174
|
}
|
|
154
175
|
});
|
|
155
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Create signed URLs to download files without requiring permissions. These URLs can be valid for a set number of seconds.
|
|
179
|
+
*
|
|
180
|
+
* @param paths The file paths to be downloaded, including the current file names. For example [`folder/image.png`, 'folder2/image2.png'].
|
|
181
|
+
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
182
|
+
*/
|
|
183
|
+
createSignedUrls(paths, expiresIn) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
try {
|
|
186
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/object/sign/${this.bucketId}`, { expiresIn, paths }, { headers: this.headers });
|
|
187
|
+
return { data, error: null };
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
return { data: null, error };
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
156
194
|
/**
|
|
157
195
|
* Downloads a file.
|
|
158
196
|
*
|
|
@@ -162,7 +200,7 @@ class StorageFileApi {
|
|
|
162
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
163
201
|
try {
|
|
164
202
|
const _path = this._getFinalPath(path);
|
|
165
|
-
const res = yield fetch_1.get(`${this.url}/object/${_path}`, {
|
|
203
|
+
const res = yield fetch_1.get(this.fetch, `${this.url}/object/${_path}`, {
|
|
166
204
|
headers: this.headers,
|
|
167
205
|
noResolveJson: true,
|
|
168
206
|
});
|
|
@@ -193,12 +231,12 @@ class StorageFileApi {
|
|
|
193
231
|
/**
|
|
194
232
|
* Deletes files within the same bucket
|
|
195
233
|
*
|
|
196
|
-
* @param paths An array of files to be
|
|
234
|
+
* @param paths An array of files to be deleted, including the path and file name. For example [`folder/image.png`].
|
|
197
235
|
*/
|
|
198
236
|
remove(paths) {
|
|
199
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
238
|
try {
|
|
201
|
-
const data = yield fetch_1.remove(`${this.url}/object/${this.bucketId}`, { prefixes: paths }, { headers: this.headers });
|
|
239
|
+
const data = yield fetch_1.remove(this.fetch, `${this.url}/object/${this.bucketId}`, { prefixes: paths }, { headers: this.headers });
|
|
202
240
|
return { data, error: null };
|
|
203
241
|
}
|
|
204
242
|
catch (error) {
|
|
@@ -244,7 +282,7 @@ class StorageFileApi {
|
|
|
244
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
283
|
try {
|
|
246
284
|
const body = Object.assign(Object.assign(Object.assign({}, DEFAULT_SEARCH_OPTIONS), options), { prefix: path || '' });
|
|
247
|
-
const data = yield fetch_1.post(`${this.url}/object/list/${this.bucketId}`, body, { headers: this.headers }, parameters);
|
|
285
|
+
const data = yield fetch_1.post(this.fetch, `${this.url}/object/list/${this.bucketId}`, body, { headers: this.headers }, parameters);
|
|
248
286
|
return { data, error: null };
|
|
249
287
|
}
|
|
250
288
|
catch (error) {
|
|
@@ -255,6 +293,9 @@ class StorageFileApi {
|
|
|
255
293
|
_getFinalPath(path) {
|
|
256
294
|
return `${this.bucketId}/${path}`;
|
|
257
295
|
}
|
|
296
|
+
_removeEmptyFolders(path) {
|
|
297
|
+
return path.replace(/^\/|\/$/g, '').replace(/\/+/g, '/');
|
|
298
|
+
}
|
|
258
299
|
}
|
|
259
300
|
exports.StorageFileApi = StorageFileApi;
|
|
260
301
|
//# sourceMappingURL=StorageFileApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageFileApi.js","sourceRoot":"","sources":["../../../src/lib/StorageFileApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"StorageFileApi.js","sourceRoot":"","sources":["../../../src/lib/StorageFileApi.ts"],"names":[],"mappings":";;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3 +1,4 @@
|
|
|
1
|
+
export declare type Fetch = typeof fetch;
|
|
1
2
|
export interface FetchOptions {
|
|
2
3
|
headers?: {
|
|
3
4
|
[key: string]: string;
|
|
@@ -8,8 +9,8 @@ export interface FetchParameters {
|
|
|
8
9
|
signal?: AbortSignal;
|
|
9
10
|
}
|
|
10
11
|
export declare type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
11
|
-
export declare function get(url: string, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
12
|
-
export declare function post(url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
13
|
-
export declare function put(url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
14
|
-
export declare function remove(url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
12
|
+
export declare function get(fetcher: Fetch | undefined, url: string, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
13
|
+
export declare function post(fetcher: Fetch | undefined, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
14
|
+
export declare function put(fetcher: Fetch | undefined, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
15
|
+
export declare function remove(fetcher: Fetch | undefined, url: string, body: object, options?: FetchOptions, parameters?: FetchParameters): Promise<any>;
|
|
15
16
|
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,oBAAY,iBAAiB,GAAG,KAAK,GAAG,M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C,CAEd"}
|
package/dist/main/lib/fetch.js
CHANGED
|
@@ -35,10 +35,10 @@ const _getRequestParams = (method, options, parameters, body) => {
|
|
|
35
35
|
params.body = JSON.stringify(body);
|
|
36
36
|
return Object.assign(Object.assign({}, params), parameters);
|
|
37
37
|
};
|
|
38
|
-
function _handleRequest(method, url, options, parameters, body) {
|
|
38
|
+
function _handleRequest(fetcher = cross_fetch_1.default, method, url, options, parameters, body) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
return new Promise((resolve, reject) => {
|
|
41
|
-
|
|
41
|
+
fetcher(url, _getRequestParams(method, options, parameters, body))
|
|
42
42
|
.then((result) => {
|
|
43
43
|
if (!result.ok)
|
|
44
44
|
throw result;
|
|
@@ -51,27 +51,27 @@ function _handleRequest(method, url, options, parameters, body) {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function get(url, options, parameters) {
|
|
54
|
+
function get(fetcher, url, options, parameters) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
return _handleRequest('GET', url, options, parameters);
|
|
56
|
+
return _handleRequest(fetcher, 'GET', url, options, parameters);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
exports.get = get;
|
|
60
|
-
function post(url, body, options, parameters) {
|
|
60
|
+
function post(fetcher, url, body, options, parameters) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return _handleRequest('POST', url, options, parameters, body);
|
|
62
|
+
return _handleRequest(fetcher, 'POST', url, options, parameters, body);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
exports.post = post;
|
|
66
|
-
function put(url, body, options, parameters) {
|
|
66
|
+
function put(fetcher, url, body, options, parameters) {
|
|
67
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return _handleRequest('PUT', url, options, parameters, body);
|
|
68
|
+
return _handleRequest(fetcher, 'PUT', url, options, parameters, body);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
exports.put = put;
|
|
72
|
-
function remove(url, body, options, parameters) {
|
|
72
|
+
function remove(fetcher, url, body, options, parameters) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
return _handleRequest('DELETE', url, options, parameters, body);
|
|
74
|
+
return _handleRequest(fetcher, 'DELETE', url, options, parameters, body);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
exports.remove = remove;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAAoC;AAiBpC,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAU,EAAE,CAC5C,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,iBAAiB,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAErF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;IAC9C,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;QACpC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;KACrB;IACD,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE;QAC7B,OAAO,MAAM,CAAC;YACZ,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC;YAC9B,MAAM,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,KAAI,GAAG;SAC7B,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CACxB,MAAyB,EACzB,OAAsB,EACtB,U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,GAAG,CACvB,OAA0B,EAC1B,GAAW,EACX,OAAsB,EACtB,UAA4B;;QAE5B,OAAO,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;IACjE,CAAC;CAAA;AAPD,kBAOC;AAED,SAAsB,IAAI,CACxB,OAA0B,EAC1B,GAAW,EACX,IAAY,EACZ,OAAsB,EACtB,UAA4B;;QAE5B,OAAO,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACxE,CAAC;CAAA;AARD,oBAQC;AAED,SAAsB,GAAG,CACvB,OAA0B,EAC1B,GAAW,EACX,IAAY,EACZ,OAAsB,EACtB,UAA4B;;QAE5B,OAAO,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACvE,CAAC;CAAA;AARD,kBAQC;AAED,SAAsB,MAAM,CAC1B,OAA0B,EAC1B,GAAW,EACX,IAAY,EACZ,OAAsB,EACtB,UAA4B;;QAE5B,OAAO,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1E,CAAC;CAAA;AARD,wBAQC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { StorageBucketApi, StorageFileApi } from './lib';
|
|
2
|
+
import { Fetch } from './lib/fetch';
|
|
2
3
|
export declare class SupabaseStorageClient extends StorageBucketApi {
|
|
3
4
|
constructor(url: string, headers?: {
|
|
4
5
|
[key: string]: string;
|
|
5
|
-
});
|
|
6
|
+
}, fetch?: Fetch);
|
|
6
7
|
/**
|
|
7
8
|
* Perform file operation in a bucket.
|
|
8
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseStorageClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { StorageBucketApi, StorageFileApi } from './lib';
|
|
2
2
|
export class SupabaseStorageClient extends StorageBucketApi {
|
|
3
|
-
constructor(url, headers = {}) {
|
|
4
|
-
super(url, headers);
|
|
3
|
+
constructor(url, headers = {}, fetch) {
|
|
4
|
+
super(url, headers, fetch);
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Perform file operation in a bucket.
|
|
@@ -9,7 +9,7 @@ export class SupabaseStorageClient extends StorageBucketApi {
|
|
|
9
9
|
* @param id The bucket id to operate on.
|
|
10
10
|
*/
|
|
11
11
|
from(id) {
|
|
12
|
-
return new StorageFileApi(this.url, this.headers, id);
|
|
12
|
+
return new StorageFileApi(this.url, this.headers, id, this.fetch);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=SupabaseStorageClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseStorageClient.js","sourceRoot":"","sources":["../../src/SupabaseStorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
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"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { Fetch } from './fetch';
|
|
1
2
|
import { Bucket } from './types';
|
|
2
3
|
export declare class StorageBucketApi {
|
|
3
4
|
protected url: string;
|
|
4
5
|
protected headers: {
|
|
5
6
|
[key: string]: string;
|
|
6
7
|
};
|
|
8
|
+
protected fetch?: Fetch;
|
|
7
9
|
constructor(url: string, headers?: {
|
|
8
10
|
[key: string]: string;
|
|
9
|
-
});
|
|
11
|
+
}, fetch?: Fetch);
|
|
10
12
|
/**
|
|
11
13
|
* Retrieves the details of all Storage buckets within an existing product.
|
|
12
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageBucketApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageBucketApi.d.ts","sourceRoot":"","sources":["../../../src/lib/StorageBucketApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA0B,MAAM,SAAS,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGhC,qBAA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