@pol-studios/db 1.0.19 → 1.0.22
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-ZmLPYR_s.d.ts +825 -0
- package/dist/EntityPermissions-DwFt4tUd.d.ts +35 -0
- package/dist/FilterConfig-Bt2Ek74z.d.ts +99 -0
- package/dist/UserMetadataContext-B8gVWGMl.d.ts +35 -0
- package/dist/UserMetadataContext-DntmpK41.d.ts +33 -0
- package/dist/auth/context.d.ts +48 -0
- package/dist/auth/context.js +2 -2
- package/dist/auth/guards.d.ts +180 -0
- package/dist/auth/hooks.d.ts +312 -0
- package/dist/auth/hooks.js +3 -3
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.js +3 -3
- package/dist/{chunk-2T6WTCP4.js → chunk-3EVWXMUV.js} +54 -155
- package/dist/chunk-3EVWXMUV.js.map +1 -0
- package/dist/{chunk-YERWPV6B.js → chunk-3FHAKRDV.js} +145 -19
- package/dist/{chunk-YERWPV6B.js.map → chunk-3FHAKRDV.js.map} +1 -1
- package/dist/{chunk-X3HZLNBV.js → chunk-FKRACEHV.js} +2 -962
- package/dist/chunk-FKRACEHV.js.map +1 -0
- package/dist/{chunk-N26IEHZT.js → chunk-FZF26ZRB.js} +18 -2
- package/dist/{chunk-N26IEHZT.js.map → chunk-FZF26ZRB.js.map} +1 -1
- package/dist/chunk-HTJ2FQW5.js +963 -0
- package/dist/chunk-HTJ2FQW5.js.map +1 -0
- package/dist/{chunk-R5B2XMN5.js → chunk-I4BDZDHX.js} +1614 -2141
- package/dist/chunk-I4BDZDHX.js.map +1 -0
- package/dist/{chunk-36DVUMQD.js → chunk-LPC64MD4.js} +2 -2
- package/dist/{chunk-72WV3ALS.js → chunk-OUUQSI3Y.js} +2 -2
- package/dist/{chunk-RMRYGICS.js → chunk-WP6TIVPH.js} +4 -4
- package/dist/client/index.d.ts +16 -0
- package/dist/core/index.d.ts +568 -0
- package/dist/database.types-ChFCG-4M.d.ts +8604 -0
- package/dist/executor-CB4KHyYG.d.ts +507 -0
- package/dist/gen/index.d.ts +1099 -0
- package/dist/hooks/index.d.ts +119 -0
- package/dist/hooks/index.js +1 -1
- package/dist/index-2YySlz7X.d.ts +433 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +14 -95
- package/dist/index.native.d.ts +775 -0
- package/dist/index.native.js +17 -96
- package/dist/index.web.d.ts +438 -0
- package/dist/index.web.js +585 -46
- package/dist/index.web.js.map +1 -1
- package/dist/mutation/index.d.ts +58 -0
- package/dist/parser/index.d.ts +366 -0
- package/dist/powersync-bridge/index.d.ts +284 -0
- package/dist/powersync-bridge/index.js +1 -1
- package/dist/query/index.d.ts +723 -0
- package/dist/query/index.js +10 -8
- package/dist/realtime/index.d.ts +44 -0
- package/dist/select-query-parser-BwyHum1L.d.ts +352 -0
- package/dist/setupAuthContext-Kv-THH-h.d.ts +61 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types-CYr9JiUE.d.ts +62 -0
- package/dist/useBatchUpsert-9OYjibLh.d.ts +24 -0
- package/dist/useDbCount-s-aR9YeV.d.ts +1082 -0
- package/dist/useDbQuery-C-TL8jY1.d.ts +19 -0
- package/dist/useReceiptAI-6HkRpRml.d.ts +58 -0
- package/dist/useResolveFeedback-DTGcHpCs.d.ts +882 -0
- package/dist/useSupabase-DvWVuHHE.d.ts +28 -0
- package/dist/with-auth/index.d.ts +704 -0
- package/dist/with-auth/index.js +4 -4
- package/package.json +50 -1
- package/dist/chunk-2T6WTCP4.js.map +0 -1
- package/dist/chunk-R5B2XMN5.js.map +0 -1
- package/dist/chunk-X3HZLNBV.js.map +0 -1
- /package/dist/{chunk-36DVUMQD.js.map → chunk-LPC64MD4.js.map} +0 -0
- /package/dist/{chunk-72WV3ALS.js.map → chunk-OUUQSI3Y.js.map} +0 -0
- /package/dist/{chunk-RMRYGICS.js.map → chunk-WP6TIVPH.js.map} +0 -0
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
useSupabase
|
|
9
9
|
} from "./chunk-5EFDS7SR.js";
|
|
10
|
+
import {
|
|
11
|
+
__require
|
|
12
|
+
} from "./chunk-P4UZ7IXC.js";
|
|
10
13
|
|
|
11
14
|
// src/hooks/useDataLayer.ts
|
|
12
15
|
import { useContext } from "react";
|
|
@@ -1446,9 +1449,36 @@ function useSyncStatus() {
|
|
|
1446
1449
|
|
|
1447
1450
|
// src/hooks/useSyncControl.ts
|
|
1448
1451
|
import { c as _c7 } from "react/compiler-runtime";
|
|
1449
|
-
import { useContext as useContext3 } from "react";
|
|
1452
|
+
import { useContext as useContext3, useState as useState3, useSyncExternalStore } from "react";
|
|
1453
|
+
var failedUploadStore = null;
|
|
1454
|
+
try {
|
|
1455
|
+
const powersyncSync = __require("@pol-studios/powersync/sync");
|
|
1456
|
+
failedUploadStore = powersyncSync.failedUploadStore;
|
|
1457
|
+
} catch {
|
|
1458
|
+
}
|
|
1459
|
+
var failedUploadListeners = /* @__PURE__ */ new Set();
|
|
1460
|
+
var cachedFailedUploads = [];
|
|
1461
|
+
function subscribeToFailedUploads(callback) {
|
|
1462
|
+
failedUploadListeners.add(callback);
|
|
1463
|
+
return () => {
|
|
1464
|
+
failedUploadListeners.delete(callback);
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
function getFailedUploadsSnapshot() {
|
|
1468
|
+
if (!failedUploadStore) {
|
|
1469
|
+
return [];
|
|
1470
|
+
}
|
|
1471
|
+
const uploads = failedUploadStore.getAll();
|
|
1472
|
+
if (uploads.length !== cachedFailedUploads.length || uploads.some((u, i) => u.id !== cachedFailedUploads[i]?.id)) {
|
|
1473
|
+
cachedFailedUploads = uploads;
|
|
1474
|
+
}
|
|
1475
|
+
return cachedFailedUploads;
|
|
1476
|
+
}
|
|
1477
|
+
function notifyFailedUploadListeners() {
|
|
1478
|
+
failedUploadListeners.forEach((listener) => listener());
|
|
1479
|
+
}
|
|
1450
1480
|
function useSyncControl() {
|
|
1451
|
-
const $ = _c7(
|
|
1481
|
+
const $ = _c7(12);
|
|
1452
1482
|
const statusContext = useContext3(DataLayerStatusContext);
|
|
1453
1483
|
const coreContext = useContext3(DataLayerCoreContext);
|
|
1454
1484
|
if (!statusContext || !coreContext) {
|
|
@@ -1461,42 +1491,138 @@ function useSyncControl() {
|
|
|
1461
1491
|
const {
|
|
1462
1492
|
powerSync
|
|
1463
1493
|
} = coreContext;
|
|
1494
|
+
const [isAutoRetryPaused, setIsAutoRetryPaused] = useState3(false);
|
|
1495
|
+
const failedUploads = useSyncExternalStore(subscribeToFailedUploads, getFailedUploadsSnapshot, _temp);
|
|
1464
1496
|
let t0;
|
|
1465
|
-
if ($[0]
|
|
1466
|
-
t0 = {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1497
|
+
if ($[0] !== powerSync || $[1] !== status.currentBackend || $[2] !== syncControl) {
|
|
1498
|
+
t0 = async () => {
|
|
1499
|
+
if (!powerSync || status.currentBackend !== "powersync") {
|
|
1500
|
+
console.warn("[useSyncControl] retryFailedUploads called but PowerSync is not available");
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
if (!failedUploadStore) {
|
|
1504
|
+
console.warn("[useSyncControl] retryFailedUploads called but failedUploadStore is not available");
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
failedUploadStore.clear();
|
|
1508
|
+
notifyFailedUploadListeners();
|
|
1509
|
+
await syncControl.triggerSync();
|
|
1471
1510
|
};
|
|
1472
|
-
$[0] =
|
|
1511
|
+
$[0] = powerSync;
|
|
1512
|
+
$[1] = status.currentBackend;
|
|
1513
|
+
$[2] = syncControl;
|
|
1514
|
+
$[3] = t0;
|
|
1473
1515
|
} else {
|
|
1474
|
-
t0 = $[
|
|
1516
|
+
t0 = $[3];
|
|
1475
1517
|
}
|
|
1476
|
-
const
|
|
1518
|
+
const retryFailedUploads = t0;
|
|
1519
|
+
const clearFailedUploads = _temp2;
|
|
1477
1520
|
let t1;
|
|
1521
|
+
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1522
|
+
t1 = () => {
|
|
1523
|
+
setIsAutoRetryPaused(true);
|
|
1524
|
+
console.log("[useSyncControl] Auto-retry paused");
|
|
1525
|
+
};
|
|
1526
|
+
$[4] = t1;
|
|
1527
|
+
} else {
|
|
1528
|
+
t1 = $[4];
|
|
1529
|
+
}
|
|
1530
|
+
const pauseAutoRetry = t1;
|
|
1531
|
+
let t2;
|
|
1532
|
+
if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1533
|
+
t2 = () => {
|
|
1534
|
+
setIsAutoRetryPaused(false);
|
|
1535
|
+
console.log("[useSyncControl] Auto-retry resumed");
|
|
1536
|
+
};
|
|
1537
|
+
$[5] = t2;
|
|
1538
|
+
} else {
|
|
1539
|
+
t2 = $[5];
|
|
1540
|
+
}
|
|
1541
|
+
const resumeAutoRetry = t2;
|
|
1542
|
+
let t3;
|
|
1543
|
+
if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1544
|
+
t3 = {
|
|
1545
|
+
triggerSync: _temp3,
|
|
1546
|
+
startLiveSync: _temp4,
|
|
1547
|
+
stopLiveSync: _temp5,
|
|
1548
|
+
setScope: _temp6,
|
|
1549
|
+
retryFailedUploads: _temp7,
|
|
1550
|
+
clearFailedUploads: _temp8,
|
|
1551
|
+
failedUploads: [],
|
|
1552
|
+
pauseAutoRetry: _temp9,
|
|
1553
|
+
resumeAutoRetry: _temp0,
|
|
1554
|
+
isAutoRetryPaused: false
|
|
1555
|
+
};
|
|
1556
|
+
$[6] = t3;
|
|
1557
|
+
} else {
|
|
1558
|
+
t3 = $[6];
|
|
1559
|
+
}
|
|
1560
|
+
const noOpControls = t3;
|
|
1561
|
+
let t4;
|
|
1478
1562
|
bb0: {
|
|
1479
1563
|
if (powerSync && status.currentBackend === "powersync") {
|
|
1480
|
-
|
|
1564
|
+
let t5;
|
|
1565
|
+
if ($[7] !== failedUploads || $[8] !== isAutoRetryPaused || $[9] !== retryFailedUploads || $[10] !== syncControl) {
|
|
1566
|
+
t5 = {
|
|
1567
|
+
...syncControl,
|
|
1568
|
+
retryFailedUploads,
|
|
1569
|
+
clearFailedUploads,
|
|
1570
|
+
failedUploads,
|
|
1571
|
+
pauseAutoRetry,
|
|
1572
|
+
resumeAutoRetry,
|
|
1573
|
+
isAutoRetryPaused
|
|
1574
|
+
};
|
|
1575
|
+
$[7] = failedUploads;
|
|
1576
|
+
$[8] = isAutoRetryPaused;
|
|
1577
|
+
$[9] = retryFailedUploads;
|
|
1578
|
+
$[10] = syncControl;
|
|
1579
|
+
$[11] = t5;
|
|
1580
|
+
} else {
|
|
1581
|
+
t5 = $[11];
|
|
1582
|
+
}
|
|
1583
|
+
t4 = t5;
|
|
1481
1584
|
break bb0;
|
|
1482
1585
|
}
|
|
1483
|
-
|
|
1586
|
+
t4 = noOpControls;
|
|
1484
1587
|
}
|
|
1485
|
-
const controls =
|
|
1588
|
+
const controls = t4;
|
|
1486
1589
|
return controls;
|
|
1487
1590
|
}
|
|
1488
|
-
|
|
1591
|
+
function _temp0() {
|
|
1592
|
+
console.warn("[useSyncControl] resumeAutoRetry called but PowerSync is not available");
|
|
1593
|
+
}
|
|
1594
|
+
function _temp9() {
|
|
1595
|
+
console.warn("[useSyncControl] pauseAutoRetry called but PowerSync is not available");
|
|
1596
|
+
}
|
|
1597
|
+
function _temp8() {
|
|
1598
|
+
console.warn("[useSyncControl] clearFailedUploads called but PowerSync is not available");
|
|
1599
|
+
}
|
|
1600
|
+
async function _temp7() {
|
|
1601
|
+
console.warn("[useSyncControl] retryFailedUploads called but PowerSync is not available");
|
|
1602
|
+
}
|
|
1603
|
+
async function _temp6(_scopeName, _values) {
|
|
1489
1604
|
console.warn("[useSyncControl] setScope called but PowerSync is not available");
|
|
1490
1605
|
}
|
|
1491
|
-
function
|
|
1606
|
+
function _temp5() {
|
|
1492
1607
|
console.warn("[useSyncControl] stopLiveSync called but PowerSync is not available");
|
|
1493
1608
|
}
|
|
1494
|
-
async function
|
|
1609
|
+
async function _temp4() {
|
|
1495
1610
|
console.warn("[useSyncControl] startLiveSync called but PowerSync is not available");
|
|
1496
1611
|
}
|
|
1497
|
-
async function
|
|
1612
|
+
async function _temp3() {
|
|
1498
1613
|
console.warn("[useSyncControl] triggerSync called but PowerSync is not available");
|
|
1499
1614
|
}
|
|
1615
|
+
function _temp2() {
|
|
1616
|
+
if (!failedUploadStore) {
|
|
1617
|
+
console.warn("[useSyncControl] clearFailedUploads called but failedUploadStore is not available");
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
failedUploadStore.clear();
|
|
1621
|
+
notifyFailedUploadListeners();
|
|
1622
|
+
}
|
|
1623
|
+
function _temp() {
|
|
1624
|
+
return [];
|
|
1625
|
+
}
|
|
1500
1626
|
|
|
1501
1627
|
// src/hooks/useOnlineStatus.ts
|
|
1502
1628
|
import { c as _c8 } from "react/compiler-runtime";
|
|
@@ -1547,4 +1673,4 @@ export {
|
|
|
1547
1673
|
useSyncControl,
|
|
1548
1674
|
useOnlineStatus
|
|
1549
1675
|
};
|
|
1550
|
-
//# sourceMappingURL=chunk-
|
|
1676
|
+
//# sourceMappingURL=chunk-3FHAKRDV.js.map
|