@pol-studios/db 1.0.30 → 1.0.33
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/{DataLayerContext-Dc7nF2IG.d.ts → DataLayerContext-BwMk4VpG.d.ts} +92 -8
- package/dist/{UserMetadataContext-B8gVWGMl.d.ts → UserMetadataContext-pQb3A8_Q.d.ts} +1 -1
- package/dist/{UserMetadataContext-DntmpK41.d.ts → UserMetadataContext-yLZQu24J.d.ts} +1 -1
- package/dist/auth/context.d.ts +3 -3
- package/dist/auth/context.js +5 -10
- package/dist/auth/guards.d.ts +9 -9
- package/dist/auth/guards.js +2 -3
- package/dist/auth/hooks.d.ts +5 -4
- package/dist/auth/hooks.js +6 -9
- package/dist/auth/index.d.ts +4 -4
- package/dist/auth/index.js +7 -12
- package/dist/{chunk-EKUDGIQZ.js → chunk-3XCW225W.js} +274 -468
- package/dist/chunk-3XCW225W.js.map +1 -0
- package/dist/{chunk-OQ7U6EQ3.js → chunk-4EJ6LUH7.js} +3800 -3425
- package/dist/chunk-4EJ6LUH7.js.map +1 -0
- package/dist/{chunk-FZF26ZRB.js → chunk-7BGDQT5X.js} +29 -16
- package/dist/{chunk-FZF26ZRB.js.map → chunk-7BGDQT5X.js.map} +1 -1
- package/dist/{chunk-P4UZ7IXC.js → chunk-7D4SUZUM.js} +1 -5
- package/dist/{chunk-3PJTNH2L.js → chunk-AKIRHA4Q.js} +2 -2
- package/dist/{chunk-5EFDS7SR.js → chunk-DMVUEJG2.js} +7 -2
- package/dist/chunk-DMVUEJG2.js.map +1 -0
- package/dist/{chunk-KQNOEADH.js → chunk-E64B4PJZ.js} +74 -309
- package/dist/chunk-E64B4PJZ.js.map +1 -0
- package/dist/{chunk-A7C2FMUF.js → chunk-E6JL3RUF.js} +209 -53
- package/dist/chunk-E6JL3RUF.js.map +1 -0
- package/dist/{chunk-U5UNPBKB.js → chunk-FI6JAD5G.js} +3 -3
- package/dist/{chunk-TKWR5AAY.js → chunk-JOULSXOI.js} +2 -2
- package/dist/{chunk-HTJ2FQW5.js → chunk-LF3V3ERS.js} +13 -15
- package/dist/{chunk-HTJ2FQW5.js.map → chunk-LF3V3ERS.js.map} +1 -1
- package/dist/{chunk-D522CKBU.js → chunk-OUCPYEKC.js} +15 -15
- package/dist/{chunk-D522CKBU.js.map → chunk-OUCPYEKC.js.map} +1 -1
- package/dist/{chunk-7DJELYBA.js → chunk-PNC6CG5U.js} +43 -82
- package/dist/chunk-PNC6CG5U.js.map +1 -0
- package/dist/{chunk-CNIGRBRE.js → chunk-QJZUIAHA.js} +43 -19
- package/dist/{chunk-CNIGRBRE.js.map → chunk-QJZUIAHA.js.map} +1 -1
- package/dist/{chunk-HAWJTZCK.js → chunk-RT4O5H2E.js} +5 -7
- package/dist/chunk-RT4O5H2E.js.map +1 -0
- package/dist/{chunk-WVF7RUW5.js → chunk-WM25QE7E.js} +3 -3
- package/dist/{chunk-H6365JPC.js → chunk-YUX6RGLZ.js} +3 -3
- package/dist/{chunk-H6365JPC.js.map → chunk-YUX6RGLZ.js.map} +1 -1
- package/dist/{chunk-H3LNH2NT.js → chunk-Z456IHCB.js} +5 -9
- package/dist/{chunk-H3LNH2NT.js.map → chunk-Z456IHCB.js.map} +1 -1
- package/dist/{chunk-JAATANS3.js → chunk-ZCOFRJQD.js} +3 -3
- package/dist/{chunk-JAATANS3.js.map → chunk-ZCOFRJQD.js.map} +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +2 -2
- package/dist/core/index.d.ts +54 -31
- package/dist/{executor-Br27YZvl.d.ts → executor-YJw4m7Q7.d.ts} +9 -1
- package/dist/gen/index.js +1 -1
- package/dist/hooks/index.d.ts +3 -22
- package/dist/hooks/index.js +5 -4
- package/dist/{index-CYFdO0iB.d.ts → index-lveh8qb0.d.ts} +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.js +60 -42
- package/dist/index.native.d.ts +19 -13
- package/dist/index.native.js +65 -39
- package/dist/index.web.d.ts +18 -45
- package/dist/index.web.js +58 -52
- package/dist/index.web.js.map +1 -1
- package/dist/mutation/index.d.ts +2 -2
- package/dist/mutation/index.js +5 -5
- package/dist/parser/index.js +4 -4
- package/dist/powersync-bridge/index.d.ts +18 -3
- package/dist/powersync-bridge/index.js +2 -2
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +7 -8
- package/dist/realtime/index.js +7 -9
- package/dist/realtime/index.js.map +1 -1
- package/dist/{setupAuthContext-Kv-THH-h.d.ts → setupAuthContext-B76nbIP6.d.ts} +23 -17
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +6 -7
- package/dist/{useBatchUpsert-9OYjibLh.d.ts → useBatchUpsert-DAkiCNo3.d.ts} +1 -1
- package/dist/{useDbCount-Dk0yCKlT.d.ts → useDbCount-DWfYB2iu.d.ts} +16 -2
- package/dist/{useResolveFeedback-C1KucfdQ.d.ts → useResolveFeedback-CxLccZKK.d.ts} +197 -93
- package/dist/{useSupabase-DvWVuHHE.d.ts → useSupabase-DSZNeXnF.d.ts} +1 -1
- package/dist/with-auth/index.d.ts +3 -3
- package/dist/with-auth/index.js +43 -32
- package/dist/with-auth/index.js.map +1 -1
- package/package.json +18 -8
- package/dist/canvas-C4TBBDUL.node +0 -0
- package/dist/canvas-ZQNCL7JL.js +0 -1541
- package/dist/canvas-ZQNCL7JL.js.map +0 -1
- package/dist/chunk-5EFDS7SR.js.map +0 -1
- package/dist/chunk-7DJELYBA.js.map +0 -1
- package/dist/chunk-A7C2FMUF.js.map +0 -1
- package/dist/chunk-EKUDGIQZ.js.map +0 -1
- package/dist/chunk-HAWJTZCK.js.map +0 -1
- package/dist/chunk-IXBDCSM3.js +0 -3391
- package/dist/chunk-IXBDCSM3.js.map +0 -1
- package/dist/chunk-KQNOEADH.js.map +0 -1
- package/dist/chunk-OQ7U6EQ3.js.map +0 -1
- package/dist/dist-NDNRSNOG.js +0 -521
- package/dist/dist-NDNRSNOG.js.map +0 -1
- package/dist/pdf-PHXP7RHD.js +0 -20336
- package/dist/pdf-PHXP7RHD.js.map +0 -1
- /package/dist/{chunk-P4UZ7IXC.js.map → chunk-7D4SUZUM.js.map} +0 -0
- /package/dist/{chunk-3PJTNH2L.js.map → chunk-AKIRHA4Q.js.map} +0 -0
- /package/dist/{chunk-U5UNPBKB.js.map → chunk-FI6JAD5G.js.map} +0 -0
- /package/dist/{chunk-TKWR5AAY.js.map → chunk-JOULSXOI.js.map} +0 -0
- /package/dist/{chunk-WVF7RUW5.js.map → chunk-WM25QE7E.js.map} +0 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSupabaseUrl
|
|
3
3
|
} from "./chunk-GC3TBUWE.js";
|
|
4
|
-
import {
|
|
5
|
-
omit
|
|
6
|
-
} from "./chunk-OQ7U6EQ3.js";
|
|
7
4
|
import {
|
|
8
5
|
useSupabase
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
__require
|
|
12
|
-
} from "./chunk-P4UZ7IXC.js";
|
|
6
|
+
} from "./chunk-DMVUEJG2.js";
|
|
13
7
|
|
|
14
8
|
// src/hooks/useDataLayer.ts
|
|
15
9
|
import { useContext } from "react";
|
|
@@ -31,6 +25,9 @@ function useDataLayerCore() {
|
|
|
31
25
|
}
|
|
32
26
|
return context;
|
|
33
27
|
}
|
|
28
|
+
function useDataLayerCoreOptional() {
|
|
29
|
+
return useContext(DataLayerCoreContext);
|
|
30
|
+
}
|
|
34
31
|
function useDataLayerStatus() {
|
|
35
32
|
const context = useContext(DataLayerStatusContext);
|
|
36
33
|
if (!context) {
|
|
@@ -120,12 +117,10 @@ function useDbQuery(table, options = {}) {
|
|
|
120
117
|
offset: queryOptions.offset
|
|
121
118
|
}), [serializedOptions]);
|
|
122
119
|
const queryFn = useCallback(async () => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
const result = await adapter.query(tableName, memoizedQueryOptions);
|
|
120
|
+
const currentAdapter = registry.getAdapter(tableName);
|
|
121
|
+
const result = await currentAdapter.query(tableName, memoizedQueryOptions);
|
|
127
122
|
return result;
|
|
128
|
-
}, [
|
|
123
|
+
}, [registry, tableName, memoizedQueryOptions]);
|
|
129
124
|
const query = useQuery({
|
|
130
125
|
queryKey,
|
|
131
126
|
queryFn,
|
|
@@ -154,11 +149,18 @@ function useDbQuery(table, options = {}) {
|
|
|
154
149
|
};
|
|
155
150
|
}, []);
|
|
156
151
|
useEffect(() => {
|
|
157
|
-
|
|
152
|
+
let currentAdapter_0;
|
|
153
|
+
try {
|
|
154
|
+
currentAdapter_0 = registry.getAdapter(tableName);
|
|
155
|
+
} catch {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!realtime || !currentAdapter_0?.subscribe) {
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
const isPowerSyncAdapter = currentAdapter_0.name === "powersync";
|
|
162
|
+
let isFirstCallback = isPowerSyncAdapter;
|
|
163
|
+
const unsubscribe = currentAdapter_0.subscribe(tableName, memoizedQueryOptions, (data) => {
|
|
162
164
|
if (isFirstCallback) {
|
|
163
165
|
isFirstCallback = false;
|
|
164
166
|
return;
|
|
@@ -174,9 +176,9 @@ function useDbQuery(table, options = {}) {
|
|
|
174
176
|
}
|
|
175
177
|
});
|
|
176
178
|
return () => {
|
|
177
|
-
unsubscribe();
|
|
179
|
+
unsubscribe?.();
|
|
178
180
|
};
|
|
179
|
-
}, [realtime,
|
|
181
|
+
}, [realtime, registry, tableName, memoizedQueryOptions, queryClient, queryKey, debouncedInvalidate]);
|
|
180
182
|
useEffect(() => {
|
|
181
183
|
const adapterName = adapter?.name ?? "unknown";
|
|
182
184
|
if (query.isError && query.error) {
|
|
@@ -282,6 +284,7 @@ function useDbQueryById(table, id, options = {}) {
|
|
|
282
284
|
import { useCallback as useCallback3, useMemo as useMemo3, useState, useEffect as useEffect3 } from "react";
|
|
283
285
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
284
286
|
import { useSessionStorageState } from "@pol-studios/hooks/storage";
|
|
287
|
+
import { omit } from "@pol-studios/utils";
|
|
285
288
|
var createDefaultFilterState = () => ({
|
|
286
289
|
id: "root",
|
|
287
290
|
op: "AND",
|
|
@@ -525,7 +528,7 @@ function useAdvanceQuery(table, options) {
|
|
|
525
528
|
import { c as _c } from "react/compiler-runtime";
|
|
526
529
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
527
530
|
function useDbInsert(table, t0) {
|
|
528
|
-
const $ = _c(
|
|
531
|
+
const $ = _c(25);
|
|
529
532
|
let t1;
|
|
530
533
|
if ($[0] !== t0) {
|
|
531
534
|
t1 = t0 === void 0 ? {} : t0;
|
|
@@ -555,39 +558,21 @@ function useDbInsert(table, t0) {
|
|
|
555
558
|
}
|
|
556
559
|
const invalidateTables = t3;
|
|
557
560
|
let t4;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
$[5] = registry;
|
|
563
|
-
$[6] = table;
|
|
564
|
-
$[7] = t52;
|
|
565
|
-
} else {
|
|
566
|
-
t52 = $[7];
|
|
567
|
-
}
|
|
568
|
-
t4 = t52;
|
|
569
|
-
} catch {
|
|
570
|
-
t4 = null;
|
|
571
|
-
}
|
|
572
|
-
const adapter = t4;
|
|
573
|
-
let t5;
|
|
574
|
-
if ($[8] !== adapter || $[9] !== table) {
|
|
575
|
-
t5 = async (data) => {
|
|
576
|
-
if (!adapter) {
|
|
577
|
-
throw new Error(`Adapter not available for table: ${table}`);
|
|
578
|
-
}
|
|
579
|
-
return adapter.insert(table, data);
|
|
561
|
+
if ($[5] !== registry || $[6] !== table) {
|
|
562
|
+
t4 = async (data) => {
|
|
563
|
+
const adapter = registry.getAdapter(table, "write");
|
|
564
|
+
return await adapter.insert(table, data);
|
|
580
565
|
};
|
|
581
|
-
$[
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
566
|
+
$[5] = registry;
|
|
567
|
+
$[6] = table;
|
|
568
|
+
$[7] = t4;
|
|
584
569
|
} else {
|
|
585
|
-
|
|
570
|
+
t4 = $[7];
|
|
586
571
|
}
|
|
587
|
-
const mutationFn =
|
|
588
|
-
let
|
|
589
|
-
if ($[
|
|
590
|
-
|
|
572
|
+
const mutationFn = t4;
|
|
573
|
+
let t5;
|
|
574
|
+
if ($[8] !== invalidateTables || $[9] !== onSuccess || $[10] !== queryClient) {
|
|
575
|
+
t5 = (data_0) => {
|
|
591
576
|
invalidateTables.forEach((t) => {
|
|
592
577
|
queryClient.invalidateQueries({
|
|
593
578
|
predicate: (query) => query.queryKey[0] === "v3" && query.queryKey[2] === t
|
|
@@ -595,67 +580,67 @@ function useDbInsert(table, t0) {
|
|
|
595
580
|
});
|
|
596
581
|
onSuccess?.(data_0);
|
|
597
582
|
};
|
|
598
|
-
$[
|
|
599
|
-
$[
|
|
600
|
-
$[
|
|
601
|
-
$[
|
|
583
|
+
$[8] = invalidateTables;
|
|
584
|
+
$[9] = onSuccess;
|
|
585
|
+
$[10] = queryClient;
|
|
586
|
+
$[11] = t5;
|
|
602
587
|
} else {
|
|
603
|
-
|
|
588
|
+
t5 = $[11];
|
|
604
589
|
}
|
|
605
|
-
let
|
|
606
|
-
if ($[
|
|
607
|
-
|
|
590
|
+
let t6;
|
|
591
|
+
if ($[12] !== onError) {
|
|
592
|
+
t6 = (error) => {
|
|
608
593
|
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
609
594
|
};
|
|
610
|
-
$[
|
|
611
|
-
$[
|
|
595
|
+
$[12] = onError;
|
|
596
|
+
$[13] = t6;
|
|
612
597
|
} else {
|
|
613
|
-
|
|
598
|
+
t6 = $[13];
|
|
614
599
|
}
|
|
615
|
-
let
|
|
616
|
-
if ($[
|
|
617
|
-
|
|
600
|
+
let t7;
|
|
601
|
+
if ($[14] !== mutationFn || $[15] !== t5 || $[16] !== t6) {
|
|
602
|
+
t7 = {
|
|
618
603
|
mutationFn,
|
|
619
|
-
onSuccess:
|
|
620
|
-
onError:
|
|
604
|
+
onSuccess: t5,
|
|
605
|
+
onError: t6
|
|
621
606
|
};
|
|
622
|
-
$[
|
|
623
|
-
$[
|
|
624
|
-
$[
|
|
625
|
-
$[
|
|
607
|
+
$[14] = mutationFn;
|
|
608
|
+
$[15] = t5;
|
|
609
|
+
$[16] = t6;
|
|
610
|
+
$[17] = t7;
|
|
626
611
|
} else {
|
|
627
|
-
|
|
612
|
+
t7 = $[17];
|
|
628
613
|
}
|
|
629
|
-
const mutation = useMutation(
|
|
630
|
-
const
|
|
631
|
-
let
|
|
632
|
-
if ($[
|
|
633
|
-
|
|
614
|
+
const mutation = useMutation(t7);
|
|
615
|
+
const t8 = mutation.error;
|
|
616
|
+
let t9;
|
|
617
|
+
if ($[18] !== mutation.data || $[19] !== mutation.isPending || $[20] !== mutation.mutate || $[21] !== mutation.mutateAsync || $[22] !== mutation.reset || $[23] !== t8) {
|
|
618
|
+
t9 = {
|
|
634
619
|
mutate: mutation.mutate,
|
|
635
620
|
mutateAsync: mutation.mutateAsync,
|
|
636
621
|
isPending: mutation.isPending,
|
|
637
|
-
error:
|
|
622
|
+
error: t8,
|
|
638
623
|
reset: mutation.reset,
|
|
639
624
|
data: mutation.data
|
|
640
625
|
};
|
|
641
|
-
$[
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
$[
|
|
645
|
-
$[
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
626
|
+
$[18] = mutation.data;
|
|
627
|
+
$[19] = mutation.isPending;
|
|
628
|
+
$[20] = mutation.mutate;
|
|
629
|
+
$[21] = mutation.mutateAsync;
|
|
630
|
+
$[22] = mutation.reset;
|
|
631
|
+
$[23] = t8;
|
|
632
|
+
$[24] = t9;
|
|
648
633
|
} else {
|
|
649
|
-
|
|
634
|
+
t9 = $[24];
|
|
650
635
|
}
|
|
651
|
-
return
|
|
636
|
+
return t9;
|
|
652
637
|
}
|
|
653
638
|
|
|
654
639
|
// src/hooks/useDbUpdate.ts
|
|
655
640
|
import { c as _c2 } from "react/compiler-runtime";
|
|
656
641
|
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
657
642
|
function useDbUpdate(table, t0) {
|
|
658
|
-
const $ = _c2(
|
|
643
|
+
const $ = _c2(32);
|
|
659
644
|
let t1;
|
|
660
645
|
if ($[0] !== t0) {
|
|
661
646
|
t1 = t0 === void 0 ? {} : t0;
|
|
@@ -687,39 +672,21 @@ function useDbUpdate(table, t0) {
|
|
|
687
672
|
const invalidateTables = t4;
|
|
688
673
|
const optimistic = t3 === void 0 ? false : t3;
|
|
689
674
|
let t5;
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
$[5] = registry;
|
|
695
|
-
$[6] = table;
|
|
696
|
-
$[7] = t62;
|
|
697
|
-
} else {
|
|
698
|
-
t62 = $[7];
|
|
699
|
-
}
|
|
700
|
-
t5 = t62;
|
|
701
|
-
} catch {
|
|
702
|
-
t5 = null;
|
|
703
|
-
}
|
|
704
|
-
const adapter = t5;
|
|
705
|
-
let t6;
|
|
706
|
-
if ($[8] !== adapter || $[9] !== table) {
|
|
707
|
-
t6 = async (params) => {
|
|
708
|
-
if (!adapter) {
|
|
709
|
-
throw new Error(`Adapter not available for table: ${table}`);
|
|
710
|
-
}
|
|
711
|
-
return adapter.update(table, params.id, params.data);
|
|
675
|
+
if ($[5] !== registry || $[6] !== table) {
|
|
676
|
+
t5 = async (params) => {
|
|
677
|
+
const adapter = registry.getAdapter(table, "write");
|
|
678
|
+
return await adapter.update(table, params.id, params.data);
|
|
712
679
|
};
|
|
713
|
-
$[
|
|
714
|
-
$[
|
|
715
|
-
$[
|
|
680
|
+
$[5] = registry;
|
|
681
|
+
$[6] = table;
|
|
682
|
+
$[7] = t5;
|
|
716
683
|
} else {
|
|
717
|
-
|
|
684
|
+
t5 = $[7];
|
|
718
685
|
}
|
|
719
|
-
const mutationFn =
|
|
720
|
-
let
|
|
721
|
-
if ($[
|
|
722
|
-
|
|
686
|
+
const mutationFn = t5;
|
|
687
|
+
let t6;
|
|
688
|
+
if ($[8] !== optimistic || $[9] !== queryClient || $[10] !== table) {
|
|
689
|
+
t6 = optimistic ? async () => {
|
|
723
690
|
await queryClient.cancelQueries({
|
|
724
691
|
predicate: (query) => query.queryKey[0] === "v3" && query.queryKey[2] === table
|
|
725
692
|
});
|
|
@@ -730,16 +697,16 @@ function useDbUpdate(table, t0) {
|
|
|
730
697
|
previousData
|
|
731
698
|
};
|
|
732
699
|
} : void 0;
|
|
733
|
-
$[
|
|
734
|
-
$[
|
|
735
|
-
$[
|
|
736
|
-
$[
|
|
700
|
+
$[8] = optimistic;
|
|
701
|
+
$[9] = queryClient;
|
|
702
|
+
$[10] = table;
|
|
703
|
+
$[11] = t6;
|
|
737
704
|
} else {
|
|
738
|
-
|
|
705
|
+
t6 = $[11];
|
|
739
706
|
}
|
|
740
|
-
let
|
|
741
|
-
if ($[
|
|
742
|
-
|
|
707
|
+
let t7;
|
|
708
|
+
if ($[12] !== invalidateTables || $[13] !== onSuccess || $[14] !== queryClient) {
|
|
709
|
+
t7 = (data) => {
|
|
743
710
|
invalidateTables.forEach((t) => {
|
|
744
711
|
queryClient.invalidateQueries({
|
|
745
712
|
predicate: (query_1) => query_1.queryKey[0] === "v3" && query_1.queryKey[2] === t
|
|
@@ -747,77 +714,77 @@ function useDbUpdate(table, t0) {
|
|
|
747
714
|
});
|
|
748
715
|
onSuccess?.(data);
|
|
749
716
|
};
|
|
750
|
-
$[
|
|
751
|
-
$[
|
|
752
|
-
$[
|
|
753
|
-
$[
|
|
717
|
+
$[12] = invalidateTables;
|
|
718
|
+
$[13] = onSuccess;
|
|
719
|
+
$[14] = queryClient;
|
|
720
|
+
$[15] = t7;
|
|
754
721
|
} else {
|
|
755
|
-
|
|
722
|
+
t7 = $[15];
|
|
756
723
|
}
|
|
757
|
-
let
|
|
758
|
-
if ($[
|
|
759
|
-
|
|
724
|
+
let t8;
|
|
725
|
+
if ($[16] !== onError || $[17] !== optimistic || $[18] !== queryClient) {
|
|
726
|
+
t8 = (error, _variables, context) => {
|
|
760
727
|
if (optimistic && context?.previousData) {
|
|
761
|
-
context.previousData.forEach((
|
|
762
|
-
const [queryKey, data_0] =
|
|
728
|
+
context.previousData.forEach((t92) => {
|
|
729
|
+
const [queryKey, data_0] = t92;
|
|
763
730
|
queryClient.setQueryData(queryKey, data_0);
|
|
764
731
|
});
|
|
765
732
|
}
|
|
766
733
|
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
767
734
|
};
|
|
768
|
-
$[
|
|
769
|
-
$[
|
|
770
|
-
$[
|
|
771
|
-
$[
|
|
735
|
+
$[16] = onError;
|
|
736
|
+
$[17] = optimistic;
|
|
737
|
+
$[18] = queryClient;
|
|
738
|
+
$[19] = t8;
|
|
772
739
|
} else {
|
|
773
|
-
|
|
740
|
+
t8 = $[19];
|
|
774
741
|
}
|
|
775
|
-
let
|
|
776
|
-
if ($[
|
|
777
|
-
|
|
742
|
+
let t9;
|
|
743
|
+
if ($[20] !== mutationFn || $[21] !== t6 || $[22] !== t7 || $[23] !== t8) {
|
|
744
|
+
t9 = {
|
|
778
745
|
mutationFn,
|
|
779
|
-
onMutate:
|
|
780
|
-
onSuccess:
|
|
781
|
-
onError:
|
|
746
|
+
onMutate: t6,
|
|
747
|
+
onSuccess: t7,
|
|
748
|
+
onError: t8
|
|
782
749
|
};
|
|
783
|
-
$[
|
|
784
|
-
$[
|
|
785
|
-
$[
|
|
786
|
-
$[
|
|
787
|
-
$[
|
|
750
|
+
$[20] = mutationFn;
|
|
751
|
+
$[21] = t6;
|
|
752
|
+
$[22] = t7;
|
|
753
|
+
$[23] = t8;
|
|
754
|
+
$[24] = t9;
|
|
788
755
|
} else {
|
|
789
|
-
|
|
756
|
+
t9 = $[24];
|
|
790
757
|
}
|
|
791
|
-
const mutation = useMutation2(
|
|
792
|
-
const
|
|
793
|
-
let
|
|
794
|
-
if ($[
|
|
795
|
-
|
|
758
|
+
const mutation = useMutation2(t9);
|
|
759
|
+
const t10 = mutation.error;
|
|
760
|
+
let t11;
|
|
761
|
+
if ($[25] !== mutation.data || $[26] !== mutation.isPending || $[27] !== mutation.mutate || $[28] !== mutation.mutateAsync || $[29] !== mutation.reset || $[30] !== t10) {
|
|
762
|
+
t11 = {
|
|
796
763
|
mutate: mutation.mutate,
|
|
797
764
|
mutateAsync: mutation.mutateAsync,
|
|
798
765
|
isPending: mutation.isPending,
|
|
799
|
-
error:
|
|
766
|
+
error: t10,
|
|
800
767
|
reset: mutation.reset,
|
|
801
768
|
data: mutation.data
|
|
802
769
|
};
|
|
803
|
-
$[
|
|
804
|
-
$[
|
|
805
|
-
$[
|
|
806
|
-
$[
|
|
807
|
-
$[
|
|
808
|
-
$[
|
|
809
|
-
$[
|
|
770
|
+
$[25] = mutation.data;
|
|
771
|
+
$[26] = mutation.isPending;
|
|
772
|
+
$[27] = mutation.mutate;
|
|
773
|
+
$[28] = mutation.mutateAsync;
|
|
774
|
+
$[29] = mutation.reset;
|
|
775
|
+
$[30] = t10;
|
|
776
|
+
$[31] = t11;
|
|
810
777
|
} else {
|
|
811
|
-
|
|
778
|
+
t11 = $[31];
|
|
812
779
|
}
|
|
813
|
-
return
|
|
780
|
+
return t11;
|
|
814
781
|
}
|
|
815
782
|
|
|
816
783
|
// src/hooks/useDbUpsert.ts
|
|
817
784
|
import { c as _c3 } from "react/compiler-runtime";
|
|
818
785
|
import { useMutation as useMutation3, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
819
786
|
function useDbUpsert(table, t0) {
|
|
820
|
-
const $ = _c3(
|
|
787
|
+
const $ = _c3(25);
|
|
821
788
|
let t1;
|
|
822
789
|
if ($[0] !== t0) {
|
|
823
790
|
t1 = t0 === void 0 ? {} : t0;
|
|
@@ -847,58 +814,21 @@ function useDbUpsert(table, t0) {
|
|
|
847
814
|
}
|
|
848
815
|
const invalidateTables = t3;
|
|
849
816
|
let t4;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
t62 = registry.getAdapter(table);
|
|
855
|
-
$[5] = registry;
|
|
856
|
-
$[6] = table;
|
|
857
|
-
$[7] = t62;
|
|
858
|
-
} else {
|
|
859
|
-
t62 = $[7];
|
|
860
|
-
}
|
|
861
|
-
t4 = t62;
|
|
862
|
-
} catch (t5) {
|
|
863
|
-
const error = t5;
|
|
864
|
-
if (__DEV__) {
|
|
865
|
-
console.warn(`[useDbUpsert] Failed to get adapter for table "${table}":`, error);
|
|
866
|
-
}
|
|
867
|
-
t4 = null;
|
|
868
|
-
}
|
|
869
|
-
const adapter = t4;
|
|
870
|
-
let t6;
|
|
871
|
-
if ($[8] !== adapter || $[9] !== table) {
|
|
872
|
-
t6 = async (data) => {
|
|
873
|
-
if (__DEV__) {
|
|
874
|
-
console.log(`[useDbUpsert] mutationFn called for table "${table}":`, {
|
|
875
|
-
adapterName: adapter?.name ?? "null",
|
|
876
|
-
dataKeys: Object.keys(data),
|
|
877
|
-
hasId: "id" in data
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
if (!adapter) {
|
|
881
|
-
throw new Error(`Adapter not available for table: ${table}`);
|
|
882
|
-
}
|
|
883
|
-
const result = await adapter.upsert(table, data);
|
|
884
|
-
if (__DEV__) {
|
|
885
|
-
console.log(`[useDbUpsert] upsert completed for table "${table}":`, {
|
|
886
|
-
adapterName: adapter.name,
|
|
887
|
-
resultId: result?.id ?? "unknown"
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
return result;
|
|
817
|
+
if ($[5] !== registry || $[6] !== table) {
|
|
818
|
+
t4 = async (data) => {
|
|
819
|
+
const adapter = registry.getAdapter(table, "write");
|
|
820
|
+
return await adapter.upsert(table, data);
|
|
891
821
|
};
|
|
892
|
-
$[
|
|
893
|
-
$[
|
|
894
|
-
$[
|
|
822
|
+
$[5] = registry;
|
|
823
|
+
$[6] = table;
|
|
824
|
+
$[7] = t4;
|
|
895
825
|
} else {
|
|
896
|
-
|
|
826
|
+
t4 = $[7];
|
|
897
827
|
}
|
|
898
|
-
const mutationFn =
|
|
899
|
-
let
|
|
900
|
-
if ($[
|
|
901
|
-
|
|
828
|
+
const mutationFn = t4;
|
|
829
|
+
let t5;
|
|
830
|
+
if ($[8] !== invalidateTables || $[9] !== onSuccess || $[10] !== queryClient) {
|
|
831
|
+
t5 = (data_0) => {
|
|
902
832
|
invalidateTables.forEach((t) => {
|
|
903
833
|
queryClient.invalidateQueries({
|
|
904
834
|
predicate: (query) => query.queryKey[0] === "v3" && query.queryKey[2] === t
|
|
@@ -906,67 +836,67 @@ function useDbUpsert(table, t0) {
|
|
|
906
836
|
});
|
|
907
837
|
onSuccess?.(data_0);
|
|
908
838
|
};
|
|
909
|
-
$[
|
|
910
|
-
$[
|
|
911
|
-
$[
|
|
912
|
-
$[
|
|
839
|
+
$[8] = invalidateTables;
|
|
840
|
+
$[9] = onSuccess;
|
|
841
|
+
$[10] = queryClient;
|
|
842
|
+
$[11] = t5;
|
|
913
843
|
} else {
|
|
914
|
-
|
|
844
|
+
t5 = $[11];
|
|
915
845
|
}
|
|
916
|
-
let
|
|
917
|
-
if ($[
|
|
918
|
-
|
|
919
|
-
onError?.(
|
|
846
|
+
let t6;
|
|
847
|
+
if ($[12] !== onError) {
|
|
848
|
+
t6 = (error) => {
|
|
849
|
+
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
920
850
|
};
|
|
921
|
-
$[
|
|
922
|
-
$[
|
|
851
|
+
$[12] = onError;
|
|
852
|
+
$[13] = t6;
|
|
923
853
|
} else {
|
|
924
|
-
|
|
854
|
+
t6 = $[13];
|
|
925
855
|
}
|
|
926
|
-
let
|
|
927
|
-
if ($[
|
|
928
|
-
|
|
856
|
+
let t7;
|
|
857
|
+
if ($[14] !== mutationFn || $[15] !== t5 || $[16] !== t6) {
|
|
858
|
+
t7 = {
|
|
929
859
|
mutationFn,
|
|
930
|
-
onSuccess:
|
|
931
|
-
onError:
|
|
860
|
+
onSuccess: t5,
|
|
861
|
+
onError: t6
|
|
932
862
|
};
|
|
933
|
-
$[
|
|
934
|
-
$[
|
|
935
|
-
$[
|
|
936
|
-
$[
|
|
863
|
+
$[14] = mutationFn;
|
|
864
|
+
$[15] = t5;
|
|
865
|
+
$[16] = t6;
|
|
866
|
+
$[17] = t7;
|
|
937
867
|
} else {
|
|
938
|
-
|
|
868
|
+
t7 = $[17];
|
|
939
869
|
}
|
|
940
|
-
const mutation = useMutation3(
|
|
941
|
-
const
|
|
942
|
-
let
|
|
943
|
-
if ($[
|
|
944
|
-
|
|
870
|
+
const mutation = useMutation3(t7);
|
|
871
|
+
const t8 = mutation.error;
|
|
872
|
+
let t9;
|
|
873
|
+
if ($[18] !== mutation.data || $[19] !== mutation.isPending || $[20] !== mutation.mutate || $[21] !== mutation.mutateAsync || $[22] !== mutation.reset || $[23] !== t8) {
|
|
874
|
+
t9 = {
|
|
945
875
|
mutate: mutation.mutate,
|
|
946
876
|
mutateAsync: mutation.mutateAsync,
|
|
947
877
|
isPending: mutation.isPending,
|
|
948
|
-
error:
|
|
878
|
+
error: t8,
|
|
949
879
|
reset: mutation.reset,
|
|
950
880
|
data: mutation.data
|
|
951
881
|
};
|
|
952
|
-
$[
|
|
953
|
-
$[
|
|
954
|
-
$[
|
|
955
|
-
$[
|
|
956
|
-
$[
|
|
957
|
-
$[
|
|
958
|
-
$[
|
|
882
|
+
$[18] = mutation.data;
|
|
883
|
+
$[19] = mutation.isPending;
|
|
884
|
+
$[20] = mutation.mutate;
|
|
885
|
+
$[21] = mutation.mutateAsync;
|
|
886
|
+
$[22] = mutation.reset;
|
|
887
|
+
$[23] = t8;
|
|
888
|
+
$[24] = t9;
|
|
959
889
|
} else {
|
|
960
|
-
|
|
890
|
+
t9 = $[24];
|
|
961
891
|
}
|
|
962
|
-
return
|
|
892
|
+
return t9;
|
|
963
893
|
}
|
|
964
894
|
|
|
965
895
|
// src/hooks/useDbDelete.ts
|
|
966
896
|
import { c as _c4 } from "react/compiler-runtime";
|
|
967
897
|
import { useMutation as useMutation4, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
968
898
|
function useDbDelete(table, t0) {
|
|
969
|
-
const $ = _c4(
|
|
899
|
+
const $ = _c4(31);
|
|
970
900
|
let t1;
|
|
971
901
|
if ($[0] !== t0) {
|
|
972
902
|
t1 = t0 === void 0 ? {} : t0;
|
|
@@ -998,39 +928,21 @@ function useDbDelete(table, t0) {
|
|
|
998
928
|
const invalidateTables = t4;
|
|
999
929
|
const optimistic = t3 === void 0 ? false : t3;
|
|
1000
930
|
let t5;
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
t62 = registry.getAdapter(table);
|
|
1005
|
-
$[5] = registry;
|
|
1006
|
-
$[6] = table;
|
|
1007
|
-
$[7] = t62;
|
|
1008
|
-
} else {
|
|
1009
|
-
t62 = $[7];
|
|
1010
|
-
}
|
|
1011
|
-
t5 = t62;
|
|
1012
|
-
} catch {
|
|
1013
|
-
t5 = null;
|
|
1014
|
-
}
|
|
1015
|
-
const adapter = t5;
|
|
1016
|
-
let t6;
|
|
1017
|
-
if ($[8] !== adapter || $[9] !== table) {
|
|
1018
|
-
t6 = async (id) => {
|
|
1019
|
-
if (!adapter) {
|
|
1020
|
-
throw new Error(`Adapter not available for table: ${table}`);
|
|
1021
|
-
}
|
|
931
|
+
if ($[5] !== registry || $[6] !== table) {
|
|
932
|
+
t5 = async (id) => {
|
|
933
|
+
const adapter = registry.getAdapter(table, "write");
|
|
1022
934
|
await adapter.delete(table, id);
|
|
1023
935
|
};
|
|
1024
|
-
$[
|
|
1025
|
-
$[
|
|
1026
|
-
$[
|
|
936
|
+
$[5] = registry;
|
|
937
|
+
$[6] = table;
|
|
938
|
+
$[7] = t5;
|
|
1027
939
|
} else {
|
|
1028
|
-
|
|
940
|
+
t5 = $[7];
|
|
1029
941
|
}
|
|
1030
|
-
const mutationFn =
|
|
1031
|
-
let
|
|
1032
|
-
if ($[
|
|
1033
|
-
|
|
942
|
+
const mutationFn = t5;
|
|
943
|
+
let t6;
|
|
944
|
+
if ($[8] !== optimistic || $[9] !== queryClient || $[10] !== table) {
|
|
945
|
+
t6 = optimistic ? async (id_0) => {
|
|
1034
946
|
await queryClient.cancelQueries({
|
|
1035
947
|
predicate: (query) => query.queryKey[0] === "v3" && query.queryKey[2] === table
|
|
1036
948
|
});
|
|
@@ -1052,16 +964,16 @@ function useDbDelete(table, t0) {
|
|
|
1052
964
|
previousData
|
|
1053
965
|
};
|
|
1054
966
|
} : void 0;
|
|
1055
|
-
$[
|
|
1056
|
-
$[
|
|
1057
|
-
$[
|
|
1058
|
-
$[
|
|
967
|
+
$[8] = optimistic;
|
|
968
|
+
$[9] = queryClient;
|
|
969
|
+
$[10] = table;
|
|
970
|
+
$[11] = t6;
|
|
1059
971
|
} else {
|
|
1060
|
-
|
|
972
|
+
t6 = $[11];
|
|
1061
973
|
}
|
|
1062
|
-
let
|
|
1063
|
-
if ($[
|
|
1064
|
-
|
|
974
|
+
let t7;
|
|
975
|
+
if ($[12] !== invalidateTables || $[13] !== onSuccess || $[14] !== queryClient) {
|
|
976
|
+
t7 = () => {
|
|
1065
977
|
invalidateTables.forEach((t) => {
|
|
1066
978
|
queryClient.invalidateQueries({
|
|
1067
979
|
predicate: (query_2) => query_2.queryKey[0] === "v3" && query_2.queryKey[2] === t
|
|
@@ -1069,68 +981,68 @@ function useDbDelete(table, t0) {
|
|
|
1069
981
|
});
|
|
1070
982
|
onSuccess?.();
|
|
1071
983
|
};
|
|
1072
|
-
$[
|
|
1073
|
-
$[
|
|
1074
|
-
$[
|
|
1075
|
-
$[
|
|
984
|
+
$[12] = invalidateTables;
|
|
985
|
+
$[13] = onSuccess;
|
|
986
|
+
$[14] = queryClient;
|
|
987
|
+
$[15] = t7;
|
|
1076
988
|
} else {
|
|
1077
|
-
|
|
989
|
+
t7 = $[15];
|
|
1078
990
|
}
|
|
1079
|
-
let
|
|
1080
|
-
if ($[
|
|
1081
|
-
|
|
991
|
+
let t8;
|
|
992
|
+
if ($[16] !== onError || $[17] !== optimistic || $[18] !== queryClient) {
|
|
993
|
+
t8 = (error, _id, context) => {
|
|
1082
994
|
if (optimistic && context?.previousData) {
|
|
1083
|
-
context.previousData.forEach((
|
|
1084
|
-
const [queryKey, data] =
|
|
995
|
+
context.previousData.forEach((t92) => {
|
|
996
|
+
const [queryKey, data] = t92;
|
|
1085
997
|
queryClient.setQueryData(queryKey, data);
|
|
1086
998
|
});
|
|
1087
999
|
}
|
|
1088
1000
|
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
1089
1001
|
};
|
|
1090
|
-
$[
|
|
1091
|
-
$[
|
|
1092
|
-
$[
|
|
1093
|
-
$[
|
|
1002
|
+
$[16] = onError;
|
|
1003
|
+
$[17] = optimistic;
|
|
1004
|
+
$[18] = queryClient;
|
|
1005
|
+
$[19] = t8;
|
|
1094
1006
|
} else {
|
|
1095
|
-
|
|
1007
|
+
t8 = $[19];
|
|
1096
1008
|
}
|
|
1097
|
-
let
|
|
1098
|
-
if ($[
|
|
1099
|
-
|
|
1009
|
+
let t9;
|
|
1010
|
+
if ($[20] !== mutationFn || $[21] !== t6 || $[22] !== t7 || $[23] !== t8) {
|
|
1011
|
+
t9 = {
|
|
1100
1012
|
mutationFn,
|
|
1101
|
-
onMutate:
|
|
1102
|
-
onSuccess:
|
|
1103
|
-
onError:
|
|
1013
|
+
onMutate: t6,
|
|
1014
|
+
onSuccess: t7,
|
|
1015
|
+
onError: t8
|
|
1104
1016
|
};
|
|
1105
|
-
$[
|
|
1106
|
-
$[
|
|
1107
|
-
$[
|
|
1108
|
-
$[
|
|
1109
|
-
$[
|
|
1017
|
+
$[20] = mutationFn;
|
|
1018
|
+
$[21] = t6;
|
|
1019
|
+
$[22] = t7;
|
|
1020
|
+
$[23] = t8;
|
|
1021
|
+
$[24] = t9;
|
|
1110
1022
|
} else {
|
|
1111
|
-
|
|
1023
|
+
t9 = $[24];
|
|
1112
1024
|
}
|
|
1113
|
-
const mutation = useMutation4(
|
|
1114
|
-
const
|
|
1115
|
-
let
|
|
1116
|
-
if ($[
|
|
1117
|
-
|
|
1025
|
+
const mutation = useMutation4(t9);
|
|
1026
|
+
const t10 = mutation.error;
|
|
1027
|
+
let t11;
|
|
1028
|
+
if ($[25] !== mutation.isPending || $[26] !== mutation.mutate || $[27] !== mutation.mutateAsync || $[28] !== mutation.reset || $[29] !== t10) {
|
|
1029
|
+
t11 = {
|
|
1118
1030
|
mutate: mutation.mutate,
|
|
1119
1031
|
mutateAsync: mutation.mutateAsync,
|
|
1120
1032
|
isPending: mutation.isPending,
|
|
1121
|
-
error:
|
|
1033
|
+
error: t10,
|
|
1122
1034
|
reset: mutation.reset
|
|
1123
1035
|
};
|
|
1124
|
-
$[
|
|
1125
|
-
$[
|
|
1126
|
-
$[
|
|
1127
|
-
$[
|
|
1128
|
-
$[
|
|
1129
|
-
$[
|
|
1036
|
+
$[25] = mutation.isPending;
|
|
1037
|
+
$[26] = mutation.mutate;
|
|
1038
|
+
$[27] = mutation.mutateAsync;
|
|
1039
|
+
$[28] = mutation.reset;
|
|
1040
|
+
$[29] = t10;
|
|
1041
|
+
$[30] = t11;
|
|
1130
1042
|
} else {
|
|
1131
|
-
|
|
1043
|
+
t11 = $[30];
|
|
1132
1044
|
}
|
|
1133
|
-
return
|
|
1045
|
+
return t11;
|
|
1134
1046
|
}
|
|
1135
1047
|
|
|
1136
1048
|
// src/hooks/useDbInfiniteQuery.ts
|
|
@@ -1493,36 +1405,9 @@ function useSyncStatus() {
|
|
|
1493
1405
|
|
|
1494
1406
|
// src/hooks/useSyncControl.ts
|
|
1495
1407
|
import { c as _c7 } from "react/compiler-runtime";
|
|
1496
|
-
import { useContext as useContext3
|
|
1497
|
-
var failedUploadStore = null;
|
|
1498
|
-
try {
|
|
1499
|
-
const powersyncSync = __require("@pol-studios/powersync/sync");
|
|
1500
|
-
failedUploadStore = powersyncSync.failedUploadStore;
|
|
1501
|
-
} catch {
|
|
1502
|
-
}
|
|
1503
|
-
var failedUploadListeners = /* @__PURE__ */ new Set();
|
|
1504
|
-
var cachedFailedUploads = [];
|
|
1505
|
-
function subscribeToFailedUploads(callback) {
|
|
1506
|
-
failedUploadListeners.add(callback);
|
|
1507
|
-
return () => {
|
|
1508
|
-
failedUploadListeners.delete(callback);
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
function getFailedUploadsSnapshot() {
|
|
1512
|
-
if (!failedUploadStore) {
|
|
1513
|
-
return [];
|
|
1514
|
-
}
|
|
1515
|
-
const uploads = failedUploadStore.getAll();
|
|
1516
|
-
if (uploads.length !== cachedFailedUploads.length || uploads.some((u, i) => u.id !== cachedFailedUploads[i]?.id)) {
|
|
1517
|
-
cachedFailedUploads = uploads;
|
|
1518
|
-
}
|
|
1519
|
-
return cachedFailedUploads;
|
|
1520
|
-
}
|
|
1521
|
-
function notifyFailedUploadListeners() {
|
|
1522
|
-
failedUploadListeners.forEach((listener) => listener());
|
|
1523
|
-
}
|
|
1408
|
+
import { useContext as useContext3 } from "react";
|
|
1524
1409
|
function useSyncControl() {
|
|
1525
|
-
const $ = _c7(
|
|
1410
|
+
const $ = _c7(1);
|
|
1526
1411
|
const coreContext = useContext3(DataLayerCoreContext);
|
|
1527
1412
|
if (!coreContext) {
|
|
1528
1413
|
throw new Error("useSyncControl must be used within a DataLayerProvider. Make sure you have wrapped your app with <DataLayerProvider>.");
|
|
@@ -1532,137 +1417,57 @@ function useSyncControl() {
|
|
|
1532
1417
|
powerSync
|
|
1533
1418
|
} = coreContext;
|
|
1534
1419
|
const isPowerSyncActive = powerSync !== null;
|
|
1535
|
-
const [isAutoRetryPaused, setIsAutoRetryPaused] = useState3(false);
|
|
1536
|
-
const failedUploads = useSyncExternalStore(subscribeToFailedUploads, getFailedUploadsSnapshot, _temp);
|
|
1537
1420
|
let t0;
|
|
1538
|
-
if ($[0]
|
|
1539
|
-
t0 =
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
notifyFailedUploadListeners();
|
|
1550
|
-
await syncControl.triggerSync();
|
|
1421
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1422
|
+
t0 = {
|
|
1423
|
+
triggerSync: _temp,
|
|
1424
|
+
startLiveSync: _temp2,
|
|
1425
|
+
stopLiveSync: _temp3,
|
|
1426
|
+
setScope: _temp4,
|
|
1427
|
+
pauseAutoRetry: _temp5,
|
|
1428
|
+
resumeAutoRetry: _temp6,
|
|
1429
|
+
isAutoRetryPaused: false,
|
|
1430
|
+
addPendingMutation: _temp7,
|
|
1431
|
+
removePendingMutation: _temp8
|
|
1551
1432
|
};
|
|
1552
|
-
$[0] =
|
|
1553
|
-
$[1] = syncControl;
|
|
1554
|
-
$[2] = t0;
|
|
1433
|
+
$[0] = t0;
|
|
1555
1434
|
} else {
|
|
1556
|
-
t0 = $[
|
|
1435
|
+
t0 = $[0];
|
|
1557
1436
|
}
|
|
1558
|
-
const
|
|
1559
|
-
const clearFailedUploads = _temp2;
|
|
1437
|
+
const noOpControls = t0;
|
|
1560
1438
|
let t1;
|
|
1561
|
-
if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1562
|
-
t1 = () => {
|
|
1563
|
-
setIsAutoRetryPaused(true);
|
|
1564
|
-
console.log("[useSyncControl] Auto-retry paused");
|
|
1565
|
-
};
|
|
1566
|
-
$[3] = t1;
|
|
1567
|
-
} else {
|
|
1568
|
-
t1 = $[3];
|
|
1569
|
-
}
|
|
1570
|
-
const pauseAutoRetry = t1;
|
|
1571
|
-
let t2;
|
|
1572
|
-
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1573
|
-
t2 = () => {
|
|
1574
|
-
setIsAutoRetryPaused(false);
|
|
1575
|
-
console.log("[useSyncControl] Auto-retry resumed");
|
|
1576
|
-
};
|
|
1577
|
-
$[4] = t2;
|
|
1578
|
-
} else {
|
|
1579
|
-
t2 = $[4];
|
|
1580
|
-
}
|
|
1581
|
-
const resumeAutoRetry = t2;
|
|
1582
|
-
let t3;
|
|
1583
|
-
if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1584
|
-
t3 = {
|
|
1585
|
-
triggerSync: _temp3,
|
|
1586
|
-
startLiveSync: _temp4,
|
|
1587
|
-
stopLiveSync: _temp5,
|
|
1588
|
-
setScope: _temp6,
|
|
1589
|
-
retryFailedUploads: _temp7,
|
|
1590
|
-
clearFailedUploads: _temp8,
|
|
1591
|
-
failedUploads: [],
|
|
1592
|
-
pauseAutoRetry: _temp9,
|
|
1593
|
-
resumeAutoRetry: _temp0,
|
|
1594
|
-
isAutoRetryPaused: false
|
|
1595
|
-
};
|
|
1596
|
-
$[5] = t3;
|
|
1597
|
-
} else {
|
|
1598
|
-
t3 = $[5];
|
|
1599
|
-
}
|
|
1600
|
-
const noOpControls = t3;
|
|
1601
|
-
let t4;
|
|
1602
1439
|
bb0: {
|
|
1603
1440
|
if (isPowerSyncActive) {
|
|
1604
|
-
|
|
1605
|
-
if ($[6] !== failedUploads || $[7] !== isAutoRetryPaused || $[8] !== retryFailedUploads || $[9] !== syncControl) {
|
|
1606
|
-
t5 = {
|
|
1607
|
-
...syncControl,
|
|
1608
|
-
retryFailedUploads,
|
|
1609
|
-
clearFailedUploads,
|
|
1610
|
-
failedUploads,
|
|
1611
|
-
pauseAutoRetry,
|
|
1612
|
-
resumeAutoRetry,
|
|
1613
|
-
isAutoRetryPaused
|
|
1614
|
-
};
|
|
1615
|
-
$[6] = failedUploads;
|
|
1616
|
-
$[7] = isAutoRetryPaused;
|
|
1617
|
-
$[8] = retryFailedUploads;
|
|
1618
|
-
$[9] = syncControl;
|
|
1619
|
-
$[10] = t5;
|
|
1620
|
-
} else {
|
|
1621
|
-
t5 = $[10];
|
|
1622
|
-
}
|
|
1623
|
-
t4 = t5;
|
|
1441
|
+
t1 = syncControl;
|
|
1624
1442
|
break bb0;
|
|
1625
1443
|
}
|
|
1626
|
-
|
|
1444
|
+
t1 = noOpControls;
|
|
1627
1445
|
}
|
|
1628
|
-
const controls =
|
|
1446
|
+
const controls = t1;
|
|
1629
1447
|
return controls;
|
|
1630
1448
|
}
|
|
1631
|
-
function
|
|
1632
|
-
console.warn("[useSyncControl] resumeAutoRetry called but PowerSync is not available");
|
|
1449
|
+
function _temp8() {
|
|
1633
1450
|
}
|
|
1634
|
-
function
|
|
1635
|
-
console.warn("[useSyncControl] pauseAutoRetry called but PowerSync is not available");
|
|
1451
|
+
function _temp7() {
|
|
1636
1452
|
}
|
|
1637
|
-
function
|
|
1638
|
-
console.warn("[useSyncControl]
|
|
1453
|
+
function _temp6() {
|
|
1454
|
+
console.warn("[useSyncControl] resumeAutoRetry called but PowerSync is not available");
|
|
1639
1455
|
}
|
|
1640
|
-
|
|
1641
|
-
console.warn("[useSyncControl]
|
|
1456
|
+
function _temp5() {
|
|
1457
|
+
console.warn("[useSyncControl] pauseAutoRetry called but PowerSync is not available");
|
|
1642
1458
|
}
|
|
1643
|
-
async function
|
|
1459
|
+
async function _temp4(_scopeName, _values) {
|
|
1644
1460
|
console.warn("[useSyncControl] setScope called but PowerSync is not available");
|
|
1645
1461
|
}
|
|
1646
|
-
function
|
|
1462
|
+
function _temp3() {
|
|
1647
1463
|
console.warn("[useSyncControl] stopLiveSync called but PowerSync is not available");
|
|
1648
1464
|
}
|
|
1649
|
-
async function
|
|
1465
|
+
async function _temp2() {
|
|
1650
1466
|
console.warn("[useSyncControl] startLiveSync called but PowerSync is not available");
|
|
1651
1467
|
}
|
|
1652
|
-
async function
|
|
1468
|
+
async function _temp() {
|
|
1653
1469
|
console.warn("[useSyncControl] triggerSync called but PowerSync is not available");
|
|
1654
1470
|
}
|
|
1655
|
-
function _temp2() {
|
|
1656
|
-
if (!failedUploadStore) {
|
|
1657
|
-
console.warn("[useSyncControl] clearFailedUploads called but failedUploadStore is not available");
|
|
1658
|
-
return;
|
|
1659
|
-
}
|
|
1660
|
-
failedUploadStore.clear();
|
|
1661
|
-
notifyFailedUploadListeners();
|
|
1662
|
-
}
|
|
1663
|
-
function _temp() {
|
|
1664
|
-
return [];
|
|
1665
|
-
}
|
|
1666
1471
|
|
|
1667
1472
|
// src/hooks/useOnlineStatus.ts
|
|
1668
1473
|
import { c as _c8 } from "react/compiler-runtime";
|
|
@@ -1697,6 +1502,7 @@ export {
|
|
|
1697
1502
|
DataLayerStatusContext,
|
|
1698
1503
|
DataLayerContext,
|
|
1699
1504
|
useDataLayerCore,
|
|
1505
|
+
useDataLayerCoreOptional,
|
|
1700
1506
|
useDataLayerStatus,
|
|
1701
1507
|
useDataLayer,
|
|
1702
1508
|
useDataLayerOptional,
|
|
@@ -1713,4 +1519,4 @@ export {
|
|
|
1713
1519
|
useSyncControl,
|
|
1714
1520
|
useOnlineStatus
|
|
1715
1521
|
};
|
|
1716
|
-
//# sourceMappingURL=chunk-
|
|
1522
|
+
//# sourceMappingURL=chunk-3XCW225W.js.map
|