@pol-studios/powersync 1.0.4 → 1.0.7
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.
- package/dist/CacheSettingsManager-1exbOC6S.d.ts +261 -0
- package/dist/attachments/index.d.ts +65 -355
- package/dist/attachments/index.js +24 -6
- package/dist/{types-Cd7RhNqf.d.ts → background-sync-ChCXW-EV.d.ts} +53 -2
- package/dist/chunk-4C3RY5SU.js +204 -0
- package/dist/chunk-4C3RY5SU.js.map +1 -0
- package/dist/{chunk-3AYXHQ4W.js → chunk-53WH2JJV.js} +111 -47
- package/dist/chunk-53WH2JJV.js.map +1 -0
- package/dist/chunk-A4IBBWGO.js +377 -0
- package/dist/chunk-A4IBBWGO.js.map +1 -0
- package/dist/chunk-BREGB4WL.js +1768 -0
- package/dist/chunk-BREGB4WL.js.map +1 -0
- package/dist/{chunk-EJ23MXPQ.js → chunk-CGL33PL4.js} +3 -1
- package/dist/chunk-CGL33PL4.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/chunk-DHYUBVP7.js +131 -0
- package/dist/chunk-DHYUBVP7.js.map +1 -0
- package/dist/chunk-FV2HXEIY.js +124 -0
- package/dist/chunk-FV2HXEIY.js.map +1 -0
- package/dist/chunk-GKF7TOMT.js +1 -0
- package/dist/{chunk-OTJXIRWX.js → chunk-H772V6XQ.js} +304 -51
- package/dist/chunk-H772V6XQ.js.map +1 -0
- package/dist/{chunk-C2RSTGDC.js → chunk-HFOFLW5F.js} +525 -87
- package/dist/chunk-HFOFLW5F.js.map +1 -0
- package/dist/chunk-KGSFAE5B.js +1 -0
- package/dist/chunk-LNL64IJZ.js +1 -0
- package/dist/chunk-MKD2VCX3.js +32 -0
- package/dist/chunk-MKD2VCX3.js.map +1 -0
- package/dist/{chunk-7EMDVIZX.js → chunk-N75DEF5J.js} +19 -1
- package/dist/chunk-N75DEF5J.js.map +1 -0
- package/dist/chunk-P6WOZO7H.js +49 -0
- package/dist/chunk-P6WOZO7H.js.map +1 -0
- package/dist/chunk-TGBT5XBE.js +1 -0
- package/dist/chunk-TGBT5XBE.js.map +1 -0
- package/dist/chunk-UEYRTLKE.js +72 -0
- package/dist/chunk-UEYRTLKE.js.map +1 -0
- package/dist/chunk-WGHNIAF7.js +329 -0
- package/dist/chunk-WGHNIAF7.js.map +1 -0
- package/dist/chunk-WQ5MPAVC.js +449 -0
- package/dist/chunk-WQ5MPAVC.js.map +1 -0
- package/dist/{chunk-FPTDATY5.js → chunk-XQAJM2MW.js} +22 -11
- package/dist/chunk-XQAJM2MW.js.map +1 -0
- package/dist/chunk-YSTEESEG.js +676 -0
- package/dist/chunk-YSTEESEG.js.map +1 -0
- package/dist/chunk-ZEOKPWUC.js +1165 -0
- package/dist/chunk-ZEOKPWUC.js.map +1 -0
- package/dist/connector/index.d.ts +182 -2
- package/dist/connector/index.js +14 -3
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +5 -2
- package/dist/error/index.d.ts +54 -0
- package/dist/error/index.js +8 -0
- package/dist/error/index.js.map +1 -0
- package/dist/index.d.ts +237 -11
- package/dist/index.js +183 -27
- package/dist/index.native.d.ts +20 -9
- package/dist/index.native.js +183 -28
- package/dist/index.web.d.ts +20 -9
- package/dist/index.web.js +184 -28
- package/dist/maintenance/index.d.ts +118 -0
- package/dist/maintenance/index.js +17 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/platform/index.d.ts +16 -1
- package/dist/platform/index.js +2 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/index.native.d.ts +2 -2
- package/dist/platform/index.native.js +2 -1
- package/dist/platform/index.web.d.ts +1 -1
- package/dist/platform/index.web.js +2 -1
- package/dist/pol-attachment-queue-C7YNXXhK.d.ts +676 -0
- package/dist/provider/index.d.ts +693 -12
- package/dist/provider/index.js +57 -12
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.js +28 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/index.native.d.ts +6 -0
- package/dist/storage/index.native.js +26 -0
- package/dist/storage/index.native.js.map +1 -0
- package/dist/storage/index.web.d.ts +6 -0
- package/dist/storage/index.web.js +26 -0
- package/dist/storage/index.web.js.map +1 -0
- package/dist/storage/upload/index.d.ts +55 -0
- package/dist/storage/upload/index.js +15 -0
- package/dist/storage/upload/index.js.map +1 -0
- package/dist/storage/upload/index.native.d.ts +57 -0
- package/dist/storage/upload/index.native.js +14 -0
- package/dist/storage/upload/index.native.js.map +1 -0
- package/dist/storage/upload/index.web.d.ts +5 -0
- package/dist/storage/upload/index.web.js +14 -0
- package/dist/storage/upload/index.web.js.map +1 -0
- package/dist/{index-Cb-NI0Ct.d.ts → supabase-connector-qLm-WHkM.d.ts} +146 -10
- package/dist/sync/index.d.ts +288 -22
- package/dist/sync/index.js +23 -5
- package/dist/types-BVacP54t.d.ts +52 -0
- package/dist/types-Bgvx7-E8.d.ts +187 -0
- package/dist/{types-afHtE1U_.d.ts → types-CDqWh56B.d.ts} +2 -0
- package/package.json +72 -2
- package/dist/chunk-32OLICZO.js +0 -1
- package/dist/chunk-3AYXHQ4W.js.map +0 -1
- package/dist/chunk-7EMDVIZX.js.map +0 -1
- package/dist/chunk-7JQZBZ5N.js +0 -1
- package/dist/chunk-C2RSTGDC.js.map +0 -1
- package/dist/chunk-EJ23MXPQ.js.map +0 -1
- package/dist/chunk-FPTDATY5.js.map +0 -1
- package/dist/chunk-GMFDCVMZ.js +0 -1285
- package/dist/chunk-GMFDCVMZ.js.map +0 -1
- package/dist/chunk-OLHGI472.js +0 -1
- package/dist/chunk-OTJXIRWX.js.map +0 -1
- package/dist/chunk-V6LJ6MR2.js +0 -740
- package/dist/chunk-V6LJ6MR2.js.map +0 -1
- package/dist/chunk-VJCL2SWD.js +0 -1
- /package/dist/{chunk-32OLICZO.js.map → chunk-DGUM43GV.js.map} +0 -0
- /package/dist/{chunk-7JQZBZ5N.js.map → chunk-GKF7TOMT.js.map} +0 -0
- /package/dist/{chunk-OLHGI472.js.map → chunk-KGSFAE5B.js.map} +0 -0
- /package/dist/{chunk-VJCL2SWD.js.map → chunk-LNL64IJZ.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,232 @@
|
|
|
1
|
-
import { A as AbstractPowerSyncDatabase } from './types-
|
|
2
|
-
export { 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-
|
|
3
|
-
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';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export { e as
|
|
8
|
-
export {
|
|
1
|
+
import { A as AbstractPowerSyncDatabase } from './types-CDqWh56B.js';
|
|
2
|
+
export { 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';
|
|
3
|
+
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, toSyncOperationError } from './core/index.js';
|
|
4
|
+
import { k as ConflictDetectionConfig, h as ConflictCheckResult } from './supabase-connector-qLm-WHkM.js';
|
|
5
|
+
export { g as ConflictBus, j as ConflictHandler, l as ConflictListener, i as ConflictResolution, C as ConnectorCircuitBreakerConfig, b as ConnectorConfig, e as CrudHandler, D as DEFAULT_RETRY_CONFIG, F as FieldConflict, P as PowerSyncCredentials, m as ResolutionListener, f as RetryConfig, R as RetryStrategyConfig, c as SchemaRouter, S as SupabaseConnector, a as SupabaseConnectorOptions, d as defaultSchemaRouter } from './supabase-connector-qLm-WHkM.js';
|
|
6
|
+
export { CircuitBreaker, CircuitBreakerConfig, CircuitBreakerStats, CircuitOpenError, CircuitState, DEFAULT_CIRCUIT_BREAKER_CONFIG } from './connector/index.js';
|
|
7
|
+
export { t as AttachmentRecord, A as AttachmentSourceConfig, q as AttachmentStatsRow, e as AttachmentStorageAdapter, p as AttachmentSyncStats, o as AttachmentSyncStatus, h as CacheConfig, r as CacheFileRow, s as CachedSizeRow, C as CompressionConfig, i as DEFAULT_CACHE_CONFIG, D as DEFAULT_COMPRESSION_CONFIG, f as DEFAULT_UPLOAD_CONFIG, k as DownloadPhase, l as DownloadStatus, E as EvictRow, I as IdRow, P as PolAttachmentQueue, j as PolAttachmentQueueConfig, a as PolAttachmentQueueOptions, d as PolAttachmentRecord, b as PolAttachmentState, U as UploadConfig, g as UploadHandler, m as UploadPhase, n as UploadStatus, c as createPolAttachmentQueue } from './pol-attachment-queue-C7YNXXhK.js';
|
|
8
|
+
export { PolStorageAdapter, PolStorageAdapterOptions } from './attachments/index.js';
|
|
9
|
+
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';
|
|
10
|
+
export { DeadLetterEntry, DeadLetterQueue, DeadLetterQueueListener, DeadLetterQueueOptions, DeadLetterReason, HealthMonitor, MetricsCollector, SyncStatusTracker, createDeadLetterEntry, generateDLQEntryId } from './sync/index.js';
|
|
9
11
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
10
|
-
export {
|
|
12
|
+
export { DatabaseMaintenanceUtils, checkIntegrityImpl, checkStorageQuotaImpl, compactDatabaseImpl, getCacheStatsImpl, useDatabaseMaintenance } from './maintenance/index.js';
|
|
13
|
+
export { A as AttachmentUploadHandler, a as BucketConfig, B as BucketResolver, D as DownloadResult, P as PowerSyncStorageAdapter, R as RemoteStorageAdapter, S as StorageUploadHandler, b as SupabaseStorageAdapterOptions, U as UploadOptions, r as resolveBucketFromConfig } from './types-Bgvx7-E8.js';
|
|
14
|
+
export { a as CacheSettings, C as CacheSettingsManager, b as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, S as SupabaseStorageAdapter, c as createSupabaseStorageAdapter } from './CacheSettingsManager-1exbOC6S.js';
|
|
15
|
+
export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from './types-BVacP54t.js';
|
|
16
|
+
export { SupabaseUploadHandler, createSupabaseUploadHandler } from './storage/upload/index.js';
|
|
17
|
+
export { PowerSyncErrorBoundary } from './error/index.js';
|
|
18
|
+
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';
|
|
11
19
|
export { AsyncStorageAdapter, CompressedImage, CompressionOptions, ConnectionType, DatabaseOptions, FileInfo, FileSystemAdapter, ImageProcessorAdapter, LoggerAdapter, NetworkAdapter, PlatformAdapter, PlatformType, detectPlatform } from './platform/index.js';
|
|
12
|
-
|
|
20
|
+
export { ATTACHMENT_TABLE, AbstractAttachmentQueue, AttachmentState, AttachmentTable, AttachmentTableOptions, AttachmentQueueOptions as BaseAttachmentQueueOptions, DEFAULT_ATTACHMENT_QUEUE_OPTIONS, EncodingType, AttachmentRecord as OfficialAttachmentRecord, StorageAdapter } from '@powersync/attachments';
|
|
21
|
+
import '@powersync/common';
|
|
13
22
|
import 'react';
|
|
23
|
+
import '@tanstack/react-query';
|
|
24
|
+
import '@powersync/react-native';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Exponential backoff retry utilities for resilient network operations.
|
|
28
|
+
*
|
|
29
|
+
* Provides configurable retry logic with exponential backoff, jitter,
|
|
30
|
+
* and abort signal support for cancellation.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for exponential backoff retry behavior.
|
|
34
|
+
*/
|
|
35
|
+
interface BackoffConfig {
|
|
36
|
+
/** Maximum number of retry attempts (0 = no retries, just one attempt) */
|
|
37
|
+
maxRetries: number;
|
|
38
|
+
/** Base delay in milliseconds before first retry */
|
|
39
|
+
baseDelayMs: number;
|
|
40
|
+
/** Maximum delay cap in milliseconds */
|
|
41
|
+
maxDelayMs: number;
|
|
42
|
+
/** Multiplier applied to delay for each subsequent retry (typically 2) */
|
|
43
|
+
backoffMultiplier: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for the withExponentialBackoff function.
|
|
47
|
+
*/
|
|
48
|
+
interface BackoffOptions {
|
|
49
|
+
/** Optional AbortSignal for cancellation support */
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
/** Callback invoked before each retry attempt */
|
|
52
|
+
onRetry?: (attempt: number, delay: number, error: Error) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Error thrown when an operation is aborted via AbortSignal.
|
|
56
|
+
*/
|
|
57
|
+
declare class AbortError extends Error {
|
|
58
|
+
constructor(message?: string);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Error thrown when all retry attempts have been exhausted.
|
|
62
|
+
*/
|
|
63
|
+
declare class RetryExhaustedError extends Error {
|
|
64
|
+
/** The last error that caused the final retry to fail */
|
|
65
|
+
readonly cause: Error;
|
|
66
|
+
/** Total number of attempts made */
|
|
67
|
+
readonly attempts: number;
|
|
68
|
+
constructor(cause: Error, attempts: number);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Calculates the delay for a given retry attempt using exponential backoff.
|
|
72
|
+
*
|
|
73
|
+
* Formula: min(baseDelay * (multiplier ^ attempt), maxDelay)
|
|
74
|
+
*
|
|
75
|
+
* @param attempt - The current attempt number (0-indexed)
|
|
76
|
+
* @param config - Backoff configuration
|
|
77
|
+
* @returns Delay in milliseconds (without jitter)
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const config = { baseDelayMs: 1000, maxDelayMs: 30000, backoffMultiplier: 2 };
|
|
82
|
+
* calculateBackoffDelay(0, config); // 1000
|
|
83
|
+
* calculateBackoffDelay(1, config); // 2000
|
|
84
|
+
* calculateBackoffDelay(2, config); // 4000
|
|
85
|
+
* calculateBackoffDelay(5, config); // 30000 (capped at maxDelayMs)
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
declare function calculateBackoffDelay(attempt: number, config: Pick<BackoffConfig, 'baseDelayMs' | 'maxDelayMs' | 'backoffMultiplier'>): number;
|
|
89
|
+
/**
|
|
90
|
+
* Adds jitter (±10%) to a delay value to prevent thundering herd.
|
|
91
|
+
*
|
|
92
|
+
* @param delay - Base delay in milliseconds
|
|
93
|
+
* @returns Delay with random jitter applied
|
|
94
|
+
*/
|
|
95
|
+
declare function addJitter(delay: number): number;
|
|
96
|
+
/**
|
|
97
|
+
* Sleep utility that respects AbortSignal for cancellation.
|
|
98
|
+
*
|
|
99
|
+
* @param ms - Duration to sleep in milliseconds
|
|
100
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
101
|
+
* @returns Promise that resolves after the delay or rejects if aborted
|
|
102
|
+
* @throws {AbortError} If the signal is aborted during sleep
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const controller = new AbortController();
|
|
107
|
+
*
|
|
108
|
+
* // Sleep for 1 second
|
|
109
|
+
* await sleep(1000);
|
|
110
|
+
*
|
|
111
|
+
* // Sleep with cancellation support
|
|
112
|
+
* await sleep(1000, controller.signal);
|
|
113
|
+
*
|
|
114
|
+
* // Cancel the sleep
|
|
115
|
+
* controller.abort();
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Default backoff configuration suitable for most network operations.
|
|
121
|
+
*/
|
|
122
|
+
declare const DEFAULT_BACKOFF_CONFIG: BackoffConfig;
|
|
123
|
+
/**
|
|
124
|
+
* Executes a function with exponential backoff retry logic.
|
|
125
|
+
*
|
|
126
|
+
* Retries the provided function on failure using exponential backoff with jitter.
|
|
127
|
+
* Supports cancellation via AbortSignal and provides hooks for retry observation.
|
|
128
|
+
*
|
|
129
|
+
* @param fn - Async function to execute with retry logic
|
|
130
|
+
* @param config - Backoff configuration (maxRetries, delays, multiplier)
|
|
131
|
+
* @param options - Optional abort signal and retry callback
|
|
132
|
+
* @returns Promise resolving to the function result
|
|
133
|
+
* @throws {AbortError} If operation is aborted via signal
|
|
134
|
+
* @throws {RetryExhaustedError} If all retry attempts fail
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* const controller = new AbortController();
|
|
139
|
+
*
|
|
140
|
+
* const result = await withExponentialBackoff(
|
|
141
|
+
* async () => {
|
|
142
|
+
* const response = await fetch('https://api.example.com/data');
|
|
143
|
+
* if (!response.ok) throw new Error('Request failed');
|
|
144
|
+
* return response.json();
|
|
145
|
+
* },
|
|
146
|
+
* {
|
|
147
|
+
* maxRetries: 3,
|
|
148
|
+
* baseDelayMs: 1000,
|
|
149
|
+
* maxDelayMs: 30000,
|
|
150
|
+
* backoffMultiplier: 2,
|
|
151
|
+
* },
|
|
152
|
+
* {
|
|
153
|
+
* signal: controller.signal,
|
|
154
|
+
* onRetry: (attempt, delay, error) => {
|
|
155
|
+
* console.log(`Retry ${attempt} in ${delay}ms: ${error.message}`);
|
|
156
|
+
* },
|
|
157
|
+
* }
|
|
158
|
+
* );
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
declare function withExponentialBackoff<T>(fn: () => Promise<T>, config: BackoffConfig, options?: BackoffOptions): Promise<T>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Format bytes to human-readable string
|
|
165
|
+
*
|
|
166
|
+
* @param bytes - Number of bytes to format
|
|
167
|
+
* @param decimals - Number of decimal places (default: 2)
|
|
168
|
+
* @returns Formatted string like "1.5 MB", "256 KB", etc.
|
|
169
|
+
*/
|
|
170
|
+
declare function formatBytes(bytes: number, decimals?: number): string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* MIME Type Utilities for @pol-studios/powersync
|
|
174
|
+
*
|
|
175
|
+
* Provides file extension to MIME type mapping for storage operations.
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* Get MIME type from file extension.
|
|
179
|
+
*
|
|
180
|
+
* @param extension - File extension (with or without leading dot)
|
|
181
|
+
* @returns MIME type string
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* getMimeType('jpg'); // 'image/jpeg'
|
|
186
|
+
* getMimeType('.png'); // 'image/png'
|
|
187
|
+
* getMimeType('unknown'); // 'application/octet-stream'
|
|
188
|
+
* getMimeType(undefined); // 'application/octet-stream'
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
declare function getMimeType(extension: string | undefined | null): string;
|
|
192
|
+
/**
|
|
193
|
+
* Get MIME type from a file path or filename.
|
|
194
|
+
*
|
|
195
|
+
* @param filePath - Full file path or filename
|
|
196
|
+
* @returns MIME type string
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* getMimeTypeFromPath('/path/to/image.jpg'); // 'image/jpeg'
|
|
201
|
+
* getMimeTypeFromPath('document.pdf'); // 'application/pdf'
|
|
202
|
+
* getMimeTypeFromPath('file-without-extension'); // 'application/octet-stream'
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
declare function getMimeTypeFromPath(filePath: string | undefined | null): string;
|
|
206
|
+
/**
|
|
207
|
+
* Check if a MIME type represents an image.
|
|
208
|
+
*/
|
|
209
|
+
declare function isImageMimeType(mimeType: string): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Check if a MIME type represents a video.
|
|
212
|
+
*/
|
|
213
|
+
declare function isVideoMimeType(mimeType: string): boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Check if a MIME type represents audio.
|
|
216
|
+
*/
|
|
217
|
+
declare function isAudioMimeType(mimeType: string): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Check if a MIME type represents a document (PDF, Office, etc.).
|
|
220
|
+
*/
|
|
221
|
+
declare function isDocumentMimeType(mimeType: string): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Get file extension from MIME type (reverse lookup).
|
|
224
|
+
* Returns the most common extension for the given MIME type.
|
|
225
|
+
*
|
|
226
|
+
* @param mimeType - MIME type string
|
|
227
|
+
* @returns File extension without leading dot, or undefined if unknown
|
|
228
|
+
*/
|
|
229
|
+
declare function getExtensionFromMimeType(mimeType: string): string | undefined;
|
|
14
230
|
|
|
15
231
|
/**
|
|
16
232
|
* Conflict Detection for @pol-studios/powersync
|
|
@@ -19,6 +235,16 @@ import 'react';
|
|
|
19
235
|
* Only queries AuditLog when version mismatch is detected.
|
|
20
236
|
*/
|
|
21
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Error thrown when conflict detection fails due to external issues
|
|
240
|
+
* (e.g., AuditLog query failure). Callers should handle this and decide
|
|
241
|
+
* whether to retry, fail the sync, or escalate to the user.
|
|
242
|
+
*/
|
|
243
|
+
declare class ConflictDetectionError extends Error {
|
|
244
|
+
constructor(message: string, options?: {
|
|
245
|
+
cause?: unknown;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
22
248
|
/**
|
|
23
249
|
* Detect conflicts between local pending changes and server state.
|
|
24
250
|
*
|
|
@@ -64,4 +290,4 @@ declare function fetchServerVersion(table: string, recordId: string, schema: str
|
|
|
64
290
|
*/
|
|
65
291
|
declare function getLocalVersion(table: string, recordId: string, db: AbstractPowerSyncDatabase): Promise<number | null>;
|
|
66
292
|
|
|
67
|
-
export { AbstractPowerSyncDatabase, ConflictCheckResult, ConflictDetectionConfig, detectConflicts, fetchServerVersion, getLocalVersion, hasVersionColumn };
|
|
293
|
+
export { AbortError, AbstractPowerSyncDatabase, type BackoffConfig, type BackoffOptions, ConflictCheckResult, ConflictDetectionConfig, ConflictDetectionError, DEFAULT_BACKOFF_CONFIG, RetryExhaustedError, addJitter, calculateBackoffDelay, detectConflicts, fetchServerVersion, formatBytes, getExtensionFromMimeType, getLocalVersion, getMimeType, getMimeTypeFromPath, hasVersionColumn, isAudioMimeType, isDocumentMimeType, isImageMimeType, isVideoMimeType, sleep, withExponentialBackoff };
|
package/dist/index.js
CHANGED
|
@@ -1,47 +1,117 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-KGSFAE5B.js";
|
|
2
|
+
import "./chunk-GKF7TOMT.js";
|
|
3
3
|
import {
|
|
4
|
-
AttachmentQueueContext,
|
|
5
4
|
ConflictBus,
|
|
5
|
+
OfflineDataProvider,
|
|
6
|
+
PowerSyncProvider,
|
|
7
|
+
ProviderBridge
|
|
8
|
+
} from "./chunk-BREGB4WL.js";
|
|
9
|
+
import {
|
|
10
|
+
PowerSyncErrorBoundary
|
|
11
|
+
} from "./chunk-P6WOZO7H.js";
|
|
12
|
+
import {
|
|
13
|
+
ATTACHMENT_TABLE,
|
|
14
|
+
AbstractAttachmentQueue,
|
|
15
|
+
AttachmentState,
|
|
16
|
+
AttachmentTable,
|
|
17
|
+
DEFAULT_ATTACHMENT_QUEUE_OPTIONS,
|
|
18
|
+
DEFAULT_CACHE_CONFIG,
|
|
19
|
+
DEFAULT_COMPRESSION_CONFIG,
|
|
20
|
+
DEFAULT_UPLOAD_CONFIG,
|
|
21
|
+
EncodingType,
|
|
22
|
+
PolAttachmentQueue,
|
|
23
|
+
PolAttachmentState,
|
|
24
|
+
PolStorageAdapter,
|
|
25
|
+
createPolAttachmentQueue
|
|
26
|
+
} from "./chunk-ZEOKPWUC.js";
|
|
27
|
+
import {
|
|
28
|
+
DeadLetterQueue,
|
|
29
|
+
createDeadLetterEntry,
|
|
30
|
+
defineBackgroundSyncTask,
|
|
31
|
+
generateDLQEntryId,
|
|
32
|
+
initializeBackgroundSync,
|
|
33
|
+
isBackgroundSyncRegistered,
|
|
34
|
+
registerBackgroundSync,
|
|
35
|
+
unregisterBackgroundSync
|
|
36
|
+
} from "./chunk-A4IBBWGO.js";
|
|
37
|
+
import {
|
|
38
|
+
DEFAULT_CONNECTION_HEALTH,
|
|
39
|
+
DEFAULT_SYNC_CONFIG,
|
|
40
|
+
DEFAULT_SYNC_METRICS,
|
|
41
|
+
DEFAULT_SYNC_STATUS,
|
|
42
|
+
HealthMonitor,
|
|
43
|
+
MetricsCollector,
|
|
44
|
+
SyncStatusTracker
|
|
45
|
+
} from "./chunk-H772V6XQ.js";
|
|
46
|
+
import {
|
|
47
|
+
checkIntegrityImpl,
|
|
48
|
+
checkStorageQuotaImpl,
|
|
49
|
+
compactDatabaseImpl,
|
|
50
|
+
formatBytes,
|
|
51
|
+
getCacheStatsImpl,
|
|
52
|
+
useDatabaseMaintenance
|
|
53
|
+
} from "./chunk-WGHNIAF7.js";
|
|
54
|
+
import {
|
|
55
|
+
AttachmentQueueContext,
|
|
56
|
+
CompletedTransactionsContext,
|
|
6
57
|
ConnectionHealthContext,
|
|
58
|
+
ConnectionStatusContext,
|
|
59
|
+
FailedTransactionsContext,
|
|
60
|
+
PendingMutationsContext,
|
|
7
61
|
PowerSyncContext,
|
|
8
|
-
|
|
62
|
+
SyncActivityContext,
|
|
9
63
|
SyncMetricsContext,
|
|
64
|
+
SyncModeContext,
|
|
10
65
|
SyncStatusContext,
|
|
11
66
|
useAttachmentQueue,
|
|
67
|
+
useAttachmentQueueReady,
|
|
68
|
+
useCompletedTransactions,
|
|
69
|
+
useCompletedTransactionsContext,
|
|
12
70
|
useConnectionHealth,
|
|
71
|
+
useConnectionStatus,
|
|
13
72
|
useDatabase,
|
|
14
73
|
useDownloadProgress,
|
|
15
74
|
useEntitySyncStatus,
|
|
75
|
+
useFailedTransactions,
|
|
76
|
+
useFailedTransactionsContext,
|
|
16
77
|
useIsSyncing,
|
|
17
78
|
useOnlineStatus,
|
|
18
79
|
usePendingMutations,
|
|
80
|
+
usePendingMutationsContext,
|
|
19
81
|
usePlatform,
|
|
20
82
|
usePowerSync,
|
|
21
83
|
useSyncActivity,
|
|
84
|
+
useSyncActivityContext,
|
|
22
85
|
useSyncControl,
|
|
23
86
|
useSyncMetrics,
|
|
24
87
|
useSyncMode,
|
|
88
|
+
useSyncModeContext,
|
|
25
89
|
useSyncStatus,
|
|
26
90
|
useUploadStatus
|
|
27
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-YSTEESEG.js";
|
|
92
|
+
import "./chunk-LNL64IJZ.js";
|
|
28
93
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
94
|
+
CacheSettingsManager,
|
|
95
|
+
DEFAULT_CACHE_SETTINGS,
|
|
96
|
+
SupabaseStorageAdapter,
|
|
97
|
+
createSupabaseStorageAdapter,
|
|
98
|
+
getExtensionFromMimeType,
|
|
99
|
+
getMimeType,
|
|
100
|
+
getMimeTypeFromPath,
|
|
101
|
+
isAudioMimeType,
|
|
102
|
+
isDocumentMimeType,
|
|
103
|
+
isImageMimeType,
|
|
104
|
+
isVideoMimeType
|
|
105
|
+
} from "./chunk-WQ5MPAVC.js";
|
|
106
|
+
import "./chunk-TGBT5XBE.js";
|
|
36
107
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} from "./chunk-OTJXIRWX.js";
|
|
108
|
+
SupabaseUploadHandler,
|
|
109
|
+
createSupabaseUploadHandler
|
|
110
|
+
} from "./chunk-UEYRTLKE.js";
|
|
111
|
+
import {
|
|
112
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
113
|
+
resolveBucketFromConfig
|
|
114
|
+
} from "./chunk-MKD2VCX3.js";
|
|
45
115
|
import "./chunk-W7HSR35B.js";
|
|
46
116
|
import {
|
|
47
117
|
ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
|
|
@@ -68,22 +138,39 @@ import {
|
|
|
68
138
|
STATUS_NOTIFY_THROTTLE_MS,
|
|
69
139
|
STORAGE_CRITICAL_THRESHOLD,
|
|
70
140
|
STORAGE_KEY_ATTACHMENT_SETTINGS,
|
|
141
|
+
STORAGE_KEY_AUTO_OFFLINE,
|
|
71
142
|
STORAGE_KEY_ENABLED,
|
|
72
143
|
STORAGE_KEY_METRICS,
|
|
73
144
|
STORAGE_KEY_PAUSED,
|
|
74
145
|
STORAGE_KEY_PREFIX,
|
|
75
146
|
STORAGE_KEY_SYNC_MODE,
|
|
76
147
|
STORAGE_WARNING_THRESHOLD
|
|
77
|
-
} from "./chunk-
|
|
78
|
-
import "./chunk-
|
|
148
|
+
} from "./chunk-CGL33PL4.js";
|
|
149
|
+
import "./chunk-53WH2JJV.js";
|
|
150
|
+
import {
|
|
151
|
+
CircuitBreaker,
|
|
152
|
+
CircuitOpenError,
|
|
153
|
+
DEFAULT_CIRCUIT_BREAKER_CONFIG
|
|
154
|
+
} from "./chunk-4C3RY5SU.js";
|
|
79
155
|
import {
|
|
156
|
+
ConflictDetectionError,
|
|
157
|
+
DEFAULT_RETRY_CONFIG,
|
|
80
158
|
SupabaseConnector,
|
|
81
159
|
defaultSchemaRouter,
|
|
82
160
|
detectConflicts,
|
|
83
161
|
fetchServerVersion,
|
|
84
162
|
getLocalVersion,
|
|
85
163
|
hasVersionColumn
|
|
86
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-HFOFLW5F.js";
|
|
165
|
+
import {
|
|
166
|
+
AbortError,
|
|
167
|
+
DEFAULT_BACKOFF_CONFIG,
|
|
168
|
+
RetryExhaustedError,
|
|
169
|
+
addJitter,
|
|
170
|
+
calculateBackoffDelay,
|
|
171
|
+
sleep,
|
|
172
|
+
withExponentialBackoff
|
|
173
|
+
} from "./chunk-FV2HXEIY.js";
|
|
87
174
|
import {
|
|
88
175
|
AttachmentError,
|
|
89
176
|
ConfigurationError,
|
|
@@ -99,39 +186,58 @@ import {
|
|
|
99
186
|
extractTableNames,
|
|
100
187
|
generateFailureId,
|
|
101
188
|
toSyncOperationError
|
|
102
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-XQAJM2MW.js";
|
|
190
|
+
import "./chunk-DGUM43GV.js";
|
|
103
191
|
export {
|
|
104
192
|
ATTACHMENT_DOWNLOAD_TIMEOUT_MS,
|
|
105
193
|
ATTACHMENT_RETRY_DELAY_MS,
|
|
194
|
+
ATTACHMENT_TABLE,
|
|
195
|
+
AbortError,
|
|
196
|
+
AbstractAttachmentQueue,
|
|
106
197
|
AttachmentError,
|
|
107
|
-
AttachmentQueue,
|
|
108
198
|
AttachmentQueueContext,
|
|
109
199
|
AttachmentState,
|
|
200
|
+
AttachmentTable,
|
|
110
201
|
COMPRESSION_MAX_WIDTH,
|
|
111
202
|
COMPRESSION_SKIP_SIZE_BYTES,
|
|
112
203
|
COMPRESSION_TARGET_SIZE_BYTES,
|
|
204
|
+
CacheSettingsManager,
|
|
205
|
+
CircuitBreaker,
|
|
206
|
+
CircuitOpenError,
|
|
207
|
+
CompletedTransactionsContext,
|
|
113
208
|
ConfigurationError,
|
|
114
209
|
ConflictBus,
|
|
210
|
+
ConflictDetectionError,
|
|
115
211
|
ConnectionHealthContext,
|
|
212
|
+
ConnectionStatusContext,
|
|
116
213
|
ConnectorError,
|
|
117
214
|
DEFAULT_ATTACHMENT_CACHE_SIZE,
|
|
118
215
|
DEFAULT_ATTACHMENT_CONCURRENCY,
|
|
216
|
+
DEFAULT_ATTACHMENT_QUEUE_OPTIONS,
|
|
217
|
+
DEFAULT_BACKOFF_CONFIG,
|
|
119
218
|
DEFAULT_CACHE_CONFIG,
|
|
219
|
+
DEFAULT_CACHE_SETTINGS,
|
|
220
|
+
DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
120
221
|
DEFAULT_COMPRESSION_CONFIG,
|
|
121
222
|
DEFAULT_COMPRESSION_QUALITY,
|
|
122
223
|
DEFAULT_CONNECTION_HEALTH,
|
|
123
|
-
DEFAULT_DOWNLOAD_CONFIG,
|
|
124
224
|
DEFAULT_MAX_RETRY_ATTEMPTS,
|
|
125
225
|
DEFAULT_RETRY_BACKOFF_MULTIPLIER,
|
|
126
226
|
DEFAULT_RETRY_BASE_DELAY_MS,
|
|
227
|
+
DEFAULT_RETRY_CONFIG,
|
|
127
228
|
DEFAULT_RETRY_MAX_DELAY_MS,
|
|
128
229
|
DEFAULT_SYNC_CONFIG,
|
|
129
230
|
DEFAULT_SYNC_INTERVAL_MS,
|
|
130
231
|
DEFAULT_SYNC_METRICS,
|
|
131
232
|
DEFAULT_SYNC_MODE,
|
|
132
233
|
DEFAULT_SYNC_STATUS,
|
|
234
|
+
DEFAULT_UPLOAD_CONFIG,
|
|
235
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
133
236
|
DOWNLOAD_STOP_THRESHOLD,
|
|
237
|
+
DeadLetterQueue,
|
|
134
238
|
EVICTION_TRIGGER_THRESHOLD,
|
|
239
|
+
EncodingType,
|
|
240
|
+
FailedTransactionsContext,
|
|
135
241
|
HEALTH_CHECK_INTERVAL_MS,
|
|
136
242
|
HEALTH_CHECK_TIMEOUT_MS,
|
|
137
243
|
HealthMonitor,
|
|
@@ -139,14 +245,23 @@ export {
|
|
|
139
245
|
LATENCY_DEGRADED_THRESHOLD_MS,
|
|
140
246
|
MAX_CONSECUTIVE_FAILURES,
|
|
141
247
|
MetricsCollector,
|
|
248
|
+
OfflineDataProvider,
|
|
249
|
+
PendingMutationsContext,
|
|
142
250
|
PlatformAdapterError,
|
|
251
|
+
PolAttachmentQueue,
|
|
252
|
+
PolAttachmentState,
|
|
253
|
+
PolStorageAdapter,
|
|
143
254
|
PowerSyncContext,
|
|
144
255
|
PowerSyncError,
|
|
256
|
+
PowerSyncErrorBoundary,
|
|
145
257
|
PowerSyncProvider,
|
|
258
|
+
ProviderBridge,
|
|
259
|
+
RetryExhaustedError,
|
|
146
260
|
STATS_CACHE_TTL_MS,
|
|
147
261
|
STATUS_NOTIFY_THROTTLE_MS,
|
|
148
262
|
STORAGE_CRITICAL_THRESHOLD,
|
|
149
263
|
STORAGE_KEY_ATTACHMENT_SETTINGS,
|
|
264
|
+
STORAGE_KEY_AUTO_OFFLINE,
|
|
150
265
|
STORAGE_KEY_ENABLED,
|
|
151
266
|
STORAGE_KEY_METRICS,
|
|
152
267
|
STORAGE_KEY_PAUSED,
|
|
@@ -154,37 +269,78 @@ export {
|
|
|
154
269
|
STORAGE_KEY_SYNC_MODE,
|
|
155
270
|
STORAGE_WARNING_THRESHOLD,
|
|
156
271
|
SupabaseConnector,
|
|
272
|
+
SupabaseStorageAdapter,
|
|
273
|
+
SupabaseUploadHandler,
|
|
274
|
+
SyncActivityContext,
|
|
157
275
|
SyncMetricsContext,
|
|
276
|
+
SyncModeContext,
|
|
158
277
|
SyncOperationError,
|
|
159
278
|
SyncStatusContext,
|
|
160
279
|
SyncStatusTracker,
|
|
280
|
+
addJitter,
|
|
281
|
+
calculateBackoffDelay,
|
|
282
|
+
checkIntegrityImpl,
|
|
283
|
+
checkStorageQuotaImpl,
|
|
161
284
|
classifyError,
|
|
162
285
|
classifySupabaseError,
|
|
286
|
+
compactDatabaseImpl,
|
|
287
|
+
createDeadLetterEntry,
|
|
288
|
+
createPolAttachmentQueue,
|
|
289
|
+
createSupabaseStorageAdapter,
|
|
290
|
+
createSupabaseUploadHandler,
|
|
163
291
|
createSyncError,
|
|
164
292
|
defaultSchemaRouter,
|
|
293
|
+
defineBackgroundSyncTask,
|
|
165
294
|
detectConflicts,
|
|
166
295
|
extractEntityIds,
|
|
167
296
|
extractTableNames,
|
|
168
297
|
fetchServerVersion,
|
|
298
|
+
formatBytes,
|
|
299
|
+
generateDLQEntryId,
|
|
169
300
|
generateFailureId,
|
|
301
|
+
getCacheStatsImpl,
|
|
302
|
+
getExtensionFromMimeType,
|
|
170
303
|
getLocalVersion,
|
|
304
|
+
getMimeType,
|
|
305
|
+
getMimeTypeFromPath,
|
|
171
306
|
hasVersionColumn,
|
|
307
|
+
initializeBackgroundSync,
|
|
308
|
+
isAudioMimeType,
|
|
309
|
+
isBackgroundSyncRegistered,
|
|
310
|
+
isDocumentMimeType,
|
|
311
|
+
isImageMimeType,
|
|
312
|
+
isVideoMimeType,
|
|
313
|
+
registerBackgroundSync,
|
|
314
|
+
resolveBucketFromConfig,
|
|
315
|
+
sleep,
|
|
172
316
|
toSyncOperationError,
|
|
317
|
+
unregisterBackgroundSync,
|
|
173
318
|
useAttachmentQueue,
|
|
319
|
+
useAttachmentQueueReady,
|
|
320
|
+
useCompletedTransactions,
|
|
321
|
+
useCompletedTransactionsContext,
|
|
174
322
|
useConnectionHealth,
|
|
323
|
+
useConnectionStatus,
|
|
175
324
|
useDatabase,
|
|
325
|
+
useDatabaseMaintenance,
|
|
176
326
|
useDownloadProgress,
|
|
177
327
|
useEntitySyncStatus,
|
|
328
|
+
useFailedTransactions,
|
|
329
|
+
useFailedTransactionsContext,
|
|
178
330
|
useIsSyncing,
|
|
179
331
|
useOnlineStatus,
|
|
180
332
|
usePendingMutations,
|
|
333
|
+
usePendingMutationsContext,
|
|
181
334
|
usePlatform,
|
|
182
335
|
usePowerSync,
|
|
183
336
|
useSyncActivity,
|
|
337
|
+
useSyncActivityContext,
|
|
184
338
|
useSyncControl,
|
|
185
339
|
useSyncMetrics,
|
|
186
340
|
useSyncMode,
|
|
341
|
+
useSyncModeContext,
|
|
187
342
|
useSyncStatus,
|
|
188
|
-
useUploadStatus
|
|
343
|
+
useUploadStatus,
|
|
344
|
+
withExponentialBackoff
|
|
189
345
|
};
|
|
190
346
|
//# sourceMappingURL=index.js.map
|
package/dist/index.native.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
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-
|
|
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 {
|
|
4
|
-
export {
|
|
5
|
-
export { e as
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
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, toSyncOperationError } from './core/index.js';
|
|
3
|
+
export { g as ConflictBus, h as ConflictCheckResult, k as ConflictDetectionConfig, j as ConflictHandler, l as ConflictListener, i as ConflictResolution, C as ConnectorCircuitBreakerConfig, b as ConnectorConfig, e as CrudHandler, D as DEFAULT_RETRY_CONFIG, F as FieldConflict, P as PowerSyncCredentials, m as ResolutionListener, f as RetryConfig, R as RetryStrategyConfig, c as SchemaRouter, S as SupabaseConnector, a as SupabaseConnectorOptions, d as defaultSchemaRouter } from './supabase-connector-qLm-WHkM.js';
|
|
4
|
+
export { CircuitBreaker, CircuitBreakerConfig, CircuitBreakerStats, CircuitOpenError, CircuitState, DEFAULT_CIRCUIT_BREAKER_CONFIG } from './connector/index.js';
|
|
5
|
+
export { t as AttachmentRecord, A as AttachmentSourceConfig, q as AttachmentStatsRow, e as AttachmentStorageAdapter, p as AttachmentSyncStats, o as AttachmentSyncStatus, h as CacheConfig, r as CacheFileRow, s as CachedSizeRow, C as CompressionConfig, i as DEFAULT_CACHE_CONFIG, D as DEFAULT_COMPRESSION_CONFIG, f as DEFAULT_UPLOAD_CONFIG, k as DownloadPhase, l as DownloadStatus, E as EvictRow, I as IdRow, P as PolAttachmentQueue, j as PolAttachmentQueueConfig, a as PolAttachmentQueueOptions, d as PolAttachmentRecord, b as PolAttachmentState, U as UploadConfig, g as UploadHandler, m as UploadPhase, n as UploadStatus, c as createPolAttachmentQueue } from './pol-attachment-queue-C7YNXXhK.js';
|
|
6
|
+
export { PolStorageAdapter, PolStorageAdapterOptions } from './attachments/index.js';
|
|
7
|
+
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';
|
|
8
|
+
export { DeadLetterEntry, DeadLetterQueue, DeadLetterQueueListener, DeadLetterQueueOptions, DeadLetterReason, HealthMonitor, MetricsCollector, SyncStatusTracker, createDeadLetterEntry, generateDLQEntryId } from './sync/index.js';
|
|
9
|
+
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';
|
|
10
|
+
export { DatabaseMaintenanceUtils, checkIntegrityImpl, checkStorageQuotaImpl, compactDatabaseImpl, getCacheStatsImpl, useDatabaseMaintenance } from './maintenance/index.js';
|
|
11
|
+
export { A as AttachmentUploadHandler, a as BucketConfig, B as BucketResolver, D as DownloadResult, P as PowerSyncStorageAdapter, R as RemoteStorageAdapter, S as StorageUploadHandler, b as SupabaseStorageAdapterOptions, U as UploadOptions, r as resolveBucketFromConfig } from './types-Bgvx7-E8.js';
|
|
12
|
+
export { a as CacheSettings, C as CacheSettingsManager, b as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, S as SupabaseStorageAdapter, c as createSupabaseStorageAdapter } from './CacheSettingsManager-1exbOC6S.js';
|
|
13
|
+
export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from './types-BVacP54t.js';
|
|
14
|
+
export { SupabaseUploadHandler, createSupabaseUploadHandler } from './storage/upload/index.js';
|
|
15
|
+
export { PowerSyncErrorBoundary } from './error/index.js';
|
|
16
|
+
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';
|
|
9
17
|
export { AsyncStorageAdapter, CompressedImage, CompressionOptions, ConnectionType, DatabaseOptions, FileInfo, FileSystemAdapter, ImageProcessorAdapter, LoggerAdapter, NetworkAdapter, PlatformAdapter, PlatformType, detectPlatform } from './platform/index.js';
|
|
10
18
|
export { createNativePlatformAdapter } from './platform/index.native.js';
|
|
19
|
+
export { ATTACHMENT_TABLE, AbstractAttachmentQueue, AttachmentState, AttachmentTable, AttachmentTableOptions, AttachmentQueueOptions as BaseAttachmentQueueOptions, DEFAULT_ATTACHMENT_QUEUE_OPTIONS, EncodingType, AttachmentRecord as OfficialAttachmentRecord, StorageAdapter } from '@powersync/attachments';
|
|
11
20
|
import '@supabase/supabase-js';
|
|
12
|
-
import '@
|
|
21
|
+
import '@powersync/common';
|
|
13
22
|
import 'react';
|
|
23
|
+
import '@tanstack/react-query';
|
|
24
|
+
import '@powersync/react-native';
|