@pol-studios/powersync 1.0.7 → 1.0.11

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 (103) hide show
  1. package/README.md +933 -0
  2. package/dist/CacheSettingsManager-uz-kbnRH.d.ts +461 -0
  3. package/dist/attachments/index.d.ts +709 -6
  4. package/dist/attachments/index.js +133 -5
  5. package/dist/chunk-24RDMMCL.js +44 -0
  6. package/dist/chunk-24RDMMCL.js.map +1 -0
  7. package/dist/chunk-4TXTAEF2.js +2060 -0
  8. package/dist/chunk-4TXTAEF2.js.map +1 -0
  9. package/dist/chunk-63PXSPIN.js +358 -0
  10. package/dist/chunk-63PXSPIN.js.map +1 -0
  11. package/dist/chunk-654ERHA7.js +1 -0
  12. package/dist/{chunk-BREGB4WL.js → chunk-BRXQNASY.js} +287 -335
  13. package/dist/chunk-BRXQNASY.js.map +1 -0
  14. package/dist/{chunk-DHYUBVP7.js → chunk-CAB26E6F.js} +20 -9
  15. package/dist/chunk-CAB26E6F.js.map +1 -0
  16. package/dist/{chunk-H772V6XQ.js → chunk-CUCAYK7Z.js} +7 -43
  17. package/dist/chunk-CUCAYK7Z.js.map +1 -0
  18. package/dist/{chunk-4C3RY5SU.js → chunk-HWSNV45P.js} +76 -1
  19. package/dist/chunk-HWSNV45P.js.map +1 -0
  20. package/dist/{chunk-HFOFLW5F.js → chunk-KN2IZERF.js} +139 -6
  21. package/dist/chunk-KN2IZERF.js.map +1 -0
  22. package/dist/{chunk-UEYRTLKE.js → chunk-P4HZA6ZT.js} +20 -9
  23. package/dist/chunk-P4HZA6ZT.js.map +1 -0
  24. package/dist/chunk-T4AO7JIG.js +1 -0
  25. package/dist/{chunk-XQAJM2MW.js → chunk-VACPAAQZ.js} +33 -2
  26. package/dist/{chunk-XQAJM2MW.js.map → chunk-VACPAAQZ.js.map} +1 -1
  27. package/dist/{chunk-53WH2JJV.js → chunk-WN5ZJ3E2.js} +5 -8
  28. package/dist/chunk-WN5ZJ3E2.js.map +1 -0
  29. package/dist/chunk-XAEII4ZX.js +456 -0
  30. package/dist/chunk-XAEII4ZX.js.map +1 -0
  31. package/dist/chunk-XOY2CJ67.js +289 -0
  32. package/dist/chunk-XOY2CJ67.js.map +1 -0
  33. package/dist/chunk-YHTZ7VMV.js +1 -0
  34. package/dist/{chunk-MKD2VCX3.js → chunk-Z6VOBGTU.js} +8 -8
  35. package/dist/chunk-Z6VOBGTU.js.map +1 -0
  36. package/dist/chunk-ZM4ENYMF.js +230 -0
  37. package/dist/chunk-ZM4ENYMF.js.map +1 -0
  38. package/dist/connector/index.d.ts +56 -3
  39. package/dist/connector/index.js +8 -5
  40. package/dist/core/index.d.ts +12 -1
  41. package/dist/core/index.js +3 -2
  42. package/dist/error/index.js +0 -1
  43. package/dist/generator/cli.js +527 -0
  44. package/dist/generator/index.d.ts +168 -0
  45. package/dist/generator/index.js +370 -0
  46. package/dist/generator/index.js.map +1 -0
  47. package/dist/index.d.ts +12 -10
  48. package/dist/index.js +191 -29
  49. package/dist/index.native.d.ts +11 -9
  50. package/dist/index.native.js +191 -29
  51. package/dist/index.web.d.ts +11 -9
  52. package/dist/index.web.js +191 -29
  53. package/dist/maintenance/index.js +0 -1
  54. package/dist/platform/index.js +0 -2
  55. package/dist/platform/index.js.map +1 -1
  56. package/dist/platform/index.native.js +1 -2
  57. package/dist/platform/index.web.js +0 -1
  58. package/dist/pol-attachment-queue-BVAIueoP.d.ts +817 -0
  59. package/dist/provider/index.d.ts +38 -34
  60. package/dist/provider/index.js +11 -12
  61. package/dist/react/index.d.ts +372 -0
  62. package/dist/react/index.js +25 -0
  63. package/dist/storage/index.d.ts +3 -3
  64. package/dist/storage/index.js +22 -8
  65. package/dist/storage/index.native.d.ts +3 -3
  66. package/dist/storage/index.native.js +21 -7
  67. package/dist/storage/index.web.d.ts +3 -3
  68. package/dist/storage/index.web.js +21 -7
  69. package/dist/storage/upload/index.d.ts +7 -8
  70. package/dist/storage/upload/index.js +3 -3
  71. package/dist/storage/upload/index.native.d.ts +7 -8
  72. package/dist/storage/upload/index.native.js +4 -3
  73. package/dist/storage/upload/index.web.d.ts +1 -4
  74. package/dist/storage/upload/index.web.js +3 -3
  75. package/dist/supabase-connector-T9vHq_3i.d.ts +202 -0
  76. package/dist/sync/index.js +3 -3
  77. package/dist/{supabase-connector-qLm-WHkM.d.ts → types-B212hgfA.d.ts} +48 -170
  78. package/dist/{types-BVacP54t.d.ts → types-CyvBaAl8.d.ts} +12 -4
  79. package/dist/types-D0WcHrq6.d.ts +234 -0
  80. package/package.json +28 -4
  81. package/dist/CacheSettingsManager-1exbOC6S.d.ts +0 -261
  82. package/dist/chunk-4C3RY5SU.js.map +0 -1
  83. package/dist/chunk-53WH2JJV.js.map +0 -1
  84. package/dist/chunk-BREGB4WL.js.map +0 -1
  85. package/dist/chunk-DGUM43GV.js +0 -11
  86. package/dist/chunk-DHYUBVP7.js.map +0 -1
  87. package/dist/chunk-GKF7TOMT.js +0 -1
  88. package/dist/chunk-H772V6XQ.js.map +0 -1
  89. package/dist/chunk-HFOFLW5F.js.map +0 -1
  90. package/dist/chunk-KGSFAE5B.js +0 -1
  91. package/dist/chunk-LNL64IJZ.js +0 -1
  92. package/dist/chunk-MKD2VCX3.js.map +0 -1
  93. package/dist/chunk-UEYRTLKE.js.map +0 -1
  94. package/dist/chunk-WQ5MPAVC.js +0 -449
  95. package/dist/chunk-WQ5MPAVC.js.map +0 -1
  96. package/dist/chunk-ZEOKPWUC.js +0 -1165
  97. package/dist/chunk-ZEOKPWUC.js.map +0 -1
  98. package/dist/pol-attachment-queue-C7YNXXhK.d.ts +0 -676
  99. package/dist/types-Bgvx7-E8.d.ts +0 -187
  100. /package/dist/{chunk-DGUM43GV.js.map → chunk-654ERHA7.js.map} +0 -0
  101. /package/dist/{chunk-GKF7TOMT.js.map → chunk-T4AO7JIG.js.map} +0 -0
  102. /package/dist/{chunk-KGSFAE5B.js.map → chunk-YHTZ7VMV.js.map} +0 -0
  103. /package/dist/{chunk-LNL64IJZ.js.map → react/index.js.map} +0 -0
