@fatagnus/dink-convex 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.
Files changed (49) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +282 -0
  3. package/convex/convex.config.ts +23 -0
  4. package/convex/crons.ts +37 -0
  5. package/convex/http.ts +421 -0
  6. package/convex/index.ts +20 -0
  7. package/convex/install.ts +172 -0
  8. package/convex/outbox.ts +198 -0
  9. package/convex/outboxProcessor.ts +240 -0
  10. package/convex/schema.ts +97 -0
  11. package/convex/sync.ts +327 -0
  12. package/dist/component.d.ts +34 -0
  13. package/dist/component.d.ts.map +1 -0
  14. package/dist/component.js +35 -0
  15. package/dist/component.js.map +1 -0
  16. package/dist/crdt.d.ts +82 -0
  17. package/dist/crdt.d.ts.map +1 -0
  18. package/dist/crdt.js +134 -0
  19. package/dist/crdt.js.map +1 -0
  20. package/dist/factories.d.ts +80 -0
  21. package/dist/factories.d.ts.map +1 -0
  22. package/dist/factories.js +159 -0
  23. package/dist/factories.js.map +1 -0
  24. package/dist/http.d.ts +238 -0
  25. package/dist/http.d.ts.map +1 -0
  26. package/dist/http.js +222 -0
  27. package/dist/http.js.map +1 -0
  28. package/dist/httpFactory.d.ts +39 -0
  29. package/dist/httpFactory.d.ts.map +1 -0
  30. package/dist/httpFactory.js +128 -0
  31. package/dist/httpFactory.js.map +1 -0
  32. package/dist/index.d.ts +68 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +73 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/schema.d.ts +217 -0
  37. package/dist/schema.d.ts.map +1 -0
  38. package/dist/schema.js +195 -0
  39. package/dist/schema.js.map +1 -0
  40. package/dist/syncFactories.d.ts +240 -0
  41. package/dist/syncFactories.d.ts.map +1 -0
  42. package/dist/syncFactories.js +623 -0
  43. package/dist/syncFactories.js.map +1 -0
  44. package/dist/triggers.d.ts +442 -0
  45. package/dist/triggers.d.ts.map +1 -0
  46. package/dist/triggers.js +705 -0
  47. package/dist/triggers.js.map +1 -0
  48. package/package.json +108 -0
  49. package/scripts/check-peer-deps.cjs +132 -0
