@reventlessdev/reventless-core 3.0.0-alpha.235 → 3.0.0-alpha.237

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 (36) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.json +7 -7
  3. package/src/admin/Platform_Admin_Structure.res +5 -1
  4. package/src/admin/Platform_Admin_Structure.res.mjs +4 -2
  5. package/src/admin/Platform_BakedManifest.res +52 -0
  6. package/src/admin/Platform_BakedManifest.res.mjs +38 -0
  7. package/src/admin/Platform_ComponentDefinitionsApi.res +4 -2
  8. package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +11 -3
  9. package/src/components/Api/GraphQL_FragmentGenerator.res +14 -1
  10. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +1 -1
  11. package/src/components/Api/QueryDbListQuery.res +25 -1
  12. package/src/components/Api/QueryDbListQuery.res.mjs +11 -4
  13. package/src/components/Api/SuryToJsonSchema.res +39 -0
  14. package/src/components/Api/SuryToJsonSchema.res.mjs +34 -3
  15. package/src/components/Dcb/Dcb_Builder.res +52 -3
  16. package/src/components/Dcb/Dcb_Builder.res.mjs +57 -1
  17. package/src/plugin/component/Plugin_Structure.res +112 -15
  18. package/src/plugin/component/Plugin_Structure.res.mjs +77 -9
  19. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +3 -2
  20. package/tests/admin/Platform_Admin_StructureTest.res +49 -0
  21. package/tests/admin/Platform_Admin_StructureTest.res.mjs +24 -0
  22. package/tests/admin/Platform_BakedManifestTest.res +3 -1
  23. package/tests/admin/Platform_BakedManifestTest.res.mjs +3 -1
  24. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +14 -8
  25. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +24 -12
  26. package/tests/admin/Platform_PluginStructuresApiTest.res +3 -1
  27. package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +6 -2
  28. package/tests/api/Api_IdsTest.res.mjs +1 -1
  29. package/tests/api/SuryToJsonSchemaTest.res +141 -1
  30. package/tests/api/SuryToJsonSchemaTest.res.mjs +269 -54
  31. package/tests/dcb/DcbEventLogSchemaTest.res +77 -0
  32. package/tests/dcb/DcbEventLogSchemaTest.res.mjs +90 -0
  33. package/tests/plugin/PluginStructureTest.res +168 -12
  34. package/tests/plugin/PluginStructureTest.res.mjs +146 -9
  35. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +3 -2
  36. package/tests/plugin/pluginDefinitionRequiredScalars.txt +2 -0
@@ -80,10 +80,11 @@ let emptySpec = {
80
80
  scanSort: emptySpec_scanSort,
81
81
  semantic: emptySpec_semantic,
82
82
  metric: emptySpec_metric,
83
- status: undefined,
83
+ lifecycle: undefined,
84
84
  groupBy: undefined,
85
85
  visibility: undefined,
86
- live: undefined
86
+ live: undefined,
87
+ retired: undefined
87
88
  };
88
89
 
89
90
  globalThis.describe("SuryToJsonSchema:", () => {
@@ -151,10 +152,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
151
152
  scanSort: emptySpec_scanSort,
152
153
  semantic: emptySpec_semantic,
153
154
  metric: emptySpec_metric,
154
- status: undefined,
155
+ lifecycle: undefined,
155
156
  groupBy: undefined,
156
157
  visibility: undefined,
157
- live: undefined
158
+ live: undefined,
159
+ retired: undefined
158
160
  });
159
161
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
160
162
  let entityIdSchema = getPropertyOf(json, "entityId");
@@ -184,10 +186,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
184
186
  scanSort: emptySpec_scanSort,
185
187
  semantic: emptySpec_semantic,
186
188
  metric: emptySpec_metric,
187
- status: undefined,
189
+ lifecycle: undefined,
188
190
  groupBy: undefined,
189
191
  visibility: undefined,
190
- live: undefined
192
+ live: undefined,
193
+ retired: undefined
191
194
  });
192
195
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
193
196
  let envSchema = getPropertyOf(json, "environment");
@@ -220,10 +223,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
220
223
  scanSort: emptySpec_scanSort,
221
224
  semantic: emptySpec_semantic,
222
225
  metric: emptySpec_metric,
