@morlay/session-rdb 0.0.14 → 0.0.16-alpha.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 (65) hide show
  1. package/README.md +11 -13
  2. package/dist/artifact.d.mts +6 -16
  3. package/dist/artifact.mjs +3 -3
  4. package/dist/{import-B-tf5vQn.mjs → import-CKrzjXVB.mjs} +73 -83
  5. package/dist/import.d.mts +2 -3
  6. package/dist/import.mjs +2 -2
  7. package/dist/index-CgGDHQSK.d.mts +225 -0
  8. package/dist/index.d.mts +3 -3
  9. package/dist/index.mjs +694 -169
  10. package/dist/log-DTJsxMud.mjs +314 -0
  11. package/dist/{schema-CFXZURX7.d.mts → schema-COK7-wRV.d.mts} +3 -15
  12. package/dist/sqlite-DCy4VTD8.mjs +698 -0
  13. package/dist/storage.d.mts +2 -7
  14. package/dist/storage.mjs +2 -3
  15. package/dist/testing.d.mts +30 -1
  16. package/dist/testing.mjs +676 -1991
  17. package/drizzle/postgres/20260908072805_v2_initial/migration.sql +58 -0
  18. package/drizzle/postgres/20260908072805_v2_initial/snapshot.json +686 -0
  19. package/drizzle/postgres/20260908072806_v3_drop_original_seq/migration.sql +1 -0
  20. package/drizzle/postgres/20260908072806_v3_drop_original_seq/snapshot.json +673 -0
  21. package/drizzle/sqlite/20260908072751_v2_initial/migration.sql +53 -0
  22. package/drizzle/sqlite/20260908072751_v2_initial/snapshot.json +492 -0
  23. package/drizzle/sqlite/20260908072752_v3_drop_original_seq/migration.sql +6 -0
  24. package/drizzle/sqlite/20260908072752_v3_drop_original_seq/snapshot.json +513 -0
  25. package/package.json +17 -12
  26. package/src/adapters/index.ts +10 -2
  27. package/src/adapters/to-postgres.ts +19 -15
  28. package/src/adapters/to-sqlite.ts +20 -14
  29. package/src/{entities → adapters}/types.ts +7 -8
  30. package/src/backend.ts +0 -7
  31. package/src/branch.ts +29 -110
  32. package/src/drizzle/postgres-v2.ts +11 -0
  33. package/src/drizzle/postgres-v3.ts +11 -0
  34. package/src/drizzle/sqlite-v2.ts +10 -0
  35. package/src/drizzle/sqlite-v3.ts +11 -0
  36. package/src/entities/index.ts +2 -30
  37. package/src/entities/v2/index.ts +20 -0
  38. package/src/entities/v2/session-events.ts +11 -0
  39. package/src/entities/v3/events.ts +27 -0
  40. package/src/entities/v3/index.ts +27 -0
  41. package/src/entities/v3/persistence-state.ts +10 -0
  42. package/src/entities/v3/schema-meta.ts +9 -0
  43. package/src/entities/v3/session-events.ts +26 -0
  44. package/src/entities/v3/sessions.ts +20 -0
  45. package/src/import.ts +65 -57
  46. package/src/index.ts +868 -223
  47. package/src/invariant.ts +0 -2
  48. package/src/legacy.ts +67 -0
  49. package/src/log.ts +41 -81
  50. package/src/postgres.ts +75 -93
  51. package/src/schema.ts +3 -14
  52. package/src/sqlite.ts +59 -46
  53. package/src/testing/contract.ts +460 -375
  54. package/src/testing/coordinator-contract.ts +108 -1374
  55. package/src/testing.ts +1 -6
  56. package/dist/index-uUvn6gYp.d.mts +0 -111
  57. package/dist/schema-BfPVmr1X.mjs +0 -875
  58. package/dist/sqlite-BUWnS0so.mjs +0 -356
  59. package/src/adapters/ddl.ts +0 -77
  60. package/src/entities/events.ts +0 -27
  61. package/src/entities/persistence-state.ts +0 -10
  62. package/src/entities/schema-meta.ts +0 -9
  63. package/src/entities/session-events.ts +0 -29
  64. package/src/entities/sessions.ts +0 -20
  65. package/src/migrate.ts +0 -137
