@pol-studios/powersync 1.0.25 → 1.0.32

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 (118) hide show
  1. package/README.md +0 -1
  2. package/dist/{CacheSettingsManager-uz-kbnRH.d.ts → CacheSettingsManager-0H_7thHW.d.ts} +21 -3
  3. package/dist/attachments/index.d.ts +30 -30
  4. package/dist/attachments/index.js +13 -4
  5. package/dist/{background-sync-ChCXW-EV.d.ts → background-sync-BujnI3IR.d.ts} +1 -1
  6. package/dist/{chunk-55DKCJV4.js → chunk-2RDWLXJW.js} +408 -78
  7. package/dist/chunk-2RDWLXJW.js.map +1 -0
  8. package/dist/{chunk-P4HZA6ZT.js → chunk-4665ZSE5.js} +2 -2
  9. package/dist/chunk-4665ZSE5.js.map +1 -0
  10. package/dist/{chunk-XOY2CJ67.js → chunk-4F5B5CZ7.js} +3 -3
  11. package/dist/chunk-5WRI5ZAA.js +31 -0
  12. package/dist/{chunk-BGBQYQV3.js → chunk-65A3SYJZ.js} +193 -299
  13. package/dist/chunk-65A3SYJZ.js.map +1 -0
  14. package/dist/chunk-6SZ64KCZ.js +755 -0
  15. package/dist/chunk-6SZ64KCZ.js.map +1 -0
  16. package/dist/{chunk-YSTEESEG.js → chunk-74TBHWJ4.js} +122 -11
  17. package/dist/chunk-74TBHWJ4.js.map +1 -0
  18. package/dist/chunk-ANXWYQEJ.js +1 -0
  19. package/dist/chunk-ANXWYQEJ.js.map +1 -0
  20. package/dist/{chunk-CAB26E6F.js → chunk-C4J4MLER.js} +29 -24
  21. package/dist/chunk-C4J4MLER.js.map +1 -0
  22. package/dist/{chunk-C5ODS3XH.js → chunk-EOW7JK7Q.js} +9 -16
  23. package/dist/chunk-EOW7JK7Q.js.map +1 -0
  24. package/dist/chunk-HRAVPIAZ.js +220 -0
  25. package/dist/chunk-HRAVPIAZ.js.map +1 -0
  26. package/dist/{chunk-XAEII4ZX.js → chunk-NUGQOTEM.js} +32 -4
  27. package/dist/chunk-NUGQOTEM.js.map +1 -0
  28. package/dist/chunk-OGUFUZSY.js +5415 -0
  29. package/dist/chunk-OGUFUZSY.js.map +1 -0
  30. package/dist/{chunk-VB737IVN.js → chunk-P4D6BQ4X.js} +328 -706
  31. package/dist/chunk-P4D6BQ4X.js.map +1 -0
  32. package/dist/{chunk-CACKC6XG.js → chunk-PGEDE6IM.js} +136 -89
  33. package/dist/chunk-PGEDE6IM.js.map +1 -0
  34. package/dist/{chunk-A4IBBWGO.js → chunk-RALHHPTU.js} +1 -1
  35. package/dist/chunk-RIDSPLE5.js +42 -0
  36. package/dist/chunk-RIDSPLE5.js.map +1 -0
  37. package/dist/{chunk-Z6VOBGTU.js → chunk-UOMHWUHV.js} +2 -12
  38. package/dist/chunk-UOMHWUHV.js.map +1 -0
  39. package/dist/{chunk-WGHNIAF7.js → chunk-YONQYTVH.js} +2 -2
  40. package/dist/chunk-ZAN22NGL.js +13 -0
  41. package/dist/chunk-ZAN22NGL.js.map +1 -0
  42. package/dist/config/index.d.ts +200 -0
  43. package/dist/config/index.js +23 -0
  44. package/dist/config/index.js.map +1 -0
  45. package/dist/connector/index.d.ts +23 -5
  46. package/dist/connector/index.js +4 -2
  47. package/dist/core/index.d.ts +2 -2
  48. package/dist/core/index.js +1 -0
  49. package/dist/error/index.js +1 -0
  50. package/dist/generator/index.js +2 -0
  51. package/dist/generator/index.js.map +1 -1
  52. package/dist/index.d.ts +19 -16
  53. package/dist/index.js +88 -46
  54. package/dist/index.native.d.ts +18 -14
  55. package/dist/index.native.js +93 -44
  56. package/dist/index.web.d.ts +17 -14
  57. package/dist/index.web.js +88 -46
  58. package/dist/maintenance/index.d.ts +2 -2
  59. package/dist/maintenance/index.js +3 -2
  60. package/dist/platform/index.d.ts +1 -1
  61. package/dist/platform/index.js +2 -0
  62. package/dist/platform/index.js.map +1 -1
  63. package/dist/platform/index.native.d.ts +1 -1
  64. package/dist/platform/index.native.js +1 -0
  65. package/dist/platform/index.web.d.ts +1 -1
  66. package/dist/platform/index.web.js +1 -0
  67. package/dist/pol-attachment-queue-DqBvLAEY.d.ts +255 -0
  68. package/dist/provider/index.d.ts +319 -124
  69. package/dist/provider/index.js +21 -16
  70. package/dist/provider/index.native.d.ts +108 -0
  71. package/dist/provider/index.native.js +121 -0
  72. package/dist/provider/index.native.js.map +1 -0
  73. package/dist/provider/index.web.d.ts +16 -0
  74. package/dist/provider/index.web.js +112 -0
  75. package/dist/provider/index.web.js.map +1 -0
  76. package/dist/react/index.d.ts +16 -65
  77. package/dist/react/index.js +2 -9
  78. package/dist/storage/index.d.ts +5 -4
  79. package/dist/storage/index.js +12 -9
  80. package/dist/storage/index.native.d.ts +5 -4
  81. package/dist/storage/index.native.js +8 -5
  82. package/dist/storage/index.web.d.ts +5 -4
  83. package/dist/storage/index.web.js +11 -8
  84. package/dist/storage/upload/index.d.ts +4 -3
  85. package/dist/storage/upload/index.js +4 -2
  86. package/dist/storage/upload/index.native.d.ts +4 -3
  87. package/dist/storage/upload/index.native.js +4 -2
  88. package/dist/storage/upload/index.web.d.ts +2 -1
  89. package/dist/storage/upload/index.web.js +4 -2
  90. package/dist/{supabase-connector-D2oIl2t8.d.ts → supabase-connector-HMxBA9Kg.d.ts} +23 -25
  91. package/dist/sync/index.d.ts +183 -11
  92. package/dist/sync/index.js +13 -3
  93. package/dist/{types-CyvBaAl8.d.ts → types-6QHGELuY.d.ts} +4 -1
  94. package/dist/{types-CDqWh56B.d.ts → types-B9MptP7E.d.ts} +13 -1
  95. package/dist/types-BhAEsJj-.d.ts +330 -0
  96. package/dist/{types-D0WcHrq6.d.ts → types-CGMibJKD.d.ts} +8 -0
  97. package/dist/{types-DiBvmGEi.d.ts → types-DqJnP50o.d.ts} +22 -24
  98. package/dist/{pol-attachment-queue-BE2HU3Us.d.ts → types-JCEhw2Lf.d.ts} +139 -346
  99. package/package.json +18 -4
  100. package/dist/chunk-24RDMMCL.js +0 -44
  101. package/dist/chunk-24RDMMCL.js.map +0 -1
  102. package/dist/chunk-55DKCJV4.js.map +0 -1
  103. package/dist/chunk-654ERHA7.js +0 -1
  104. package/dist/chunk-BGBQYQV3.js.map +0 -1
  105. package/dist/chunk-C5ODS3XH.js.map +0 -1
  106. package/dist/chunk-CAB26E6F.js.map +0 -1
  107. package/dist/chunk-CACKC6XG.js.map +0 -1
  108. package/dist/chunk-P4HZA6ZT.js.map +0 -1
  109. package/dist/chunk-TIFL2KWE.js +0 -358
  110. package/dist/chunk-TIFL2KWE.js.map +0 -1
  111. package/dist/chunk-VB737IVN.js.map +0 -1
  112. package/dist/chunk-XAEII4ZX.js.map +0 -1
  113. package/dist/chunk-YSTEESEG.js.map +0 -1
  114. package/dist/chunk-Z6VOBGTU.js.map +0 -1
  115. /package/dist/{chunk-XOY2CJ67.js.map → chunk-4F5B5CZ7.js.map} +0 -0
  116. /package/dist/{chunk-654ERHA7.js.map → chunk-5WRI5ZAA.js.map} +0 -0
  117. /package/dist/{chunk-A4IBBWGO.js.map → chunk-RALHHPTU.js.map} +0 -0
  118. /package/dist/{chunk-WGHNIAF7.js.map → chunk-YONQYTVH.js.map} +0 -0
