@pol-studios/db 1.0.31 → 1.0.34

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.
Files changed (107) hide show
  1. package/dist/{DataLayerContext-Dc7nF2IG.d.ts → DataLayerContext-BwMk4VpG.d.ts} +92 -8
  2. package/dist/UserMetadataContext-QLIv-mfF.d.ts +171 -0
  3. package/dist/{UserMetadataContext-B8gVWGMl.d.ts → UserMetadataContext-pQb3A8_Q.d.ts} +1 -1
  4. package/dist/auth/context.d.ts +53 -5
  5. package/dist/auth/context.js +30 -8
  6. package/dist/auth/guards.d.ts +9 -9
  7. package/dist/auth/guards.js +2 -3
  8. package/dist/auth/hooks.d.ts +108 -4
  9. package/dist/auth/hooks.js +13 -9
  10. package/dist/auth/index.d.ts +6 -6
  11. package/dist/auth/index.js +45 -17
  12. package/dist/chunk-5HJLTYRA.js +355 -0
  13. package/dist/chunk-5HJLTYRA.js.map +1 -0
  14. package/dist/{chunk-WX4ABYIF.js → chunk-67HMVGV7.js} +292 -94
  15. package/dist/chunk-67HMVGV7.js.map +1 -0
  16. package/dist/chunk-6KN7KLEG.js +1 -0
  17. package/dist/{chunk-FZF26ZRB.js → chunk-7BGDQT5X.js} +29 -16
  18. package/dist/{chunk-FZF26ZRB.js.map → chunk-7BGDQT5X.js.map} +1 -1
  19. package/dist/{chunk-P4UZ7IXC.js → chunk-7D4SUZUM.js} +1 -5
  20. package/dist/{chunk-3PJTNH2L.js → chunk-AKIRHA4Q.js} +2 -2
  21. package/dist/{chunk-OQ7U6EQ3.js → chunk-AML2TLXJ.js} +3801 -3424
  22. package/dist/chunk-AML2TLXJ.js.map +1 -0
  23. package/dist/{chunk-5EFDS7SR.js → chunk-DMVUEJG2.js} +7 -2
  24. package/dist/chunk-DMVUEJG2.js.map +1 -0
  25. package/dist/{chunk-ADD5MIMK.js → chunk-FESQS4S5.js} +15 -15
  26. package/dist/{chunk-ADD5MIMK.js.map → chunk-FESQS4S5.js.map} +1 -1
  27. package/dist/{chunk-U5UNPBKB.js → chunk-FI6JAD5G.js} +3 -3
  28. package/dist/{chunk-TKWR5AAY.js → chunk-JOULSXOI.js} +2 -2
  29. package/dist/{chunk-HTJ2FQW5.js → chunk-LF3V3ERS.js} +13 -15
  30. package/dist/{chunk-HTJ2FQW5.js.map → chunk-LF3V3ERS.js.map} +1 -1
  31. package/dist/{chunk-5BLKZUKM.js → chunk-MREERKQU.js} +45 -14
  32. package/dist/chunk-MREERKQU.js.map +1 -0
  33. package/dist/{chunk-VGEMLNNM.js → chunk-NP34C3O3.js} +306 -704
  34. package/dist/chunk-NP34C3O3.js.map +1 -0
  35. package/dist/{chunk-CNIGRBRE.js → chunk-QJZUIAHA.js} +43 -19
  36. package/dist/{chunk-CNIGRBRE.js.map → chunk-QJZUIAHA.js.map} +1 -1
  37. package/dist/{chunk-HAWJTZCK.js → chunk-RT4O5H2E.js} +5 -7
  38. package/dist/chunk-RT4O5H2E.js.map +1 -0
  39. package/dist/{chunk-2NVSXZKQ.js → chunk-TN7QINPK.js} +74 -309
  40. package/dist/chunk-TN7QINPK.js.map +1 -0
  41. package/dist/chunk-UBHORKBS.js +215 -0
  42. package/dist/chunk-UBHORKBS.js.map +1 -0
  43. package/dist/{chunk-WVF7RUW5.js → chunk-WM25QE7E.js} +3 -3
  44. package/dist/{chunk-H6365JPC.js → chunk-YUX6RGLZ.js} +3 -3
  45. package/dist/{chunk-H6365JPC.js.map → chunk-YUX6RGLZ.js.map} +1 -1
  46. package/dist/{chunk-H3LNH2NT.js → chunk-Z456IHCB.js} +5 -9
  47. package/dist/{chunk-H3LNH2NT.js.map → chunk-Z456IHCB.js.map} +1 -1
  48. package/dist/{chunk-JAATANS3.js → chunk-ZCOFRJQD.js} +3 -3
  49. package/dist/{chunk-JAATANS3.js.map → chunk-ZCOFRJQD.js.map} +1 -1
  50. package/dist/client/index.d.ts +1 -1
  51. package/dist/client/index.js +2 -2
  52. package/dist/core/index.d.ts +54 -31
  53. package/dist/{executor-Br27YZvl.d.ts → executor-YJw4m7Q7.d.ts} +9 -1
  54. package/dist/gen/index.js +1 -1
  55. package/dist/hooks/index.d.ts +3 -22
  56. package/dist/hooks/index.js +12 -9
  57. package/dist/{index-CYFdO0iB.d.ts → index-lveh8qb0.d.ts} +1 -1
  58. package/dist/index.d.ts +38 -10
  59. package/dist/index.js +57 -36
  60. package/dist/index.native.d.ts +19 -13
  61. package/dist/index.native.js +64 -35
  62. package/dist/index.web.d.ts +18 -45
  63. package/dist/index.web.js +58 -49
  64. package/dist/index.web.js.map +1 -1
  65. package/dist/mutation/index.d.ts +2 -2
  66. package/dist/mutation/index.js +5 -5
  67. package/dist/parser/index.js +4 -4
  68. package/dist/powersync-bridge/index.d.ts +18 -3
  69. package/dist/powersync-bridge/index.js +2 -2
  70. package/dist/query/index.d.ts +1 -1
  71. package/dist/query/index.js +7 -8
  72. package/dist/realtime/index.js +7 -9
  73. package/dist/realtime/index.js.map +1 -1
  74. package/dist/types/index.d.ts +3 -3
  75. package/dist/types/index.js +6 -7
  76. package/dist/{useBatchUpsert-9OYjibLh.d.ts → useBatchUpsert-DAkiCNo3.d.ts} +1 -1
  77. package/dist/{useDbCount-Dk0yCKlT.d.ts → useDbCount-DWfYB2iu.d.ts} +16 -2
  78. package/dist/{useResolveFeedback-C1KucfdQ.d.ts → useResolveFeedback-CxLccZKK.d.ts} +197 -93
  79. package/dist/{useSupabase-DvWVuHHE.d.ts → useSupabase-DSZNeXnF.d.ts} +1 -1
  80. package/dist/with-auth/index.d.ts +2 -2
  81. package/dist/with-auth/index.js +46 -33
  82. package/dist/with-auth/index.js.map +1 -1
  83. package/package.json +18 -8
  84. package/dist/UserMetadataContext-DntmpK41.d.ts +0 -33
  85. package/dist/canvas-C4TBBDUL.node +0 -0
  86. package/dist/canvas-ZQNCL7JL.js +0 -1541
  87. package/dist/canvas-ZQNCL7JL.js.map +0 -1
  88. package/dist/chunk-2NVSXZKQ.js.map +0 -1
  89. package/dist/chunk-5BLKZUKM.js.map +0 -1
  90. package/dist/chunk-5EFDS7SR.js.map +0 -1
  91. package/dist/chunk-HAWJTZCK.js.map +0 -1
  92. package/dist/chunk-NSIAAYW3.js +0 -1
  93. package/dist/chunk-O7SETNGD.js +0 -3391
  94. package/dist/chunk-O7SETNGD.js.map +0 -1
  95. package/dist/chunk-OQ7U6EQ3.js.map +0 -1
  96. package/dist/chunk-VGEMLNNM.js.map +0 -1
  97. package/dist/chunk-WX4ABYIF.js.map +0 -1
  98. package/dist/dist-NDNRSNOG.js +0 -521
  99. package/dist/dist-NDNRSNOG.js.map +0 -1
  100. package/dist/pdf-PHXP7RHD.js +0 -20336
  101. package/dist/pdf-PHXP7RHD.js.map +0 -1
  102. /package/dist/{chunk-NSIAAYW3.js.map → chunk-6KN7KLEG.js.map} +0 -0
  103. /package/dist/{chunk-P4UZ7IXC.js.map → chunk-7D4SUZUM.js.map} +0 -0
  104. /package/dist/{chunk-3PJTNH2L.js.map → chunk-AKIRHA4Q.js.map} +0 -0
  105. /package/dist/{chunk-U5UNPBKB.js.map → chunk-FI6JAD5G.js.map} +0 -0
  106. /package/dist/{chunk-TKWR5AAY.js.map → chunk-JOULSXOI.js.map} +0 -0
  107. /package/dist/{chunk-WVF7RUW5.js.map → chunk-WM25QE7E.js.map} +0 -0
