@quatrain/storage-supabase 1.1.14 → 1.1.15

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/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @quatrain/storage-supabase
2
+
3
+ A storage adapter for Supabase Storage. This package allows Quatrain to use Supabase for S3-compatible object storage.
4
+
5
+ ## Features
6
+
7
+ - Implements the `@quatrain/storage` abstract adapter.
8
+ - Works with both Supabase SaaS and self-hosted instances.
9
+ - Integrates with Supabase's policies for fine-grained file access control.
10
+ - Uses the `@supabase/supabase-js` library.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @quatrain/storage-supabase @supabase/supabase-js
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { Storage } from '@quatrain/storage'
22
+ import { SupabaseStorageAdapter } from '@quatrain/storage-supabase'
23
+
24
+ const adapter = new SupabaseStorageAdapter({
25
+ config: { url: '...', anonKey: '...' },
26
+ })
27
+ Storage.addAdapter(adapter, 'default', true)
28
+ ```
@@ -186,7 +186,7 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
186
186
  return __awaiter(this, void 0, void 0, function* () {
187
187
  const { data, error } = yield this._client
188
188
  .from(file.bucket)
189
- .download(meta.path);
189
+ .download(file.ref);
190
190
  if (error !== null) {
191
191
  console.log(error);
192
192
  throw new Error(`Unable to download ${file.ref}`);
@@ -194,6 +194,9 @@ class SupabaseStorageAdapter extends storage_1.AbstractStorageAdapter {
194
194
  if (meta.onlyContent) {
195
195
  return data;
196
196
  }
197
+ // Write the downloaded data to the specified path
198
+ const buffer = yield data.arrayBuffer();
199
+ node_fs_1.default.writeFileSync(meta.path, Buffer.from(buffer));
197
200
  return meta.path;
198
201
  });
199
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/storage-supabase",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Storage adapter for Supabase Storage",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -22,10 +22,10 @@
22
22
  "typescript": "^5.1.5"
23
23
  },
24
24
  "dependencies": {
25
- "@quatrain/core": "^1.1.19",
26
- "@quatrain/storage": "^1.1.17",
25
+ "@quatrain/core": "^1.1.23",
26
+ "@quatrain/storage": "^1.1.21",
27
27
  "@supabase/storage-js": "^2.7.2",
28
- "@supabase/supabase-js": "^2.45.1"
28
+ "@supabase/supabase-js": "^2.57.2"
29
29
  },
30
30
  "scripts": {
31
31
  "test-ci": "jest --runInBand",