@shakerquiz/utilities 4.0.41 → 4.0.43

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "4.0.41",
4
+ "version": "4.0.43",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -21,7 +21,20 @@ let parameters = pathname =>
21
21
  .split('/')
22
22
  .filter(x => x.includes(':'))
23
23
 
24
- let breakdown = route => {
24
+ let breakdown = route =>
25
+ route
26
+ .split('/')
27
+ .map((x, i) => {
28
+ if (i > 0)
29
+ return x
30
+ else if (Segment[x].cardinality === '1')
31
+ return x
32
+ else
33
+ return Segment[x].relation
34
+ })
35
+ .join('/')
36
+
37
+ let relation = route => {
25
38
  let segments = route.split('/')
26
39
 
27
40
  return segments
@@ -84,6 +97,10 @@ let RouteBreakdown = Routes
84
97
  .map(x => `'${x}': '${breakdown(x)}'`)
85
98
  .join(',\n ')
86
99
 
100
+ let RouteRelation = Routes
101
+ .map(x => `'${x}': '${relation(x)}'`)
102
+ .join(',\n ')
103
+
87
104
  let RouteService = Routes
88
105
  .map(x => `'${x}': '${service(x)}'`)
89
106
  .join(',\n ')
@@ -104,6 +121,7 @@ Bun.write(
104
121
  .replace('/* pathname -> parameters */', PathnameParameters)
105
122
  .replace('/* parameter -> pattern */', ParameterPattern)
106
123
  .replace('/* route -> breakdown */', RouteBreakdown)
124
+ .replace('/* route -> relation */', RouteRelation)
107
125
  .replace('/* route -> service */', RouteService)
108
126
  .replace('/* service -> routes */', ServiceRoutes),
109
127
  )
@@ -48,6 +48,12 @@ export const RouteBreakdown = Object.freeze(
48
48
  }),
49
49
  )
50
50
 
