@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
@@ -1,5 +1,6 @@
1
- import { S as SupabaseUploadHandlerOptions, B as BucketConfig } from '../../types-CyvBaAl8.js';
2
- export { D as DEFAULT_UPLOAD_NOTIFICATION, U as UploadEventHandlers, a as UploadNotificationConfig } from '../../types-CyvBaAl8.js';
1
+ import { S as SupabaseUploadHandlerOptions, B as BucketConfig } from '../../types-6QHGELuY.js';
2
+ export { D as DEFAULT_UPLOAD_NOTIFICATION, U as UploadEventHandlers, a as UploadNotificationConfig } from '../../types-6QHGELuY.js';
3
+ import { SupabaseClient } from '@supabase/supabase-js';
3
4
 
4
5
  /**
5
6
  * Supabase Upload Handler for Web
@@ -49,6 +50,6 @@ declare class SupabaseUploadHandler {
49
50
  /**
50
51
  * Factory function for creating a SupabaseUploadHandler.
51
52
  */
52
- declare function createSupabaseUploadHandler(supabaseClient: any, bucketConfig: BucketConfig): SupabaseUploadHandler;
53
+ declare function createSupabaseUploadHandler(supabaseClient: SupabaseClient, bucketConfig: BucketConfig): SupabaseUploadHandler;
53
54
 
54
55
  export { BucketConfig, SupabaseUploadHandler, SupabaseUploadHandlerOptions, createSupabaseUploadHandler };
@@ -2,11 +2,13 @@ import "../../chunk-TGBT5XBE.js";
2
2
  import {
3
3
  SupabaseUploadHandler,
4
4
  createSupabaseUploadHandler
5
- } from "../../chunk-P4HZA6ZT.js";
5
+ } from "../../chunk-4665ZSE5.js";
6
6
  import {
7
7
  DEFAULT_UPLOAD_NOTIFICATION
8
- } from "../../chunk-Z6VOBGTU.js";
8
+ } from "../../chunk-ZAN22NGL.js";
9
+ import "../../chunk-UOMHWUHV.js";
9
10
  import "../../chunk-FV2HXEIY.js";
11
+ import "../../chunk-5WRI5ZAA.js";
10
12
  export {
11
13
  DEFAULT_UPLOAD_NOTIFICATION,
12
14
  SupabaseUploadHandler,
@@ -1,5 +1,6 @@
1
- import { S as SupabaseUploadHandlerOptions, a as UploadNotificationConfig, B as BucketConfig } from '../../types-CyvBaAl8.js';
2
- export { D as DEFAULT_UPLOAD_NOTIFICATION, U as UploadEventHandlers } from '../../types-CyvBaAl8.js';
1
+ import { S as SupabaseUploadHandlerOptions, a as UploadNotificationConfig, B as BucketConfig } from '../../types-6QHGELuY.js';
2
+ export { D as DEFAULT_UPLOAD_NOTIFICATION, U as UploadEventHandlers } from '../../types-6QHGELuY.js';
3
+ import { SupabaseClient } from '@supabase/supabase-js';
3
4
 
4
5
  /**
5
6
  * Supabase Upload Handler for React Native
@@ -51,6 +52,6 @@ declare class SupabaseUploadHandler {
51
52
  /**
52
53
  * Factory function for creating a SupabaseUploadHandler.
53
54
  */
54
- declare function createSupabaseUploadHandler(supabaseClient: any, bucketConfig: BucketConfig, notificationConfig?: Partial<UploadNotificationConfig>): SupabaseUploadHandler;
55
+ declare function createSupabaseUploadHandler(supabaseClient: SupabaseClient, bucketConfig: BucketConfig, notificationConfig?: Partial<UploadNotificationConfig>): SupabaseUploadHandler;
55
56
 
56
57
  export { BucketConfig, SupabaseUploadHandler, SupabaseUploadHandlerOptions, UploadNotificationConfig, createSupabaseUploadHandler };
@@ -2,11 +2,13 @@ import "../../chunk-YHTZ7VMV.js";
2
2
  import {
3
3
  SupabaseUploadHandler,
4
4
  createSupabaseUploadHandler
5
- } from "../../chunk-CAB26E6F.js";
5
+ } from "../../chunk-C4J4MLER.js";
6
6
  import {
7
7
  DEFAULT_UPLOAD_NOTIFICATION
8
- } from "../../chunk-Z6VOBGTU.js";
8
+ } from "../../chunk-ZAN22NGL.js";
9
+ import "../../chunk-UOMHWUHV.js";
9
10
  import "../../chunk-FV2HXEIY.js";
