@morlay/session-rdb 0.0.15 → 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-DFed8DBt.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 -87
  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-vwzwEXNE.mjs +0 -878
  58. package/dist/sqlite-CG_Qcx5C.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,686 @@
1
+ {
2
+ "version": "8",
3
+ "dialect": "postgres",
4
+ "id": "f8eb0d0c-5310-4cf5-bf7c-48578a99b463",
5
+ "prevIds": ["00000000-0000-0000-0000-000000000000"],
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": "integer",
299
+ "typeSchema": null,
300
+ "notNull": true,
301
+ "dimensions": 0,
302
+ "default": null,
303
+ "generated": null,
304
+ "identity": null,
305
+ "name": "f_original_seq",
306
+ "entityType": "columns",
307
+ "schema": "public",
308
+ "table": "t_session_events"
309
+ },
310
+ {
311
+ "type": "serial",
312
+ "typeSchema": null,
313
+ "notNull": true,
314
+ "dimensions": 0,
315
+ "default": null,
316
+ "generated": null,
317
+ "identity": null,
318
+ "name": "f_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": null,
329
+ "generated": null,
330
+ "identity": null,
331
+ "name": "f_session_id",
332
+ "entityType": "columns",
333
+ "schema": "public",
334
+ "table": "t_sessions"
335
+ },
336
+ {
337
+ "type": "text",
338
+ "typeSchema": null,
339
+ "notNull": true,
340
+ "dimensions": 0,
341
+ "default": "''",
342
+ "generated": null,
343
+ "identity": null,
344
+ "name": "f_head_event_id",
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": "-1",
355
+ "generated": null,
356
+ "identity": null,
357
+ "name": "f_head_sequence",
358
+ "entityType": "columns",
359
+ "schema": "public",
360
+ "table": "t_sessions"
361
+ },
362
+ {
363
+ "type": "integer",
364
+ "typeSchema": null,
365
+ "notNull": true,
366
+ "dimensions": 0,
367
+ "default": null,
368
+ "generated": null,
369
+ "identity": null,
370
+ "name": "f_version",
371
+ "entityType": "columns",
372
+ "schema": "public",
373
+ "table": "t_sessions"
374
+ },
375
+ {
376
+ "type": "bigint",
377
+ "typeSchema": null,
378
+ "notNull": true,
379
+ "dimensions": 0,
380
+ "default": null,
381
+ "generated": null,
382
+ "identity": null,
383
+ "name": "f_created_at",
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_cwd",
397
+ "entityType": "columns",
398
+ "schema": "public",
399
+ "table": "t_sessions"
400
+ },
401
+ {
402
+ "type": "text",
403
+ "typeSchema": null,
404
+ "notNull": false,
405
+ "dimensions": 0,
406
+ "default": null,
407
+ "generated": null,
408
+ "identity": null,
409
+ "name": "f_parent_session",
410
+ "entityType": "columns",
411
+ "schema": "public",
412
+ "table": "t_sessions"
413
+ },
414
+ {
415
+ "type": "integer",
416
+ "typeSchema": null,
417
+ "notNull": false,
418
+ "dimensions": 0,
419
+ "default": null,
420
+ "generated": null,
421
+ "identity": null,
422
+ "name": "f_seed_length",
423
+ "entityType": "columns",
424
+ "schema": "public",
425
+ "table": "t_sessions"
426
+ },
427
+ {
428
+ "type": "text",
429
+ "typeSchema": null,
430
+ "notNull": false,
431
+ "dimensions": 0,
432
+ "default": null,
433
+ "generated": null,
434
+ "identity": null,
435
+ "name": "f_origin",
436
+ "entityType": "columns",
437
+ "schema": "public",
438
+ "table": "t_sessions"
439
+ },
440
+ {
441
+ "type": "integer",
442
+ "typeSchema": null,
443
+ "notNull": false,
444
+ "dimensions": 0,
445
+ "default": null,
446
+ "generated": null,
447
+ "identity": null,
448
+ "name": "f_delegation_depth",
449
+ "entityType": "columns",
450
+ "schema": "public",
451
+ "table": "t_sessions"
452
+ },
453
+ {
454
+ "type": "text",
455
+ "typeSchema": null,
456
+ "notNull": true,
457
+ "dimensions": 0,
458
+ "default": null,
459
+ "generated": null,
460
+ "identity": null,
461
+ "name": "f_incarnation",
462
+ "entityType": "columns",
463
+ "schema": "public",
464
+ "table": "t_sessions"
465
+ },
466
+ {
467
+ "type": "integer",
468
+ "typeSchema": null,
469
+ "notNull": true,
470
+ "dimensions": 0,
471
+ "default": null,
472
+ "generated": null,
473
+ "identity": null,
474
+ "name": "f_revision",
475
+ "entityType": "columns",
476
+ "schema": "public",
477
+ "table": "t_sessions"
478
+ },
479
+ {
480
+ "nameExplicit": true,
481
+ "columns": [
482
+ {
483
+ "value": "f_kind",
484
+ "isExpression": false,
485
+ "asc": true,
486
+ "nullsFirst": false,
487
+ "opclass": null
488
+ }
489
+ ],
490
+ "isUnique": false,
491
+ "where": null,
492
+ "with": "",
493
+ "method": "btree",
494
+ "concurrently": false,
495
+ "name": "idx_events_kind",
496
+ "entityType": "indexes",
497
+ "schema": "public",
498
+ "table": "t_events"
499
+ },
500
+ {
501
+ "nameExplicit": true,
502
+ "columns": [
503
+ {
504
+ "value": "f_role",
505
+ "isExpression": false,
506
+ "asc": true,
507
+ "nullsFirst": false,
508
+ "opclass": null
509
+ }
510
+ ],
511
+ "isUnique": false,
512
+ "where": null,
513
+ "with": "",
514
+ "method": "btree",
515
+ "concurrently": false,
516
+ "name": "idx_events_role",
517
+ "entityType": "indexes",
518
+ "schema": "public",
519
+ "table": "t_events"
520
+ },
521
+ {
522
+ "nameExplicit": true,
523
+ "columns": [
524
+ {
525
+ "value": "f_name",
526
+ "isExpression": false,
527
+ "asc": true,
528
+ "nullsFirst": false,
529
+ "opclass": null
530
+ }
531
+ ],
532
+ "isUnique": false,
533
+ "where": null,
534
+ "with": "",
535
+ "method": "btree",
536
+ "concurrently": false,
537
+ "name": "idx_events_name",
538
+ "entityType": "indexes",
539
+ "schema": "public",
540
+ "table": "t_events"
541
+ },
542
+ {
543
+ "nameExplicit": true,
544
+ "columns": [
545
+ {
546
+ "value": "f_action_id",
547
+ "isExpression": false,
548
+ "asc": true,
549
+ "nullsFirst": false,
550
+ "opclass": null
551
+ }
552
+ ],
553
+ "isUnique": false,
554
+ "where": null,
555
+ "with": "",
556
+ "method": "btree",
557
+ "concurrently": false,
558
+ "name": "idx_events_action_id",
559
+ "entityType": "indexes",
560
+ "schema": "public",
561
+ "table": "t_events"
562
+ },
563
+ {
564
+ "nameExplicit": true,
565
+ "columns": [
566
+ {
567
+ "value": "f_event_id",
568
+ "isExpression": false,
569
+ "asc": true,
570
+ "nullsFirst": false,
571
+ "opclass": null
572
+ }
573
+ ],
574
+ "isUnique": false,
575
+ "where": null,
576
+ "with": "",
577
+ "method": "btree",
578
+ "concurrently": false,
579
+ "name": "idx_session_events_event_id",
580
+ "entityType": "indexes",
581
+ "schema": "public",
582
+ "table": "t_session_events"
583
+ },
584
+ {
585
+ "nameExplicit": false,
586
+ "columns": ["f_session_id"],
587
+ "schemaTo": "public",
588
+ "tableTo": "t_sessions",
589
+ "columnsTo": ["f_session_id"],
590
+ "onUpdate": "NO ACTION",
591
+ "onDelete": "CASCADE",
592
+ "name": "t_session_events_f_session_id_t_sessions_f_session_id_fkey",
593
+ "entityType": "fks",
594
+ "schema": "public",
595
+ "table": "t_session_events"
596
+ },
597
+ {
598
+ "nameExplicit": false,
599
+ "columns": ["f_event_id"],
600
+ "schemaTo": "public",
601
+ "tableTo": "t_events",
602
+ "columnsTo": ["f_event_id"],
603
+ "onUpdate": "NO ACTION",
604
+ "onDelete": "CASCADE",
605
+ "name": "t_session_events_f_event_id_t_events_f_event_id_fkey",
606
+ "entityType": "fks",
607
+ "schema": "public",
608
+ "table": "t_session_events"
609
+ },
610
+ {
611
+ "columns": ["f_id"],
612
+ "nameExplicit": false,
613
+ "name": "t_events_pkey",
614
+ "schema": "public",
615
+ "table": "t_events",
616
+ "entityType": "pks"
617
+ },
618
+ {
619
+ "columns": ["f_singleton"],
620
+ "nameExplicit": false,
621
+ "name": "t_persistence_state_pkey",
622
+ "schema": "public",
623
+ "table": "t_persistence_state",
624
+ "entityType": "pks"
625
+ },
626
+ {
627
+ "columns": ["f_key"],
628
+ "nameExplicit": false,
629
+ "name": "t_schema_meta_pkey",
630
+ "schema": "public",
631
+ "table": "t_schema_meta",
632
+ "entityType": "pks"
633
+ },
634
+ {
635
+ "columns": ["f_id"],
636
+ "nameExplicit": false,
637
+ "name": "t_session_events_pkey",
638
+ "schema": "public",
639
+ "table": "t_session_events",
640
+ "entityType": "pks"
641
+ },
642
+ {
643
+ "columns": ["f_id"],
644
+ "nameExplicit": false,
645
+ "name": "t_sessions_pkey",
646
+ "schema": "public",
647
+ "table": "t_sessions",
648
+ "entityType": "pks"
649
+ },
650
+ {
651
+ "nameExplicit": true,
652
+ "columns": ["f_session_id", "f_sequence"],
653
+ "nullsNotDistinct": false,
654
+ "name": "uq_session_events_session_sequence",
655
+ "entityType": "uniques",
656
+ "schema": "public",
657
+ "table": "t_session_events"
658
+ },
659
+ {
660
+ "nameExplicit": false,
661
+ "columns": ["f_event_id"],
662
+ "nullsNotDistinct": false,
663
+ "name": "t_events_f_event_id_key",
664
+ "schema": "public",
665
+ "table": "t_events",
666
+ "entityType": "uniques"
667
+ },
668
+ {
669
+ "nameExplicit": false,
670
+ "columns": ["f_session_id"],
671
+ "nullsNotDistinct": false,
672
+ "name": "t_sessions_f_session_id_key",
673
+ "schema": "public",
674
+ "table": "t_sessions",
675
+ "entityType": "uniques"
676
+ },
677
+ {
678
+ "value": "f_singleton = 1",
679
+ "name": "ck_persistence_state_singleton",
680
+ "entityType": "checks",
681
+ "schema": "public",
682
+ "table": "t_persistence_state"
683
+ }
684
+ ],
685
+ "renames": []
686
+ }
@@ -0,0 +1 @@
1
+ ALTER TABLE "t_session_events" DROP COLUMN "f_original_seq";