@quatrain/storage-supabase 1.2.8 → 1.2.10-pr25.8069

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.
@@ -205,7 +205,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
205
205
  // La variable publicCacheDuration / cacheControl n'est donc pas gérée correctement ici pour le moment.
206
206
  // Voir si le SDK de Supabase permet de la supporter dans le futur.
207
207
  let download = false;
208
- const isVideoOrAudio = file.contentType && (file.contentType.startsWith('video/') || file.contentType.startsWith('audio/'));
208
+ const isMediaStream = this.isVideoOrAudio(file);
209
209
  if (action === 'download') {
210
210
  download = true;
211
211
  }
@@ -221,7 +221,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
221
221
  download = true;
222
222
  }
223
223
  }
224
- else if (!isVideoOrAudio) {
224
+ else if (!isMediaStream) {
225
225
  // Default to download=true for non-media files (images, documents) to preserve historical behavior
226
226
  download = true;
227
227
  }
@@ -231,7 +231,11 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
231
231
  if (error !== null) {
232
232
  throw new Error(`Unable to get signed url: ${error}`);
233
233
  }
234
- return { url: data === null || data === void 0 ? void 0 : data.signedUrl, expiresIn };
234
+ let signedUrl = data === null || data === void 0 ? void 0 : data.signedUrl;
235
+ if (signedUrl && download === false) {
236
+ signedUrl += '&play=true';
237
+ }
238
+ return { url: signedUrl, expiresIn };
235
239
  });
236
240
  }
237
241
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/storage-supabase",
3
- "version": "1.2.8",
3
+ "version": "1.2.10-pr25.8069",
4
4
  "description": "Storage adapter for Supabase Storage",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,8 +31,8 @@
31
31
  "typescript": "^5.1.5"
32
32
  },
33
33
  "dependencies": {
34
- "@quatrain/core": "^1.2.16",
35
- "@quatrain/storage": "^1.2.12",
34
+ "@quatrain/core": "^1.2.18",
35
+ "@quatrain/storage": "^1.2.13",
36
36
  "@supabase/storage-js": "^2.7.2",
37
37
  "@supabase/supabase-js": "^2.108.2"
38
38
  },
@@ -215,7 +215,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
215
215
  // Voir si le SDK de Supabase permet de la supporter dans le futur.
216
216
 
217
217
  let download: boolean | string = false
218
- const isVideoOrAudio = file.contentType && (file.contentType.startsWith('video/') || file.contentType.startsWith('audio/'))
218
+ const isMediaStream = this.isVideoOrAudio(file)
219
219
 
220
220
  if (action === 'download') {
221
221
  download = true
@@ -228,7 +228,7 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
228
228
  } else {
229
229
  download = true
230
230
  }
231
- } else if (!isVideoOrAudio) {
231
+ } else if (!isMediaStream) {
232
232
  // Default to download=true for non-media files (images, documents) to preserve historical behavior
233
233
  download = true
234
234
  }
@@ -241,7 +241,12 @@ export class SupabaseStorageAdapter extends AbstractStorageAdapter {
241
241
  throw new Error(`Unable to get signed url: ${error}`)
242
242
  }
243
243
 
244
- return { url: data?.signedUrl, expiresIn }
244
+ let signedUrl = data?.signedUrl
245
+ if (signedUrl && download === false) {
246
+ signedUrl += '&play=true'
247
+ }
248
+
249
+ return { url: signedUrl, expiresIn }
245
250
  }
246
251
 
247
252
  /**