@reventlessdev/reventless-core 3.0.0-alpha.236 → 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.
- package/CHANGELOG.md +11 -0
- package/package.json +7 -7
- package/src/admin/Platform_Admin_Structure.res +5 -1
- package/src/admin/Platform_Admin_Structure.res.mjs +4 -2
- package/src/admin/Platform_ComponentDefinitionsApi.res +4 -2
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +11 -3
- package/src/components/Api/GraphQL_FragmentGenerator.res +14 -1
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +1 -1
- package/src/components/Api/QueryDbListQuery.res +25 -1
- package/src/components/Api/QueryDbListQuery.res.mjs +11 -4
- package/src/components/Api/SuryToJsonSchema.res +39 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +34 -3
- package/src/plugin/component/Plugin_Structure.res +112 -15
- package/src/plugin/component/Plugin_Structure.res.mjs +77 -9
- package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +3 -2
- package/tests/admin/Platform_Admin_StructureTest.res +49 -0
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +24 -0
- package/tests/admin/Platform_BakedManifestTest.res +3 -1
- package/tests/admin/Platform_BakedManifestTest.res.mjs +3 -1
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +14 -8
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +24 -12
- package/tests/admin/Platform_PluginStructuresApiTest.res +3 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +6 -2
- package/tests/api/Api_IdsTest.res.mjs +1 -1
- package/tests/api/SuryToJsonSchemaTest.res +141 -1
- package/tests/api/SuryToJsonSchemaTest.res.mjs +269 -54
- package/tests/plugin/PluginStructureTest.res +168 -12
- package/tests/plugin/PluginStructureTest.res.mjs +146 -9
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +3 -2
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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");
|