@@ -0,0 +1,673 @@
1
+ {
2
+ "version": "8",
3
+ "dialect": "postgres",
4
+ "id": "d4f668b2-5d9b-4755-8dba-5ab2c30cf372",
5
+ "prevIds": ["f8eb0d0c-5310-4cf5-bf7c-48578a99b463"],
6
+ "ddl": [
7
+ {
8
+ "isRlsEnabled": false,
9
+ "name": "t_events",
10
+ "entityType": "tables",
11
+ "schema": "public"
12
+ },
13
+ {
14
+ "isRlsEnabled": false,
15
+ "name": "t_persistence_state",
16
+ "entityType": "tables",
17
+ "schema": "public"
18
+ },
19
+ {
20
+ "isRlsEnabled": false,
21
+ "name": "t_schema_meta",
22
+ "entityType": "tables",
23
+ "schema": "public"
24
+ },
25
+ {
26
+ "isRlsEnabled": false,
27
+ "name": "t_session_events",
28
+ "entityType": "tables",
29
+ "schema": "public"
30
+ },
31
+ {
32
+ "isRlsEnabled": false,
33
+ "name": "t_sessions",
34
+ "entityType": "tables",
35
+ "schema": "public"
36
+ },
37
+ {
38
+ "type": "serial",
39
+ "typeSchema": null,
40
+ "notNull": true,
41
+ "dimensions": 0,
42
+ "default": null,
43
+ "generated": null,
44
+ "identity": null,
45
+ "name": "f_id",
46
+ "entityType": "columns",
47
+ "schema": "public",
48
+ "table": "t_events"
49
+ },
50
+ {
51
+ "type": "text",
52
+ "typeSchema": null,
53
+ "notNull": true,
54
+ "dimensions": 0,
55
+ "default": null,
56
+ "generated": null,
57
+ "identity": null,
58
+ "name": "f_event_id",
59
+ "entityType": "columns",
60
+ "schema": "public",
61
+ "table": "t_events"
62
+ },
63
+ {
64
+ "type": "text",
65
+ "typeSchema": null,
66
+ "notNull": true,
67
+ "dimensions": 0,
68
+ "default": "''",
69
+ "generated": null,
70
+ "identity": null,
71
+ "name": "f_parent_id",
72
+ "entityType": "columns",
73
+ "schema": "public",
74
+ "table": "t_events"
75
+ },
76
+ {
77
+ "type": "text",
78
+ "typeSchema": null,
79
+ "notNull": true,
80
+ "dimensions": 0,
81
+ "default": "''",
82
+ "generated": null,
83
+ "identity": null,
84
+ "name": "f_type",
85
+ "entityType": "columns",
86
+ "schema": "public",
87
+ "table": "t_events"
88
+ },
89
+ {
90
+ "type": "text",
91
+ "typeSchema": null,
92
+ "notNull": true,
93
+ "dimensions": 0,
94
+ "default": "''",
95
+ "generated": null,
96
+ "identity": null,
97
+ "name": "f_kind",
98
+ "entityType": "columns",
99
+ "schema": "public",
100
+ "table": "t_events"
101
+ },
102
+ {
103
+ "type": "text",
104
+ "typeSchema": null,
105
+ "notNull": true,
106
+ "dimensions": 0,
107
+ "default": "''",
108
+ "generated": null,
109
+ "identity": null,
110
+ "name": "f_role",
111
+ "entityType": "columns",
112
+ "schema": "public",
113
+ "table": "t_events"
114
+ },
115
+ {
116
+ "type": "text",
117
+ "typeSchema": null,
118
+ "notNull": true,
119
+ "dimensions": 0,
120
+ "default": "''",
121
+ "generated": null,
122
+ "identity": null,
123
+ "name": "f_name",
124
+ "entityType": "columns",
125
+ "schema": "public",
126
+ "table": "t_events"
127
+ },
128
+ {
129
+ "type": "text",
130
+ "typeSchema": null,
131
+ "notNull": true,
132
+ "dimensions": 0,
133
+ "default": "''",
134
+ "generated": null,
135
+ "identity": null,
136
+ "name": "f_action_id",
137
+ "entityType": "columns",
138
+ "schema": "public",
139
+ "table": "t_events"
140
+ },
141
+ {
142
+ "type": "text",
143
+ "typeSchema": null,
144
+ "notNull": true,
145
+ "dimensions": 0,
146
+ "default": "''",
147
+ "generated": null,
148
+ "identity": null,
149
+ "name": "f_encoding",
150
+ "entityType": "columns",
151
+ "schema": "public",
152
+ "table": "t_events"
153
+ },
154
+ {
155
+ "type": "text",
156
+ "typeSchema": null,
157
+ "notNull": true,
158
+ "dimensions": 0,
159
+ "default": null,
160
+ "generated": null,
161
+ "identity": null,
162
+ "name": "f_data",
163
+ "entityType": "columns",
164
+ "schema": "public",
165
+ "table": "t_events"
166
+ },
167
+ {
168
+ "type": "bigint",
169
+ "typeSchema": null,
170
+ "notNull": true,
171
+ "dimensions": 0,
172
+ "default": "0",
173
+ "generated": null,
174
+ "identity": null,
175
+ "name": "f_created_at",
176
+ "entityType": "columns",
177
+ "schema": "public",
178
+ "table": "t_events"
179
+ },
180
+ {
181
+ "type": "integer",
182
+ "typeSchema": null,
183
+ "notNull": true,
184
+ "dimensions": 0,
185
+ "default": null,
186
+ "generated": null,
187
+ "identity": null,
188
+ "name": "f_singleton",
189
+ "entityType": "columns",
190
+ "schema": "public",
191
+ "table": "t_persistence_state"
192
+ },
193
+ {
194
+ "type": "text",
195
+ "typeSchema": null,
196
+ "notNull": true,
197
+ "dimensions": 0,
198
+ "default": null,
199
+ "generated": null,
200
+ "identity": null,
201
+ "name": "f_store_id",
202
+ "entityType": "columns",
203
+ "schema": "public",
204
+ "table": "t_persistence_state"
205
+ },
206
+ {
207
+ "type": "text",
208
+ "typeSchema": null,
209
+ "notNull": true,
210
+ "dimensions": 0,
211
+ "default": null,
212
+ "generated": null,
213
+ "identity": null,
214
+ "name": "f_key",
215
+ "entityType": "columns",
216
+ "schema": "public",
217
+ "table": "t_schema_meta"
218
+ },
219
+ {
220
+ "type": "text",
221
+ "typeSchema": null,
222
+ "notNull": true,
223
+ "dimensions": 0,
224
+ "default": null,
225
+ "generated": null,
226
+ "identity": null,
227
+ "name": "f_value",
228
+ "entityType": "columns",
229
+ "schema": "public",
230
+ "table": "t_schema_meta"
231
+ },
232
+ {
233
+ "type": "serial",
234
+ "typeSchema": null,
235
+ "notNull": true,
236
+ "dimensions": 0,
237
+ "default": null,
238
+ "generated": null,
239
+ "identity": null,
240
+ "name": "f_id",
241
+ "entityType": "columns",
242
+ "schema": "public",
243
+ "table": "t_session_events"
244
+ },
245
+ {
246
+ "type": "text",
247
+ "typeSchema": null,
248
+ "notNull": true,
249
+ "dimensions": 0,
250
+ "default": null,
251
+ "generated": null,
252
+ "identity": null,
253
+ "name": "f_session_id",
254
+ "entityType": "columns",
255
+ "schema": "public",
256
+ "table": "t_session_events"
257
+ },
258
+ {
259
+ "type": "text",
260
+ "typeSchema": null,
261
+ "notNull": true,
262
+ "dimensions": 0,
263
+ "default": null,
264
+ "generated": null,
265
+ "identity": null,
266
+ "name": "f_event_id",
267
+ "entityType": "columns",
268
+ "schema": "public",
269
+ "table": "t_session_events"
270
+ },
271
+ {
272
+ "type": "integer",
273
+ "typeSchema": null,
274
+ "notNull": true,
275
+ "dimensions": 0,
276
+ "default": null,
277
+ "generated": null,
278
+ "identity": null,
279
+ "name": "f_sequence",
280
+ "entityType": "columns",
281
+ "schema": "public",
282
+ "table": "t_session_events"
283
+ },
284
+ {
285
+ "type": "text",
286
+ "typeSchema": null,
287
+ "notNull": false,
288
+ "dimensions": 0,
289
+ "default": null,
290
+ "generated": null,
291
+ "identity": null,
292
+ "name": "f_surface_op",
293
+ "entityType": "columns",
294
+ "schema": "public",
295
+ "table": "t_session_events"
296
+ },
297
+ {
298
+ "type": "serial",
299
+ "typeSchema": null,
300
+ "notNull": true,
301
+ "dimensions": 0,
302
+ "default": null,
303
+ "generated": null,
304
+ "identity": null,
305
+ "name": "f_id",
306
+ "entityType": "columns",
307
+ "schema": "public",
308
+ "table": "t_sessions"
309
+ },
310
+ {
311
+ "type": "text",
312
+ "typeSchema": null,
313
+ "notNull": true,
314
+ "dimensions": 0,
315
+ "default": null,
316
+ "generated": null,
317
+ "identity": null,
318
+ "name": "f_session_id",
319
+ "entityType": "columns",
320
+ "schema": "public",
321
+ "table": "t_sessions"
322
+ },
323
+ {
324
+ "type": "text",
325
+ "typeSchema": null,
326
+ "notNull": true,
327
+ "dimensions": 0,
328
+ "default": "''",
329
+ "generated": null,
330
+ "identity": null,
331
+ "name": "f_head_event_id",
332
+ "entityType": "columns",
333
+ "schema": "public",
334
+ "table": "t_sessions"
335
+ },
336
+ {
337
+ "type": "integer",
338
+ "typeSchema": null,
339
+ "notNull": true,
340
+ "dimensions": 0,
341
+ "default": "-1",
342
+ "generated": null,
343
+ "identity": null,
344
+ "name": "f_head_sequence",
345
+ "entityType": "columns",
346
+ "schema": "public",
347
+ "table": "t_sessions"
348
+ },
349
+ {
350
+ "type": "integer",
351
+ "typeSchema": null,
352
+ "notNull": true,
353
+ "dimensions": 0,
354
+ "default": null,
355
+ "generated": null,
356
+ "identity": null,
357
+ "name": "f_version",
358
+ "entityType": "columns",
359
+ "schema": "public",
360
+ "table": "t_sessions"
361
+ },
362
+ {
363
+ "type": "bigint",
364
+ "typeSchema": null,
365
+ "notNull": true,
366
+ "dimensions": 0,
367
+ "default": null,
368
+ "generated": null,
369
+ "identity": null,
370
+ "name": "f_created_at",
371
+ "entityType": "columns",
372
+ "schema": "public",
373
+ "table": "t_sessions"
374
+ },
375
+ {
376
+ "type": "text",
377
+ "typeSchema": null,
378
+ "notNull": false,
379
+ "dimensions": 0,
380
+ "default": null,
381
+ "generated": null,
382
+ "identity": null,
383
+ "name": "f_cwd",
384
+ "entityType": "columns",
385
+ "schema": "public",
386
+ "table": "t_sessions"
387
+ },
388
+ {
389
+ "type": "text",
390
+ "typeSchema": null,
391
+ "notNull": false,
392
+ "dimensions": 0,
393
+ "default": null,
394
+ "generated": null,
395
+ "identity": null,
396
+ "name": "f_parent_session",
397
+ "entityType": "columns",
398
+ "schema": "public",
399
+ "table": "t_sessions"
400
+ },
401
+ {
402
+ "type": "integer",
403
+ "typeSchema": null,
404
+ "notNull": false,
405
+ "dimensions": 0,
406
+ "default": null,
407
+ "generated": null,
408
+ "identity": null,
409
+ "name": "f_seed_length",
410
+ "entityType": "columns",
411
+ "schema": "public",
412
+ "table": "t_sessions"
413
+ },
414
+ {
415
+ "type": "text",
416
+ "typeSchema": null,
417
+ "notNull": false,
418
+ "dimensions": 0,
419
+ "default": null,
420
+ "generated": null,
421
+ "identity": null,
422
+ "name": "f_origin",
423
+ "entityType": "columns",
424
+ "schema": "public",
425
+ "table": "t_sessions"
426
+ },
427
+ {
428
+ "type": "integer",
429
+ "typeSchema": null,
430
+ "notNull": false,
431
+ "dimensions": 0,
432
+ "default": null,
433
+ "generated": null,
434
+ "identity": null,
435
+ "name": "f_delegation_depth",
436
+ "entityType": "columns",
437
+ "schema": "public",
438
+ "table": "t_sessions"
439
+ },
440
+ {
441
+ "type": "text",
442
+ "typeSchema": null,
443
+ "notNull": true,
444
+ "dimensions": 0,
445
+ "default": null,
446
+ "generated": null,
447
+ "identity": null,
448
+ "name": "f_incarnation",
449
+ "entityType": "columns",
450
+ "schema": "public",
451
+ "table": "t_sessions"
452
+ },
453
+ {
454
+ "type": "integer",
455
+ "typeSchema": null,
456
+ "notNull": true,
457
+ "dimensions": 0,
458
+ "default": null,
459
+ "generated": null,
460
+ "identity": null,
461
+ "name": "f_revision",
462
+ "entityType": "columns",
463
+ "schema": "public",
464
+ "table": "t_sessions"
465
+ },
466
+ {
467
+ "nameExplicit": true,
468
+ "columns": [
469
+ {
470
+ "value": "f_kind",
471
+ "isExpression": false,
472
+ "asc": true,
473
+ "nullsFirst": false,
474
+ "opclass": null
475
+ }
476
+ ],
477
+ "isUnique": false,
478
+ "where": null,
479
+ "with": "",
480
+ "method": "btree",
481
+ "concurrently": false,
482
+ "name": "idx_events_kind",
483
+ "entityType": "indexes",
484
+ "schema": "public",
485
+ "table": "t_events"
486
+ },
487
+ {
488
+ "nameExplicit": true,
489
+ "columns": [
490
+ {
491
+ "value": "f_role",
492
+ "isExpression": false,
493
+ "asc": true,
494
+ "nullsFirst": false,
495
+ "opclass": null
496
+ }
497
+ ],
498
+ "isUnique": false,
499
+ "where": null,
500
+ "with": "",
501
+ "method": "btree",
502
+ "concurrently": false,
503
+ "name": "idx_events_role",
504
+ "entityType": "indexes",
505
+ "schema": "public",
506
+ "table": "t_events"
507
+ },
508
+ {
509
+ "nameExplicit": true,
510
+ "columns": [
511
+ {
512
+ "value": "f_name",
513
+ "isExpression": false,
514
+ "asc": true,
515
+ "nullsFirst": false,
516
+ "opclass": null
517
+ }
518
+ ],
519
+ "isUnique": false,
520
+ "where": null,
521
+ "with": "",
522
+ "method": "btree",
523
+ "concurrently": false,
524
+ "name": "idx_events_name",
525
+ "entityType": "indexes",
526
+ "schema": "public",
527
+ "table": "t_events"
528
+ },
529
+ {
530
+ "nameExplicit": true,
531
+ "columns": [
532
+ {
533
+ "value": "f_action_id",
534
+ "isExpression": false,
535
+ "asc": true,
536
+ "nullsFirst": false,
537
+ "opclass": null
538
+ }
539
+ ],
540
+ "isUnique": false,
541
+ "where": null,
542
+ "with": "",
543
+ "method": "btree",
544
+ "concurrently": false,
545
+ "name": "idx_events_action_id",
546
+ "entityType": "indexes",
547
+ "schema": "public",
548
+ "table": "t_events"
549
+ },
550
+ {
551
+ "nameExplicit": true,
552
+ "columns": [
553
+ {
554
+ "value": "f_event_id",
555
+ "isExpression": false,
556
+ "asc": true,
557
+ "nullsFirst": false,
558
+ "opclass": null
559
+ }
560
+ ],
561
+ "isUnique": false,
562
+ "where": null,
563
+ "with": "",
564
+ "method": "btree",
565
+ "concurrently": false,
566
+ "name": "idx_session_events_event_id",
567
+ "entityType": "indexes",
568
+ "schema": "public",
569
+ "table": "t_session_events"
570
+ },
571
+ {
572
+ "nameExplicit": false,
573
+ "columns": ["f_session_id"],
574
+ "schemaTo": "public",
575
+ "tableTo": "t_sessions",
576
+ "columnsTo": ["f_session_id"],
577
+ "onUpdate": "NO ACTION",
578
+ "onDelete": "CASCADE",
579
+ "name": "t_session_events_f_session_id_t_sessions_f_session_id_fkey",
580
+ "entityType": "fks",
581
+ "schema": "public",
582
+ "table": "t_session_events"
583
+ },
584
+ {
585
+ "nameExplicit": false,
586
+ "columns": ["f_event_id"],
587
+ "schemaTo": "public",
588
+ "tableTo": "t_events",
589
+ "columnsTo": ["f_event_id"],
590
+ "onUpdate": "NO ACTION",
591
+ "onDelete": "CASCADE",
592
+ "name": "t_session_events_f_event_id_t_events_f_event_id_fkey",
593
+ "entityType": "fks",
594
+ "schema": "public",
595
+ "table": "t_session_events"
596
+ },
597
+ {
598
+ "columns": ["f_id"],
599
+ "nameExplicit": false,
600
+ "name": "t_events_pkey",
601
+ "schema": "public",
602
+ "table": "t_events",
603
+ "entityType": "pks"
604
+ },
605
+ {
606
+ "columns": ["f_singleton"],
607
+ "nameExplicit": false,
608
+ "name": "t_persistence_state_pkey",
609
+ "schema": "public",
610
+ "table": "t_persistence_state",
611
+ "entityType": "pks"
612
+ },
613
+ {
614
+ "columns": ["f_key"],
615
+ "nameExplicit": false,
616
+ "name": "t_schema_meta_pkey",
617
+ "schema": "public",
618
+ "table": "t_schema_meta",
619
+ "entityType": "pks"
620
+ },
621
+ {
622
+ "columns": ["f_id"],
623
+ "nameExplicit": false,
624
+ "name": "t_session_events_pkey",
625
+ "schema": "public",
626
+ "table": "t_session_events",
627
+ "entityType": "pks"
628
+ },
629
+ {
630
+ "columns": ["f_id"],
631
+ "nameExplicit": false,
632
+ "name": "t_sessions_pkey",
633
+ "schema": "public",
634
+ "table": "t_sessions",
635
+ "entityType": "pks"
636
+ },
637
+ {
638
+ "nameExplicit": true,
639
+ "columns": ["f_session_id", "f_sequence"],
640
+ "nullsNotDistinct": false,
641
+ "name": "uq_session_events_session_sequence",
642
+ "entityType": "uniques",
643
+ "schema": "public",
644
+ "table": "t_session_events"
645
+ },
646
+ {
647
+ "nameExplicit": false,
648
+ "columns": ["f_event_id"],
649
+ "nullsNotDistinct": false,
650
+ "name": "t_events_f_event_id_key",
651
+ "schema": "public",
652
+ "table": "t_events",
653
+ "entityType": "uniques"
654
+ },
655
+ {
656
+ "nameExplicit": false,
657
+ "columns": ["f_session_id"],
658
+ "nullsNotDistinct": false,
659
+ "name": "t_sessions_f_session_id_key",
660
+ "schema": "public",
661
+ "table": "t_sessions",
662
+ "entityType": "uniques"
663
+ },
664
+ {
665
+ "value": "f_singleton = 1",
666
+ "name": "ck_persistence_state_singleton",
667
+ "entityType": "checks",
668
+ "schema": "public",
669
+ "table": "t_persistence_state"
670
+ }
671
+ ],
672
+ "renames": []
673
+ }