@@ -0,0 +1,442 @@
1
+ /**
2
+ * Triggers setup for automatic sync on database writes.
3
+ *
4
+ * Uses convex-helpers Triggers to intercept database operations and
5
+ * automatically generate CRDT deltas for synced tables.
6
+ *
7
+ * @module triggers
8
+ */
9
+ import { Triggers } from "convex-helpers/server/triggers";
10
+ import type { GenericDataModel } from "convex/server";
11
+ /**
12
+ * Get the next sequence number for delta ordering.
13
+ * @deprecated Use getNextSeqAsync or createSequenceCounter for persisted sequences.
14
+ * This synchronous version uses an in-memory counter that resets on redeploy.
15
+ * @returns The next sequence number
16
+ */
17
+ export declare function getNextSeq(): number;
18
+ /**
19
+ * Database context type for sequence queries.
20
+ */
21
+ interface SequenceDb {
22
+ query: (table: string) => {
23
+ withIndex: (indexName: string, queryFn: (q: {
24
+ eq: (field: string, value: string) => unknown;
25
+ }) => unknown) => {
26
+ order: (dir: "desc") => {
27
+ first: () => Promise<{
28
+ seq: number;
29
+ } | null>;
30
+ };
31
+ };
32
+ };
33
+ }
34
+ /**
35
+ * Get the next sequence number by querying the database.
36
+ * This async version queries _sync_deltas to find the max seq and returns max + 1.
37
+ *
38
+ * @param db - Database context with query capability
39
+ * @param collection - The collection name to get the next sequence for
40
+ * @returns Promise<number> - The next sequence number
41
+ */
42
+ export declare function getNextSeqAsync(db: SequenceDb, collection: string): Promise<number>;
43
+ /**
44
+ * Sequence counter interface for cached sequence generation.
45
+ */
46
+ export interface SequenceCounter {
47
+ /**
48
+ * Get the next sequence number for a collection.
49
+ * Caches the max seq after first query to avoid repeated database lookups.
50
+ */
51
+ getNext: (db: SequenceDb, collection: string) => Promise<number>;
52
+ /**
53
+ * Reset the cache, forcing the next getNext call to query the database.
54
+ */
55
+ reset: () => void;
56
+ }
57
+ /**
58
+ * Create a sequence counter with request-level caching.
59
+ *
60
+ * The counter queries the database once per collection to get the max seq,
61
+ * then increments locally for subsequent calls within the same request context.
62
+ * This avoids querying the database on every call while still persisting
63
+ * sequences across redeploys.
64
+ *
65
+ * @returns SequenceCounter - A counter object with getNext and reset methods
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const counter = createSequenceCounter();
70
+ * const seq1 = await counter.getNext(ctx.db, "tasks"); // Queries DB
71
+ * const seq2 = await counter.getNext(ctx.db, "tasks"); // Uses cache
72
+ * const seq3 = await counter.getNext(ctx.db, "users"); // Queries DB (different collection)
73
+ * ```
74
+ */
75
+ export declare function createSequenceCounter(): SequenceCounter;
76
+ /**
77
+ * Register a table for sync.
78
+ * Tables registered here will have triggers applied to generate CRDT deltas.
79
+ *
80
+ * @param tableName - The name of the table to register
81
+ */
82
+ export declare function registerSyncedTable(tableName: string): void;
83
+ /**
84
+ * Check if a table is registered for sync.
85
+ *
86
+ * @param tableName - The name of the table to check
87
+ * @returns True if the table is registered for sync
88
+ */
89
+ export declare function isSyncedTable(tableName: string): boolean;
90
+ /**
91
+ * Get sync configuration for a table.
92
+ * In production, this would query the _sync_config table.
93
+ *
94
+ * @param tableName - The name of the table
95
+ * @returns Sync configuration or null if not synced
96
+ */
97
+ export declare function getSyncConfig(tableName: string): {
98
+ enabled: boolean;
99
+ } | null;
100
+ /**
101
+ * Database context type for _sync_config queries.
102
+ */
103
+ interface SyncConfigDb {
104
+ query: (table: string) => {
105
+ withIndex: (indexName: string, queryFn: (q: {
106
+ eq: (field: string, value: string) => unknown;
107
+ }) => unknown) => {
108
+ first: () => Promise<{
109
+ collection: string;
110
+ enabled: boolean;
111
+ } | null>;
112
+ };
113
+ };
114
+ }
115
+ /**
116
+ * Check if sync is enabled for a collection by querying _sync_config table.
117
+ * This is the production-ready version that queries the database.
118
+ *
119
+ * @param db - Database context with query capability
120
+ * @param collection - The collection name to check
121
+ * @returns Promise<boolean> - True if sync is enabled for this collection
122
+ */
123
+ export declare function checkSyncConfigEnabled(db: SyncConfigDb, collection: string): Promise<boolean>;
124
+ /**
125
+ * Create a sync config checker function.
126
+ * Returns a function that can be used to check sync status with caching.
127
+ *
128
+ * @returns A checker function that takes (db, collection) and returns Promise<boolean>
129
+ */
130
+ export declare function createSyncConfigChecker(): (db: SyncConfigDb, collection: string) => Promise<boolean>;
131
+ /**
132
+ * Document type with sync ID field.
133
+ * Uses 'syncId' (not '_syncId') to match the field name created by syncedTable().
134
+ */
135
+ interface SyncedDocument {
136
+ _id: string;
137
+ syncId: string;
138
+ [key: string]: unknown;
139
+ }
140
+ /**
141
+ * Generate a CRDT delta for a newly inserted document.
142
+ * Creates a Yjs document with all fields set.
143
+ *
144
+ * @param doc - The inserted document
145
+ * @returns CRDT delta as Uint8Array
146
+ */
147
+ export declare function generateInsertDelta(doc: SyncedDocument): Uint8Array;
148
+ /**
149
+ * Generate a CRDT delta for an updated document.
150
+ * Creates a delta containing only the changed fields.
151
+ *
152
+ * @param oldDoc - The document before update
153
+ * @param newDoc - The document after update
154
+ * @returns CRDT delta as Uint8Array
155
+ */
156
+ export declare function generateUpdateDelta(oldDoc: SyncedDocument, newDoc: SyncedDocument): Uint8Array;
157
+ /**
158
+ * Generate a tombstone CRDT delta for a deleted document.
159
+ * Creates a special delta indicating the document was deleted.
160
+ *
161
+ * @param doc - The deleted document
162
+ * @returns CRDT delta as Uint8Array representing a tombstone
163
+ */
164
+ export declare function generateDeleteDelta(doc: SyncedDocument): Uint8Array;
165
+ /**
166
+ * Input for creating a delta record.
167
+ */
168
+ interface DeltaRecordInput {
169
+ collection: string;
170
+ docId: string;
171
+ bytes: Uint8Array;
172
+ seq: number;
173
+ }
174
+ /**
175
+ * Delta record structure for _sync_deltas table.
176
+ */
177
+ interface DeltaRecord {
178
+ collection: string;
179
+ docId: string;
180
+ bytes: Uint8Array;
181
+ seq: number;
182
+ timestamp: number;
183
+ }
184
+ /**
185
+ * Create a delta record for storage in _sync_deltas.
186
+ *
187
+ * @param input - Delta record input
188
+ * @returns Complete delta record with timestamp
189
+ */
190
+ export declare function createDeltaRecord(input: DeltaRecordInput): DeltaRecord;
191
+ /**
192
+ * Input for creating an outbox record.
193
+ */
194
+ interface OutboxRecordInput {
195
+ collection: string;
196
+ docId: string;
197
+ delta: Uint8Array;
198
+ seq: number;
199
+ }
200
+ /**
201
+ * Outbox record structure for _sync_outbox table.
202
+ */
203
+ interface OutboxRecord {
204
+ collection: string;
205
+ docId: string;
206
+ delta: Uint8Array;
207
+ seq: number;
208
+ status: string;
209
+ retries: number;
210
+ createdAt: number;
211
+ }
212
+ /**
213
+ * Create an outbox record for storage in _sync_outbox.
214
+ *
215
+ * @param input - Outbox record input
216
+ * @returns Complete outbox record with status and timestamps
217
+ */
218
+ export declare function createOutboxRecord(input: OutboxRecordInput): OutboxRecord;
219
+ /**
220
+ * Change type from convex-helpers Triggers.
221
+ */
222
+ interface Change<T> {
223
+ id: string;
224
+ operation: "insert" | "update" | "delete";
225
+ oldDoc: T | null;
226
+ newDoc: T | null;
227
+ }
228
+ /**
229
+ * Context type for trigger handlers.
230
+ */
231
+ interface TriggerContext {
232
+ innerDb: {
233
+ insert: (table: string, doc: Record<string, unknown>) => Promise<string>;
234
+ };
235
+ }
236
+ /**
237
+ * Create a sync trigger handler for a specific table.
238
+ * This handler generates CRDT deltas and stores them on database changes.
239
+ *
240
+ * @param tableName - The name of the table to handle
241
+ * @returns Trigger handler function
242
+ */
243
+ export declare function createSyncTriggerHandler(tableName: string): (ctx: TriggerContext, change: Change<SyncedDocument>) => Promise<void>;
244
+ /**
245
+ * Type for sync trigger handler functions.
246
+ */
247
+ type SyncTriggerHandler = (ctx: TriggerContext, change: Change<SyncedDocument>) => Promise<void>;
248
+ /**
249
+ * Context type for async trigger handlers that need database access for sequences.
250
+ */
251
+ interface AsyncTriggerContext extends TriggerContext {
252
+ db: SequenceDb;
253
+ }
254
+ /**
255
+ * Create a sync trigger handler that uses persisted sequence numbers.
256
+ * This async version queries the database to get the max sequence number,
257
+ * ensuring sequences persist across redeploys.
258
+ *
259
+ * @param tableName - The name of the table to handle
260
+ * @returns Trigger handler function that uses async sequence generation
261
+ */
262
+ export declare function createSyncTriggerHandlerAsync(tableName: string): (ctx: AsyncTriggerContext, change: Change<SyncedDocument>) => Promise<void>;
263
+ /**
264
+ * Map-like wrapper that provides backward compatibility for registered triggers.
265
+ * Wraps the object-based `registered` property from convex-helpers Triggers
266
+ * to provide Map-like `has()` and `get()` methods.
267
+ */
268
+ declare class RegisteredTriggersMap {
269
+ private _storage;
270
+ constructor();
271
+ has(tableName: string): boolean;
272
+ get(tableName: string): SyncTriggerHandler[] | undefined;
273
+ set(tableName: string, handlers: SyncTriggerHandler[]): void;
274
+ getOrCreate(tableName: string): SyncTriggerHandler[];
275
+ }
276
+ /**
277
+ * Sync triggers wrapper that uses convex-helpers Triggers internally.
278
+ * Provides backward compatibility with Map-like `registered` property
279
+ * while leveraging the real Triggers implementation.
280
+ */
281
+ declare class SyncTriggersWrapper {
282
+ /**
283
+ * Internal Triggers instance from convex-helpers.
284
+ * Uses GenericDataModel for flexibility across different Convex apps.
285
+ */
286
+ private _triggers;
287
+ /**
288
+ * Map-like storage for backward compatibility with existing tests.
289
+ */
290
+ registered: RegisteredTriggersMap;
291
+ constructor();
292
+ /**
293
+ * Register a trigger for a table.
294
+ * Registers with both the internal Triggers instance and the Map for compatibility.
295
+ */
296
+ register(tableName: string, handler: SyncTriggerHandler): void;
297
+ /**
298
+ * Wrap DB to apply triggers.
299
+ * Uses the real Triggers.wrapDB from convex-helpers.
300
+ */
301
+ wrapDB<T extends {
302
+ db: unknown;
303
+ }>(ctx: T): T;
304
+ /**
305
+ * Get the underlying Triggers instance for advanced usage.
306
+ */
307
+ getTriggersInstance(): Triggers<GenericDataModel>;
308
+ }
309
+ /**
310
+ * Sync triggers instance.
311
+ * Uses convex-helpers Triggers internally for real database wrapping
312
+ * while maintaining backward compatibility with Map-like `registered` property.
313
+ */
314
+ export declare const syncTriggers: SyncTriggersWrapper;
315
+ /**
316
+ * Context type for config-aware trigger handlers.
317
+ */
318
+ interface ConfigAwareTriggerContext extends TriggerContext {
319
+ db: SyncConfigDb;
320
+ }
321
+ /**
322
+ * Create a new Triggers instance for sync operations.
323
+ * This factory function creates a real convex-helpers Triggers instance
324
+ * that can be used to wrap database operations with trigger support.
325
+ *
326
+ * @returns A new Triggers instance with register and wrapDB methods
327
+ *
328
+ * @example
329
+ * ```typescript
330
+ * import { createSyncTriggers } from "@fatagnus/dink-convex";
331
+ * import { customMutation } from "convex-helpers/server/customFunctions";
332
+ * import { mutation as rawMutation } from "./_generated/server";
333
+ *
334
+ * const triggers = createSyncTriggers();
335
+ * triggers.register("tasks", async (ctx, change) => {
336
+ * console.log("Task changed:", change);
337
+ * });
338
+ *
339
+ * export const mutation = customMutation(rawMutation, customCtx(triggers.wrapDB));
340
+ * ```
341
+ */
342
+ export declare function createSyncTriggers<DataModel extends GenericDataModel = GenericDataModel>(): Triggers<DataModel>;
343
+ /**
344
+ * Create a Triggers instance with sync handlers pre-registered for specified tables.
345
+ * This is a convenience function that creates a Triggers instance and automatically
346
+ * registers sync trigger handlers that generate CRDT deltas for the specified tables.
347
+ *
348
+ * @param tableNames - Array of table names to register sync handlers for
349
+ * @returns A Triggers instance with sync handlers registered
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * import { createSyncTriggersWithHandlers } from "@fatagnus/dink-convex";
354
+ * import { customMutation } from "convex-helpers/server/customFunctions";
355
+ * import { mutation as rawMutation } from "./_generated/server";
356
+ *
357
+ * // Creates triggers with sync handlers for tasks and users tables
358
+ * const triggers = createSyncTriggersWithHandlers(["tasks", "users"]);
359
+ *
360
+ * export const mutation = customMutation(rawMutation, customCtx(triggers.wrapDB));
361
+ * ```
362
+ */
363
+ export declare function createSyncTriggersWithHandlers<DataModel extends GenericDataModel = GenericDataModel>(tableNames: string[]): Triggers<DataModel>;
364
+ /**
365
+ * Create a sync trigger handler that checks _sync_config before processing.
366
+ * This is the production version that queries the database for config.
367
+ *
368
+ * @param tableName - The name of the table to handle
369
+ * @returns Trigger handler function that checks _sync_config
370
+ */
371
+ export declare function createConfigAwareSyncTriggerHandler(tableName: string): (ctx: ConfigAwareTriggerContext, change: Change<SyncedDocument>) => Promise<void>;
372
+ /**
373
+ * Scheduler interface for immediate outbox processing.
374
+ */
375
+ interface OutboxScheduler {
376
+ runAfter: (delay: number, fn: unknown, args?: unknown) => void;
377
+ }
378
+ /**
379
+ * Schedule immediate outbox processing.
380
+ *
381
+ * This helper function calls scheduler.runAfter(0, ...) to trigger
382
+ * immediate processing of the outbox. It's designed to be called
383
+ * after inserting to _sync_outbox to provide near real-time sync.
384
+ *
385
+ * If scheduler is null/undefined, this is a no-op (graceful degradation
386
+ * for contexts where scheduling isn't available).
387
+ *
388
+ * @param scheduler - The Convex scheduler object or null/undefined
389
+ * @returns Promise that resolves when scheduling is complete
390
+ */
391
+ export declare function scheduleImmediateProcessing(scheduler: OutboxScheduler | null | undefined): Promise<void>;
392
+ /**
393
+ * Context type for trigger handlers with scheduling support.
394
+ */
395
+ interface SchedulingTriggerContext extends TriggerContext {
396
+ scheduler?: OutboxScheduler;
397
+ }
398
+ /**
399
+ * Create a sync trigger handler with immediate scheduling support.
400
+ *
401
+ * This handler generates CRDT deltas, stores them, and schedules
402
+ * immediate outbox processing for near real-time sync.
403
+ *
404
+ * @param tableName - The name of the table to handle
405
+ * @returns Trigger handler function with scheduling support
406
+ */
407
+ export declare function createSyncTriggerHandlerWithScheduling(tableName: string): (ctx: SchedulingTriggerContext, change: Change<SyncedDocument>) => Promise<void>;
408
+ /**
409
+ * Custom mutation wrapper that includes trigger logic.
410
+ *
411
+ * This is a factory function that creates mutations with sync triggers enabled.
412
+ * In production, this would use customMutation from convex-helpers combined with
413
+ * the syncTriggers.wrapDB function.
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * import { customMutation } from "@fatagnus/dink-convex";
418
+ *
419
+ * export const createTask = customMutation({
420
+ * args: { text: v.string() },
421
+ * handler: async (ctx, args) => {
422
+ * return await ctx.db.insert("tasks", {
423
+ * text: args.text,
424
+ * syncId: generateSyncId(),
425
+ * });
426
+ * },
427
+ * });
428
+ * ```
429
+ */
430
+ export declare function customMutation<Args, Returns>(config: {
431
+ args: Args;
432
+ handler: (ctx: {
433
+ db: unknown;
434
+ }, args: Args) => Promise<Returns>;
435
+ }): {
436
+ args: Args;
437
+ handler: (ctx: {
438
+ db: unknown;
439
+ }, args: Args) => Promise<Returns>;
440
+ };
441
+ export {};
442
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../src/triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AAe1E;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,UAAU,UAAU;IAClB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK;QACxB,SAAS,EAAE,CACT,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,CAAC,EAAE;YAAE,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;SAAE,KAAK,OAAO,KACvE;YACH,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK;gBACtB,KAAK,EAAE,MAAM,OAAO,CAAC;oBAAE,GAAG,EAAE,MAAM,CAAA;iBAAE,GAAG,IAAI,CAAC,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,EAAE,EAAE,UAAU,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EA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