11
+ import "../../chunk-5WRI5ZAA.js";
10
12
  export {
11
13
  DEFAULT_UPLOAD_NOTIFICATION,
12
14
  SupabaseUploadHandler,
@@ -1,2 +1,3 @@
1
- export { B as BucketConfig, D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from '../../types-CyvBaAl8.js';
1
+ export { B as BucketConfig, D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from '../../types-6QHGELuY.js';
2
2
  export { SupabaseUploadHandler, createSupabaseUploadHandler } from './index.js';
3
+ import '@supabase/supabase-js';
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  SupabaseUploadHandler,
3
3
  createSupabaseUploadHandler
4
- } from "../../chunk-P4HZA6ZT.js";
4
+ } from "../../chunk-4665ZSE5.js";
5
5
  import {
6
6
  DEFAULT_UPLOAD_NOTIFICATION
7
- } from "../../chunk-Z6VOBGTU.js";
7
+ } from "../../chunk-ZAN22NGL.js";
8
+ import "../../chunk-UOMHWUHV.js";
8
9
  import "../../chunk-FV2HXEIY.js";
10
+ import "../../chunk-5WRI5ZAA.js";
9
11
  export {
10
12
  DEFAULT_UPLOAD_NOTIFICATION,
11
13
  SupabaseUploadHandler,
@@ -1,5 +1,5 @@
1
- import { P as PowerSyncBackendConnector, A as AbstractPowerSyncDatabase } from './types-Dv1uf0LZ.js';
2
- import { S as SupabaseConnectorOptions, P as PowerSyncCredentials } from './types-CpM2_LhU.js';
1
+ import { P as PowerSyncBackendConnector, A as AbstractPowerSyncDatabase } from './types-B9MptP7E.js';
2
+ import { S as SupabaseConnectorOptions, P as PowerSyncCredentials } from './types-DqJnP50o.js';
3
3
 
4
4
  /**
5
5
  * Supabase Connector for PowerSync
@@ -1,13 +1,18 @@
1
- import { b as SyncStatusTrackerOptions, P as PowerSyncRawStatus, U as Unsubscribe, M as MetricsCollectorOptions, d as SyncOperationData, H as HealthMonitorOptions, e as HealthCheckResult } from '../background-sync-CVR3PkFi.js';
2
- export { B as BackgroundSyncOptions, h as BackgroundSyncSystem, c as SyncControlActions, f as SyncEvent, g as SyncEventListener, S as SyncScope, a as SyncStatusState, i as defineBackgroundSyncTask, j as initializeBackgroundSync, k as isBackgroundSyncRegistered, r as registerBackgroundSync, u as unregisterBackgroundSync } from '../background-sync-CVR3PkFi.js';
3
- import { a as SyncStatus, S as SyncMode, U as UploadBlockReason, C as CrudEntry, f as SyncError, F as FailedTransaction, h as CompletedTransaction, e as SyncMetrics, A as AbstractPowerSyncDatabase, b as ConnectionHealth } from '../types-Dv1uf0LZ.js';
1
+ import { b as SyncStatusTrackerOptions, P as PowerSyncRawStatus, U as Unsubscribe, M as MetricsCollectorOptions, d as SyncOperationData, H as HealthMonitorOptions, e as HealthCheckResult } from '../background-sync-BujnI3IR.js';
2
+ export { B as BackgroundSyncOptions, h as BackgroundSyncSystem, c as SyncControlActions, f as SyncEvent, g as SyncEventListener, S as SyncScope, a as SyncStatusState, i as defineBackgroundSyncTask, j as initializeBackgroundSync, k as isBackgroundSyncRegistered, r as registerBackgroundSync, u as unregisterBackgroundSync } from '../background-sync-BujnI3IR.js';
3
+ import { A as AbstractPowerSyncDatabase, a as SyncStatus, S as SyncMode, U as UploadBlockReason, C as CrudEntry, f as SyncError, F as FailedTransaction, h as CompletedTransaction, e as SyncMetrics, b as ConnectionHealth } from '../types-B9MptP7E.js';
4
4
  import { AsyncStorageAdapter, LoggerAdapter } from '../platform/index.js';
5
+ import * as _powersync_common from '@powersync/common';
6
+ import { Table } from '@powersync/common';
5
7
 
6
8
  /**
7
9
  * Sync Status Tracker for @pol-studios/powersync
8
10
  *
9
11
  * Tracks and normalizes PowerSync status changes, providing a consistent
10
12
  * interface for status updates with throttling support.
13
+ *
14
+ * Transaction persistence uses local-only SQLite tables instead of AsyncStorage
15
+ * for better integration with PowerSync's database.
11
16
  */
12
17
 
13
18
  /**
@@ -41,6 +46,7 @@ declare class SyncStatusTracker {
41
46
  private readonly logger;
42
47
  private readonly notifyThrottleMs;
43
48
  private readonly onStatusChange?;
49
+ private _db;
44
50
  private _state;
45
51
  private _pendingMutations;
46
52
  private _lastNotifyTime;
@@ -53,9 +59,6 @@ declare class SyncStatusTracker {
53
59
  private readonly _networkRestoreDelayMs;
54
60
  private _persistDebounceTimer;
55
61
  private _lastProgress;
56
- private readonly _backoffBaseMs;
57
- private readonly _backoffMaxMs;
58
- private readonly _backoffMultiplier;
59
62
  private _failedTransactions;
60
63
  private readonly _maxStoredFailures;
61
64
  private readonly _failureTTLMs;
@@ -65,11 +68,64 @@ declare class SyncStatusTracker {
65
68
  private _lastNotificationTime;
66
69
  private _isAutoOffline;
67
70
  constructor(storage: AsyncStorageAdapter, logger: LoggerAdapter, options?: SyncStatusTrackerOptions);
71
+ private _dbInitializing;
72
+ private _dbReady;
73
+ private _persistenceErrorCount;
74
+ private readonly _maxPersistenceErrors;
75
+ /**
76
+ * Set the PowerSync database instance AND initialize transactions atomically.
77
+ * This prevents race conditions between setDatabase() and initTransactions().
78
+ *
79
+ * @param db - The PowerSync database instance
80
+ * @returns Promise that resolves when initialization is complete
81
+ */
82
+ setDatabaseAndInit(db: AbstractPowerSyncDatabase): Promise<void>;
83
+ /**
84
+ * Set the PowerSync database instance for local-only table persistence.
85
+ * @deprecated Use setDatabaseAndInit() instead to avoid race conditions.
86
+ */
87
+ setDatabase(db: AbstractPowerSyncDatabase): void;
88
+ /**
89
+ * Get the PowerSync database instance.
90
+ */
91
+ getDatabase(): AbstractPowerSyncDatabase | null;
92
+ /**
93
+ * Check if the database is ready for persistence operations.
94
+ */
95
+ isDatabaseReady(): boolean;
96
+ /**
97
+ * Check if persistence is in a degraded state (too many errors).
98
+ */
99
+ isPersistenceDegraded(): boolean;
100
+ /**
101
+ * Track a persistence error and log if we enter degraded mode.
102
+ */
103
+ private _trackPersistenceError;
104
+ /**
105
+ * Reset persistence error count (e.g., after successful operation).
106
+ */
107
+ private _resetPersistenceErrors;
68
108
  /**
69
109
  * Initialize the tracker by loading persisted state.
70
110
  * Includes migration from old isPaused boolean to new syncMode.
111
+ *
112
+ * Note: Transaction data is loaded from SQLite after the database is set.
113
+ * Call initTransactions() after setDatabase() to load transaction history.
71
114
  */
72
115
  init(): Promise<void>;
116
+ /**
117
+ * Initialize transactions from SQLite local-only tables.
118
+ * Must be called after setDatabase() has been called.
119
+ */
120
+ initTransactions(): Promise<void>;
121
+ /**
122
+ * Load completed transactions from SQLite local-only table.
123
+ */
124
+ private _loadCompletedTransactionsFromDb;
125
+ /**
126
+ * Load failed transactions from SQLite local-only table.
127
+ */
128
+ private _loadFailedTransactionsFromDb;
73
129
  /**
74
130
  * Dispose the tracker and clear timers.
75
131
  */
@@ -180,14 +236,6 @@ declare class SyncStatusTracker {
180
236
  * @returns Unsubscribe function
181
237
  */
182
238
  onSyncModeChange(listener: (mode: SyncMode) => void): Unsubscribe;
183
- /**
184
- * Compute exponential backoff delay for a given retry count.
185
- * Uses base 1s, max 60s, multiplier 2.
186
- *
187
- * @param retryCount - Number of retries (1-based)
188
- * @returns Backoff delay in milliseconds
189
- */
190
- private _computeBackoffMs;
191
239
  /**
192
240
  * Record a transaction failure.
193
241
  * If a failure for the same entries already exists, updates the retry count.
@@ -287,14 +335,30 @@ declare class SyncStatusTracker {
287
335
  */
288
336
  getLastNotificationTime(): number;
289
337
  /**
290
- * Schedule a debounced persist operation.
291
- * This prevents race conditions from multiple rapid persist calls.
338
+ * Insert a completed transaction into SQLite.
292
339
  */
293
- private _schedulePersist;
340
+ private _insertCompletedTransaction;
341
+ /**
342
+ * Delete a completed transaction from SQLite.
343
+ */
344
+ private _deleteCompletedTransaction;
345
+ /**
346
+ * Delete all completed transactions from SQLite.
347
+ */
348
+ private _deleteAllCompletedTransactions;
349
+ /**
350
+ * Insert a failed transaction into SQLite.
351
+ */
352
+ private _insertFailedTransaction;
353
+ /**
354
+ * Delete a failed transaction from SQLite.
355
+ */
356
+ private _deleteFailedTransaction;
294
357
  /**
295
- * Persist completed and failed transactions to storage.
358
+ * Enforce the max completed transactions limit in SQLite.
359
+ * Removes oldest entries beyond the limit.
296
360
  */
297
- private _persistTransactions;
361
+ private _enforceCompletedTransactionsLimit;
298
362
  private _hasStatusChanged;
299
363
  /**
300
364
  * Notify all listeners of status changes with throttling.
@@ -532,6 +596,77 @@ declare class HealthMonitor {
532
596
  private _withTimeout;
533
597
  }
534
598
 
599
+ /**
600
+ * Local-only table for storing failed upload transactions.
601
+ * Not synced to server - purely client-side persistence.
602
+ *
603
+ * Replaces AsyncStorage key '@pol-powersync:failed_transactions'.
604
+ */
605
+ declare const FailedTransactionsTable: Table<{
606
+ entries: _powersync_common.BaseColumnType<string>;
607
+ errorType: _powersync_common.BaseColumnType<string>;
608
+ errorMessage: _powersync_common.BaseColumnType<string>;
609
+ errorUserMessage: _powersync_common.BaseColumnType<string>;
610
+ errorPgCode: _powersync_common.BaseColumnType<string>;
611
+ errorTimestamp: _powersync_common.BaseColumnType<string>;
612
+ errorIsPermanent: _powersync_common.BaseColumnType<number>;
613
+ affectedEntityIds: _powersync_common.BaseColumnType<string>;
614
+ affectedTables: _powersync_common.BaseColumnType<string>;
615
+ retryCount: _powersync_common.BaseColumnType<number>;
616
+ isPermanent: _powersync_common.BaseColumnType<number>;
617
+ firstFailedAt: _powersync_common.BaseColumnType<string>;
618
+ lastFailedAt: _powersync_common.BaseColumnType<string>;
619
+ }>;
620
+ /**
621
+ * Local-only table for storing completed upload transactions.
622
+ * Used for sync history/activity display.
623
+ *
624
+ * Replaces AsyncStorage key '@pol-powersync:completed_transactions'.
625
+ */
626
+ declare const CompletedTransactionsTable: Table<{
627
+ entries: _powersync_common.BaseColumnType<string>;
628
+ affectedEntityIds: _powersync_common.BaseColumnType<string>;
629
+ affectedTables: _powersync_common.BaseColumnType<string>;
630
+ completedAt: _powersync_common.BaseColumnType<string>;
631
+ }>;
632
+ /**
633
+ * Local-only tables to be merged into the PowerSync schema.
634
+ *
635
+ * These use the naming convention `ps_local_*` to clearly indicate
636
+ * they are local-only tables managed by the sync system.
637
+ */
638
+ declare const LOCAL_ONLY_TABLES: {
639
+ ps_local_failed_transactions: Table<{
640
+ entries: _powersync_common.BaseColumnType<string>;
641
+ errorType: _powersync_common.BaseColumnType<string>;
642
+ errorMessage: _powersync_common.BaseColumnType<string>;
643
+ errorUserMessage: _powersync_common.BaseColumnType<string>;
644
+ errorPgCode: _powersync_common.BaseColumnType<string>;
645
+ errorTimestamp: _powersync_common.BaseColumnType<string>;
646
+ errorIsPermanent: _powersync_common.BaseColumnType<number>;
647
+ affectedEntityIds: _powersync_common.BaseColumnType<string>;
648
+ affectedTables: _powersync_common.BaseColumnType<string>;
649
+ retryCount: _powersync_common.BaseColumnType<number>;
650
+ isPermanent: _powersync_common.BaseColumnType<number>;
651
+ firstFailedAt: _powersync_common.BaseColumnType<string>;
652
+ lastFailedAt: _powersync_common.BaseColumnType<string>;
653
+ }>;
654
+ ps_local_completed_transactions: Table<{
655
+ entries: _powersync_common.BaseColumnType<string>;
656
+ affectedEntityIds: _powersync_common.BaseColumnType<string>;
657
+ affectedTables: _powersync_common.BaseColumnType<string>;
658
+ completedAt: _powersync_common.BaseColumnType<string>;
659
+ }>;
660
+ };
661
+ /**
662
+ * Table names for the local-only tables.
663
+ * Use these constants when querying the tables.
664
+ */
665
+ declare const LOCAL_TABLE_NAMES: {
666
+ readonly FAILED_TRANSACTIONS: "ps_local_failed_transactions";
667
+ readonly COMPLETED_TRANSACTIONS: "ps_local_completed_transactions";
668
+ };
669
+
535
670
  /**
536
671
  * Dead Letter Queue (DLQ) for PowerSync
537
672
  *
@@ -724,4 +859,4 @@ declare function generateDLQEntryId(entries: CrudEntry[]): string;
724
859
  */
725
860
  declare function createDeadLetterEntry(entries: CrudEntry[], error: SyncError, reason: DeadLetterReason, retryAttempts?: number): DeadLetterEntry;
726
861
 
727
- export { type DeadLetterEntry, DeadLetterQueue, type DeadLetterQueueListener, type DeadLetterQueueOptions, type DeadLetterReason, HealthCheckResult, HealthMonitor, HealthMonitorOptions, MetricsCollector, MetricsCollectorOptions, PowerSyncRawStatus, SyncOperationData, SyncStatusTracker, SyncStatusTrackerOptions, Unsubscribe, createDeadLetterEntry, generateDLQEntryId };
862
+ export { CompletedTransactionsTable, type DeadLetterEntry, DeadLetterQueue, type DeadLetterQueueListener, type DeadLetterQueueOptions, type DeadLetterReason, FailedTransactionsTable, HealthCheckResult, HealthMonitor, HealthMonitorOptions, LOCAL_ONLY_TABLES, LOCAL_TABLE_NAMES, MetricsCollector, MetricsCollectorOptions, PowerSyncRawStatus, SyncOperationData, SyncStatusTracker, SyncStatusTrackerOptions, Unsubscribe, createDeadLetterEntry, generateDLQEntryId };
@@ -7,18 +7,28 @@ import {
7
7
  isBackgroundSyncRegistered,
8
8
  registerBackgroundSync,
9
9
  unregisterBackgroundSync
10
- } from "../chunk-A4IBBWGO.js";
10
+ } from "../chunk-RALHHPTU.js";
11
11
  import {
12
12
  HealthMonitor,
13
13
  MetricsCollector,
14
14
  SyncStatusTracker
15
- } from "../chunk-RE5HWLCB.js";
16
- import "../chunk-FNYQFILT.js";
15
+ } from "../chunk-2RDWLXJW.js";
16
+ import {
17
+ CompletedTransactionsTable,
18
+ FailedTransactionsTable,
19
+ LOCAL_ONLY_TABLES,
20
+ LOCAL_TABLE_NAMES
21
+ } from "../chunk-OGUFUZSY.js";
17
22
  import "../chunk-CGL33PL4.js";
