@quatrain/storage-supabase 1.1.29 → 1.1.30
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.
|
@@ -12,7 +12,7 @@ export declare class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
12
12
|
create(file: FileType, stream: Readable | string): Promise<FileType>;
|
|
13
13
|
copy(file: FileType, destFile: FileType): Promise<void>;
|
|
14
14
|
move(file: FileType, destFile: FileType): Promise<FileType>;
|
|
15
|
-
getUrl(file: FileType, expiresIn?: number): Promise<{
|
|
15
|
+
getUrl(file: FileType, expiresIn?: number, action?: any, extra?: any): Promise<{
|
|
16
16
|
url: string;
|
|
17
17
|
expiresIn: number;
|
|
18
18
|
}>;
|
|
@@ -133,8 +133,12 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
getUrl(file_1) {
|
|
136
|
-
return __awaiter(this, arguments, void 0, function* (file, expiresIn = 3600) {
|
|
136
|
+
return __awaiter(this, arguments, void 0, function* (file, expiresIn = 3600, action = 'read', extra = {}) {
|
|
137
137
|
storage_1.Storage.debug(`Getting signed url for file ${file.ref} in bucket ${file.bucket}`);
|
|
138
|
+
const cacheControl = extra.cacheControl || (this._params.config.publicCacheDuration ? `${this._params.config.publicCacheDuration}` : undefined);
|
|
139
|
+
// TODO: Le client Supabase JS ne supporte pas nativement l'override du ResponseCacheControl dans createSignedUrl.
|
|
140
|
+
// La variable publicCacheDuration / cacheControl n'est donc pas gérée correctement ici pour le moment.
|
|
141
|
+
// Voir si le SDK de Supabase permet de la supporter dans le futur.
|
|
138
142
|
const { data, error } = yield this._client
|
|
139
143
|
.from(file.bucket)
|
|
140
144
|
.createSignedUrl(file.ref, expiresIn, { download: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/storage-supabase",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
4
4
|
"description": "Storage adapter for Supabase Storage",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,5 +41,8 @@
|
|
|
41
41
|
"build": "tsc",
|
|
42
42
|
"wbuild": "tsc --watch",
|
|
43
43
|
"bump-to": "yarn version"
|
|
44
|
+
},
|
|
45
|
+
"typedoc": {
|
|
46
|
+
"entryPoint": "src/index.ts"
|
|
44
47
|
}
|
|
45
48
|
}
|
|
@@ -138,10 +138,17 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
138
138
|
return destFile
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
async getUrl(file: FileType, expiresIn = 3600) {
|
|
141
|
+
async getUrl(file: FileType, expiresIn = 3600, action: any = 'read', extra: any = {}) {
|
|
142
142
|
Storage.debug(
|
|
143
143
|
`Getting signed url for file ${file.ref} in bucket ${file.bucket}`
|
|
144
144
|
)
|
|
145
|
+
|
|
146
|
+
const cacheControl = extra.cacheControl || (this._params.config.publicCacheDuration ? `${this._params.config.publicCacheDuration}` : undefined)
|
|
147
|
+
|
|
148
|
+
// TODO: Le client Supabase JS ne supporte pas nativement l'override du ResponseCacheControl dans createSignedUrl.
|
|
149
|
+
// La variable publicCacheDuration / cacheControl n'est donc pas gérée correctement ici pour le moment.
|
|
150
|
+
// Voir si le SDK de Supabase permet de la supporter dans le futur.
|
|
151
|
+
|
|
145
152
|
const { data, error } = await this._client
|
|
146
153
|
.from(file.bucket)
|
|
147
154
|
.createSignedUrl(file.ref, expiresIn, { download: true })
|