51
+ export const RouteRelation = Object.freeze(
52
+ /** @type {const} */ ({
53
+ /* route -> relation */
54
+ }),
55
+ )
56
+
51
57
  export const RouteService = Object.freeze(
52
58
  /** @type {const} */ ({
53
59
  /* route -> service */
@@ -44,9 +44,12 @@ export const RouteExcessiveCardinality = Object.freeze(
44
44
  'themes/cover': 'n/1',
45
45
  'themes/games': 'n/n',
46
46
  'game': '1',
47
+ 'game/id': '1/1',
47
48
  'game/status': '1/1',
48
49
  'game/city': '1/1',
49
50
  'game/registration': '1/1',
51
+ 'game/registration/status': '1/1/1',
52
+ 'game/registration/lineup': '1/1/1',
50
53
  'game/registrations': '1/n',
51
54
  'game/registrations/status': '1/n/1',
52
55
  'game/registrations/lineup': '1/n/1',
@@ -139,9 +142,12 @@ export const RouteCardinality = Object.freeze(
139
142
  'themes/cover': 'n/1',
140
143
  'themes/games': 'n/n',
141
144
  'game': '1',
145
+ 'game/id': '1/1',
142
146
  'game/status': '1/1',
143
147
  'game/city': '1/1',
144
148
  'game/registration': '1/1',
149
+ 'game/registration/status': '1/1',
150
+ 'game/registration/lineup': '1/1',
145
151
  'game/registrations': '1/n',
146
152
  'game/registrations/status': '1/1',
147
153
  'game/registrations/lineup': '1/1',
@@ -234,9 +240,12 @@ export const RoutePathname = Object.freeze(
234
240
  'themes/cover': 'themes/cover/:cover',
235
241
  'themes/games': 'themes/games',
236
242
  'game': 'game/:game',
243
+ 'game/id': 'game/:game/id',
237
244
  'game/status': 'game/:game/status/:status',
238
245
  'game/city': 'game/:game/city/:city',
239
246
  'game/registration': 'game/:game/registration/:registration',
247
+ 'game/registration/status': 'game/:game/registration/:registration/status/:status',
248
+ 'game/registration/lineup': 'game/:game/registration/:registration/lineup',
240
249
  'game/registrations': 'game/:game/registrations',
241
250
  'game/registrations/status': 'game/:game/registrations/status/:status',
242
251
  'game/registrations/lineup': 'game/:game/registrations/lineup',
@@ -395,6 +404,9 @@ export const RouteParameters = Object.freeze(
395
404
  'game': [
396
405
  ':game',
397
406
  ],
407
+ 'game/id': [
408
+ ':game',
409
+ ],
398
410
  'game/status': [
399
411
  ':game',
400
412
  ':status',
@@ -407,6 +419,15 @@ export const RouteParameters = Object.freeze(
407
419
  ':game',
408
420
  ':registration',
409
421
  ],
422
+ 'game/registration/status': [
423
+ ':game',
424
+ ':registration',
425
+ ':status',
426
+ ],
427
+ 'game/registration/lineup': [
428
+ ':game',
429
+ ':registration',
430
+ ],
410
431
  'game/registrations': [
411
432
  ':game',
412
433
  ],
@@ -587,9 +608,12 @@ export const PathnameRoute = Object.freeze(
587
608
  'themes/cover/:cover': 'themes/cover',
588
609
  'themes/games': 'themes/games',
589
610
  'game/:game': 'game',
611
+ 'game/:game/id': 'game/id',
590
612
  'game/:game/status/:status': 'game/status',
591
613
  'game/:game/city/:city': 'game/city',
592
614
  'game/:game/registration/:registration': 'game/registration',
615
+ 'game/:game/registration/:registration/status/:status': 'game/registration/status',
616
+ 'game/:game/registration/:registration/lineup': 'game/registration/lineup',
593
617
  'game/:game/registrations': 'game/registrations',
594
618
  'game/:game/registrations/status/:status': 'game/registrations/status',
595
619
  'game/:game/registrations/lineup': 'game/registrations/lineup',
@@ -748,6 +772,9 @@ export const PathnameParameters = Object.freeze(
748
772
  'game/:game': [
749
773
  ':game',
750
774
  ],
775
+ 'game/:game/id': [
776
+ ':game',
777
+ ],
751
778
  'game/:game/status/:status': [
752
779
  ':game',
753
780
  ':status',
@@ -760,6 +787,15 @@ export const PathnameParameters = Object.freeze(
760
787
  ':game',
761
788
  ':registration',
762
789
  ],
790
+ 'game/:game/registration/:registration/status/:status': [
791
+ ':game',
792
+ ':registration',
793
+ ':status',
794
+ ],
795
+ 'game/:game/registration/:registration/lineup': [
796
+ ':game',
797
+ ':registration',
798
+ ],
763
799
  'game/:game/registrations': [
764
800
  ':game',
765
801
  ],
@@ -914,6 +950,104 @@ export const ParameterPattern = Object.freeze(
914
950
  )
915
951
 
916
952
  export const RouteBreakdown = Object.freeze(
953
+ /** @type {const} */ ({
954
+ 'role': 'role',
955
+ 'roles': 'role',
956
+ 'user': 'user',
957
+ 'user/id': 'user/id',
958
+ 'user/password': 'user/password',
959
+ 'user/role': 'user/role',
960
+ 'user/city': 'user/city',
961
+ 'user/cities': 'user/cities',
962
+ 'users': 'user',
963
+ 'users/password': 'user/password',
964
+ 'users/role': 'user/role',
965
+ 'users/cities': 'user/cities',
966
+ 'checkin': 'checkin',
967
+ 'cities': 'city',
968
+ 'cities/country': 'city/country',
969
+ 'cities/currency': 'city/currency',
970
+ 'cities/timezone': 'city/timezone',
971
+ 'cities/venues': 'city/venues',
972
+ 'city': 'city',
973
+ 'city/vk_group_token': 'city/vk_group_token',
974
+ 'city/country': 'city/country',
975
+ 'city/currency': 'city/currency',
976
+ 'city/timezone': 'city/timezone',
977
+ 'city/venue': 'city/venue',
978
+ 'city/venues': 'city/venues',
979
+ 'country': 'country',
980
+ 'countries': 'country',
981
+ 'currency': 'currency',
982
+ 'currencies': 'currency',
983
+ 'timezone': 'timezone',
984
+ 'timezones': 'timezone',
985
+ 'venue': 'venue',
986
+ 'venue/city': 'venue/city',
987
+ 'venues': 'venue',
988
+ 'venues/city': 'venue/city',
989
+ 'cover': 'cover',
990
+ 'theme': 'theme',
991
+ 'theme/cover': 'theme/cover',
992
+ 'themes': 'theme',
993
+ 'themes/cover': 'theme/cover',
994
+ 'themes/games': 'theme/games',
995
+ 'game': 'game',
996
+ 'game/id': 'game/id',
997
+ 'game/status': 'game/status',
998
+ 'game/city': 'game/city',
999
+ 'game/registration': 'game/registration',
1000
+ 'game/registration/status': 'game/registration/status',
1001
+ 'game/registration/lineup': 'game/registration/lineup',
1002
+ 'game/registrations': 'game/registrations',
1003
+ 'game/registrations/status': 'game/registrations/status',
1004
+ 'game/registrations/lineup': 'game/registrations/lineup',
1005
+ 'game/registrations/export': 'game/registrations/export',
1006
+ 'game/summary': 'game/summary',
1007
+ 'game/theme': 'game/theme',
1008
+ 'game/theme/cover': 'game/theme/cover',
1009
+ 'game/venue': 'game/venue',
1010
+ 'games': 'game',
1011
+ 'games/status': 'game/status',
1012
+ 'games/city': 'game/city',
1013
+ 'games/registrations': 'game/registrations',
1014
+ 'games/registrations/export': 'game/registrations/export',
1015
+ 'games/summary': 'game/summary',
1016
+ 'games/theme': 'game/theme',
1017
+ 'games/theme/cover': 'game/theme/cover',
1018
+ 'games/venue': 'game/venue',
1019
+ 'registration': 'registration',
1020
+ 'registration/status': 'registration/status',
1021
+ 'registration/creation': 'registration/creation',
1022
+ 'registration/confirmation': 'registration/confirmation',
1023
+ 'registration/cancellation': 'registration/cancellation',
1024
+ 'registration/lineup': 'registration/lineup',
1025
+ 'registration/channel': 'registration/channel',
1026
+ 'registration/export': 'registration/export',
1027
+ 'registration/city': 'registration/city',
1028
+ 'registration/game': 'registration/game',
1029
+ 'registration/game/theme': 'registration/game/theme',
1030
+ 'registration/game/theme/cover': 'registration/game/theme/cover',
1031
+ 'registration/game/venue': 'registration/game/venue',
1032
+ 'registrations': 'registration',
1033
+ 'registrations/status': 'registration/status',
1034
+ 'registrations/lineup': 'registration/lineup',
1035
+ 'registrations/city': 'registration/city',
1036
+ 'registrations/game': 'registration/game',
1037
+ 'registrations/game/status': 'registration/game/status',
1038
+ 'registrations/game/theme': 'registration/game/theme',
1039
+ 'registrations/export': 'registration/export',
1040
+ 'telegram/webhook': 'telegram/webhook',
1041
+ 'telegram/registration/mailing': 'telegram/registration/mailing',
1042
+ 'chatapp/webhook': 'chatapp/webhook',
1043
+ 'chatapp/registration': 'chatapp/registration',
1044
+ 'chatapp/registration/mailing': 'chatapp/registration/mailing',
1045
+ 'bitrix/registration': 'bitrix/registration',
1046
+ 'source': 'source',
1047
+ }),
1048
+ )
1049
+
1050
+ export const RouteRelation = Object.freeze(
917
1051
  /** @type {const} */ ({
918
1052
  'role': 'role',
919
1053
  'roles': 'role',
@@ -957,9 +1091,12 @@ export const RouteBreakdown = Object.freeze(
957
1091
  'themes/cover': 'theme/cover',
958
1092
  'themes/games': 'theme/game',
959
1093
  'game': 'game',
1094
+ 'game/id': 'game/id',
960
1095
  'game/status': 'game/status',
961
1096
  'game/city': 'game/city',
962
1097
  'game/registration': 'game/registration',
1098
+ 'game/registration/status': 'registration/status',
1099
+ 'game/registration/lineup': 'registration/lineup',
963
1100
  'game/registrations': 'game/registration',
964
1101
  'game/registrations/status': 'registration/status',
965
1102
  'game/registrations/lineup': 'registration/lineup',
@@ -1052,9 +1189,12 @@ export const RouteService = Object.freeze(
1052
1189
  'themes/cover': 'Themes',
1053
1190
  'themes/games': 'Themes',
1054
1191
  'game': 'Games',
1192
+ 'game/id': 'Games',
1055
1193
  'game/status': 'Games',
1056
1194
  'game/city': 'Games',
1057
1195
  'game/registration': 'Games',
1196
+ 'game/registration/status': 'Games',
1197
+ 'game/registration/lineup': 'Games',
1058
1198
  'game/registrations': 'Games',
1059
1199
  'game/registrations/status': 'Games',
1060
1200
  'game/registrations/lineup': 'Games',
@@ -1164,9 +1304,12 @@ export const ServiceRoutes = Object.freeze(
1164
1304
  ],
1165
1305
  'Games': [
1166
1306
  'game',
1307
+ 'game/id',
1167
1308
  'game/status',
1168
1309
  'game/city',
1169
1310
  'game/registration',
1311
+ 'game/registration/status',
1312
+ 'game/registration/lineup',
1170
1313
  'game/registrations',
1171
1314
  'game/registrations/status',
1172
1315
  'game/registrations/lineup',
@@ -42,9 +42,12 @@ export const Routes = Object.freeze(
42
42
  'themes/cover',
43
43
  'themes/games',
44
44
  'game',
45
+ 'game/id',
45
46
  'game/status',
46
47
  'game/city',
47
48
  'game/registration',
49
+ 'game/registration/status',
50
+ 'game/registration/lineup',
48
51
  'game/registrations',
49
52
  'game/registrations/status',
50
53
  'game/registrations/lineup',