@rljson/rljson 0.0.65 → 0.0.66
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/dist/content/table-cfg.d.ts +7 -0
- package/dist/example.d.ts +1 -4
- package/dist/rljson.js +397 -235
- package/dist/src/example.ts +379 -173
- package/package.json +1 -1
|
@@ -25,6 +25,13 @@ export interface ColumnCfg extends Json {
|
|
|
25
25
|
* An optional short title of the column
|
|
26
26
|
*/
|
|
27
27
|
titleShort: string;
|
|
28
|
+
/**
|
|
29
|
+
* Defines if the column is reference column to another table (foreign key)
|
|
30
|
+
*/
|
|
31
|
+
ref?: {
|
|
32
|
+
tableKey: TableKey;
|
|
33
|
+
columnKey?: ColumnKey;
|
|
34
|
+
};
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* A column configuration with route
|
package/dist/example.d.ts
CHANGED
|
@@ -7,11 +7,9 @@ export declare class Example {
|
|
|
7
7
|
singleRow: () => Rljson;
|
|
8
8
|
multipleRows: () => Rljson;
|
|
9
9
|
singleRef: () => Rljson;
|
|
10
|
+
multiRef: () => Rljson;
|
|
10
11
|
singleSliceIdRef: () => Rljson;
|
|
11
12
|
multiSliceIdRef: () => Rljson;
|
|
12
|
-
singleNamedRef: () => Rljson;
|
|
13
|
-
multiRef: () => Rljson;
|
|
14
|
-
multiMixedRef: () => Rljson;
|
|
15
13
|
complete: () => Rljson;
|
|
16
14
|
};
|
|
17
15
|
static readonly broken: {
|
|
@@ -24,7 +22,6 @@ export declare class Example {
|
|
|
24
22
|
missingData: () => Rljson;
|
|
25
23
|
dataNotBeingAnArray: () => Rljson;
|
|
26
24
|
missingRef: () => Rljson;
|
|
27
|
-
missingNamedRef: () => Rljson;
|
|
28
25
|
missingMultiRef: () => Rljson;
|
|
29
26
|
missingReferencedTable: () => Rljson;
|
|
30
27
|
missingSliceId: () => Rljson;
|
package/dist/rljson.js
CHANGED
|
@@ -535,26 +535,172 @@ class Example {
|
|
|
535
535
|
};
|
|
536
536
|
},
|
|
537
537
|
singleRef: () => {
|
|
538
|
+
const tableCfgs = hip({
|
|
539
|
+
_type: "tableCfgs",
|
|
540
|
+
_data: [
|
|
541
|
+
{
|
|
542
|
+
key: "tableA",
|
|
543
|
+
type: "components",
|
|
544
|
+
isHead: false,
|
|
545
|
+
isRoot: false,
|
|
546
|
+
isShared: true,
|
|
547
|
+
columns: [
|
|
548
|
+
{
|
|
549
|
+
key: "_hash",
|
|
550
|
+
type: "string",
|
|
551
|
+
titleLong: "Hash",
|
|
552
|
+
titleShort: "Hash"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
key: "propertyA",
|
|
556
|
+
type: "string",
|
|
557
|
+
titleLong: "Key",
|
|
558
|
+
titleShort: "Key"
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
_hash: ""
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
key: "tableB",
|
|
565
|
+
type: "components",
|
|
566
|
+
isHead: false,
|
|
567
|
+
isRoot: false,
|
|
568
|
+
isShared: true,
|
|
569
|
+
columns: [
|
|
570
|
+
{
|
|
571
|
+
key: "_hash",
|
|
572
|
+
type: "string",
|
|
573
|
+
titleLong: "Hash",
|
|
574
|
+
titleShort: "Hash"
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
key: "propertyAFromTableA",
|
|
578
|
+
type: "string",
|
|
579
|
+
titleLong: "Table A Reference",
|
|
580
|
+
titleShort: "TableARef",
|
|
581
|
+
ref: {
|
|
582
|
+
tableKey: "tableA",
|
|
583
|
+
columnKey: "propertyA"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
_hash: ""
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
});
|
|
591
|
+
const tableA = hip({
|
|
592
|
+
_type: "components",
|
|
593
|
+
_tableCfg: tableCfgs._data[0]._hash,
|
|
594
|
+
_data: [
|
|
595
|
+
{
|
|
596
|
+
propertyA: "a0"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
propertyA: "a1"
|
|
600
|
+
}
|
|
601
|
+
],
|
|
602
|
+
_hash: ""
|
|
603
|
+
});
|
|
604
|
+
const tableB = hip({
|
|
605
|
+
_type: "components",
|
|
606
|
+
_tableCfg: tableCfgs._data[1]._hash,
|
|
607
|
+
_data: [
|
|
608
|
+
{
|
|
609
|
+
propertyAFromTableA: tableA._data[0]._hash
|
|
610
|
+
}
|
|
611
|
+
],
|
|
612
|
+
_hash: ""
|
|
613
|
+
});
|
|
538
614
|
return {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
615
|
+
tableCfgs,
|
|
616
|
+
tableA,
|
|
617
|
+
tableB
|
|
618
|
+
};
|
|
619
|
+
},
|
|
620
|
+
multiRef: () => {
|
|
621
|
+
const tableCfgs = hip({
|
|
622
|
+
_type: "tableCfgs",
|
|
623
|
+
_data: [
|
|
624
|
+
{
|
|
625
|
+
key: "tableA",
|
|
626
|
+
type: "components",
|
|
627
|
+
isHead: false,
|
|
628
|
+
isRoot: false,
|
|
629
|
+
isShared: true,
|
|
630
|
+
columns: [
|
|
631
|
+
{
|
|
632
|
+
key: "_hash",
|
|
633
|
+
type: "string",
|
|
634
|
+
titleLong: "Hash",
|
|
635
|
+
titleShort: "Hash"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
key: "propertyA",
|
|
639
|
+
type: "string",
|
|
640
|
+
titleLong: "Key",
|
|
641
|
+
titleShort: "Key"
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
_hash: ""
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: "tableB",
|
|
648
|
+
type: "components",
|
|
649
|
+
isHead: false,
|
|
650
|
+
isRoot: false,
|
|
651
|
+
isShared: true,
|
|
652
|
+
columns: [
|
|
653
|
+
{
|
|
654
|
+
key: "_hash",
|
|
655
|
+
type: "string",
|
|
656
|
+
titleLong: "Hash",
|
|
657
|
+
titleShort: "Hash"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
key: "propertyAFromTableA",
|
|
661
|
+
type: "jsonValue",
|
|
662
|
+
titleLong: "Table A Reference",
|
|
663
|
+
titleShort: "TableARef",
|
|
664
|
+
ref: {
|
|
665
|
+
tableKey: "tableA",
|
|
666
|
+
columnKey: "propertyA"
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
],
|
|
670
|
+
_hash: ""
|
|
671
|
+
}
|
|
672
|
+
]
|
|
673
|
+
});
|
|
674
|
+
const tableA = hip({
|
|
675
|
+
_type: "components",
|
|
676
|
+
_tableCfg: tableCfgs._data[0]._hash,
|
|
677
|
+
_data: [
|
|
678
|
+
{
|
|
679
|
+
propertyA: "a0"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
propertyA: "a1"
|
|
683
|
+
}
|
|
684
|
+
],
|
|
685
|
+
_hash: ""
|
|
686
|
+
});
|
|
687
|
+
const tableB = hip({
|
|
688
|
+
_type: "components",
|
|
689
|
+
_tableCfg: tableCfgs._data[1]._hash,
|
|
690
|
+
_data: [
|
|
691
|
+
{
|
|
692
|
+
propertyAFromTableA: [
|
|
693
|
+
tableA._data[0]._hash,
|
|
694
|
+
tableA._data[1]._hash
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
],
|
|
698
|
+
_hash: ""
|
|
699
|
+
});
|
|
700
|
+
return {
|
|
701
|
+
tableCfgs,
|
|
702
|
+
tableA,
|
|
703
|
+
tableB
|
|
558
704
|
};
|
|
559
705
|
},
|
|
560
706
|
singleSliceIdRef: () => {
|
|
@@ -597,89 +743,6 @@ class Example {
|
|
|
597
743
|
}
|
|
598
744
|
};
|
|
599
745
|
},
|
|
600
|
-
singleNamedRef: () => {
|
|
601
|
-
return {
|
|
602
|
-
tableA: {
|
|
603
|
-
_type: "components",
|
|
604
|
-
_data: [
|
|
605
|
-
{
|
|
606
|
-
keyA0: "a0"
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
keyA1: "a1"
|
|
610
|
-
}
|
|
611
|
-
]
|
|
612
|
-
},
|
|
613
|
-
tableB: {
|
|
614
|
-
_type: "components",
|
|
615
|
-
_data: [
|
|
616
|
-
{
|
|
617
|
-
namedRef: { component: "tableA", ref: "KFQrf4mEz0UPmUaFHwH4T6" }
|
|
618
|
-
}
|
|
619
|
-
]
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
},
|
|
623
|
-
multiRef: () => {
|
|
624
|
-
return {
|
|
625
|
-
tableA: {
|
|
626
|
-
_type: "components",
|
|
627
|
-
_data: [
|
|
628
|
-
{
|
|
629
|
-
keyA0: "a0"
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
keyA1: "a1"
|
|
633
|
-
}
|
|
634
|
-
]
|
|
635
|
-
},
|
|
636
|
-
tableB: {
|
|
637
|
-
_type: "components",
|
|
638
|
-
_data: [
|
|
639
|
-
{
|
|
640
|
-
tableARef: ["KFQrf4mEz0UPmUaFHwH4T6", "YPw-pxhqaUOWRFGramr4B1"]
|
|
641
|
-
}
|
|
642
|
-
]
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
},
|
|
646
|
-
multiMixedRef: () => {
|
|
647
|
-
return {
|
|
648
|
-
tableA: {
|
|
649
|
-
_type: "components",
|
|
650
|
-
_data: [
|
|
651
|
-
{
|
|
652
|
-
keyA0: "a0"
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
keyA1: "a1"
|
|
656
|
-
}
|
|
657
|
-
]
|
|
658
|
-
},
|
|
659
|
-
tableB: {
|
|
660
|
-
_type: "components",
|
|
661
|
-
_data: [
|
|
662
|
-
{
|
|
663
|
-
keyB0: "b0"
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
keyB1: "b1"
|
|
667
|
-
}
|
|
668
|
-
]
|
|
669
|
-
},
|
|
670
|
-
tableC: {
|
|
671
|
-
_type: "components",
|
|
672
|
-
_data: [
|
|
673
|
-
{
|
|
674
|
-
tableRef: [
|
|
675
|
-
{ component: "tableA", ref: "KFQrf4mEz0UPmUaFHwH4T6" },
|
|
676
|
-
{ component: "tableB", ref: "dXhIygNwNMVPEqFbsFJkn6" }
|
|
677
|
-
]
|
|
678
|
-
}
|
|
679
|
-
]
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
},
|
|
683
746
|
complete: () => {
|
|
684
747
|
const sliceIds = hip({
|
|
685
748
|
_type: "sliceIds",
|
|
@@ -777,87 +840,220 @@ class Example {
|
|
|
777
840
|
};
|
|
778
841
|
},
|
|
779
842
|
missingRef: () => {
|
|
843
|
+
const tableCfgs = hip({
|
|
844
|
+
_type: "tableCfgs",
|
|
845
|
+
_data: [
|
|
846
|
+
{
|
|
847
|
+
key: "tableA",
|
|
848
|
+
type: "components",
|
|
849
|
+
isHead: false,
|
|
850
|
+
isRoot: false,
|
|
851
|
+
isShared: true,
|
|
852
|
+
columns: [
|
|
853
|
+
{
|
|
854
|
+
key: "_hash",
|
|
855
|
+
type: "string",
|
|
856
|
+
titleLong: "Hash",
|
|
857
|
+
titleShort: "Hash"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
key: "propertyA",
|
|
861
|
+
type: "string",
|
|
862
|
+
titleLong: "Key",
|
|
863
|
+
titleShort: "Key"
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
_hash: ""
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
key: "tableB",
|
|
870
|
+
type: "components",
|
|
871
|
+
isHead: false,
|
|
872
|
+
isRoot: false,
|
|
873
|
+
isShared: true,
|
|
874
|
+
columns: [
|
|
875
|
+
{
|
|
876
|
+
key: "_hash",
|
|
877
|
+
type: "string",
|
|
878
|
+
titleLong: "Hash",
|
|
879
|
+
titleShort: "Hash"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
key: "propertyAFromTableA",
|
|
883
|
+
type: "jsonValue",
|
|
884
|
+
titleLong: "Table A Reference",
|
|
885
|
+
titleShort: "TableARef",
|
|
886
|
+
ref: {
|
|
887
|
+
tableKey: "tableA",
|
|
888
|
+
columnKey: "propertyA"
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
],
|
|
892
|
+
_hash: ""
|
|
893
|
+
}
|
|
894
|
+
]
|
|
895
|
+
});
|
|
896
|
+
const tableA = hip({
|
|
897
|
+
_type: "components",
|
|
898
|
+
_tableCfg: tableCfgs._data[0]._hash,
|
|
899
|
+
_data: [
|
|
900
|
+
{
|
|
901
|
+
propertyA: "a0"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
propertyA: "a1"
|
|
905
|
+
}
|
|
906
|
+
],
|
|
907
|
+
_hash: ""
|
|
908
|
+
});
|
|
909
|
+
const tableB = hip({
|
|
910
|
+
_type: "components",
|
|
911
|
+
_tableCfg: tableCfgs._data[1]._hash,
|
|
912
|
+
_data: [
|
|
913
|
+
{
|
|
914
|
+
propertyAFromTableA: "MISSINGREF"
|
|
915
|
+
// Missing reference
|
|
916
|
+
}
|
|
917
|
+
],
|
|
918
|
+
_hash: ""
|
|
919
|
+
});
|
|
780
920
|
return {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
{
|
|
785
|
-
keyA0: "a0"
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
keyA1: "a1"
|
|
789
|
-
}
|
|
790
|
-
]
|
|
791
|
-
},
|
|
792
|
-
tableB: {
|
|
793
|
-
_type: "components",
|
|
794
|
-
_data: [
|
|
795
|
-
{
|
|
796
|
-
tableARef: "MISSINGREF"
|
|
797
|
-
// MISSINGREF does not exist in tableA
|
|
798
|
-
}
|
|
799
|
-
]
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
},
|
|
803
|
-
missingNamedRef: () => {
|
|
804
|
-
return {
|
|
805
|
-
tableA: {
|
|
806
|
-
_type: "components",
|
|
807
|
-
_data: [
|
|
808
|
-
{
|
|
809
|
-
keyA0: "a0"
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
keyA1: "a1"
|
|
813
|
-
}
|
|
814
|
-
]
|
|
815
|
-
},
|
|
816
|
-
tableB: {
|
|
817
|
-
_type: "components",
|
|
818
|
-
_data: [
|
|
819
|
-
{
|
|
820
|
-
namedRef: { component: "tableA", ref: "MISSINGREF" }
|
|
821
|
-
// MISSINGREF does not exist in tableA
|
|
822
|
-
}
|
|
823
|
-
]
|
|
824
|
-
}
|
|
921
|
+
tableCfgs,
|
|
922
|
+
tableA,
|
|
923
|
+
tableB
|
|
825
924
|
};
|
|
826
925
|
},
|
|
827
926
|
missingMultiRef: () => {
|
|
927
|
+
const tableCfgs = hip({
|
|
928
|
+
_type: "tableCfgs",
|
|
929
|
+
_data: [
|
|
930
|
+
{
|
|
931
|
+
key: "tableA",
|
|
932
|
+
type: "components",
|
|
933
|
+
isHead: false,
|
|
934
|
+
isRoot: false,
|
|
935
|
+
isShared: true,
|
|
936
|
+
columns: [
|
|
937
|
+
{
|
|
938
|
+
key: "_hash",
|
|
939
|
+
type: "string",
|
|
940
|
+
titleLong: "Hash",
|
|
941
|
+
titleShort: "Hash"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
key: "propertyA",
|
|
945
|
+
type: "string",
|
|
946
|
+
titleLong: "Key",
|
|
947
|
+
titleShort: "Key"
|
|
948
|
+
}
|
|
949
|
+
],
|
|
950
|
+
_hash: ""
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
key: "tableB",
|
|
954
|
+
type: "components",
|
|
955
|
+
isHead: false,
|
|
956
|
+
isRoot: false,
|
|
957
|
+
isShared: true,
|
|
958
|
+
columns: [
|
|
959
|
+
{
|
|
960
|
+
key: "_hash",
|
|
961
|
+
type: "string",
|
|
962
|
+
titleLong: "Hash",
|
|
963
|
+
titleShort: "Hash"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
key: "propertyAFromTableA",
|
|
967
|
+
type: "jsonValue",
|
|
968
|
+
titleLong: "Table A Reference",
|
|
969
|
+
titleShort: "TableARef",
|
|
970
|
+
ref: {
|
|
971
|
+
tableKey: "tableA",
|
|
972
|
+
columnKey: "propertyA"
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
],
|
|
976
|
+
_hash: ""
|
|
977
|
+
}
|
|
978
|
+
]
|
|
979
|
+
});
|
|
980
|
+
const tableA = hip({
|
|
981
|
+
_type: "components",
|
|
982
|
+
_tableCfg: tableCfgs._data[0]._hash,
|
|
983
|
+
_data: [
|
|
984
|
+
{
|
|
985
|
+
propertyA: "a0"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
propertyA: "a1"
|
|
989
|
+
}
|
|
990
|
+
],
|
|
991
|
+
_hash: ""
|
|
992
|
+
});
|
|
993
|
+
const tableB = hip({
|
|
994
|
+
_type: "components",
|
|
995
|
+
_tableCfg: tableCfgs._data[1]._hash,
|
|
996
|
+
_data: [
|
|
997
|
+
{
|
|
998
|
+
propertyAFromTableA: [tableA._data[0]._hash, "MISSINGREF"]
|
|
999
|
+
// Missing reference
|
|
1000
|
+
}
|
|
1001
|
+
],
|
|
1002
|
+
_hash: ""
|
|
1003
|
+
});
|
|
828
1004
|
return {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
{
|
|
833
|
-
keyA0: "a0"
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
keyA1: "a1"
|
|
837
|
-
}
|
|
838
|
-
]
|
|
839
|
-
},
|
|
840
|
-
tableB: {
|
|
841
|
-
_type: "components",
|
|
842
|
-
_data: [
|
|
843
|
-
{
|
|
844
|
-
tableARef: ["KFQrf4mEz0UPmUaFHwH4T6", "MISSING"]
|
|
845
|
-
}
|
|
846
|
-
]
|
|
847
|
-
}
|
|
1005
|
+
tableCfgs,
|
|
1006
|
+
tableA,
|
|
1007
|
+
tableB
|
|
848
1008
|
};
|
|
849
1009
|
},
|
|
850
1010
|
missingReferencedTable: () => {
|
|
1011
|
+
const tableCfgs = hip({
|
|
1012
|
+
_type: "tableCfgs",
|
|
1013
|
+
_data: [
|
|
1014
|
+
{
|
|
1015
|
+
key: "tableB",
|
|
1016
|
+
type: "components",
|
|
1017
|
+
isHead: false,
|
|
1018
|
+
isRoot: false,
|
|
1019
|
+
isShared: true,
|
|
1020
|
+
columns: [
|
|
1021
|
+
{
|
|
1022
|
+
key: "_hash",
|
|
1023
|
+
type: "string",
|
|
1024
|
+
titleLong: "Hash",
|
|
1025
|
+
titleShort: "Hash"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
key: "propertyAFromTableA",
|
|
1029
|
+
type: "jsonValue",
|
|
1030
|
+
titleLong: "Table A Reference",
|
|
1031
|
+
titleShort: "TableARef",
|
|
1032
|
+
ref: {
|
|
1033
|
+
tableKey: "tableA",
|
|
1034
|
+
// Referenced table missing
|
|
1035
|
+
columnKey: "propertyA"
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
],
|
|
1039
|
+
_hash: ""
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
1042
|
+
});
|
|
1043
|
+
const tableB = hip({
|
|
1044
|
+
_type: "components",
|
|
1045
|
+
_tableCfg: tableCfgs._data[0]._hash,
|
|
1046
|
+
_data: [
|
|
1047
|
+
{
|
|
1048
|
+
propertyAFromTableA: "MISSINGREF"
|
|
1049
|
+
// Missing reference
|
|
1050
|
+
}
|
|
1051
|
+
],
|
|
1052
|
+
_hash: ""
|
|
1053
|
+
});
|
|
851
1054
|
return {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
_data: [
|
|
855
|
-
{
|
|
856
|
-
tableARef: "MISSINGREF"
|
|
857
|
-
// tableA is missing
|
|
858
|
-
}
|
|
859
|
-
]
|
|
860
|
-
}
|
|
1055
|
+
tableCfgs,
|
|
1056
|
+
tableB
|
|
861
1057
|
};
|
|
862
1058
|
},
|
|
863
1059
|
missingSliceId: () => {
|
|
@@ -1400,7 +1596,6 @@ class _BaseValidator {
|
|
|
1400
1596
|
() => this._rootOrHeadTableHasNoIdColumn(),
|
|
1401
1597
|
// Check references
|
|
1402
1598
|
() => this._refsNotFound(),
|
|
1403
|
-
() => this._sliceIdRefsNotFound(),
|
|
1404
1599
|
// Check layers
|
|
1405
1600
|
() => this._layerBasesNotFound(),
|
|
1406
1601
|
() => this._layerSliceIdsTableNotFound(),
|
|
@@ -1769,36 +1964,46 @@ class _BaseValidator {
|
|
|
1769
1964
|
_refsNotFound() {
|
|
1770
1965
|
const missingRefs = [];
|
|
1771
1966
|
iterateTablesSync(this.rljson, (tableKey, table) => {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1967
|
+
if (tableKey === "tableCfgs") return;
|
|
1968
|
+
const tableCfgRef = table._tableCfg;
|
|
1969
|
+
if (!tableCfgRef) return;
|
|
1970
|
+
const tableCfg = this.rljsonIndexed.tableCfgs._data[tableCfgRef];
|
|
1971
|
+
/* v8 ignore next -- @preserve */
|
|
1972
|
+
if (!tableCfg) return;
|
|
1973
|
+
const tableRows = table._data;
|
|
1974
|
+
for (const row of tableRows) {
|
|
1975
|
+
for (const columnKey of Object.keys(row)) {
|
|
1976
|
+
if (columnKey.startsWith("_")) continue;
|
|
1977
|
+
const columnCfg = tableCfg.columns.find(
|
|
1978
|
+
(col) => col.key === columnKey
|
|
1979
|
+
);
|
|
1980
|
+
/* v8 ignore next -- @preserve */
|
|
1981
|
+
if (columnCfg === void 0) continue;
|
|
1982
|
+
if (columnCfg.ref && columnCfg.ref.tableKey) {
|
|
1983
|
+
const targetTableKey = columnCfg.ref.tableKey;
|
|
1984
|
+
const targetRefs = Array.isArray(row[columnKey]) ? row[columnKey] : [row[columnKey]];
|
|
1985
|
+
for (const targetRef of targetRefs) {
|
|
1781
1986
|
if (this.tableKeys.indexOf(targetTableKey) === -1) {
|
|
1782
1987
|
missingRefs.push({
|
|
1783
1988
|
error: `Target table "${targetTableKey}" not found.`,
|
|
1784
1989
|
sourceTable: tableKey,
|
|
1785
|
-
sourceKey:
|
|
1786
|
-
sourceItemHash:
|
|
1787
|
-
targetItemHash,
|
|
1990
|
+
sourceKey: columnKey,
|
|
1991
|
+
sourceItemHash: row._hash,
|
|
1992
|
+
targetItemHash: targetRef,
|
|
1788
1993
|
targetTable: targetTableKey
|
|
1789
1994
|
});
|
|
1790
1995
|
continue;
|
|
1791
1996
|
}
|
|
1792
1997
|
const targetTableIndexed = this.rljsonIndexed[targetTableKey];
|
|
1793
|
-
const referencedItem = targetTableIndexed._data[
|
|
1998
|
+
const referencedItem = targetTableIndexed._data[targetRef];
|
|
1794
1999
|
if (referencedItem === void 0) {
|
|
1795
2000
|
missingRefs.push({
|
|
1796
2001
|
sourceTable: tableKey,
|
|
1797
|
-
sourceItemHash:
|
|
1798
|
-
sourceKey:
|
|
1799
|
-
targetItemHash,
|
|
2002
|
+
sourceItemHash: row._hash,
|
|
2003
|
+
sourceKey: columnKey,
|
|
2004
|
+
targetItemHash: targetRef,
|
|
1800
2005
|
targetTable: targetTableKey,
|
|
1801
|
-
error: `Table "${targetTableKey}" has no item with hash "${
|
|
2006
|
+
error: `Table "${targetTableKey}" has no item with hash "${targetRef}"`
|
|
1802
2007
|
});
|
|
1803
2008
|
}
|
|
1804
2009
|
}
|
|
@@ -1814,49 +2019,6 @@ class _BaseValidator {
|
|
|
1814
2019
|
}
|
|
1815
2020
|
}
|
|
1816
2021
|
// ...........................................................................
|
|
1817
|
-
_sliceIdRefsNotFound() {
|
|
1818
|
-
const missingSliceIdRefs = [];
|
|
1819
|
-
iterateTablesSync(this.rljson, (tableKey, table) => {
|
|
1820
|
-
const tableData = table._data;
|
|
1821
|
-
for (const item of tableData) {
|
|
1822
|
-
for (const key of Object.keys(item)) {
|
|
1823
|
-
if (key.endsWith("SliceId")) {
|
|
1824
|
-
const targetSliceIds = Array.isArray(item[key]) ? item[key] : [item[key]];
|
|
1825
|
-
for (const targetSliceId of targetSliceIds) {
|
|
1826
|
-
if (this.tableKeys.indexOf(key) === -1) {
|
|
1827
|
-
missingSliceIdRefs.push({
|
|
1828
|
-
sourceTable: tableKey,
|
|
1829
|
-
targetSliceId,
|
|
1830
|
-
targetTable: key,
|
|
1831
|
-
error: `Target table "${targetSliceId}" not found.`
|
|
1832
|
-
});
|
|
1833
|
-
continue;
|
|
1834
|
-
}
|
|
1835
|
-
const targetSliceIdsTable = this.rljson[key];
|
|
1836
|
-
const targetSliceIds2 = targetSliceIdsTable._data.flatMap(
|
|
1837
|
-
(d) => [...d.add, ...d.remove ?? []]
|
|
1838
|
-
);
|
|
1839
|
-
if (targetSliceIds2.indexOf(targetSliceId) === -1) {
|
|
1840
|
-
missingSliceIdRefs.push({
|
|
1841
|
-
sourceTable: tableKey,
|
|
1842
|
-
targetSliceId,
|
|
1843
|
-
targetTable: key,
|
|
1844
|
-
error: `Table "${key}" has no sliceId "${targetSliceId}"`
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
if (missingSliceIdRefs.length > 0) {
|
|
1853
|
-
this.errors.refsNotFound = {
|
|
1854
|
-
error: "Broken references",
|
|
1855
|
-
missingRefs: missingSliceIdRefs
|
|
1856
|
-
};
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
// ...........................................................................
|
|
1860
2022
|
_layerBasesNotFound() {
|
|
1861
2023
|
const brokenLayers = [];
|
|
1862
2024
|
iterateTablesSync(this.rljson, (tableKey, table) => {
|
package/dist/src/example.ts
CHANGED
|
@@ -16,7 +16,6 @@ import { ColumnCfg, TablesCfgTable } from './content/table-cfg.ts';
|
|
|
16
16
|
import { bakeryExample } from './example/bakery-example.ts';
|
|
17
17
|
import { Rljson } from './rljson.ts';
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
export class Example {
|
|
21
20
|
static readonly ok = {
|
|
22
21
|
bakery: (): Rljson => bakeryExample(),
|
|
@@ -158,26 +157,178 @@ export class Example {
|
|
|
158
157
|
},
|
|
159
158
|
|
|
160
159
|
singleRef: (): Rljson => {
|
|
160
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
161
|
+
_type: 'tableCfgs',
|
|
162
|
+
_data: [
|
|
163
|
+
{
|
|
164
|
+
key: 'tableA',
|
|
165
|
+
type: 'components',
|
|
166
|
+
isHead: false,
|
|
167
|
+
isRoot: false,
|
|
168
|
+
isShared: true,
|
|
169
|
+
columns: [
|
|
170
|
+
{
|
|
171
|
+
key: '_hash',
|
|
172
|
+
type: 'string',
|
|
173
|
+
titleLong: 'Hash',
|
|
174
|
+
titleShort: 'Hash',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: 'propertyA',
|
|
178
|
+
type: 'string',
|
|
179
|
+
titleLong: 'Key',
|
|
180
|
+
titleShort: 'Key',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
_hash: '',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: 'tableB',
|
|
187
|
+
type: 'components',
|
|
188
|
+
isHead: false,
|
|
189
|
+
isRoot: false,
|
|
190
|
+
isShared: true,
|
|
191
|
+
columns: [
|
|
192
|
+
{
|
|
193
|
+
key: '_hash',
|
|
194
|
+
type: 'string',
|
|
195
|
+
titleLong: 'Hash',
|
|
196
|
+
titleShort: 'Hash',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: 'propertyAFromTableA',
|
|
200
|
+
type: 'string',
|
|
201
|
+
titleLong: 'Table A Reference',
|
|
202
|
+
titleShort: 'TableARef',
|
|
203
|
+
ref: {
|
|
204
|
+
tableKey: 'tableA',
|
|
205
|
+
columnKey: 'propertyA',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
_hash: '',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
} as TablesCfgTable);
|
|
213
|
+
|
|
214
|
+
const tableA = hip<ComponentsTable<Json>>({
|
|
215
|
+
_type: 'components',
|
|
216
|
+
_tableCfg: tableCfgs._data[0]._hash as string,
|
|
217
|
+
_data: [
|
|
218
|
+
{
|
|
219
|
+
propertyA: 'a0',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
propertyA: 'a1',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
_hash: '',
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const tableB = hip<ComponentsTable<Json>>({
|
|
229
|
+
_type: 'components',
|
|
230
|
+
_tableCfg: tableCfgs._data[1]._hash as string,
|
|
231
|
+
_data: [
|
|
232
|
+
{
|
|
233
|
+
propertyAFromTableA: tableA._data[0]._hash as string,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
_hash: '',
|
|
237
|
+
});
|
|
238
|
+
|
|
161
239
|
return {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
240
|
+
tableCfgs,
|
|
241
|
+
tableA,
|
|
242
|
+
tableB,
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
multiRef: (): Rljson => {
|
|
246
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
247
|
+
_type: 'tableCfgs',
|
|
248
|
+
_data: [
|
|
249
|
+
{
|
|
250
|
+
key: 'tableA',
|
|
251
|
+
type: 'components',
|
|
252
|
+
isHead: false,
|
|
253
|
+
isRoot: false,
|
|
254
|
+
isShared: true,
|
|
255
|
+
columns: [
|
|
256
|
+
{
|
|
257
|
+
key: '_hash',
|
|
258
|
+
type: 'string',
|
|
259
|
+
titleLong: 'Hash',
|
|
260
|
+
titleShort: 'Hash',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: 'propertyA',
|
|
264
|
+
type: 'string',
|
|
265
|
+
titleLong: 'Key',
|
|
266
|
+
titleShort: 'Key',
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
_hash: '',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
key: 'tableB',
|
|
273
|
+
type: 'components',
|
|
274
|
+
isHead: false,
|
|
275
|
+
isRoot: false,
|
|
276
|
+
isShared: true,
|
|
277
|
+
columns: [
|
|
278
|
+
{
|
|
279
|
+
key: '_hash',
|
|
280
|
+
type: 'string',
|
|
281
|
+
titleLong: 'Hash',
|
|
282
|
+
titleShort: 'Hash',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: 'propertyAFromTableA',
|
|
286
|
+
type: 'jsonValue',
|
|
287
|
+
titleLong: 'Table A Reference',
|
|
288
|
+
titleShort: 'TableARef',
|
|
289
|
+
ref: {
|
|
290
|
+
tableKey: 'tableA',
|
|
291
|
+
columnKey: 'propertyA',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
_hash: '',
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
} as TablesCfgTable);
|
|
299
|
+
|
|
300
|
+
const tableA = hip<ComponentsTable<Json>>({
|
|
301
|
+
_type: 'components',
|
|
302
|
+
_tableCfg: tableCfgs._data[0]._hash as string,
|
|
303
|
+
_data: [
|
|
304
|
+
{
|
|
305
|
+
propertyA: 'a0',
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
propertyA: 'a1',
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
_hash: '',
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
const tableB = hip<ComponentsTable<Json>>({
|
|
315
|
+
_type: 'components',
|
|
316
|
+
_tableCfg: tableCfgs._data[1]._hash as string,
|
|
317
|
+
_data: [
|
|
318
|
+
{
|
|
319
|
+
propertyAFromTableA: [
|
|
320
|
+
tableA._data[0]._hash,
|
|
321
|
+
tableA._data[1]._hash,
|
|
322
|
+
] as string[],
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
_hash: '',
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
return {
|
|
329
|
+
tableCfgs,
|
|
330
|
+
tableA,
|
|
331
|
+
tableB,
|
|
181
332
|
};
|
|
182
333
|
},
|
|
183
334
|
singleSliceIdRef: (): Rljson => {
|
|
@@ -220,90 +371,6 @@ export class Example {
|
|
|
220
371
|
} as ComponentsTable<Json>,
|
|
221
372
|
};
|
|
222
373
|
},
|
|
223
|
-
singleNamedRef: (): Rljson => {
|
|
224
|
-
return {
|
|
225
|
-
tableA: {
|
|
226
|
-
_type: 'components',
|
|
227
|
-
_data: [
|
|
228
|
-
{
|
|
229
|
-
keyA0: 'a0',
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
keyA1: 'a1',
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
tableB: {
|
|
237
|
-
_type: 'components',
|
|
238
|
-
_data: [
|
|
239
|
-
{
|
|
240
|
-
namedRef: { component: 'tableA', ref: 'KFQrf4mEz0UPmUaFHwH4T6' },
|
|
241
|
-
},
|
|
242
|
-
],
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
multiRef: (): Rljson => {
|
|
247
|
-
return {
|
|
248
|
-
tableA: {
|
|
249
|
-
_type: 'components',
|
|
250
|
-
_data: [
|
|
251
|
-
{
|
|
252
|
-
keyA0: 'a0',
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
keyA1: 'a1',
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
},
|
|
259
|
-
tableB: {
|
|
260
|
-
_type: 'components',
|
|
261
|
-
_data: [
|
|
262
|
-
{
|
|
263
|
-
tableARef: ['KFQrf4mEz0UPmUaFHwH4T6', 'YPw-pxhqaUOWRFGramr4B1'],
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
},
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
multiMixedRef: (): Rljson => {
|
|
270
|
-
return {
|
|
271
|
-
tableA: {
|
|
272
|
-
_type: 'components',
|
|
273
|
-
_data: [
|
|
274
|
-
{
|
|
275
|
-
keyA0: 'a0',
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
keyA1: 'a1',
|
|
279
|
-
},
|
|
280
|
-
],
|
|
281
|
-
},
|
|
282
|
-
tableB: {
|
|
283
|
-
_type: 'components',
|
|
284
|
-
_data: [
|
|
285
|
-
{
|
|
286
|
-
keyB0: 'b0',
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
keyB1: 'b1',
|
|
290
|
-
},
|
|
291
|
-
],
|
|
292
|
-
},
|
|
293
|
-
tableC: {
|
|
294
|
-
_type: 'components',
|
|
295
|
-
_data: [
|
|
296
|
-
{
|
|
297
|
-
tableRef: [
|
|
298
|
-
{ component: 'tableA', ref: 'KFQrf4mEz0UPmUaFHwH4T6' },
|
|
299
|
-
{ component: 'tableB', ref: 'dXhIygNwNMVPEqFbsFJkn6' },
|
|
300
|
-
],
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
},
|
|
306
|
-
|
|
307
374
|
complete: (): Rljson => {
|
|
308
375
|
const sliceIds = hip<SliceIdsTable>({
|
|
309
376
|
_type: 'sliceIds',
|
|
@@ -413,87 +480,226 @@ export class Example {
|
|
|
413
480
|
},
|
|
414
481
|
|
|
415
482
|
missingRef: (): Rljson => {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
483
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
484
|
+
_type: 'tableCfgs',
|
|
485
|
+
_data: [
|
|
486
|
+
{
|
|
487
|
+
key: 'tableA',
|
|
488
|
+
type: 'components',
|
|
489
|
+
isHead: false,
|
|
490
|
+
isRoot: false,
|
|
491
|
+
isShared: true,
|
|
492
|
+
columns: [
|
|
493
|
+
{
|
|
494
|
+
key: '_hash',
|
|
495
|
+
type: 'string',
|
|
496
|
+
titleLong: 'Hash',
|
|
497
|
+
titleShort: 'Hash',
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
key: 'propertyA',
|
|
501
|
+
type: 'string',
|
|
502
|
+
titleLong: 'Key',
|
|
503
|
+
titleShort: 'Key',
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
_hash: '',
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
key: 'tableB',
|
|
510
|
+
type: 'components',
|
|
511
|
+
isHead: false,
|
|
512
|
+
isRoot: false,
|
|
513
|
+
isShared: true,
|
|
514
|
+
columns: [
|
|
515
|
+
{
|
|
516
|
+
key: '_hash',
|
|
517
|
+
type: 'string',
|
|
518
|
+
titleLong: 'Hash',
|
|
519
|
+
titleShort: 'Hash',
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
key: 'propertyAFromTableA',
|
|
523
|
+
type: 'jsonValue',
|
|
524
|
+
titleLong: 'Table A Reference',
|
|
525
|
+
titleShort: 'TableARef',
|
|
526
|
+
ref: {
|
|
527
|
+
tableKey: 'tableA',
|
|
528
|
+
columnKey: 'propertyA',
|
|
529
|
+
},
|
|
530
|
+
},
|
|
531
|
+
],
|
|
532
|
+
_hash: '',
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
} as TablesCfgTable);
|
|
536
|
+
|
|
537
|
+
const tableA = hip<ComponentsTable<Json>>({
|
|
538
|
+
_type: 'components',
|
|
539
|
+
_tableCfg: tableCfgs._data[0]._hash as string,
|
|
540
|
+
_data: [
|
|
541
|
+
{
|
|
542
|
+
propertyA: 'a0',
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
propertyA: 'a1',
|
|
546
|
+
},
|
|
547
|
+
],
|
|
548
|
+
_hash: '',
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
const tableB = hip<ComponentsTable<Json>>({
|
|
552
|
+
_type: 'components',
|
|
553
|
+
_tableCfg: tableCfgs._data[1]._hash as string,
|
|
554
|
+
_data: [
|
|
555
|
+
{
|
|
556
|
+
propertyAFromTableA: 'MISSINGREF', // Missing reference
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
_hash: '',
|
|
560
|
+
});
|
|
438
561
|
|
|
439
|
-
missingNamedRef: (): Rljson => {
|
|
440
562
|
return {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
{
|
|
445
|
-
keyA0: 'a0',
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
keyA1: 'a1',
|
|
449
|
-
},
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
tableB: {
|
|
453
|
-
_type: 'components',
|
|
454
|
-
_data: [
|
|
455
|
-
{
|
|
456
|
-
namedRef: { component: 'tableA', ref: 'MISSINGREF' }, // MISSINGREF does not exist in tableA
|
|
457
|
-
},
|
|
458
|
-
],
|
|
459
|
-
},
|
|
563
|
+
tableCfgs,
|
|
564
|
+
tableA,
|
|
565
|
+
tableB,
|
|
460
566
|
};
|
|
461
567
|
},
|
|
462
568
|
|
|
463
569
|
missingMultiRef: (): Rljson => {
|
|
570
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
571
|
+
_type: 'tableCfgs',
|
|
572
|
+
_data: [
|
|
573
|
+
{
|
|
574
|
+
key: 'tableA',
|
|
575
|
+
type: 'components',
|
|
576
|
+
isHead: false,
|
|
577
|
+
isRoot: false,
|
|
578
|
+
isShared: true,
|
|
579
|
+
columns: [
|
|
580
|
+
{
|
|
581
|
+
key: '_hash',
|
|
582
|
+
type: 'string',
|
|
583
|
+
titleLong: 'Hash',
|
|
584
|
+
titleShort: 'Hash',
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
key: 'propertyA',
|
|
588
|
+
type: 'string',
|
|
589
|
+
titleLong: 'Key',
|
|
590
|
+
titleShort: 'Key',
|
|
591
|
+
},
|
|
592
|
+
],
|
|
593
|
+
_hash: '',
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: 'tableB',
|
|
597
|
+
type: 'components',
|
|
598
|
+
isHead: false,
|
|
599
|
+
isRoot: false,
|
|
600
|
+
isShared: true,
|
|
601
|
+
columns: [
|
|
602
|
+
{
|
|
603
|
+
key: '_hash',
|
|
604
|
+
type: 'string',
|
|
605
|
+
titleLong: 'Hash',
|
|
606
|
+
titleShort: 'Hash',
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
key: 'propertyAFromTableA',
|
|
610
|
+
type: 'jsonValue',
|
|
611
|
+
titleLong: 'Table A Reference',
|
|
612
|
+
titleShort: 'TableARef',
|
|
613
|
+
ref: {
|
|
614
|
+
tableKey: 'tableA',
|
|
615
|
+
columnKey: 'propertyA',
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
],
|
|
619
|
+
_hash: '',
|
|
620
|
+
},
|
|
621
|
+
],
|
|
622
|
+
} as TablesCfgTable);
|
|
623
|
+
|
|
624
|
+
const tableA = hip<ComponentsTable<Json>>({
|
|
625
|
+
_type: 'components',
|
|
626
|
+
_tableCfg: tableCfgs._data[0]._hash as string,
|
|
627
|
+
_data: [
|
|
628
|
+
{
|
|
629
|
+
propertyA: 'a0',
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
propertyA: 'a1',
|
|
633
|
+
},
|
|
634
|
+
],
|
|
635
|
+
_hash: '',
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
const tableB = hip<ComponentsTable<Json>>({
|
|
639
|
+
_type: 'components',
|
|
640
|
+
_tableCfg: tableCfgs._data[1]._hash as string,
|
|
641
|
+
_data: [
|
|
642
|
+
{
|
|
643
|
+
propertyAFromTableA: [tableA._data[0]._hash, 'MISSINGREF'], // Missing reference
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
_hash: '',
|
|
647
|
+
});
|
|
648
|
+
|
|
464
649
|
return {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
{
|
|
469
|
-
keyA0: 'a0',
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
keyA1: 'a1',
|
|
473
|
-
},
|
|
474
|
-
],
|
|
475
|
-
},
|
|
476
|
-
tableB: {
|
|
477
|
-
_type: 'components',
|
|
478
|
-
_data: [
|
|
479
|
-
{
|
|
480
|
-
tableARef: ['KFQrf4mEz0UPmUaFHwH4T6', 'MISSING'],
|
|
481
|
-
},
|
|
482
|
-
],
|
|
483
|
-
},
|
|
650
|
+
tableCfgs,
|
|
651
|
+
tableA,
|
|
652
|
+
tableB,
|
|
484
653
|
};
|
|
485
654
|
},
|
|
486
655
|
|
|
487
656
|
missingReferencedTable: (): Rljson => {
|
|
657
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
658
|
+
_type: 'tableCfgs',
|
|
659
|
+
_data: [
|
|
660
|
+
{
|
|
661
|
+
key: 'tableB',
|
|
662
|
+
type: 'components',
|
|
663
|
+
isHead: false,
|
|
664
|
+
isRoot: false,
|
|
665
|
+
isShared: true,
|
|
666
|
+
columns: [
|
|
667
|
+
{
|
|
668
|
+
key: '_hash',
|
|
669
|
+
type: 'string',
|
|
670
|
+
titleLong: 'Hash',
|
|
671
|
+
titleShort: 'Hash',
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
key: 'propertyAFromTableA',
|
|
675
|
+
type: 'jsonValue',
|
|
676
|
+
titleLong: 'Table A Reference',
|
|
677
|
+
titleShort: 'TableARef',
|
|
678
|
+
ref: {
|
|
679
|
+
tableKey: 'tableA', // Referenced table missing
|
|
680
|
+
columnKey: 'propertyA',
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
],
|
|
684
|
+
_hash: '',
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
} as TablesCfgTable);
|
|
688
|
+
|
|
689
|
+
const tableB = hip<ComponentsTable<Json>>({
|
|
690
|
+
_type: 'components',
|
|
691
|
+
_tableCfg: tableCfgs._data[0]._hash as string,
|
|
692
|
+
_data: [
|
|
693
|
+
{
|
|
694
|
+
propertyAFromTableA: 'MISSINGREF', // Missing reference
|
|
695
|
+
},
|
|
696
|
+
],
|
|
697
|
+
_hash: '',
|
|
698
|
+
});
|
|
699
|
+
|
|
488
700
|
return {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
_data: [
|
|
492
|
-
{
|
|
493
|
-
tableARef: 'MISSINGREF', // tableA is missing
|
|
494
|
-
},
|
|
495
|
-
],
|
|
496
|
-
},
|
|
701
|
+
tableCfgs,
|
|
702
|
+
tableB,
|
|
497
703
|
};
|
|
498
704
|
},
|
|
499
705
|
|