223
- status: undefined,
226
+ lifecycle: undefined,
224
227
  groupBy: undefined,
225
228
  visibility: undefined,
226
- live: undefined
229
+ live: undefined,
230
+ retired: undefined
227
231
  });
228
232
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
229
233
  let versionSchema = getPropertyOf(json, "version");
@@ -252,10 +256,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
252
256
  scanSort: emptySpec_scanSort,
253
257
  semantic: emptySpec_semantic,
254
258
  metric: emptySpec_metric,
255
- status: undefined,
259
+ lifecycle: undefined,
256
260
  groupBy: undefined,
257
261
  visibility: undefined,
258
- live: undefined
262
+ live: undefined,
263
+ retired: undefined
259
264
  });
260
265
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
261
266
  let ownerIdSchema = getPropertyOf(json, "ownerId");
@@ -284,10 +289,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
284
289
  scanSort: emptySpec_scanSort,
285
290
  semantic: emptySpec_semantic,
286
291
  metric: emptySpec_metric,
287
- status: undefined,
292
+ lifecycle: undefined,
288
293
  groupBy: undefined,
289
294
  visibility: undefined,
290
- live: undefined
295
+ live: undefined,
296
+ retired: undefined
291
297
  });
292
298
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
293
299
  let categorySchema = getPropertyOf(json, "category");
@@ -313,10 +319,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
313
319
  scanSort: emptySpec_scanSort,
314
320
  semantic: emptySpec_semantic,
315
321
  metric: emptySpec_metric,
316
- status: undefined,
322
+ lifecycle: undefined,
317
323
  groupBy: undefined,
318
324
  visibility: undefined,
319
- live: undefined
325
+ live: undefined,
326
+ retired: undefined
320
327
  });
321
328
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
322
329
  let nameSchema = getPropertyOf(json, "name");
@@ -342,10 +349,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
342
349
  scanSort: emptySpec_scanSort,
343
350
  semantic: emptySpec_semantic,
344
351
  metric: emptySpec_metric,
345
- status: undefined,
352
+ lifecycle: undefined,
346
353
  groupBy: undefined,
347
354
  visibility: undefined,
348
- live: undefined
355
+ live: undefined,
356
+ retired: undefined
349
357
  });
350
358
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
351
359
  let deploymentIdSchema = getPropertyOf(json, "deploymentId");
@@ -378,10 +386,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
378
386
  scanSort: emptySpec_scanSort,
379
387
  semantic: emptySpec_semantic,
380
388
  metric: emptySpec_metric,
381
- status: undefined,
389
+ lifecycle: undefined,
382
390
  groupBy: undefined,
383
391
  visibility: undefined,
384
- live: undefined
392
+ live: undefined,
393
+ retired: undefined
385
394
  });
386
395
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
387
396
  let pluginNameSchema = getPropertyOf(json, "pluginName");
@@ -417,10 +426,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
417
426
  scanSort: emptySpec_scanSort,
418
427
  semantic: emptySpec_semantic,
419
428
  metric: emptySpec_metric,
420
- status: undefined,
429
+ lifecycle: undefined,
421
430
  groupBy: undefined,
422
431
  visibility: undefined,
423
- live: undefined
432
+ live: undefined,
433
+ retired: undefined
424
434
  });
425
435
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
426
436
  let componentsSchema = getPropertyOf(json, "components");
@@ -459,10 +469,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
459
469
  scanSort: emptySpec_scanSort,
460
470
  semantic: emptySpec_semantic,
461
471
  metric: emptySpec_metric,
462
- status: undefined,
472
+ lifecycle: undefined,
463
473
  groupBy: undefined,
464
474
  visibility: undefined,
465
- live: undefined
475
+ live: undefined,
476
+ retired: undefined
466
477
  });
467
478
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
468
479
  let componentsSchema = getPropertyOf(json, "components");
@@ -491,10 +502,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
491
502
  scanSort: emptySpec_scanSort,
492
503
  semantic: emptySpec_semantic,
493
504
  metric: emptySpec_metric,
494
- status: undefined,
505
+ lifecycle: undefined,
495
506
  groupBy: undefined,
496
507
  visibility: undefined,
