event-sourced-collection 0.0.1

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/index.mjs ADDED
@@ -0,0 +1,584 @@
1
+ import { uuidv7 as generateEventId } from "uuidv7";
2
+ //#region src/sync.ts
3
+ function createHttpTransport(config) {
4
+ return {
5
+ push: createHttpPushEvents(config.push, config.headers),
6
+ pull: createHttpPullEvents(config.pull, config.headers)
7
+ };
8
+ }
9
+ function createSyncTransport(config) {
10
+ if (!config) return null;
11
+ if (isTransport(config)) return {
12
+ push: config.push,
13
+ pull: config.pull
14
+ };
15
+ const pushUrl = getPushUrl(config);
16
+ const pullUrl = getPullUrl(config);
17
+ const push = "pushEvents" in config && config.pushEvents ? config.pushEvents : pushUrl ? createHttpPushEvents(pushUrl, config.headers) : void 0;
18
+ const pullEvents = "pullEvents" in config ? config.pullEvents : void 0;
19
+ const pull = pullEvents ? createPullFromHandler(pullEvents) : pullUrl ? createHttpPullEvents(pullUrl, config.headers) : void 0;
20
+ if (!push && !pull) return null;
21
+ return {
22
+ push,
23
+ pull
24
+ };
25
+ }
26
+ function normalizePushResponse(response) {
27
+ if (Array.isArray(response)) return { confirmed: response };
28
+ return {
29
+ confirmed: response.confirmed,
30
+ failed: response.failed
31
+ };
32
+ }
33
+ function createHttpPushEvents(url, headers) {
34
+ return async (events) => {
35
+ if (events.length === 0) return { confirmed: [] };
36
+ const resolvedHeaders = await resolveHeaders(headers);
37
+ const response = await fetch(url, {
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/json",
41
+ ...resolvedHeaders
42
+ },
43
+ body: JSON.stringify(events)
44
+ });
45
+ if (!response.ok) throw new SyncPushError(response.status, await response.text());
46
+ return response.json();
47
+ };
48
+ }
49
+ function createPullFromHandler(pullEvents) {
50
+ return (since) => pullEvents({ since });
51
+ }
52
+ function createHttpPullEvents(url, headers) {
53
+ return async (since) => {
54
+ const resolvedHeaders = await resolveHeaders(headers);
55
+ const pullUrl = appendSince(url, since);
56
+ const response = await fetch(pullUrl, { headers: {
57
+ Accept: "application/json",
58
+ ...resolvedHeaders
59
+ } });
60
+ if (!response.ok) throw new SyncPullError(response.status, await response.text());
61
+ return response.json();
62
+ };
63
+ }
64
+ async function resolveHeaders(headers) {
65
+ if (!headers) return {};
66
+ if (typeof headers === "function") return headers();
67
+ return headers;
68
+ }
69
+ function appendSince(url, since) {
70
+ return `${url}${url.includes("?") ? "&" : "?"}since=${encodeURIComponent(String(since))}`;
71
+ }
72
+ function getPushUrl(config) {
73
+ if ("pushUrl" in config && config.pushUrl) return config.pushUrl;
74
+ if ("push" in config && typeof config.push === "string") return config.push;
75
+ }
76
+ function getPullUrl(config) {
77
+ if ("pullUrl" in config && config.pullUrl) return config.pullUrl;
78
+ if ("pull" in config && typeof config.pull === "string") return config.pull;
79
+ }
80
+ var SyncPushError = class extends Error {
81
+ status;
82
+ body;
83
+ constructor(status, body) {
84
+ super(`Event push failed: HTTP ${status}`);
85
+ this.status = status;
86
+ this.body = body;
87
+ this.name = "SyncPushError";
88
+ }
89
+ };
90
+ var SyncPullError = class extends Error {
91
+ status;
92
+ body;
93
+ constructor(status, body) {
94
+ super(`Event pull failed: HTTP ${status}`);
95
+ this.status = status;
96
+ this.body = body;
97
+ this.name = "SyncPullError";
98
+ }
99
+ };
100
+ function isTransport(value) {
101
+ return "push" in value && typeof value.push === "function";
102
+ }
103
+ //#endregion
104
+ //#region src/utils/logger.ts
105
+ const noopLogger = {
106
+ debug: () => {},
107
+ info: () => {},
108
+ warn: () => {},
109
+ error: () => {}
110
+ };
111
+ const LOG_PREFIX = "[event-sourced]";
112
+ function createEventSourcedLogger(debug) {
113
+ if (debug === void 0 || debug === false) return noopLogger;
114
+ if (typeof debug === "object") return debug;
115
+ return {
116
+ debug: (message, data) => {
117
+ if (data === void 0) {
118
+ console.debug(LOG_PREFIX, message);
119
+ return;
120
+ }
121
+ console.debug(LOG_PREFIX, message, data);
122
+ },
123
+ info: (message, data) => {
124
+ if (data === void 0) {
125
+ console.info(LOG_PREFIX, message);
126
+ return;
127
+ }
128
+ console.info(LOG_PREFIX, message, data);
129
+ },
130
+ warn: (message, data) => {
131
+ if (data === void 0) {
132
+ console.warn(LOG_PREFIX, message);
133
+ return;
134
+ }
135
+ console.warn(LOG_PREFIX, message, data);
136
+ },
137
+ error: (message, data) => {
138
+ if (data === void 0) {
139
+ console.error(LOG_PREFIX, message);
140
+ return;
141
+ }
142
+ console.error(LOG_PREFIX, message, data);
143
+ }
144
+ };
145
+ }
146
+ //#endregion
147
+ //#region src/create-event-sourced-db.ts
148
+ const OUTBOX_ID = "outbox";
149
+ const INBOX_ID = "inbox";
150
+ const RESERVED_IDS = /* @__PURE__ */ new Set([OUTBOX_ID, INBOX_ID]);
151
+ async function createEventSourcedDB(config) {
152
+ assertReservedNamesAvailable(config.collections);
153
+ const log = createEventSourcedLogger(config.debug);
154
+ const transport = createSyncTransport(config.sync);
155
+ log.info("creating event-sourced db", {
156
+ collectionIds: Object.keys(config.collections),
157
+ hasTransport: transport !== null
158
+ });
159
+ const defaultSchemaVersion = config.schemaVersion ?? 1;
160
+ const seq = { value: 0 };
161
+ const outbox = createMetaCollection(config, OUTBOX_ID, (entry) => entry.eventId, defaultSchemaVersion);
162
+ const inbox = createMetaCollection(config, INBOX_ID, (entry) => entry.eventId, defaultSchemaVersion);
163
+ const userCollections = {};
164
+ for (const collectionId of Object.keys(config.collections)) {
165
+ const def = config.collections[collectionId];
166
+ const getKey = def.getKey;
167
+ const options = config.persistedCollectionOptions({
168
+ id: collectionId,
169
+ getKey,
170
+ persistence: config.persistence,
171
+ schemaVersion: def.schemaVersion ?? defaultSchemaVersion,
172
+ onInsert: createMutationHook(outbox, collectionId, "insert", seq, log),
173
+ onUpdate: createMutationHook(outbox, collectionId, "update", seq, log),
174
+ onDelete: createMutationHook(outbox, collectionId, "delete", seq, log)
175
+ });
176
+ const collection = config.createCollection(options);
177
+ const hasAcceptMutations = Boolean(collection.utils?.acceptMutations);
178
+ log.debug("registered collection", {
179
+ collectionId,
180
+ hasAcceptMutations
181
+ });
182
+ userCollections[collectionId] = collection;
183
+ }
184
+ const collections = {
185
+ ...userCollections,
186
+ outbox,
187
+ inbox
188
+ };
189
+ const replayTargets = collections;
190
+ const subscriptions = [outbox.subscribeChanges(() => {}), inbox.subscribeChanges(() => {})];
191
+ await outbox.preload();
192
+ await inbox.preload();
193
+ seq.value = nextLocalSeq(outbox);
194
+ log.info("preloaded meta collections", {
195
+ outboxCount: outbox.state.size,
196
+ inboxCount: inbox.state.size,
197
+ nextLocalSeq: seq.value
198
+ });
199
+ await replayInbox(inbox, replayTargets, log);
200
+ async function sync() {
201
+ if (!transport) {
202
+ log.warn("sync skipped: no transport configured");
203
+ return {
204
+ pushed: 0,
205
+ pulled: 0,
206
+ errors: []
207
+ };
208
+ }
209
+ log.info("sync started");
210
+ await outbox.preload();
211
+ await inbox.preload();
212
+ const errors = [];
213
+ let pushed = 0;
214
+ let pulled = 0;
215
+ try {
216
+ if (transport.push) pushed = await pushOutbox(outbox, transport, log);
217
+ else log.debug("push skipped: no push transport configured");
218
+ } catch (err) {
219
+ const error = toError(err);
220
+ log.error("push outbox failed", { message: error.message });
221
+ errors.push(error);
222
+ }
223
+ try {
224
+ if (transport.pull) pulled = await pullInbox(outbox, inbox, transport, replayTargets, log);
225
+ else log.debug("pull skipped: no pull transport configured");
226
+ } catch (err) {
227
+ const error = toError(err);
228
+ log.error("pull inbox failed", { message: error.message });
229
+ errors.push(error);
230
+ }
231
+ log.info("sync finished", {
232
+ pushed,
233
+ pulled,
234
+ errorCount: errors.length
235
+ });
236
+ return {
237
+ pushed,
238
+ pulled,
239
+ errors
240
+ };
241
+ }
242
+ async function manualSync() {
243
+ log.info("manual sync started");
244
+ await outbox.preload();
245
+ await inbox.preload();
246
+ const errors = [];
247
+ let pushed = 0;
248
+ let pulled = 0;
249
+ let replayed = 0;
250
+ if (transport) {
251
+ try {
252
+ if (transport.push) pushed = await pushOutbox(outbox, transport, log);
253
+ else log.debug("manual sync push skipped: no push transport configured");
254
+ } catch (err) {
255
+ const error = toError(err);
256
+ log.error("manual sync push failed", { message: error.message });
257
+ errors.push(error);
258
+ }
259
+ try {
260
+ if (transport.pull) pulled = await pullInbox(outbox, inbox, transport, replayTargets, log);
261
+ else log.debug("manual sync pull skipped: no pull transport configured");
262
+ } catch (err) {
263
+ const error = toError(err);
264
+ log.error("manual sync pull failed", { message: error.message });
265
+ errors.push(error);
266
+ }
267
+ } else log.warn("manual sync: no transport configured, skipping push/pull");
268
+ try {
269
+ replayed = await replayInbox(inbox, replayTargets, log);
270
+ } catch (err) {
271
+ const error = toError(err);
272
+ log.error("manual sync replay failed", { message: error.message });
273
+ errors.push(error);
274
+ }
275
+ log.info("manual sync finished", {
276
+ pushed,
277
+ pulled,
278
+ replayed,
279
+ errorCount: errors.length
280
+ });
281
+ return {
282
+ pushed,
283
+ pulled,
284
+ replayed,
285
+ errors
286
+ };
287
+ }
288
+ function dispose() {
289
+ log.debug("disposing event-sourced db");
290
+ for (const subscription of subscriptions) subscription.unsubscribe();
291
+ }
292
+ return {
293
+ collections,
294
+ sync,
295
+ manualSync,
296
+ dispose
297
+ };
298
+ }
299
+ function createMetaCollection(config, id, getKey, schemaVersion) {
300
+ const options = config.persistedCollectionOptions({
301
+ id,
302
+ getKey,
303
+ persistence: config.persistence,
304
+ schemaVersion
305
+ });
306
+ return config.createCollection(options);
307
+ }
308
+ function createMutationHook(outbox, collectionId, type, seq, log) {
309
+ return async (params) => {
310
+ for (const mutation of params.transaction.mutations) {
311
+ const payload = type === "delete" ? mutation.original : mutation.modified;
312
+ const entry = {
313
+ eventId: generateEventId(),
314
+ collectionId,
315
+ type,
316
+ key: mutation.key,
317
+ payload,
318
+ timestamp: Date.now(),
319
+ localSeq: seq.value++,
320
+ globalSeq: null,
321
+ sync: false,
322
+ syncStatus: "pending",
323
+ attemptCount: 0,
324
+ lastAttemptAt: null,
325
+ lastError: null,
326
+ lastErrorCode: null,
327
+ retryable: null
328
+ };
329
+ await outbox.insert(entry).isPersisted.promise;
330
+ log.debug("outbox entry created", {
331
+ eventId: entry.eventId,
332
+ collectionId,
333
+ type,
334
+ key: entry.key,
335
+ localSeq: entry.localSeq
336
+ });
337
+ }
338
+ return {};
339
+ };
340
+ }
341
+ async function pushOutbox(outbox, transport, log) {
342
+ const pending = [...outbox.state.values()].filter((entry) => !entry.sync && entry.syncStatus !== "failed").sort((a, b) => a.localSeq - b.localSeq);
343
+ log.debug("push outbox", { pendingCount: pending.length });
344
+ if (pending.length === 0) return 0;
345
+ const attemptAt = Date.now();
346
+ for (const entry of pending) await outbox.update(entry.eventId, (draft) => {
347
+ draft.syncStatus = "pending";
348
+ draft.attemptCount = (draft.attemptCount ?? 0) + 1;
349
+ draft.lastAttemptAt = attemptAt;
350
+ draft.lastError = null;
351
+ draft.lastErrorCode = null;
352
+ draft.retryable = null;
353
+ }).isPersisted.promise;
354
+ const outbound = pending.map((entry) => ({
355
+ eventId: entry.eventId,
356
+ collectionId: entry.collectionId,
357
+ type: entry.type,
358
+ key: entry.key,
359
+ payload: entry.payload,
360
+ timestamp: entry.timestamp
361
+ }));
362
+ const response = normalizePushResponse(await transport.push(outbound));
363
+ log.info("push outbox confirmed", {
364
+ sent: outbound.length,
365
+ confirmed: response.confirmed.length,
366
+ failed: response.failed?.length ?? 0
367
+ });
368
+ for (const confirmation of response.confirmed) {
369
+ await outbox.update(confirmation.eventId, (draft) => {
370
+ draft.sync = true;
371
+ draft.syncStatus = "synced";
372
+ draft.globalSeq = confirmation.globalSeq;
373
+ draft.lastError = null;
374
+ draft.lastErrorCode = null;
375
+ draft.retryable = null;
376
+ }).isPersisted.promise;
377
+ log.debug("outbox entry marked pushed", {
378
+ eventId: confirmation.eventId,
379
+ globalSeq: confirmation.globalSeq
380
+ });
381
+ }
382
+ for (const failure of response.failed ?? []) {
383
+ await outbox.update(failure.eventId, (draft) => {
384
+ draft.sync = false;
385
+ draft.syncStatus = "failed";
386
+ draft.lastError = failure.message;
387
+ draft.lastErrorCode = failure.code ?? null;
388
+ draft.retryable = failure.retryable ?? null;
389
+ }).isPersisted.promise;
390
+ log.warn("outbox entry marked failed", {
391
+ eventId: failure.eventId,
392
+ message: failure.message,
393
+ code: failure.code,
394
+ retryable: failure.retryable
395
+ });
396
+ }
397
+ return response.confirmed.length;
398
+ }
399
+ async function pullInbox(outbox, inbox, transport, targets, log) {
400
+ let pulled = 0;
401
+ let hasMore = true;
402
+ while (hasMore) {
403
+ const since = currentSince(inbox);
404
+ log.debug("pull inbox page", { since });
405
+ const response = await transport.pull(since);
406
+ log.debug("pull inbox response", {
407
+ since,
408
+ eventCount: response.events.length,
409
+ hasMore: response.hasMore,
410
+ cursor: response.cursor
411
+ });
412
+ if (response.events.length === 0) break;
413
+ const sorted = [...response.events].sort((a, b) => a.globalSeq - b.globalSeq);
414
+ for (const event of sorted) {
415
+ if (outbox.has(event.eventId)) {
416
+ await markInboxEventSynced(inbox, event);
417
+ log.debug("pull skipped: event originated locally", {
418
+ eventId: event.eventId,
419
+ globalSeq: event.globalSeq
420
+ });
421
+ continue;
422
+ }
423
+ const existing = inbox.get(event.eventId);
424
+ if (existing?.sync) {
425
+ log.debug("pull skipped: inbox already applied", {
426
+ eventId: event.eventId,
427
+ globalSeq: event.globalSeq
428
+ });
429
+ continue;
430
+ }
431
+ if (!existing) {
432
+ await inbox.insert(toInboxEntry(event, false)).isPersisted.promise;
433
+ log.debug("inbox entry inserted", {
434
+ eventId: event.eventId,
435
+ globalSeq: event.globalSeq,
436
+ collectionId: event.collectionId
437
+ });
438
+ }
439
+ if (!await replayEvent(targets, event.collectionId, event.eventId, event.type, event.key, event.payload, log)) return pulled;
440
+ await inbox.update(event.eventId, (draft) => {
441
+ draft.sync = true;
442
+ }).isPersisted.promise;
443
+ log.info("pull replay applied", {
444
+ eventId: event.eventId,
445
+ globalSeq: event.globalSeq,
446
+ collectionId: event.collectionId,
447
+ type: event.type,
448
+ key: event.key
449
+ });
450
+ pulled++;
451
+ }
452
+ hasMore = response.hasMore;
453
+ }
454
+ log.info("pull inbox finished", { pulled });
455
+ return pulled;
456
+ }
457
+ async function replayInbox(inbox, targets, log) {
458
+ const pending = [...inbox.state.values()].filter((entry) => !entry.sync).sort((a, b) => a.globalSeq - b.globalSeq);
459
+ log.info("pending inbox replay started", { pendingCount: pending.length });
460
+ let replayed = 0;
461
+ for (const entry of pending) {
462
+ if (!await replayEvent(targets, entry.collectionId, entry.eventId, entry.type, entry.key, entry.payload, log)) break;
463
+ await inbox.update(entry.eventId, (draft) => {
464
+ draft.sync = true;
465
+ }).isPersisted.promise;
466
+ replayed++;
467
+ log.info("pending inbox replay applied", {
468
+ eventId: entry.eventId,
469
+ globalSeq: entry.globalSeq,
470
+ collectionId: entry.collectionId
471
+ });
472
+ }
473
+ log.info("pending inbox replay finished", { replayed });
474
+ return replayed;
475
+ }
476
+ async function replayEvent(targets, collectionId, eventId, type, key, payload, log) {
477
+ if (RESERVED_IDS.has(collectionId)) {
478
+ log.warn("replay skipped: reserved collection", {
479
+ eventId,
480
+ collectionId,
481
+ type,
482
+ key
483
+ });
484
+ return false;
485
+ }
486
+ const target = targets[collectionId];
487
+ if (!target) {
488
+ log.warn("replay skipped: unknown collection", {
489
+ eventId,
490
+ collectionId,
491
+ type,
492
+ key,
493
+ knownCollections: Object.keys(targets).filter((id) => !RESERVED_IDS.has(id))
494
+ });
495
+ return false;
496
+ }
497
+ if (!target.utils.acceptMutations) {
498
+ log.warn("replay skipped: collection missing acceptMutations", {
499
+ eventId,
500
+ collectionId,
501
+ type,
502
+ key,
503
+ targetId: target.id
504
+ });
505
+ return false;
506
+ }
507
+ log.debug("replay applying mutation", {
508
+ eventId,
509
+ collectionId,
510
+ type,
511
+ key
512
+ });
513
+ try {
514
+ await target.utils.acceptMutations({ mutations: [{
515
+ mutationId: eventId,
516
+ type,
517
+ key,
518
+ modified: payload,
519
+ original: payload,
520
+ changes: payload,
521
+ collection: target
522
+ }] });
523
+ log.info("replay mutation accepted", {
524
+ eventId,
525
+ collectionId,
526
+ type,
527
+ key
528
+ });
529
+ } catch (err) {
530
+ const error = toError(err);
531
+ log.error("replay mutation failed", {
532
+ eventId,
533
+ collectionId,
534
+ type,
535
+ key,
536
+ message: error.message
537
+ });
538
+ throw error;
539
+ }
540
+ return true;
541
+ }
542
+ function currentSince(inbox) {
543
+ let max = 0;
544
+ for (const entry of inbox.state.values()) if (entry.sync && entry.globalSeq > max) max = entry.globalSeq;
545
+ return max;
546
+ }
547
+ function nextLocalSeq(outbox) {
548
+ let max = -1;
549
+ for (const entry of outbox.state.values()) if (entry.localSeq > max) max = entry.localSeq;
550
+ return max + 1;
551
+ }
552
+ async function markInboxEventSynced(inbox, event) {
553
+ const existing = inbox.get(event.eventId);
554
+ if (!existing) {
555
+ await inbox.insert(toInboxEntry(event, true)).isPersisted.promise;
556
+ return;
557
+ }
558
+ if (!existing.sync || existing.globalSeq !== event.globalSeq) await inbox.update(event.eventId, (draft) => {
559
+ draft.globalSeq = event.globalSeq;
560
+ draft.sync = true;
561
+ }).isPersisted.promise;
562
+ }
563
+ function toInboxEntry(event, sync) {
564
+ return {
565
+ eventId: event.eventId,
566
+ globalSeq: event.globalSeq,
567
+ collectionId: event.collectionId,
568
+ type: event.type,
569
+ key: event.key,
570
+ payload: event.payload,
571
+ timestamp: event.timestamp,
572
+ sync
573
+ };
574
+ }
575
+ function assertReservedNamesAvailable(collections) {
576
+ for (const id of Object.keys(collections)) if (RESERVED_IDS.has(id)) throw new Error(`Collection id "${id}" is reserved. "outbox" and "inbox" are built-in collections.`);
577
+ }
578
+ function toError(err) {
579
+ return err instanceof Error ? err : new Error(String(err));
580
+ }
581
+ //#endregion
582
+ export { SyncPullError, SyncPushError, createEventSourcedDB, createEventSourcedLogger, createHttpTransport, generateEventId };
583
+
584
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/sync.ts","../src/utils/logger.ts","../src/create-event-sourced-db.ts"],"sourcesContent":["import type {\n OutboundEvent,\n PullEventsFn,\n PullResponse,\n PushConfirmation,\n PushEventsFn,\n PushResponse,\n SyncHandlersConfig,\n SyncTransport,\n SyncUrlConfig,\n} from \"./types\";\n\nexport type NormalizedSyncTransport = {\n push?: PushEventsFn;\n pull?: (since: number) => Promise<PullResponse>;\n};\n\ntype HeaderConfig = SyncHandlersConfig[\"headers\"];\n\nexport function createHttpTransport(config: SyncUrlConfig): SyncTransport {\n return {\n push: createHttpPushEvents(config.push, config.headers),\n pull: createHttpPullEvents(config.pull, config.headers),\n };\n}\n\nexport function createSyncTransport(\n config?: SyncHandlersConfig | SyncUrlConfig | SyncTransport,\n): NormalizedSyncTransport | null {\n if (!config) {\n return null;\n }\n\n if (isTransport(config)) {\n return {\n push: config.push,\n pull: config.pull,\n };\n }\n\n const pushUrl = getPushUrl(config);\n const pullUrl = getPullUrl(config);\n\n const push = \"pushEvents\" in config && config.pushEvents\n ? config.pushEvents\n : pushUrl\n ? createHttpPushEvents(pushUrl, config.headers)\n : undefined;\n\n const pullEvents = \"pullEvents\" in config ? config.pullEvents : undefined;\n const pull = pullEvents\n ? createPullFromHandler(pullEvents)\n : pullUrl\n ? createHttpPullEvents(pullUrl, config.headers)\n : undefined;\n\n if (!push && !pull) {\n return null;\n }\n\n return { push, pull };\n}\n\nexport function normalizePushResponse(\n response: PushResponse | ReadonlyArray<PushConfirmation>,\n): PushResponse {\n if (Array.isArray(response)) {\n return { confirmed: response };\n }\n\n return {\n confirmed: response.confirmed,\n failed: response.failed,\n };\n}\n\nfunction createHttpPushEvents(url: string, headers: HeaderConfig): PushEventsFn {\n return async (events: ReadonlyArray<OutboundEvent>): Promise<PushResponse> => {\n if (events.length === 0) return { confirmed: [] };\n\n const resolvedHeaders = await resolveHeaders(headers);\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...resolvedHeaders },\n body: JSON.stringify(events),\n });\n\n if (!response.ok) {\n throw new SyncPushError(response.status, await response.text());\n }\n\n return response.json() as Promise<PushResponse>;\n };\n}\n\nfunction createPullFromHandler(pullEvents: PullEventsFn): (since: number) => Promise<PullResponse> {\n return (since: number) => pullEvents({ since });\n}\n\nfunction createHttpPullEvents(\n url: string,\n headers: HeaderConfig,\n): (since: number) => Promise<PullResponse> {\n return async (since: number): Promise<PullResponse> => {\n const resolvedHeaders = await resolveHeaders(headers);\n const pullUrl = appendSince(url, since);\n\n const response = await fetch(pullUrl, {\n headers: { Accept: \"application/json\", ...resolvedHeaders },\n });\n\n if (!response.ok) {\n throw new SyncPullError(response.status, await response.text());\n }\n\n return response.json() as Promise<PullResponse>;\n };\n}\n\nasync function resolveHeaders(headers: HeaderConfig): Promise<Record<string, string>> {\n if (!headers) return {};\n if (typeof headers === \"function\") return headers();\n return headers;\n}\n\nfunction appendSince(url: string, since: number): string {\n const separator = url.includes(\"?\") ? \"&\" : \"?\";\n return `${url}${separator}since=${encodeURIComponent(String(since))}`;\n}\n\nfunction getPushUrl(config: SyncHandlersConfig | SyncUrlConfig): string | undefined {\n if (\"pushUrl\" in config && config.pushUrl) {\n return config.pushUrl;\n }\n\n if (\"push\" in config && typeof config.push === \"string\") {\n return config.push;\n }\n\n return undefined;\n}\n\nfunction getPullUrl(config: SyncHandlersConfig | SyncUrlConfig): string | undefined {\n if (\"pullUrl\" in config && config.pullUrl) {\n return config.pullUrl;\n }\n\n if (\"pull\" in config && typeof config.pull === \"string\") {\n return config.pull;\n }\n\n return undefined;\n}\n\nexport class SyncPushError extends Error {\n constructor(\n public readonly status: number,\n public readonly body: string,\n ) {\n super(`Event push failed: HTTP ${status}`);\n this.name = \"SyncPushError\";\n }\n}\n\nexport class SyncPullError extends Error {\n constructor(\n public readonly status: number,\n public readonly body: string,\n ) {\n super(`Event pull failed: HTTP ${status}`);\n this.name = \"SyncPullError\";\n }\n}\n\nexport function isTransport(\n value: SyncHandlersConfig | SyncUrlConfig | SyncTransport,\n): value is SyncTransport {\n return \"push\" in value && typeof value.push === \"function\";\n}\n","export type EventSourcedLogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport type EventSourcedLogger = {\n debug: (message: string, data?: Record<string, unknown>) => void;\n info: (message: string, data?: Record<string, unknown>) => void;\n warn: (message: string, data?: Record<string, unknown>) => void;\n error: (message: string, data?: Record<string, unknown>) => void;\n};\n\nconst noopLogger: EventSourcedLogger = {\n debug: () => {},\n info: () => {},\n warn: () => {},\n error: () => {},\n};\n\nconst LOG_PREFIX = \"[event-sourced]\";\n\nexport function createEventSourcedLogger(\n debug?: boolean | EventSourcedLogger,\n): EventSourcedLogger {\n if (debug === undefined || debug === false) {\n return noopLogger;\n }\n\n if (typeof debug === \"object\") {\n return debug;\n }\n\n return {\n debug: (message, data) => {\n if (data === undefined) {\n console.debug(LOG_PREFIX, message);\n return;\n }\n console.debug(LOG_PREFIX, message, data);\n },\n info: (message, data) => {\n if (data === undefined) {\n console.info(LOG_PREFIX, message);\n return;\n }\n console.info(LOG_PREFIX, message, data);\n },\n warn: (message, data) => {\n if (data === undefined) {\n console.warn(LOG_PREFIX, message);\n return;\n }\n console.warn(LOG_PREFIX, message, data);\n },\n error: (message, data) => {\n if (data === undefined) {\n console.error(LOG_PREFIX, message);\n return;\n }\n console.error(LOG_PREFIX, message, data);\n },\n };\n}\n","import type { Collection } from \"@tanstack/db\";\nimport { createSyncTransport, normalizePushResponse } from \"./sync\";\nimport type { NormalizedSyncTransport } from \"./sync\";\nimport type { EventSourcedLogger } from \"./utils/logger\";\nimport { createEventSourcedLogger } from \"./utils/logger\";\nimport { generateEventId } from \"./utils/uuid\";\nimport type {\n CollectionMap,\n EventSourcedDB,\n EventSourcedDBConfig,\n InboxEntry,\n MutationType,\n OutboundEvent,\n OutboxEntry,\n ServerEvent,\n SyncResult,\n ManualSyncResult,\n} from \"./types\";\n\nconst OUTBOX_ID = \"outbox\";\nconst INBOX_ID = \"inbox\";\nconst RESERVED_IDS = new Set<string>([OUTBOX_ID, INBOX_ID]);\n\ntype CollectionDefConstraint = {\n getKey: (state: never) => string | number;\n schemaVersion?: number;\n};\n\ntype ReplayMutation = {\n mutationId: string;\n type: MutationType;\n key: string | number;\n modified: Record<string, unknown>;\n original: Record<string, unknown>;\n changes: Record<string, unknown>;\n collection: AcceptMutationsCollection;\n};\n\ntype AcceptMutationsCollection = {\n id?: string;\n utils: {\n acceptMutations?: (transaction: { mutations: Array<ReplayMutation> }) => Promise<void> | void;\n };\n};\n\ntype MutationHookParams = {\n transaction: {\n mutations: ReadonlyArray<{\n mutationId: string;\n key: string | number;\n modified: Record<string, unknown>;\n original: Record<string, unknown>;\n }>;\n };\n};\n\ntype SeqCounter = { value: number };\n\ntype MetaCollectionFactory = Pick<\n EventSourcedDBConfig<Record<string, CollectionDefConstraint>>,\n \"createCollection\" | \"persistedCollectionOptions\" | \"persistence\"\n>;\n\nexport async function createEventSourcedDB<\n const TDefs extends Record<string, CollectionDefConstraint>,\n>(config: EventSourcedDBConfig<TDefs>): Promise<EventSourcedDB<TDefs>> {\n assertReservedNamesAvailable(config.collections);\n\n const log = createEventSourcedLogger(config.debug);\n\n const transport = createSyncTransport(config.sync);\n\n log.info(\"creating event-sourced db\", {\n collectionIds: Object.keys(config.collections),\n hasTransport: transport !== null,\n });\n\n const defaultSchemaVersion = config.schemaVersion ?? 1;\n const seq: SeqCounter = { value: 0 };\n\n const outbox = createMetaCollection<OutboxEntry>(\n config,\n OUTBOX_ID,\n (entry) => entry.eventId,\n defaultSchemaVersion,\n );\n\n const inbox = createMetaCollection<InboxEntry>(\n config,\n INBOX_ID,\n (entry) => entry.eventId,\n defaultSchemaVersion,\n );\n\n const userCollections = {} as CollectionMap<TDefs>;\n\n for (const collectionId of Object.keys(config.collections)) {\n const def = config.collections[collectionId]!;\n const getKey = def.getKey as (item: Record<string, unknown>) => string | number;\n\n const options = config.persistedCollectionOptions<Record<string, unknown>, string | number>({\n id: collectionId,\n getKey,\n persistence: config.persistence,\n schemaVersion: def.schemaVersion ?? defaultSchemaVersion,\n onInsert: createMutationHook(outbox, collectionId, \"insert\", seq, log),\n onUpdate: createMutationHook(outbox, collectionId, \"update\", seq, log),\n onDelete: createMutationHook(outbox, collectionId, \"delete\", seq, log),\n });\n\n const collection = config.createCollection(options);\n const hasAcceptMutations = Boolean(\n (collection as AcceptMutationsCollection).utils?.acceptMutations,\n );\n\n log.debug(\"registered collection\", {\n collectionId,\n hasAcceptMutations,\n });\n\n (userCollections as Record<string, unknown>)[collectionId] = collection;\n }\n\n const collections = {\n ...(userCollections as CollectionMap<TDefs>),\n outbox,\n inbox,\n } as EventSourcedDB<TDefs>[\"collections\"];\n\n const replayTargets = collections as unknown as Record<string, AcceptMutationsCollection>;\n\n const subscriptions = [\n outbox.subscribeChanges(() => {}),\n inbox.subscribeChanges(() => {}),\n ];\n\n await outbox.preload();\n await inbox.preload();\n\n seq.value = nextLocalSeq(outbox);\n\n log.info(\"preloaded meta collections\", {\n outboxCount: outbox.state.size,\n inboxCount: inbox.state.size,\n nextLocalSeq: seq.value,\n });\n\n await replayInbox(inbox, replayTargets, log);\n\n async function sync(): Promise<SyncResult> {\n if (!transport) {\n log.warn(\"sync skipped: no transport configured\");\n return { pushed: 0, pulled: 0, errors: [] };\n }\n\n log.info(\"sync started\");\n\n await outbox.preload();\n await inbox.preload();\n\n const errors: Error[] = [];\n let pushed = 0;\n let pulled = 0;\n\n try {\n if (transport.push) {\n pushed = await pushOutbox(outbox, transport, log);\n } else {\n log.debug(\"push skipped: no push transport configured\");\n }\n } catch (err) {\n const error = toError(err);\n log.error(\"push outbox failed\", { message: error.message });\n errors.push(error);\n }\n\n try {\n if (transport.pull) {\n pulled = await pullInbox(outbox, inbox, transport, replayTargets, log);\n } else {\n log.debug(\"pull skipped: no pull transport configured\");\n }\n } catch (err) {\n const error = toError(err);\n log.error(\"pull inbox failed\", { message: error.message });\n errors.push(error);\n }\n\n log.info(\"sync finished\", { pushed, pulled, errorCount: errors.length });\n\n return { pushed, pulled, errors };\n }\n\n async function manualSync(): Promise<ManualSyncResult> {\n log.info(\"manual sync started\");\n\n await outbox.preload();\n await inbox.preload();\n\n const errors: Error[] = [];\n let pushed = 0;\n let pulled = 0;\n let replayed = 0;\n\n if (transport) {\n try {\n if (transport.push) {\n pushed = await pushOutbox(outbox, transport, log);\n } else {\n log.debug(\"manual sync push skipped: no push transport configured\");\n }\n } catch (err) {\n const error = toError(err);\n log.error(\"manual sync push failed\", { message: error.message });\n errors.push(error);\n }\n\n try {\n if (transport.pull) {\n pulled = await pullInbox(outbox, inbox, transport, replayTargets, log);\n } else {\n log.debug(\"manual sync pull skipped: no pull transport configured\");\n }\n } catch (err) {\n const error = toError(err);\n log.error(\"manual sync pull failed\", { message: error.message });\n errors.push(error);\n }\n } else {\n log.warn(\"manual sync: no transport configured, skipping push/pull\");\n }\n\n try {\n replayed = await replayInbox(inbox, replayTargets, log);\n } catch (err) {\n const error = toError(err);\n log.error(\"manual sync replay failed\", { message: error.message });\n errors.push(error);\n }\n\n log.info(\"manual sync finished\", { pushed, pulled, replayed, errorCount: errors.length });\n\n return { pushed, pulled, replayed, errors };\n }\n\n function dispose(): void {\n log.debug(\"disposing event-sourced db\");\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n }\n\n return { collections, sync, manualSync, dispose };\n}\n\nfunction createMetaCollection<TEntry extends object>(\n config: MetaCollectionFactory,\n id: string,\n getKey: (entry: TEntry) => string,\n schemaVersion: number,\n): Collection<TEntry, string> {\n const options = config.persistedCollectionOptions<TEntry, string>({\n id,\n getKey,\n persistence: config.persistence,\n schemaVersion,\n });\n\n return config.createCollection(options);\n}\n\nfunction createMutationHook(\n outbox: Collection<OutboxEntry, string>,\n collectionId: string,\n type: MutationType,\n seq: SeqCounter,\n log: EventSourcedLogger,\n) {\n return async (params: MutationHookParams): Promise<Record<string, unknown>> => {\n for (const mutation of params.transaction.mutations) {\n const payload = type === \"delete\" ? mutation.original : mutation.modified;\n\n const entry: OutboxEntry = {\n eventId: generateEventId(),\n collectionId,\n type,\n key: mutation.key,\n payload,\n timestamp: Date.now(),\n localSeq: seq.value++,\n globalSeq: null,\n sync: false,\n syncStatus: \"pending\",\n attemptCount: 0,\n lastAttemptAt: null,\n lastError: null,\n lastErrorCode: null,\n retryable: null,\n };\n\n await outbox.insert(entry).isPersisted.promise;\n\n log.debug(\"outbox entry created\", {\n eventId: entry.eventId,\n collectionId,\n type,\n key: entry.key,\n localSeq: entry.localSeq,\n });\n }\n\n return {};\n };\n}\n\nasync function pushOutbox(\n outbox: Collection<OutboxEntry, string>,\n transport: NormalizedSyncTransport & { push: NonNullable<NormalizedSyncTransport[\"push\"]> },\n log: EventSourcedLogger,\n): Promise<number> {\n const pending = [...outbox.state.values()]\n .filter((entry) => !entry.sync && entry.syncStatus !== \"failed\")\n .sort((a, b) => a.localSeq - b.localSeq);\n\n log.debug(\"push outbox\", { pendingCount: pending.length });\n\n if (pending.length === 0) return 0;\n\n const attemptAt = Date.now();\n\n for (const entry of pending) {\n await outbox\n .update(entry.eventId, (draft) => {\n draft.syncStatus = \"pending\";\n draft.attemptCount = (draft.attemptCount ?? 0) + 1;\n draft.lastAttemptAt = attemptAt;\n draft.lastError = null;\n draft.lastErrorCode = null;\n draft.retryable = null;\n })\n .isPersisted.promise;\n }\n\n const outbound: OutboundEvent[] = pending.map((entry) => ({\n eventId: entry.eventId,\n collectionId: entry.collectionId,\n type: entry.type,\n key: entry.key,\n payload: entry.payload,\n timestamp: entry.timestamp,\n }));\n\n const response = normalizePushResponse(await transport.push(outbound));\n\n log.info(\"push outbox confirmed\", {\n sent: outbound.length,\n confirmed: response.confirmed.length,\n failed: response.failed?.length ?? 0,\n });\n\n for (const confirmation of response.confirmed) {\n await outbox\n .update(confirmation.eventId, (draft) => {\n draft.sync = true;\n draft.syncStatus = \"synced\";\n draft.globalSeq = confirmation.globalSeq;\n draft.lastError = null;\n draft.lastErrorCode = null;\n draft.retryable = null;\n })\n .isPersisted.promise;\n\n log.debug(\"outbox entry marked pushed\", {\n eventId: confirmation.eventId,\n globalSeq: confirmation.globalSeq,\n });\n }\n\n for (const failure of response.failed ?? []) {\n await outbox\n .update(failure.eventId, (draft) => {\n draft.sync = false;\n draft.syncStatus = \"failed\";\n draft.lastError = failure.message;\n draft.lastErrorCode = failure.code ?? null;\n draft.retryable = failure.retryable ?? null;\n })\n .isPersisted.promise;\n\n log.warn(\"outbox entry marked failed\", {\n eventId: failure.eventId,\n message: failure.message,\n code: failure.code,\n retryable: failure.retryable,\n });\n }\n\n return response.confirmed.length;\n}\n\nasync function pullInbox(\n outbox: Collection<OutboxEntry, string>,\n inbox: Collection<InboxEntry, string>,\n transport: NormalizedSyncTransport & { pull: NonNullable<NormalizedSyncTransport[\"pull\"]> },\n targets: Record<string, AcceptMutationsCollection>,\n log: EventSourcedLogger,\n): Promise<number> {\n let pulled = 0;\n let hasMore = true;\n\n while (hasMore) {\n const since = currentSince(inbox);\n log.debug(\"pull inbox page\", { since });\n\n const response = await transport.pull(since);\n\n log.debug(\"pull inbox response\", {\n since,\n eventCount: response.events.length,\n hasMore: response.hasMore,\n cursor: response.cursor,\n });\n\n if (response.events.length === 0) break;\n\n const sorted = [...response.events].sort((a, b) => a.globalSeq - b.globalSeq);\n\n for (const event of sorted) {\n if (outbox.has(event.eventId)) {\n await markInboxEventSynced(inbox, event);\n\n log.debug(\"pull skipped: event originated locally\", {\n eventId: event.eventId,\n globalSeq: event.globalSeq,\n });\n continue;\n }\n\n const existing = inbox.get(event.eventId);\n if (existing?.sync) {\n log.debug(\"pull skipped: inbox already applied\", {\n eventId: event.eventId,\n globalSeq: event.globalSeq,\n });\n continue;\n }\n\n if (!existing) {\n await inbox.insert(toInboxEntry(event, false)).isPersisted.promise;\n log.debug(\"inbox entry inserted\", {\n eventId: event.eventId,\n globalSeq: event.globalSeq,\n collectionId: event.collectionId,\n });\n }\n\n const applied = await replayEvent(\n targets,\n event.collectionId,\n event.eventId,\n event.type,\n event.key,\n event.payload,\n log,\n );\n\n if (!applied) {\n return pulled;\n }\n\n await inbox\n .update(event.eventId, (draft) => {\n draft.sync = true;\n })\n .isPersisted.promise;\n\n log.info(\"pull replay applied\", {\n eventId: event.eventId,\n globalSeq: event.globalSeq,\n collectionId: event.collectionId,\n type: event.type,\n key: event.key,\n });\n\n pulled++;\n }\n\n hasMore = response.hasMore;\n }\n\n log.info(\"pull inbox finished\", { pulled });\n\n return pulled;\n}\n\nasync function replayInbox(\n inbox: Collection<InboxEntry, string>,\n targets: Record<string, AcceptMutationsCollection>,\n log: EventSourcedLogger,\n): Promise<number> {\n const pending = [...inbox.state.values()]\n .filter((entry) => !entry.sync)\n .sort((a, b) => a.globalSeq - b.globalSeq);\n\n log.info(\"pending inbox replay started\", { pendingCount: pending.length });\n\n let replayed = 0;\n\n for (const entry of pending) {\n const applied = await replayEvent(\n targets,\n entry.collectionId,\n entry.eventId,\n entry.type,\n entry.key,\n entry.payload,\n log,\n );\n\n if (!applied) {\n break;\n }\n\n await inbox\n .update(entry.eventId, (draft) => {\n draft.sync = true;\n })\n .isPersisted.promise;\n\n replayed++;\n\n log.info(\"pending inbox replay applied\", {\n eventId: entry.eventId,\n globalSeq: entry.globalSeq,\n collectionId: entry.collectionId,\n });\n }\n\n log.info(\"pending inbox replay finished\", { replayed });\n\n return replayed;\n}\n\nasync function replayEvent(\n targets: Record<string, AcceptMutationsCollection>,\n collectionId: string,\n eventId: string,\n type: MutationType,\n key: string | number,\n payload: Record<string, unknown>,\n log: EventSourcedLogger,\n): Promise<boolean> {\n if (RESERVED_IDS.has(collectionId)) {\n log.warn(\"replay skipped: reserved collection\", { eventId, collectionId, type, key });\n return false;\n }\n\n const target = targets[collectionId];\n if (!target) {\n log.warn(\"replay skipped: unknown collection\", {\n eventId,\n collectionId,\n type,\n key,\n knownCollections: Object.keys(targets).filter((id) => !RESERVED_IDS.has(id)),\n });\n return false;\n }\n\n if (!target.utils.acceptMutations) {\n log.warn(\"replay skipped: collection missing acceptMutations\", {\n eventId,\n collectionId,\n type,\n key,\n targetId: target.id,\n });\n return false;\n }\n\n log.debug(\"replay applying mutation\", { eventId, collectionId, type, key });\n\n try {\n await target.utils.acceptMutations({\n mutations: [\n {\n mutationId: eventId,\n type,\n key,\n modified: payload,\n original: payload,\n changes: payload,\n collection: target,\n },\n ],\n });\n\n log.info(\"replay mutation accepted\", { eventId, collectionId, type, key });\n } catch (err) {\n const error = toError(err);\n log.error(\"replay mutation failed\", {\n eventId,\n collectionId,\n type,\n key,\n message: error.message,\n });\n throw error;\n }\n\n return true;\n}\n\nfunction currentSince(inbox: Collection<InboxEntry, string>): number {\n let max = 0;\n\n for (const entry of inbox.state.values()) {\n if (entry.sync && entry.globalSeq > max) max = entry.globalSeq;\n }\n\n return max;\n}\n\nfunction nextLocalSeq(outbox: Collection<OutboxEntry, string>): number {\n let max = -1;\n\n for (const entry of outbox.state.values()) {\n if (entry.localSeq > max) max = entry.localSeq;\n }\n\n return max + 1;\n}\n\nasync function markInboxEventSynced(\n inbox: Collection<InboxEntry, string>,\n event: ServerEvent,\n): Promise<void> {\n const existing = inbox.get(event.eventId);\n\n if (!existing) {\n await inbox.insert(toInboxEntry(event, true)).isPersisted.promise;\n return;\n }\n\n if (!existing.sync || existing.globalSeq !== event.globalSeq) {\n await inbox\n .update(event.eventId, (draft) => {\n draft.globalSeq = event.globalSeq;\n draft.sync = true;\n })\n .isPersisted.promise;\n }\n}\n\nfunction toInboxEntry(event: ServerEvent, sync: boolean): InboxEntry {\n return {\n eventId: event.eventId,\n globalSeq: event.globalSeq,\n collectionId: event.collectionId,\n type: event.type,\n key: event.key,\n payload: event.payload,\n timestamp: event.timestamp,\n sync,\n };\n}\n\nfunction assertReservedNamesAvailable(collections: Record<string, unknown>): void {\n for (const id of Object.keys(collections)) {\n if (RESERVED_IDS.has(id)) {\n throw new Error(\n `Collection id \"${id}\" is reserved. \"outbox\" and \"inbox\" are built-in collections.`,\n );\n }\n }\n}\n\nfunction toError(err: unknown): Error {\n return err instanceof Error ? err : new Error(String(err));\n}\n"],"mappings":";;A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MAAM;CAGvD,OAAO;AACT;AAEA,SAAS,aAAa,QAAiD;CACrE,IAAI,MAAM;CAEV,KAAK,MAAM,SAAS,OAAO,MAAM,OAAO,GACtC,IAAI,MAAM,WAAW,KAAK,MAAM,MAAM;CAGxC,OAAO,MAAM;AACf;AAEA,eAAe,qBACb,OACA,OACe;CACf,MAAM,WAAW,MAAM,IAAI,MAAM,OAAO;CAExC,IAAI,CAAC,UAAU;EACb,MAAM,MAAM,OAAO,aAAa,OAAO,IAAI,CAAC,CAAC,CAAC,YAAY;EAC1D;CACF;CAEA,IAAI,CAAC,SAAS,QAAQ,SAAS,cAAc,MAAM,WACjD,MAAM,MACH,OAAO,MAAM,UAAU,UAAU;EAChC,MAAM,YAAY,MAAM;EACxB,MAAM,OAAO;CACf,CAAC,CAAC,CACD,YAAY;AAEnB;AAEA,SAAS,aAAa,OAAoB,MAA2B;CACnE,OAAO;EACL,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,cAAc,MAAM;EACpB,MAAM,MAAM;EACZ,KAAK,MAAM;EACX,SAAS,MAAM;EACf,WAAW,MAAM;EACjB;CACF;AACF;AAEA,SAAS,6BAA6B,aAA4C;CAChF,KAAK,MAAM,MAAM,OAAO,KAAK,WAAW,GACtC,IAAI,aAAa,IAAI,EAAE,GACrB,MAAM,IAAI,MACR,kBAAkB,GAAG,8DACvB;AAGN;AAEA,SAAS,QAAQ,KAAqB;CACpC,OAAO,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAC3D"}
@@ -0,0 +1,19 @@
1
+ import { p as PersistedCollectionPersistence, x as SQLiteDriver } from "./types-CAT14Tbj.mjs";
2
+
3
+ //#region src/platforms/react-native.d.ts
4
+ type ReactNativePlatformDeps = {
5
+ createReactNativeSQLitePersistence: (options: {
6
+ database: SQLiteDriver;
7
+ }) => PersistedCollectionPersistence;
8
+ };
9
+ type ReactNativePlatformConfig = {
10
+ database: SQLiteDriver;
11
+ };
12
+ type ReactNativePlatformResult = {
13
+ driver: SQLiteDriver;
14
+ persistence: PersistedCollectionPersistence;
15
+ };
16
+ declare function createReactNativePlatform(deps: ReactNativePlatformDeps, config: ReactNativePlatformConfig): ReactNativePlatformResult;
17
+ //#endregion
18
+ export { type ReactNativePlatformConfig, type ReactNativePlatformDeps, type ReactNativePlatformResult, createReactNativePlatform };
19
+ //# sourceMappingURL=react-native.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.d.mts","names":[],"sources":["../src/platforms/react-native.ts"],"mappings":";;;KAEY,uBAAA;EACV,kCAAA,GAAqC,OAAA;IACnC,QAAA,EAAU,YAAA;EAAA,MACN,8BAA8B;AAAA;AAAA,KAG1B,yBAAA;EACV,QAAA,EAAU,YAAY;AAAA;AAAA,KAGZ,yBAAA;EACV,MAAA,EAAQ,YAAA;EACR,WAAA,EAAa,8BAA8B;AAAA;AAAA,iBAG7B,yBAAA,CACd,IAAA,EAAM,uBAAA,EACN,MAAA,EAAQ,yBAAA,GACP,yBAAA"}