@pol-studios/powersync 1.0.6 → 1.0.10

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 (128) 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 +745 -332
  4. package/dist/attachments/index.js +152 -6
  5. package/dist/{types-Cd7RhNqf.d.ts → background-sync-ChCXW-EV.d.ts} +53 -2
  6. package/dist/chunk-24RDMMCL.js +44 -0
  7. package/dist/chunk-24RDMMCL.js.map +1 -0
  8. package/dist/chunk-4TXTAEF2.js +2060 -0
  9. package/dist/chunk-4TXTAEF2.js.map +1 -0
  10. package/dist/chunk-63PXSPIN.js +358 -0
  11. package/dist/chunk-63PXSPIN.js.map +1 -0
  12. package/dist/chunk-654ERHA7.js +1 -0
  13. package/dist/chunk-A4IBBWGO.js +377 -0
  14. package/dist/chunk-A4IBBWGO.js.map +1 -0
  15. package/dist/chunk-BRXQNASY.js +1720 -0
  16. package/dist/chunk-BRXQNASY.js.map +1 -0
  17. package/dist/chunk-CAB26E6F.js +142 -0
  18. package/dist/chunk-CAB26E6F.js.map +1 -0
  19. package/dist/{chunk-EJ23MXPQ.js → chunk-CGL33PL4.js} +3 -1
  20. package/dist/chunk-CGL33PL4.js.map +1 -0
  21. package/dist/{chunk-R4YFWQ3Q.js → chunk-CUCAYK7Z.js} +309 -92
  22. package/dist/chunk-CUCAYK7Z.js.map +1 -0
  23. package/dist/chunk-FV2HXEIY.js +124 -0
  24. package/dist/chunk-FV2HXEIY.js.map +1 -0
  25. package/dist/chunk-HWSNV45P.js +279 -0
  26. package/dist/chunk-HWSNV45P.js.map +1 -0
  27. package/dist/{chunk-62J2DPKX.js → chunk-KN2IZERF.js} +530 -413
  28. package/dist/chunk-KN2IZERF.js.map +1 -0
  29. package/dist/{chunk-7EMDVIZX.js → chunk-N75DEF5J.js} +19 -1
  30. package/dist/chunk-N75DEF5J.js.map +1 -0
  31. package/dist/chunk-P4HZA6ZT.js +83 -0
  32. package/dist/chunk-P4HZA6ZT.js.map +1 -0
  33. package/dist/chunk-P6WOZO7H.js +49 -0
  34. package/dist/chunk-P6WOZO7H.js.map +1 -0
  35. package/dist/chunk-T4AO7JIG.js +1 -0
  36. package/dist/chunk-TGBT5XBE.js +1 -0
  37. package/dist/{chunk-FPTDATY5.js → chunk-VACPAAQZ.js} +54 -12
  38. package/dist/chunk-VACPAAQZ.js.map +1 -0
  39. package/dist/chunk-WGHNIAF7.js +329 -0
  40. package/dist/chunk-WGHNIAF7.js.map +1 -0
  41. package/dist/{chunk-3AYXHQ4W.js → chunk-WN5ZJ3E2.js} +108 -47
  42. package/dist/chunk-WN5ZJ3E2.js.map +1 -0
  43. package/dist/chunk-XAEII4ZX.js +456 -0
  44. package/dist/chunk-XAEII4ZX.js.map +1 -0
  45. package/dist/chunk-XOY2CJ67.js +289 -0
  46. package/dist/chunk-XOY2CJ67.js.map +1 -0
  47. package/dist/chunk-YHTZ7VMV.js +1 -0
  48. package/dist/chunk-YSTEESEG.js +676 -0
  49. package/dist/chunk-YSTEESEG.js.map +1 -0
  50. package/dist/chunk-Z6VOBGTU.js +32 -0
  51. package/dist/chunk-Z6VOBGTU.js.map +1 -0
  52. package/dist/chunk-ZM4ENYMF.js +230 -0
  53. package/dist/chunk-ZM4ENYMF.js.map +1 -0
  54. package/dist/connector/index.d.ts +236 -4
  55. package/dist/connector/index.js +15 -4
  56. package/dist/core/index.d.ts +16 -3
  57. package/dist/core/index.js +6 -2
  58. package/dist/error/index.d.ts +54 -0
  59. package/dist/error/index.js +7 -0
  60. package/dist/error/index.js.map +1 -0
  61. package/dist/index.d.ts +102 -12
  62. package/dist/index.js +309 -37
  63. package/dist/index.native.d.ts +22 -10
  64. package/dist/index.native.js +309 -38
  65. package/dist/index.web.d.ts +22 -10
  66. package/dist/index.web.js +310 -38
  67. package/dist/maintenance/index.d.ts +118 -0
  68. package/dist/maintenance/index.js +16 -0
  69. package/dist/maintenance/index.js.map +1 -0
  70. package/dist/platform/index.d.ts +16 -1
  71. package/dist/platform/index.js.map +1 -1
  72. package/dist/platform/index.native.d.ts +2 -2
  73. package/dist/platform/index.native.js +1 -1
  74. package/dist/platform/index.web.d.ts +1 -1
  75. package/dist/platform/index.web.js +1 -1
  76. package/dist/pol-attachment-queue-BVAIueoP.d.ts +817 -0
  77. package/dist/provider/index.d.ts +451 -21
  78. package/dist/provider/index.js +32 -13
  79. package/dist/react/index.d.ts +372 -0
  80. package/dist/react/index.js +25 -0
  81. package/dist/react/index.js.map +1 -0
  82. package/dist/storage/index.d.ts +6 -0
  83. package/dist/storage/index.js +42 -0
  84. package/dist/storage/index.js.map +1 -0
  85. package/dist/storage/index.native.d.ts +6 -0
  86. package/dist/storage/index.native.js +40 -0
  87. package/dist/storage/index.native.js.map +1 -0
  88. package/dist/storage/index.web.d.ts +6 -0
  89. package/dist/storage/index.web.js +40 -0
  90. package/dist/storage/index.web.js.map +1 -0
  91. package/dist/storage/upload/index.d.ts +54 -0
  92. package/dist/storage/upload/index.js +15 -0
  93. package/dist/storage/upload/index.js.map +1 -0
  94. package/dist/storage/upload/index.native.d.ts +56 -0
  95. package/dist/storage/upload/index.native.js +15 -0
  96. package/dist/storage/upload/index.native.js.map +1 -0
  97. package/dist/storage/upload/index.web.d.ts +2 -0
  98. package/dist/storage/upload/index.web.js +14 -0
  99. package/dist/storage/upload/index.web.js.map +1 -0
  100. package/dist/supabase-connector-T9vHq_3i.d.ts +202 -0
  101. package/dist/sync/index.d.ts +288 -23
  102. package/dist/sync/index.js +22 -10
  103. package/dist/{index-l3iL9Jte.d.ts → types-B212hgfA.d.ts} +101 -158
  104. package/dist/{types-afHtE1U_.d.ts → types-CDqWh56B.d.ts} +2 -0
  105. package/dist/types-CyvBaAl8.d.ts +60 -0
  106. package/dist/types-D0WcHrq6.d.ts +234 -0
  107. package/package.json +89 -5
  108. package/dist/chunk-32OLICZO.js +0 -1
  109. package/dist/chunk-3AYXHQ4W.js.map +0 -1
  110. package/dist/chunk-5FIMA26D.js +0 -1
  111. package/dist/chunk-62J2DPKX.js.map +0 -1
  112. package/dist/chunk-7EMDVIZX.js.map +0 -1
  113. package/dist/chunk-EJ23MXPQ.js.map +0 -1
  114. package/dist/chunk-FPTDATY5.js.map +0 -1
  115. package/dist/chunk-KCDG2MNP.js +0 -1431
  116. package/dist/chunk-KCDG2MNP.js.map +0 -1
  117. package/dist/chunk-OLHGI472.js +0 -1
  118. package/dist/chunk-PAFBKNL3.js +0 -99
  119. package/dist/chunk-PAFBKNL3.js.map +0 -1
  120. package/dist/chunk-R4YFWQ3Q.js.map +0 -1
  121. package/dist/chunk-V6LJ6MR2.js +0 -740
  122. package/dist/chunk-V6LJ6MR2.js.map +0 -1
  123. package/dist/chunk-VJCL2SWD.js +0 -1
  124. package/dist/failed-upload-store-C0cLxxPz.d.ts +0 -33
  125. /package/dist/{chunk-32OLICZO.js.map → chunk-654ERHA7.js.map} +0 -0
  126. /package/dist/{chunk-5FIMA26D.js.map → chunk-T4AO7JIG.js.map} +0 -0
  127. /package/dist/{chunk-OLHGI472.js.map → chunk-TGBT5XBE.js.map} +0 -0
  128. /package/dist/{chunk-VJCL2SWD.js.map → chunk-YHTZ7VMV.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,26 +1,159 @@
1
- import "./chunk-OLHGI472.js";
2
- import "./chunk-32OLICZO.js";
1
+ import "./chunk-654ERHA7.js";
2
+ import {
3
+ SlimPowerSyncProvider,
4
+ useAttachmentQueueContext,
5
+ usePowerSyncContext,
6
+ useSyncStatusContext
7
+ } from "./chunk-63PXSPIN.js";
8
+ import {
9
+ DOWNLOAD_WORKFLOW_STATES,
10
+ STATE_MAPPING,
11
+ STATE_NAMES,
12
+ TERMINAL_STATES,
13
+ UPLOAD_WORKFLOW_STATES,
14
+ VALID_STATES,
15
+ buildIdOnlyWatchQuery,
16
+ buildRecordFetchQuery,
17
+ buildWatchQuery,
18
+ createMigrationStats,
19
+ formatMigrationStats,
20
+ getStateName,
21
+ isDownloadWorkflowState,
22
+ isTerminalState,
23
+ isUploadWorkflowState,
24
+ isValidAttachmentState,
25
+ migrateAttachmentState,
26
+ migrateAttachmentStateSafe,
27
+ recordMigration,
28
+ validateSqlIdentifier as validateSqlIdentifier2,
29
+ validateWhereClause,
30
+ watchConfigToSourceConfig
31
+ } from "./chunk-ZM4ENYMF.js";
32
+ import {
33
+ ConflictBus,
34
+ OfflineDataProvider,
35
+ PowerSyncProvider,
36
+ ProviderBridge
37
+ } from "./chunk-BRXQNASY.js";
38
+ import "./chunk-YHTZ7VMV.js";
39
+ import {
40
+ PowerSyncErrorBoundary
41
+ } from "./chunk-P6WOZO7H.js";
42
+ import {
43
+ ATTACHMENT_TABLE,
44
+ AbstractAttachmentQueue,
45
+ AttachmentState,
46
+ AttachmentTable,
47
+ CACHE_SIZE_PRESETS,
48
+ DEFAULT_ATTACHMENT_QUEUE_OPTIONS,
49
+ DEFAULT_CACHE_CONFIG,
50
+ DEFAULT_COMPRESSION_CONFIG,
51
+ DEFAULT_DOWNLOAD_CONFIG,
52
+ DEFAULT_UPLOAD_CONFIG,
53
+ EncodingType,
54
+ LOCALLY_AVAILABLE_STATES,
55
+ PENDING_DOWNLOAD_STATES,
56
+ PROTECTED_UPLOAD_STATES,
57
+ PolAttachmentQueue,
58
+ PolAttachmentState,
59
+ PolStorageAdapter,
60
+ blobToArrayBuffer,
61
+ cacheLocalFile,
62
+ clearCache,
63
+ clearUploadCallback,
64
+ copyToManagedCache,
65
+ createCacheManagerDeps,
66
+ createPolAttachmentQueue,
67
+ createUploadManagerDeps,
68
+ createUploadManagerState,
69
+ determineAttachmentState,
70
+ downloadRecord,
71
+ enforceCacheLimit,
72
+ ensureFileUri,
73
+ extractErrorCode,
74
+ formatCacheSize,
75
+ getCachedSize,
76
+ getEvictionCandidates,
77
+ getExcludeProtectedStatesCondition,
78
+ getExtensionFromMimeType,
79
+ getFailedPermanentUploads,
80
+ getLocalUriForStoragePath,
81
+ getMimeType,
82
+ getMimeTypeFromPath,
83
+ getPendingUploads,
84
+ getProtectedStatesInClause,
85
+ getSoonestRetryTime,
86
+ getStaleUploads,
87
+ getSyncedUploadsWithPendingCallback,
88
+ isAudioMimeType,
89
+ isCacheNearCapacity,
90
+ isDocumentMimeType,
91
+ isImageMimeType,
92
+ isLocallyAvailable,
93
+ isPendingDownloadState,
94
+ isPermanentError,
95
+ isProtectedUploadState,
96
+ isStateTransitionAllowed,
97
+ isVideoMimeType,
98
+ markUploadPermanentFailure,
99
+ markUploadSynced,
100
+ scheduleUploadRetry,
101
+ startUploadProcessing,
102
+ stripFileUri,
103
+ uploadOne,
104
+ validateSqlIdentifier
105
+ } from "./chunk-4TXTAEF2.js";
106
+ import {
107
+ DeadLetterQueue,
108
+ createDeadLetterEntry,
109
+ defineBackgroundSyncTask,
110
+ generateDLQEntryId,
111
+ initializeBackgroundSync,
112
+ isBackgroundSyncRegistered,
113
+ registerBackgroundSync,
114
+ unregisterBackgroundSync
115
+ } from "./chunk-A4IBBWGO.js";
116
+ import {
117
+ HealthMonitor,
118
+ MetricsCollector,
119
+ SyncStatusTracker
120
+ } from "./chunk-CUCAYK7Z.js";
121
+ import {
122
+ DEFAULT_CONNECTION_HEALTH,
123
+ DEFAULT_SYNC_CONFIG,
124
+ DEFAULT_SYNC_METRICS,
125
+ DEFAULT_SYNC_STATUS
126
+ } from "./chunk-24RDMMCL.js";
127
+ import {
128
+ checkIntegrityImpl,
129
+ checkStorageQuotaImpl,
130
+ compactDatabaseImpl,
131
+ formatBytes,
132
+ getCacheStatsImpl,
133
+ useDatabaseMaintenance
134
+ } from "./chunk-WGHNIAF7.js";
3
135
  import {
4
136
  AttachmentQueueContext,
5
137
  CompletedTransactionsContext,
6
- ConflictBus,
7
138
  ConnectionHealthContext,
8
139
  ConnectionStatusContext,
9
140
  FailedTransactionsContext,
10
141
  PendingMutationsContext,
11
142
  PowerSyncContext,
12
- PowerSyncProvider,
13
143
  SyncActivityContext,
14
144
  SyncMetricsContext,
15
145
  SyncModeContext,
16
146
  SyncStatusContext,
17
147
  useAttachmentQueue,
148
+ useAttachmentQueueReady,
149
+ useCompletedTransactions,
18
150
  useCompletedTransactionsContext,
19
151
  useConnectionHealth,
20
152
  useConnectionStatus,
21
153
  useDatabase,
22
154
  useDownloadProgress,
23
155
  useEntitySyncStatus,
156
+ useFailedTransactions,
24
157
  useFailedTransactionsContext,
25
158
  useIsSyncing,
26
159
  useOnlineStatus,
@@ -36,24 +169,32 @@ import {
36
169
  useSyncModeContext,
37
170
  useSyncStatus,
38
171
  useUploadStatus
39
- } from "./chunk-KCDG2MNP.js";
172
+ } from "./chunk-YSTEESEG.js";
173
+ import "./chunk-T4AO7JIG.js";
174
+ import "./chunk-CAB26E6F.js";
40
175
  import {
41
- AttachmentQueue,
42
- AttachmentState,
43
- DEFAULT_CACHE_CONFIG,
44
- DEFAULT_COMPRESSION_CONFIG,
45
- DEFAULT_DOWNLOAD_CONFIG
46
- } from "./chunk-V6LJ6MR2.js";
47
- import "./chunk-5FIMA26D.js";
176
+ CacheSettingsManager,
177
+ DEFAULT_CACHE_SETTINGS,
178
+ createSupabaseStorage,
179
+ isBlobResult,
180
+ isFileResult
181
+ } from "./chunk-XOY2CJ67.js";
48
182
  import {
49
- DEFAULT_CONNECTION_HEALTH,
50
- DEFAULT_SYNC_CONFIG,
51
- DEFAULT_SYNC_METRICS,
52
- DEFAULT_SYNC_STATUS,
53
- HealthMonitor,
54
- MetricsCollector,
55
- SyncStatusTracker
56
- } from "./chunk-R4YFWQ3Q.js";
183
+ SupabaseStorageAdapter,
184
+ createSupabaseStorageAdapter,
185
+ getStorageErrorMessage,
186
+ isStorageAuthError,
187
+ normalizeStoragePath
188
+ } from "./chunk-XAEII4ZX.js";
189
+ import "./chunk-TGBT5XBE.js";
190
+ import {
191
+ SupabaseUploadHandler,
192
+ createSupabaseUploadHandler
193
+ } from "./chunk-P4HZA6ZT.js";
194
+ import {
195
+ DEFAULT_UPLOAD_NOTIFICATION,
196
+ resolveBucket
197
+ } from "./chunk-Z6VOBGTU.js";
57
198
  import "./chunk-W7HSR35B.js";
