@pol-studios/powersync 1.0.6 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +933 -0
- package/dist/CacheSettingsManager-uz-kbnRH.d.ts +461 -0
- package/dist/attachments/index.d.ts +745 -332
- package/dist/attachments/index.js +152 -6
- package/dist/{types-Cd7RhNqf.d.ts → background-sync-ChCXW-EV.d.ts} +53 -2
- package/dist/chunk-24RDMMCL.js +44 -0
- package/dist/chunk-24RDMMCL.js.map +1 -0
- package/dist/chunk-4TXTAEF2.js +2060 -0
- package/dist/chunk-4TXTAEF2.js.map +1 -0
- package/dist/chunk-63PXSPIN.js +358 -0
- package/dist/chunk-63PXSPIN.js.map +1 -0
- package/dist/chunk-654ERHA7.js +1 -0
- package/dist/chunk-A4IBBWGO.js +377 -0
- package/dist/chunk-A4IBBWGO.js.map +1 -0
- package/dist/chunk-BRXQNASY.js +1720 -0
- package/dist/chunk-BRXQNASY.js.map +1 -0
- package/dist/chunk-CAB26E6F.js +142 -0
- package/dist/chunk-CAB26E6F.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-R4YFWQ3Q.js → chunk-CUCAYK7Z.js} +309 -92
- package/dist/chunk-CUCAYK7Z.js.map +1 -0
- package/dist/chunk-FV2HXEIY.js +124 -0
- package/dist/chunk-FV2HXEIY.js.map +1 -0
- package/dist/chunk-HWSNV45P.js +279 -0
- package/dist/chunk-HWSNV45P.js.map +1 -0
- package/dist/{chunk-62J2DPKX.js → chunk-KN2IZERF.js} +530 -413
- package/dist/chunk-KN2IZERF.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-P4HZA6ZT.js +83 -0
- package/dist/chunk-P4HZA6ZT.js.map +1 -0
- package/dist/chunk-P6WOZO7H.js +49 -0
- package/dist/chunk-P6WOZO7H.js.map +1 -0
- package/dist/chunk-T4AO7JIG.js +1 -0
- package/dist/chunk-TGBT5XBE.js +1 -0
- package/dist/{chunk-FPTDATY5.js → chunk-VACPAAQZ.js} +54 -12
- package/dist/chunk-VACPAAQZ.js.map +1 -0
- package/dist/chunk-WGHNIAF7.js +329 -0
- package/dist/chunk-WGHNIAF7.js.map +1 -0
- package/dist/{chunk-3AYXHQ4W.js → chunk-WN5ZJ3E2.js} +108 -47
- package/dist/chunk-WN5ZJ3E2.js.map +1 -0
- package/dist/chunk-XAEII4ZX.js +456 -0
- package/dist/chunk-XAEII4ZX.js.map +1 -0
- package/dist/chunk-XOY2CJ67.js +289 -0
- package/dist/chunk-XOY2CJ67.js.map +1 -0
- package/dist/chunk-YHTZ7VMV.js +1 -0
- package/dist/chunk-YSTEESEG.js +676 -0
- package/dist/chunk-YSTEESEG.js.map +1 -0
- package/dist/chunk-Z6VOBGTU.js +32 -0
- package/dist/chunk-Z6VOBGTU.js.map +1 -0
- package/dist/chunk-ZM4ENYMF.js +230 -0
- package/dist/chunk-ZM4ENYMF.js.map +1 -0
- package/dist/connector/index.d.ts +236 -4
- package/dist/connector/index.js +15 -4
- package/dist/core/index.d.ts +16 -3
- package/dist/core/index.js +6 -2
- package/dist/error/index.d.ts +54 -0
- package/dist/error/index.js +7 -0
- package/dist/error/index.js.map +1 -0
- package/dist/index.d.ts +102 -12
- package/dist/index.js +309 -37
- package/dist/index.native.d.ts +22 -10
- package/dist/index.native.js +309 -38
- package/dist/index.web.d.ts +22 -10
- package/dist/index.web.js +310 -38
- package/dist/maintenance/index.d.ts +118 -0
- package/dist/maintenance/index.js +16 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/platform/index.d.ts +16 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/index.native.d.ts +2 -2
- package/dist/platform/index.native.js +1 -1
- package/dist/platform/index.web.d.ts +1 -1
- package/dist/platform/index.web.js +1 -1
- package/dist/pol-attachment-queue-BVAIueoP.d.ts +817 -0
- package/dist/provider/index.d.ts +451 -21
- package/dist/provider/index.js +32 -13
- package/dist/react/index.d.ts +372 -0
- package/dist/react/index.js +25 -0
- package/dist/react/index.js.map +1 -0
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.js +42 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/index.native.d.ts +6 -0
- package/dist/storage/index.native.js +40 -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 +40 -0
- package/dist/storage/index.web.js.map +1 -0
- package/dist/storage/upload/index.d.ts +54 -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 +56 -0
- package/dist/storage/upload/index.native.js +15 -0
- package/dist/storage/upload/index.native.js.map +1 -0
- package/dist/storage/upload/index.web.d.ts +2 -0
- package/dist/storage/upload/index.web.js +14 -0
- package/dist/storage/upload/index.web.js.map +1 -0
- package/dist/supabase-connector-T9vHq_3i.d.ts +202 -0
- package/dist/sync/index.d.ts +288 -23
- package/dist/sync/index.js +22 -10
- package/dist/{index-l3iL9Jte.d.ts → types-B212hgfA.d.ts} +101 -158
- package/dist/{types-afHtE1U_.d.ts → types-CDqWh56B.d.ts} +2 -0
- package/dist/types-CyvBaAl8.d.ts +60 -0
- package/dist/types-D0WcHrq6.d.ts +234 -0
- package/package.json +89 -5
- package/dist/chunk-32OLICZO.js +0 -1
- package/dist/chunk-3AYXHQ4W.js.map +0 -1
- package/dist/chunk-5FIMA26D.js +0 -1
- package/dist/chunk-62J2DPKX.js.map +0 -1
- package/dist/chunk-7EMDVIZX.js.map +0 -1
- package/dist/chunk-EJ23MXPQ.js.map +0 -1
- package/dist/chunk-FPTDATY5.js.map +0 -1
- package/dist/chunk-KCDG2MNP.js +0 -1431
- package/dist/chunk-KCDG2MNP.js.map +0 -1
- package/dist/chunk-OLHGI472.js +0 -1
- package/dist/chunk-PAFBKNL3.js +0 -99
- package/dist/chunk-PAFBKNL3.js.map +0 -1
- package/dist/chunk-R4YFWQ3Q.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/failed-upload-store-C0cLxxPz.d.ts +0 -33
- /package/dist/{chunk-32OLICZO.js.map → chunk-654ERHA7.js.map} +0 -0
- /package/dist/{chunk-5FIMA26D.js.map → chunk-T4AO7JIG.js.map} +0 -0
- /package/dist/{chunk-OLHGI472.js.map → chunk-TGBT5XBE.js.map} +0 -0
- /package/dist/{chunk-VJCL2SWD.js.map → chunk-YHTZ7VMV.js.map} +0 -0
package/dist/provider/index.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OfflineDataProvider,
|
|
3
|
+
PowerSyncProvider,
|
|
4
|
+
ProviderBridge
|
|
5
|
+
} from "../chunk-BRXQNASY.js";
|
|
6
|
+
import "../chunk-YHTZ7VMV.js";
|
|
7
|
+
import "../chunk-P6WOZO7H.js";
|
|
8
|
+
import "../chunk-4TXTAEF2.js";
|
|
9
|
+
import "../chunk-CUCAYK7Z.js";
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_CONNECTION_HEALTH,
|
|
12
|
+
DEFAULT_SYNC_CONFIG,
|
|
13
|
+
DEFAULT_SYNC_METRICS,
|
|
14
|
+
DEFAULT_SYNC_STATUS
|
|
15
|
+
} from "../chunk-24RDMMCL.js";
|
|
1
16
|
import {
|
|
2
17
|
AttachmentQueueContext,
|
|
3
18
|
CompletedTransactionsContext,
|
|
@@ -6,18 +21,20 @@ import {
|
|
|
6
21
|
FailedTransactionsContext,
|
|
7
22
|
PendingMutationsContext,
|
|
8
23
|
PowerSyncContext,
|
|
9
|
-
PowerSyncProvider,
|
|
10
24
|
SyncActivityContext,
|
|
11
25
|
SyncMetricsContext,
|
|
12
26
|
SyncModeContext,
|
|
13
27
|
SyncStatusContext,
|
|
14
28
|
useAttachmentQueue,
|
|
29
|
+
useAttachmentQueueReady,
|
|
30
|
+
useCompletedTransactions,
|
|
15
31
|
useCompletedTransactionsContext,
|
|
16
32
|
useConnectionHealth,
|
|
17
33
|
useConnectionStatus,
|
|
18
34
|
useDatabase,
|
|
19
35
|
useDownloadProgress,
|
|
20
36
|
useEntitySyncStatus,
|
|
37
|
+
useFailedTransactions,
|
|
21
38
|
useFailedTransactionsContext,
|
|
22
39
|
useIsSyncing,
|
|
23
40
|
useOnlineStatus,
|
|
@@ -33,18 +50,15 @@ import {
|
|
|
33
50
|
useSyncModeContext,
|
|
34
51
|
useSyncStatus,
|
|
35
52
|
useUploadStatus
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
38
|
-
import
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-62J2DPKX.js";
|
|
46
|
-
import "../chunk-PAFBKNL3.js";
|
|
47
|
-
import "../chunk-FPTDATY5.js";
|
|
53
|
+
} from "../chunk-YSTEESEG.js";
|
|
54
|
+
import "../chunk-CAB26E6F.js";
|
|
55
|
+
import "../chunk-XAEII4ZX.js";
|
|
56
|
+
import "../chunk-Z6VOBGTU.js";
|
|
57
|
+
import "../chunk-CGL33PL4.js";
|
|
58
|
+
import "../chunk-WN5ZJ3E2.js";
|
|
59
|
+
import "../chunk-KN2IZERF.js";
|
|
60
|
+
import "../chunk-FV2HXEIY.js";
|
|
61
|
+
import "../chunk-VACPAAQZ.js";
|
|
48
62
|
export {
|
|
49
63
|
AttachmentQueueContext,
|
|
50
64
|
CompletedTransactionsContext,
|
|
@@ -55,20 +69,25 @@ export {
|
|
|
55
69
|
DEFAULT_SYNC_METRICS,
|
|
56
70
|
DEFAULT_SYNC_STATUS,
|
|
57
71
|
FailedTransactionsContext,
|
|
72
|
+
OfflineDataProvider,
|
|
58
73
|
PendingMutationsContext,
|
|
59
74
|
PowerSyncContext,
|
|
60
75
|
PowerSyncProvider,
|
|
76
|
+
ProviderBridge,
|
|
61
77
|
SyncActivityContext,
|
|
62
78
|
SyncMetricsContext,
|
|
63
79
|
SyncModeContext,
|
|
64
80
|
SyncStatusContext,
|
|
65
81
|
useAttachmentQueue,
|
|
82
|
+
useAttachmentQueueReady,
|
|
83
|
+
useCompletedTransactions,
|
|
66
84
|
useCompletedTransactionsContext,
|
|
67
85
|
useConnectionHealth,
|
|
68
86
|
useConnectionStatus,
|
|
69
87
|
useDatabase,
|
|
70
88
|
useDownloadProgress,
|
|
71
89
|
useEntitySyncStatus,
|
|
90
|
+
useFailedTransactions,
|
|
72
91
|
useFailedTransactionsContext,
|
|
73
92
|
useIsSyncing,
|
|
74
93
|
useOnlineStatus,
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { ReactNode } from 'react';
|
|
3
|
+
import { Schema } from '@powersync/react-native';
|
|
4
|
+
import { A as AuthProvider } from '../types-B212hgfA.js';
|
|
5
|
+
import { a as StorageBackend } from '../types-D0WcHrq6.js';
|
|
6
|
+
import { e as AttachmentConfig, P as PolAttachmentQueue } from '../pol-attachment-queue-BVAIueoP.js';
|
|
7
|
+
import { PlatformAdapter } from '../platform/index.js';
|
|
8
|
+
import { f as SyncError, a as SyncStatus, A as AbstractPowerSyncDatabase } from '../types-CDqWh56B.js';
|
|
9
|
+
import '@supabase/supabase-js';
|
|
10
|
+
import '@powersync/attachments';
|
|
11
|
+
import '@powersync/common';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Types for the slim PowerSyncProvider
|
|
15
|
+
*
|
|
16
|
+
* This module contains type definitions for the new simplified provider API.
|
|
17
|
+
* The types here are designed for zero domain coupling - all domain-specific
|
|
18
|
+
* logic should be handled via callbacks at the consumer level.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* PowerSync provider configuration.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const config: PowerSyncConfig = {
|
|
27
|
+
* schema: AppSchema,
|
|
28
|
+
* powerSyncUrl: 'https://my-instance.powersync.journeyapps.com',
|
|
29
|
+
* dbFilename: 'myapp.db',
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
interface PowerSyncConfig {
|
|
34
|
+
/**
|
|
35
|
+
* PowerSync schema definition.
|
|
36
|
+
* Defines the tables and their structure for the local database.
|
|
37
|
+
*/
|
|
38
|
+
schema: Schema;
|
|
39
|
+
/**
|
|
40
|
+
* PowerSync service URL.
|
|
41
|
+
* @example "https://your-instance.powersync.journeyapps.com"
|
|
42
|
+
*/
|
|
43
|
+
powerSyncUrl: string;
|
|
44
|
+
/**
|
|
45
|
+
* Database filename.
|
|
46
|
+
* @default "powersync.db"
|
|
47
|
+
*/
|
|
48
|
+
dbFilename?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Props for the slim PowerSyncProvider.
|
|
52
|
+
*
|
|
53
|
+
* This provider is designed to be minimal and composable:
|
|
54
|
+
* - No @pol/db coupling
|
|
55
|
+
* - No domain-specific logic
|
|
56
|
+
* - All callbacks are optional
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* <PowerSyncProvider
|
|
61
|
+
* config={{
|
|
62
|
+
* schema: AppSchema,
|
|
63
|
+
* powerSyncUrl: POWERSYNC_URL,
|
|
64
|
+
* dbFilename: 'myapp.db',
|
|
65
|
+
* }}
|
|
66
|
+
* auth={supabaseAuth}
|
|
67
|
+
* storage={supabaseStorage}
|
|
68
|
+
* attachments={{
|
|
69
|
+
* watch: {
|
|
70
|
+
* table: 'MediaContent',
|
|
71
|
+
* idColumn: 'storagePath',
|
|
72
|
+
* },
|
|
73
|
+
* }}
|
|
74
|
+
* onError={(error) => console.error(error)}
|
|
75
|
+
* onReady={() => console.log('Ready!')}
|
|
76
|
+
* >
|
|
77
|
+
* <App />
|
|
78
|
+
* </PowerSyncProvider>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
interface PowerSyncProviderProps {
|
|
82
|
+
/**
|
|
83
|
+
* PowerSync configuration.
|
|
84
|
+
*/
|
|
85
|
+
config: PowerSyncConfig;
|
|
86
|
+
/**
|
|
87
|
+
* Authentication provider.
|
|
88
|
+
* Abstracts auth for the connector - works with any auth backend.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* import { createSupabaseAuth } from '@pol-studios/powersync';
|
|
93
|
+
* const auth = createSupabaseAuth(supabaseClient);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
auth: AuthProvider;
|
|
97
|
+
/**
|
|
98
|
+
* Storage backend for attachments (required if using attachments).
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import { createSupabaseStorage } from '@pol-studios/powersync';
|
|
103
|
+
* const storage = createSupabaseStorage({
|
|
104
|
+
* client: supabaseClient,
|
|
105
|
+
* defaultBucket: 'attachments',
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
storage?: StorageBackend;
|
|
110
|
+
/**
|
|
111
|
+
* Attachment configuration.
|
|
112
|
+
* Zero domain coupling - use skipDownload callback for domain-specific filtering.
|
|
113
|
+
*/
|
|
114
|
+
attachments?: AttachmentConfig;
|
|
115
|
+
/**
|
|
116
|
+
* Platform adapter (auto-detected if omitted).
|
|
117
|
+
* Use createNativePlatformAdapter() for React Native.
|
|
118
|
+
*/
|
|
119
|
+
platform?: PlatformAdapter;
|
|
120
|
+
/**
|
|
121
|
+
* Error handler for sync failures.
|
|
122
|
+
* Receives structured errors with classification and user messages.
|
|
123
|
+
*/
|
|
124
|
+
onError?: (error: SyncError) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Called when PowerSync is initialized and ready.
|
|
127
|
+
*/
|
|
128
|
+
onReady?: () => void;
|
|
129
|
+
/**
|
|
130
|
+
* Called when sync status changes.
|
|
131
|
+
*/
|
|
132
|
+
onSyncStatusChange?: (status: SyncStatus) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Child components to render.
|
|
135
|
+
*/
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Value provided by the main PowerSyncContext.
|
|
140
|
+
*/
|
|
141
|
+
interface PowerSyncContextValue {
|
|
142
|
+
/**
|
|
143
|
+
* The PowerSync database instance.
|
|
144
|
+
* Will be null if not initialized or if initialization failed.
|
|
145
|
+
*/
|
|
146
|
+
db: AbstractPowerSyncDatabase | null;
|
|
147
|
+
/**
|
|
148
|
+
* Whether the PowerSync database is ready for use.
|
|
149
|
+
*/
|
|
150
|
+
isReady: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the provider is currently initializing.
|
|
153
|
+
*/
|
|
154
|
+
isInitializing: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Error that occurred during initialization, if any.
|
|
157
|
+
*/
|
|
158
|
+
error: Error | null;
|
|
159
|
+
/**
|
|
160
|
+
* The platform adapter instance.
|
|
161
|
+
*/
|
|
162
|
+
platform: PlatformAdapter;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Value provided by the SyncStatusContext.
|
|
166
|
+
*/
|
|
167
|
+
interface SyncStatusContextValue {
|
|
168
|
+
/**
|
|
169
|
+
* Current sync status.
|
|
170
|
+
*/
|
|
171
|
+
status: SyncStatus;
|
|
172
|
+
/**
|
|
173
|
+
* Timestamp of the last successful sync.
|
|
174
|
+
*/
|
|
175
|
+
lastSyncedAt: Date | null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Value provided by the AttachmentQueueContext.
|
|
179
|
+
*/
|
|
180
|
+
interface AttachmentQueueContextValue {
|
|
181
|
+
/**
|
|
182
|
+
* The attachment queue instance.
|
|
183
|
+
* Will be null if attachments are not configured or not initialized.
|
|
184
|
+
*/
|
|
185
|
+
queue: PolAttachmentQueue | null;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the attachment queue is ready for use.
|
|
188
|
+
*/
|
|
189
|
+
isReady: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Slim PowerSyncProvider for @pol-studios/powersync
|
|
194
|
+
*
|
|
195
|
+
* A simplified, composable provider that:
|
|
196
|
+
* - Has zero @pol/db coupling
|
|
197
|
+
* - Uses AuthProvider interface for any auth backend
|
|
198
|
+
* - Delegates domain logic to callbacks
|
|
199
|
+
* - Is ~150 lines vs 1400+ in the legacy provider
|
|
200
|
+
*
|
|
201
|
+
* For backwards compatibility, the legacy OfflineDataProvider is still available.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Slim PowerSyncProvider - minimal, composable, no domain coupling.
|
|
206
|
+
*
|
|
207
|
+
* This provider handles:
|
|
208
|
+
* - Database initialization via platform adapter
|
|
209
|
+
* - Connector setup using AuthProvider
|
|
210
|
+
* - Attachment queue initialization (if configured)
|
|
211
|
+
* - Sync status tracking
|
|
212
|
+
* - Error classification and callbacks
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```tsx
|
|
216
|
+
* import { PowerSyncProvider, createSupabaseAuth, createSupabaseStorage } from '@pol-studios/powersync/react';
|
|
217
|
+
*
|
|
218
|
+
* function App() {
|
|
219
|
+
* const auth = useMemo(() => createSupabaseAuth(supabase), [supabase]);
|
|
220
|
+
* const storage = useMemo(() => createSupabaseStorage({
|
|
221
|
+
* client: supabase,
|
|
222
|
+
* defaultBucket: 'attachments',
|
|
223
|
+
* }), [supabase]);
|
|
224
|
+
*
|
|
225
|
+
* return (
|
|
226
|
+
* <PowerSyncProvider
|
|
227
|
+
* config={{ schema: AppSchema, powerSyncUrl: URL, dbFilename: 'app.db' }}
|
|
228
|
+
* auth={auth}
|
|
229
|
+
* storage={storage}
|
|
230
|
+
* attachments={{ watch: { table: 'Media', idColumn: 'storagePath' } }}
|
|
231
|
+
* onError={(error) => showToast(error.userMessage)}
|
|
232
|
+
* onReady={() => console.log('Ready!')}
|
|
233
|
+
* >
|
|
234
|
+
* <MyApp />
|
|
235
|
+
* </PowerSyncProvider>
|
|
236
|
+
* );
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare function SlimPowerSyncProvider({ config, auth, storage, attachments, platform: customPlatform, onError, onReady, onSyncStatusChange, children, }: PowerSyncProviderProps): react__default.ReactElement;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Main context for PowerSync database instance and initialization state.
|
|
244
|
+
*
|
|
245
|
+
* Provides access to:
|
|
246
|
+
* - PowerSync database instance
|
|
247
|
+
* - Initialization state (isReady, isInitializing, error)
|
|
248
|
+
* - Platform adapter
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* import { useContext } from 'react';
|
|
253
|
+
* import { PowerSyncContext } from '@pol-studios/powersync/react';
|
|
254
|
+
*
|
|
255
|
+
* function MyComponent() {
|
|
256
|
+
* const { db, isReady, error } = useContext(PowerSyncContext);
|
|
257
|
+
* if (!isReady) return <Loading />;
|
|
258
|
+
* if (error) return <Error message={error.message} />;
|
|
259
|
+
* // Use db...
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
declare const PowerSyncContext: react.Context<PowerSyncContextValue>;
|
|
264
|
+
/**
|
|
265
|
+
* Context for sync status updates.
|
|
266
|
+
*
|
|
267
|
+
* Provides access to:
|
|
268
|
+
* - Current sync status (connected, syncing, etc.)
|
|
269
|
+
* - Last synced timestamp
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* import { useContext } from 'react';
|
|
274
|
+
* import { SyncStatusContext } from '@pol-studios/powersync/react';
|
|
275
|
+
*
|
|
276
|
+
* function SyncIndicator() {
|
|
277
|
+
* const { status, lastSyncedAt } = useContext(SyncStatusContext);
|
|
278
|
+
* return (
|
|
279
|
+
* <View>
|
|
280
|
+
* {status.connected ? 'Connected' : 'Offline'}
|
|
281
|
+
* {lastSyncedAt && <Text>Last synced: {lastSyncedAt.toISOString()}</Text>}
|
|
282
|
+
* </View>
|
|
283
|
+
* );
|
|
284
|
+
* }
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
declare const SyncStatusContext: react.Context<SyncStatusContextValue>;
|
|
288
|
+
/**
|
|
289
|
+
* Context for the attachment queue (if configured).
|
|
290
|
+
*
|
|
291
|
+
* Provides access to:
|
|
292
|
+
* - AttachmentQueue instance for checking stats, pausing/resuming downloads
|
|
293
|
+
* - Ready state for the attachment queue
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* import { useContext } from 'react';
|
|
298
|
+
* import { AttachmentQueueContext } from '@pol-studios/powersync/react';
|
|
299
|
+
*
|
|
300
|
+
* function AttachmentStatus() {
|
|
301
|
+
* const { queue, isReady } = useContext(AttachmentQueueContext);
|
|
302
|
+
* if (!isReady || !queue) return null;
|
|
303
|
+
*
|
|
304
|
+
* const stats = await queue.getStats();
|
|
305
|
+
* return <Text>Downloaded: {stats.syncedCount}/{stats.totalExpected}</Text>;
|
|
306
|
+
* }
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
declare const AttachmentQueueContext: react.Context<AttachmentQueueContextValue>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* React Module for @pol-studios/powersync
|
|
313
|
+
*
|
|
314
|
+
* This module exports the new slim PowerSyncProvider and related contexts/types.
|
|
315
|
+
* For backwards compatibility, the legacy OfflineDataProvider is still available
|
|
316
|
+
* from the main package export.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```typescript
|
|
320
|
+
* import {
|
|
321
|
+
* PowerSyncProvider,
|
|
322
|
+
* usePowerSyncContext,
|
|
323
|
+
* useSyncStatusContext,
|
|
324
|
+
* useAttachmentQueueContext,
|
|
325
|
+
* } from '@pol-studios/powersync/react';
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Hook to access the PowerSync context.
|
|
331
|
+
* Throws if used outside of a PowerSyncProvider.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* function MyComponent() {
|
|
336
|
+
* const { db, isReady, error } = usePowerSyncContext();
|
|
337
|
+
* if (!isReady) return <Loading />;
|
|
338
|
+
* if (error) return <Error message={error.message} />;
|
|
339
|
+
* // Use db...
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
declare function usePowerSyncContext(): PowerSyncContextValue;
|
|
344
|
+
/**
|
|
345
|
+
* Hook to access sync status.
|
|
346
|
+
* Throws if used outside of a PowerSyncProvider.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```typescript
|
|
350
|
+
* function SyncIndicator() {
|
|
351
|
+
* const { status, lastSyncedAt } = useSyncStatusContext();
|
|
352
|
+
* return <Text>{status.connected ? 'Online' : 'Offline'}</Text>;
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
declare function useSyncStatusContext(): SyncStatusContextValue;
|
|
357
|
+
/**
|
|
358
|
+
* Hook to access the attachment queue.
|
|
359
|
+
* Throws if used outside of a PowerSyncProvider.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* function AttachmentStatus() {
|
|
364
|
+
* const { queue, isReady } = useAttachmentQueueContext();
|
|
365
|
+
* if (!isReady || !queue) return null;
|
|
366
|
+
* // Use queue...
|
|
367
|
+
* }
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare function useAttachmentQueueContext(): AttachmentQueueContextValue;
|
|
371
|
+
|
|
372
|
+
export { AttachmentQueueContext, type AttachmentQueueContextValue, type PowerSyncConfig, PowerSyncContext, type PowerSyncContextValue, SlimPowerSyncProvider as PowerSyncProvider, type PowerSyncProviderProps, SlimPowerSyncProvider, SyncStatusContext, type SyncStatusContextValue, useAttachmentQueueContext, usePowerSyncContext, useSyncStatusContext };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AttachmentQueueContext,
|
|
3
|
+
PowerSyncContext,
|
|
4
|
+
SlimPowerSyncProvider,
|
|
5
|
+
SyncStatusContext,
|
|
6
|
+
useAttachmentQueueContext,
|
|
7
|
+
usePowerSyncContext,
|
|
8
|
+
useSyncStatusContext
|
|
9
|
+
} from "../chunk-63PXSPIN.js";
|
|
10
|
+
import "../chunk-4TXTAEF2.js";
|
|
11
|
+
import "../chunk-24RDMMCL.js";
|
|
12
|
+
import "../chunk-KN2IZERF.js";
|
|
13
|
+
import "../chunk-FV2HXEIY.js";
|
|
14
|
+
import "../chunk-VACPAAQZ.js";
|
|
15
|
+
export {
|
|
16
|
+
AttachmentQueueContext,
|
|
17
|
+
PowerSyncContext,
|
|
18
|
+
SlimPowerSyncProvider as PowerSyncProvider,
|
|
19
|
+
SlimPowerSyncProvider,
|
|
20
|
+
SyncStatusContext,
|
|
21
|
+
useAttachmentQueueContext,
|
|
22
|
+
usePowerSyncContext,
|
|
23
|
+
useSyncStatusContext
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { D as DownloadResult, a as StorageBackend, b as StorageUploadOptions, d as SupabaseClient, S as SupabaseStorage, c as SupabaseStorageOptions, e as SupabaseTransformOptions, U as UploadProgress, r as resolveBucket } from '../types-D0WcHrq6.js';
|
|
2
|
+
export { f as CacheSettings, C as CacheSettingsManager, h as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, I as ImageTransformOptions, S as SupabaseStorageAdapter, e as SupabaseStorageAdapterOptions, c as createSupabaseStorage, d as createSupabaseStorageAdapter, g as getStorageErrorMessage, a as isBlobResult, i as isFileResult, b as isStorageAuthError, n as normalizeStoragePath } from '../CacheSettingsManager-uz-kbnRH.js';
|
|
3
|
+
export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from '../types-CyvBaAl8.js';
|
|
4
|
+
export { SupabaseUploadHandler, createSupabaseUploadHandler } from './upload/index.js';
|
|
5
|
+
import '../platform/index.js';
|
|
6
|
+
import '../types-CDqWh56B.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "../chunk-T4AO7JIG.js";
|
|
2
|
+
import {
|
|
3
|
+
CacheSettingsManager,
|
|
4
|
+
DEFAULT_CACHE_SETTINGS,
|
|
5
|
+
createSupabaseStorage,
|
|
6
|
+
isBlobResult,
|
|
7
|
+
isFileResult
|
|
8
|
+
} from "../chunk-XOY2CJ67.js";
|
|
9
|
+
import {
|
|
10
|
+
SupabaseStorageAdapter,
|
|
11
|
+
createSupabaseStorageAdapter,
|
|
12
|
+
getStorageErrorMessage,
|
|
13
|
+
isStorageAuthError,
|
|
14
|
+
normalizeStoragePath
|
|
15
|
+
} from "../chunk-XAEII4ZX.js";
|
|
16
|
+
import "../chunk-TGBT5XBE.js";
|
|
17
|
+
import {
|
|
18
|
+
SupabaseUploadHandler,
|
|
19
|
+
createSupabaseUploadHandler
|
|
20
|
+
} from "../chunk-P4HZA6ZT.js";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
23
|
+
resolveBucket
|
|
24
|
+
} from "../chunk-Z6VOBGTU.js";
|
|
25
|
+
import "../chunk-FV2HXEIY.js";
|
|
26
|
+
export {
|
|
27
|
+
CacheSettingsManager,
|
|
28
|
+
DEFAULT_CACHE_SETTINGS,
|
|
29
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
30
|
+
SupabaseStorageAdapter,
|
|
31
|
+
SupabaseUploadHandler,
|
|
32
|
+
createSupabaseStorage,
|
|
33
|
+
createSupabaseStorageAdapter,
|
|
34
|
+
createSupabaseUploadHandler,
|
|
35
|
+
getStorageErrorMessage,
|
|
36
|
+
isBlobResult,
|
|
37
|
+
isFileResult,
|
|
38
|
+
isStorageAuthError,
|
|
39
|
+
normalizeStoragePath,
|
|
40
|
+
resolveBucket
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { D as DownloadResult, a as StorageBackend, b as StorageUploadOptions, d as SupabaseClient, S as SupabaseStorage, c as SupabaseStorageOptions, U as UploadProgress, r as resolveBucket } from '../types-D0WcHrq6.js';
|
|
2
|
+
export { f as CacheSettings, C as CacheSettingsManager, h as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, S as SupabaseStorageAdapter, c as createSupabaseStorage, d as createSupabaseStorageAdapter, g as getStorageErrorMessage, a as isBlobResult, i as isFileResult, b as isStorageAuthError, n as normalizeStoragePath } from '../CacheSettingsManager-uz-kbnRH.js';
|
|
3
|
+
export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from '../types-CyvBaAl8.js';
|
|
4
|
+
export { SupabaseUploadHandler, createSupabaseUploadHandler } from './upload/index.native.js';
|
|
5
|
+
import '../platform/index.js';
|
|
6
|
+
import '../types-CDqWh56B.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SupabaseUploadHandler,
|
|
3
|
+
createSupabaseUploadHandler
|
|
4
|
+
} from "../chunk-CAB26E6F.js";
|
|
5
|
+
import {
|
|
6
|
+
CacheSettingsManager,
|
|
7
|
+
DEFAULT_CACHE_SETTINGS,
|
|
8
|
+
createSupabaseStorage,
|
|
9
|
+
isBlobResult,
|
|
10
|
+
isFileResult
|
|
11
|
+
} from "../chunk-XOY2CJ67.js";
|
|
12
|
+
import {
|
|
13
|
+
SupabaseStorageAdapter,
|
|
14
|
+
createSupabaseStorageAdapter,
|
|
15
|
+
getStorageErrorMessage,
|
|
16
|
+
isStorageAuthError,
|
|
17
|
+
normalizeStoragePath
|
|
18
|
+
} from "../chunk-XAEII4ZX.js";
|
|
19
|
+
import {
|
|
20
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
21
|
+
resolveBucket
|
|
22
|
+
} from "../chunk-Z6VOBGTU.js";
|
|
23
|
+
import "../chunk-FV2HXEIY.js";
|
|
24
|
+
export {
|
|
25
|
+
CacheSettingsManager,
|
|
26
|
+
DEFAULT_CACHE_SETTINGS,
|
|
27
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
28
|
+
SupabaseStorageAdapter,
|
|
29
|
+
SupabaseUploadHandler,
|
|
30
|
+
createSupabaseStorage,
|
|
31
|
+
createSupabaseStorageAdapter,
|
|
32
|
+
createSupabaseUploadHandler,
|
|
33
|
+
getStorageErrorMessage,
|
|
34
|
+
isBlobResult,
|
|
35
|
+
isFileResult,
|
|
36
|
+
isStorageAuthError,
|
|
37
|
+
normalizeStoragePath,
|
|
38
|
+
resolveBucket
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { D as DownloadResult, a as StorageBackend, b as StorageUploadOptions, d as SupabaseClient, S as SupabaseStorage, c as SupabaseStorageOptions, U as UploadProgress, r as resolveBucket } from '../types-D0WcHrq6.js';
|
|
2
|
+
export { f as CacheSettings, C as CacheSettingsManager, h as CacheSettingsManagerOptions, D as DEFAULT_CACHE_SETTINGS, S as SupabaseStorageAdapter, c as createSupabaseStorage, d as createSupabaseStorageAdapter, g as getStorageErrorMessage, a as isBlobResult, i as isFileResult, b as isStorageAuthError, n as normalizeStoragePath } from '../CacheSettingsManager-uz-kbnRH.js';
|
|
3
|
+
export { D as DEFAULT_UPLOAD_NOTIFICATION, S as SupabaseUploadHandlerOptions, U as UploadEventHandlers, a as UploadNotificationConfig } from '../types-CyvBaAl8.js';
|
|
4
|
+
export { SupabaseUploadHandler, createSupabaseUploadHandler } from './upload/index.js';
|
|
5
|
+
import '../platform/index.js';
|
|
6
|
+
import '../types-CDqWh56B.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CacheSettingsManager,
|
|
3
|
+
DEFAULT_CACHE_SETTINGS,
|
|
4
|
+
createSupabaseStorage,
|
|
5
|
+
isBlobResult,
|
|
6
|
+
isFileResult
|
|
7
|
+
} from "../chunk-XOY2CJ67.js";
|
|
8
|
+
import {
|
|
9
|
+
SupabaseStorageAdapter,
|
|
10
|
+
createSupabaseStorageAdapter,
|
|
11
|
+
getStorageErrorMessage,
|
|
12
|
+
isStorageAuthError,
|
|
13
|
+
normalizeStoragePath
|
|
14
|
+
} from "../chunk-XAEII4ZX.js";
|
|
15
|
+
import {
|
|
16
|
+
SupabaseUploadHandler,
|
|
17
|
+
createSupabaseUploadHandler
|
|
18
|
+
} from "../chunk-P4HZA6ZT.js";
|
|
19
|
+
import {
|
|
20
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
21
|
+
resolveBucket
|
|
22
|
+
} from "../chunk-Z6VOBGTU.js";
|
|
23
|
+
import "../chunk-FV2HXEIY.js";
|
|
24
|
+
export {
|
|
25
|
+
CacheSettingsManager,
|
|
26
|
+
DEFAULT_CACHE_SETTINGS,
|
|
27
|
+
DEFAULT_UPLOAD_NOTIFICATION,
|
|
28
|
+
SupabaseStorageAdapter,
|
|
29
|
+
SupabaseUploadHandler,
|
|
30
|
+
createSupabaseStorage,
|
|
31
|
+
createSupabaseStorageAdapter,
|
|
32
|
+
createSupabaseUploadHandler,
|
|
33
|
+
getStorageErrorMessage,
|
|
34
|
+
isBlobResult,
|
|
35
|
+
isFileResult,
|
|
36
|
+
isStorageAuthError,
|
|
37
|
+
normalizeStoragePath,
|
|
38
|
+
resolveBucket
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|