497
- live: undefined
508
+ live: undefined,
509
+ retired: undefined
498
510
  });
499
511
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
500
512
  let componentsSchema = getPropertyOf(json, "components");
@@ -520,10 +532,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
520
532
  scanSort: emptySpec_scanSort,
521
533
  semantic: emptySpec_semantic,
522
534
  metric: emptySpec_metric,
523
- status: undefined,
535
+ lifecycle: undefined,
524
536
  groupBy: undefined,
525
537
  visibility: undefined,
526
- live: undefined
538
+ live: undefined,
539
+ retired: undefined
527
540
  });
528
541
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
529
542
  let statusSchema = getPropertyOf(json, "status");
@@ -556,10 +569,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
556
569
  scanSort: ["name"],
557
570
  semantic: emptySpec_semantic,
558
571
  metric: emptySpec_metric,
559
- status: undefined,
572
+ lifecycle: undefined,
560
573
  groupBy: undefined,
561
574
  visibility: undefined,
562
- live: undefined
575
+ live: undefined,
576
+ retired: undefined
563
577
  });
564
578
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
565
579
  let nameSchema = getPropertyOf(json, "name");
@@ -595,10 +609,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
595
609
  "currency"
596
610
  ]],
597
611
  metric: emptySpec_metric,
598
- status: undefined,
612
+ lifecycle: undefined,
599
613
  groupBy: undefined,
600
614
  visibility: undefined,
601
- live: undefined
615
+ live: undefined,
616
+ retired: undefined
602
617
  });
603
618
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
604
619
  let totalSchema = getPropertyOf(json, "total");
@@ -637,10 +652,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
637
652
  label: "Revenue"
638
653
  }
639
654
  ]],
640
- status: undefined,
655
+ lifecycle: undefined,
641
656
  groupBy: undefined,
642
657
  visibility: undefined,
643
- live: undefined
658
+ live: undefined,
659
+ retired: undefined
644
660
  });
645
661
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
646
662
  let metricObj = Stdlib_Option.flatMap(getPropertyOf(json, "total"), s => getProperty(s, "x-reventless-metric"));
@@ -677,10 +693,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
677
693
  label: ""
678
694
  }
679
695
  ]],
680
- status: undefined,
696
+ lifecycle: undefined,
681
697
  groupBy: undefined,
682
698
  visibility: undefined,
683
- live: undefined
699
+ live: undefined,
700
+ retired: undefined
684
701
  });
685
702
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
686
703
  let metricObj = Stdlib_Option.flatMap(getPropertyOf(json, "total"), s => getProperty(s, "x-reventless-metric"));
@@ -692,6 +709,194 @@ globalThis.describe("SuryToJsonSchema:", () => {
692
709
  undefined
693
710
  ]);
694
711
  });
