@pol-studios/powersync 1.0.30 → 1.0.33

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 (116) hide show
  1. package/dist/{CacheSettingsManager-uz-kbnRH.d.ts → CacheSettingsManager-0H_7thHW.d.ts} +21 -3
  2. package/dist/attachments/index.d.ts +30 -30
  3. package/dist/attachments/index.js +13 -4
  4. package/dist/{background-sync-CVR3PkFi.d.ts → background-sync-BujnI3IR.d.ts} +1 -1
  5. package/dist/{chunk-RE5HWLCB.js → chunk-2RDWLXJW.js} +322 -103
  6. package/dist/chunk-2RDWLXJW.js.map +1 -0
  7. package/dist/{chunk-P4HZA6ZT.js → chunk-4665ZSE5.js} +2 -2
  8. package/dist/chunk-4665ZSE5.js.map +1 -0
  9. package/dist/{chunk-XOY2CJ67.js → chunk-4F5B5CZ7.js} +3 -3
  10. package/dist/chunk-5WRI5ZAA.js +31 -0
  11. package/dist/{chunk-BC2SRII2.js → chunk-65A3SYJZ.js} +14 -1
  12. package/dist/chunk-65A3SYJZ.js.map +1 -0
  13. package/dist/chunk-6SZ64KCZ.js +755 -0
  14. package/dist/chunk-6SZ64KCZ.js.map +1 -0
  15. package/dist/{chunk-C2ACBYBZ.js → chunk-74TBHWJ4.js} +10 -96
  16. package/dist/{chunk-C2ACBYBZ.js.map → chunk-74TBHWJ4.js.map} +1 -1
  17. package/dist/chunk-ANXWYQEJ.js +1 -0
  18. package/dist/chunk-ANXWYQEJ.js.map +1 -0
  19. package/dist/{chunk-CAB26E6F.js → chunk-C4J4MLER.js} +29 -24
  20. package/dist/chunk-C4J4MLER.js.map +1 -0
  21. package/dist/{chunk-C5ODS3XH.js → chunk-EOW7JK7Q.js} +9 -16
  22. package/dist/chunk-EOW7JK7Q.js.map +1 -0
  23. package/dist/chunk-HRAVPIAZ.js +220 -0
  24. package/dist/chunk-HRAVPIAZ.js.map +1 -0
  25. package/dist/{chunk-XAEII4ZX.js → chunk-NUGQOTEM.js} +32 -4
  26. package/dist/chunk-NUGQOTEM.js.map +1 -0
  27. package/dist/chunk-OGUFUZSY.js +5415 -0
  28. package/dist/chunk-OGUFUZSY.js.map +1 -0
  29. package/dist/{chunk-JCGOZVWL.js → chunk-P4D6BQ4X.js} +115 -576
  30. package/dist/chunk-P4D6BQ4X.js.map +1 -0
  31. package/dist/{chunk-CACKC6XG.js → chunk-PGEDE6IM.js} +136 -89
  32. package/dist/chunk-PGEDE6IM.js.map +1 -0
  33. package/dist/{chunk-A4IBBWGO.js → chunk-RALHHPTU.js} +1 -1
  34. package/dist/chunk-RIDSPLE5.js +42 -0
  35. package/dist/chunk-RIDSPLE5.js.map +1 -0
  36. package/dist/{chunk-Z6VOBGTU.js → chunk-UOMHWUHV.js} +2 -12
  37. package/dist/chunk-UOMHWUHV.js.map +1 -0
  38. package/dist/{chunk-QREWE3NR.js → chunk-YONQYTVH.js} +2 -2
  39. package/dist/chunk-ZAN22NGL.js +13 -0
  40. package/dist/chunk-ZAN22NGL.js.map +1 -0
  41. package/dist/config/index.d.ts +200 -0
  42. package/dist/config/index.js +23 -0
  43. package/dist/config/index.js.map +1 -0
  44. package/dist/connector/index.d.ts +23 -5
  45. package/dist/connector/index.js +4 -1
  46. package/dist/core/index.d.ts +2 -2
  47. package/dist/core/index.js +1 -0
  48. package/dist/error/index.js +1 -0
  49. package/dist/generator/index.js +2 -0
  50. package/dist/generator/index.js.map +1 -1
  51. package/dist/index.d.ts +19 -16
  52. package/dist/index.js +68 -36
  53. package/dist/index.native.d.ts +18 -14
  54. package/dist/index.native.js +73 -34
  55. package/dist/index.web.d.ts +17 -14
  56. package/dist/index.web.js +68 -36
  57. package/dist/maintenance/index.d.ts +2 -2
  58. package/dist/maintenance/index.js +3 -2
  59. package/dist/platform/index.d.ts +1 -1
  60. package/dist/platform/index.js +2 -0
  61. package/dist/platform/index.js.map +1 -1
  62. package/dist/platform/index.native.d.ts +1 -1
  63. package/dist/platform/index.native.js +1 -0
  64. package/dist/platform/index.web.d.ts +1 -1
  65. package/dist/platform/index.web.js +1 -0
  66. package/dist/pol-attachment-queue-DqBvLAEY.d.ts +255 -0
  67. package/dist/provider/index.d.ts +149 -114
  68. package/dist/provider/index.js +9 -14
  69. package/dist/provider/index.native.d.ts +108 -0
  70. package/dist/provider/index.native.js +121 -0
  71. package/dist/provider/index.native.js.map +1 -0
  72. package/dist/provider/index.web.d.ts +16 -0
  73. package/dist/provider/index.web.js +112 -0
  74. package/dist/provider/index.web.js.map +1 -0
  75. package/dist/react/index.d.ts +16 -65
  76. package/dist/react/index.js +2 -9
  77. package/dist/storage/index.d.ts +5 -4
  78. package/dist/storage/index.js +12 -9
  79. package/dist/storage/index.native.d.ts +5 -4
  80. package/dist/storage/index.native.js +8 -5
  81. package/dist/storage/index.web.d.ts +5 -4
  82. package/dist/storage/index.web.js +11 -8
  83. package/dist/storage/upload/index.d.ts +4 -3
  84. package/dist/storage/upload/index.js +4 -2
  85. package/dist/storage/upload/index.native.d.ts +4 -3
  86. package/dist/storage/upload/index.native.js +4 -2
  87. package/dist/storage/upload/index.web.d.ts +2 -1
  88. package/dist/storage/upload/index.web.js +4 -2
  89. package/dist/{supabase-connector-C4YpH_l3.d.ts → supabase-connector-HMxBA9Kg.d.ts} +2 -2
  90. package/dist/sync/index.d.ts +155 -20
  91. package/dist/sync/index.js +13 -3
  92. package/dist/{types-CyvBaAl8.d.ts → types-6QHGELuY.d.ts} +4 -1
  93. package/dist/{types-Dv1uf0LZ.d.ts → types-B9MptP7E.d.ts} +7 -10
  94. package/dist/types-BhAEsJj-.d.ts +330 -0
  95. package/dist/{types-D0WcHrq6.d.ts → types-CGMibJKD.d.ts} +8 -0
  96. package/dist/{types-CpM2_LhU.d.ts → types-DqJnP50o.d.ts} +6 -1
  97. package/dist/{pol-attachment-queue-BE2HU3Us.d.ts → types-JCEhw2Lf.d.ts} +139 -346
  98. package/package.json +18 -4
  99. package/dist/chunk-654ERHA7.js +0 -1
  100. package/dist/chunk-BC2SRII2.js.map +0 -1
  101. package/dist/chunk-C5ODS3XH.js.map +0 -1
  102. package/dist/chunk-CAB26E6F.js.map +0 -1
  103. package/dist/chunk-CACKC6XG.js.map +0 -1
  104. package/dist/chunk-FNYQFILT.js +0 -44
  105. package/dist/chunk-FNYQFILT.js.map +0 -1
  106. package/dist/chunk-JCGOZVWL.js.map +0 -1
  107. package/dist/chunk-P4HZA6ZT.js.map +0 -1
  108. package/dist/chunk-RBPWEOIV.js +0 -358
  109. package/dist/chunk-RBPWEOIV.js.map +0 -1
  110. package/dist/chunk-RE5HWLCB.js.map +0 -1
  111. package/dist/chunk-XAEII4ZX.js.map +0 -1
  112. package/dist/chunk-Z6VOBGTU.js.map +0 -1
  113. /package/dist/{chunk-XOY2CJ67.js.map → chunk-4F5B5CZ7.js.map} +0 -0
  114. /package/dist/{chunk-654ERHA7.js.map → chunk-5WRI5ZAA.js.map} +0 -0
  115. /package/dist/{chunk-A4IBBWGO.js.map → chunk-RALHHPTU.js.map} +0 -0
  116. /package/dist/{chunk-QREWE3NR.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-RBPWEOIV.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,19 +39,17 @@ import {
30
39
  validateSqlIdentifier as validateSqlIdentifier2,
31
40
  validateWhereClause,
32
41
  watchConfigToSourceConfig
33
- } from "./chunk-C5ODS3XH.js";
42
+ } from "./chunk-EOW7JK7Q.js";
43
+ import {
44
+ PowerSyncErrorBoundary
45
+ } from "./chunk-P6WOZO7H.js";
34
46
  import {
35
47
  ConflictBus,
36
- OfflineDataProvider,
37
48
  PowerSyncProvider,
38
49
  ProviderBridge,
39
50
  UPLOAD_BACKOFF_DELAYS,
40
51
  UPLOAD_MAX_RETRIES
41
- } from "./chunk-JCGOZVWL.js";
42
- import "./chunk-YHTZ7VMV.js";
43
- import {
44
- PowerSyncErrorBoundary
45
- } from "./chunk-P6WOZO7H.js";
52
+ } from "./chunk-P4D6BQ4X.js";
46
53
  import {
47
54
  ATTACHMENT_TABLE,
48
55
  AbstractAttachmentQueue,
@@ -77,6 +84,7 @@ import {
77
84
  extractErrorCode,
78
85
  formatCacheSize,
79
86
  getCachedSize,
87
+ getCustomUrlResolver,
80
88
  getEvictionCandidates,
81
89
  getExcludeProtectedStatesCondition,
82
90
  getExtensionFromMimeType,
@@ -91,22 +99,25 @@ import {
91
99
  getSyncedUploadsWithPendingCallback,
92
100
  isAudioMimeType,
93
101
  isCacheNearCapacity,
102
+ isCustomSource,
94
103
  isDocumentMimeType,
95
104
  isImageMimeType,
96
105
  isLocallyAvailable,
97
106
  isPendingDownloadState,
98
107
  isPermanentError,
99
108
  isProtectedUploadState,
109
+ isSignedUrlSource,
100
110
  isStateTransitionAllowed,
101
111
  isVideoMimeType,
102
112
  markUploadPermanentFailure,
103
113
  markUploadSynced,
114
+ resolveBucketFromConfig,
104
115
  scheduleUploadRetry,
105
116
  startUploadProcessing,
106
117
  stripFileUri,
107
118
  uploadOne,
108
119
  validateSqlIdentifier
109
- } from "./chunk-CACKC6XG.js";
120
+ } from "./chunk-PGEDE6IM.js";
110
121
  import {
111
122
  DeadLetterQueue,
112
123
  createDeadLetterEntry,
@@ -116,18 +127,22 @@ import {
116
127
  isBackgroundSyncRegistered,
117
128
  registerBackgroundSync,
118
129
  unregisterBackgroundSync
119
- } from "./chunk-A4IBBWGO.js";
130
+ } from "./chunk-RALHHPTU.js";
120
131
  import {
132
+ DEFAULT_CONNECTION_HEALTH,
133
+ DEFAULT_SYNC_CONFIG,
134
+ DEFAULT_SYNC_METRICS,
135
+ DEFAULT_SYNC_STATUS,
121
136
  HealthMonitor,
122
137
  MetricsCollector,
123
138
  SyncStatusTracker
124
- } from "./chunk-RE5HWLCB.js";
139
+ } from "./chunk-2RDWLXJW.js";
125
140
  import {
126
- DEFAULT_CONNECTION_HEALTH,
127
- DEFAULT_SYNC_CONFIG,
128
- DEFAULT_SYNC_METRICS,
129
- DEFAULT_SYNC_STATUS
130
- } from "./chunk-FNYQFILT.js";
141
+ CompletedTransactionsTable,
142
+ FailedTransactionsTable,
143
+ LOCAL_ONLY_TABLES,
144
+ LOCAL_TABLE_NAMES
145
+ } from "./chunk-OGUFUZSY.js";
131
146
  import {
132
147
  checkIntegrityImpl,
133
148
  checkStorageQuotaImpl,
@@ -135,7 +150,7 @@ import {
135
150
  formatBytes,
136
151
  getCacheStatsImpl,
137
152
  useDatabaseMaintenance
138
- } from "./chunk-QREWE3NR.js";
153
+ } from "./chunk-YONQYTVH.js";
139
154
  import {
140
155
  AttachmentQueueContext,
141
156
  CompletedTransactionsContext,
@@ -176,32 +191,33 @@ import {
176
191
  useUploadBlockedReason,
177
192
  useUploadRetry,
178
193
  useUploadStatus
179
- } from "./chunk-C2ACBYBZ.js";
194
+ } from "./chunk-74TBHWJ4.js";
180
195
  import "./chunk-T4AO7JIG.js";
