rads-db 0.1.104 → 0.1.106

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.
@@ -210,7 +210,7 @@ function getDb(options) {
210
210
  entities: {},
211
211
  driverOptions: {
212
212
  dbName,
213
- dexieOptions: {},
213
+ dexieOptions: void 0,
214
214
  invalidateCounter: 0,
215
215
  ...options
216
216
  }
@@ -174,6 +174,6 @@ function getDb(options) {
174
174
  const dbName = options?.dbName || "db";
175
175
  if (dbs[dbName]?.db)
176
176
  dbs[dbName].db?.close();
177
- dbs[dbName] = { entities: {}, driverOptions: { dbName, dexieOptions: {}, invalidateCounter: 0, ...options } };
177
+ dbs[dbName] = { entities: {}, driverOptions: { dbName, dexieOptions: void 0, invalidateCounter: 0, ...options } };
178
178
  return dbs[dbName];
179
179
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = void 0;
7
+ var _default = options => {
8
+ const {
9
+ supabase,
10
+ bucket
11
+ } = options || {};
12
+ if (!supabase || !bucket) throw new Error(`Please provide supabase client and bucket name`);
13
+ const driver = {
14
+ driverName: "supabase",
15
+ async uploadFile(args) {
16
+ const {
17
+ data,
18
+ error
19
+ } = await supabase.storage.from(args.containerName || bucket).upload(args.fileName, args.blob, args.options);
20
+ if (error) throw error;
21
+ return {
22
+ url: data?.path
23
+ };
24
+ }
25
+ };
26
+ return driver;
27
+ };
28
+ module.exports = _default;
@@ -0,0 +1,7 @@
1
+ import type { SupabaseClient } from '@supabase/supabase-js';
2
+ declare const _default: (options: SupabaseFileUploadDriverOptions) => FileUploadDriver;
3
+ export default _default;
4
+ interface SupabaseFileUploadDriverOptions {
5
+ supabase: SupabaseClient;
6
+ bucket: string;
7
+ }
@@ -0,0 +1,15 @@
1
+ export default (options) => {
2
+ const { supabase, bucket } = options || {};
3
+ if (!supabase || !bucket)
4
+ throw new Error(`Please provide supabase client and bucket name`);
5
+ const driver = {
6
+ driverName: "supabase",
7
+ async uploadFile(args) {
8
+ const { data, error } = await supabase.storage.from(args.containerName || bucket).upload(args.fileName, args.blob, args.options);
9
+ if (error)
10
+ throw error;
11
+ return { url: data?.path };
12
+ }
13
+ };
14
+ return driver;
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "0.1.104",
3
+ "version": "0.1.106",
4
4
  "files": [
5
5
  "dist",
6
6
  "drivers",
@@ -46,6 +46,7 @@
46
46
  "author": "",
47
47
  "license": "ISC",
48
48
  "peerDependencies": {
49
+ "@supabase/supabase-js": ">=2",
49
50
  "@azure/cosmos": ">=3",
50
51
  "@azure/storage-blob": ">=12",
51
52
  "dexie": ">=3",
@@ -53,6 +54,9 @@
53
54
  "typescript": ">=5.0.0"
54
55
  },
55
56
  "peerDependenciesMeta": {
57
+ "@supabase/supabase-js": {
58
+ "optional": true
59
+ },
56
60
  "@azure/storage-blob": {
57
61
  "optional": true
58
62
  },
@@ -68,6 +72,7 @@
68
72
  },
69
73
  "packageManager": "pnpm@8.6.1",
70
74
  "devDependencies": {
75
+ "@supabase/supabase-js": "^2.39.0",
71
76
  "@azure/cosmos": "^3.17.3",
72
77
  "@types/eslint": "^8.44.8",
73
78
  "@types/klaw": "^3.0.3",