712
+ globalThis.test("emits x-reventless-retired {label,showWhenFalse} on the retired field", () => {
713
+ let schema = S.schema(s => ({
714
+ id: s.m(S.string),
715
+ archived: s.m(S.bool)
716
+ }));
717
+ let schema$p = withSpec(schema, {
718
+ ids: emptySpec_ids,
719
+ compositeIds: emptySpec_compositeIds,
720
+ subIds: emptySpec_subIds,
721
+ compositeSubIds: emptySpec_compositeSubIds,
722
+ indexes: emptySpec_indexes,
723
+ hidden: emptySpec_hidden,
724
+ summary: emptySpec_summary,
725
+ drillTargets: emptySpec_drillTargets,
726
+ drillTargetKeys: emptySpec_drillTargetKeys,
727
+ collapsed: emptySpec_collapsed,
728
+ scan: emptySpec_scan,
729
+ scanSort: emptySpec_scanSort,
730
+ semantic: emptySpec_semantic,
731
+ metric: emptySpec_metric,
732
+ lifecycle: undefined,
733
+ groupBy: undefined,
734
+ visibility: undefined,
735
+ live: undefined,
736
+ retired: {
737
+ field: "archived",
738
+ label: "Archived",
739
+ showWhenFalse: true,
740
+ values: undefined
741
+ }
742
+ });
743
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
744
+ let retiredObj = Stdlib_Option.flatMap(getPropertyOf(json, "archived"), s => getProperty(s, "x-reventless-retired"));
745
+ globalThis.expect([
746
+ Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "label")), Stdlib_JSON.Decode.string),
747
+ Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "showWhenFalse")), Stdlib_JSON.Decode.bool),
748
+ Stdlib_Option.flatMap(getPropertyOf(json, "id"), s => getProperty(s, "x-reventless-retired"))
749
+ ]).toEqual([
750
+ "Archived",
751
+ true,
752
+ undefined
753
+ ]);
754
+ });
755
+ let stateFormJson = values => {
756
+ let schema = S.schema(s => ({
757
+ customerId: s.m(S.string),
758
+ accountStatus: s.m(S.union([
759
+ S.literal("Active"),
760
+ S.literal("Deactivated")
761
+ ]))
762
+ }));
763
+ return SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
764
+ ids: emptySpec_ids,
765
+ compositeIds: emptySpec_compositeIds,
766
+ subIds: emptySpec_subIds,
767
+ compositeSubIds: emptySpec_compositeSubIds,
768
+ indexes: emptySpec_indexes,
769
+ hidden: emptySpec_hidden,
770
+ summary: emptySpec_summary,
771
+ drillTargets: emptySpec_drillTargets,
772
+ drillTargetKeys: emptySpec_drillTargetKeys,
773
+ collapsed: emptySpec_collapsed,
774
+ scan: emptySpec_scan,
775
+ scanSort: emptySpec_scanSort,
776
+ semantic: emptySpec_semantic,
777
+ metric: emptySpec_metric,
778
+ lifecycle: "accountStatus",
779
+ groupBy: undefined,
780
+ visibility: undefined,
781
+ live: undefined,
782
+ retired: {
783
+ field: "accountStatus",
784
+ label: "",
785
+ showWhenFalse: false,
786
+ values: values
787
+ }
788
+ }));
789
+ };
790
+ let retiredOn = (json, field) => Stdlib_Option.flatMap(getPropertyOf(json, field), s => getProperty(s, "x-reventless-retired"));
791
+ let stringsAt = (retiredObj, key) => Stdlib_Option.map(Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredObj, r => getProperty(r, key)), Stdlib_JSON.Decode.array), a => Stdlib_Array.filterMap(a, Stdlib_JSON.Decode.string));
792
+ globalThis.test("carries one retirement state as a one-element set", () => {
793
+ globalThis.expect(stringsAt(retiredOn(stateFormJson(["Deactivated"]), "accountStatus"), "values")).toEqual(["Deactivated"]);
794
+ });
795
+ globalThis.test("carries every retirement state a lifecycle declares", () => {
796
+ globalThis.expect(stringsAt(retiredOn(stateFormJson([
797
+ "Archived",
798
+ "Discontinued"
799
+ ]), "accountStatus"), "values")).toEqual([
800
+ "Archived",
801
+ "Discontinued"
802
+ ]);
803
+ });
804
+ globalThis.test("emits the singular value beside a one-element set", () => {
805
+ globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredOn(stateFormJson(["Deactivated"]), "accountStatus"), r => getProperty(r, "value")), Stdlib_JSON.Decode.string)).toEqual("Deactivated");
806
+ });
807
+ globalThis.test("omits the singular value for a set of two", () => {
808
+ globalThis.expect(Stdlib_Option.flatMap(retiredOn(stateFormJson([
809
+ "Archived",
810
+ "Discontinued"
811
+ ]), "accountStatus"), r => getProperty(r, "value"))).toEqual(undefined);
812
+ });
813
+ globalThis.test("omits both value and values entirely on the boolean form", () => {
814
+ let schema = S.schema(s => ({
815
+ archived: s.m(S.bool)
816
+ }));
817
+ let schema$p = withSpec(schema, {
818
+ ids: emptySpec_ids,
819
+ compositeIds: emptySpec_compositeIds,
820
+ subIds: emptySpec_subIds,
821
+ compositeSubIds: emptySpec_compositeSubIds,
822
+ indexes: emptySpec_indexes,
823
+ hidden: emptySpec_hidden,
824
+ summary: emptySpec_summary,
825
+ drillTargets: emptySpec_drillTargets,
826
+ drillTargetKeys: emptySpec_drillTargetKeys,
827
+ collapsed: emptySpec_collapsed,
828
+ scan: emptySpec_scan,
829
+ scanSort: emptySpec_scanSort,
830
+ semantic: emptySpec_semantic,
831
+ metric: emptySpec_metric,
832
+ lifecycle: undefined,
833
+ groupBy: undefined,
834
+ visibility: undefined,
835
+ live: undefined,
836
+ retired: {
837
+ field: "archived",
838
+ label: "",
839
+ showWhenFalse: false,
840
+ values: undefined
841
+ }
842
+ });
843
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
844
+ let retiredObj = retiredOn(json, "archived");
845
+ globalThis.expect([
846
+ Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "value")),
847
+ Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "values"))
848
+ ]).toEqual([
849
+ undefined,
850
+ undefined
851
+ ]);
852
+ });
853
+ globalThis.test("omits the retired label when empty but always states showWhenFalse", () => {
854
+ let schema = S.schema(s => ({
855
+ deactivated: s.m(S.bool)
856
+ }));
857
+ let schema$p = withSpec(schema, {
858
+ ids: emptySpec_ids,
859
+ compositeIds: emptySpec_compositeIds,
860
+ subIds: emptySpec_subIds,
861
+ compositeSubIds: emptySpec_compositeSubIds,
862
+ indexes: emptySpec_indexes,
863
+ hidden: emptySpec_hidden,
864
+ summary: emptySpec_summary,
865
+ drillTargets: emptySpec_drillTargets,
866
+ drillTargetKeys: emptySpec_drillTargetKeys,
867
+ collapsed: emptySpec_collapsed,
868
+ scan: emptySpec_scan,
869
+ scanSort: emptySpec_scanSort,
870
+ semantic: emptySpec_semantic,
871
+ metric: emptySpec_metric,
872
+ lifecycle: undefined,
873
+ groupBy: undefined,
874
+ visibility: undefined,
875
+ live: undefined,
876
+ retired: {
877
+ field: "deactivated",
878
+ label: "",
879
+ showWhenFalse: false,
880
+ values: undefined
881
+ }
882
+ });
883
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
884
+ let retiredObj = Stdlib_Option.flatMap(getPropertyOf(json, "deactivated"), s => getProperty(s, "x-reventless-retired"));
885
+ globalThis.expect([
886
+ Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "label")),
887
+ Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredObj, r => getProperty(r, "showWhenFalse")), Stdlib_JSON.Decode.bool)
888
+ ]).toEqual([
889
+ undefined,
890
+ false
891
+ ]);
892
+ });
893
+ globalThis.test("emits nothing for a schema with no retired annotation", () => {
894
+ let schema = S.schema(s => ({
895
+ archived: s.m(S.bool)
896
+ }));
897
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, emptySpec));
898
+ globalThis.expect(Stdlib_Option.flatMap(getPropertyOf(json, "archived"), s => getProperty(s, "x-reventless-retired"))).toBe(undefined);
899
+ });
695
900
  globalThis.test("emits x-reventless-group-by on the field named by groupBy", () => {
696
901
  let schema = S.schema(s => ({
697
902
  id: s.m(S.string),
@@ -712,10 +917,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
712
917
  scanSort: emptySpec_scanSort,
713
918
  semantic: emptySpec_semantic,
714
919
  metric: emptySpec_metric,
715
- status: undefined,
920
+ lifecycle: undefined,
716
921
  groupBy: "kind",
717
922
  visibility: undefined,
718
- live: undefined
923
+ live: undefined,
924
+ retired: undefined
719
925
  });
720
926
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
721
927
  let kindSchema = getPropertyOf(json, "kind");
@@ -748,10 +954,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
748
954
  scanSort: emptySpec_scanSort,
749
955
  semantic: emptySpec_semantic,
750
956
  metric: emptySpec_metric,
751
- status: undefined,
957
+ lifecycle: undefined,
752
958
  groupBy: undefined,
753
959
  visibility: undefined,
754
- live: undefined
960
+ live: undefined,
961
+ retired: undefined
755
962
  });
756
963
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
757
964
  let primarySchema = getPropertyOf(json, "primaryResource");
@@ -783,10 +990,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
783
990
  scanSort: emptySpec_scanSort,
784
991
  semantic: emptySpec_semantic,
785
992
  metric: emptySpec_metric,
786
- status: undefined,
993
+ lifecycle: undefined,
787
994
  groupBy: undefined,
788
995
  visibility: "Internal",
789
- live: undefined
996
+ live: undefined,
997
+ retired: undefined
790
998
  });