18
23
  import "../chunk-I2AYMY5O.js";
24
+ import "../chunk-5WRI5ZAA.js";
19
25
  export {
26
+ CompletedTransactionsTable,
20
27
  DeadLetterQueue,
28
+ FailedTransactionsTable,
21
29
  HealthMonitor,
30
+ LOCAL_ONLY_TABLES,
31
+ LOCAL_TABLE_NAMES,
22
32
  MetricsCollector,
23
33
  SyncStatusTracker,
24
34
  createDeadLetterEntry,
@@ -1,8 +1,11 @@
1
+ import { SupabaseClient } from '@supabase/supabase-js';
2
+
1
3
  /**
2
4
  * Upload Handler Types for @pol-studios/powersync
3
5
  *
4
6
  * Defines types for platform-specific upload handlers.
5
7
  */
8
+
6
9
  /**
7
10
  * Bucket configuration for multi-bucket routing.
8
11
  */
@@ -19,7 +22,7 @@ interface BucketConfig {
19
22
  */
20
23
  interface SupabaseUploadHandlerOptions {
21
24
  /** Supabase client instance */
22
- supabaseClient: any;
25
+ supabaseClient: SupabaseClient;
23
26
  /** Bucket configuration for multi-bucket routing */
24
27
  bucketConfig: BucketConfig;
25
28
  }
@@ -214,16 +214,6 @@ interface FailedTransaction {
214
214
  affectedEntityIds: string[];
215
215
  /** Table names involved in this transaction */
216
216
  affectedTables: string[];
217
- /**
218
- * Estimated next retry time.
219
- * @deprecated With simplified architecture, PowerSync SDK controls retry timing.
220
- */
221
- nextRetryAt?: Date;
222
- /**
223
- * Current backoff delay in ms.
224
- * @deprecated With simplified architecture, PowerSync SDK controls retry timing.
225
- */
226
- backoffMs?: number;
227
217
  }
228
218
  /**
229
219
  * Result of classifying a Supabase/PostgreSQL error
@@ -332,6 +322,13 @@ interface AbstractPowerSyncDatabase {
332
322
  connect(connector: PowerSyncBackendConnector): Promise<void>;
333
323
  /** Disconnect from the PowerSync service */
334
324
  disconnect(): Promise<void>;
325
+ /**
326
+ * Disconnect and clear all synced data.
327
+ * @param options.clearLocal - If false, preserves local mutations in ps_crud. Default: true
328
+ */
329
+ disconnectAndClear(options?: {
330
+ clearLocal?: boolean;
331
+ }): Promise<void>;
335
332
  /** Register a listener for status changes */
336
333
  registerListener(listener: {
337
334
  statusChanged?: (status: unknown) => void;