@pol-studios/db 1.0.59 → 1.0.62
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/{chunk-K46TGKB2.js → chunk-EKIZNM2L.js} +90 -77
- package/dist/chunk-EKIZNM2L.js.map +1 -0
- package/dist/{chunk-VADZSRHY.js → chunk-FWCHS5NN.js} +2 -2
- package/dist/{chunk-VSY6766U.js → chunk-H4Z73DC4.js} +2 -2
- package/dist/{chunk-7BGDQT5X.js → chunk-PIPB3JMK.js} +1 -7
- package/dist/{chunk-7BGDQT5X.js.map → chunk-PIPB3JMK.js.map} +1 -1
- package/dist/{chunk-WY6MNB6K.js → chunk-ZPFZ2ZRW.js} +3 -12
- package/dist/{chunk-WY6MNB6K.js.map → chunk-ZPFZ2ZRW.js.map} +1 -1
- package/dist/core/index.d.ts +7 -43
- package/dist/hooks/index.js +1 -1
- package/dist/index.js +5 -5
- package/dist/index.native.js +4 -4
- package/dist/index.web.js +3 -10
- package/dist/index.web.js.map +1 -1
- package/dist/powersync-bridge/index.js +1 -1
- package/dist/with-auth/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-K46TGKB2.js.map +0 -1
- /package/dist/{chunk-VADZSRHY.js.map → chunk-FWCHS5NN.js.map} +0 -0
- /package/dist/{chunk-VSY6766U.js.map → chunk-H4Z73DC4.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createSupabaseAdapter,
|
|
4
4
|
getPowerSyncAlias,
|
|
5
5
|
stripSchemaPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FWCHS5NN.js";
|
|
7
7
|
import {
|
|
8
8
|
DataLayerContext,
|
|
9
9
|
DataLayerCoreContext,
|
|
@@ -1418,20 +1418,13 @@ var defaultSyncControl = {
|
|
|
1418
1418
|
setScope: async () => {
|
|
1419
1419
|
console.warn("Scope control not available: PowerSync not initialized");
|
|
1420
1420
|
},
|
|
1421
|
-
pauseAutoRetry: () => {
|
|
1422
|
-
console.warn("Pause auto-retry not available: PowerSync not initialized");
|
|
1423
|
-
},
|
|
1424
|
-
resumeAutoRetry: () => {
|
|
1425
|
-
console.warn("Resume auto-retry not available: PowerSync not initialized");
|
|
1426
|
-
},
|
|
1427
|
-
isAutoRetryPaused: false,
|
|
1428
1421
|
addPendingMutation: () => {
|
|
1429
1422
|
},
|
|
1430
1423
|
removePendingMutation: () => {
|
|
1431
1424
|
}
|
|
1432
1425
|
};
|
|
1433
1426
|
function DataLayerProvider(t0) {
|
|
1434
|
-
const $ = _c(
|
|
1427
|
+
const $ = _c(70);
|
|
1435
1428
|
const {
|
|
1436
1429
|
config,
|
|
1437
1430
|
children,
|
|
@@ -1562,26 +1555,44 @@ function DataLayerProvider(t0) {
|
|
|
1562
1555
|
}
|
|
1563
1556
|
const getPowerSyncTables = t9;
|
|
1564
1557
|
let t10;
|
|
1565
|
-
if ($[24] !== adapters.powerSync || $[25] !== adapters.supabase || $[26] !== adapters.syncTracking || $[27] !== config.tables) {
|
|
1558
|
+
if ($[24] !== adapters.powerSync || $[25] !== adapters.supabase || $[26] !== adapters.syncTracking || $[27] !== config.tables || $[28] !== hasSynced || $[29] !== isOnline) {
|
|
1566
1559
|
t10 = (table_2, t112) => {
|
|
1567
|
-
t112 === void 0 ? "read" : t112;
|
|
1560
|
+
const _operation = t112 === void 0 ? "read" : t112;
|
|
1568
1561
|
const tableWithoutSchema_1 = table_2.includes(".") ? stripSchemaPrefix(table_2) : table_2;
|
|
1569
1562
|
const strategy_3 = config.tables[table_2] ?? config.tables[tableWithoutSchema_1];
|
|
1570
1563
|
if (strategy_3?.strategy === "supabase") {
|
|
1571
1564
|
return adapters.supabase;
|
|
1572
1565
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1566
|
+
if (strategy_3?.strategy === "cached") {
|
|
1567
|
+
return adapters.supabase;
|
|
1568
|
+
}
|
|
1569
|
+
if (strategy_3?.strategy === "powersync") {
|
|
1570
|
+
if (_operation === "read" && isOnline && !hasSynced) {
|
|
1571
|
+
return adapters.supabase;
|
|
1572
|
+
}
|
|
1573
|
+
if (adapters.powerSync) {
|
|
1574
|
+
return adapters.syncTracking ?? adapters.powerSync;
|
|
1575
|
+
}
|
|
1576
|
+
return adapters.supabase;
|
|
1577
|
+
}
|
|
1578
|
+
const isAutoTable = !strategy_3 || strategy_3.strategy === "auto" || strategy_3.strategy === "hybrid";
|
|
1579
|
+
if (isAutoTable) {
|
|
1575
1580
|
const powerSyncTableKeys = Object.keys(config.tables).filter((key_0) => {
|
|
1576
1581
|
const s = config.tables[key_0];
|
|
1577
1582
|
return s.strategy === "powersync" || s.strategy === "hybrid" || s.strategy === "auto";
|
|
1578
1583
|
});
|
|
1579
1584
|
const isConfigured = powerSyncTableKeys.some((key_1) => key_1 === table_2 || key_1 === tableWithoutSchema_1 || key_1.includes(".") && key_1.split(".")[1] === tableWithoutSchema_1);
|
|
1580
|
-
if (isConfigured) {
|
|
1581
|
-
|
|
1585
|
+
if (!isConfigured) {
|
|
1586
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
1587
|
+
console.warn(`[DataLayerProvider] Table "${table_2}" is not configured for PowerSync. Using Supabase fallback.`);
|
|
1588
|
+
}
|
|
1589
|
+
return adapters.supabase;
|
|
1582
1590
|
}
|
|
1583
|
-
if (
|
|
1584
|
-
|
|
1591
|
+
if (isOnline && !hasSynced) {
|
|
1592
|
+
return adapters.supabase;
|
|
1593
|
+
}
|
|
1594
|
+
if (adapters.powerSync) {
|
|
1595
|
+
return adapters.syncTracking ?? adapters.powerSync;
|
|
1585
1596
|
}
|
|
1586
1597
|
}
|
|
1587
1598
|
if (!adapters.supabase) {
|
|
@@ -1593,13 +1604,15 @@ function DataLayerProvider(t0) {
|
|
|
1593
1604
|
$[25] = adapters.supabase;
|
|
1594
1605
|
$[26] = adapters.syncTracking;
|
|
1595
1606
|
$[27] = config.tables;
|
|
1596
|
-
$[28] =
|
|
1607
|
+
$[28] = hasSynced;
|
|
1608
|
+
$[29] = isOnline;
|
|
1609
|
+
$[30] = t10;
|
|
1597
1610
|
} else {
|
|
1598
|
-
t10 = $[
|
|
1611
|
+
t10 = $[30];
|
|
1599
1612
|
}
|
|
1600
1613
|
const getAdapter = t10;
|
|
1601
1614
|
let t11;
|
|
1602
|
-
if ($[
|
|
1615
|
+
if ($[31] !== adapters.powerSync || $[32] !== config.tables || $[33] !== getPowerSyncTables) {
|
|
1603
1616
|
t11 = () => ({
|
|
1604
1617
|
isInitialized: true,
|
|
1605
1618
|
hasPowerSync: adapters.powerSync !== null,
|
|
@@ -1607,15 +1620,15 @@ function DataLayerProvider(t0) {
|
|
|
1607
1620
|
configuredTableCount: Object.keys(config.tables).length,
|
|
1608
1621
|
powerSyncTables: getPowerSyncTables()
|
|
1609
1622
|
});
|
|
1610
|
-
$[
|
|
1611
|
-
$[
|
|
1612
|
-
$[
|
|
1613
|
-
$[
|
|
1623
|
+
$[31] = adapters.powerSync;
|
|
1624
|
+
$[32] = config.tables;
|
|
1625
|
+
$[33] = getPowerSyncTables;
|
|
1626
|
+
$[34] = t11;
|
|
1614
1627
|
} else {
|
|
1615
|
-
t11 = $[
|
|
1628
|
+
t11 = $[34];
|
|
1616
1629
|
}
|
|
1617
1630
|
let t12;
|
|
1618
|
-
if ($[
|
|
1631
|
+
if ($[35] !== config || $[36] !== getAdapter || $[37] !== getPowerSyncTables || $[38] !== getTableAlias || $[39] !== getTableStrategy || $[40] !== t11 || $[41] !== usesPowerSync) {
|
|
1619
1632
|
t12 = {
|
|
1620
1633
|
getAdapter,
|
|
1621
1634
|
getTableStrategy,
|
|
@@ -1626,20 +1639,20 @@ function DataLayerProvider(t0) {
|
|
|
1626
1639
|
config,
|
|
1627
1640
|
isInitialized: true
|
|
1628
1641
|
};
|
|
1629
|
-
$[
|
|
1630
|
-
$[
|
|
1631
|
-
$[
|
|
1632
|
-
$[
|
|
1633
|
-
$[
|
|
1634
|
-
$[
|
|
1635
|
-
$[
|
|
1636
|
-
$[
|
|
1642
|
+
$[35] = config;
|
|
1643
|
+
$[36] = getAdapter;
|
|
1644
|
+
$[37] = getPowerSyncTables;
|
|
1645
|
+
$[38] = getTableAlias;
|
|
1646
|
+
$[39] = getTableStrategy;
|
|
1647
|
+
$[40] = t11;
|
|
1648
|
+
$[41] = usesPowerSync;
|
|
1649
|
+
$[42] = t12;
|
|
1637
1650
|
} else {
|
|
1638
|
-
t12 = $[
|
|
1651
|
+
t12 = $[42];
|
|
1639
1652
|
}
|
|
1640
1653
|
const registry = t12;
|
|
1641
1654
|
let t13;
|
|
1642
|
-
if ($[
|
|
1655
|
+
if ($[43] !== config.schema || $[44] !== getAdapter || $[45] !== powerSyncInstance || $[46] !== queryClient || $[47] !== registry || $[48] !== supabaseClient || $[49] !== syncControl) {
|
|
1643
1656
|
t13 = {
|
|
1644
1657
|
registry,
|
|
1645
1658
|
getAdapter,
|
|
@@ -1649,22 +1662,22 @@ function DataLayerProvider(t0) {
|
|
|
1649
1662
|
schema: config.schema,
|
|
1650
1663
|
syncControl
|
|
1651
1664
|
};
|
|
1652
|
-
$[
|
|
1653
|
-
$[
|
|
1654
|
-
$[
|
|
1655
|
-
$[
|
|
1656
|
-
$[
|
|
1657
|
-
$[
|
|
1658
|
-
$[
|
|
1659
|
-
$[
|
|
1665
|
+
$[43] = config.schema;
|
|
1666
|
+
$[44] = getAdapter;
|
|
1667
|
+
$[45] = powerSyncInstance;
|
|
1668
|
+
$[46] = queryClient;
|
|
1669
|
+
$[47] = registry;
|
|
1670
|
+
$[48] = supabaseClient;
|
|
1671
|
+
$[49] = syncControl;
|
|
1672
|
+
$[50] = t13;
|
|
1660
1673
|
} else {
|
|
1661
|
-
t13 = $[
|
|
1674
|
+
t13 = $[50];
|
|
1662
1675
|
}
|
|
1663
1676
|
const coreContextValue = t13;
|
|
1664
1677
|
const t14 = powerSyncInstance ? "powersync" : "supabase";
|
|
1665
1678
|
const t15 = powerSyncInstance ? "available" /* AVAILABLE */ : "unavailable" /* UNAVAILABLE */;
|
|
1666
1679
|
let t16;
|
|
1667
|
-
if ($[
|
|
1680
|
+
if ($[51] !== hasSynced || $[52] !== isOnline || $[53] !== t14 || $[54] !== t15) {
|
|
1668
1681
|
t16 = {
|
|
1669
1682
|
isInitialized: true,
|
|
1670
1683
|
currentBackend: t14,
|
|
@@ -1674,66 +1687,66 @@ function DataLayerProvider(t0) {
|
|
|
1674
1687
|
error: null,
|
|
1675
1688
|
hasSynced
|
|
1676
1689
|
};
|
|
1677
|
-
$[
|
|
1678
|
-
$[
|
|
1679
|
-
$[
|
|
1680
|
-
$[
|
|
1681
|
-
$[
|
|
1690
|
+
$[51] = hasSynced;
|
|
1691
|
+
$[52] = isOnline;
|
|
1692
|
+
$[53] = t14;
|
|
1693
|
+
$[54] = t15;
|
|
1694
|
+
$[55] = t16;
|
|
1682
1695
|
} else {
|
|
1683
|
-
t16 = $[
|
|
1696
|
+
t16 = $[55];
|
|
1684
1697
|
}
|
|
1685
1698
|
const status = t16;
|
|
1686
1699
|
let t17;
|
|
1687
|
-
if ($[
|
|
1700
|
+
if ($[56] !== status) {
|
|
1688
1701
|
t17 = {
|
|
1689
1702
|
status,
|
|
1690
1703
|
syncStatus: defaultSyncStatus
|
|
1691
1704
|
};
|
|
1692
|
-
$[
|
|
1693
|
-
$[
|
|
1705
|
+
$[56] = status;
|
|
1706
|
+
$[57] = t17;
|
|
1694
1707
|
} else {
|
|
1695
|
-
t17 = $[
|
|
1708
|
+
t17 = $[57];
|
|
1696
1709
|
}
|
|
1697
1710
|
const statusContextValue = t17;
|
|
1698
1711
|
let t18;
|
|
1699
|
-
if ($[
|
|
1712
|
+
if ($[58] !== coreContextValue || $[59] !== statusContextValue) {
|
|
1700
1713
|
t18 = {
|
|
1701
1714
|
...coreContextValue,
|
|
1702
1715
|
...statusContextValue
|
|
1703
1716
|
};
|
|
1704
|
-
$[
|
|
1705
|
-
$[
|
|
1706
|
-
$[
|
|
1717
|
+
$[58] = coreContextValue;
|
|
1718
|
+
$[59] = statusContextValue;
|
|
1719
|
+
$[60] = t18;
|
|
1707
1720
|
} else {
|
|
1708
|
-
t18 = $[
|
|
1721
|
+
t18 = $[60];
|
|
1709
1722
|
}
|
|
1710
1723
|
const contextValue = t18;
|
|
1711
1724
|
let t19;
|
|
1712
|
-
if ($[
|
|
1725
|
+
if ($[61] !== children || $[62] !== statusContextValue) {
|
|
1713
1726
|
t19 = /* @__PURE__ */ jsx(DataLayerStatusContext.Provider, { value: statusContextValue, children });
|
|
1714
|
-
$[
|
|
1715
|
-
$[
|
|
1716
|
-
$[
|
|
1727
|
+
$[61] = children;
|
|
1728
|
+
$[62] = statusContextValue;
|
|
1729
|
+
$[63] = t19;
|
|
1717
1730
|
} else {
|
|
1718
|
-
t19 = $[
|
|
1731
|
+
t19 = $[63];
|
|
1719
1732
|
}
|
|
1720
1733
|
let t20;
|
|
1721
|
-
if ($[
|
|
1734
|
+
if ($[64] !== coreContextValue || $[65] !== t19) {
|
|
1722
1735
|
t20 = /* @__PURE__ */ jsx(DataLayerCoreContext.Provider, { value: coreContextValue, children: t19 });
|
|
1723
|
-
$[
|
|
1724
|
-
$[
|
|
1725
|
-
$[
|
|
1736
|
+
$[64] = coreContextValue;
|
|
1737
|
+
$[65] = t19;
|
|
1738
|
+
$[66] = t20;
|
|
1726
1739
|
} else {
|
|
1727
|
-
t20 = $[
|
|
1740
|
+
t20 = $[66];
|
|
1728
1741
|
}
|
|
1729
1742
|
let t21;
|
|
1730
|
-
if ($[
|
|
1743
|
+
if ($[67] !== contextValue || $[68] !== t20) {
|
|
1731
1744
|
t21 = /* @__PURE__ */ jsx(DataLayerNestingContext.Provider, { value: true, children: /* @__PURE__ */ jsx(DataLayerContext.Provider, { value: contextValue, children: t20 }) });
|
|
1732
|
-
$[
|
|
1733
|
-
$[
|
|
1734
|
-
$[
|
|
1745
|
+
$[67] = contextValue;
|
|
1746
|
+
$[68] = t20;
|
|
1747
|
+
$[69] = t21;
|
|
1735
1748
|
} else {
|
|
1736
|
-
t21 = $[
|
|
1749
|
+
t21 = $[69];
|
|
1737
1750
|
}
|
|
1738
1751
|
return t21;
|
|
1739
1752
|
}
|
|
@@ -5012,4 +5025,4 @@ object-assign/index.js:
|
|
|
5012
5025
|
@license MIT
|
|
5013
5026
|
*)
|
|
5014
5027
|
*/
|
|
5015
|
-
//# sourceMappingURL=chunk-
|
|
5028
|
+
//# sourceMappingURL=chunk-EKIZNM2L.js.map
|