@@ -3,15 +3,17 @@ import {
3
3
  } from "./chunk-P6WOZO7H.js";
4
4
  import {
5
5
  createPolAttachmentQueue
6
- } from "./chunk-ZEOKPWUC.js";
6
+ } from "./chunk-4TXTAEF2.js";
7
7
  import {
8
- DEFAULT_CONNECTION_HEALTH,
9
- DEFAULT_SYNC_METRICS,
10
- DEFAULT_SYNC_STATUS,
11
8
  HealthMonitor,
12
9
  MetricsCollector,
13
10
  SyncStatusTracker
14
- } from "./chunk-H772V6XQ.js";
11
+ } from "./chunk-CUCAYK7Z.js";
12
+ import {
13
+ DEFAULT_CONNECTION_HEALTH,
14
+ DEFAULT_SYNC_METRICS,
15
+ DEFAULT_SYNC_STATUS
16
+ } from "./chunk-24RDMMCL.js";
15
17
  import {
16
18
  AttachmentQueueContext,
17
19
  CompletedTransactionsContext,
@@ -29,23 +31,23 @@ import {
29
31
  usePowerSync,
30
32
  useSyncStatus
31
33
  } from "./chunk-YSTEESEG.js";
34
+ import {
35
+ createSupabaseUploadHandler
36
+ } from "./chunk-CAB26E6F.js";
32
37
  import {
33
38
  SupabaseStorageAdapter
34
- } from "./chunk-WQ5MPAVC.js";
39
+ } from "./chunk-XAEII4ZX.js";
35
40
  import {
36
41
  createNativePlatformAdapter
37
- } from "./chunk-53WH2JJV.js";
42
+ } from "./chunk-WN5ZJ3E2.js";
38
43
  import {
39
44
  SupabaseConnector
40
- } from "./chunk-HFOFLW5F.js";
45
+ } from "./chunk-KN2IZERF.js";
41
46
  import {
42
47
  createSyncError,
43
48
  extractEntityIds,
44
49
  extractTableNames
45
- } from "./chunk-XQAJM2MW.js";
46
- import {
47
- __require
48
- } from "./chunk-DGUM43GV.js";
50
+ } from "./chunk-VACPAAQZ.js";
49
51
 
50
52
  // src/provider/PowerSyncProvider.tsx
51
53
  import { useEffect, useState, useRef, useMemo, useCallback } from "react";