package/dist/index.web.js CHANGED
@@ -1,10 +1,19 @@
1
- import "./chunk-654ERHA7.js";
1
+ import "./chunk-ANXWYQEJ.js";
2
2
  import {
3
- SlimPowerSyncProvider,
4
3
  useAttachmentQueueContext,
5
4
  usePowerSyncContext,
6
5
  useSyncStatusContext
7
- } from "./chunk-TIFL2KWE.js";
6
+ } from "./chunk-RIDSPLE5.js";
7
+ import {
8
+ createSchemaRouter,
9
+ definePolConfig,
10
+ generatePowerSyncSchema,
11
+ getTableFromSchema,
12
+ getTableStrategy,
13
+ isProcessedPolConfig,
14
+ isTablePowerSync,
15
+ normalizeTableSpec
16
+ } from "./chunk-HRAVPIAZ.js";
8
17
  import {
9
18
  DOWNLOAD_WORKFLOW_STATES,
10
19
  STATE_MAPPING,
@@ -16,7 +25,7 @@ import {
16
25
  buildRecordFetchQuery,
17
26
  buildWatchQuery,
18
27
  createMigrationStats,
19
- createWatchIds,
28
+ createWatchPaths,
20
29
  extractIdsFromRows,
21
30
  formatMigrationStats,
22
31
  getStateName,
@@ -30,17 +39,17 @@ import {
30
39
  validateSqlIdentifier as validateSqlIdentifier2,
31
40
  validateWhereClause,
32
41
  watchConfigToSourceConfig
33
- } from "./chunk-C5ODS3XH.js";
34
- import {
35
- ConflictBus,
36
- OfflineDataProvider,
37
- PowerSyncProvider,
38
- ProviderBridge
39
- } from "./chunk-VB737IVN.js";
40
- import "./chunk-YHTZ7VMV.js";
42
+ } from "./chunk-EOW7JK7Q.js";
41
43
  import {
42
44
  PowerSyncErrorBoundary
43
45
  } from "./chunk-P6WOZO7H.js";
46
+ import {
47
+ ConflictBus,
48
+ PowerSyncProvider,
49
+ ProviderBridge,
50
+ UPLOAD_BACKOFF_DELAYS,
51
+ UPLOAD_MAX_RETRIES
52
+ } from "./chunk-P4D6BQ4X.js";
44
53
  import {
45
54
  ATTACHMENT_TABLE,
46
55
  AbstractAttachmentQueue,
@@ -75,6 +84,7 @@ import {
75
84
  extractErrorCode,
76
85
  formatCacheSize,
77
86
  getCachedSize,
87
+ getCustomUrlResolver,
78
88
  getEvictionCandidates,
79
89
  getExcludeProtectedStatesCondition,
80
90
  getExtensionFromMimeType,
@@ -89,22 +99,25 @@ import {
89
99
  getSyncedUploadsWithPendingCallback,
90
100
  isAudioMimeType,
91
101
  isCacheNearCapacity,
102
+ isCustomSource,
92
103
  isDocumentMimeType,
93
104
  isImageMimeType,
94
105
  isLocallyAvailable,
95
106
  isPendingDownloadState,
96
107
  isPermanentError,
97
108
  isProtectedUploadState,
109
+ isSignedUrlSource,
98
110
  isStateTransitionAllowed,
99
111
  isVideoMimeType,
100
112
  markUploadPermanentFailure,
101
113
  markUploadSynced,
114
+ resolveBucketFromConfig,
102
115
  scheduleUploadRetry,
103
116
  startUploadProcessing,
104
117
  stripFileUri,
105
118
  uploadOne,
106
119
  validateSqlIdentifier
107
- } from "./chunk-CACKC6XG.js";
120
+ } from "./chunk-PGEDE6IM.js";
108
121
  import {
109
122
  DeadLetterQueue,
110
123
  createDeadLetterEntry,
@@ -114,18 +127,22 @@ import {
114
127
  isBackgroundSyncRegistered,
115
128
  registerBackgroundSync,
116
129
  unregisterBackgroundSync
117
- } from "./chunk-A4IBBWGO.js";
130
+ } from "./chunk-RALHHPTU.js";
118
131
  import {
132
+ DEFAULT_CONNECTION_HEALTH,
133
+ DEFAULT_SYNC_CONFIG,
134
+ DEFAULT_SYNC_METRICS,
135
+ DEFAULT_SYNC_STATUS,
119
136
  HealthMonitor,
120
137
  MetricsCollector,
121
138
  SyncStatusTracker
122
- } from "./chunk-55DKCJV4.js";
139
+ } from "./chunk-2RDWLXJW.js";
123
140
  import {
124
- DEFAULT_CONNECTION_HEALTH,
125
- DEFAULT_SYNC_CONFIG,
126
- DEFAULT_SYNC_METRICS,
127
- DEFAULT_SYNC_STATUS
128
- } from "./chunk-24RDMMCL.js";
141
+ CompletedTransactionsTable,
142
+ FailedTransactionsTable,
143
+ LOCAL_ONLY_TABLES,
144
+ LOCAL_TABLE_NAMES
145
+ } from "./chunk-OGUFUZSY.js";
129
146
  import {
130
147
  checkIntegrityImpl,
131
148
  checkStorageQuotaImpl,
@@ -133,7 +150,7 @@ import {
133
150
  formatBytes,
134
151
  getCacheStatsImpl,
135
152
  useDatabaseMaintenance
136
- } from "./chunk-WGHNIAF7.js";
153
+ } from "./chunk-YONQYTVH.js";
137
154
  import {
138
155
  AttachmentQueueContext,
139
156
  CompletedTransactionsContext,
@@ -163,6 +180,7 @@ import {
163
180
  usePendingMutationsContext,
164
181
  usePlatform,
165
182
  usePowerSync,
183
+ useRetryCountdown,
166
184
  useSyncActivity,
167
185
  useSyncActivityContext,
168
186
  useSyncControl,
@@ -170,33 +188,45 @@ import {
170
188
  useSyncMode,
171
189
  useSyncModeContext,
172
190
  useSyncStatus,
191
+ useUploadBlockedReason,
192
+ useUploadRetry,
173
193
  useUploadStatus
174
- } from "./chunk-YSTEESEG.js";
194
+ } from "./chunk-74TBHWJ4.js";
175
195
  import "./chunk-T4AO7JIG.js";
176
- import "./chunk-CAB26E6F.js";
196
+ import "./chunk-TGBT5XBE.js";
197
+ import {
198
+ SupabaseUploadHandler,
199
+ createSupabaseUploadHandler
200
+ } from "./chunk-4665ZSE5.js";
177
201
  import {
178
202
  CacheSettingsManager,
179
203
  DEFAULT_CACHE_SETTINGS,
180
204
  createSupabaseStorage,
181
205
  isBlobResult,
182
206
  isFileResult
183
- } from "./chunk-XOY2CJ67.js";
207
+ } from "./chunk-4F5B5CZ7.js";
208
+ import {
209
+ DEFAULT_UPLOAD_NOTIFICATION
210
+ } from "./chunk-ZAN22NGL.js";
184
211
  import {
185
212
  SupabaseStorageAdapter,
186
213
  createSupabaseStorageAdapter,
187
214
  getStorageErrorMessage,
188
215
  isStorageAuthError,
189
216
  normalizeStoragePath
190
- } from "./chunk-XAEII4ZX.js";
191
- import "./chunk-TGBT5XBE.js";
217
+ } from "./chunk-NUGQOTEM.js";
192
218
  import {
193
- SupabaseUploadHandler,
194
- createSupabaseUploadHandler
195
- } from "./chunk-P4HZA6ZT.js";
196
- import {
197
- DEFAULT_UPLOAD_NOTIFICATION,
198
219
  resolveBucket
199
- } from "./chunk-Z6VOBGTU.js";
220
+ } from "./chunk-UOMHWUHV.js";
221
+ import {
222
+ AbortError,
223
+ DEFAULT_BACKOFF_CONFIG,
224
+ RetryExhaustedError,
225
+ addJitter,
226
+ calculateBackoffDelay,
227
+ sleep,
228
+ withExponentialBackoff
229
+ } from "./chunk-FV2HXEIY.js";
200
230
  import "./chunk-W7HSR35B.js";