791
999
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
792
1000
  globalThis.expect(Stdlib_Option.flatMap(getProperty(json, "x-reventless-visibility"), Stdlib_JSON.Decode.string)).toBe("Internal");
@@ -810,10 +1018,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
810
1018
  scanSort: emptySpec_scanSort,
811
1019
  semantic: emptySpec_semantic,
812
1020
  metric: emptySpec_metric,
813
- status: undefined,
1021
+ lifecycle: undefined,
814
1022
  groupBy: undefined,
815
1023
  visibility: undefined,
816
- live: undefined
1024
+ live: undefined,
1025
+ retired: undefined
817
1026
  });
818
1027
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
819
1028
  globalThis.expect(getProperty(json, "x-reventless-visibility")).toBe(undefined);
@@ -837,10 +1046,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
837
1046
  scanSort: emptySpec_scanSort,
838
1047
  semantic: emptySpec_semantic,
839
1048
  metric: emptySpec_metric,
840
- status: undefined,
1049
+ lifecycle: undefined,
841
1050
  groupBy: undefined,
842
1051
  visibility: undefined,
843
- live: false
1052
+ live: false,
1053
+ retired: undefined
844
1054
  }));
845
1055
  let onJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
846
1056
  ids: emptySpec_ids,
@@ -857,10 +1067,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
857
1067
  scanSort: emptySpec_scanSort,
