@aiao/rxdb-adapter-supabase 0.0.9 → 0.0.10
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/dist/index.js +8 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityRemoteRemovedEvent as O, EntityRemoteUpdatedEvent as W, EntityRemoteCreatedEvent as U, isRuleGroup as A, getEntityMetadata as b, PropertyType as E, RepositoryBase as K, RxDBAdapterRemoteBase as z } from "@aiao/rxdb";
|
|
2
2
|
import { createClient as L } from "@supabase/supabase-js";
|
|
3
|
-
import { defer as D, from as k, map as
|
|
3
|
+
import { defer as D, from as k, map as N, of as Q } from "rxjs";
|
|
4
4
|
class S extends Error {
|
|
5
5
|
constructor(t, e) {
|
|
6
6
|
super(t), this.code = e, this.name = "SupabaseSyncError";
|
|
@@ -201,15 +201,17 @@ function M(i, t, e, s) {
|
|
|
201
201
|
const [r, o] = n;
|
|
202
202
|
return i.or(`${t}.lt.${r},${t}.gt.${o}`);
|
|
203
203
|
}
|
|
204
|
+
case "null":
|
|
204
205
|
case "isNull":
|
|
205
206
|
return i.is(t, null);
|
|
207
|
+
case "notNull":
|
|
206
208
|
case "isNotNull":
|
|
207
209
|
return i.not(t, "is", null);
|
|
208
210
|
default:
|
|
209
211
|
throw new Error(`Unsupported operator: ${e}`);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
function
|
|
214
|
+
function T(i) {
|
|
213
215
|
const t = /* @__PURE__ */ new Map();
|
|
214
216
|
for (const e of i) {
|
|
215
217
|
const s = e.constructor;
|
|
@@ -594,13 +596,13 @@ class it extends z {
|
|
|
594
596
|
* 批量保存实体(upsert 语义,非事务)
|
|
595
597
|
*/
|
|
596
598
|
async saveMany(t) {
|
|
597
|
-
return t.length === 0 ? [] : this.executeUpsert(
|
|
599
|
+
return t.length === 0 ? [] : this.executeUpsert(T(t));
|
|
598
600
|
}
|
|
599
601
|
/**
|
|
600
602
|
* 批量删除实体(非事务)
|
|
601
603
|
*/
|
|
602
604
|
async removeMany(t) {
|
|
603
|
-
return t.length === 0 ? [] : this.executeDelete(
|
|
605
|
+
return t.length === 0 ? [] : this.executeDelete(T(t));
|
|
604
606
|
}
|
|
605
607
|
/**
|
|
606
608
|
* 批量修改实体(事务)
|
|
@@ -844,7 +846,7 @@ class it extends z {
|
|
|
844
846
|
return D(() => {
|
|
845
847
|
let s = this.#t.from(t).select("id, updatedAt");
|
|
846
848
|
return s = $(s, e), k(s).pipe(
|
|
847
|
-
|
|
849
|
+
N(({ data: n, error: a }) => {
|
|
848
850
|
if (a)
|
|
849
851
|
throw new m(`Failed to fetch metadata: ${a.message}`);
|
|
850
852
|
return (n ?? []).map((r) => ({
|
|
@@ -864,7 +866,7 @@ class it extends z {
|
|
|
864
866
|
*/
|
|
865
867
|
findByIds(t, e) {
|
|
866
868
|
return D(() => e.length === 0 ? Q([]) : k(this.#t.from(t).select("*").in("id", e)).pipe(
|
|
867
|
-
|
|
869
|
+
N(({ data: s, error: n }) => {
|
|
868
870
|
if (n)
|
|
869
871
|
throw new m(`Failed to find by ids: ${n.message}`);
|
|
870
872
|
return s ?? [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiao/rxdb-adapter-supabase",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@supabase/supabase-js": "^2.88.0",
|
|
32
32
|
"@supabase/postgrest-js": "^2.89.0",
|
|
33
33
|
"rxjs": "^7.8.2",
|
|
34
|
-
"@aiao/rxdb": "0.0.
|
|
34
|
+
"@aiao/rxdb": "0.0.10"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"dotenv": "^17.2.3",
|
|
38
|
-
"@aiao/rxdb-
|
|
39
|
-
"@aiao/rxdb-
|
|
38
|
+
"@aiao/rxdb-adapter-sqlite": "0.0.10",
|
|
39
|
+
"@aiao/rxdb-test": "0.0.10"
|
|
40
40
|
}
|
|
41
41
|
}
|