@quatrain/storage-supabase 1.2.4 → 1.2.6

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.
@@ -117,7 +117,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
117
117
  const { error } = yield this._client
118
118
  .from(file.bucket)
119
119
  .upload(file.ref, new Blob([node_fs_1.default.readFileSync(stream)]), {
120
- upsert: true,
120
+ upsert: storage_1.Storage.defaultUpsert,
121
121
  contentType: file.contentType,
122
122
  });
123
123
  if (error !== null) {
@@ -134,7 +134,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
134
134
  .from(file.bucket)
135
135
  .upload(file.ref, content, {
136
136
  // cacheControl: '3600',
137
- upsert: false,
137
+ upsert: storage_1.Storage.defaultUpsert,
138
138
  contentType: file.contentType,
139
139
  });
140
140
  if (error !== null) {
@@ -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 buffer = Buffer.from(item.toString(), 'base64');
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 buffer = Buffer.from(item.toString(), 'base64');
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);
@@ -304,7 +306,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
304
306
  return __awaiter(this, arguments, void 0, function* (file, _expiresIn = 7200) {
305
307
  const { data, error } = yield this._client
306
308
  .from(file.bucket)
307
- .createSignedUploadUrl(file.ref, { upsert: true });
309
+ .createSignedUploadUrl(file.ref, { upsert: storage_1.Storage.defaultUpsert });
308
310
  if (error !== null) {
309
311
  throw new Error(`Unable to get signed upload url: ${error}`);
310
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/storage-supabase",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Storage adapter for Supabase Storage",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,10 +31,10 @@
31
31
  "typescript": "^5.1.5"
32
32
  },
33
33
  "dependencies": {
34
- "@quatrain/core": "^1.2.6",
35
- "@quatrain/storage": "^1.2.5",
34
+ "@quatrain/core": "^1.2.16",
35
+ "@quatrain/storage": "^1.2.12",
36
36
  "@supabase/storage-js": "^2.7.2",
37
- "@supabase/supabase-js": "^2.87.3"
37
+ "@supabase/supabase-js": "^2.108.2"
38
38
  },
39
39
  "scripts": {
40
40
  "test-ci": "jest --runInBand",
@@ -120,7 +120,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
120
120
  const { error } = await this._client
121
121
  .from(file.bucket)
122
122
  .upload(file.ref, new Blob([fs.readFileSync(stream)]), {
123
- upsert: true,
123
+ upsert: Storage.defaultUpsert,
124
124
  contentType: file.contentType,
125
125
  })
126
126
  if (error !== null) {
@@ -136,7 +136,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
136
136
  .from(file.bucket)
137
137
  .upload(file.ref, content, {
138
138
  // cacheControl: '3600',
139
- upsert: false,
139
+ upsert: Storage.defaultUpsert,
140
140
  contentType: file.contentType,
141
141
  })
142
142
  if (error !== null) {
@@ -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 buffer = Buffer.from(item.toString(), 'base64')
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 buffer = Buffer.from(item.toString(), 'base64')
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)
@@ -328,7 +330,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
328
330
  ): Promise<FileResponseLinkType> {
329
331
  const { data, error } = await this._client
330
332
  .from(file.bucket)
331
- .createSignedUploadUrl(file.ref, { upsert: true })
333
+ .createSignedUploadUrl(file.ref, { upsert: Storage.defaultUpsert })
332
334
 
333
335
  if (error !== null) {
334
336
  throw new Error(`Unable to get signed upload url: ${error}`)