858
1068
  semantic: emptySpec_semantic,
859
1069
  metric: emptySpec_metric,
860
- status: undefined,
1070
+ lifecycle: undefined,
861
1071
  groupBy: undefined,
862
1072
  visibility: undefined,
863
- live: true
1073
+ live: true,
1074
+ retired: undefined
864
1075
  }));
865
1076
  globalThis.expect([
866
1077
  Stdlib_Option.flatMap(getProperty(offJson, "x-reventless-live"), Stdlib_JSON.Decode.bool),
@@ -889,10 +1100,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
889
1100
  scanSort: emptySpec_scanSort,
890
1101
  semantic: emptySpec_semantic,
891
1102
  metric: emptySpec_metric,
892
- status: undefined,
1103
+ lifecycle: undefined,
893
1104
  groupBy: undefined,
894
1105
  visibility: undefined,
895
- live: undefined
1106
+ live: undefined,
1107
+ retired: undefined
896
1108
  });
897
1109
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
898
1110
  globalThis.expect(getProperty(json, "x-reventless-live")).toBe(undefined);
@@ -916,10 +1128,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
916
1128
  scanSort: emptySpec_scanSort,
917
1129
  semantic: emptySpec_semantic,
918
1130
  metric: emptySpec_metric,
919
- status: undefined,
1131
+ lifecycle: undefined,
920
1132
  groupBy: undefined,
921
1133
  visibility: "Internal",
922
- live: false
1134
+ live: false,
1135
+ retired: undefined
923
1136
  });
924
1137
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
925
1138
  globalThis.expect([
@@ -989,10 +1202,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
989
1202
  scanSort: emptySpec_scanSort,
990
1203
  semantic: emptySpec_semantic,
991
1204
  metric: emptySpec_metric,
992
- status: undefined,
1205
+ lifecycle: undefined,
993
1206
  groupBy: undefined,
994
1207
  visibility: undefined,
995
- live: undefined
1208
+ live: undefined,
1209
+ retired: undefined
996
1210
  });
997
1211
  let native = S.toJSONSchema(schema$p);
998
1212
  let entityIdSchema = getPropertyOf(native, "entityId");
@@ -1100,10 +1314,11 @@ globalThis.describe("SuryToJsonSchema:", () => {
1100
1314
  "image"
1101
1315
  ]],
1102
1316
  metric: emptySpec_metric,
1103
- status: undefined,
1317
+ lifecycle: undefined,
1104
1318
  groupBy: undefined,
1105
1319
  visibility: undefined,
