@itwin/core-i18n 5.13.1 → 5.14.0-dev.10
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 +1 -6
- package/lib/cjs/ITwinLocalization.d.ts.map +1 -1
- package/lib/cjs/ITwinLocalization.js +3 -17
- package/lib/cjs/ITwinLocalization.js.map +1 -1
- package/lib/cjs/test/ITwinLocalization.test.js +60 -0
- package/lib/cjs/test/ITwinLocalization.test.js.map +1 -1
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js +441 -376
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js.map +1 -1
- package/lib/cjs/test/webpack/bundled-tests.js +293 -91
- package/lib/cjs/test/webpack/bundled-tests.js.map +1 -1
- package/lib/esm/ITwinLocalization.d.ts.map +1 -1
- package/lib/esm/ITwinLocalization.js +3 -17
- package/lib/esm/ITwinLocalization.js.map +1 -1
- package/lib/esm/test/ITwinLocalization.test.js +60 -0
- package/lib/esm/test/ITwinLocalization.test.js.map +1 -1
- package/package.json +6 -6
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
function cov_ogldeftyv() {
|
|
21
21
|
var path = "C:\\agent\\_work\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js";
|
|
22
|
-
var hash = "
|
|
22
|
+
var hash = "8de28e753813d64322bcaeb99c8c8dfad2c2faad";
|
|
23
23
|
var global = new Function("return this")();
|
|
24
24
|
var gcv = "__coverage__";
|
|
25
25
|
var coverageData = {
|
|
@@ -521,7 +521,7 @@ function cov_ogldeftyv() {
|
|
|
521
521
|
column: 31
|
|
522
522
|
},
|
|
523
523
|
end: {
|
|
524
|
-
line:
|
|
524
|
+
line: 176,
|
|
525
525
|
column: 10
|
|
526
526
|
}
|
|
527
527
|
},
|
|
@@ -531,7 +531,7 @@ function cov_ogldeftyv() {
|
|
|
531
531
|
column: 12
|
|
532
532
|
},
|
|
533
533
|
end: {
|
|
534
|
-
line:
|
|
534
|
+
line: 175,
|
|
535
535
|
column: 15
|
|
536
536
|
}
|
|
537
537
|
},
|
|
@@ -557,251 +557,191 @@ function cov_ogldeftyv() {
|
|
|
557
557
|
},
|
|
558
558
|
"53": {
|
|
559
559
|
start: {
|
|
560
|
-
line:
|
|
561
|
-
column:
|
|
560
|
+
line: 171,
|
|
561
|
+
column: 34
|
|
562
562
|
},
|
|
563
563
|
end: {
|
|
564
|
-
line:
|
|
565
|
-
column:
|
|
564
|
+
line: 171,
|
|
565
|
+
column: 123
|
|
566
566
|
}
|
|
567
567
|
},
|
|
568
568
|
"54": {
|
|
569
569
|
start: {
|
|
570
|
-
line:
|
|
571
|
-
column:
|
|
570
|
+
line: 171,
|
|
571
|
+
column: 76
|
|
572
572
|
},
|
|
573
573
|
end: {
|
|
574
|
-
line:
|
|
575
|
-
column:
|
|
574
|
+
line: 171,
|
|
575
|
+
column: 122
|
|
576
576
|
}
|
|
577
577
|
},
|
|
578
578
|
"55": {
|
|
579
579
|
start: {
|
|
580
|
-
line:
|
|
581
|
-
column: 16
|
|
582
|
-
},
|
|
583
|
-
end: {
|
|
584
|
-
line: 184,
|
|
585
|
-
column: 17
|
|
586
|
-
}
|
|
587
|
-
},
|
|
588
|
-
"56": {
|
|
589
|
-
start: {
|
|
590
|
-
line: 177,
|
|
591
|
-
column: 20
|
|
592
|
-
},
|
|
593
|
-
end: {
|
|
594
|
-
line: 180,
|
|
595
|
-
column: 21
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
"57": {
|
|
599
|
-
start: {
|
|
600
|
-
line: 178,
|
|
601
|
-
column: 24
|
|
602
|
-
},
|
|
603
|
-
end: {
|
|
604
|
-
line: 179,
|
|
605
|
-
column: 102
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
"58": {
|
|
609
|
-
start: {
|
|
610
|
-
line: 179,
|
|
611
|
-
column: 28
|
|
612
|
-
},
|
|
613
|
-
end: {
|
|
614
|
-
line: 179,
|
|
615
|
-
column: 102
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
"59": {
|
|
619
|
-
start: {
|
|
620
|
-
line: 179,
|
|
621
|
-
column: 69
|
|
622
|
-
},
|
|
623
|
-
end: {
|
|
624
|
-
line: 179,
|
|
625
|
-
column: 100
|
|
626
|
-
}
|
|
627
|
-
},
|
|
628
|
-
"60": {
|
|
629
|
-
start: {
|
|
630
|
-
line: 183,
|
|
631
|
-
column: 20
|
|
632
|
-
},
|
|
633
|
-
end: {
|
|
634
|
-
line: 183,
|
|
635
|
-
column: 33
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
"61": {
|
|
639
|
-
start: {
|
|
640
|
-
line: 186,
|
|
580
|
+
line: 172,
|
|
641
581
|
column: 16
|
|
642
582
|
},
|
|
643
583
|
end: {
|
|
644
|
-
line:
|
|
584
|
+
line: 173,
|
|
645
585
|
column: 113
|
|
646
586
|
}
|
|
647
587
|
},
|
|
648
|
-
"
|
|
588
|
+
"56": {
|
|
649
589
|
start: {
|
|
650
|
-
line:
|
|
590
|
+
line: 173,
|
|
651
591
|
column: 20
|
|
652
592
|
},
|
|
653
593
|
end: {
|
|
654
|
-
line:
|
|
594
|
+
line: 173,
|
|
655
595
|
column: 113
|
|
656
596
|
}
|
|
657
597
|
},
|
|
658
|
-
"
|
|
598
|
+
"57": {
|
|
659
599
|
start: {
|
|
660
|
-
line:
|
|
600
|
+
line: 174,
|
|
661
601
|
column: 16
|
|
662
602
|
},
|
|
663
603
|
end: {
|
|
664
|
-
line:
|
|
604
|
+
line: 174,
|
|
665
605
|
column: 26
|
|
666
606
|
}
|
|
667
607
|
},
|
|
668
|
-
"
|
|
608
|
+
"58": {
|
|
669
609
|
start: {
|
|
670
|
-
line:
|
|
610
|
+
line: 177,
|
|
671
611
|
column: 8
|
|
672
612
|
},
|
|
673
613
|
end: {
|
|
674
|
-
line:
|
|
614
|
+
line: 177,
|
|
675
615
|
column: 51
|
|
676
616
|
}
|
|
677
617
|
},
|
|
678
|
-
"
|
|
618
|
+
"59": {
|
|
679
619
|
start: {
|
|
680
|
-
line:
|
|
620
|
+
line: 178,
|
|
681
621
|
column: 8
|
|
682
622
|
},
|
|
683
623
|
end: {
|
|
684
|
-
line:
|
|
624
|
+
line: 178,
|
|
685
625
|
column: 30
|
|
686
626
|
}
|
|
687
627
|
},
|
|
688
|
-
"
|
|
628
|
+
"60": {
|
|
689
629
|
start: {
|
|
690
|
-
line:
|
|
630
|
+
line: 182,
|
|
691
631
|
column: 8
|
|
692
632
|
},
|
|
693
633
|
end: {
|
|
694
|
-
line:
|
|
634
|
+
line: 182,
|
|
695
635
|
column: 38
|
|
696
636
|
}
|
|
697
637
|
},
|
|
698
|
-
"
|
|
638
|
+
"61": {
|
|
699
639
|
start: {
|
|
700
|
-
line:
|
|
640
|
+
line: 185,
|
|
701
641
|
column: 0
|
|
702
642
|
},
|
|
703
643
|
end: {
|
|
704
|
-
line:
|
|
644
|
+
line: 185,
|
|
705
645
|
column: 46
|
|
706
646
|
}
|
|
707
647
|
},
|
|
708
|
-
"
|
|
648
|
+
"62": {
|
|
709
649
|
start: {
|
|
710
|
-
line:
|
|
650
|
+
line: 187,
|
|
711
651
|
column: 18
|
|
712
652
|
},
|
|
713
653
|
end: {
|
|
714
|
-
line:
|
|
654
|
+
line: 187,
|
|
715
655
|
column: 26
|
|
716
656
|
}
|
|
717
657
|
},
|
|
718
|
-
"
|
|
658
|
+
"63": {
|
|
719
659
|
start: {
|
|
720
|
-
line:
|
|
660
|
+
line: 188,
|
|
721
661
|
column: 16
|
|
722
662
|
},
|
|
723
663
|
end: {
|
|
724
|
-
line:
|
|
664
|
+
line: 188,
|
|
725
665
|
column: 83
|
|
726
666
|
}
|
|
727
667
|
},
|
|
728
|
-
"
|
|
668
|
+
"64": {
|
|
729
669
|
start: {
|
|
730
|
-
line:
|
|
670
|
+
line: 189,
|
|
731
671
|
column: 17
|
|
732
672
|
},
|
|
733
673
|
end: {
|
|
734
|
-
line:
|
|
674
|
+
line: 189,
|
|
735
675
|
column: 87
|
|
736
676
|
}
|
|
737
677
|
},
|
|
738
|
-
"
|
|
678
|
+
"65": {
|
|
739
679
|
start: {
|
|
740
|
-
line:
|
|
680
|
+
line: 190,
|
|
741
681
|
column: 18
|
|
742
682
|
},
|
|
743
683
|
end: {
|
|
744
|
-
line:
|
|
684
|
+
line: 190,
|
|
745
685
|
column: 86
|
|
746
686
|
}
|
|
747
687
|
},
|
|
748
|
-
"
|
|
688
|
+
"66": {
|
|
749
689
|
start: {
|
|
750
|
-
line:
|
|
690
|
+
line: 192,
|
|
751
691
|
column: 22
|
|
752
692
|
},
|
|
753
693
|
end: {
|
|
754
|
-
line:
|
|
694
|
+
line: 192,
|
|
755
695
|
column: 29
|
|
756
696
|
}
|
|
757
697
|
},
|
|
758
|
-
"
|
|
698
|
+
"67": {
|
|
759
699
|
start: {
|
|
760
|
-
line:
|
|
700
|
+
line: 193,
|
|
761
701
|
column: 8
|
|
762
702
|
},
|
|
763
703
|
end: {
|
|
764
|
-
line:
|
|
704
|
+
line: 196,
|
|
765
705
|
column: 9
|
|
766
706
|
}
|
|
767
707
|
},
|
|
768
|
-
"
|
|
708
|
+
"68": {
|
|
769
709
|
start: {
|
|
770
|
-
line:
|
|
710
|
+
line: 193,
|
|
771
711
|
column: 21
|
|
772
712
|
},
|
|
773
713
|
end: {
|
|
774
|
-
line:
|
|
714
|
+
line: 193,
|
|
775
715
|
column: 22
|
|
776
716
|
}
|
|
777
717
|
},
|
|
778
|
-
"
|
|
718
|
+
"69": {
|
|
779
719
|
start: {
|
|
780
|
-
line:
|
|
720
|
+
line: 194,
|
|
781
721
|
column: 12
|
|
782
722
|
},
|
|
783
723
|
end: {
|
|
784
|
-
line:
|
|
724
|
+
line: 195,
|
|
785
725
|
column: 44
|
|
786
726
|
}
|
|
787
727
|
},
|
|
788
|
-
"
|
|
728
|
+
"70": {
|
|
789
729
|
start: {
|
|
790
|
-
line:
|
|
730
|
+
line: 195,
|
|
791
731
|
column: 16
|
|
792
732
|
},
|
|
793
733
|
end: {
|
|
794
|
-
line:
|
|
734
|
+
line: 195,
|
|
795
735
|
column: 44
|
|
796
736
|
}
|
|
797
737
|
},
|
|
798
|
-
"
|
|
738
|
+
"71": {
|
|
799
739
|
start: {
|
|
800
|
-
line:
|
|
740
|
+
line: 197,
|
|
801
741
|
column: 8
|
|
802
742
|
},
|
|
803
743
|
end: {
|
|
804
|
-
line:
|
|
744
|
+
line: 197,
|
|
805
745
|
column: 23
|
|
806
746
|
}
|
|
807
747
|
}
|
|
@@ -1065,7 +1005,7 @@ function cov_ogldeftyv() {
|
|
|
1065
1005
|
column: 34
|
|
1066
1006
|
},
|
|
1067
1007
|
end: {
|
|
1068
|
-
line:
|
|
1008
|
+
line: 179,
|
|
1069
1009
|
column: 5
|
|
1070
1010
|
}
|
|
1071
1011
|
},
|
|
@@ -1089,7 +1029,7 @@ function cov_ogldeftyv() {
|
|
|
1089
1029
|
column: 56
|
|
1090
1030
|
},
|
|
1091
1031
|
end: {
|
|
1092
|
-
line:
|
|
1032
|
+
line: 176,
|
|
1093
1033
|
column: 9
|
|
1094
1034
|
}
|
|
1095
1035
|
},
|
|
@@ -1113,7 +1053,7 @@ function cov_ogldeftyv() {
|
|
|
1113
1053
|
column: 55
|
|
1114
1054
|
},
|
|
1115
1055
|
end: {
|
|
1116
|
-
line:
|
|
1056
|
+
line: 175,
|
|
1117
1057
|
column: 13
|
|
1118
1058
|
}
|
|
1119
1059
|
},
|
|
@@ -1123,169 +1063,145 @@ function cov_ogldeftyv() {
|
|
|
1123
1063
|
name: "(anonymous_13)",
|
|
1124
1064
|
decl: {
|
|
1125
1065
|
start: {
|
|
1126
|
-
line:
|
|
1127
|
-
column:
|
|
1066
|
+
line: 171,
|
|
1067
|
+
column: 62
|
|
1128
1068
|
},
|
|
1129
1069
|
end: {
|
|
1130
|
-
line:
|
|
1131
|
-
column:
|
|
1070
|
+
line: 171,
|
|
1071
|
+
column: 63
|
|
1132
1072
|
}
|
|
1133
1073
|
},
|
|
1134
1074
|
loc: {
|
|
1135
1075
|
start: {
|
|
1136
|
-
line:
|
|
1137
|
-
column:
|
|
1076
|
+
line: 171,
|
|
1077
|
+
column: 76
|
|
1138
1078
|
},
|
|
1139
1079
|
end: {
|
|
1140
|
-
line:
|
|
1141
|
-
column:
|
|
1080
|
+
line: 171,
|
|
1081
|
+
column: 122
|
|
1142
1082
|
}
|
|
1143
1083
|
},
|
|
1144
|
-
line:
|
|
1084
|
+
line: 171
|
|
1145
1085
|
},
|
|
1146
1086
|
"14": {
|
|
1147
1087
|
name: "(anonymous_14)",
|
|
1148
1088
|
decl: {
|
|
1149
1089
|
start: {
|
|
1150
|
-
line:
|
|
1151
|
-
column: 53
|
|
1152
|
-
},
|
|
1153
|
-
end: {
|
|
1154
|
-
line: 179,
|
|
1155
|
-
column: 54
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
|
-
loc: {
|
|
1159
|
-
start: {
|
|
1160
|
-
line: 179,
|
|
1161
|
-
column: 69
|
|
1162
|
-
},
|
|
1163
|
-
end: {
|
|
1164
|
-
line: 179,
|
|
1165
|
-
column: 100
|
|
1166
|
-
}
|
|
1167
|
-
},
|
|
1168
|
-
line: 179
|
|
1169
|
-
},
|
|
1170
|
-
"15": {
|
|
1171
|
-
name: "(anonymous_15)",
|
|
1172
|
-
decl: {
|
|
1173
|
-
start: {
|
|
1174
|
-
line: 195,
|
|
1090
|
+
line: 181,
|
|
1175
1091
|
column: 4
|
|
1176
1092
|
},
|
|
1177
1093
|
end: {
|
|
1178
|
-
line:
|
|
1094
|
+
line: 181,
|
|
1179
1095
|
column: 5
|
|
1180
1096
|
}
|
|
1181
1097
|
},
|
|
1182
1098
|
loc: {
|
|
1183
1099
|
start: {
|
|
1184
|
-
line:
|
|
1100
|
+
line: 181,
|
|
1185
1101
|
column: 30
|
|
1186
1102
|
},
|
|
1187
1103
|
end: {
|
|
1188
|
-
line:
|
|
1104
|
+
line: 183,
|
|
1189
1105
|
column: 5
|
|
1190
1106
|
}
|
|
1191
1107
|
},
|
|
1192
|
-
line:
|
|
1108
|
+
line: 181
|
|
1193
1109
|
},
|
|
1194
|
-
"
|
|
1195
|
-
name: "(
|
|
1110
|
+
"15": {
|
|
1111
|
+
name: "(anonymous_15)",
|
|
1196
1112
|
decl: {
|
|
1197
1113
|
start: {
|
|
1198
|
-
line:
|
|
1114
|
+
line: 188,
|
|
1199
1115
|
column: 4
|
|
1200
1116
|
},
|
|
1201
1117
|
end: {
|
|
1202
|
-
line:
|
|
1118
|
+
line: 188,
|
|
1203
1119
|
column: 5
|
|
1204
1120
|
}
|
|
1205
1121
|
},
|
|
1206
1122
|
loc: {
|
|
1207
1123
|
start: {
|
|
1208
|
-
line:
|
|
1124
|
+
line: 188,
|
|
1209
1125
|
column: 14
|
|
1210
1126
|
},
|
|
1211
1127
|
end: {
|
|
1212
|
-
line:
|
|
1128
|
+
line: 188,
|
|
1213
1129
|
column: 85
|
|
1214
1130
|
}
|
|
1215
1131
|
},
|
|
1216
|
-
line:
|
|
1132
|
+
line: 188
|
|
1217
1133
|
},
|
|
1218
|
-
"
|
|
1219
|
-
name: "(
|
|
1134
|
+
"16": {
|
|
1135
|
+
name: "(anonymous_16)",
|
|
1220
1136
|
decl: {
|
|
1221
1137
|
start: {
|
|
1222
|
-
line:
|
|
1138
|
+
line: 189,
|
|
1223
1139
|
column: 4
|
|
1224
1140
|
},
|
|
1225
1141
|
end: {
|
|
1226
|
-
line:
|
|
1142
|
+
line: 189,
|
|
1227
1143
|
column: 5
|
|
1228
1144
|
}
|
|
1229
1145
|
},
|
|
1230
1146
|
loc: {
|
|
1231
1147
|
start: {
|
|
1232
|
-
line:
|
|
1148
|
+
line: 189,
|
|
1233
1149
|
column: 15
|
|
1234
1150
|
},
|
|
1235
1151
|
end: {
|
|
1236
|
-
line:
|
|
1152
|
+
line: 189,
|
|
1237
1153
|
column: 89
|
|
1238
1154
|
}
|
|
1239
1155
|
},
|
|
1240
|
-
line:
|
|
1156
|
+
line: 189
|
|
1241
1157
|
},
|
|
1242
|
-
"
|
|
1243
|
-
name: "(
|
|
1158
|
+
"17": {
|
|
1159
|
+
name: "(anonymous_17)",
|
|
1244
1160
|
decl: {
|
|
1245
1161
|
start: {
|
|
1246
|
-
line:
|
|
1162
|
+
line: 190,
|
|
1247
1163
|
column: 4
|
|
1248
1164
|
},
|
|
1249
1165
|
end: {
|
|
1250
|
-
line:
|
|
1166
|
+
line: 190,
|
|
1251
1167
|
column: 5
|
|
1252
1168
|
}
|
|
1253
1169
|
},
|
|
1254
1170
|
loc: {
|
|
1255
1171
|
start: {
|
|
1256
|
-
line:
|
|
1172
|
+
line: 190,
|
|
1257
1173
|
column: 16
|
|
1258
1174
|
},
|
|
1259
1175
|
end: {
|
|
1260
|
-
line:
|
|
1176
|
+
line: 190,
|
|
1261
1177
|
column: 88
|
|
1262
1178
|
}
|
|
1263
1179
|
},
|
|
1264
|
-
line:
|
|
1180
|
+
line: 190
|
|
1265
1181
|
},
|
|
1266
|
-
"
|
|
1267
|
-
name: "(
|
|
1182
|
+
"18": {
|
|
1183
|
+
name: "(anonymous_18)",
|
|
1268
1184
|
decl: {
|
|
1269
1185
|
start: {
|
|
1270
|
-
line:
|
|
1186
|
+
line: 191,
|
|
1271
1187
|
column: 4
|
|
1272
1188
|
},
|
|
1273
1189
|
end: {
|
|
1274
|
-
line:
|
|
1190
|
+
line: 191,
|
|
1275
1191
|
column: 5
|
|
1276
1192
|
}
|
|
1277
1193
|
},
|
|
1278
1194
|
loc: {
|
|
1279
1195
|
start: {
|
|
1280
|
-
line:
|
|
1196
|
+
line: 191,
|
|
1281
1197
|
column: 27
|
|
1282
1198
|
},
|
|
1283
1199
|
end: {
|
|
1284
|
-
line:
|
|
1200
|
+
line: 198,
|
|
1285
1201
|
column: 5
|
|
1286
1202
|
}
|
|
1287
1203
|
},
|
|
1288
|
-
line:
|
|
1204
|
+
line: 191
|
|
1289
1205
|
}
|
|
1290
1206
|
},
|
|
1291
1207
|
branchMap: {
|
|
@@ -1895,55 +1811,22 @@ function cov_ogldeftyv() {
|
|
|
1895
1811
|
"18": {
|
|
1896
1812
|
loc: {
|
|
1897
1813
|
start: {
|
|
1898
|
-
line:
|
|
1899
|
-
column: 24
|
|
1900
|
-
},
|
|
1901
|
-
end: {
|
|
1902
|
-
line: 179,
|
|
1903
|
-
column: 102
|
|
1904
|
-
}
|
|
1905
|
-
},
|
|
1906
|
-
type: "if",
|
|
1907
|
-
locations: [{
|
|
1908
|
-
start: {
|
|
1909
|
-
line: 178,
|
|
1910
|
-
column: 24
|
|
1911
|
-
},
|
|
1912
|
-
end: {
|
|
1913
|
-
line: 179,
|
|
1914
|
-
column: 102
|
|
1915
|
-
}
|
|
1916
|
-
}, {
|
|
1917
|
-
start: {
|
|
1918
|
-
line: undefined,
|
|
1919
|
-
column: undefined
|
|
1920
|
-
},
|
|
1921
|
-
end: {
|
|
1922
|
-
line: undefined,
|
|
1923
|
-
column: undefined
|
|
1924
|
-
}
|
|
1925
|
-
}],
|
|
1926
|
-
line: 178
|
|
1927
|
-
},
|
|
1928
|
-
"19": {
|
|
1929
|
-
loc: {
|
|
1930
|
-
start: {
|
|
1931
|
-
line: 186,
|
|
1814
|
+
line: 172,
|
|
1932
1815
|
column: 16
|
|
1933
1816
|
},
|
|
1934
1817
|
end: {
|
|
1935
|
-
line:
|
|
1818
|
+
line: 173,
|
|
1936
1819
|
column: 113
|
|
1937
1820
|
}
|
|
1938
1821
|
},
|
|
1939
1822
|
type: "if",
|
|
1940
1823
|
locations: [{
|
|
1941
1824
|
start: {
|
|
1942
|
-
line:
|
|
1825
|
+
line: 172,
|
|
1943
1826
|
column: 16
|
|
1944
1827
|
},
|
|
1945
1828
|
end: {
|
|
1946
|
-
line:
|
|
1829
|
+
line: 173,
|
|
1947
1830
|
column: 113
|
|
1948
1831
|
}
|
|
1949
1832
|
}, {
|
|
@@ -1956,27 +1839,27 @@ function cov_ogldeftyv() {
|
|
|
1956
1839
|
column: undefined
|
|
1957
1840
|
}
|
|
1958
1841
|
}],
|
|
1959
|
-
line:
|
|
1842
|
+
line: 172
|
|
1960
1843
|
},
|
|
1961
|
-
"
|
|
1844
|
+
"19": {
|
|
1962
1845
|
loc: {
|
|
1963
1846
|
start: {
|
|
1964
|
-
line:
|
|
1847
|
+
line: 194,
|
|
1965
1848
|
column: 12
|
|
1966
1849
|
},
|
|
1967
1850
|
end: {
|
|
1968
|
-
line:
|
|
1851
|
+
line: 195,
|
|
1969
1852
|
column: 44
|
|
1970
1853
|
}
|
|
1971
1854
|
},
|
|
1972
1855
|
type: "if",
|
|
1973
1856
|
locations: [{
|
|
1974
1857
|
start: {
|
|
1975
|
-
line:
|
|
1858
|
+
line: 194,
|
|
1976
1859
|
column: 12
|
|
1977
1860
|
},
|
|
1978
1861
|
end: {
|
|
1979
|
-
line:
|
|
1862
|
+
line: 195,
|
|
1980
1863
|
column: 44
|
|
1981
1864
|
}
|
|
1982
1865
|
}, {
|
|
@@ -1989,7 +1872,7 @@ function cov_ogldeftyv() {
|
|
|
1989
1872
|
column: undefined
|
|
1990
1873
|
}
|
|
1991
1874
|
}],
|
|
1992
|
-
line:
|
|
1875
|
+
line: 194
|
|
1993
1876
|
}
|
|
1994
1877
|
},
|
|
1995
1878
|
s: {
|
|
@@ -2064,13 +1947,7 @@ function cov_ogldeftyv() {
|
|
|
2064
1947
|
"68": 0,
|
|
2065
1948
|
"69": 0,
|
|
2066
1949
|
"70": 0,
|
|
2067
|
-
"71": 0
|
|
2068
|
-
"72": 0,
|
|
2069
|
-
"73": 0,
|
|
2070
|
-
"74": 0,
|
|
2071
|
-
"75": 0,
|
|
2072
|
-
"76": 0,
|
|
2073
|
-
"77": 0
|
|
1950
|
+
"71": 0
|
|
2074
1951
|
},
|
|
2075
1952
|
f: {
|
|
2076
1953
|
"0": 0,
|
|
@@ -2091,8 +1968,7 @@ function cov_ogldeftyv() {
|
|
|
2091
1968
|
"15": 0,
|
|
2092
1969
|
"16": 0,
|
|
2093
1970
|
"17": 0,
|
|
2094
|
-
"18": 0
|
|
2095
|
-
"19": 0
|
|
1971
|
+
"18": 0
|
|
2096
1972
|
},
|
|
2097
1973
|
b: {
|
|
2098
1974
|
"0": [0, 0, 0],
|
|
@@ -2114,19 +1990,18 @@ function cov_ogldeftyv() {
|
|
|
2114
1990
|
"16": [0, 0],
|
|
2115
1991
|
"17": [0, 0],
|
|
2116
1992
|
"18": [0, 0],
|
|
2117
|
-
"19": [0, 0]
|
|
2118
|
-
"20": [0, 0]
|
|
1993
|
+
"19": [0, 0]
|
|
2119
1994
|
},
|
|
2120
1995
|
inputSourceMap: {
|
|
2121
1996
|
version: 3,
|
|
2122
1997
|
file: "ITwinLocalization.js",
|
|
2123
1998
|
sources: ["C:\\agent\\_work\\1\\s\\core\\i18n\\src\\ITwinLocalization.ts"],
|
|
2124
1999
|
names: [],
|
|
2125
|
-
mappings: ";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,sDAA2E;AAC3E,wGAAmG;AACnG,gFAAqF;AACrF,sDAA6C;AAG7C,MAAM,mBAAmB,GAAW,CAAC,CAAC,CAAC,8GAA8G;AAcrJ;;;GAGG;AACH,MAAa,iBAAiB;IACrB,OAAO,CAAO;IACJ,YAAY,CAAc;IAC1B,eAAe,CAAiB;IAChC,iBAAiB,CAAkB;IACnC,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEhE,YAAmB,OAA6B;QAC9C,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC,cAAc,EAAE,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG;YACrB,QAAQ,EAAE,OAAO,EAAE,WAAW,IAAI,6BAA6B;YAC/D,WAAW,EAAE,IAAI;YACjB,GAAG,OAAO,EAAE,kBAAkB;SAC/B,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG;YACvB,KAAK,EAAE,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,CAAC;YAC9C,iBAAiB,EAAE,KAAK;YACxB,MAAM,EAAE,E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AAG,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,OAAO,GAAG,KAAK,QAAQ;YACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAElD,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,IAAY;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB;IACT,eAAe;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAChC,CAAC;IAED,qDAAqD;IAC9C,KAAK,CAAC,cAAc,CAAC,QAAgB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAA6B,CAAC;IAC3E,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,iBAAiB,CAAC,IAAY;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,QAAQ,CAAC;QAElB,MAAM,cAAc,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnD,mEAAmE;YACnE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;gBACxC,IAAI,CAAC,GAAG;oBACN,OAAO,OAAO,EAAE,CAAC;gBAEnB,
|
|
2126
|
-
sourcesContent: ["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Localization\r\n */\r\n\r\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\r\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\r\nimport Backend, { HttpBackendOptions as BackendOptions } from \"i18next-http-backend\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport type { Localization } from \"@itwin/core-common\";\r\n\r\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\r\n\r\n/** Options for ITwinLocalization\r\n * @public\r\n */\r\nexport interface LocalizationOptions {\r\n urlTemplate?: string;\r\n backendPlugin?: Module;\r\n detectorPlugin?: Module;\r\n initOptions?: InitOptions;\r\n backendHttpOptions?: BackendOptions;\r\n detectorOptions?: DetectorOptions;\r\n}\r\n\r\n/** Supplies localizations for iTwin.js\r\n * @note this class uses the [i18next](https://www.i18next.com/) package.\r\n * @public\r\n */\r\nexport class ITwinLocalization implements Localization {\r\n public i18next: i18n;\r\n private readonly _initOptions: InitOptions;\r\n private readonly _backendOptions: BackendOptions;\r\n private readonly _detectionOptions: DetectorOptions;\r\n private readonly _namespaces = new Map<string, Promise<void>>();\r\n\r\n public constructor(options?: LocalizationOptions) {\r\n this.i18next = i18next.createInstance();\r\n\r\n this._backendOptions = {\r\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\r\n crossDomain: true,\r\n ...options?.backendHttpOptions,\r\n };\r\n\r\n this._detectionOptions = {\r\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\r\n lookupQuerystring: \"lng\",\r\n caches: [],\r\n ...options?.detectorOptions,\r\n };\r\n\r\n this._initOptions = {\r\n interpolation: { escapeValue: true },\r\n fallbackLng: \"en\",\r\n maxRetries: DEFAULT_MAX_RETRIES,\r\n backend: this._backendOptions,\r\n detection: this._detectionOptions,\r\n ...options?.initOptions,\r\n };\r\n\r\n this.i18next\r\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\r\n .use(options?.backendPlugin ?? Backend)\r\n .use(TranslationLogger);\r\n }\r\n\r\n public async initialize(namespaces: string[]): Promise<void> {\r\n\r\n // Also consider namespaces passed into constructor\r\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\r\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\r\n\r\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\r\n if (defaultNamespace)\r\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\r\n\r\n const initOptions: InitOptions = {\r\n ...this._initOptions,\r\n defaultNS: defaultNamespace,\r\n ns: [...combinedNamespaces],\r\n };\r\n\r\n // if in a development environment, set debugging\r\n if (process.env.NODE_ENV === \"development\")\r\n initOptions.debug = true;\r\n\r\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\r\n\r\n for (const ns of namespaces)\r\n this._namespaces.set(ns, initPromise);\r\n\r\n return initPromise;\r\n }\r\n\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n * @param line The input line, potentially containing %{keys}.\r\n * @returns The line with all %{keys} translated\r\n * @public\r\n */\r\n public getLocalizedKeys(line: string): string {\r\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\r\n }\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @public\r\n */\r\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const value = this.i18next.t(key, options);\r\n\r\n if (typeof value !== \"string\") {\r\n throw new Error(\"Translation key(s) string not found\");\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /** Gets the English translation.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n options = {\r\n ...options,\r\n ns: namespace, // ensure namespace argument is used\r\n };\r\n\r\n const en = this.i18next.getFixedT(\"en\", namespace);\r\n const str = en(key, options);\r\n if (typeof str !== \"string\")\r\n throw new Error(\"Translation key(s) not found\");\r\n\r\n return str;\r\n }\r\n\r\n /** Get the promise for an already registered Namespace.\r\n * @param name - the name of the namespace\r\n * @public\r\n */\r\n public getNamespacePromise(name: string): Promise<void> | undefined {\r\n return this._namespaces.get(name);\r\n }\r\n\r\n /** @internal */\r\n public getLanguageList(): readonly string[] {\r\n return this.i18next.languages;\r\n }\r\n\r\n /** override the language detected in the browser */\r\n public async changeLanguage(language: string) {\r\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\r\n }\r\n\r\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\r\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n * @public\r\n */\r\n public async registerNamespace(name: string): Promise<void> {\r\n const existing = this._namespaces.get(name);\r\n if (existing !== undefined)\r\n return existing;\r\n\r\n const theReadPromise = new Promise<void>((resolve) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.i18next.loadNamespaces(name, (err) => {\r\n if (!err)\r\n return resolve();\r\n\r\n // Here we got a non-null err object.\r\n // This method is called when the system has attempted to load the resources for the namespaces for each possible locale.\r\n // For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.\r\n // Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.\r\n // There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.\r\n let locales = this.getLanguageList().map((thisLocale: any) => `/${thisLocale}/`);\r\n\r\n try {\r\n for (const thisError of err) {\r\n if (typeof thisError === \"string\")\r\n locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));\r\n }\r\n } catch {\r\n locales = [];\r\n }\r\n // if we removed every locale from the array, it wasn't loaded.\r\n if (locales.length === 0)\r\n Logger.logError(\"i18n\", `No resources for namespace ${name} could be loaded`);\r\n\r\n resolve();\r\n });\r\n });\r\n this._namespaces.set(name, theReadPromise);\r\n return theReadPromise;\r\n }\r\n\r\n /** @internal */\r\n public unregisterNamespace(name: string): void {\r\n this._namespaces.delete(name);\r\n }\r\n}\r\n\r\nclass TranslationLogger {\r\n public static readonly type = \"logger\";\r\n public log(args: string[]) { Logger.logInfo(\"i18n\", this.createLogMessage(args)); }\r\n public warn(args: string[]) { Logger.logWarning(\"i18n\", this.createLogMessage(args)); }\r\n public error(args: string[]) { Logger.logError(\"i18n\", this.createLogMessage(args)); }\r\n private createLogMessage(args: string[]) {\r\n let message = args[0];\r\n for (let i = 1; i < args.length; ++i) {\r\n if (typeof args[i] === \"string\")\r\n message += `\\n ${args[i]}`;\r\n }\r\n return message;\r\n }\r\n}\r\n"]
|
|
2000
|
+
mappings: ";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,sDAA2E;AAC3E,wGAAmG;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IAAc,IAAI,qBAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,gBAAgB,CAAC,IAAc;QACrC,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACrC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;gBAC7B,OAAO,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC",
|
|
2001
|
+
sourcesContent: ["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Localization\r\n */\r\n\r\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\r\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\r\nimport Backend, { HttpBackendOptions as BackendOptions } from \"i18next-http-backend\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport type { Localization } from \"@itwin/core-common\";\r\n\r\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\r\n\r\n/** Options for ITwinLocalization\r\n * @public\r\n */\r\nexport interface LocalizationOptions {\r\n urlTemplate?: string;\r\n backendPlugin?: Module;\r\n detectorPlugin?: Module;\r\n initOptions?: InitOptions;\r\n backendHttpOptions?: BackendOptions;\r\n detectorOptions?: DetectorOptions;\r\n}\r\n\r\n/** Supplies localizations for iTwin.js\r\n * @note this class uses the [i18next](https://www.i18next.com/) package.\r\n * @public\r\n */\r\nexport class ITwinLocalization implements Localization {\r\n public i18next: i18n;\r\n private readonly _initOptions: InitOptions;\r\n private readonly _backendOptions: BackendOptions;\r\n private readonly _detectionOptions: DetectorOptions;\r\n private readonly _namespaces = new Map<string, Promise<void>>();\r\n\r\n public constructor(options?: LocalizationOptions) {\r\n this.i18next = i18next.createInstance();\r\n\r\n this._backendOptions = {\r\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\r\n crossDomain: true,\r\n ...options?.backendHttpOptions,\r\n };\r\n\r\n this._detectionOptions = {\r\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\r\n lookupQuerystring: \"lng\",\r\n caches: [],\r\n ...options?.detectorOptions,\r\n };\r\n\r\n this._initOptions = {\r\n interpolation: { escapeValue: true },\r\n fallbackLng: \"en\",\r\n maxRetries: DEFAULT_MAX_RETRIES,\r\n backend: this._backendOptions,\r\n detection: this._detectionOptions,\r\n ...options?.initOptions,\r\n };\r\n\r\n this.i18next\r\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\r\n .use(options?.backendPlugin ?? Backend)\r\n .use(TranslationLogger);\r\n }\r\n\r\n public async initialize(namespaces: string[]): Promise<void> {\r\n\r\n // Also consider namespaces passed into constructor\r\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\r\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\r\n\r\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\r\n if (defaultNamespace)\r\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\r\n\r\n const initOptions: InitOptions = {\r\n ...this._initOptions,\r\n defaultNS: defaultNamespace,\r\n ns: [...combinedNamespaces],\r\n };\r\n\r\n // if in a development environment, set debugging\r\n if (process.env.NODE_ENV === \"development\")\r\n initOptions.debug = true;\r\n\r\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\r\n\r\n for (const ns of namespaces)\r\n this._namespaces.set(ns, initPromise);\r\n\r\n return initPromise;\r\n }\r\n\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n * @param line The input line, potentially containing %{keys}.\r\n * @returns The line with all %{keys} translated\r\n * @public\r\n */\r\n public getLocalizedKeys(line: string): string {\r\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\r\n }\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @public\r\n */\r\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const value = this.i18next.t(key, options);\r\n\r\n if (typeof value !== \"string\") {\r\n throw new Error(\"Translation key(s) string not found\");\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /** Gets the English translation.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n options = {\r\n ...options,\r\n ns: namespace, // ensure namespace argument is used\r\n };\r\n\r\n const en = this.i18next.getFixedT(\"en\", namespace);\r\n const str = en(key, options);\r\n if (typeof str !== \"string\")\r\n throw new Error(\"Translation key(s) not found\");\r\n\r\n return str;\r\n }\r\n\r\n /** Get the promise for an already registered Namespace.\r\n * @param name - the name of the namespace\r\n * @public\r\n */\r\n public getNamespacePromise(name: string): Promise<void> | undefined {\r\n return this._namespaces.get(name);\r\n }\r\n\r\n /** @internal */\r\n public getLanguageList(): readonly string[] {\r\n return this.i18next.languages;\r\n }\r\n\r\n /** override the language detected in the browser */\r\n public async changeLanguage(language: string) {\r\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\r\n }\r\n\r\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\r\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n * @public\r\n */\r\n public async registerNamespace(name: string): Promise<void> {\r\n const existing = this._namespaces.get(name);\r\n if (existing !== undefined)\r\n return existing;\r\n\r\n const theReadPromise = new Promise<void>((resolve) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.i18next.loadNamespaces(name, (err) => {\r\n if (!err)\r\n return resolve();\r\n\r\n // i18next can return errors from other concurrent namespace loads in this callback.\r\n const wasLoaded = this.getLanguageList().some((language) => this.i18next.hasResourceBundle(language, name));\r\n if (!wasLoaded)\r\n Logger.logError(\"i18n\", `No resources for namespace ${name} could be loaded`);\r\n\r\n resolve();\r\n });\r\n });\r\n this._namespaces.set(name, theReadPromise);\r\n return theReadPromise;\r\n }\r\n\r\n /** @internal */\r\n public unregisterNamespace(name: string): void {\r\n this._namespaces.delete(name);\r\n }\r\n}\r\n\r\nclass TranslationLogger {\r\n public static readonly type = \"logger\";\r\n public log(args: string[]) { Logger.logInfo(\"i18n\", this.createLogMessage(args)); }\r\n public warn(args: string[]) { Logger.logWarning(\"i18n\", this.createLogMessage(args)); }\r\n public error(args: string[]) { Logger.logError(\"i18n\", this.createLogMessage(args)); }\r\n private createLogMessage(args: string[]) {\r\n let message = args[0];\r\n for (let i = 1; i < args.length; ++i) {\r\n if (typeof args[i] === \"string\")\r\n message += `\\n ${args[i]}`;\r\n }\r\n return message;\r\n }\r\n}\r\n"]
|
|
2127
2002
|
},
|
|
2128
2003
|
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
|
|
2129
|
-
hash: "
|
|
2004
|
+
hash: "8de28e753813d64322bcaeb99c8c8dfad2c2faad"
|
|
2130
2005
|
};
|
|
2131
2006
|
var coverage = global[gcv] || (global[gcv] = {});
|
|
2132
2007
|
if (!coverage[path] || coverage[path].hash !== hash) {
|
|
@@ -2384,96 +2259,70 @@ class ITwinLocalization {
|
|
|
2384
2259
|
} else {
|
|
2385
2260
|
cov_ogldeftyv().b[17][1]++;
|
|
2386
2261
|
}
|
|
2387
|
-
//
|
|
2388
|
-
|
|
2389
|
-
// For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.
|
|
2390
|
-
// Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.
|
|
2391
|
-
// There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.
|
|
2392
|
-
let locales = (cov_ogldeftyv().s[53]++, this.getLanguageList().map(thisLocale => {
|
|
2262
|
+
// i18next can return errors from other concurrent namespace loads in this callback.
|
|
2263
|
+
const wasLoaded = (cov_ogldeftyv().s[53]++, this.getLanguageList().some(language => {
|
|
2393
2264
|
cov_ogldeftyv().f[13]++;
|
|
2394
2265
|
cov_ogldeftyv().s[54]++;
|
|
2395
|
-
return
|
|
2266
|
+
return this.i18next.hasResourceBundle(language, name);
|
|
2396
2267
|
}));
|
|
2397
2268
|
cov_ogldeftyv().s[55]++;
|
|
2398
|
-
|
|
2269
|
+
if (!wasLoaded) {
|
|
2270
|
+
cov_ogldeftyv().b[18][0]++;
|
|
2399
2271
|
cov_ogldeftyv().s[56]++;
|
|
2400
|
-
for (const thisError of err) {
|
|
2401
|
-
cov_ogldeftyv().s[57]++;
|
|
2402
|
-
if (typeof thisError === "string") {
|
|
2403
|
-
cov_ogldeftyv().b[18][0]++;
|
|
2404
|
-
cov_ogldeftyv().s[58]++;
|
|
2405
|
-
locales = locales.filter(thisLocale => {
|
|
2406
|
-
cov_ogldeftyv().f[14]++;
|
|
2407
|
-
cov_ogldeftyv().s[59]++;
|
|
2408
|
-
return !thisError.includes(thisLocale);
|
|
2409
|
-
});
|
|
2410
|
-
} else {
|
|
2411
|
-
cov_ogldeftyv().b[18][1]++;
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
} catch {
|
|
2415
|
-
cov_ogldeftyv().s[60]++;
|
|
2416
|
-
locales = [];
|
|
2417
|
-
}
|
|
2418
|
-
// if we removed every locale from the array, it wasn't loaded.
|
|
2419
|
-
cov_ogldeftyv().s[61]++;
|
|
2420
|
-
if (locales.length === 0) {
|
|
2421
|
-
cov_ogldeftyv().b[19][0]++;
|
|
2422
|
-
cov_ogldeftyv().s[62]++;
|
|
2423
2272
|
core_bentley_1.Logger.logError("i18n", `No resources for namespace ${name} could be loaded`);
|
|
2424
2273
|
} else {
|
|
2425
|
-
cov_ogldeftyv().b[
|
|
2274
|
+
cov_ogldeftyv().b[18][1]++;
|
|
2426
2275
|
}
|
|
2427
|
-
cov_ogldeftyv().s[
|
|
2276
|
+
cov_ogldeftyv().s[57]++;
|
|
2428
2277
|
resolve();
|
|
2429
2278
|
});
|
|
2430
2279
|
}));
|
|
2431
|
-
cov_ogldeftyv().s[
|
|
2280
|
+
cov_ogldeftyv().s[58]++;
|
|
2432
2281
|
this._namespaces.set(name, theReadPromise);
|
|
2433
|
-
cov_ogldeftyv().s[
|
|
2282
|
+
cov_ogldeftyv().s[59]++;
|
|
2434
2283
|
return theReadPromise;
|
|
2435
2284
|
}
|
|
2436
2285
|
/** @internal */
|
|
2437
2286
|
unregisterNamespace(name) {
|
|
2438
|
-
cov_ogldeftyv().f[
|
|
2439
|
-
cov_ogldeftyv().s[
|
|
2287
|
+
cov_ogldeftyv().f[14]++;
|
|
2288
|
+
cov_ogldeftyv().s[60]++;
|
|
2440
2289
|
this._namespaces.delete(name);
|
|
2441
2290
|
}
|
|
2442
2291
|
}
|
|
2443
|
-
cov_ogldeftyv().s[
|
|
2292
|
+
cov_ogldeftyv().s[61]++;
|
|
2444
2293
|
exports.ITwinLocalization = ITwinLocalization;
|
|
2445
2294
|
class TranslationLogger {
|
|
2446
|
-
static type = (cov_ogldeftyv().s[
|
|
2295
|
+
static type = (cov_ogldeftyv().s[62]++, "logger");
|
|
2447
2296
|
log(args) {
|
|
2448
|
-
cov_ogldeftyv().f[
|
|
2449
|
-
cov_ogldeftyv().s[
|
|
2297
|
+
cov_ogldeftyv().f[15]++;
|
|
2298
|
+
cov_ogldeftyv().s[63]++;
|
|
2450
2299
|
core_bentley_1.Logger.logInfo("i18n", this.createLogMessage(args));
|
|
2451
2300
|
}
|
|
2452
2301
|
warn(args) {
|
|
2453
|
-
cov_ogldeftyv().f[
|
|
2454
|
-
cov_ogldeftyv().s[
|
|
2302
|
+
cov_ogldeftyv().f[16]++;
|
|
2303
|
+
cov_ogldeftyv().s[64]++;
|
|
2455
2304
|
core_bentley_1.Logger.logWarning("i18n", this.createLogMessage(args));
|
|
2456
2305
|
}
|
|
2457
2306
|
error(args) {
|
|
2458
|
-
cov_ogldeftyv().f[
|
|
2459
|
-
cov_ogldeftyv().s[
|
|
2307
|
+
cov_ogldeftyv().f[17]++;
|
|
2308
|
+
cov_ogldeftyv().s[65]++;
|
|
2460
2309
|
core_bentley_1.Logger.logError("i18n", this.createLogMessage(args));
|
|
2461
2310
|
}
|
|
2462
2311
|
createLogMessage(args) {
|
|
2463
|
-
cov_ogldeftyv().f[
|
|
2464
|
-
let message = (cov_ogldeftyv().s[
|
|
2465
|
-
cov_ogldeftyv().s[
|
|
2466
|
-
for (let i = (cov_ogldeftyv().s[
|
|
2467
|
-
cov_ogldeftyv().s[
|
|
2312
|
+
cov_ogldeftyv().f[18]++;
|
|
2313
|
+
let message = (cov_ogldeftyv().s[66]++, args[0]);
|
|
2314
|
+
cov_ogldeftyv().s[67]++;
|
|
2315
|
+
for (let i = (cov_ogldeftyv().s[68]++, 1); i < args.length; ++i) {
|
|
2316
|
+
cov_ogldeftyv().s[69]++;
|
|
2468
2317
|
if (typeof args[i] === "string") {
|
|
2469
|
-
cov_ogldeftyv().b[
|
|
2470
|
-
cov_ogldeftyv().s[
|
|
2318
|
+
cov_ogldeftyv().b[19][0]++;
|
|
2319
|
+
cov_ogldeftyv().s[70]++;
|
|
2471
2320
|
message += `\n ${args[i]}`;
|
|
2472
2321
|
} else {
|
|
2473
|
-
cov_ogldeftyv().b[
|
|
2322
|
+
cov_ogldeftyv().b[19][1]++;
|
|
2474
2323
|
}
|
|
2475
2324
|
}
|
|
2476
|
-
cov_ogldeftyv().s[
|
|
2325
|
+
cov_ogldeftyv().s[71]++;
|
|
2477
2326
|
return message;
|
|
2478
2327
|
}
|
|
2479
2328
|
}
|
|
@@ -21685,6 +21534,122 @@ class PerfLogger {
|
|
|
21685
21534
|
}
|
|
21686
21535
|
|
|
21687
21536
|
|
|
21537
|
+
/***/ },
|
|
21538
|
+
|
|
21539
|
+
/***/ "../bentley/lib/esm/ObservableMap.js"
|
|
21540
|
+
/*!*******************************************!*\
|
|
21541
|
+
!*** ../bentley/lib/esm/ObservableMap.js ***!
|
|
21542
|
+
\*******************************************/
|
|
21543
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
21544
|
+
|
|
21545
|
+
"use strict";
|
|
21546
|
+
__webpack_require__.r(__webpack_exports__);
|
|
21547
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21548
|
+
/* harmony export */ ObservableMap: () => (/* binding */ ObservableMap)
|
|
21549
|
+
/* harmony export */ });
|
|
21550
|
+
/* harmony import */ var _BeEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BeEvent */ "../bentley/lib/esm/BeEvent.js");
|
|
21551
|
+
/*---------------------------------------------------------------------------------------------
|
|
21552
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
21553
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
21554
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21555
|
+
/** @packageDocumentation
|
|
21556
|
+
* @module Collections
|
|
21557
|
+
*/
|
|
21558
|
+
|
|
21559
|
+
/** A standard [Map<K,V>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) that emits an event when its contents change.
|
|
21560
|
+
* @public
|
|
21561
|
+
*/
|
|
21562
|
+
class ObservableMap extends Map {
|
|
21563
|
+
/** @internal */
|
|
21564
|
+
get [Symbol.toStringTag]() { return "ObservableMap"; }
|
|
21565
|
+
/** Emitted after any change to the contents of this map. */
|
|
21566
|
+
onChanged = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21567
|
+
/** Construct a new ObservableMap.
|
|
21568
|
+
* @param elements Optional elements with which to populate the new map.
|
|
21569
|
+
*/
|
|
21570
|
+
constructor(elements) {
|
|
21571
|
+
// IMPORTANT: do not pass `elements` to `super()`. It will invoke `set` which is overridden to invoke `onChanged.raiseEvent`, but
|
|
21572
|
+
// `onChanged` is not initialized until `super()` returns.
|
|
21573
|
+
super();
|
|
21574
|
+
if (elements)
|
|
21575
|
+
this.setAll(elements);
|
|
21576
|
+
}
|
|
21577
|
+
/** Invokes [Map.set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set), raising
|
|
21578
|
+
* the [[onChanged]] event unless `key` is already present with the same `value`.
|
|
21579
|
+
*/
|
|
21580
|
+
set(key, value) {
|
|
21581
|
+
const valueChanged = !this.has(key) || !Object.is(this.get(key), value);
|
|
21582
|
+
if (valueChanged)
|
|
21583
|
+
super.set(key, value);
|
|
21584
|
+
if (valueChanged) {
|
|
21585
|
+
this.onChanged.raiseEvent();
|
|
21586
|
+
}
|
|
21587
|
+
return this;
|
|
21588
|
+
}
|
|
21589
|
+
/** Invokes [Map.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete), raising
|
|
21590
|
+
* the [[onChanged]] event if the key was removed from the map.
|
|
21591
|
+
*/
|
|
21592
|
+
delete(key) {
|
|
21593
|
+
const ret = super.delete(key);
|
|
21594
|
+
if (ret) {
|
|
21595
|
+
this.onChanged.raiseEvent();
|
|
21596
|
+
}
|
|
21597
|
+
return ret;
|
|
21598
|
+
}
|
|
21599
|
+
/** If this map is not already empty, invokes [Map.clear](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear)
|
|
21600
|
+
* and raises the [[onChanged]] event.
|
|
21601
|
+
*/
|
|
21602
|
+
clear() {
|
|
21603
|
+
if (0 !== this.size) {
|
|
21604
|
+
super.clear();
|
|
21605
|
+
this.onChanged.raiseEvent();
|
|
21606
|
+
}
|
|
21607
|
+
}
|
|
21608
|
+
/** Add or update multiple entries in the map, raising [[onChanged]] only once after all items are set, if the contents of
|
|
21609
|
+
* the map changed as a result.
|
|
21610
|
+
* This is more efficient than calling [[set]] in a loop when listeners need not be notified of each individual change.
|
|
21611
|
+
* @param items The entries to add or update.
|
|
21612
|
+
*/
|
|
21613
|
+
setAll(items) {
|
|
21614
|
+
let changed = false;
|
|
21615
|
+
try {
|
|
21616
|
+
for (const [key, value] of items) {
|
|
21617
|
+
if (!this.has(key) || !Object.is(this.get(key), value)) {
|
|
21618
|
+
super.set(key, value);
|
|
21619
|
+
changed = true;
|
|
21620
|
+
}
|
|
21621
|
+
}
|
|
21622
|
+
}
|
|
21623
|
+
finally {
|
|
21624
|
+
if (changed) {
|
|
21625
|
+
this.onChanged.raiseEvent();
|
|
21626
|
+
}
|
|
21627
|
+
}
|
|
21628
|
+
}
|
|
21629
|
+
/** Delete multiple keys from the map, raising [[onChanged]] only once after all keys are deleted.
|
|
21630
|
+
* This is more efficient than calling [[delete]] in a loop when listeners need not be notified of each individual deletion.
|
|
21631
|
+
* @param keys The keys to delete.
|
|
21632
|
+
* @returns The number of keys that were actually deleted (i.e., were present in the map).
|
|
21633
|
+
*/
|
|
21634
|
+
deleteAll(keys) {
|
|
21635
|
+
const prevSize = this.size;
|
|
21636
|
+
let deletedAny = false;
|
|
21637
|
+
try {
|
|
21638
|
+
for (const key of keys) {
|
|
21639
|
+
if (super.delete(key))
|
|
21640
|
+
deletedAny = true;
|
|
21641
|
+
}
|
|
21642
|
+
}
|
|
21643
|
+
finally {
|
|
21644
|
+
if (deletedAny) {
|
|
21645
|
+
this.onChanged.raiseEvent();
|
|
21646
|
+
}
|
|
21647
|
+
}
|
|
21648
|
+
return prevSize - this.size;
|
|
21649
|
+
}
|
|
21650
|
+
}
|
|
21651
|
+
|
|
21652
|
+
|
|
21688
21653
|
/***/ },
|
|
21689
21654
|
|
|
21690
21655
|
/***/ "../bentley/lib/esm/ObservableSet.js"
|
|
@@ -21711,6 +21676,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21711
21676
|
* @public
|
|
21712
21677
|
*/
|
|
21713
21678
|
class ObservableSet extends Set {
|
|
21679
|
+
/** @internal */
|
|
21680
|
+
get [Symbol.toStringTag]() { return "ObservableSet"; }
|
|
21714
21681
|
/** Emitted after `item` is added to this set. */
|
|
21715
21682
|
onAdded = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21716
21683
|
/** Emitted after `item` is deleted from this set. */
|
|
@@ -21721,27 +21688,39 @@ class ObservableSet extends Set {
|
|
|
21721
21688
|
onBatchAdded = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21722
21689
|
/** Emitted after multiple items are deleted from this set via [[deleteAll]]. */
|
|
21723
21690
|
onBatchDeleted = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21691
|
+
/** Emitted after any change to the contents of this set. */
|
|
21692
|
+
onChanged = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21724
21693
|
/** Construct a new ObservableSet.
|
|
21725
21694
|
* @param elements Optional elements with which to populate the new set.
|
|
21726
21695
|
*/
|
|
21727
21696
|
constructor(elements) {
|
|
21728
|
-
//
|
|
21729
|
-
super(
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
|
|
21697
|
+
// IMPORTANT: do not pass `elements` to `super()`. It will invoke `add` which is overridden to invoke `onAdded.raiseEvent`, but
|
|
21698
|
+
// `onAdded` is not initialized until `super()` returns.
|
|
21699
|
+
super();
|
|
21700
|
+
if (elements)
|
|
21701
|
+
this.addAll(elements);
|
|
21702
|
+
}
|
|
21703
|
+
/** Invokes [Set.add](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/add), raising
|
|
21704
|
+
* the [[onAdded]] event if the item was not already present in the set.
|
|
21705
|
+
*/
|
|
21706
|
+
add(item) {
|
|
21707
|
+
const prevSize = this.size;
|
|
21708
|
+
const ret = super.add(item);
|
|
21709
|
+
if (this.size !== prevSize) {
|
|
21710
|
+
this.onAdded.raiseEvent(item);
|
|
21711
|
+
this.onChanged.raiseEvent();
|
|
21712
|
+
}
|
|
21713
|
+
return ret;
|
|
21737
21714
|
}
|
|
21738
21715
|
/** Invokes [Set.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/delete), raising
|
|
21739
21716
|
* the [[onDeleted]] event if the item was removed from the set.
|
|
21740
21717
|
*/
|
|
21741
21718
|
delete(item) {
|
|
21742
21719
|
const ret = super.delete(item);
|
|
21743
|
-
if (ret)
|
|
21720
|
+
if (ret) {
|
|
21744
21721
|
this.onDeleted.raiseEvent(item);
|
|
21722
|
+
this.onChanged.raiseEvent();
|
|
21723
|
+
}
|
|
21745
21724
|
return ret;
|
|
21746
21725
|
}
|
|
21747
21726
|
/** If this set is not already empty, invokes [Set.clear](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/clear)
|
|
@@ -21751,6 +21730,7 @@ class ObservableSet extends Set {
|
|
|
21751
21730
|
if (0 !== this.size) {
|
|
21752
21731
|
super.clear();
|
|
21753
21732
|
this.onCleared.raiseEvent();
|
|
21733
|
+
this.onChanged.raiseEvent();
|
|
21754
21734
|
}
|
|
21755
21735
|
}
|
|
21756
21736
|
/** Add multiple items to the set, raising [[onBatchAdded]] only once after all items are added.
|
|
@@ -21760,10 +21740,21 @@ class ObservableSet extends Set {
|
|
|
21760
21740
|
*/
|
|
21761
21741
|
addAll(items) {
|
|
21762
21742
|
const prevSize = this.size;
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21743
|
+
let addedAny = false;
|
|
21744
|
+
try {
|
|
21745
|
+
for (const item of items) {
|
|
21746
|
+
const prevSetSize = this.size;
|
|
21747
|
+
super.add(item);
|
|
21748
|
+
if (this.size !== prevSetSize)
|
|
21749
|
+
addedAny = true;
|
|
21750
|
+
}
|
|
21751
|
+
}
|
|
21752
|
+
finally {
|
|
21753
|
+
if (addedAny) {
|
|
21754
|
+
this.onBatchAdded.raiseEvent();
|
|
21755
|
+
this.onChanged.raiseEvent();
|
|
21756
|
+
}
|
|
21757
|
+
}
|
|
21767
21758
|
return this.size - prevSize;
|
|
21768
21759
|
}
|
|
21769
21760
|
/** Delete multiple items from the set, raising [[onBatchDeleted]] only once after all items are deleted.
|
|
@@ -21773,10 +21764,21 @@ class ObservableSet extends Set {
|
|
|
21773
21764
|
*/
|
|
21774
21765
|
deleteAll(items) {
|
|
21775
21766
|
const prevSize = this.size;
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
|
|
21767
|
+
let deletedAny = false;
|
|
21768
|
+
try {
|
|
21769
|
+
for (const item of items) {
|
|
21770
|
+
const prevSetSize = this.size;
|
|
21771
|
+
super.delete(item);
|
|
21772
|
+
if (this.size !== prevSetSize)
|
|
21773
|
+
deletedAny = true;
|
|
21774
|
+
}
|
|
21775
|
+
}
|
|
21776
|
+
finally {
|
|
21777
|
+
if (deletedAny) {
|
|
21778
|
+
this.onBatchDeleted.raiseEvent();
|
|
21779
|
+
this.onChanged.raiseEvent();
|
|
21780
|
+
}
|
|
21781
|
+
}
|
|
21780
21782
|
return prevSize - this.size;
|
|
21781
21783
|
}
|
|
21782
21784
|
}
|
|
@@ -24198,11 +24200,11 @@ class YieldManager {
|
|
|
24198
24200
|
"use strict";
|
|
24199
24201
|
__webpack_require__.r(__webpack_exports__);
|
|
24200
24202
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24201
|
-
/* harmony export */ AbandonedError: () => (/* reexport safe */
|
|
24202
|
-
/* harmony export */ BeDuration: () => (/* reexport safe */
|
|
24203
|
+
/* harmony export */ AbandonedError: () => (/* reexport safe */ _OneAtATimeAction__WEBPACK_IMPORTED_MODULE_22__.AbandonedError),
|
|
24204
|
+
/* harmony export */ BeDuration: () => (/* reexport safe */ _Time__WEBPACK_IMPORTED_MODULE_30__.BeDuration),
|
|
24203
24205
|
/* harmony export */ BeEvent: () => (/* reexport safe */ _BeEvent__WEBPACK_IMPORTED_MODULE_2__.BeEvent),
|
|
24204
24206
|
/* harmony export */ BeEventList: () => (/* reexport safe */ _BeEvent__WEBPACK_IMPORTED_MODULE_2__.BeEventList),
|
|
24205
|
-
/* harmony export */ BeTimePoint: () => (/* reexport safe */
|
|
24207
|
+
/* harmony export */ BeTimePoint: () => (/* reexport safe */ _Time__WEBPACK_IMPORTED_MODULE_30__.BeTimePoint),
|
|
24206
24208
|
/* harmony export */ BeUiEvent: () => (/* reexport safe */ _BeEvent__WEBPACK_IMPORTED_MODULE_2__.BeUiEvent),
|
|
24207
24209
|
/* harmony export */ BeUnorderedEvent: () => (/* reexport safe */ _BeEvent__WEBPACK_IMPORTED_MODULE_2__.BeUnorderedEvent),
|
|
24208
24210
|
/* harmony export */ BeUnorderedUiEvent: () => (/* reexport safe */ _BeEvent__WEBPACK_IMPORTED_MODULE_2__.BeUnorderedUiEvent),
|
|
@@ -24213,15 +24215,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24213
24215
|
/* harmony export */ ByteStream: () => (/* reexport safe */ _ByteStream__WEBPACK_IMPORTED_MODULE_7__.ByteStream),
|
|
24214
24216
|
/* harmony export */ ChangeSetStatus: () => (/* reexport safe */ _BentleyError__WEBPACK_IMPORTED_MODULE_3__.ChangeSetStatus),
|
|
24215
24217
|
/* harmony export */ CompressedId64Set: () => (/* reexport safe */ _CompressedId64Set__WEBPACK_IMPORTED_MODULE_10__.CompressedId64Set),
|
|
24216
|
-
/* harmony export */ DbChangeStage: () => (/* reexport safe */
|
|
24217
|
-
/* harmony export */ DbConflictCause: () => (/* reexport safe */
|
|
24218
|
-
/* harmony export */ DbConflictResolution: () => (/* reexport safe */
|
|
24218
|
+
/* harmony export */ DbChangeStage: () => (/* reexport safe */ _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__.DbChangeStage),
|
|
24219
|
+
/* harmony export */ DbConflictCause: () => (/* reexport safe */ _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__.DbConflictCause),
|
|
24220
|
+
/* harmony export */ DbConflictResolution: () => (/* reexport safe */ _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__.DbConflictResolution),
|
|
24219
24221
|
/* harmony export */ DbOpcode: () => (/* reexport safe */ _BeSQLite__WEBPACK_IMPORTED_MODULE_6__.DbOpcode),
|
|
24220
24222
|
/* harmony export */ DbResult: () => (/* reexport safe */ _BeSQLite__WEBPACK_IMPORTED_MODULE_6__.DbResult),
|
|
24221
|
-
/* harmony export */ DbValueType: () => (/* reexport safe */
|
|
24223
|
+
/* harmony export */ DbValueType: () => (/* reexport safe */ _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__.DbValueType),
|
|
24222
24224
|
/* harmony export */ Dictionary: () => (/* reexport safe */ _Dictionary__WEBPACK_IMPORTED_MODULE_11__.Dictionary),
|
|
24223
24225
|
/* harmony export */ DisposableList: () => (/* reexport safe */ _Disposable__WEBPACK_IMPORTED_MODULE_12__.DisposableList),
|
|
24224
|
-
/* harmony export */ DuplicatePolicy: () => (/* reexport safe */
|
|
24226
|
+
/* harmony export */ DuplicatePolicy: () => (/* reexport safe */ _SortedArray__WEBPACK_IMPORTED_MODULE_28__.DuplicatePolicy),
|
|
24225
24227
|
/* harmony export */ Entry: () => (/* reexport safe */ _LRUMap__WEBPACK_IMPORTED_MODULE_19__.Entry),
|
|
24226
24228
|
/* harmony export */ ErrorCategory: () => (/* reexport safe */ _StatusCategory__WEBPACK_IMPORTED_MODULE_5__.ErrorCategory),
|
|
24227
24229
|
/* harmony export */ GeoServiceStatus: () => (/* reexport safe */ _BentleyError__WEBPACK_IMPORTED_MODULE_3__.GeoServiceStatus),
|
|
@@ -24240,39 +24242,40 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24240
24242
|
/* harmony export */ LogLevel: () => (/* reexport safe */ _Logger__WEBPACK_IMPORTED_MODULE_18__.LogLevel),
|
|
24241
24243
|
/* harmony export */ Logger: () => (/* reexport safe */ _Logger__WEBPACK_IMPORTED_MODULE_18__.Logger),
|
|
24242
24244
|
/* harmony export */ MutableCompressedId64Set: () => (/* reexport safe */ _CompressedId64Set__WEBPACK_IMPORTED_MODULE_10__.MutableCompressedId64Set),
|
|
24243
|
-
/* harmony export */
|
|
24244
|
-
/* harmony export */
|
|
24245
|
+
/* harmony export */ ObservableMap: () => (/* reexport safe */ _ObservableMap__WEBPACK_IMPORTED_MODULE_20__.ObservableMap),
|
|
24246
|
+
/* harmony export */ ObservableSet: () => (/* reexport safe */ _ObservableSet__WEBPACK_IMPORTED_MODULE_21__.ObservableSet),
|
|
24247
|
+
/* harmony export */ OneAtATimeAction: () => (/* reexport safe */ _OneAtATimeAction__WEBPACK_IMPORTED_MODULE_22__.OneAtATimeAction),
|
|
24245
24248
|
/* harmony export */ OpenMode: () => (/* reexport safe */ _BeSQLite__WEBPACK_IMPORTED_MODULE_6__.OpenMode),
|
|
24246
24249
|
/* harmony export */ OrderedId64Array: () => (/* reexport safe */ _CompressedId64Set__WEBPACK_IMPORTED_MODULE_10__.OrderedId64Array),
|
|
24247
|
-
/* harmony export */ OrderedId64Iterable: () => (/* reexport safe */
|
|
24248
|
-
/* harmony export */ OrderedSet: () => (/* reexport safe */
|
|
24250
|
+
/* harmony export */ OrderedId64Iterable: () => (/* reexport safe */ _OrderedId64Iterable__WEBPACK_IMPORTED_MODULE_23__.OrderedId64Iterable),
|
|
24251
|
+
/* harmony export */ OrderedSet: () => (/* reexport safe */ _OrderedSet__WEBPACK_IMPORTED_MODULE_24__.OrderedSet),
|
|
24249
24252
|
/* harmony export */ PerfLogger: () => (/* reexport safe */ _Logger__WEBPACK_IMPORTED_MODULE_18__.PerfLogger),
|
|
24250
|
-
/* harmony export */ PriorityQueue: () => (/* reexport safe */
|
|
24251
|
-
/* harmony export */ ProcessDetector: () => (/* reexport safe */
|
|
24252
|
-
/* harmony export */ ReadonlyOrderedSet: () => (/* reexport safe */
|
|
24253
|
-
/* harmony export */ ReadonlySortedArray: () => (/* reexport safe */
|
|
24253
|
+
/* harmony export */ PriorityQueue: () => (/* reexport safe */ _PriorityQueue__WEBPACK_IMPORTED_MODULE_26__.PriorityQueue),
|
|
24254
|
+
/* harmony export */ ProcessDetector: () => (/* reexport safe */ _ProcessDetector__WEBPACK_IMPORTED_MODULE_27__.ProcessDetector),
|
|
24255
|
+
/* harmony export */ ReadonlyOrderedSet: () => (/* reexport safe */ _OrderedSet__WEBPACK_IMPORTED_MODULE_24__.ReadonlyOrderedSet),
|
|
24256
|
+
/* harmony export */ ReadonlySortedArray: () => (/* reexport safe */ _SortedArray__WEBPACK_IMPORTED_MODULE_28__.ReadonlySortedArray),
|
|
24254
24257
|
/* harmony export */ RealityDataStatus: () => (/* reexport safe */ _BentleyError__WEBPACK_IMPORTED_MODULE_3__.RealityDataStatus),
|
|
24255
|
-
/* harmony export */ RepositoryStatus: () => (/* reexport safe */
|
|
24258
|
+
/* harmony export */ RepositoryStatus: () => (/* reexport safe */ _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__.RepositoryStatus),
|
|
24256
24259
|
/* harmony export */ RpcInterfaceStatus: () => (/* reexport safe */ _BentleyError__WEBPACK_IMPORTED_MODULE_3__.RpcInterfaceStatus),
|
|
24257
|
-
/* harmony export */ SortedArray: () => (/* reexport safe */
|
|
24258
|
-
/* harmony export */ SpanKind: () => (/* reexport safe */
|
|
24260
|
+
/* harmony export */ SortedArray: () => (/* reexport safe */ _SortedArray__WEBPACK_IMPORTED_MODULE_28__.SortedArray),
|
|
24261
|
+
/* harmony export */ SpanKind: () => (/* reexport safe */ _Tracing__WEBPACK_IMPORTED_MODULE_31__.SpanKind),
|
|
24259
24262
|
/* harmony export */ StatusCategory: () => (/* reexport safe */ _StatusCategory__WEBPACK_IMPORTED_MODULE_5__.StatusCategory),
|
|
24260
|
-
/* harmony export */ StopWatch: () => (/* reexport safe */
|
|
24263
|
+
/* harmony export */ StopWatch: () => (/* reexport safe */ _Time__WEBPACK_IMPORTED_MODULE_30__.StopWatch),
|
|
24261
24264
|
/* harmony export */ SuccessCategory: () => (/* reexport safe */ _StatusCategory__WEBPACK_IMPORTED_MODULE_5__.SuccessCategory),
|
|
24262
|
-
/* harmony export */ Tracing: () => (/* reexport safe */
|
|
24265
|
+
/* harmony export */ Tracing: () => (/* reexport safe */ _Tracing__WEBPACK_IMPORTED_MODULE_31__.Tracing),
|
|
24263
24266
|
/* harmony export */ TransientIdSequence: () => (/* reexport safe */ _Id__WEBPACK_IMPORTED_MODULE_14__.TransientIdSequence),
|
|
24264
|
-
/* harmony export */ TupleKeyedMap: () => (/* reexport safe */
|
|
24265
|
-
/* harmony export */ TypedArrayBuilder: () => (/* reexport safe */
|
|
24266
|
-
/* harmony export */ Uint16ArrayBuilder: () => (/* reexport safe */
|
|
24267
|
-
/* harmony export */ Uint32ArrayBuilder: () => (/* reexport safe */
|
|
24268
|
-
/* harmony export */ Uint8ArrayBuilder: () => (/* reexport safe */
|
|
24269
|
-
/* harmony export */ UintArrayBuilder: () => (/* reexport safe */
|
|
24270
|
-
/* harmony export */ UnexpectedErrors: () => (/* reexport safe */
|
|
24271
|
-
/* harmony export */ YieldManager: () => (/* reexport safe */
|
|
24267
|
+
/* harmony export */ TupleKeyedMap: () => (/* reexport safe */ _TupleKeyedMap__WEBPACK_IMPORTED_MODULE_32__.TupleKeyedMap),
|
|
24268
|
+
/* harmony export */ TypedArrayBuilder: () => (/* reexport safe */ _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__.TypedArrayBuilder),
|
|
24269
|
+
/* harmony export */ Uint16ArrayBuilder: () => (/* reexport safe */ _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__.Uint16ArrayBuilder),
|
|
24270
|
+
/* harmony export */ Uint32ArrayBuilder: () => (/* reexport safe */ _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__.Uint32ArrayBuilder),
|
|
24271
|
+
/* harmony export */ Uint8ArrayBuilder: () => (/* reexport safe */ _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__.Uint8ArrayBuilder),
|
|
24272
|
+
/* harmony export */ UintArrayBuilder: () => (/* reexport safe */ _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__.UintArrayBuilder),
|
|
24273
|
+
/* harmony export */ UnexpectedErrors: () => (/* reexport safe */ _UnexpectedErrors__WEBPACK_IMPORTED_MODULE_34__.UnexpectedErrors),
|
|
24274
|
+
/* harmony export */ YieldManager: () => (/* reexport safe */ _YieldManager__WEBPACK_IMPORTED_MODULE_37__.YieldManager),
|
|
24272
24275
|
/* harmony export */ areEqualPossiblyUndefined: () => (/* reexport safe */ _Compare__WEBPACK_IMPORTED_MODULE_9__.areEqualPossiblyUndefined),
|
|
24273
|
-
/* harmony export */ asInstanceOf: () => (/* reexport safe */
|
|
24276
|
+
/* harmony export */ asInstanceOf: () => (/* reexport safe */ _UtilityTypes__WEBPACK_IMPORTED_MODULE_36__.asInstanceOf),
|
|
24274
24277
|
/* harmony export */ assert: () => (/* reexport safe */ _Assert__WEBPACK_IMPORTED_MODULE_1__.assert),
|
|
24275
|
-
/* harmony export */ base64StringToUint8Array: () => (/* reexport safe */
|
|
24278
|
+
/* harmony export */ base64StringToUint8Array: () => (/* reexport safe */ _StringUtils__WEBPACK_IMPORTED_MODULE_29__.base64StringToUint8Array),
|
|
24276
24279
|
/* harmony export */ compareArrays: () => (/* reexport safe */ _Compare__WEBPACK_IMPORTED_MODULE_9__.compareArrays),
|
|
24277
24280
|
/* harmony export */ compareBooleans: () => (/* reexport safe */ _Compare__WEBPACK_IMPORTED_MODULE_9__.compareBooleans),
|
|
24278
24281
|
/* harmony export */ compareBooleansOrUndefined: () => (/* reexport safe */ _Compare__WEBPACK_IMPORTED_MODULE_9__.compareBooleansOrUndefined),
|
|
@@ -24290,16 +24293,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24290
24293
|
/* harmony export */ expectNotNull: () => (/* reexport safe */ _Expect__WEBPACK_IMPORTED_MODULE_13__.expectNotNull),
|
|
24291
24294
|
/* harmony export */ isDisposable: () => (/* reexport safe */ _Disposable__WEBPACK_IMPORTED_MODULE_12__.isDisposable),
|
|
24292
24295
|
/* harmony export */ isIDisposable: () => (/* reexport safe */ _Disposable__WEBPACK_IMPORTED_MODULE_12__.isIDisposable),
|
|
24293
|
-
/* harmony export */ isInstanceOf: () => (/* reexport safe */
|
|
24296
|
+
/* harmony export */ isInstanceOf: () => (/* reexport safe */ _UtilityTypes__WEBPACK_IMPORTED_MODULE_36__.isInstanceOf),
|
|
24294
24297
|
/* harmony export */ isProperSubclassOf: () => (/* reexport safe */ _ClassUtils__WEBPACK_IMPORTED_MODULE_8__.isProperSubclassOf),
|
|
24295
24298
|
/* harmony export */ isSubclassOf: () => (/* reexport safe */ _ClassUtils__WEBPACK_IMPORTED_MODULE_8__.isSubclassOf),
|
|
24296
|
-
/* harmony export */ lowerBound: () => (/* reexport safe */
|
|
24297
|
-
/* harmony export */ omit: () => (/* reexport safe */
|
|
24298
|
-
/* harmony export */ partitionArray: () => (/* reexport safe */
|
|
24299
|
-
/* harmony export */ shallowClone: () => (/* reexport safe */
|
|
24299
|
+
/* harmony export */ lowerBound: () => (/* reexport safe */ _SortedArray__WEBPACK_IMPORTED_MODULE_28__.lowerBound),
|
|
24300
|
+
/* harmony export */ omit: () => (/* reexport safe */ _UtilityTypes__WEBPACK_IMPORTED_MODULE_36__.omit),
|
|
24301
|
+
/* harmony export */ partitionArray: () => (/* reexport safe */ _partitionArray__WEBPACK_IMPORTED_MODULE_25__.partitionArray),
|
|
24302
|
+
/* harmony export */ shallowClone: () => (/* reexport safe */ _SortedArray__WEBPACK_IMPORTED_MODULE_28__.shallowClone),
|
|
24300
24303
|
/* harmony export */ using: () => (/* reexport safe */ _Disposable__WEBPACK_IMPORTED_MODULE_12__.using),
|
|
24301
|
-
/* harmony export */ utf8ToString: () => (/* reexport safe */
|
|
24302
|
-
/* harmony export */ wrapTimerCallback: () => (/* reexport safe */
|
|
24304
|
+
/* harmony export */ utf8ToString: () => (/* reexport safe */ _StringUtils__WEBPACK_IMPORTED_MODULE_29__.utf8ToString),
|
|
24305
|
+
/* harmony export */ wrapTimerCallback: () => (/* reexport safe */ _UtilityFunctions__WEBPACK_IMPORTED_MODULE_35__.wrapTimerCallback)
|
|
24303
24306
|
/* harmony export */ });
|
|
24304
24307
|
/* harmony import */ var _AccessToken__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AccessToken */ "../bentley/lib/esm/AccessToken.js");
|
|
24305
24308
|
/* harmony import */ var _Assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Assert */ "../bentley/lib/esm/Assert.js");
|
|
@@ -24321,24 +24324,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24321
24324
|
/* harmony import */ var _JsonUtils__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./JsonUtils */ "../bentley/lib/esm/JsonUtils.js");
|
|
24322
24325
|
/* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Logger */ "../bentley/lib/esm/Logger.js");
|
|
24323
24326
|
/* harmony import */ var _LRUMap__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./LRUMap */ "../bentley/lib/esm/LRUMap.js");
|
|
24324
|
-
/* harmony import */ var
|
|
24325
|
-
/* harmony import */ var
|
|
24326
|
-
/* harmony import */ var
|
|
24327
|
-
/* harmony import */ var
|
|
24328
|
-
/* harmony import */ var
|
|
24329
|
-
/* harmony import */ var
|
|
24330
|
-
/* harmony import */ var
|
|
24331
|
-
/* harmony import */ var
|
|
24332
|
-
/* harmony import */ var
|
|
24333
|
-
/* harmony import */ var
|
|
24334
|
-
/* harmony import */ var
|
|
24335
|
-
/* harmony import */ var
|
|
24336
|
-
/* harmony import */ var
|
|
24337
|
-
/* harmony import */ var
|
|
24338
|
-
/* harmony import */ var
|
|
24339
|
-
/* harmony import */ var
|
|
24340
|
-
/* harmony import */ var
|
|
24341
|
-
/* harmony import */ var
|
|
24327
|
+
/* harmony import */ var _ObservableMap__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ObservableMap */ "../bentley/lib/esm/ObservableMap.js");
|
|
24328
|
+
/* harmony import */ var _ObservableSet__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ObservableSet */ "../bentley/lib/esm/ObservableSet.js");
|
|
24329
|
+
/* harmony import */ var _OneAtATimeAction__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./OneAtATimeAction */ "../bentley/lib/esm/OneAtATimeAction.js");
|
|
24330
|
+
/* harmony import */ var _OrderedId64Iterable__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./OrderedId64Iterable */ "../bentley/lib/esm/OrderedId64Iterable.js");
|
|
24331
|
+
/* harmony import */ var _OrderedSet__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./OrderedSet */ "../bentley/lib/esm/OrderedSet.js");
|
|
24332
|
+
/* harmony import */ var _partitionArray__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./partitionArray */ "../bentley/lib/esm/partitionArray.js");
|
|
24333
|
+
/* harmony import */ var _PriorityQueue__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./PriorityQueue */ "../bentley/lib/esm/PriorityQueue.js");
|
|
24334
|
+
/* harmony import */ var _ProcessDetector__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./ProcessDetector */ "../bentley/lib/esm/ProcessDetector.js");
|
|
24335
|
+
/* harmony import */ var _SortedArray__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./SortedArray */ "../bentley/lib/esm/SortedArray.js");
|
|
24336
|
+
/* harmony import */ var _StringUtils__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./StringUtils */ "../bentley/lib/esm/StringUtils.js");
|
|
24337
|
+
/* harmony import */ var _Time__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Time */ "../bentley/lib/esm/Time.js");
|
|
24338
|
+
/* harmony import */ var _Tracing__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Tracing */ "../bentley/lib/esm/Tracing.js");
|
|
24339
|
+
/* harmony import */ var _TupleKeyedMap__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./TupleKeyedMap */ "../bentley/lib/esm/TupleKeyedMap.js");
|
|
24340
|
+
/* harmony import */ var _TypedArrayBuilder__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./TypedArrayBuilder */ "../bentley/lib/esm/TypedArrayBuilder.js");
|
|
24341
|
+
/* harmony import */ var _UnexpectedErrors__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./UnexpectedErrors */ "../bentley/lib/esm/UnexpectedErrors.js");
|
|
24342
|
+
/* harmony import */ var _UtilityFunctions__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./UtilityFunctions */ "../bentley/lib/esm/UtilityFunctions.js");
|
|
24343
|
+
/* harmony import */ var _UtilityTypes__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./UtilityTypes */ "../bentley/lib/esm/UtilityTypes.js");
|
|
24344
|
+
/* harmony import */ var _YieldManager__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./YieldManager */ "../bentley/lib/esm/YieldManager.js");
|
|
24345
|
+
/* harmony import */ var _internal_cross_package__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./internal/cross-package */ "../bentley/lib/esm/internal/cross-package.js");
|
|
24342
24346
|
/*---------------------------------------------------------------------------------------------
|
|
24343
24347
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
24344
24348
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -24378,6 +24382,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24378
24382
|
|
|
24379
24383
|
|
|
24380
24384
|
|
|
24385
|
+
|
|
24381
24386
|
|
|
24382
24387
|
|
|
24383
24388
|
// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.
|
|
@@ -25734,6 +25739,7 @@ let exports = __webpack_exports__;
|
|
|
25734
25739
|
*--------------------------------------------------------------------------------------------*/
|
|
25735
25740
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
25736
25741
|
const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.pnpm/chai@4.5.0/node_modules/chai/index.js");
|
|
25742
|
+
const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../bentley/lib/esm/core-bentley.js");
|
|
25737
25743
|
const ITwinLocalization_1 = __webpack_require__(/*! ../ITwinLocalization */ "./lib/cjs/ITwinLocalization.js");
|
|
25738
25744
|
describe("ITwinLocalization", () => {
|
|
25739
25745
|
let localization;
|
|
@@ -26600,6 +26606,65 @@ describe("ITwinLocalization", () => {
|
|
|
26600
26606
|
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("Test"));
|
|
26601
26607
|
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
26602
26608
|
});
|
|
26609
|
+
it("attributes errors from concurrent namespace loads to the namespace that failed", async () => {
|
|
26610
|
+
const pendingLoads = new Map();
|
|
26611
|
+
const backend = {
|
|
26612
|
+
type: "backend",
|
|
26613
|
+
init: () => { },
|
|
26614
|
+
read: (_language, namespace, callback) => pendingLoads.set(namespace, callback),
|
|
26615
|
+
};
|
|
26616
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({
|
|
26617
|
+
backendPlugin: backend,
|
|
26618
|
+
initOptions: { lng: "en", fallbackLng: false },
|
|
26619
|
+
});
|
|
26620
|
+
await itwinLocalization.initialize([]);
|
|
26621
|
+
const loggedErrors = [];
|
|
26622
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method -- Preserve the exact method reference so the test can restore it.
|
|
26623
|
+
const originalLogError = core_bentley_1.Logger.logError;
|
|
26624
|
+
core_bentley_1.Logger.logError = (_category, message) => loggedErrors.push(String(message));
|
|
26625
|
+
try {
|
|
26626
|
+
const loadedPromise = itwinLocalization.registerNamespace("Loaded");
|
|
26627
|
+
const missingPromise = itwinLocalization.registerNamespace("Missing");
|
|
26628
|
+
chai_1.assert.sameMembers([...pendingLoads.keys()], ["Loaded", "Missing"]);
|
|
26629
|
+
pendingLoads.get("Missing")?.(new Error("Missing namespace"), false);
|
|
26630
|
+
pendingLoads.get("Loaded")?.(null, { key: "value" });
|
|
26631
|
+
await Promise.all([missingPromise, loadedPromise]);
|
|
26632
|
+
chai_1.assert.deepEqual(loggedErrors, ["No resources for namespace Missing could be loaded"]);
|
|
26633
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasResourceBundle("en", "Loaded"));
|
|
26634
|
+
}
|
|
26635
|
+
finally {
|
|
26636
|
+
core_bentley_1.Logger.logError = originalLogError;
|
|
26637
|
+
}
|
|
26638
|
+
});
|
|
26639
|
+
it("does not log an error when a namespace loads from a fallback language", async () => {
|
|
26640
|
+
const pendingLoads = new Map();
|
|
26641
|
+
const backend = {
|
|
26642
|
+
type: "backend",
|
|
26643
|
+
init: () => { },
|
|
26644
|
+
read: (language, namespace, callback) => pendingLoads.set(`${language}/${namespace}`, callback),
|
|
26645
|
+
};
|
|
26646
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({
|
|
26647
|
+
backendPlugin: backend,
|
|
26648
|
+
initOptions: { lng: "fr", fallbackLng: "en" },
|
|
26649
|
+
});
|
|
26650
|
+
await itwinLocalization.initialize([]);
|
|
26651
|
+
const loggedErrors = [];
|
|
26652
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method -- Preserve the exact method reference so the test can restore it.
|
|
26653
|
+
const originalLogError = core_bentley_1.Logger.logError;
|
|
26654
|
+
core_bentley_1.Logger.logError = (_category, message) => loggedErrors.push(String(message));
|
|
26655
|
+
try {
|
|
26656
|
+
const loadPromise = itwinLocalization.registerNamespace("Fallback");
|
|
26657
|
+
chai_1.assert.sameMembers([...pendingLoads.keys()], ["fr/Fallback", "en/Fallback"]);
|
|
26658
|
+
pendingLoads.get("fr/Fallback")?.(new Error("Missing French namespace"), false);
|
|
26659
|
+
pendingLoads.get("en/Fallback")?.(null, { key: "value" });
|
|
26660
|
+
await loadPromise;
|
|
26661
|
+
chai_1.assert.isEmpty(loggedErrors);
|
|
26662
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasResourceBundle("en", "Fallback"));
|
|
26663
|
+
}
|
|
26664
|
+
finally {
|
|
26665
|
+
core_bentley_1.Logger.logError = originalLogError;
|
|
26666
|
+
}
|
|
26667
|
+
});
|
|
26603
26668
|
});
|
|
26604
26669
|
// unregisterNamespace() isn't used and basically does nothing
|
|
26605
26670
|
// describe("#unregisterNamespace", () => {
|