@pol-studios/powersync 1.0.0
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/attachments/index.d.ts +399 -0
- package/dist/attachments/index.js +16 -0
- package/dist/attachments/index.js.map +1 -0
- package/dist/chunk-32OLICZO.js +1 -0
- package/dist/chunk-32OLICZO.js.map +1 -0
- package/dist/chunk-4FJVBR3X.js +227 -0
- package/dist/chunk-4FJVBR3X.js.map +1 -0
- package/dist/chunk-7BPTGEVG.js +1 -0
- package/dist/chunk-7BPTGEVG.js.map +1 -0
- package/dist/chunk-7JQZBZ5N.js +1 -0
- package/dist/chunk-7JQZBZ5N.js.map +1 -0
- package/dist/chunk-BJ36QDFN.js +290 -0
- package/dist/chunk-BJ36QDFN.js.map +1 -0
- package/dist/chunk-CFCK2LHI.js +1002 -0
- package/dist/chunk-CFCK2LHI.js.map +1 -0
- package/dist/chunk-CHRTN5PF.js +322 -0
- package/dist/chunk-CHRTN5PF.js.map +1 -0
- package/dist/chunk-FLHDT4TS.js +327 -0
- package/dist/chunk-FLHDT4TS.js.map +1 -0
- package/dist/chunk-GBGATW2S.js +749 -0
- package/dist/chunk-GBGATW2S.js.map +1 -0
- package/dist/chunk-NPNBGCRC.js +65 -0
- package/dist/chunk-NPNBGCRC.js.map +1 -0
- package/dist/chunk-Q3LFFMRR.js +925 -0
- package/dist/chunk-Q3LFFMRR.js.map +1 -0
- package/dist/chunk-T225XEML.js +298 -0
- package/dist/chunk-T225XEML.js.map +1 -0
- package/dist/chunk-W7HSR35B.js +1 -0
- package/dist/chunk-W7HSR35B.js.map +1 -0
- package/dist/connector/index.d.ts +5 -0
- package/dist/connector/index.js +14 -0
- package/dist/connector/index.js.map +1 -0
- package/dist/core/index.d.ts +197 -0
- package/dist/core/index.js +96 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index-nae7nzib.d.ts +147 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +191 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +14 -0
- package/dist/index.native.js +195 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.web.d.ts +14 -0
- package/dist/index.web.js +195 -0
- package/dist/index.web.js.map +1 -0
- package/dist/platform/index.d.ts +280 -0
- package/dist/platform/index.js +14 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/index.native.d.ts +37 -0
- package/dist/platform/index.native.js +7 -0
- package/dist/platform/index.native.js.map +1 -0
- package/dist/platform/index.web.d.ts +37 -0
- package/dist/platform/index.web.js +7 -0
- package/dist/platform/index.web.js.map +1 -0
- package/dist/provider/index.d.ts +873 -0
- package/dist/provider/index.js +63 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/supabase-connector-D14-kl5v.d.ts +232 -0
- package/dist/sync/index.d.ts +421 -0
- package/dist/sync/index.js +14 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/types-Cd7RhNqf.d.ts +224 -0
- package/dist/types-afHtE1U_.d.ts +391 -0
- package/package.json +101 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { A as AbstractPowerSyncDatabase } from '../types-afHtE1U_.js';
|
|
2
|
+
import { PlatformAdapter } from '../platform/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Attachment Queue Types for @pol-studios/powersync
|
|
6
|
+
*
|
|
7
|
+
* Defines interfaces for the attachment queue system that handles
|
|
8
|
+
* offline file caching with download, compression, and eviction.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* State of an attachment in the queue.
|
|
12
|
+
* NOTE: These do NOT match @powersync/attachments enum ordering (values 0-2 differ).
|
|
13
|
+
*/
|
|
14
|
+
declare enum AttachmentState {
|
|
15
|
+
/** Waiting to be downloaded */
|
|
16
|
+
QUEUED_DOWNLOAD = 0,
|
|
17
|
+
/** Waiting for initial sync */
|
|
18
|
+
QUEUED_SYNC = 1,
|
|
19
|
+
/** Waiting to be uploaded */
|
|
20
|
+
QUEUED_UPLOAD = 2,
|
|
21
|
+
/** Fully synced (downloaded or uploaded) */
|
|
22
|
+
SYNCED = 3,
|
|
23
|
+
/** Archived (removed from sync but record kept) */
|
|
24
|
+
ARCHIVED = 4
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Record representing an attachment in the queue database.
|
|
28
|
+
*/
|
|
29
|
+
interface AttachmentRecord {
|
|
30
|
+
/** Unique identifier (typically storage path) */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Filename for display and type inference */
|
|
33
|
+
filename: string;
|
|
34
|
+
/** MIME type of the file */
|
|
35
|
+
media_type: string;
|
|
36
|
+
/** Current state in the queue */
|
|
37
|
+
state: AttachmentState;
|
|
38
|
+
/** Local file URI (set after download) */
|
|
39
|
+
local_uri?: string | null;
|
|
40
|
+
/** File size in bytes */
|
|
41
|
+
size?: number;
|
|
42
|
+
/** Timestamp when the attachment was created */
|
|
43
|
+
timestamp?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for the source table that contains attachment references.
|
|
47
|
+
* This makes the attachment queue reusable across different tables/projects.
|
|
48
|
+
*/
|
|
49
|
+
interface AttachmentSourceConfig {
|
|
50
|
+
/**
|
|
51
|
+
* Table name containing attachment references.
|
|
52
|
+
* @example "EquipmentUnitMediaContent"
|
|
53
|
+
*/
|
|
54
|
+
table: string;
|
|
55
|
+
/**
|
|
56
|
+
* Column containing the storage path / attachment ID.
|
|
57
|
+
* @example "storagePath"
|
|
58
|
+
*/
|
|
59
|
+
idColumn: string;
|
|
60
|
+
/**
|
|
61
|
+
* Column to order by for "newest first" downloads.
|
|
62
|
+
* Set to null to skip ordering.
|
|
63
|
+
* @example "takenOn"
|
|
64
|
+
*/
|
|
65
|
+
orderByColumn: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Optional filter config to exclude attachments from archived/unsynced projects.
|
|
68
|
+
* When set, the attachment query JOINs through intermediary tables to ensure
|
|
69
|
+
* only attachments belonging to synced projects are downloaded.
|
|
70
|
+
*/
|
|
71
|
+
projectFilter?: {
|
|
72
|
+
/** Foreign key column in the source table (e.g., "equipmentUnitId") */
|
|
73
|
+
foreignKey: string;
|
|
74
|
+
/** Intermediary table to JOIN through (e.g., "EquipmentFixtureUnit") */
|
|
75
|
+
intermediaryTable: string;
|
|
76
|
+
/** Column in intermediary table that links to ProjectDatabase (e.g., "projectDatabaseId") */
|
|
77
|
+
projectForeignKey: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Interface for attachment storage operations (e.g., Supabase Storage).
|
|
82
|
+
*/
|
|
83
|
+
interface AttachmentStorageAdapter {
|
|
84
|
+
/**
|
|
85
|
+
* Download a file from remote storage.
|
|
86
|
+
* @param filePath - The storage path of the file
|
|
87
|
+
* @returns The file data as a Blob or base64 string
|
|
88
|
+
*/
|
|
89
|
+
downloadFile(filePath: string): Promise<Blob | string>;
|
|
90
|
+
/**
|
|
91
|
+
* Upload a file to remote storage (optional - not all queues need upload).
|
|
92
|
+
* @param filePath - The storage path to upload to
|
|
93
|
+
* @param data - The file data to upload
|
|
94
|
+
*/
|
|
95
|
+
uploadFile?(filePath: string, data: Blob | string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Delete a file from remote storage (optional).
|
|
98
|
+
* @param filePath - The storage path of the file
|
|
99
|
+
*/
|
|
100
|
+
deleteFile?(filePath: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Resolve the storage bucket for a file path.
|
|
103
|
+
* Allows routing different files to different buckets.
|
|
104
|
+
* @param filePath - The file path to resolve
|
|
105
|
+
* @returns The bucket name
|
|
106
|
+
*/
|
|
107
|
+
resolveBucket?(filePath: string): string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Configuration for image compression.
|
|
111
|
+
*/
|
|
112
|
+
interface CompressionConfig {
|
|
113
|
+
/** Enable compression (default: true) */
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
/** Compression quality 0.0-1.0 (default: 0.7) */
|
|
116
|
+
quality: number;
|
|
117
|
+
/** Max width before resizing (default: 2048) */
|
|
118
|
+
maxWidth: number;
|
|
119
|
+
/** Skip files under this size in bytes (default: 100KB) */
|
|
120
|
+
skipSizeBytes: number;
|
|
121
|
+
/** Skip if already under this size in bytes (default: 300KB) */
|
|
122
|
+
targetSizeBytes: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Default compression configuration.
|
|
126
|
+
*/
|
|
127
|
+
declare const DEFAULT_COMPRESSION_CONFIG: CompressionConfig;
|
|
128
|
+
/**
|
|
129
|
+
* Configuration for the download engine.
|
|
130
|
+
*/
|
|
131
|
+
interface DownloadConfig {
|
|
132
|
+
/** Maximum concurrent downloads (default: 50) */
|
|
133
|
+
concurrency: number;
|
|
134
|
+
/** Download timeout per file in ms (default: 60000) */
|
|
135
|
+
timeoutMs: number;
|
|
136
|
+
/** Retry delay between batches in ms (default: 5000) */
|
|
137
|
+
retryDelayMs: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Default download configuration.
|
|
141
|
+
*/
|
|
142
|
+
declare const DEFAULT_DOWNLOAD_CONFIG: DownloadConfig;
|
|
143
|
+
/**
|
|
144
|
+
* Configuration for cache management.
|
|
145
|
+
*/
|
|
146
|
+
interface CacheConfig {
|
|
147
|
+
/** Maximum cache size in bytes (default: 5GB) */
|
|
148
|
+
maxSize: number;
|
|
149
|
+
/** Stop downloads at this percentage of max (default: 0.95 = 95%) */
|
|
150
|
+
downloadStopThreshold: number;
|
|
151
|
+
/** Trigger eviction at this percentage (default: 1.0 = 100%) */
|
|
152
|
+
evictionTriggerThreshold: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Default cache configuration.
|
|
156
|
+
*/
|
|
157
|
+
declare const DEFAULT_CACHE_CONFIG: CacheConfig;
|
|
158
|
+
/**
|
|
159
|
+
* Full configuration for the attachment queue.
|
|
160
|
+
*/
|
|
161
|
+
interface AttachmentQueueConfig {
|
|
162
|
+
/** Source table configuration */
|
|
163
|
+
source: AttachmentSourceConfig;
|
|
164
|
+
/** Storage adapter for downloading files */
|
|
165
|
+
storage: AttachmentStorageAdapter;
|
|
166
|
+
/** Table name for storing attachment records (default: "photo_attachments") */
|
|
167
|
+
attachmentTableName?: string;
|
|
168
|
+
/** Perform initial sync on initialization (default: true) */
|
|
169
|
+
performInitialSync?: boolean;
|
|
170
|
+
/** Download configuration */
|
|
171
|
+
download?: Partial<DownloadConfig>;
|
|
172
|
+
/** Cache configuration */
|
|
173
|
+
cache?: Partial<CacheConfig>;
|
|
174
|
+
/** Compression configuration */
|
|
175
|
+
compression?: Partial<CompressionConfig>;
|
|
176
|
+
/**
|
|
177
|
+
* Called when a download fails.
|
|
178
|
+
* Return { retry: true } to retry, { retry: false } to skip.
|
|
179
|
+
*/
|
|
180
|
+
onDownloadError?: (attachment: AttachmentRecord, error: Error) => Promise<{
|
|
181
|
+
retry: boolean;
|
|
182
|
+
}>;
|
|
183
|
+
/**
|
|
184
|
+
* Called when sync progress changes.
|
|
185
|
+
*/
|
|
186
|
+
onProgress?: (stats: AttachmentSyncStats) => void;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Current phase of a download operation.
|
|
190
|
+
*/
|
|
191
|
+
type DownloadPhase = 'downloading' | 'compressing' | 'complete' | 'error';
|
|
192
|
+
/**
|
|
193
|
+
* Status of an individual download.
|
|
194
|
+
*/
|
|
195
|
+
interface DownloadStatus {
|
|
196
|
+
/** Attachment ID */
|
|
197
|
+
id: string;
|
|
198
|
+
/** Filename being downloaded */
|
|
199
|
+
filename: string;
|
|
200
|
+
/** Current phase */
|
|
201
|
+
phase: DownloadPhase;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Why downloads are stopped (if not actively syncing).
|
|
205
|
+
*/
|
|
206
|
+
type AttachmentSyncStatus = 'syncing' | 'paused' | 'cache_full' | 'complete';
|
|
207
|
+
/**
|
|
208
|
+
* Statistics about the attachment sync progress.
|
|
209
|
+
*/
|
|
210
|
+
interface AttachmentSyncStats {
|
|
211
|
+
/** Number of attachments that have been downloaded */
|
|
212
|
+
syncedCount: number;
|
|
213
|
+
/** Total size of synced attachments in bytes */
|
|
214
|
+
syncedSize: number;
|
|
215
|
+
/** Number of attachments waiting to be downloaded */
|
|
216
|
+
pendingCount: number;
|
|
217
|
+
/** Total expected attachments (synced + pending) */
|
|
218
|
+
totalExpected: number;
|
|
219
|
+
/** Maximum cache size in bytes */
|
|
220
|
+
maxCacheSize: number;
|
|
221
|
+
/** Current compression quality (0.1 to 1.0) */
|
|
222
|
+
compressionQuality: number;
|
|
223
|
+
/** Current sync status */
|
|
224
|
+
status: AttachmentSyncStatus;
|
|
225
|
+
/** Whether downloads are paused */
|
|
226
|
+
isPaused: boolean;
|
|
227
|
+
/** Whether currently processing downloads */
|
|
228
|
+
isProcessing: boolean;
|
|
229
|
+
/** Currently active downloads */
|
|
230
|
+
activeDownloads: DownloadStatus[];
|
|
231
|
+
}
|
|
232
|
+
/** Row from stats query */
|
|
233
|
+
interface AttachmentStatsRow {
|
|
234
|
+
state: number;
|
|
235
|
+
cnt: number;
|
|
236
|
+
sz: number;
|
|
237
|
+
}
|
|
238
|
+
/** Row for cache file operations */
|
|
239
|
+
interface CacheFileRow {
|
|
240
|
+
id: string;
|
|
241
|
+
local_uri: string;
|
|
242
|
+
}
|
|
243
|
+
/** Row for eviction operations */
|
|
244
|
+
interface EvictRow {
|
|
245
|
+
id: string;
|
|
246
|
+
local_uri: string;
|
|
247
|
+
size: number;
|
|
248
|
+
}
|
|
249
|
+
/** Row for cached size queries */
|
|
250
|
+
interface CachedSizeRow {
|
|
251
|
+
total: number;
|
|
252
|
+
}
|
|
253
|
+
/** Row for ID queries */
|
|
254
|
+
interface IdRow {
|
|
255
|
+
id: string;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Attachment Queue for @pol-studios/powersync
|
|
260
|
+
*
|
|
261
|
+
* Platform-agnostic attachment queue that handles:
|
|
262
|
+
* - Parallel downloads with configurable concurrency
|
|
263
|
+
* - Cache management with eviction
|
|
264
|
+
* - Image compression
|
|
265
|
+
* - Pause/resume functionality
|
|
266
|
+
* - Progress tracking
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Platform-agnostic attachment queue for offline file caching.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```typescript
|
|
274
|
+
* const queue = new AttachmentQueue({
|
|
275
|
+
* powersync: db,
|
|
276
|
+
* platform: platformAdapter,
|
|
277
|
+
* config: {
|
|
278
|
+
* source: {
|
|
279
|
+
* table: 'EquipmentUnitMediaContent',
|
|
280
|
+
* idColumn: 'storagePath',
|
|
281
|
+
* orderByColumn: 'takenOn',
|
|
282
|
+
* },
|
|
283
|
+
* storage: storageAdapter,
|
|
284
|
+
* },
|
|
285
|
+
* });
|
|
286
|
+
*
|
|
287
|
+
* await queue.init();
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
declare class AttachmentQueue {
|
|
291
|
+
private readonly powersync;
|
|
292
|
+
private readonly platform;
|
|
293
|
+
private readonly config;
|
|
294
|
+
private readonly logger;
|
|
295
|
+
private readonly tableName;
|
|
296
|
+
private readonly concurrency;
|
|
297
|
+
private readonly downloadTimeoutMs;
|
|
298
|
+
private readonly retryDelayMs;
|
|
299
|
+
private readonly downloadStopThreshold;
|
|
300
|
+
private readonly evictionTriggerThreshold;
|
|
301
|
+
private _initialized;
|
|
302
|
+
private _paused;
|
|
303
|
+
private _processing;
|
|
304
|
+
private _cacheFull;
|
|
305
|
+
private _resumeRequested;
|
|
306
|
+
private _maxCacheSize;
|
|
307
|
+
private _compressionQuality;
|
|
308
|
+
private _abort;
|
|
309
|
+
private _downloads;
|
|
310
|
+
private _cachedSize;
|
|
311
|
+
private _cachedSizeTimestamp;
|
|
312
|
+
private _cachedStats;
|
|
313
|
+
private _cachedStatsTimestamp;
|
|
314
|
+
private _lastNotifyTime;
|
|
315
|
+
private _notifyTimer;
|
|
316
|
+
private _progressCallbacks;
|
|
317
|
+
private _watcherInterval;
|
|
318
|
+
constructor(options: {
|
|
319
|
+
powersync: AbstractPowerSyncDatabase;
|
|
320
|
+
platform: PlatformAdapter;
|
|
321
|
+
config: AttachmentQueueConfig;
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* Initialize the attachment queue.
|
|
325
|
+
* Creates the attachment table if needed and starts watching for downloads.
|
|
326
|
+
*/
|
|
327
|
+
init(): Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Dispose the attachment queue.
|
|
330
|
+
*/
|
|
331
|
+
dispose(): void;
|
|
332
|
+
/**
|
|
333
|
+
* Subscribe to real-time progress updates.
|
|
334
|
+
* Returns an unsubscribe function.
|
|
335
|
+
*/
|
|
336
|
+
onProgress(callback: (stats: AttachmentSyncStats) => void): () => void;
|
|
337
|
+
/** Whether downloads are paused */
|
|
338
|
+
get paused(): boolean;
|
|
339
|
+
/** Whether currently processing downloads */
|
|
340
|
+
get processing(): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Set the maximum cache size.
|
|
343
|
+
*/
|
|
344
|
+
setMaxCacheSize(bytes: number): Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* Set the compression quality (0.1 to 1.0).
|
|
347
|
+
*/
|
|
348
|
+
setCompressionQuality(quality: number): void;
|
|
349
|
+
/** Get the current compression quality */
|
|
350
|
+
getCompressionQuality(): number;
|
|
351
|
+
/**
|
|
352
|
+
* Pause downloads.
|
|
353
|
+
*/
|
|
354
|
+
pause(): void;
|
|
355
|
+
/**
|
|
356
|
+
* Resume downloads.
|
|
357
|
+
*/
|
|
358
|
+
resume(): void;
|
|
359
|
+
/**
|
|
360
|
+
* Get current sync statistics.
|
|
361
|
+
*/
|
|
362
|
+
getStats(): Promise<AttachmentSyncStats>;
|
|
363
|
+
/**
|
|
364
|
+
* Clear all cached files and re-queue for download.
|
|
365
|
+
*/
|
|
366
|
+
clearCache(): Promise<void>;
|
|
367
|
+
/**
|
|
368
|
+
* Get an attachment record by ID.
|
|
369
|
+
*/
|
|
370
|
+
getRecord(id: string): Promise<AttachmentRecord | null>;
|
|
371
|
+
/**
|
|
372
|
+
* Get the local file URI for an attachment.
|
|
373
|
+
*/
|
|
374
|
+
getLocalUri(localPath: string): string;
|
|
375
|
+
/**
|
|
376
|
+
* Cache a local file (e.g. one just uploaded) into the attachment cache.
|
|
377
|
+
* This avoids a redundant download by copying the source file directly
|
|
378
|
+
* into the cache directory and marking it as SYNCED.
|
|
379
|
+
*/
|
|
380
|
+
cacheLocalFile(storagePath: string, sourceUri: string): Promise<void>;
|
|
381
|
+
private _startDownloadWatcher;
|
|
382
|
+
private _syncAttachmentIds;
|
|
383
|
+
private _startDownloads;
|
|
384
|
+
private _downloadOne;
|
|
385
|
+
private _batchUpdateSizes;
|
|
386
|
+
private _getIdsToDownload;
|
|
387
|
+
private _evictIfNeeded;
|
|
388
|
+
private _compressImage;
|
|
389
|
+
private _isImage;
|
|
390
|
+
private _getStatus;
|
|
391
|
+
private _getCachedSizeWithCache;
|
|
392
|
+
private _orderByNewest;
|
|
393
|
+
private _sleep;
|
|
394
|
+
private _withTimeout;
|
|
395
|
+
private _blobToBase64;
|
|
396
|
+
private _notify;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export { AttachmentQueue, type AttachmentQueueConfig, type AttachmentRecord, type AttachmentSourceConfig, AttachmentState, type AttachmentStatsRow, type AttachmentStorageAdapter, type AttachmentSyncStats, type AttachmentSyncStatus, type CacheConfig, type CacheFileRow, type CachedSizeRow, type CompressionConfig, DEFAULT_CACHE_CONFIG, DEFAULT_COMPRESSION_CONFIG, DEFAULT_DOWNLOAD_CONFIG, type DownloadConfig, type DownloadPhase, type DownloadStatus, type EvictRow, type IdRow };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../chunk-32OLICZO.js";
|
|
2
|
+
import {
|
|
3
|
+
AttachmentQueue,
|
|
4
|
+
AttachmentState,
|
|
5
|
+
DEFAULT_CACHE_CONFIG,
|
|
6
|
+
DEFAULT_COMPRESSION_CONFIG,
|
|
7
|
+
DEFAULT_DOWNLOAD_CONFIG
|
|
8
|
+
} from "../chunk-GBGATW2S.js";
|
|
9
|
+
export {
|
|
10
|
+
AttachmentQueue,
|
|
11
|
+
AttachmentState,
|
|
12
|
+
DEFAULT_CACHE_CONFIG,
|
|
13
|
+
DEFAULT_COMPRESSION_CONFIG,
|
|
14
|
+
DEFAULT_DOWNLOAD_CONFIG
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-32OLICZO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// src/platform/index.native.ts
|
|
2
|
+
function createNativePlatformAdapter(logger) {
|
|
3
|
+
let PowerSyncDatabase;
|
|
4
|
+
let FileSystem;
|
|
5
|
+
let AsyncStorage;
|
|
6
|
+
let NetInfo;
|
|
7
|
+
let ImageManipulator;
|
|
8
|
+
const loadDependencies = async () => {
|
|
9
|
+
if (!PowerSyncDatabase) {
|
|
10
|
+
const psModule = await import("@powersync/react-native");
|
|
11
|
+
PowerSyncDatabase = psModule.PowerSyncDatabase;
|
|
12
|
+
}
|
|
13
|
+
if (!FileSystem) {
|
|
14
|
+
FileSystem = await import("expo-file-system");
|
|
15
|
+
}
|
|
16
|
+
if (!AsyncStorage) {
|
|
17
|
+
const asModule = await import("@react-native-async-storage/async-storage");
|
|
18
|
+
AsyncStorage = asModule.default;
|
|
19
|
+
}
|
|
20
|
+
if (!NetInfo) {
|
|
21
|
+
const niModule = await import("@react-native-community/netinfo");
|
|
22
|
+
NetInfo = niModule.default;
|
|
23
|
+
}
|
|
24
|
+
if (!ImageManipulator) {
|
|
25
|
+
ImageManipulator = await import("expo-image-manipulator");
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const fileSystem = {
|
|
29
|
+
async readFile(uri, encoding = "utf8") {
|
|
30
|
+
if (!FileSystem) await loadDependencies();
|
|
31
|
+
return FileSystem.readAsStringAsync(uri, {
|
|
32
|
+
encoding: encoding === "base64" ? FileSystem.EncodingType.Base64 : FileSystem.EncodingType.UTF8
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
async writeFile(uri, data, encoding = "utf8") {
|
|
36
|
+
if (!FileSystem) await loadDependencies();
|
|
37
|
+
const parentDir = uri.substring(0, uri.lastIndexOf("/"));
|
|
38
|
+
if (parentDir) {
|
|
39
|
+
await FileSystem.makeDirectoryAsync(parentDir, { intermediates: true }).catch(
|
|
40
|
+
() => {
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
await FileSystem.writeAsStringAsync(uri, data, {
|
|
45
|
+
encoding: encoding === "base64" ? FileSystem.EncodingType.Base64 : FileSystem.EncodingType.UTF8
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
async deleteFile(uri) {
|
|
49
|
+
if (!FileSystem) await loadDependencies();
|
|
50
|
+
await FileSystem.deleteAsync(uri, { idempotent: true });
|
|
51
|
+
},
|
|
52
|
+
async copyFile(source, destination) {
|
|
53
|
+
if (!FileSystem) await loadDependencies();
|
|
54
|
+
await FileSystem.copyAsync({ from: source, to: destination });
|
|
55
|
+
},
|
|
56
|
+
async moveFile(source, destination) {
|
|
57
|
+
if (!FileSystem) await loadDependencies();
|
|
58
|
+
await FileSystem.moveAsync({ from: source, to: destination });
|
|
59
|
+
},
|
|
60
|
+
async getFileInfo(uri) {
|
|
61
|
+
if (!FileSystem) await loadDependencies();
|
|
62
|
+
try {
|
|
63
|
+
const info = await FileSystem.getInfoAsync(uri);
|
|
64
|
+
if (!info.exists) return null;
|
|
65
|
+
return {
|
|
66
|
+
exists: true,
|
|
67
|
+
size: "size" in info ? info.size ?? 0 : 0,
|
|
68
|
+
isDirectory: info.isDirectory ?? false,
|
|
69
|
+
modificationTime: "modificationTime" in info && info.modificationTime ? new Date(info.modificationTime * 1e3) : void 0
|
|
70
|
+
};
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
async makeDirectory(uri, options) {
|
|
76
|
+
if (!FileSystem) await loadDependencies();
|
|
77
|
+
await FileSystem.makeDirectoryAsync(uri, {
|
|
78
|
+
intermediates: options?.intermediates ?? true
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
getDocumentsDirectory() {
|
|
82
|
+
return FileSystem?.documentDirectory ?? "";
|
|
83
|
+
},
|
|
84
|
+
getCacheDirectory() {
|
|
85
|
+
return FileSystem?.cacheDirectory ?? "";
|
|
86
|
+
},
|
|
87
|
+
async getFreeDiskSpace() {
|
|
88
|
+
if (!FileSystem) await loadDependencies();
|
|
89
|
+
return FileSystem.getFreeDiskStorageAsync();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const storage = {
|
|
93
|
+
async getItem(key) {
|
|
94
|
+
if (!AsyncStorage) await loadDependencies();
|
|
95
|
+
return AsyncStorage.getItem(key);
|
|
96
|
+
},
|
|
97
|
+
async setItem(key, value) {
|
|
98
|
+
if (!AsyncStorage) await loadDependencies();
|
|
99
|
+
await AsyncStorage.setItem(key, value);
|
|
100
|
+
},
|
|
101
|
+
async removeItem(key) {
|
|
102
|
+
if (!AsyncStorage) await loadDependencies();
|
|
103
|
+
await AsyncStorage.removeItem(key);
|
|
104
|
+
},
|
|
105
|
+
async multiGet(keys) {
|
|
106
|
+
if (!AsyncStorage) await loadDependencies();
|
|
107
|
+
const result = await AsyncStorage.multiGet(keys);
|
|
108
|
+
return result;
|
|
109
|
+
},
|
|
110
|
+
async multiSet(entries) {
|
|
111
|
+
if (!AsyncStorage) await loadDependencies();
|
|
112
|
+
await AsyncStorage.multiSet(entries);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const network = {
|
|
116
|
+
async isConnected() {
|
|
117
|
+
if (!NetInfo) await loadDependencies();
|
|
118
|
+
const state = await NetInfo.fetch();
|
|
119
|
+
return state.isConnected ?? false;
|
|
120
|
+
},
|
|
121
|
+
async getConnectionType() {
|
|
122
|
+
if (!NetInfo) await loadDependencies();
|
|
123
|
+
const state = await NetInfo.fetch();
|
|
124
|
+
const type = state.type;
|
|
125
|
+
if (type === "wifi") return "wifi";
|
|
126
|
+
if (type === "cellular") return "cellular";
|
|
127
|
+
if (type === "ethernet") return "ethernet";
|
|
128
|
+
if (type === "none") return "none";
|
|
129
|
+
return "unknown";
|
|
130
|
+
},
|
|
131
|
+
addConnectionListener(callback) {
|
|
132
|
+
if (!NetInfo) {
|
|
133
|
+
logger.warn(
|
|
134
|
+
"[Platform] NetInfo not loaded, connection listener may not work immediately"
|
|
135
|
+
);
|
|
136
|
+
loadDependencies().then(() => {
|
|
137
|
+
NetInfo.addEventListener((state) => {
|
|
138
|
+
callback(state.isConnected ?? false);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
return () => {
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const unsubscribe = NetInfo.addEventListener((state) => {
|
|
145
|
+
callback(state.isConnected ?? false);
|
|
146
|
+
});
|
|
147
|
+
return unsubscribe;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const imageProcessor = {
|
|
151
|
+
async compress(uri, options) {
|
|
152
|
+
if (!ImageManipulator) await loadDependencies();
|
|
153
|
+
const actions = [];
|
|
154
|
+
if (options.maxWidth || options.maxHeight) {
|
|
155
|
+
actions.push({
|
|
156
|
+
resize: {
|
|
157
|
+
width: options.maxWidth,
|
|
158
|
+
height: options.maxHeight
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
let format;
|
|
163
|
+
switch (options.format) {
|
|
164
|
+
case "png":
|
|
165
|
+
format = ImageManipulator.SaveFormat.PNG;
|
|
166
|
+
break;
|
|
167
|
+
case "webp":
|
|
168
|
+
format = ImageManipulator.SaveFormat.WEBP;
|
|
169
|
+
break;
|
|
170
|
+
case "jpeg":
|
|
171
|
+
default:
|
|
172
|
+
format = ImageManipulator.SaveFormat.JPEG;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
const result = await ImageManipulator.manipulateAsync(uri, actions, {
|
|
176
|
+
compress: options.quality,
|
|
177
|
+
format
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
uri: result.uri,
|
|
181
|
+
width: result.width,
|
|
182
|
+
height: result.height
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
async createDatabase(options) {
|
|
188
|
+
if (!PowerSyncDatabase) await loadDependencies();
|
|
189
|
+
logger.info("[Platform] Creating PowerSync database:", options.dbFilename);
|
|
190
|
+
const db = new PowerSyncDatabase({
|
|
191
|
+
schema: options.schema,
|
|
192
|
+
database: {
|
|
193
|
+
dbFilename: options.dbFilename
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
logger.info("[Platform] Initializing database...");
|
|
197
|
+
await db.init();
|
|
198
|
+
const maxAttempts = 3;
|
|
199
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
200
|
+
try {
|
|
201
|
+
await db.get("SELECT 1");
|
|
202
|
+
logger.info("[Platform] Database initialized and verified");
|
|
203
|
+
return db;
|
|
204
|
+
} catch (err) {
|
|
205
|
+
if (attempt < maxAttempts - 1) {
|
|
206
|
+
logger.warn(`[Platform] Database readiness check failed (attempt ${attempt + 1}/${maxAttempts}), retrying...`);
|
|
207
|
+
await new Promise((r) => setTimeout(r, 100 * Math.pow(2, attempt)));
|
|
208
|
+
} else {
|
|
209
|
+
logger.error("[Platform] Database failed readiness verification after all attempts");
|
|
210
|
+
throw new Error(`Database failed readiness verification: ${err instanceof Error ? err.message : err}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
throw new Error("Database readiness verification failed");
|
|
215
|
+
},
|
|
216
|
+
fileSystem,
|
|
217
|
+
storage,
|
|
218
|
+
network,
|
|
219
|
+
logger,
|
|
220
|
+
imageProcessor
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export {
|
|
225
|
+
createNativePlatformAdapter
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=chunk-4FJVBR3X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/platform/index.native.ts"],"sourcesContent":["/**\n * React Native Platform Adapter for @pol-studios/powersync\n *\n * Implements the PlatformAdapter interface using React Native specific APIs:\n * - @powersync/react-native for SQLite database\n * - expo-file-system for file operations\n * - @react-native-async-storage/async-storage for key-value storage\n * - @react-native-community/netinfo for network monitoring\n * - expo-image-manipulator for image compression\n */\n\nimport type {\n PlatformAdapter,\n DatabaseOptions,\n FileSystemAdapter,\n AsyncStorageAdapter,\n NetworkAdapter,\n LoggerAdapter,\n ImageProcessorAdapter,\n FileInfo,\n CompressedImage,\n CompressionOptions,\n ConnectionType,\n} from './types';\nimport type { AbstractPowerSyncDatabase } from '../core/types';\n\n/**\n * Create a React Native platform adapter\n *\n * @param logger - Logger implementation to use\n * @returns Platform adapter configured for React Native\n *\n * @example\n * ```typescript\n * import { createNativePlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const logger = {\n * debug: console.log,\n * info: console.log,\n * warn: console.warn,\n * error: console.error,\n * };\n *\n * const platform = createNativePlatformAdapter(logger);\n * ```\n */\nexport function createNativePlatformAdapter(\n logger: LoggerAdapter\n): PlatformAdapter {\n // Lazy imports to avoid loading these modules until needed\n // This also helps with tree-shaking in web builds\n let PowerSyncDatabase: typeof import('@powersync/react-native').PowerSyncDatabase;\n // Use 'any' for FileSystem to handle type changes between expo-file-system versions\n let FileSystem: any;\n let AsyncStorage: typeof import('@react-native-async-storage/async-storage').default;\n let NetInfo: typeof import('@react-native-community/netinfo').default;\n let ImageManipulator: typeof import('expo-image-manipulator');\n\n const loadDependencies = async () => {\n if (!PowerSyncDatabase) {\n const psModule = await import('@powersync/react-native');\n PowerSyncDatabase = psModule.PowerSyncDatabase;\n }\n if (!FileSystem) {\n FileSystem = await import('expo-file-system');\n }\n if (!AsyncStorage) {\n const asModule = await import('@react-native-async-storage/async-storage');\n AsyncStorage = asModule.default;\n }\n if (!NetInfo) {\n const niModule = await import('@react-native-community/netinfo');\n NetInfo = niModule.default;\n }\n if (!ImageManipulator) {\n ImageManipulator = await import('expo-image-manipulator');\n }\n };\n\n // File system adapter implementation\n const fileSystem: FileSystemAdapter = {\n async readFile(uri: string, encoding: 'base64' | 'utf8' = 'utf8'): Promise<string> {\n if (!FileSystem) await loadDependencies();\n return FileSystem!.readAsStringAsync(uri, {\n encoding:\n encoding === 'base64'\n ? FileSystem!.EncodingType.Base64\n : FileSystem!.EncodingType.UTF8,\n });\n },\n\n async writeFile(\n uri: string,\n data: string,\n encoding: 'base64' | 'utf8' = 'utf8'\n ): Promise<void> {\n if (!FileSystem) await loadDependencies();\n // Ensure parent directory exists\n const parentDir = uri.substring(0, uri.lastIndexOf('/'));\n if (parentDir) {\n await FileSystem!.makeDirectoryAsync(parentDir, { intermediates: true }).catch(\n () => {\n // Directory may already exist\n }\n );\n }\n await FileSystem!.writeAsStringAsync(uri, data, {\n encoding:\n encoding === 'base64'\n ? FileSystem!.EncodingType.Base64\n : FileSystem!.EncodingType.UTF8,\n });\n },\n\n async deleteFile(uri: string): Promise<void> {\n if (!FileSystem) await loadDependencies();\n await FileSystem!.deleteAsync(uri, { idempotent: true });\n },\n\n async copyFile(source: string, destination: string): Promise<void> {\n if (!FileSystem) await loadDependencies();\n await FileSystem!.copyAsync({ from: source, to: destination });\n },\n\n async moveFile(source: string, destination: string): Promise<void> {\n if (!FileSystem) await loadDependencies();\n await FileSystem!.moveAsync({ from: source, to: destination });\n },\n\n async getFileInfo(uri: string): Promise<FileInfo | null> {\n if (!FileSystem) await loadDependencies();\n try {\n const info = await FileSystem!.getInfoAsync(uri);\n if (!info.exists) return null;\n return {\n exists: true,\n size: 'size' in info ? (info.size ?? 0) : 0,\n isDirectory: info.isDirectory ?? false,\n modificationTime:\n 'modificationTime' in info && info.modificationTime\n ? new Date(info.modificationTime * 1000)\n : undefined,\n };\n } catch {\n return null;\n }\n },\n\n async makeDirectory(\n uri: string,\n options?: { intermediates?: boolean }\n ): Promise<void> {\n if (!FileSystem) await loadDependencies();\n await FileSystem!.makeDirectoryAsync(uri, {\n intermediates: options?.intermediates ?? true,\n });\n },\n\n getDocumentsDirectory(): string {\n // Note: This will be set after first load\n // Return a placeholder that will work for path construction\n return FileSystem?.documentDirectory ?? '';\n },\n\n getCacheDirectory(): string {\n return FileSystem?.cacheDirectory ?? '';\n },\n\n async getFreeDiskSpace(): Promise<number> {\n if (!FileSystem) await loadDependencies();\n return FileSystem!.getFreeDiskStorageAsync();\n },\n };\n\n // Async storage adapter implementation\n const storage: AsyncStorageAdapter = {\n async getItem(key: string): Promise<string | null> {\n if (!AsyncStorage) await loadDependencies();\n return AsyncStorage!.getItem(key);\n },\n\n async setItem(key: string, value: string): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.setItem(key, value);\n },\n\n async removeItem(key: string): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.removeItem(key);\n },\n\n async multiGet(keys: string[]): Promise<[string, string | null][]> {\n if (!AsyncStorage) await loadDependencies();\n const result = await AsyncStorage!.multiGet(keys);\n return result as [string, string | null][];\n },\n\n async multiSet(entries: [string, string][]): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.multiSet(entries);\n },\n };\n\n // Network adapter implementation\n const network: NetworkAdapter = {\n async isConnected(): Promise<boolean> {\n if (!NetInfo) await loadDependencies();\n const state = await NetInfo!.fetch();\n return state.isConnected ?? false;\n },\n\n async getConnectionType(): Promise<ConnectionType> {\n if (!NetInfo) await loadDependencies();\n const state = await NetInfo!.fetch();\n const type = state.type;\n if (type === 'wifi') return 'wifi';\n if (type === 'cellular') return 'cellular';\n if (type === 'ethernet') return 'ethernet';\n if (type === 'none') return 'none';\n return 'unknown';\n },\n\n addConnectionListener(callback: (isConnected: boolean) => void): () => void {\n // NetInfo must be loaded synchronously for listener setup\n // This is typically called after initialization\n if (!NetInfo) {\n logger.warn(\n '[Platform] NetInfo not loaded, connection listener may not work immediately'\n );\n // Load and set up listener asynchronously\n loadDependencies().then(() => {\n NetInfo!.addEventListener((state) => {\n callback(state.isConnected ?? false);\n });\n });\n return () => {};\n }\n\n const unsubscribe = NetInfo.addEventListener((state) => {\n callback(state.isConnected ?? false);\n });\n return unsubscribe;\n },\n };\n\n // Image processor adapter implementation\n const imageProcessor: ImageProcessorAdapter = {\n async compress(\n uri: string,\n options: CompressionOptions\n ): Promise<CompressedImage> {\n if (!ImageManipulator) await loadDependencies();\n\n const actions: import('expo-image-manipulator').Action[] = [];\n\n // Add resize action if maxWidth or maxHeight specified\n if (options.maxWidth || options.maxHeight) {\n actions.push({\n resize: {\n width: options.maxWidth,\n height: options.maxHeight,\n },\n });\n }\n\n // Determine output format\n let format: import('expo-image-manipulator').SaveFormat;\n switch (options.format) {\n case 'png':\n format = ImageManipulator!.SaveFormat.PNG;\n break;\n case 'webp':\n format = ImageManipulator!.SaveFormat.WEBP;\n break;\n case 'jpeg':\n default:\n format = ImageManipulator!.SaveFormat.JPEG;\n break;\n }\n\n const result = await ImageManipulator!.manipulateAsync(uri, actions, {\n compress: options.quality,\n format,\n });\n\n return {\n uri: result.uri,\n width: result.width,\n height: result.height,\n };\n },\n };\n\n // Main platform adapter\n return {\n async createDatabase(\n options: DatabaseOptions\n ): Promise<AbstractPowerSyncDatabase> {\n if (!PowerSyncDatabase) await loadDependencies();\n\n logger.info('[Platform] Creating PowerSync database:', options.dbFilename);\n\n const db = new PowerSyncDatabase!({\n schema: options.schema as any,\n database: {\n dbFilename: options.dbFilename,\n },\n });\n\n logger.info('[Platform] Initializing database...');\n await db.init();\n\n // Verify database is queryable before returning\n // This prevents race conditions where db.connect() is called before SQLite is truly ready\n const maxAttempts = 3;\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n await db.get('SELECT 1');\n logger.info('[Platform] Database initialized and verified');\n return db as unknown as AbstractPowerSyncDatabase;\n } catch (err) {\n if (attempt < maxAttempts - 1) {\n logger.warn(`[Platform] Database readiness check failed (attempt ${attempt + 1}/${maxAttempts}), retrying...`);\n await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt))); // 100ms, 200ms, 400ms\n } else {\n logger.error('[Platform] Database failed readiness verification after all attempts');\n throw new Error(`Database failed readiness verification: ${err instanceof Error ? err.message : err}`);\n }\n }\n }\n\n // TypeScript: unreachable but needed for return type\n throw new Error('Database readiness verification failed');\n },\n\n fileSystem,\n storage,\n network,\n logger,\n imageProcessor,\n };\n}\n\n// Re-export types for convenience\nexport type { PlatformAdapter, LoggerAdapter } from './types';\n"],"mappings":";AA8CO,SAAS,4BACd,QACiB;AAGjB,MAAI;AAEJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AAEJ,QAAM,mBAAmB,YAAY;AACnC,QAAI,CAAC,mBAAmB;AACtB,YAAM,WAAW,MAAM,OAAO,yBAAyB;AACvD,0BAAoB,SAAS;AAAA,IAC/B;AACA,QAAI,CAAC,YAAY;AACf,mBAAa,MAAM,OAAO,kBAAkB;AAAA,IAC9C;AACA,QAAI,CAAC,cAAc;AACjB,YAAM,WAAW,MAAM,OAAO,2CAA2C;AACzE,qBAAe,SAAS;AAAA,IAC1B;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,WAAW,MAAM,OAAO,iCAAiC;AAC/D,gBAAU,SAAS;AAAA,IACrB;AACA,QAAI,CAAC,kBAAkB;AACrB,yBAAmB,MAAM,OAAO,wBAAwB;AAAA,IAC1D;AAAA,EACF;AAG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