@quatrain/storage-supabase 1.2.3 → 1.2.5
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.
|
@@ -77,7 +77,7 @@ export declare class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
77
77
|
* @returns A promise resolving to the signed URL payload.
|
|
78
78
|
* @throws {Error} If signature creation fails.
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
getUrl(file: FileType, expiresIn?: number, action?: any, extra?: any): Promise<{
|
|
81
81
|
url: string;
|
|
82
82
|
expiresIn: number;
|
|
83
83
|
}>;
|
|
@@ -197,7 +197,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
|
|
|
197
197
|
* @returns A promise resolving to the signed URL payload.
|
|
198
198
|
* @throws {Error} If signature creation fails.
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
getUrl(file_1) {
|
|
201
201
|
return __awaiter(this, arguments, void 0, function* (file, expiresIn = 3600, action = 'read', extra = {}) {
|
|
202
202
|
storage_1.Storage.debug(`Getting signed url for file ${file.ref} in bucket ${file.bucket}`);
|
|
203
203
|
const cacheControl = extra.cacheControl || (this._params.config.publicCacheDuration ? `${this._params.config.publicCacheDuration}` : undefined);
|
|
@@ -241,7 +241,8 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
|
|
|
241
241
|
storage_1.Storage.debug(`GET Readable : ${file.ref}`);
|
|
242
242
|
const path = (0, node_path_1.join)((0, node_os_1.tmpdir)(), String(Date.now()));
|
|
243
243
|
const item = yield this.download(file, { path, onlyContent: true });
|
|
244
|
-
const
|
|
244
|
+
const arrayBuffer = yield item.arrayBuffer();
|
|
245
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
245
246
|
const readable = new node_stream_1.Readable();
|
|
246
247
|
readable.push(buffer);
|
|
247
248
|
readable.push(null);
|
|
@@ -260,7 +261,8 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
|
|
|
260
261
|
storage_1.Storage.debug(`GET Stream : ${file.ref}`);
|
|
261
262
|
const path = (0, node_path_1.join)((0, node_os_1.tmpdir)(), String(Date.now()));
|
|
262
263
|
const item = yield this.download(file, { path, onlyContent: true });
|
|
263
|
-
const
|
|
264
|
+
const arrayBuffer = yield item.arrayBuffer();
|
|
265
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
264
266
|
const readable = new node_stream_1.Readable();
|
|
265
267
|
readable.push(buffer);
|
|
266
268
|
readable.push(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/storage-supabase",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Storage adapter for Supabase Storage",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@quatrain/core": "^1.2.6",
|
|
35
|
-
"@quatrain/storage": "^1.2.
|
|
35
|
+
"@quatrain/storage": "^1.2.6",
|
|
36
36
|
"@supabase/storage-js": "^2.7.2",
|
|
37
37
|
"@supabase/supabase-js": "^2.87.3"
|
|
38
38
|
},
|
|
@@ -203,7 +203,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
203
203
|
* @returns A promise resolving to the signed URL payload.
|
|
204
204
|
* @throws {Error} If signature creation fails.
|
|
205
205
|
*/
|
|
206
|
-
async
|
|
206
|
+
async getUrl(file: FileType, expiresIn = 3600, action: any = 'read', extra: any = {}) {
|
|
207
207
|
Storage.debug(
|
|
208
208
|
`Getting signed url for file ${file.ref} in bucket ${file.bucket}`
|
|
209
209
|
)
|
|
@@ -255,7 +255,8 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
255
255
|
|
|
256
256
|
const path = join(tmpdir(), String(Date.now()))
|
|
257
257
|
const item = await this.download(file, { path, onlyContent: true })
|
|
258
|
-
const
|
|
258
|
+
const arrayBuffer = await (item as Blob).arrayBuffer()
|
|
259
|
+
const buffer = Buffer.from(arrayBuffer)
|
|
259
260
|
const readable = new Readable()
|
|
260
261
|
readable.push(buffer)
|
|
261
262
|
readable.push(null)
|
|
@@ -275,7 +276,8 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
|
|
|
275
276
|
|
|
276
277
|
const path = join(tmpdir(), String(Date.now()))
|
|
277
278
|
const item = await this.download(file, { path, onlyContent: true })
|
|
278
|
-
const
|
|
279
|
+
const arrayBuffer = await (item as Blob).arrayBuffer()
|
|
280
|
+
const buffer = Buffer.from(arrayBuffer)
|
|
279
281
|
const readable = new Readable()
|
|
280
282
|
readable.push(buffer)
|
|
281
283
|
readable.push(null)
|