201
231
  import {
202
232
  ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
@@ -231,7 +261,6 @@ import {
231
261
  STORAGE_KEY_SYNC_MODE,
232
262
  STORAGE_WARNING_THRESHOLD
233
263
  } from "./chunk-CGL33PL4.js";
234
- import "./chunk-WN5ZJ3E2.js";
235
264
  import {
236
265
  createWebPlatformAdapter
237
266
  } from "./chunk-N75DEF5J.js";
@@ -252,6 +281,7 @@ import {
252
281
  detectConflicts,
253
282
  discardOnHttpStatus,
254
283
  discardOnPgCodes,
284
+ discardOnRlsDenied,
255
285
  discardOrphaned,
256
286
  fetchServerVersion,
257
287
  getLocalVersion,
@@ -262,16 +292,7 @@ import {
262
292
  runUploadErrorMiddlewareSync,
263
293
  successOnPgCodes,
264
294
  tableHandlers
265
- } from "./chunk-BGBQYQV3.js";
266
- import {
267
- AbortError,
268
- DEFAULT_BACKOFF_CONFIG,
269
- RetryExhaustedError,
270
- addJitter,
271
- calculateBackoffDelay,
272
- sleep,
273
- withExponentialBackoff
274
- } from "./chunk-FV2HXEIY.js";
295
+ } from "./chunk-65A3SYJZ.js";
275
296
  import {
276
297
  AttachmentError,
277
298
  ConfigurationError,
@@ -290,6 +311,7 @@ import {
290
311
  isRlsError,
291
312
  toSyncOperationError
292
313
  } from "./chunk-I2AYMY5O.js";
314
+ import "./chunk-5WRI5ZAA.js";
293
315
  export {
294
316
  ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
295
317
  ATTACHMENT_RETRY_DELAY_MS,
@@ -309,6 +331,7 @@ export {
309
331
  CircuitBreaker,
310
332
  CircuitOpenError,
311
333
  CompletedTransactionsContext,
334
+ CompletedTransactionsTable,
312
335
  ConfigurationError,
313
336
  ConflictBus,
314
337
  ConflictDetectionError,
@@ -345,15 +368,17 @@ export {
345
368
  EVICTION_TRIGGER_THRESHOLD,
346
369
  EncodingType,
347
370
  FailedTransactionsContext,
371
+ FailedTransactionsTable,
348
372
  HEALTH_CHECK_INTERVAL_MS,
349
373
  HEALTH_CHECK_TIMEOUT_MS,
350
374
  HealthMonitor,
351
375
  InitializationError,
352
376
  LATENCY_DEGRADED_THRESHOLD_MS,
353
377
  LOCALLY_AVAILABLE_STATES,
378
+ LOCAL_ONLY_TABLES,
379
+ LOCAL_TABLE_NAMES,
354
380
  MAX_CONSECUTIVE_FAILURES,
355
381
  MetricsCollector,
356
- OfflineDataProvider,
357
382
  PENDING_DOWNLOAD_STATES,
358
383
  PROTECTED_UPLOAD_STATES,
359
384
  PendingMutationsContext,
@@ -380,7 +405,6 @@ export {
380
405
  STORAGE_KEY_PREFIX,
381
406
  STORAGE_KEY_SYNC_MODE,
382
407
  STORAGE_WARNING_THRESHOLD,
383
- SlimPowerSyncProvider,
384
408
  SupabaseConnector,
385
409
  SupabaseStorageAdapter,
386
410
  SupabaseUploadHandler,
@@ -392,6 +416,8 @@ export {
392
416
  SyncStatusTracker,
393
417
  TERMINAL_STATES,
394
418
  TransactionAbortError,
419
+ UPLOAD_BACKOFF_DELAYS,
420
+ UPLOAD_MAX_RETRIES,
395
421
  UPLOAD_WORKFLOW_STATES,
396
422
  VALID_STATES,
397
423
  addJitter,
@@ -413,6 +439,7 @@ export {
413
439
  createDeadLetterEntry,
414
440
  createMigrationStats,
415
441
  createPolAttachmentQueue,
442
+ createSchemaRouter,
416
443
  createSupabaseAuth,
417
444
  createSupabaseStorage,
418
445
  createSupabaseStorageAdapter,
@@ -420,14 +447,16 @@ export {
420
447
  createSyncError,
421
448
  createUploadManagerDeps,
422
449
  createUploadManagerState,
423
- createWatchIds,
450
+ createWatchPaths,
424
451
  createWebPlatformAdapter,
425
452
  defaultSchemaRouter,
426
453
  defineBackgroundSyncTask,
454
+ definePolConfig,
427
455
  detectConflicts,
428
456
  determineAttachmentState,
429
457
  discardOnHttpStatus,
430
458
  discardOnPgCodes,
459
+ discardOnRlsDenied,
431
460
  discardOrphaned,
432
461
  downloadRecord,
433
462
  enforceCacheLimit,
@@ -443,8 +472,10 @@ export {
443
472
  formatMigrationStats,
444
473
  generateDLQEntryId,
445
474
  generateFailureId,
475
+ generatePowerSyncSchema,
446
476
  getCacheStatsImpl,
447
477
  getCachedSize,
478
+ getCustomUrlResolver,
448
479
  getEvictionCandidates,
449
480
  getExcludeProtectedStatesCondition,
450
481
  getExtensionFromMimeType,
@@ -460,6 +491,8 @@ export {
460
491
  getStateName,
461
492
  getStorageErrorMessage,
462
493
  getSyncedUploadsWithPendingCallback,
494
+ getTableFromSchema,
495
+ getTableStrategy,
463
496
  hasVersionColumn,
464
497
  idempotentTables,
465
498
  initializeBackgroundSync,
@@ -467,6 +500,7 @@ export {
467
500
  isBackgroundSyncRegistered,
468
501
  isBlobResult,
469
502
  isCacheNearCapacity,
503
+ isCustomSource,
470
504
  isDocumentMimeType,
471
505
  isDownloadWorkflowState,
472
506
  isFileResult,
@@ -474,10 +508,13 @@ export {
474
508
  isLocallyAvailable,
475
509
  isPendingDownloadState,
476
510
  isPermanentError,
511
+ isProcessedPolConfig,
477
512
  isProtectedUploadState,
478
513
  isRlsError,
514
+ isSignedUrlSource,
479
515
  isStateTransitionAllowed,
480
516
  isStorageAuthError,
517
+ isTablePowerSync,
481
518
  isTerminalState,
482
519
  isUploadWorkflowState,
483
520
  isValidAttachmentState,
@@ -487,9 +524,11 @@ export {
487
524
  migrateAttachmentState,
488
525
  migrateAttachmentStateSafe,
489
526
  normalizeStoragePath,
527
+ normalizeTableSpec,
490
528
  recordMigration,
491
529
  registerBackgroundSync,
492
530
  resolveBucket,
531
+ resolveBucketFromConfig,
493
532
  retryOnHttpStatus,
494
533
  runUploadErrorMiddleware,
495
534
  runUploadErrorMiddlewareSync,
@@ -522,6 +561,7 @@ export {
522
561
  usePlatform,
523
562
  usePowerSync,
524
563
  usePowerSyncContext,
564
+ useRetryCountdown,
525
565
  useSyncActivity,
526
566
  useSyncActivityContext,
527
567
  useSyncControl,
@@ -530,6 +570,8 @@ export {
530
570
  useSyncModeContext,
531
571
  useSyncStatus,
532
572
  useSyncStatusContext,
573
+ useUploadBlockedReason,
574
+ useUploadRetry,
533
575
  useUploadStatus,
534
576
  validateSqlIdentifier2 as validateSqlIdentifier,
535
577
  validateSqlIdentifier as validateSqlIdentifierFromStateMachine,
@@ -1,5 +1,5 @@
1
- import { k as CacheStats, j as CompactResult, I as IntegrityResult, d as StorageQuota, A as AbstractPowerSyncDatabase } from '../types-CDqWh56B.js';
2
- export { c as StorageInfo } from '../types-CDqWh56B.js';
1
+ import { k as CacheStats, j as CompactResult, I as IntegrityResult, d as StorageQuota, A as AbstractPowerSyncDatabase } from '../types-B9MptP7E.js';
2
+ export { c as StorageInfo } from '../types-B9MptP7E.js';
3
3
  import { LoggerAdapter } from '../platform/index.js';
4
4
 
5
5
  /**
@@ -4,8 +4,9 @@ import {
4
4
  compactDatabaseImpl,
5
5
  getCacheStatsImpl,
6
6
  useDatabaseMaintenance
7
- } from "../chunk-WGHNIAF7.js";
8
- import "../chunk-YSTEESEG.js";
7
+ } from "../chunk-YONQYTVH.js";
8
+ import "../chunk-74TBHWJ4.js";
9
+ import "../chunk-5WRI5ZAA.js";
9
10
  export {
10
11
  checkIntegrityImpl,
11
12
  checkStorageQuotaImpl,
@@ -1,4 +1,4 @@
1
- import { A as AbstractPowerSyncDatabase } from '../types-CDqWh56B.js';
1
+ import { A as AbstractPowerSyncDatabase } from '../types-B9MptP7E.js';
2
2
 
3
3
  /**
4
4
  * Platform Adapter Types for @pol-studios/powersync
@@ -1,3 +1,5 @@
1
+ import "../chunk-5WRI5ZAA.js";
2
+
1
3
  // src/platform/types.ts
2
4
  function detectPlatform() {
3
5
  if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/platform/types.ts"],"sourcesContent":["/**\n * Platform Adapter Types for @pol-studios/powersync\n *\n * This module defines the interfaces that platform-specific adapters must implement.\n * Consumers provide an adapter for their platform (React Native or Web) that handles\n * platform-specific operations like file system access, async storage, and network status.\n */\n\nimport type { AbstractPowerSyncDatabase } from '../core/types';\n\n// ─── Database Factory Options ────────────────────────────────────────────────\n\n/**\n * Options for creating a PowerSync database instance\n */\nexport interface DatabaseOptions {\n /** Database file name (e.g., \"pol-offline.db\") */\n dbFilename: string;\n /** PowerSync schema definition */\n schema: unknown; // Schema type from @powersync/common\n /** Optional: Encryption key for SQLite */\n encryptionKey?: string;\n}\n\n// ─── File System Adapter ─────────────────────────────────────────────────────\n\n/**\n * Information about a file or directory\n */\nexport interface FileInfo {\n /** Whether the file/directory exists */\n exists: boolean;\n /** Size in bytes (0 for directories) */\n size: number;\n /** Last modification time */\n modificationTime?: Date;\n /** Whether this is a directory */\n isDirectory: boolean;\n}\n\n/**\n * File system operations interface.\n *\n * React Native: Implemented using expo-file-system\n * Web: Implemented using IndexedDB or Cache API\n */\nexport interface FileSystemAdapter {\n /**\n * Read a file's contents\n * @param uri - The file URI/path\n * @param encoding - How to encode the result ('base64' or 'utf8')\n */\n readFile(uri: string, encoding?: 'base64' | 'utf8'): Promise<string>;\n\n /**\n * Write data to a file (creates parent directories if needed)\n * @param uri - The file URI/path\n * @param data - The data to write\n * @param encoding - How the data is encoded ('base64' or 'utf8')\n */\n writeFile(uri: string, data: string, encoding?: 'base64' | 'utf8'): Promise<void>;\n\n /**\n * Delete a file\n * @param uri - The file URI/path\n */\n deleteFile(uri: string): Promise<void>;\n\n /**\n * Copy a file from source to destination\n * @param source - Source file URI/path\n * @param destination - Destination file URI/path\n */\n copyFile(source: string, destination: string): Promise<void>;\n\n /**\n * Move a file from source to destination\n * @param source - Source file URI/path\n * @param destination - Destination file URI/path\n */\n moveFile(source: string, destination: string): Promise<void>;\n\n /**\n * Get information about a file or directory\n * @param uri - The file URI/path\n * @returns File info or null if it doesn't exist\n */\n getFileInfo(uri: string): Promise<FileInfo | null>;\n\n /**\n * Create a directory\n * @param uri - The directory URI/path\n * @param options - Options for directory creation\n */\n makeDirectory(uri: string, options?: {\n intermediates?: boolean;\n }): Promise<void>;\n\n /**\n * Get the documents directory path for this platform\n */\n getDocumentsDirectory(): string;\n\n /**\n * Get the cache directory path for this platform\n */\n getCacheDirectory(): string;\n\n /**\n * Get the free disk space in bytes\n */\n getFreeDiskSpace(): Promise<number>;\n\n /**\n * Download a file from a URL directly to a local path.\n *\n * React Native: Uses expo-file-system downloadAsync which streams\n * directly to disk without loading the entire file into memory,\n * making it suitable for large files.\n *\n * Web: Uses fetch + blob + base64 conversion to IndexedDB. Note that\n * the file is temporarily held in memory during conversion, so very\n * large files (>50MB) may cause memory pressure on web platforms.\n *\n * @param url - The URL to download from\n * @param localPath - The local path to save the file to\n */\n downloadFile(url: string, localPath: string): Promise<void>;\n}\n\n// ─── Async Storage Adapter ───────────────────────────────────────────────────\n\n/**\n * Key-value storage interface for persisting preferences and state.\n *\n * React Native: Implemented using @react-native-async-storage/async-storage\n * Web: Implemented using localStorage\n */\nexport interface AsyncStorageAdapter {\n /**\n * Get a value by key\n * @param key - The storage key\n * @returns The stored value or null if not found\n */\n getItem(key: string): Promise<string | null>;\n\n /**\n * Set a value by key\n * @param key - The storage key\n * @param value - The value to store\n */\n setItem(key: string, value: string): Promise<void>;\n\n /**\n * Remove a value by key\n * @param key - The storage key\n */\n removeItem(key: string): Promise<void>;\n\n /**\n * Get multiple values by keys\n * @param keys - Array of storage keys\n * @returns Array of [key, value] tuples\n */\n multiGet(keys: string[]): Promise<[string, string | null][]>;\n\n /**\n * Set multiple values\n * @param entries - Array of [key, value] tuples\n */\n multiSet(entries: [string, string][]): Promise<void>;\n}\n\n// ─── Network Adapter ─────────────────────────────────────────────────────────\n\n/** Network connection types */\nexport type ConnectionType = 'wifi' | 'cellular' | 'ethernet' | 'unknown' | 'none';\n\n/**\n * Network connectivity monitoring interface.\n *\n * React Native: Implemented using @react-native-community/netinfo\n * Web: Implemented using navigator.onLine + online/offline events\n */\nexport interface NetworkAdapter {\n /**\n * Check if the device is currently connected to the internet\n */\n isConnected(): Promise<boolean>;\n\n /**\n * Get the current connection type\n */\n getConnectionType(): Promise<ConnectionType>;\n\n /**\n * Add a listener for connection status changes\n * @param callback - Called when connection status changes\n * @returns Unsubscribe function\n */\n addConnectionListener(callback: (isConnected: boolean) => void): () => void;\n}\n\n// ─── Logger Adapter ──────────────────────────────────────────────────────────\n\n/**\n * Logging interface for debugging and monitoring.\n * Allows consumers to use their existing logging infrastructure.\n */\nexport interface LoggerAdapter {\n /**\n * Log a debug message (verbose, for development)\n */\n debug(message: string, ...args: unknown[]): void;\n\n /**\n * Log an info message (general information)\n */\n info(message: string, ...args: unknown[]): void;\n\n /**\n * Log a warning message (potential issues)\n */\n warn(message: string, ...args: unknown[]): void;\n\n /**\n * Log an error message (failures)\n */\n error(message: string, ...args: unknown[]): void;\n}\n\n// ─── Image Processor Adapter ─────────────────────────────────────────────────\n\n/**\n * Result of an image compression operation\n */\nexport interface CompressedImage {\n /** URI/path to the compressed image */\n uri: string;\n /** Width of the compressed image in pixels */\n width: number;\n /** Height of the compressed image in pixels */\n height: number;\n}\n\n/**\n * Options for image compression\n */\nexport interface CompressionOptions {\n /** Compression quality (0.0 to 1.0, where 1.0 is best quality) */\n quality: number;\n /** Maximum width in pixels (will scale down if larger) */\n maxWidth?: number;\n /** Maximum height in pixels (will scale down if larger) */\n maxHeight?: number;\n /** Output format */\n format?: 'jpeg' | 'png' | 'webp';\n}\n\n/**\n * Image processing interface for attachment compression.\n *\n * React Native: Implemented using expo-image-manipulator\n * Web: Implemented using canvas API\n *\n * This is optional - if not provided, attachments won't be compressed.\n */\nexport interface ImageProcessorAdapter {\n /**\n * Compress an image\n * @param uri - The source image URI/path\n * @param options - Compression options\n * @returns The compressed image result\n */\n compress(uri: string, options: CompressionOptions): Promise<CompressedImage>;\n}\n\n// ─── Main Platform Adapter Interface ─────────────────────────────────────────\n\n/**\n * Platform-specific adapter that consumers must provide.\n * This allows the package to work across React Native and Web.\n *\n * @example React Native\n * ```typescript\n * import { createNativePlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const platform = createNativePlatformAdapter(logger);\n * ```\n *\n * @example Web\n * ```typescript\n * import { createWebPlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const platform = createWebPlatformAdapter(logger);\n * ```\n */\nexport interface PlatformAdapter {\n /**\n * Create a PowerSync database instance for this platform.\n *\n * React Native: Uses PowerSyncDatabase from @powersync/react-native\n * Web: Uses PowerSyncDatabase from @powersync/web\n *\n * @param options - Database creation options\n * @returns Initialized PowerSync database\n */\n createDatabase(options: DatabaseOptions): Promise<AbstractPowerSyncDatabase>;\n\n /**\n * File system operations for attachment caching.\n */\n fileSystem: FileSystemAdapter;\n\n /**\n * Key-value storage for preferences and metrics persistence.\n */\n storage: AsyncStorageAdapter;\n\n /**\n * Network connectivity monitoring.\n */\n network: NetworkAdapter;\n\n /**\n * Logging interface.\n */\n logger: LoggerAdapter;\n\n /**\n * Optional: Image compression for attachment optimization.\n * If not provided, attachments won't be compressed.\n */\n imageProcessor?: ImageProcessorAdapter;\n}\n\n// ─── Platform Detection ──────────────────────────────────────────────────────\n\n/** Supported platform types */\nexport type PlatformType = 'react-native' | 'web' | 'unknown';\n\n/**\n * Detect the current platform based on environment\n */\nexport function detectPlatform(): PlatformType {\n // Check for React Native\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n // Check for browser environment\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'web';\n }\n return 'unknown';\n}"],"mappings":";AAwVO,SAAS,iBAA+B;AAE7C,MAAI,OAAO,cAAc,eAAe,UAAU,YAAY,eAAe;AAC3E,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/platform/types.ts"],"sourcesContent":["/**\n * Platform Adapter Types for @pol-studios/powersync\n *\n * This module defines the interfaces that platform-specific adapters must implement.\n * Consumers provide an adapter for their platform (React Native or Web) that handles\n * platform-specific operations like file system access, async storage, and network status.\n */\n\nimport type { AbstractPowerSyncDatabase } from '../core/types';\n\n// ─── Database Factory Options ────────────────────────────────────────────────\n\n/**\n * Options for creating a PowerSync database instance\n */\nexport interface DatabaseOptions {\n /** Database file name (e.g., \"pol-offline.db\") */\n dbFilename: string;\n /** PowerSync schema definition */\n schema: unknown; // Schema type from @powersync/common\n /** Optional: Encryption key for SQLite */\n encryptionKey?: string;\n}\n\n// ─── File System Adapter ─────────────────────────────────────────────────────\n\n/**\n * Information about a file or directory\n */\nexport interface FileInfo {\n /** Whether the file/directory exists */\n exists: boolean;\n /** Size in bytes (0 for directories) */\n size: number;\n /** Last modification time */\n modificationTime?: Date;\n /** Whether this is a directory */\n isDirectory: boolean;\n}\n\n/**\n * File system operations interface.\n *\n * React Native: Implemented using expo-file-system\n * Web: Implemented using IndexedDB or Cache API\n */\nexport interface FileSystemAdapter {\n /**\n * Read a file's contents\n * @param uri - The file URI/path\n * @param encoding - How to encode the result ('base64' or 'utf8')\n */\n readFile(uri: string, encoding?: 'base64' | 'utf8'): Promise<string>;\n\n /**\n * Write data to a file (creates parent directories if needed)\n * @param uri - The file URI/path\n * @param data - The data to write\n * @param encoding - How the data is encoded ('base64' or 'utf8')\n */\n writeFile(uri: string, data: string, encoding?: 'base64' | 'utf8'): Promise<void>;\n\n /**\n * Delete a file\n * @param uri - The file URI/path\n */\n deleteFile(uri: string): Promise<void>;\n\n /**\n * Copy a file from source to destination\n * @param source - Source file URI/path\n * @param destination - Destination file URI/path\n */\n copyFile(source: string, destination: string): Promise<void>;\n\n /**\n * Move a file from source to destination\n * @param source - Source file URI/path\n * @param destination - Destination file URI/path\n */\n moveFile(source: string, destination: string): Promise<void>;\n\n /**\n * Get information about a file or directory\n * @param uri - The file URI/path\n * @returns File info or null if it doesn't exist\n */\n getFileInfo(uri: string): Promise<FileInfo | null>;\n\n /**\n * Create a directory\n * @param uri - The directory URI/path\n * @param options - Options for directory creation\n */\n makeDirectory(uri: string, options?: {\n intermediates?: boolean;\n }): Promise<void>;\n\n /**\n * Get the documents directory path for this platform\n */\n getDocumentsDirectory(): string;\n\n /**\n * Get the cache directory path for this platform\n */\n getCacheDirectory(): string;\n\n /**\n * Get the free disk space in bytes\n */\n getFreeDiskSpace(): Promise<number>;\n\n /**\n * Download a file from a URL directly to a local path.\n *\n * React Native: Uses expo-file-system downloadAsync which streams\n * directly to disk without loading the entire file into memory,\n * making it suitable for large files.\n *\n * Web: Uses fetch + blob + base64 conversion to IndexedDB. Note that\n * the file is temporarily held in memory during conversion, so very\n * large files (>50MB) may cause memory pressure on web platforms.\n *\n * @param url - The URL to download from\n * @param localPath - The local path to save the file to\n */\n downloadFile(url: string, localPath: string): Promise<void>;\n}\n\n// ─── Async Storage Adapter ───────────────────────────────────────────────────\n\n/**\n * Key-value storage interface for persisting preferences and state.\n *\n * React Native: Implemented using @react-native-async-storage/async-storage\n * Web: Implemented using localStorage\n */\nexport interface AsyncStorageAdapter {\n /**\n * Get a value by key\n * @param key - The storage key\n * @returns The stored value or null if not found\n */\n getItem(key: string): Promise<string | null>;\n\n /**\n * Set a value by key\n * @param key - The storage key\n * @param value - The value to store\n */\n setItem(key: string, value: string): Promise<void>;\n\n /**\n * Remove a value by key\n * @param key - The storage key\n */\n removeItem(key: string): Promise<void>;\n\n /**\n * Get multiple values by keys\n * @param keys - Array of storage keys\n * @returns Array of [key, value] tuples\n */\n multiGet(keys: string[]): Promise<[string, string | null][]>;\n\n /**\n * Set multiple values\n * @param entries - Array of [key, value] tuples\n */\n multiSet(entries: [string, string][]): Promise<void>;\n}\n\n// ─── Network Adapter ─────────────────────────────────────────────────────────\n\n/** Network connection types */\nexport type ConnectionType = 'wifi' | 'cellular' | 'ethernet' | 'unknown' | 'none';\n\n/**\n * Network connectivity monitoring interface.\n *\n * React Native: Implemented using @react-native-community/netinfo\n * Web: Implemented using navigator.onLine + online/offline events\n */\nexport interface NetworkAdapter {\n /**\n * Check if the device is currently connected to the internet\n */\n isConnected(): Promise<boolean>;\n\n /**\n * Get the current connection type\n */\n getConnectionType(): Promise<ConnectionType>;\n\n /**\n * Add a listener for connection status changes\n * @param callback - Called when connection status changes\n * @returns Unsubscribe function\n */\n addConnectionListener(callback: (isConnected: boolean) => void): () => void;\n}\n\n// ─── Logger Adapter ──────────────────────────────────────────────────────────\n\n/**\n * Logging interface for debugging and monitoring.\n * Allows consumers to use their existing logging infrastructure.\n */\nexport interface LoggerAdapter {\n /**\n * Log a debug message (verbose, for development)\n */\n debug(message: string, ...args: unknown[]): void;\n\n /**\n * Log an info message (general information)\n */\n info(message: string, ...args: unknown[]): void;\n\n /**\n * Log a warning message (potential issues)\n */\n warn(message: string, ...args: unknown[]): void;\n\n /**\n * Log an error message (failures)\n */\n error(message: string, ...args: unknown[]): void;\n}\n\n// ─── Image Processor Adapter ─────────────────────────────────────────────────\n\n/**\n * Result of an image compression operation\n */\nexport interface CompressedImage {\n /** URI/path to the compressed image */\n uri: string;\n /** Width of the compressed image in pixels */\n width: number;\n /** Height of the compressed image in pixels */\n height: number;\n}\n\n/**\n * Options for image compression\n */\nexport interface CompressionOptions {\n /** Compression quality (0.0 to 1.0, where 1.0 is best quality) */\n quality: number;\n /** Maximum width in pixels (will scale down if larger) */\n maxWidth?: number;\n /** Maximum height in pixels (will scale down if larger) */\n maxHeight?: number;\n /** Output format */\n format?: 'jpeg' | 'png' | 'webp';\n}\n\n/**\n * Image processing interface for attachment compression.\n *\n * React Native: Implemented using expo-image-manipulator\n * Web: Implemented using canvas API\n *\n * This is optional - if not provided, attachments won't be compressed.\n */\nexport interface ImageProcessorAdapter {\n /**\n * Compress an image\n * @param uri - The source image URI/path\n * @param options - Compression options\n * @returns The compressed image result\n */\n compress(uri: string, options: CompressionOptions): Promise<CompressedImage>;\n}\n\n// ─── Main Platform Adapter Interface ─────────────────────────────────────────\n\n/**\n * Platform-specific adapter that consumers must provide.\n * This allows the package to work across React Native and Web.\n *\n * @example React Native\n * ```typescript\n * import { createNativePlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const platform = createNativePlatformAdapter(logger);\n * ```\n *\n * @example Web\n * ```typescript\n * import { createWebPlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const platform = createWebPlatformAdapter(logger);\n * ```\n */\nexport interface PlatformAdapter {\n /**\n * Create a PowerSync database instance for this platform.\n *\n * React Native: Uses PowerSyncDatabase from @powersync/react-native\n * Web: Uses PowerSyncDatabase from @powersync/web\n *\n * @param options - Database creation options\n * @returns Initialized PowerSync database\n */\n createDatabase(options: DatabaseOptions): Promise<AbstractPowerSyncDatabase>;\n\n /**\n * File system operations for attachment caching.\n */\n fileSystem: FileSystemAdapter;\n\n /**\n * Key-value storage for preferences and metrics persistence.\n */\n storage: AsyncStorageAdapter;\n\n /**\n * Network connectivity monitoring.\n */\n network: NetworkAdapter;\n\n /**\n * Logging interface.\n */\n logger: LoggerAdapter;\n\n /**\n * Optional: Image compression for attachment optimization.\n * If not provided, attachments won't be compressed.\n */\n imageProcessor?: ImageProcessorAdapter;\n}\n\n// ─── Platform Detection ──────────────────────────────────────────────────────\n\n/** Supported platform types */\nexport type PlatformType = 'react-native' | 'web' | 'unknown';\n\n/**\n * Detect the current platform based on environment\n */\nexport function detectPlatform(): PlatformType {\n // Check for React Native\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n // Check for browser environment\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'web';\n }\n return 'unknown';\n}"],"mappings":";;;AAwVO,SAAS,iBAA+B;AAE7C,MAAI,OAAO,cAAc,eAAe,UAAU,YAAY,eAAe;AAC3E,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { LoggerAdapter, PlatformAdapter } from './index.js';
2
- import '../types-CDqWh56B.js';
2
+ import '../types-B9MptP7E.js';
3
3
 
4
4
  /**
5
5
  * React Native Platform Adapter for @pol-studios/powersync
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createNativePlatformAdapter
3
3
  } from "../chunk-WN5ZJ3E2.js";
4
+ import "../chunk-5WRI5ZAA.js";
4
5
  export {
5
6
  createNativePlatformAdapter
6
7
  };
@@ -1,5 +1,5 @@
1
1
  import { LoggerAdapter, PlatformAdapter } from './index.js';
2
- import '../types-CDqWh56B.js';
2
+ import '../types-B9MptP7E.js';
3
3
 
4
4
  /**
5
5
  * Web Platform Adapter for @pol-studios/powersync
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createWebPlatformAdapter
3
3
  } from "../chunk-N75DEF5J.js";
4
+ import "../chunk-5WRI5ZAA.js";
4
5
  export {
5
6
  createWebPlatformAdapter
6
7
  };