181
- import "./chunk-CAB26E6F.js";
196
+ import "./chunk-TGBT5XBE.js";
197
+ import {
198
+ SupabaseUploadHandler,
199
+ createSupabaseUploadHandler
200
+ } from "./chunk-4665ZSE5.js";
182
201
  import {
183
202
  CacheSettingsManager,
184
203
  DEFAULT_CACHE_SETTINGS,
185
204
  createSupabaseStorage,
186
205
  isBlobResult,
187
206
  isFileResult
188
- } from "./chunk-XOY2CJ67.js";
207
+ } from "./chunk-4F5B5CZ7.js";
208
+ import {
209
+ DEFAULT_UPLOAD_NOTIFICATION
210
+ } from "./chunk-ZAN22NGL.js";
189
211
  import {
190
212
  SupabaseStorageAdapter,
191
213
  createSupabaseStorageAdapter,
192
214
  getStorageErrorMessage,
193
215
  isStorageAuthError,
194
216
  normalizeStoragePath
195
- } from "./chunk-XAEII4ZX.js";
196
- import "./chunk-TGBT5XBE.js";
197
- import {
198
- SupabaseUploadHandler,
199
- createSupabaseUploadHandler
200
- } from "./chunk-P4HZA6ZT.js";
217
+ } from "./chunk-NUGQOTEM.js";
201
218
  import {
202
- DEFAULT_UPLOAD_NOTIFICATION,
203
219
  resolveBucket
204
- } from "./chunk-Z6VOBGTU.js";
220
+ } from "./chunk-UOMHWUHV.js";
205
221
  import {
206
222
  AbortError,
207
223
  DEFAULT_BACKOFF_CONFIG,
@@ -245,7 +261,6 @@ import {
245
261
  STORAGE_KEY_SYNC_MODE,
246
262
  STORAGE_WARNING_THRESHOLD
247
263
  } from "./chunk-CGL33PL4.js";
248
- import "./chunk-WN5ZJ3E2.js";
249
264
  import {
250
265
  createWebPlatformAdapter
251
266
  } from "./chunk-N75DEF5J.js";
@@ -266,6 +281,7 @@ import {
266
281
  detectConflicts,
267
282
  discardOnHttpStatus,
268
283
  discardOnPgCodes,
284
+ discardOnRlsDenied,
269
285
  discardOrphaned,
270
286
  fetchServerVersion,
271
287
  getLocalVersion,
@@ -276,7 +292,7 @@ import {
276
292
  runUploadErrorMiddlewareSync,
277
293
  successOnPgCodes,
278
294
  tableHandlers
279
- } from "./chunk-BC2SRII2.js";
295
+ } from "./chunk-65A3SYJZ.js";
280
296
  import {
281
297
  AttachmentError,
282
298
  ConfigurationError,
@@ -295,6 +311,7 @@ import {
295
311
  isRlsError,
296
312
  toSyncOperationError
297
313
  } from "./chunk-I2AYMY5O.js";
314
+ import "./chunk-5WRI5ZAA.js";
298
315
  export {
299
316
  ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
300
317
  ATTACHMENT_RETRY_DELAY_MS,
@@ -314,6 +331,7 @@ export {
314
331
  CircuitBreaker,
315
332
  CircuitOpenError,
316
333
  CompletedTransactionsContext,
334
+ CompletedTransactionsTable,
317
335
  ConfigurationError,
318
336
  ConflictBus,
319
337
  ConflictDetectionError,
@@ -350,15 +368,17 @@ export {
350
368
  EVICTION_TRIGGER_THRESHOLD,
351
369
  EncodingType,
352
370
  FailedTransactionsContext,
371
+ FailedTransactionsTable,
353
372
  HEALTH_CHECK_INTERVAL_MS,
354
373
  HEALTH_CHECK_TIMEOUT_MS,
355
374
  HealthMonitor,
356
375
  InitializationError,
357
376
  LATENCY_DEGRADED_THRESHOLD_MS,
358
377
  LOCALLY_AVAILABLE_STATES,
378
+ LOCAL_ONLY_TABLES,
379
+ LOCAL_TABLE_NAMES,
359
380
  MAX_CONSECUTIVE_FAILURES,
360
381
  MetricsCollector,
361
- OfflineDataProvider,
362
382
  PENDING_DOWNLOAD_STATES,
363
383
  PROTECTED_UPLOAD_STATES,
364
384
  PendingMutationsContext,
@@ -385,7 +405,6 @@ export {
385
405
  STORAGE_KEY_PREFIX,
386
406
  STORAGE_KEY_SYNC_MODE,
387
407
  STORAGE_WARNING_THRESHOLD,
388
- SlimPowerSyncProvider,
389
408
  SupabaseConnector,
390
409
  SupabaseStorageAdapter,
391
410
  SupabaseUploadHandler,
@@ -420,6 +439,7 @@ export {
420
439
  createDeadLetterEntry,
421
440
  createMigrationStats,
422
441
  createPolAttachmentQueue,
442
+ createSchemaRouter,
423
443
  createSupabaseAuth,
424
444
  createSupabaseStorage,
425
445
  createSupabaseStorageAdapter,
@@ -427,14 +447,16 @@ export {
427
447
  createSyncError,
428
448
  createUploadManagerDeps,
429
449
  createUploadManagerState,
430
- createWatchIds,
450
+ createWatchPaths,
431
451
  createWebPlatformAdapter,
432
452
  defaultSchemaRouter,
433
453
  defineBackgroundSyncTask,
454
+ definePolConfig,
434
455
  detectConflicts,
435
456
  determineAttachmentState,
436
457
  discardOnHttpStatus,
437
458
  discardOnPgCodes,
459
+ discardOnRlsDenied,
438
460
  discardOrphaned,
439
461
  downloadRecord,
440
462
  enforceCacheLimit,
@@ -450,8 +472,10 @@ export {
450
472
  formatMigrationStats,
451
473
  generateDLQEntryId,
452
474
  generateFailureId,
475
+ generatePowerSyncSchema,
453
476
  getCacheStatsImpl,
454
477
  getCachedSize,
478
+ getCustomUrlResolver,
455
479
  getEvictionCandidates,
456
480
  getExcludeProtectedStatesCondition,
457
481
  getExtensionFromMimeType,
@@ -467,6 +491,8 @@ export {
467
491
  getStateName,
468
492
  getStorageErrorMessage,
469
493
  getSyncedUploadsWithPendingCallback,
494
+ getTableFromSchema,
495
+ getTableStrategy,
470
496
  hasVersionColumn,
471
497
  idempotentTables,
472
498
  initializeBackgroundSync,
@@ -474,6 +500,7 @@ export {
474
500
  isBackgroundSyncRegistered,
475
501
  isBlobResult,
476
502
  isCacheNearCapacity,
503
+ isCustomSource,
477
504
  isDocumentMimeType,
478
505
  isDownloadWorkflowState,
479
506
  isFileResult,
@@ -481,10 +508,13 @@ export {
481
508
  isLocallyAvailable,
482
509
  isPendingDownloadState,
483
510
  isPermanentError,
511
+ isProcessedPolConfig,
484
512
  isProtectedUploadState,
485
513
  isRlsError,
514
+ isSignedUrlSource,
486
515
  isStateTransitionAllowed,
487
516
  isStorageAuthError,
517
+ isTablePowerSync,
488
518
  isTerminalState,
489
519
  isUploadWorkflowState,
490
520
  isValidAttachmentState,
@@ -494,9 +524,11 @@ export {
494
524
  migrateAttachmentState,
495
525
  migrateAttachmentStateSafe,
496
526
  normalizeStoragePath,
527
+ normalizeTableSpec,
497
528
  recordMigration,
498
529
  registerBackgroundSync,
499
530
  resolveBucket,
531
+ resolveBucketFromConfig,
500
532
  retryOnHttpStatus,
501
533
  runUploadErrorMiddleware,
502
534
  runUploadErrorMiddlewareSync,
@@ -1,5 +1,5 @@
1
- import { k as CacheStats, j as CompactResult, I as IntegrityResult, d as StorageQuota, A as AbstractPowerSyncDatabase } from '../types-Dv1uf0LZ.js';
2
- export { c as StorageInfo } from '../types-Dv1uf0LZ.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-QREWE3NR.js";
8
- import "../chunk-C2ACBYBZ.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-Dv1uf0LZ.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-Dv1uf0LZ.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-Dv1uf0LZ.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
  };