1106
- live: undefined
1320
+ live: undefined,
1321
+ retired: undefined
1107
1322
  });
1108
1323
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
1109
1324
  globalThis.expect(semanticOf(json, "imageUrl")).toEqual("storageRef");
@@ -0,0 +1,77 @@
1
+ // What a DCB event log tells its readers it carries.
2
+ //
3
+ // A plugin's slices all append to ONE log, but each slice declares only its own
4
+ // events. The log's schema entry used to be the first slice's schema, taken as
5
+ // representative — and every reader of that entry believed it: the upload
6
+ // claimer granted and untagged refs for one slice's events, and MCP described
7
+ // the log's history as carrying that slice's event types and no others. Nothing
8
+ // failed; the rest was simply invisible, which for the claimer means objects
9
+ // that keep their pending tag and expire while an event references them.
10
+ //
11
+ // So the assertions here are about completeness, and about the shape that
12
+ // completeness has to arrive in: readers walk exactly one level, `Union` →
13
+ // per-variant `Object` with a `TAG`, so a union of unions would be as blind as
14
+ // the single schema it replaced while looking like it covered everything.
15
+
16
+ open JestGlobals
17
+
18
+ let variant = (~tag: string, fields: array<(string, S.t<unknown>)>): S.t<unknown> =>
19
+ S.object(s => {
20
+ let _ = s.field("TAG", S.literal(tag)->S.castToUnknown)
21
+ fields->Array.forEach(((name, schema)) => {
22
+ let _ = s.field(name, schema)
23
+ })
24
+ ()
25
+ })->S.castToUnknown
26
+
27
+ let ref_ = (~store: string) => Reventless.StorageRef.forStore(~store)->S.castToUnknown
28
+
29
+ let addCategory = S.union([
30
+ variant(~tag="CategoryAdded", [("imageUrl", ref_(~store="categoryImages"))]),
31
+ ])->S.castToUnknown
32
+
33
+ let addProduct = S.union([
34
+ variant(~tag="ProductAdded", [("imageUrl", ref_(~store="productImages"))]),
35
+ ])->S.castToUnknown
36
+
37
+ let renameCategory = S.union([
38
+ variant(~tag="CategoryRenamed", [("name", S.string->S.castToUnknown)]),
39
+ ])->S.castToUnknown
40
+
41
+ describe("Dcb_Builder.mergedEventSchema", () => {
42
+ testSync("carries every slice's event types, not the first slice's", () => {
43
+ let merged = [addCategory, addProduct, renameCategory]->Dcb_Builder.mergedEventSchema
44
+ expect(Reventless.DcbTag.extractVariantNames(merged))->toEqual([
45
+ "CategoryAdded",
46
+ "ProductAdded",
47
+ "CategoryRenamed",
48
+ ])
49
+ })
50
+
51
+ // The claimer's whole input. One slice short here is a store's objects
52
+ // expiring under a live reference.
53
+ testSync("surfaces the ref fields of every slice that declares one", () => {
54
+ let merged = [addCategory, addProduct, renameCategory]->Dcb_Builder.mergedEventSchema
55
+ expect(
56
+ StorageRefFields.fromEventSchema(~plugin="Catalog", merged)->Array.map(e => (
57
+ e.eventType,
58
+ e.fields->Array.map(f => f.store),
59
+ )),
60
+ )->toEqual([
61
+ ("CategoryAdded", ["Catalog.categoryImages"]),
62
+ ("ProductAdded", ["Catalog.productImages"]),
63
+ ])
64
+ })
65
+
66
+ // Two slices producing the same event would otherwise hand sury two arms
67
+ // under one discriminant, and every reader a duplicate.
68
+ testSync("keeps one arm per event type", () => {
69
+ let merged = [addProduct, addProduct]->Dcb_Builder.mergedEventSchema
70
+ expect(Reventless.DcbTag.extractVariantNames(merged))->toEqual(["ProductAdded"])
71
+ })
72
+
73
+ testSync("leaves a lone slice's schema as it is", () => {
74
+ let merged = [addProduct]->Dcb_Builder.mergedEventSchema
75
+ expect(Reventless.DcbTag.extractVariantNames(merged))->toEqual(["ProductAdded"])
76
+ })
77
+ })