@@ -3,23 +3,24 @@ import {
3
3
  createAdapterRegistry,
4
4
  createSupabaseAdapter,
5
5
  stripSchemaPrefix
6
- } from "./chunk-O7SETNGD.js";
6
+ } from "./chunk-AML2TLXJ.js";
7
7
  import {
8
+ DataLayerContext,
8
9
  DataLayerCoreContext,
9
10
  DataLayerStatusContext
10
- } from "./chunk-VGEMLNNM.js";
11
+ } from "./chunk-UBHORKBS.js";
11
12
  import {
12
13
  QueryExecutor,
13
14
  extractRelationNames,
14
15
  parseSelect
15
- } from "./chunk-CNIGRBRE.js";
16
+ } from "./chunk-QJZUIAHA.js";
16
17
  import {
17
18
  useSupabase
18
- } from "./chunk-5EFDS7SR.js";
19
+ } from "./chunk-DMVUEJG2.js";
19
20
  import {
20
21
  __commonJS,
21
22
  __toESM
22
- } from "./chunk-P4UZ7IXC.js";
23
+ } from "./chunk-7D4SUZUM.js";
23
24
 
24
25
  // ../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js
25
26
  var require_react_is_production_min = __commonJS({
@@ -996,137 +997,6 @@ var require_es = __commonJS({
996
997
  }
997
998
  });
998
999
 
999
- // ../../../node_modules/.pnpm/is-plain-obj@2.1.0/node_modules/is-plain-obj/index.js
1000
- var require_is_plain_obj = __commonJS({
1001
- "../../../node_modules/.pnpm/is-plain-obj@2.1.0/node_modules/is-plain-obj/index.js"(exports, module) {
1002
- "use strict";
1003
- module.exports = (value) => {
1004
- if (Object.prototype.toString.call(value) !== "[object Object]") {
1005
- return false;
1006
- }
1007
- const prototype = Object.getPrototypeOf(value);
1008
- return prototype === null || prototype === Object.prototype;
1009
- };
1010
- }
1011
- });
1012
-
1013
- // ../../../node_modules/.pnpm/merge-options@3.0.4/node_modules/merge-options/index.js
1014
- var require_merge_options = __commonJS({
1015
- "../../../node_modules/.pnpm/merge-options@3.0.4/node_modules/merge-options/index.js"(exports, module) {
1016
- "use strict";
1017
- var isOptionObject = require_is_plain_obj();
1018
- var { hasOwnProperty } = Object.prototype;
1019
- var { propertyIsEnumerable } = Object;
1020
- var defineProperty = (object, name, value) => Object.defineProperty(object, name, {
1021
- value,
1022
- writable: true,
1023
- enumerable: true,
1024
- configurable: true
1025
- });
1026
- var globalThis2 = exports;
1027
- var defaultMergeOptions = {
1028
- concatArrays: false,
1029
- ignoreUndefined: false
1030
- };
1031
- var getEnumerableOwnPropertyKeys = (value) => {
1032
- const keys = [];
1033
- for (const key in value) {
1034
- if (hasOwnProperty.call(value, key)) {
1035
- keys.push(key);
1036
- }
1037
- }
1038
- if (Object.getOwnPropertySymbols) {
1039
- const symbols = Object.getOwnPropertySymbols(value);
1040
- for (const symbol of symbols) {
1041
- if (propertyIsEnumerable.call(value, symbol)) {
1042
- keys.push(symbol);
1043
- }
1044
- }
1045
- }
1046
- return keys;
1047
- };
1048
- function clone(value) {
1049
- if (Array.isArray(value)) {
1050
- return cloneArray(value);
1051
- }
1052
- if (isOptionObject(value)) {
1053
- return cloneOptionObject(value);
1054
- }
1055
- return value;
1056
- }
1057
- function cloneArray(array) {
1058
- const result = array.slice(0, 0);
1059
- getEnumerableOwnPropertyKeys(array).forEach((key) => {
1060
- defineProperty(result, key, clone(array[key]));
1061
- });
1062
- return result;
1063
- }
1064
- function cloneOptionObject(object) {
1065
- const result = Object.getPrototypeOf(object) === null ? /* @__PURE__ */ Object.create(null) : {};
1066
- getEnumerableOwnPropertyKeys(object).forEach((key) => {
1067
- defineProperty(result, key, clone(object[key]));
1068
- });
1069
- return result;
1070
- }
1071
- var mergeKeys = (merged, source, keys, config) => {
1072
- keys.forEach((key) => {
1073
- if (typeof source[key] === "undefined" && config.ignoreUndefined) {
1074
- return;
1075
- }
1076
- if (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {
1077
- defineProperty(merged, key, merge2(merged[key], source[key], config));
1078
- } else {
1079
- defineProperty(merged, key, clone(source[key]));
1080
- }
1081
- });
1082
- return merged;
1083
- };
1084
- var concatArrays = (merged, source, config) => {
1085
- let result = merged.slice(0, 0);
1086
- let resultIndex = 0;
1087
- [merged, source].forEach((array) => {
1088
- const indices = [];
1089
- for (let k = 0; k < array.length; k++) {
1090
- if (!hasOwnProperty.call(array, k)) {
1091
- continue;
1092
- }
1093
- indices.push(String(k));
1094
- if (array === merged) {
1095
- defineProperty(result, resultIndex++, array[k]);
1096
- } else {
1097
- defineProperty(result, resultIndex++, clone(array[k]));
1098
- }
1099
- }
1100
- result = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter((key) => !indices.includes(key)), config);
1101
- });
1102
- return result;
1103
- };
1104
- function merge2(merged, source, config) {
1105
- if (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {
1106
- return concatArrays(merged, source, config);
1107
- }
1108
- if (!isOptionObject(source) || !isOptionObject(merged)) {
1109
- return clone(source);
1110
- }
1111
- return mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);
1112
- }
1113
- module.exports = function(...options) {
1114
- const config = merge2(clone(defaultMergeOptions), this !== globalThis2 && this || {}, defaultMergeOptions);
1115
- let merged = { _: {} };
1116
- for (const option of options) {
1117
- if (option === void 0) {
1118
- continue;
1119
- }
1120
- if (!isOptionObject(option)) {
1121
- throw new TypeError("`" + option + "` is not an Option Object");
1122
- }
1123
- merged = merge2(merged, { _: option }, config);
1124
- }
1125
- return merged._;
1126
- };
1127
- }
1128
- });
1129
-
1130
1000
  // src/utils/type-transformer.ts
1131
1001
  var columnMapCache = /* @__PURE__ */ new WeakMap();
1132
1002
  function getOrCreateSchemaCache(schema) {
@@ -1342,11 +1212,12 @@ var PowerSyncAdapter = class {
1342
1212
  return this.subscribeWithPolling(table, options, callback);
1343
1213
  }
1344
1214
  const abortController = new AbortController();
1215
+ const parsed = parseSelect(options.select ?? "*");
1345
1216
  const builder = this.executor.getBuilder();
1346
1217
  const {
1347
1218
  sql,
1348
1219
  params
1349
- } = builder.build(resolvedTable, "*", {
1220
+ } = builder.build(resolvedTable, parsed.columns, {
1350
1221
  where: options.where,
1351
1222
  orderBy: options.orderBy,
1352
1223
  limit: options.limit,
@@ -1354,8 +1225,8 @@ var PowerSyncAdapter = class {
1354
1225
  });
1355
1226
  let watchTables = [resolvedTable];
1356
1227
  if (options.select && options.select !== "*") {
1357
- const parsed = parseSelect(options.select);
1358
- const relationNames = extractRelationNames(parsed);
1228
+ const parsed2 = parseSelect(options.select);
1229
+ const relationNames = extractRelationNames(parsed2);
1359
1230
  watchTables = [resolvedTable, ...relationNames.map((r) => this.resolveTableName(r))];
1360
1231
  }
1361
1232
  const schema = this.schema;
@@ -1558,21 +1429,19 @@ var defaultSyncControl = {
1558
1429
  setScope: async () => {
1559
1430
  console.warn("Scope control not available: PowerSync not initialized");
1560
1431
  },
1561
- // Failed upload controls
1562
- retryFailedUploads: async () => {
1563
- console.warn("Retry not available: PowerSync not initialized");
1564
- },
1565
- clearFailedUploads: () => {
1566
- console.warn("Clear failed uploads not available: PowerSync not initialized");
1567
- },
1568
- failedUploads: [],
1432
+ // Auto-retry controls
1569
1433
  pauseAutoRetry: () => {
1570
1434
  console.warn("Pause auto-retry not available: PowerSync not initialized");
1571
1435
  },
1572
1436
  resumeAutoRetry: () => {
1573
1437
  console.warn("Resume auto-retry not available: PowerSync not initialized");
1574
1438
  },
1575
- isAutoRetryPaused: false
1439
+ isAutoRetryPaused: false,
1440
+ // Pending mutations
1441
+ addPendingMutation: () => {
1442
+ },
1443
+ removePendingMutation: () => {
1444
+ }
1576
1445
  };
1577
1446
  function DataLayerProvider({
1578
1447
  config,
@@ -1582,9 +1451,11 @@ function DataLayerProvider({
1582
1451
  queryClient,
1583
1452
  onInitialized,
1584
1453
  onError,
1585
- powerSyncSyncStatus
1454
+ powerSyncSyncStatus,
1455
+ syncControl: externalSyncControl
1586
1456
  }) {
1587
1457
  const [registry] = useState(() => createAdapterRegistry(config));
1458
+ const resolvedSyncControl = useMemo(() => externalSyncControl ?? defaultSyncControl, [externalSyncControl]);
1588
1459
  const [isInitializedOnce, setIsInitializedOnce] = useState(false);
1589
1460
  const [autoDetector, setAutoDetector] = useState(null);
1590
1461
  const [status, setStatus] = useState({
@@ -1609,6 +1480,10 @@ function DataLayerProvider({
1609
1480
  const powerSyncAdapter = createPowerSyncAdapter(powerSyncInstance, config.schema);
1610
1481
  registry.setPowerSyncAdapter(powerSyncAdapter);
1611
1482
  }
1483
+ registry.setSyncTracker({
1484
+ addPendingMutation: resolvedSyncControl.addPendingMutation,
1485
+ removePendingMutation: resolvedSyncControl.removePendingMutation
1486
+ });
1612
1487
  registry.initialize({
1613
1488
  powerSync: powerSyncInstance,
1614
1489
  supabase: supabaseClient,
@@ -1713,6 +1588,14 @@ function DataLayerProvider({
1713
1588
  };
1714
1589
  });
1715
1590
  }, [autoDetector, powerSyncSyncStatus?.hasSynced, powerSyncSyncStatus?.connected, powerSyncSyncStatus?.connecting, powerSyncSyncStatus?.isOnline]);
1591
+ useEffect(() => {
1592
+ if (registry) {
1593
+ registry.setSyncTracker({
1594
+ addPendingMutation: resolvedSyncControl.addPendingMutation,
1595
+ removePendingMutation: resolvedSyncControl.removePendingMutation
1596
+ });
1597
+ }
1598
+ }, [resolvedSyncControl, registry]);
1716
1599
  useEffect(() => {
1717
1600
  if (status.isInitialized && !status.error && onInitialized) {
1718
1601
  const contextValue2 = buildContextValue();
@@ -1726,8 +1609,8 @@ function DataLayerProvider({
1726
1609
  setIsInitializedOnce(true);
1727
1610
  }
1728
1611
  }, [status.isInitialized, isInitializedOnce]);
1729
- const getAdapter = useCallback((table) => {
1730
- return registry.getAdapter(table);
1612
+ const getAdapter = useCallback((table, operation = "read") => {
1613
+ return registry.getAdapter(table, operation);
1731
1614
  }, [registry]);
1732
1615
  const buildContextValue = useCallback(() => {
1733
1616
  if (!status.isInitialized) return null;
@@ -1740,9 +1623,9 @@ function DataLayerProvider({
1740
1623
  schema: config.schema,
1741
1624
  status,
1742
1625
  syncStatus: defaultSyncStatus,
1743
- syncControl: defaultSyncControl
1626
+ syncControl: resolvedSyncControl
1744
1627
  };
1745
- }, [registry, getAdapter, powerSyncInstance, supabaseClient, queryClient, config.schema, status]);
1628
+ }, [registry, getAdapter, powerSyncInstance, supabaseClient, queryClient, config.schema, status, resolvedSyncControl]);
1746
1629
  const coreContextValue = useMemo(() => {
1747
1630
  if (!isInitializedOnce) return null;
1748
1631
  return {
@@ -1752,18 +1635,9 @@ function DataLayerProvider({
1752
1635
  supabase: supabaseClient,
1753
1636
  queryClient,
1754
1637
  schema: config.schema,
1755
- syncControl: defaultSyncControl
1638
+ syncControl: resolvedSyncControl
1756
1639
  };
1757
- }, [
1758
- isInitializedOnce,
1759
- registry,
1760
- getAdapter,
1761
- powerSyncInstance,
1762
- supabaseClient,
1763
- queryClient,
1764
- config.schema
1765
- // Note: defaultSyncControl is module-level constant, not needed in deps
1766
- ]);
1640
+ }, [isInitializedOnce, registry, getAdapter, powerSyncInstance, supabaseClient, queryClient, config.schema, resolvedSyncControl]);
1767
1641
  const statusContextValue = useMemo(() => {
1768
1642
  if (!status.isInitialized) return null;
1769
1643
  return {
@@ -1783,16 +1657,39 @@ function DataLayerProvider({
1783
1657
  registry.dispose();
1784
1658
  };
1785
1659
  }, [registry]);
1786
- if (!contextValue || !coreContextValue || !statusContextValue) {
1787
- return null;
1788
- }
1789
- return /* @__PURE__ */ jsx(DataLayerCoreContext.Provider, { value: coreContextValue, children: /* @__PURE__ */ jsx(DataLayerStatusContext.Provider, { value: statusContextValue, children }) });
1660
+ const pendingCoreContextValue = useMemo(
1661
+ () => ({
1662
+ registry,
1663
+ getAdapter: () => {
1664
+ throw new Error("DataLayer not yet initialized");
1665
+ },
1666
+ powerSync: null,
1667
+ supabase: supabaseClient,
1668
+ queryClient,
1669
+ schema: config.schema,
1670
+ syncControl: resolvedSyncControl
1671
+ }),
1672
+ // Only recompute when these stable deps change — not on every status update
1673
+ [registry, supabaseClient, queryClient, config.schema, resolvedSyncControl]
1674
+ );
1675
+ const pendingStatusContextValue = useMemo(() => ({
1676
+ status,
1677
+ syncStatus: defaultSyncStatus
1678
+ }), [status]);
1679
+ const pendingContextValue = useMemo(() => ({
1680
+ ...pendingCoreContextValue,
1681
+ ...pendingStatusContextValue
1682
+ }), [pendingCoreContextValue, pendingStatusContextValue]);
1683
+ const resolvedCore = coreContextValue ?? pendingCoreContextValue;
1684
+ const resolvedStatus = statusContextValue ?? pendingStatusContextValue;
1685
+ const resolvedContext = contextValue ?? pendingContextValue;
1686
+ return /* @__PURE__ */ jsx(DataLayerContext.Provider, { value: resolvedContext, children: /* @__PURE__ */ jsx(DataLayerCoreContext.Provider, { value: resolvedCore, children: /* @__PURE__ */ jsx(DataLayerStatusContext.Provider, { value: resolvedStatus, children }) }) });
1790
1687
  }
1791
1688
 
1792
1689
  // src/storage/use-supabase-upload.tsx
1793
1690
  import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
1794
1691
 
1795
- // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.1.1/node_modules/react-dropzone/dist/es/index.js
1692
+ // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.2.0/node_modules/react-dropzone/dist/es/index.js
1796
1693
  var import_prop_types = __toESM(require_prop_types(), 1);
1797
1694
  import React2, { forwardRef, Fragment, useCallback as useCallback2, useEffect as useEffect2, useImperativeHandle, useMemo as useMemo2, useReducer, useRef } from "react";
1798
1695
 
@@ -3219,7 +3116,7 @@ function fromFileEntry(entry) {
3219
3116
  });
3220
3117
  }
3221
3118
 
3222
- // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.1.1/node_modules/react-dropzone/dist/es/utils/index.js
3119
+ // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.2.0/node_modules/react-dropzone/dist/es/utils/index.js
3223
3120
  var import_attr_accept = __toESM(require_es(), 1);
3224
3121
  function _toConsumableArray(arr) {
3225
3122
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
@@ -3467,7 +3364,7 @@ function isExt(v) {
3467
3364
  return /^.*\.[\w]+$/.test(v);
3468
3365
  }
3469
3366
 
3470
- // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.1.1/node_modules/react-dropzone/dist/es/index.js
3367
+ // ../../../node_modules/.pnpm/react-dropzone@14.3.8_react@19.2.0/node_modules/react-dropzone/dist/es/index.js
3471
3368
  var _excluded = ["children"];
3472
3369
  var _excluded2 = ["open"];
3473
3370
  var _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"];
@@ -4317,140 +4214,8 @@ var useSupabaseUpload = (options) => {
4317
4214
  import { c as _c } from "react/compiler-runtime";
4318
4215
  import { createContext, useEffect as useEffect4, useReducer as useReducer2, useRef as useRef2 } from "react";
4319
4216
 
4320
- // ../../../node_modules/.pnpm/merge-options@3.0.4/node_modules/merge-options/index.mjs
4321
- var import_index = __toESM(require_merge_options(), 1);
4322
- var merge_options_default = import_index.default;
4323
-
4324
- // ../../../node_modules/.pnpm/@react-native-async-storage+async-storage@2.2.0_react-native@0.81.5_@babel+core@7.28.0_@react_2hvarrbjesownckmm5rnp7ulv4/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js
4325
- var merge = merge_options_default.bind({
4326
- concatArrays: true,
4327
- ignoreUndefined: true
4328
- });
4329
- function mergeLocalStorageItem(key, value) {
4330
- const oldValue = window.localStorage.getItem(key);
4331
- if (oldValue) {
4332
- const oldObject = JSON.parse(oldValue);
4333
- const newObject = JSON.parse(value);
4334
- const nextValue = JSON.stringify(merge(oldObject, newObject));
4335
- window.localStorage.setItem(key, nextValue);
4336
- } else {
4337
- window.localStorage.setItem(key, value);
4338
- }
4339
- }
4340
- function createPromise(getValue, callback) {
4341
- return new Promise((resolve, reject) => {
4342
- try {
4343
- const value = getValue();
4344
- callback?.(null, value);
4345
- resolve(value);
4346
- } catch (err) {
4347
- callback?.(err);
4348
- reject(err);
4349
- }
4350
- });
4351
- }
4352
- function createPromiseAll(promises, callback, processResult) {
4353
- return Promise.all(promises).then((result) => {
4354
- const value = processResult?.(result) ?? null;
4355
- callback?.(null, value);
4356
- return Promise.resolve(value);
4357
- }, (errors) => {
4358
- callback?.(errors);
4359
- return Promise.reject(errors);
4360
- });
4361
- }
4362
- var AsyncStorage = {
4363
- /**
4364
- * Fetches `key` value.
4365
- */
4366
- getItem: (key, callback) => {
4367
- return createPromise(() => window.localStorage.getItem(key), callback);
4368
- },
4369
- /**
4370
- * Sets `value` for `key`.
4371
- */
4372
- setItem: (key, value, callback) => {
4373
- return createPromise(() => window.localStorage.setItem(key, value), callback);
4374
- },
4375
- /**
4376
- * Removes a `key`
4377
- */
4378
- removeItem: (key, callback) => {
4379
- return createPromise(() => window.localStorage.removeItem(key), callback);
4380
- },
4381
- /**
4382
- * Merges existing value with input value, assuming they are stringified JSON.
4383
- */
4384
- mergeItem: (key, value, callback) => {
4385
- return createPromise(() => mergeLocalStorageItem(key, value), callback);
4386
- },
4387
- /**
4388
- * Erases *all* AsyncStorage for the domain.
4389
- */
4390
- clear: (callback) => {
4391
- return createPromise(() => window.localStorage.clear(), callback);
4392
- },
4393
- /**
4394
- * Gets *all* keys known to the app, for all callers, libraries, etc.
4395
- */
4396
- getAllKeys: (callback) => {
4397
- return createPromise(() => {
4398
- const numberOfKeys = window.localStorage.length;
4399
- const keys = [];
4400
- for (let i = 0; i < numberOfKeys; i += 1) {
4401
- const key = window.localStorage.key(i) || "";
4402
- keys.push(key);
4403
- }
4404
- return keys;
4405
- }, callback);
4406
- },
4407
- /**
4408
- * (stub) Flushes any pending requests using a single batch call to get the data.
4409
- */
4410
- flushGetRequests: () => void 0,
4411
- /**
4412
- * multiGet resolves to an array of key-value pair arrays that matches the
4413
- * input format of multiSet.
4414
- *
4415
- * multiGet(['k1', 'k2']) -> [['k1', 'val1'], ['k2', 'val2']]
4416
- */
4417
- multiGet: (keys, callback) => {
4418
- const promises = keys.map((key) => AsyncStorage.getItem(key));
4419
- const processResult = (result) => result.map((value, i) => [keys[i], value]);
4420
- return createPromiseAll(promises, callback, processResult);
4421
- },
4422
- /**
4423
- * Takes an array of key-value array pairs.
4424
- * multiSet([['k1', 'val1'], ['k2', 'val2']])
4425
- */
4426
- multiSet: (keyValuePairs, callback) => {
4427
- const promises = keyValuePairs.map((item) => AsyncStorage.setItem(item[0], item[1]));
4428
- return createPromiseAll(promises, callback);
4429
- },
4430
- /**
4431
- * Delete all the keys in the `keys` array.
4432
- */
4433
- multiRemove: (keys, callback) => {
4434
- const promises = keys.map((key) => AsyncStorage.removeItem(key));
4435
- return createPromiseAll(promises, callback);
4436
- },
4437
- /**
4438
- * Takes an array of key-value array pairs and merges them with existing
4439
- * values, assuming they are stringified JSON.
4440
- *
4441
- * multiMerge([['k1', 'val1'], ['k2', 'val2']])
4442
- */
4443
- multiMerge: (keyValuePairs, callback) => {
4444
- const promises = keyValuePairs.map((item) => AsyncStorage.mergeItem(item[0], item[1]));
4445
- return createPromiseAll(promises, callback);
4446
- }
4447
- };
4448
- var AsyncStorage_default = AsyncStorage;
4449
-
4450
- // ../../../node_modules/.pnpm/@react-native-async-storage+async-storage@2.2.0_react-native@0.81.5_@babel+core@7.28.0_@react_2hvarrbjesownckmm5rnp7ulv4/node_modules/@react-native-async-storage/async-storage/lib/module/index.js
4451
- var module_default = AsyncStorage_default;
4452
-
4453
4217
  // src/conflicts/storage.ts
4218
+ import AsyncStorage from "@react-native-async-storage/async-storage";
4454
4219
  var CONFLICT_STORAGE_KEY = "@pol/conflicts";
4455
4220
  var TTL_MS = 24 * 60 * 60 * 1e3;
4456
4221
  async function saveConflicts(conflicts, existingTimestamps) {
@@ -4465,14 +4230,14 @@ async function saveConflicts(conflicts, existingTimestamps) {
4465
4230
  // Preserve existing timestamp or use new
4466
4231
  };
4467
4232
  });
4468
- await module_default.setItem(CONFLICT_STORAGE_KEY, JSON.stringify(persisted));
4233
+ await AsyncStorage.setItem(CONFLICT_STORAGE_KEY, JSON.stringify(persisted));
4469
4234
  } catch (error) {
4470
4235
  console.warn("[ConflictStorage] Failed to save conflicts:", error);
4471
4236
  }
4472
4237
  }
4473
4238
  async function loadConflicts() {
4474
4239
  try {
4475
- const data = await module_default.getItem(CONFLICT_STORAGE_KEY);
4240
+ const data = await AsyncStorage.getItem(CONFLICT_STORAGE_KEY);
4476
4241
  if (!data) return {
4477
4242
  conflicts: [],
4478
4243
  timestamps: /* @__PURE__ */ new Map()
@@ -4481,7 +4246,7 @@ async function loadConflicts() {
4481
4246
  const now = Date.now();
4482
4247
  const valid = persisted.filter((p) => now - p.savedAt < TTL_MS);
4483
4248
  if (valid.length !== persisted.length) {
4484
- await module_default.setItem(CONFLICT_STORAGE_KEY, JSON.stringify(valid));
4249
+ await AsyncStorage.setItem(CONFLICT_STORAGE_KEY, JSON.stringify(valid));
4485
4250
  }
4486
4251
  const timestamps = /* @__PURE__ */ new Map();
4487
4252
  for (const p of valid) {
@@ -4510,7 +4275,7 @@ async function loadConflicts() {
4510
4275
  }
4511
4276
  async function clearPersistedConflicts() {
4512
4277
  try {
4513
- await module_default.removeItem(CONFLICT_STORAGE_KEY);
4278
+ await AsyncStorage.removeItem(CONFLICT_STORAGE_KEY);
4514
4279
  } catch (error) {
4515
4280
  console.warn("[ConflictStorage] Failed to clear conflicts:", error);
4516
4281
  }
@@ -5187,4 +4952,4 @@ object-assign/index.js:
5187
4952
  @license MIT
5188
4953
  *)
5189
4954
  */
5190
- //# sourceMappingURL=chunk-2NVSXZKQ.js.map
4955
+ //# sourceMappingURL=chunk-TN7QINPK.js.map