58
199
  import {
59
200
  ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
@@ -80,34 +221,41 @@ import {
80
221
  STATUS_NOTIFY_THROTTLE_MS,
81
222
  STORAGE_CRITICAL_THRESHOLD,
82
223
  STORAGE_KEY_ATTACHMENT_SETTINGS,
224
+ STORAGE_KEY_AUTO_OFFLINE,
83
225
  STORAGE_KEY_ENABLED,
84
226
  STORAGE_KEY_METRICS,
85
227
  STORAGE_KEY_PAUSED,
86
228
  STORAGE_KEY_PREFIX,
87
229
  STORAGE_KEY_SYNC_MODE,
88
230
  STORAGE_WARNING_THRESHOLD
89
- } from "./chunk-EJ23MXPQ.js";
90
- import "./chunk-VJCL2SWD.js";
231
+ } from "./chunk-CGL33PL4.js";
232
+ import "./chunk-WN5ZJ3E2.js";
91
233
  import {
92
- AbortError,
93
- DEFAULT_BACKOFF_CONFIG,
234
+ AuthRefreshError,
235
+ CircuitBreaker,
236
+ CircuitOpenError,
237
+ DEFAULT_CIRCUIT_BREAKER_CONFIG,
238
+ createSupabaseAuth
239
+ } from "./chunk-HWSNV45P.js";
240
+ import {
241
+ ConflictDetectionError,
94
242
  DEFAULT_RETRY_CONFIG,
95
- RetryExhaustedError,
96
243
  SupabaseConnector,
97
- addJitter,
98
- calculateBackoffDelay,
99
244
  defaultSchemaRouter,
100
245
  detectConflicts,
101
246
  fetchServerVersion,
102
247
  getLocalVersion,
103
- hasVersionColumn,
248
+ hasVersionColumn
249
+ } from "./chunk-KN2IZERF.js";
250
+ import {
251
+ AbortError,
252
+ DEFAULT_BACKOFF_CONFIG,
253
+ RetryExhaustedError,
254
+ addJitter,
255
+ calculateBackoffDelay,
104
256
  sleep,
105
257
  withExponentialBackoff
106
- } from "./chunk-62J2DPKX.js";
107
- import {
108
- FailedUploadStore,
109
- failedUploadStore
110
- } from "./chunk-PAFBKNL3.js";
258
+ } from "./chunk-FV2HXEIY.js";
111
259
  import {
112
260
  AttachmentError,
113
261
  ConfigurationError,
@@ -122,29 +270,41 @@ import {
122
270
  extractEntityIds,
123
271
  extractTableNames,
124
272
  generateFailureId,
273
+ isRlsError,
125
274
  toSyncOperationError
126
- } from "./chunk-FPTDATY5.js";
275
+ } from "./chunk-VACPAAQZ.js";
127
276
  export {
128
277
  ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
129
278
  ATTACHMENT_RETRY_DELAY_MS,
279
+ ATTACHMENT_TABLE,
130
280
  AbortError,
281
+ AbstractAttachmentQueue,
131
282
  AttachmentError,
132
- AttachmentQueue,
133
283
  AttachmentQueueContext,
134
284
  AttachmentState,
285
+ AttachmentTable,
286
+ AuthRefreshError,
287
+ CACHE_SIZE_PRESETS,
135
288
  COMPRESSION_MAX_WIDTH,
136
289
  COMPRESSION_SKIP_SIZE_BYTES,
137
290
  COMPRESSION_TARGET_SIZE_BYTES,
291
+ CacheSettingsManager,
292
+ CircuitBreaker,
293
+ CircuitOpenError,
138
294
  CompletedTransactionsContext,
139
295
  ConfigurationError,
140
296
  ConflictBus,
297
+ ConflictDetectionError,
141
298
  ConnectionHealthContext,
142
299
  ConnectionStatusContext,
143
300
  ConnectorError,
144
301
  DEFAULT_ATTACHMENT_CACHE_SIZE,
145
302
  DEFAULT_ATTACHMENT_CONCURRENCY,
303
+ DEFAULT_ATTACHMENT_QUEUE_OPTIONS,
146
304
  DEFAULT_BACKOFF_CONFIG,
147
305
  DEFAULT_CACHE_CONFIG,
306
+ DEFAULT_CACHE_SETTINGS,
307
+ DEFAULT_CIRCUIT_BREAKER_CONFIG,
148
308
  DEFAULT_COMPRESSION_CONFIG,
149
309
  DEFAULT_COMPRESSION_QUALITY,
150
310
  DEFAULT_CONNECTION_HEALTH,
@@ -159,63 +319,169 @@ export {
159
319
  DEFAULT_SYNC_METRICS,
160
320
  DEFAULT_SYNC_MODE,
161
321
  DEFAULT_SYNC_STATUS,
322
+ DEFAULT_UPLOAD_CONFIG,
323
+ DEFAULT_UPLOAD_NOTIFICATION,
162
324
  DOWNLOAD_STOP_THRESHOLD,
325
+ DOWNLOAD_WORKFLOW_STATES,
326
+ DeadLetterQueue,
163
327
  EVICTION_TRIGGER_THRESHOLD,
328
+ EncodingType,
164
329
  FailedTransactionsContext,
165
- FailedUploadStore,
166
330
  HEALTH_CHECK_INTERVAL_MS,
167
331
  HEALTH_CHECK_TIMEOUT_MS,
168
332
  HealthMonitor,
169
333
  InitializationError,
170
334
  LATENCY_DEGRADED_THRESHOLD_MS,
335
+ LOCALLY_AVAILABLE_STATES,
171
336
  MAX_CONSECUTIVE_FAILURES,
172
337
  MetricsCollector,
338
+ OfflineDataProvider,
339
+ PENDING_DOWNLOAD_STATES,
340
+ PROTECTED_UPLOAD_STATES,
173
341
  PendingMutationsContext,
174
342
  PlatformAdapterError,
343
+ PolAttachmentQueue,
344
+ PolAttachmentState,
345
+ PolStorageAdapter,
175
346
  PowerSyncContext,
176
347
  PowerSyncError,
348
+ PowerSyncErrorBoundary,
177
349
  PowerSyncProvider,
350
+ ProviderBridge,
178
351
  RetryExhaustedError,
352
+ STATE_MAPPING,
353
+ STATE_NAMES,
179
354
  STATS_CACHE_TTL_MS,
180
355
  STATUS_NOTIFY_THROTTLE_MS,
181
356
  STORAGE_CRITICAL_THRESHOLD,
182
357
  STORAGE_KEY_ATTACHMENT_SETTINGS,
358
+ STORAGE_KEY_AUTO_OFFLINE,
183
359
  STORAGE_KEY_ENABLED,
184
360
  STORAGE_KEY_METRICS,
185
361
  STORAGE_KEY_PAUSED,
186
362
  STORAGE_KEY_PREFIX,
187
363
  STORAGE_KEY_SYNC_MODE,
188
364
  STORAGE_WARNING_THRESHOLD,
365
+ SlimPowerSyncProvider,
189
366
  SupabaseConnector,
367
+ SupabaseStorageAdapter,
368
+ SupabaseUploadHandler,
190
369
  SyncActivityContext,
191
370
  SyncMetricsContext,
192
371
  SyncModeContext,
193
372
  SyncOperationError,
194
373
  SyncStatusContext,
195
374
  SyncStatusTracker,
375
+ TERMINAL_STATES,
376
+ UPLOAD_WORKFLOW_STATES,
377
+ VALID_STATES,
196
378
  addJitter,
379
+ blobToArrayBuffer,
380
+ buildIdOnlyWatchQuery,
381
+ buildRecordFetchQuery,
382
+ buildWatchQuery,
383
+ cacheLocalFile,
197
384
  calculateBackoffDelay,
385
+ checkIntegrityImpl,
386
+ checkStorageQuotaImpl,
198
387
  classifyError,
199
388
  classifySupabaseError,
389
+ clearCache,
390
+ clearUploadCallback,
391
+ compactDatabaseImpl,
392
+ copyToManagedCache,
393
+ createCacheManagerDeps,
394
+ createDeadLetterEntry,
395
+ createMigrationStats,
396
+ createPolAttachmentQueue,
397
+ createSupabaseAuth,
398
+ createSupabaseStorage,
399
+ createSupabaseStorageAdapter,
400
+ createSupabaseUploadHandler,
200
401
  createSyncError,
402
+ createUploadManagerDeps,
403
+ createUploadManagerState,
201
404
  defaultSchemaRouter,
405
+ defineBackgroundSyncTask,
202
406
  detectConflicts,
407
+ determineAttachmentState,
408
+ downloadRecord,
409
+ enforceCacheLimit,
410
+ ensureFileUri,
203
411
  extractEntityIds,
412
+ extractErrorCode,
204
413
  extractTableNames,
205
- failedUploadStore,
206
414
  fetchServerVersion,
415
+ formatBytes,
416
+ formatCacheSize,
417
+ formatMigrationStats,
418
+ generateDLQEntryId,
207
419
  generateFailureId,
420
+ getCacheStatsImpl,
421
+ getCachedSize,
422
+ getEvictionCandidates,
423
+ getExcludeProtectedStatesCondition,
424
+ getExtensionFromMimeType,
425
+ getFailedPermanentUploads,
426
+ getLocalUriForStoragePath,
208
427
  getLocalVersion,
428
+ getMimeType,
429
+ getMimeTypeFromPath,
430
+ getPendingUploads,
431
+ getProtectedStatesInClause,
432
+ getSoonestRetryTime,
433
+ getStaleUploads,
434
+ getStateName,
435
+ getStorageErrorMessage,
436
+ getSyncedUploadsWithPendingCallback,
209
437
  hasVersionColumn,
438
+ initializeBackgroundSync,
439
+ isAudioMimeType,
440
+ isBackgroundSyncRegistered,
441
+ isBlobResult,
442
+ isCacheNearCapacity,
443
+ isDocumentMimeType,
444
+ isDownloadWorkflowState,
445
+ isFileResult,
446
+ isImageMimeType,
447
+ isLocallyAvailable,
448
+ isPendingDownloadState,
449
+ isPermanentError,
450
+ isProtectedUploadState,
451
+ isRlsError,
452
+ isStateTransitionAllowed,
453
+ isStorageAuthError,
454
+ isTerminalState,
455
+ isUploadWorkflowState,
456
+ isValidAttachmentState,
457
+ isVideoMimeType,
458
+ markUploadPermanentFailure,
459
+ markUploadSynced,
460
+ migrateAttachmentState,
461
+ migrateAttachmentStateSafe,
462
+ normalizeStoragePath,
463
+ recordMigration,
464
+ registerBackgroundSync,
465
+ resolveBucket,
466
+ scheduleUploadRetry,
210
467
  sleep,
468
+ startUploadProcessing,
469
+ stripFileUri,
211
470
  toSyncOperationError,
471
+ unregisterBackgroundSync,
472
+ uploadOne,
212
473
  useAttachmentQueue,
474
+ useAttachmentQueueContext,
475
+ useAttachmentQueueReady,
476
+ useCompletedTransactions,
213
477
  useCompletedTransactionsContext,
214
478
  useConnectionHealth,
215
479
  useConnectionStatus,
216
480
  useDatabase,
481
+ useDatabaseMaintenance,
217
482
  useDownloadProgress,
218
483
  useEntitySyncStatus,
484
+ useFailedTransactions,
219
485
  useFailedTransactionsContext,
220
486
  useIsSyncing,
221
487
  useOnlineStatus,
@@ -223,6 +489,7 @@ export {
223
489
  usePendingMutationsContext,
224
490
  usePlatform,
225
491
  usePowerSync,
492
+ usePowerSyncContext,
226
493
  useSyncActivity,
227
494
  useSyncActivityContext,
228
495
  useSyncControl,
@@ -230,7 +497,12 @@ export {
230
497
  useSyncMode,
231
498
  useSyncModeContext,
232
499
  useSyncStatus,
500
+ useSyncStatusContext,
233
501
  useUploadStatus,
502
+ validateSqlIdentifier2 as validateSqlIdentifier,
503
+ validateSqlIdentifier as validateSqlIdentifierFromStateMachine,
504
+ validateWhereClause,
505
+ watchConfigToSourceConfig,
234
506
  withExponentialBackoff
235
507
  };
236
508
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,26 @@
1
- export { A as AbstractPowerSyncDatabase, k as CacheStats, i as ClassifiedError, j as CompactResult, h as CompletedTransaction, b as ConnectionHealth, o as CountRow, C as CrudEntry, l as CrudTransaction, n as DbStatRow, D as DownloadProgress, E as EntitySyncState, F as FailedTransaction, r as FreelistCountRow, s as IntegrityCheckRow, I as IntegrityResult, q as PageCountRow, p as PageSizeRow, P as PowerSyncBackendConnector, m as SqliteTableRow, c as StorageInfo, d as StorageQuota, f as SyncError, g as SyncErrorType, e as SyncMetrics, S as SyncMode, a as SyncStatus, T as TableCacheStats } from './types-afHtE1U_.js';
2
- export { ATTACHMENT_DOWNLOAD_TIMEOUT_MS, ATTACHMENT_RETRY_DELAY_MS, AttachmentError, COMPRESSION_MAX_WIDTH, COMPRESSION_SKIP_SIZE_BYTES, COMPRESSION_TARGET_SIZE_BYTES, ConfigurationError, ConnectorError, DEFAULT_ATTACHMENT_CACHE_SIZE, DEFAULT_ATTACHMENT_CONCURRENCY, DEFAULT_COMPRESSION_QUALITY, DEFAULT_MAX_RETRY_ATTEMPTS, DEFAULT_RETRY_BACKOFF_MULTIPLIER, DEFAULT_RETRY_BASE_DELAY_MS, DEFAULT_RETRY_MAX_DELAY_MS, DEFAULT_SYNC_INTERVAL_MS, DEFAULT_SYNC_MODE, DOWNLOAD_STOP_THRESHOLD, EVICTION_TRIGGER_THRESHOLD, HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, InitializationError, LATENCY_DEGRADED_THRESHOLD_MS, MAX_CONSECUTIVE_FAILURES, PlatformAdapterError, PowerSyncError, STATS_CACHE_TTL_MS, STATUS_NOTIFY_THROTTLE_MS, STORAGE_CRITICAL_THRESHOLD, STORAGE_KEY_ATTACHMENT_SETTINGS, STORAGE_KEY_ENABLED, STORAGE_KEY_METRICS, STORAGE_KEY_PAUSED, STORAGE_KEY_PREFIX, STORAGE_KEY_SYNC_MODE, STORAGE_WARNING_THRESHOLD, SyncOperationError, classifyError, classifySupabaseError, createSyncError, extractEntityIds, extractTableNames, generateFailureId, toSyncOperationError } from './core/index.js';
3
- export { f as ConflictBus, g as ConflictCheckResult, j as ConflictDetectionConfig, i as ConflictHandler, k as ConflictListener, h as ConflictResolution, C as ConnectorConfig, c as CrudHandler, D as DEFAULT_RETRY_CONFIG, F as FieldConflict, P as PowerSyncCredentials, l as ResolutionListener, e as RetryConfig, R as RetryStrategyConfig, b as SchemaRouter, S as SupabaseConnector, a as SupabaseConnectorOptions, d as defaultSchemaRouter } from './index-l3iL9Jte.js';
4
- export { AttachmentQueue, AttachmentQueueConfig, AttachmentRecord, AttachmentSourceConfig, AttachmentState, AttachmentStatsRow, AttachmentStorageAdapter, AttachmentSyncStats, AttachmentSyncStatus, CacheConfig, CacheFileRow, CachedSizeRow, CompressionConfig, DEFAULT_CACHE_CONFIG, DEFAULT_COMPRESSION_CONFIG, DEFAULT_DOWNLOAD_CONFIG, DownloadConfig, DownloadPhase, DownloadStatus, EvictRow, IdRow } from './attachments/index.js';
5
- export { e as HealthCheckResult, H as HealthMonitorOptions, M as MetricsCollectorOptions, P as PowerSyncRawStatus, c as SyncControlActions, f as SyncEvent, g as SyncEventListener, d as SyncOperationData, S as SyncScope, a as SyncStatusState, b as SyncStatusTrackerOptions, U as Unsubscribe } from './types-Cd7RhNqf.js';
6
- export { HealthMonitor, MetricsCollector, SyncStatusTracker } from './sync/index.js';
7
- export { F as FailedUpload, a as FailedUploadStore, f as failedUploadStore } from './failed-upload-store-C0cLxxPz.js';
8
- export { AbortError, BackoffConfig, BackoffOptions, DEFAULT_BACKOFF_CONFIG, RetryExhaustedError, addJitter, calculateBackoffDelay, detectConflicts, fetchServerVersion, getLocalVersion, hasVersionColumn, sleep, withExponentialBackoff } from './index.js';
9
- export { AttachmentQueueContext, CompletedTransactionsContext, CompletedTransactionsContextValue, ConnectionHealthContext, ConnectionHealthContextValue, ConnectionStatusContext, ConnectionStatusContextValue, DEFAULT_CONNECTION_HEALTH, DEFAULT_SYNC_CONFIG, DEFAULT_SYNC_METRICS, DEFAULT_SYNC_STATUS, EntitySyncStatusResult, FailedTransactionsContext, FailedTransactionsContextValue, PendingMutationsContext, PendingMutationsContextValue, PowerSyncConfig, PowerSyncContext, PowerSyncContextValue, PowerSyncProvider, PowerSyncProviderProps, SyncActivityContext, SyncActivityContextValue, SyncActivityResult, SyncConfig, SyncMetricsContext, SyncMetricsContextValue, SyncModeContext, SyncModeContextValue, SyncStatusContext, SyncStatusContextValue, UploadStatusResult, useAttachmentQueue, useCompletedTransactionsContext, useConnectionHealth, useConnectionStatus, useDatabase, useDownloadProgress, useEntitySyncStatus, useFailedTransactionsContext, useIsSyncing, useOnlineStatus, usePendingMutations, usePendingMutationsContext, usePlatform, usePowerSync, useSyncActivity, useSyncActivityContext, useSyncControl, useSyncMetrics, useSyncMode, useSyncModeContext, useSyncStatus, useUploadStatus } from './provider/index.js';
1
+ export { A as AbstractPowerSyncDatabase, k as CacheStats, i as ClassifiedError, j as CompactResult, h as CompletedTransaction, b as ConnectionHealth, o as CountRow, C as CrudEntry, l as CrudTransaction, n as DbStatRow, D as DownloadProgress, E as EntitySyncState, F as FailedTransaction, r as FreelistCountRow, s as IntegrityCheckRow, I as IntegrityResult, q as PageCountRow, p as PageSizeRow, P as PowerSyncBackendConnector, m as SqliteTableRow, c as StorageInfo, d as StorageQuota, f as SyncError, g as SyncErrorType, e as SyncMetrics, S as SyncMode, a as SyncStatus, T as TableCacheStats } from './types-CDqWh56B.js';
2
+ export { ATTACHMENT_DOWNLOAD_TIMEOUT_MS, ATTACHMENT_RETRY_DELAY_MS, AttachmentError, COMPRESSION_MAX_WIDTH, COMPRESSION_SKIP_SIZE_BYTES, COMPRESSION_TARGET_SIZE_BYTES, ConfigurationError, ConnectorError, DEFAULT_ATTACHMENT_CACHE_SIZE, DEFAULT_ATTACHMENT_CONCURRENCY, DEFAULT_COMPRESSION_QUALITY, DEFAULT_MAX_RETRY_ATTEMPTS, DEFAULT_RETRY_BACKOFF_MULTIPLIER, DEFAULT_RETRY_BASE_DELAY_MS, DEFAULT_RETRY_MAX_DELAY_MS, DEFAULT_SYNC_INTERVAL_MS, DEFAULT_SYNC_MODE, DOWNLOAD_STOP_THRESHOLD, EVICTION_TRIGGER_THRESHOLD, HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, InitializationError, LATENCY_DEGRADED_THRESHOLD_MS, MAX_CONSECUTIVE_FAILURES, PlatformAdapterError, PowerSyncError, STATS_CACHE_TTL_MS, STATUS_NOTIFY_THROTTLE_MS, STORAGE_CRITICAL_THRESHOLD, STORAGE_KEY_ATTACHMENT_SETTINGS, STORAGE_KEY_AUTO_OFFLINE, STORAGE_KEY_ENABLED, STORAGE_KEY_METRICS, STORAGE_KEY_PAUSED, STORAGE_KEY_PREFIX, STORAGE_KEY_SYNC_MODE, STORAGE_WARNING_THRESHOLD, SyncOperationError, classifyError, classifySupabaseError, createSyncError, extractEntityIds, extractTableNames, generateFailureId, isRlsError, toSyncOperationError } from './core/index.js';
3
+ export { A as AuthProvider, g as ConflictBus, h as ConflictCheckResult, k as ConflictDetectionConfig, j as ConflictHandler, l as ConflictListener, i as ConflictResolution, C as ConnectorCircuitBreakerConfig, a as ConnectorConfig, c as CrudHandler, D as DEFAULT_RETRY_CONFIG, F as FieldConflict, P as PowerSyncCredentials, m as ResolutionListener, e as RetryConfig, R as RetryStrategyConfig, b as SchemaRouter, f as Session, S as SupabaseConnectorOptions, d as defaultSchemaRouter } from './types-B212hgfA.js';
4
+ export { S as SupabaseConnector } from './supabase-connector-T9vHq_3i.js';
5
+ export { AuthRefreshError, CircuitBreaker, CircuitBreakerConfig, CircuitBreakerStats, CircuitOpenError, CircuitState, DEFAULT_CIRCUIT_BREAKER_CONFIG, SupabaseAuthOptions, createSupabaseAuth } from './connector/index.js';
6
+ export { e as AttachmentConfig, z as AttachmentRecord, A as AttachmentSourceConfig, w as AttachmentStatsRow, f as AttachmentStorageAdapter, v as AttachmentSyncStats, u as AttachmentSyncStatus, B as BatchFilterContext, m as CACHE_SIZE_PRESETS, k as CacheConfig, x as CacheFileRow, n as CacheSizePreset, o as CacheSizeValue, y as CachedSizeRow, C as CompressionConfig, l as DEFAULT_CACHE_CONFIG, D as DEFAULT_COMPRESSION_CONFIG, j as DEFAULT_DOWNLOAD_CONFIG, g as DEFAULT_UPLOAD_CONFIG, i as DownloadConfig, q as DownloadPhase, r as DownloadStatus, E as EvictRow, I as IdRow, P as PolAttachmentQueue, a as PolAttachmentQueueOptions, d as PolAttachmentRecord, b as PolAttachmentState, S as SkipDownloadContext, U as UploadConfig, h as UploadHandler, s as UploadPhase, t as UploadStatus, W as WatchConfig, c as createPolAttachmentQueue, p as formatCacheSize } from './pol-attachment-queue-BVAIueoP.js';
7
+ export { CacheManagerDeps, DOWNLOAD_WORKFLOW_STATES, DownloadManagerDeps, LOCALLY_AVAILABLE_STATES, MigrationStats, PENDING_DOWNLOAD_STATES, PROTECTED_UPLOAD_STATES, PolStorageAdapter, PolStorageAdapterOptions, STATE_MAPPING, STATE_NAMES, TERMINAL_STATES, UPLOAD_WORKFLOW_STATES, UploadManagerDeps, UploadManagerState, VALID_STATES, blobToArrayBuffer, buildIdOnlyWatchQuery, buildRecordFetchQuery, buildWatchQuery, cacheLocalFile, clearCache, clearUploadCallback, copyToManagedCache, createCacheManagerDeps, createMigrationStats, createUploadManagerDeps, createUploadManagerState, determineAttachmentState, downloadRecord, enforceCacheLimit, ensureFileUri, extractErrorCode, formatMigrationStats, getCachedSize, getEvictionCandidates, getExcludeProtectedStatesCondition, getFailedPermanentUploads, getLocalUriForStoragePath, getPendingUploads, getProtectedStatesInClause, getSoonestRetryTime, getStaleUploads, getStateName, getSyncedUploadsWithPendingCallback, isCacheNearCapacity, isDownloadWorkflowState, isLocallyAvailable, isPendingDownloadState, isPermanentError, isProtectedUploadState, isStateTransitionAllowed, isTerminalState, isUploadWorkflowState, isValidAttachmentState, markUploadPermanentFailure, markUploadSynced, migrateAttachmentState, migrateAttachmentStateSafe, recordMigration, scheduleUploadRetry, startUploadProcessing, stripFileUri, uploadOne, validateSqlIdentifier, validateSqlIdentifierFromStateMachine, validateWhereClause, watchConfigToSourceConfig } from './attachments/index.js';
8
+ export { B as BackgroundSyncOptions, h as BackgroundSyncSystem, e as HealthCheckResult, H as HealthMonitorOptions, M as MetricsCollectorOptions, P as PowerSyncRawStatus, c as SyncControlActions, f as SyncEvent, g as SyncEventListener, d as SyncOperationData, S as SyncScope, a as SyncStatusState, b as SyncStatusTrackerOptions, U as Unsubscribe, i as defineBackgroundSyncTask, j as initializeBackgroundSync, k as isBackgroundSyncRegistered, r as registerBackgroundSync, u as unregisterBackgroundSync } from './background-sync-ChCXW-EV.js';
9
+ export { DeadLetterEntry, DeadLetterQueue, DeadLetterQueueListener, DeadLetterQueueOptions, DeadLetterReason, HealthMonitor, MetricsCollector, SyncStatusTracker, createDeadLetterEntry, generateDLQEntryId } from './sync/index.js';
10
+ export { AbortError, BackoffConfig, BackoffOptions, ConflictDetectionError, DEFAULT_BACKOFF_CONFIG, RetryExhaustedError, addJitter, calculateBackoffDelay, detectConflicts, fetchServerVersion, formatBytes, getExtensionFromMimeType, getLocalVersion, getMimeType, getMimeTypeFromPath, hasVersionColumn, isAudioMimeType, isDocumentMimeType, isImageMimeType, isVideoMimeType, sleep, withExponentialBackoff } from './index.js';
11
+ export { DatabaseMaintenanceUtils, checkIntegrityImpl, checkStorageQuotaImpl, compactDatabaseImpl, getCacheStatsImpl, useDatabaseMaintenance } from './maintenance/index.js';
12
+ export { D as DownloadResult, a as StorageBackend, b as StorageUploadOptions, d as SupabaseClient, S as SupabaseStorage, c as SupabaseStorageOptions, e as SupabaseTransformOptions, U as UploadProgress, r as resolveBucket } from './types-D0WcHrq6.js';
13
+ export { f as CacheSettings, C as CacheSettingsManager, h as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, I as ImageTransformOptions, S as SupabaseStorageAdapter, e as SupabaseStorageAdapterOptions, c as createSupabaseStorage, d as createSupabaseStorageAdapter, g as getStorageErrorMessage, a as isBlobResult, i as isFileResult, b as isStorageAuthError, n as normalizeStoragePath } from './CacheSettingsManager-uz-kbnRH.js';
14
+ export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from './types-CyvBaAl8.js';
15
+ export { SupabaseUploadHandler, createSupabaseUploadHandler } from './storage/upload/index.js';
16
+ export { PowerSyncErrorBoundary } from './error/index.js';
17
+ export { AttachmentQueueContext, BackgroundSyncCallbacks, BackgroundSyncConfig, BackgroundSyncStatus, CompletedTransactionsContext, CompletedTransactionsContextValue, ConnectionHealthContext, ConnectionHealthContextValue, ConnectionStatusContext, ConnectionStatusContextValue, DEFAULT_CONNECTION_HEALTH, DEFAULT_SYNC_CONFIG, DEFAULT_SYNC_METRICS, DEFAULT_SYNC_STATUS, DataLayerConfig, DataLayerIntegration, EntitySyncStatusResult, FailedTransactionsContext, FailedTransactionsContextValue, OfflineDataAttachmentConfig, OfflineDataProvider, OfflineDataProviderConfig, OfflineDataProviderProps, PendingMutationsContext, PendingMutationsContextValue, PowerSyncConfig, PowerSyncContext, PowerSyncContextValue, PowerSyncProvider, PowerSyncProviderProps, PowerSyncSyncStatusSnapshot, ProviderBridge, ProviderBridgeProps, SyncActivityContext, SyncActivityContextValue, SyncActivityResult, SyncConfig, SyncMetricsContext, SyncMetricsContextValue, SyncModeContext, SyncModeContextValue, SyncStatusContext, SyncStatusContextValue, UploadStatusResult, useAttachmentQueue, useAttachmentQueueReady, useCompletedTransactions, useCompletedTransactionsContext, useConnectionHealth, useConnectionStatus, useDatabase, useDownloadProgress, useEntitySyncStatus, useFailedTransactions, useFailedTransactionsContext, useIsSyncing, useOnlineStatus, usePendingMutations, usePendingMutationsContext, usePlatform, usePowerSync, useSyncActivity, useSyncActivityContext, useSyncControl, useSyncMetrics, useSyncMode, useSyncModeContext, useSyncStatus, useUploadStatus } from './provider/index.js';
18
+ export { AttachmentQueueContextValue, SlimPowerSyncProvider, useAttachmentQueueContext, usePowerSyncContext, useSyncStatusContext } from './react/index.js';
10
19
  export { AsyncStorageAdapter, CompressedImage, CompressionOptions, ConnectionType, DatabaseOptions, FileInfo, FileSystemAdapter, ImageProcessorAdapter, LoggerAdapter, NetworkAdapter, PlatformAdapter, PlatformType, detectPlatform } from './platform/index.js';
11
20
  export { createNativePlatformAdapter } from './platform/index.native.js';
21
+ export { ATTACHMENT_TABLE, AbstractAttachmentQueue, AttachmentState, AttachmentTable, AttachmentTableOptions, AttachmentQueueOptions as BaseAttachmentQueueOptions, DEFAULT_ATTACHMENT_QUEUE_OPTIONS, EncodingType, AttachmentRecord as OfficialAttachmentRecord, StorageAdapter } from '@powersync/attachments';
22
+ export { AbstractPowerSyncDatabase as PowerSyncDBInterface } from '@powersync/common';
12
23
  import '@supabase/supabase-js';
13
- import '@tanstack/react-query';
14
24
  import 'react';
25
+ import '@tanstack/react-query';
26
+ import '@powersync/react-native';