@@ -579,12 +581,21 @@ function PowerSyncProvider({
579
581
  const initAttachmentQueue = async () => {
580
582
  try {
581
583
  logger.info("[PowerSyncProvider] Initializing attachment queue...");
582
- const queue = createPolAttachmentQueue(
583
- db,
584
- // PowerSync DB instance
585
- platform,
586
- attachmentConfig
587
- );
584
+ const remoteStorage = new SupabaseStorageAdapter({
585
+ client: supabaseClient,
586
+ defaultBucket: attachmentConfig.bucket,
587
+ logger,
588
+ imageTransform: attachmentConfig.compression ? {
589
+ enabled: attachmentConfig.compression.enabled ?? true,
590
+ width: attachmentConfig.compression.maxWidth,
591
+ quality: attachmentConfig.compression.quality ? Math.round(attachmentConfig.compression.quality * 100) : void 0
592
+ } : void 0
593
+ }, platform.fileSystem);
594
+ const queueOptions = {
595
+ ...attachmentConfig,
596
+ remoteStorage
597
+ };
598
+ const queue = createPolAttachmentQueue(db, platform, queueOptions);
588
599
  await queue.init();
589
600
  if (controller_0.cancelled) {
590
601
  queue.dispose();
@@ -608,7 +619,7 @@ function PowerSyncProvider({
608
619
  attachmentQueueRef.current = null;
609
620
  setAttachmentQueueReady(false);
610
621
  };
611
- }, [db, attachmentConfig, platform, logger]);
622
+ }, [db, attachmentConfig, platform, logger, supabaseClient]);
612
623
  useEffect(() => {
613
624
  return () => {
614
625
  if (isCleaningUpRef.current) {
@@ -1019,10 +1030,12 @@ function PowerSyncProvider({
1019
1030
  import { c as _c } from "react/compiler-runtime";
1020
1031
  import { useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
1021
1032
  import { View, Text, StyleSheet, Pressable } from "react-native";
1033
+ import { DataLayerProvider } from "@pol-studios/db";
1022
1034
 
1023
1035
  // src/provider/ProviderBridge.tsx
1024
1036
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
1025
1037
  import { PowerSyncContext as PowerSyncContext2 } from "@powersync/react-native";
1038
+ import { StorageQueueProvider, ConflictProvider } from "@pol-studios/db";
1026
1039
  import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
1027
1040
  function ProviderBridge({
1028
1041
  children,
@@ -1116,15 +1129,9 @@ function ProviderBridge({
1116
1129
  }
1117
1130
  let content = children;
1118
1131
  if (!skipStorageQueueProvider) {
1119
- const {
1120
- StorageQueueProvider
1121
- } = __require("@pol-studios/db");
1122
1132
  content = /* @__PURE__ */ jsx2(StorageQueueProvider, { attachmentQueue, isReady: attachmentQueueReady, children: content });
1123
1133
  }
1124
1134
  if (!skipConflictProvider) {
1125
- const {
1126
- ConflictProvider
1127
- } = __require("@pol-studios/db");
1128
1135
  content = /* @__PURE__ */ jsx2(ConflictProvider, { conflictBus, children: content });
1129
1136
  }
1130
1137
  if (db) {
@@ -1258,7 +1265,7 @@ function DefaultErrorRecoveryUI(t0) {
1258
1265
  return t6;
1259
1266
  }
1260
1267
  function OfflineDataProvider(t0) {
1261
- const $ = _c(109);
1268
+ const $ = _c(106);
1262
1269
  const {
1263
1270
  config,
1264
1271
  children,
@@ -1266,8 +1273,7 @@ function OfflineDataProvider(t0) {
1266
1273
  backgroundSync,
1267
1274
  skipConflictProvider: t1,
1268
1275
  skipStorageQueueProvider: t2,
1269
- storageAdapter: customStorageAdapter,
1270
- uploadHandler: customUploadHandler,
1276
+ storageBackend,
1271
1277
  renderInitError,
1272
1278
  renderError,
1273
1279
  onReady,
@@ -1305,266 +1311,217 @@ function OfflineDataProvider(t0) {
1305
1311
  t4 = $[1];
1306
1312
  }
1307
1313
  const platform = t4;
1308
- let t5;
1309
- bb0: {
1310
- if (customStorageAdapter) {
1311
- t5 = customStorageAdapter;
1312
- break bb0;
1313
- }
1314
- if (!attachments) {
1315
- t5 = void 0;
1316
- break bb0;
1317
- }
1318
- let t62;
1319
- if ($[2] !== attachments.bucket || $[3] !== platform.fileSystem || $[4] !== supabaseClient) {
1320
- t62 = new SupabaseStorageAdapter({
1321
- client: supabaseClient,
1322
- bucketConfig: {
1323
- defaultBucket: attachments.bucket
1324
- }
1325
- }, platform.fileSystem);
1326
- $[2] = attachments.bucket;
1327
- $[3] = platform.fileSystem;
1328
- $[4] = supabaseClient;
1329
- $[5] = t62;
1330
- } else {
1331
- t62 = $[5];
1332
- }
1333
- t5 = t62;
1334
- }
1335
- const storageAdapter = t5;
1336
1314
  let t10;
1337
- let t11;
1315
+ let t5;
1338
1316
  let t6;
1339
1317
  let t7;
1340
1318
  let t8;
1341
1319
  let t9;
1342
- if ($[6] !== platform.logger) {
1343
- t6 = async () => {
1320
+ if ($[2] !== platform.logger) {
1321
+ t5 = async () => {
1344
1322
  platform.logger.warn("Sync not available: Use useSyncControl from PowerSync context");
1345
1323
  };
1346
- t7 = async () => {
1324
+ t6 = async () => {
1347
1325
  platform.logger.warn("Live sync not available: Use useSyncControl from PowerSync context");
1348
1326
  };
1349
- t8 = () => {
1327
+ t7 = () => {
1350
1328
  platform.logger.warn("Live sync not available: Use useSyncControl from PowerSync context");
1351
1329
  };
1352
- t9 = async () => {
1330
+ t8 = async () => {
1353
1331
  platform.logger.warn("Scope control not available: Use useSyncControl from PowerSync context");
1354
1332
  };
1355
- t10 = async () => {
1333
+ t9 = async () => {
1356
1334
  platform.logger.warn("Retry not available: Use useSyncControl from PowerSync context");
1357
1335
  };
1358
- t11 = () => {
1336
+ t10 = () => {
1359
1337
  platform.logger.warn("Clear failed uploads not available: Use useSyncControl from PowerSync context");
1360
1338
  };
1361
- $[6] = platform.logger;
1362
- $[7] = t10;
1363
- $[8] = t11;
1364
- $[9] = t6;
1365
- $[10] = t7;
1366
- $[11] = t8;
1367
- $[12] = t9;
1339
+ $[2] = platform.logger;
1340
+ $[3] = t10;
1341
+ $[4] = t5;
1342
+ $[5] = t6;
1343
+ $[6] = t7;
1344
+ $[7] = t8;
1345
+ $[8] = t9;
1368
1346
  } else {
1369
- t10 = $[7];
1370
- t11 = $[8];
1371
- t6 = $[9];
1372
- t7 = $[10];
1373
- t8 = $[11];
1374
- t9 = $[12];
1347
+ t10 = $[3];
1348
+ t5 = $[4];
1349
+ t6 = $[5];
1350
+ t7 = $[6];
1351
+ t8 = $[7];
1352
+ t9 = $[8];
1375
1353
  }
1376
- let t12;
1377
- if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1378
- t12 = [];
1379
- $[13] = t12;
1354
+ let t11;
1355
+ if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1356
+ t11 = [];
1357
+ $[9] = t11;
1380
1358
  } else {
1381
- t12 = $[13];
1359
+ t11 = $[9];
1382
1360
  }
1361
+ let t12;
1383
1362
  let t13;
1384
- let t14;
1385
- if ($[14] !== platform.logger) {
1386
- t13 = () => {
1363
+ if ($[10] !== platform.logger) {
1364
+ t12 = () => {
1387
1365
  platform.logger.warn("Pause auto-retry not available: Use useSyncControl from PowerSync context");
1388
1366
  };
1389
- t14 = () => {
1367
+ t13 = () => {
1390
1368
  platform.logger.warn("Resume auto-retry not available: Use useSyncControl from PowerSync context");
1391
1369
  };
1392
- $[14] = platform.logger;
1393
- $[15] = t13;
1394
- $[16] = t14;
1370
+ $[10] = platform.logger;
1371
+ $[11] = t12;
1372
+ $[12] = t13;
1395
1373
  } else {
1396
- t13 = $[15];
1397
- t14 = $[16];
1374
+ t12 = $[11];
1375
+ t13 = $[12];
1398
1376
  }
1377
+ let t14;
1399
1378
  let t15;
1400
- let t16;
1401
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1402
- t15 = (entry) => {
1379
+ if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1380
+ t14 = (entry) => {
1403
1381
  if (addPendingMutationRef.current) {
1404
1382
  addPendingMutationRef.current(entry);
1405
1383
  }
1406
1384
  };
1407
- t16 = (id) => {
1385
+ t15 = (id) => {
1408
1386
  if (removePendingMutationRef.current) {
1409
1387
  removePendingMutationRef.current(id);
1410
1388
  }
1411
1389
  };
1412
- $[17] = t15;
1413
- $[18] = t16;
1390
+ $[13] = t14;
1391
+ $[14] = t15;
1414
1392
  } else {
1415
- t15 = $[17];
1416
- t16 = $[18];
1393
+ t14 = $[13];
1394
+ t15 = $[14];
1417
1395
  }
1418
- let t17;
1419
- if ($[19] !== t10 || $[20] !== t11 || $[21] !== t13 || $[22] !== t14 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
1420
- t17 = {
1421
- triggerSync: t6,
1422
- startLiveSync: t7,
1423
- stopLiveSync: t8,
1424
- setScope: t9,
1425
- retryFailedUploads: t10,
1426
- clearFailedUploads: t11,
1427
- failedUploads: t12,
1428
- pauseAutoRetry: t13,
1429
- resumeAutoRetry: t14,
1396
+ let t16;
1397
+ if ($[15] !== t10 || $[16] !== t12 || $[17] !== t13 || $[18] !== t5 || $[19] !== t6 || $[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
1398
+ t16 = {
1399
+ triggerSync: t5,
1400
+ startLiveSync: t6,
1401
+ stopLiveSync: t7,
1402
+ setScope: t8,
1403
+ retryFailedUploads: t9,
1404
+ clearFailedUploads: t10,
1405
+ failedUploads: t11,
1406
+ pauseAutoRetry: t12,
1407
+ resumeAutoRetry: t13,
1430
1408
  isAutoRetryPaused: false,
1431
- addPendingMutation: t15,
1432
- removePendingMutation: t16
1409
+ addPendingMutation: t14,
1410
+ removePendingMutation: t15
1433
1411
  };
1434
- $[19] = t10;
1435
- $[20] = t11;
1436
- $[21] = t13;
1437
- $[22] = t14;
1438
- $[23] = t6;
1439
- $[24] = t7;
1440
- $[25] = t8;
1441
- $[26] = t9;
1442
- $[27] = t17;
1412
+ $[15] = t10;
1413
+ $[16] = t12;
1414
+ $[17] = t13;
1415
+ $[18] = t5;
1416
+ $[19] = t6;
1417
+ $[20] = t7;
1418
+ $[21] = t8;
1419
+ $[22] = t9;
1420
+ $[23] = t16;
1443
1421
  } else {
1444
- t17 = $[27];
1422
+ t16 = $[23];
1445
1423
  }
1446
- const syncControl = t17;
1447
- let t18;
1448
- bb1: {
1424
+ const syncControl = t16;
1425
+ let t17;
1426
+ bb0: {
1449
1427
  if (!attachments) {
1450
- t18 = void 0;
1451
- break bb1;
1428
+ t17 = void 0;
1429
+ break bb0;
1452
1430
  }
1453
- let t192;
1454
- if ($[28] !== attachments.idColumn || $[29] !== attachments.orderByColumn || $[30] !== attachments.projectFilter || $[31] !== attachments.sourceTable) {
1455
- t192 = {
1456
- table: attachments.sourceTable,
1457
- idColumn: attachments.idColumn,
1458
- orderByColumn: attachments.orderByColumn,
1459
- projectFilter: attachments.projectFilter
1460
- };
1461
- $[28] = attachments.idColumn;
1462
- $[29] = attachments.orderByColumn;
1463
- $[30] = attachments.projectFilter;
1464
- $[31] = attachments.sourceTable;
1465
- $[32] = t192;
1431
+ let t182;
1432
+ if ($[24] !== attachments.bucket || $[25] !== storageBackend || $[26] !== supabaseClient) {
1433
+ t182 = supabaseClient ? createSupabaseUploadHandler(supabaseClient, {
1434
+ defaultBucket: attachments.bucket,
1435
+ resolver: storageBackend?.resolveBucket?.bind(storageBackend)
1436
+ }) : void 0;
1437
+ $[24] = attachments.bucket;
1438
+ $[25] = storageBackend;
1439
+ $[26] = supabaseClient;
1440
+ $[27] = t182;
1466
1441
  } else {
1467
- t192 = $[32];
1442
+ t182 = $[27];
1468
1443
  }
1444
+ const nativeUploadHandler = t182;
1445
+ const t192 = storageBackend;
1469
1446
  let t202;
1470
- if ($[33] !== platform.logger) {
1471
- t202 = async (attachment, error) => {
1472
- platform.logger.warn(`[AttachmentQueue] Download failed for ${attachment.filename}:`, error);
1473
- return {
1474
- retry: true
1475
- };
1447
+ if ($[28] !== attachments.bucket || $[29] !== attachments.compression || $[30] !== attachments.download || $[31] !== attachments.maxCacheBytes || $[32] !== attachments.onUploadComplete || $[33] !== attachments.onUploadFailed || $[34] !== attachments.skipDownload || $[35] !== attachments.watchIds || $[36] !== nativeUploadHandler || $[37] !== t192) {
1448
+ t202 = {
1449
+ bucket: attachments.bucket,
1450
+ watchIds: attachments.watchIds,
1451
+ skipDownload: attachments.skipDownload,
1452
+ onUploadComplete: attachments.onUploadComplete,
1453
+ onUploadFailed: attachments.onUploadFailed,
1454
+ maxCacheBytes: attachments.maxCacheBytes,
1455
+ compression: attachments.compression,
1456
+ download: attachments.download,
1457
+ remoteStorage: t192,
1458
+ uploadHandler: nativeUploadHandler
1476
1459
  };
1477
- $[33] = platform.logger;
1478
- $[34] = t202;
1479
- } else {
1480
- t202 = $[34];
1481
- }
1482
- let t212;
1483
- if ($[35] !== customUploadHandler) {
1484
- t212 = customUploadHandler ? {
1485
- handler: customUploadHandler,
1486
- config: {
1487
- concurrency: 3,
1488
- timeoutMs: 12e4,
1489
- baseRetryDelayMs: 5e3,
1490
- maxRetryDelayMs: 36e5,
1491
- staleDaysThreshold: 7
1492
- }
1493
- } : void 0;
1494
- $[35] = customUploadHandler;
1495
- $[36] = t212;
1460
+ $[28] = attachments.bucket;
1461
+ $[29] = attachments.compression;
1462
+ $[30] = attachments.download;
1463
+ $[31] = attachments.maxCacheBytes;
1464
+ $[32] = attachments.onUploadComplete;
1465
+ $[33] = attachments.onUploadFailed;
1466
+ $[34] = attachments.skipDownload;
1467
+ $[35] = attachments.watchIds;
1468
+ $[36] = nativeUploadHandler;
1469
+ $[37] = t192;
1470
+ $[38] = t202;
1496
1471
  } else {
1497
- t212 = $[36];
1472
+ t202 = $[38];
1498
1473
  }
1499
- let t222;
1500
- if ($[37] !== storageAdapter || $[38] !== t192 || $[39] !== t202 || $[40] !== t212) {
1501
- t222 = {
1502
- source: t192,
1503
- remoteStorage: storageAdapter,
1504
- attachmentTableName: "photo_attachments",
1505
- performInitialSync: true,
1506
- onDownloadError: t202,
1507
- upload: t212
1508
- };
1509
- $[37] = storageAdapter;
1510
- $[38] = t192;
1511
- $[39] = t202;
1512
- $[40] = t212;
1513
- $[41] = t222;
1514
- } else {
1515
- t222 = $[41];
1516
- }
1517
- t18 = t222;
1474
+ t17 = t202;
1518
1475
  }
1519
- const attachmentConfig = t18;
1520
- const t19 = powerSyncUrl ?? "";
1521
- const t20 = syncConfig?.autoConnect ?? true;
1522
- const t21 = syncConfig?.enableHealthMonitoring ?? true;
1523
- const t22 = syncConfig?.enableMetrics ?? true;
1524
- let t23;
1525
- if ($[42] !== t20 || $[43] !== t21 || $[44] !== t22) {
1526
- t23 = {
1527
- autoConnect: t20,
1528
- enableHealthMonitoring: t21,
1529
- enableMetrics: t22
1476
+ const attachmentConfig = t17;
1477
+ const t18 = powerSyncUrl ?? "";
1478
+ const t19 = syncConfig?.autoConnect ?? true;
1479
+ const t20 = syncConfig?.enableHealthMonitoring ?? true;
1480
+ const t21 = syncConfig?.enableMetrics ?? true;
1481
+ let t22;
1482
+ if ($[39] !== t19 || $[40] !== t20 || $[41] !== t21) {
1483
+ t22 = {
1484
+ autoConnect: t19,
1485
+ enableHealthMonitoring: t20,
1486
+ enableMetrics: t21
1530
1487
  };
1531
- $[42] = t20;
1532
- $[43] = t21;
1533
- $[44] = t22;
1534
- $[45] = t23;
1488
+ $[39] = t19;
1489
+ $[40] = t20;
1490
+ $[41] = t21;
1491
+ $[42] = t22;
1535
1492
  } else {
1536
- t23 = $[45];
1493
+ t22 = $[42];
1537
1494
  }
1538
- let t24;
1539
- if ($[46] !== attachmentConfig || $[47] !== connectorConfig || $[48] !== dbFilename || $[49] !== platform || $[50] !== queryClient || $[51] !== schema || $[52] !== supabaseClient || $[53] !== t19 || $[54] !== t23) {
1540
- t24 = {
1495
+ let t23;
1496
+ if ($[43] !== attachmentConfig || $[44] !== connectorConfig || $[45] !== dbFilename || $[46] !== platform || $[47] !== queryClient || $[48] !== schema || $[49] !== supabaseClient || $[50] !== t18 || $[51] !== t22) {
1497
+ t23 = {
1541
1498
  platform,
1542
1499
  schema,
1543
- powerSyncUrl: t19,
1500
+ powerSyncUrl: t18,
1544
1501
  supabaseClient,
1545
1502
  queryClient,
1546
1503
  dbFilename,
1547
1504
  connector: connectorConfig,
1548
1505
  attachments: attachmentConfig,
1549
- sync: t23
1506
+ sync: t22
1550
1507
  };
1551
- $[46] = attachmentConfig;
1552
- $[47] = connectorConfig;
1553
- $[48] = dbFilename;
1554
- $[49] = platform;
1555
- $[50] = queryClient;
1556
- $[51] = schema;
1557
- $[52] = supabaseClient;
1558
- $[53] = t19;
1559
- $[54] = t23;
1560
- $[55] = t24;
1508
+ $[43] = attachmentConfig;
1509
+ $[44] = connectorConfig;
1510
+ $[45] = dbFilename;
1511
+ $[46] = platform;
1512
+ $[47] = queryClient;
1513
+ $[48] = schema;
1514
+ $[49] = supabaseClient;
1515
+ $[50] = t18;
1516
+ $[51] = t22;
1517
+ $[52] = t23;
1561
1518
  } else {
1562
- t24 = $[55];
1519
+ t23 = $[52];
1563
1520
  }
1564
- const powerSyncConfig = t24;
1565
- let t25;
1566
- if ($[56] !== onError || $[57] !== platform.logger) {
1567
- t25 = (err) => {
1521
+ const powerSyncConfig = t23;
1522
+ let t24;
1523
+ if ($[53] !== onError || $[54] !== platform.logger) {
1524
+ t24 = (err) => {
1568
1525
  platform.logger.error("PowerSync error:", err);
1569
1526
  const errorMessage = err.message ?? "";
1570
1527
  if (errorMessage.includes("not open") || errorMessage.includes("closed") || errorMessage.includes("failed to open") || errorMessage.includes("initialization failed")) {
@@ -1572,97 +1529,97 @@ function OfflineDataProvider(t0) {
1572
1529
  }
1573
1530
  onError?.(err);
1574
1531
  };
1575
- $[56] = onError;
1576
- $[57] = platform.logger;
1577
- $[58] = t25;
1532
+ $[53] = onError;
1533
+ $[54] = platform.logger;
1534
+ $[55] = t24;
1578
1535
  } else {
1579
- t25 = $[58];
1536
+ t24 = $[55];
1580
1537
  }
1581
- const handlePowerSyncError = t25;
1582
- let t26;
1583
- if ($[59] !== platform.logger) {
1584
- t26 = () => {
1538
+ const handlePowerSyncError = t24;
1539
+ let t25;
1540
+ if ($[56] !== platform.logger) {
1541
+ t25 = () => {
1585
1542
  platform.logger.info("Retrying PowerSync initialization...");
1586
1543
  setInitError(null);
1587
1544
  setRetryKey(_temp);
1588
1545
  };
1589
- $[59] = platform.logger;
1590
- $[60] = t26;
1546
+ $[56] = platform.logger;
1547
+ $[57] = t25;
1591
1548
  } else {
1592
- t26 = $[60];
1549
+ t25 = $[57];
1593
1550
  }
1594
- const handleRetry = t26;
1595
- let t27;
1596
- if ($[61] !== backgroundSync?.callbacks || $[62] !== onBackgroundSyncSystemReadyProp || $[63] !== platform.logger) {
1597
- t27 = (system) => {
1551
+ const handleRetry = t25;
1552
+ let t26;
1553
+ if ($[58] !== backgroundSync?.callbacks || $[59] !== onBackgroundSyncSystemReadyProp || $[60] !== platform.logger) {
1554
+ t26 = (system) => {
1598
1555
  backgroundSyncSystemRef.current = system;
1599
1556
  backgroundSync?.callbacks?.onSyncStart?.();
1600
1557
  onBackgroundSyncSystemReadyProp?.(system);
1601
1558
  platform.logger.info("[Background Sync] System ready");
1602
1559
  };
1603
- $[61] = backgroundSync?.callbacks;
1604
- $[62] = onBackgroundSyncSystemReadyProp;
1605
- $[63] = platform.logger;
1606
- $[64] = t27;
1560
+ $[58] = backgroundSync?.callbacks;
1561
+ $[59] = onBackgroundSyncSystemReadyProp;
1562
+ $[60] = platform.logger;
1563
+ $[61] = t26;
1607
1564
  } else {
1608
- t27 = $[64];
1565
+ t26 = $[61];
1609
1566
  }
1610
1567
  backgroundSync?.callbacks;
1611
- const handleBackgroundSyncSystemReady = t27;
1612
- let t28;
1613
- if ($[65] !== renderError || $[66] !== renderInitError) {
1614
- t28 = (error_0, retry) => {
1568
+ const handleBackgroundSyncSystemReady = t26;
1569
+ let t27;
1570
+ if ($[62] !== renderError || $[63] !== renderInitError) {
1571
+ t27 = (error, retry) => {
1615
1572
  const customRenderer = renderInitError ?? renderError;
1616
1573
  if (customRenderer) {
1617
- return customRenderer(error_0, retry);
1574
+ return customRenderer(error, retry);
1618
1575
  }
1619
- return /* @__PURE__ */ jsx3(DefaultErrorRecoveryUI, { error: error_0, onRetry: retry });
1576
+ return /* @__PURE__ */ jsx3(DefaultErrorRecoveryUI, { error, onRetry: retry });
1620
1577
  };
1621
- $[65] = renderError;
1622
- $[66] = renderInitError;
1623
- $[67] = t28;
1578
+ $[62] = renderError;
1579
+ $[63] = renderInitError;
1580
+ $[64] = t27;
1624
1581
  } else {
1625
- t28 = $[67];
1582
+ t27 = $[64];
1626
1583
  }
1627
- const errorFallback = t28;
1628
- let t29;
1629
- if ($[68] !== powerSyncSyncStatus || $[69] !== powerSyncUrl) {
1630
- t29 = !powerSyncUrl ? {
1584
+ const errorFallback = t27;
1585
+ let t28;
1586
+ if ($[65] !== powerSyncSyncStatus || $[66] !== powerSyncUrl) {
1587
+ t28 = !powerSyncUrl ? {
1631
1588
  hasSynced: true,
1632
1589
  connected: true,
1633
1590
  connecting: false,
1634
1591
  isOnline: true
1635
1592
  } : powerSyncSyncStatus;
1636
- $[68] = powerSyncSyncStatus;
1637
- $[69] = powerSyncUrl;
1638
- $[70] = t29;
1593
+ $[65] = powerSyncSyncStatus;
1594
+ $[66] = powerSyncUrl;
1595
+ $[67] = t28;
1639
1596
  } else {
1640
- t29 = $[70];
1597
+ t28 = $[67];
1641
1598
  }
1642
- const effectiveSyncStatus = t29;
1599
+ const effectiveSyncStatus = t28;
1600
+ let t29;
1643
1601
  let t30;
1644
- let t31;
1645
- if ($[71] !== effectiveSyncStatus || $[72] !== onSyncStatusChange) {
1646
- t30 = () => {
1602
+ if ($[68] !== effectiveSyncStatus || $[69] !== onSyncStatusChange) {
1603
+ t29 = () => {
1647
1604
  if (effectiveSyncStatus) {
1648
1605
  onSyncStatusChange?.(effectiveSyncStatus);
1649
1606
  }
1650
1607
  };
1651
- t31 = [effectiveSyncStatus, onSyncStatusChange];
1652
- $[71] = effectiveSyncStatus;
1653
- $[72] = onSyncStatusChange;
1654
- $[73] = t30;
1655
- $[74] = t31;
1608
+ t30 = [effectiveSyncStatus, onSyncStatusChange];
1609
+ $[68] = effectiveSyncStatus;
1610
+ $[69] = onSyncStatusChange;
1611
+ $[70] = t29;
1612
+ $[71] = t30;
1656
1613
  } else {
1657
- t30 = $[73];
1658
- t31 = $[74];
1614
+ t29 = $[70];
1615
+ t30 = $[71];
1659
1616
  }
1660
- useEffect3(t30, t31);
1617
+ useEffect3(t29, t30);
1618
+ let t31;
1661
1619
  let t32;
1662
- let t33;
1663
- if ($[75] !== backgroundSync || $[76] !== children || $[77] !== dataLayer || $[78] !== effectiveSyncStatus || $[79] !== errorFallback || $[80] !== handleBackgroundSyncSystemReady || $[81] !== handlePowerSyncError || $[82] !== handleRetry || $[83] !== initError || $[84] !== onError || $[85] !== onReady || $[86] !== platform.logger || $[87] !== powerSyncConfig || $[88] !== powerSyncInstance || $[89] !== powerSyncUrl || $[90] !== queryClient || $[91] !== renderError || $[92] !== renderInitError || $[93] !== retryKey || $[94] !== skipConflictProvider || $[95] !== skipStorageQueueProvider || $[96] !== supabaseClient || $[97] !== syncControl) {
1664
- t33 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1665
- bb2: {
1620
+ if ($[72] !== backgroundSync || $[73] !== children || $[74] !== dataLayer || $[75] !== effectiveSyncStatus || $[76] !== errorFallback || $[77] !== handleBackgroundSyncSystemReady || $[78] !== handlePowerSyncError || $[79] !== handleRetry || $[80] !== initError || $[81] !== onError || $[82] !== onReady || $[83] !== platform.logger || $[84] !== powerSyncConfig || $[85] !== powerSyncInstance || $[86] !== powerSyncUrl || $[87] !== queryClient || $[88] !== renderError || $[89] !== renderInitError || $[90] !== retryKey || $[91] !== skipConflictProvider || $[92] !== skipStorageQueueProvider || $[93] !== supabaseClient || $[94] !== syncControl) {
1621
+ t32 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1622
+ bb1: {
1666
1623
  const renderContent = () => {
1667
1624
  if (!powerSyncUrl) {
1668
1625
  return /* @__PURE__ */ jsx3(Fragment2, { children });
@@ -1689,71 +1646,66 @@ function OfflineDataProvider(t0) {
1689
1646
  removePendingMutationRef.current = remove;
1690
1647
  }, children }) }, retryKey) });
1691
1648
  };
1692
- let t34;
1693
- if ($[100] !== dataLayer.config || $[101] !== effectiveSyncStatus || $[102] !== onError || $[103] !== platform.logger || $[104] !== powerSyncInstance || $[105] !== queryClient || $[106] !== supabaseClient || $[107] !== syncControl) {
1694
- t34 = (content) => {
1695
- const {
1696
- DataLayerProvider
1697
- } = __require("@pol-studios/db");
1698
- return /* @__PURE__ */ jsx3(DataLayerProvider, { config: dataLayer.config, powerSyncInstance, supabaseClient, queryClient, powerSyncSyncStatus: effectiveSyncStatus, syncControl, onInitialized: () => {
1699
- platform.logger.info("Data layer initialized");
1700
- }, onError: (err_0) => {
1701
- platform.logger.error("Data layer error:", err_0);
1702
- onError?.(err_0);
1703
- }, children: content });
1704
- };
1705
- $[100] = dataLayer.config;
1706
- $[101] = effectiveSyncStatus;
1707
- $[102] = onError;
1708
- $[103] = platform.logger;
1709
- $[104] = powerSyncInstance;
1710
- $[105] = queryClient;
1711
- $[106] = supabaseClient;
1712
- $[107] = syncControl;
1713
- $[108] = t34;
1649
+ let t33;
1650
+ if ($[97] !== dataLayer.config || $[98] !== effectiveSyncStatus || $[99] !== onError || $[100] !== platform.logger || $[101] !== powerSyncInstance || $[102] !== queryClient || $[103] !== supabaseClient || $[104] !== syncControl) {
1651
+ t33 = (content) => /* @__PURE__ */ jsx3(DataLayerProvider, { config: dataLayer.config, powerSyncInstance, supabaseClient, queryClient, powerSyncSyncStatus: effectiveSyncStatus, syncControl, onInitialized: () => {
1652
+ platform.logger.info("Data layer initialized");
1653
+ }, onError: (err_0) => {
1654
+ platform.logger.error("Data layer error:", err_0);
1655
+ onError?.(err_0);
1656
+ }, children: content });
1657
+ $[97] = dataLayer.config;
1658
+ $[98] = effectiveSyncStatus;
1659
+ $[99] = onError;
1660
+ $[100] = platform.logger;
1661
+ $[101] = powerSyncInstance;
1662
+ $[102] = queryClient;
1663
+ $[103] = supabaseClient;
1664
+ $[104] = syncControl;
1665
+ $[105] = t33;
1714
1666
  } else {
1715
- t34 = $[108];
1667
+ t33 = $[105];
1716
1668
  }
1717
- const renderWithDataLayer = t34;
1669
+ const renderWithDataLayer = t33;
1718
1670
  if (dataLayer && !dataLayer.skip) {
1719
- t33 = renderWithDataLayer(renderContent());
1720
- break bb2;
1671
+ t32 = renderWithDataLayer(renderContent());
1672
+ break bb1;
1721
1673
  }
1722
- t32 = renderContent();
1674
+ t31 = renderContent();
1723
1675
  }
1724
- $[75] = backgroundSync;
1725
- $[76] = children;
1726
- $[77] = dataLayer;
1727
- $[78] = effectiveSyncStatus;
1728
- $[79] = errorFallback;
1729
- $[80] = handleBackgroundSyncSystemReady;
1730
- $[81] = handlePowerSyncError;
1731
- $[82] = handleRetry;
1732
- $[83] = initError;
1733
- $[84] = onError;
1734
- $[85] = onReady;
1735
- $[86] = platform.logger;
1736
- $[87] = powerSyncConfig;
1737
- $[88] = powerSyncInstance;
1738
- $[89] = powerSyncUrl;
1739
- $[90] = queryClient;
1740
- $[91] = renderError;
1741
- $[92] = renderInitError;
1742
- $[93] = retryKey;
1743
- $[94] = skipConflictProvider;
1744
- $[95] = skipStorageQueueProvider;
1745
- $[96] = supabaseClient;
1746
- $[97] = syncControl;
1747
- $[98] = t32;
1748
- $[99] = t33;
1676
+ $[72] = backgroundSync;
1677
+ $[73] = children;
1678
+ $[74] = dataLayer;
1679
+ $[75] = effectiveSyncStatus;
1680
+ $[76] = errorFallback;
1681
+ $[77] = handleBackgroundSyncSystemReady;
1682
+ $[78] = handlePowerSyncError;
1683
+ $[79] = handleRetry;
1684
+ $[80] = initError;
1685
+ $[81] = onError;
1686
+ $[82] = onReady;
1687
+ $[83] = platform.logger;
1688
+ $[84] = powerSyncConfig;
1689
+ $[85] = powerSyncInstance;
1690
+ $[86] = powerSyncUrl;
1691
+ $[87] = queryClient;
1692
+ $[88] = renderError;
1693
+ $[89] = renderInitError;
1694
+ $[90] = retryKey;
1695
+ $[91] = skipConflictProvider;
1696
+ $[92] = skipStorageQueueProvider;
1697
+ $[93] = supabaseClient;
1698
+ $[94] = syncControl;
1699
+ $[95] = t31;
1700
+ $[96] = t32;
1749
1701
  } else {
1750
- t32 = $[98];
1751
- t33 = $[99];
1702
+ t31 = $[95];
1703
+ t32 = $[96];
1752
1704
  }
1753
- if (t33 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
1754
- return t33;
1705
+ if (t32 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
1706
+ return t32;
1755
1707
  }
1756
- return t32;
1708
+ return t31;
1757
1709
  }
1758
1710
  function _temp(prev) {
1759
1711
  return prev + 1;
@@ -1765,4 +1717,4 @@ export {
1765
1717
  ProviderBridge,
1766
1718
  OfflineDataProvider
1767
1719
  };
1768
- //# sourceMappingURL=chunk-BREGB4WL.js.map
1720
+ //# sourceMappingURL=chunk-BRXQNASY.js.map