@shakerquiz/utilities 4.0.42 → 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.42",
4
+ "version": "4.0.43",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -21,15 +21,6 @@ let parameters = pathname =>
21
21
  .split('/')
22
22
  .filter(x => x.includes(':'))
23
23
 
24
- // let breakdown = route => {
25
- // let segments = route.split('/')
26
-
27
- // return segments
28
- // .slice(segments.length >= 3 ? -2 : 0)
29
- // .map(x => Segment[x].cardinality === '1' ? x : Segment[x].relation)
30
- // .join('/')
31
- // }
32
-
33
24
  let breakdown = route =>
34
25
  route
35
26
  .split('/')
@@ -43,6 +34,15 @@ let breakdown = route =>
43
34
  })
44
35
  .join('/')
45
36
 
37
+ let relation = route => {
38
+ let segments = route.split('/')
39
+
40
+ return segments
41
+ .slice(segments.length >= 3 ? -2 : 0)
42
+ .map(x => Segment[x].cardinality === '1' ? x : Segment[x].relation)
43
+ .join('/')
44
+ }
45
+
46
46
  let service = route =>
47
47
  route
48
48
  .split('/')
@@ -97,6 +97,10 @@ let RouteBreakdown = Routes
97
97
  .map(x => `'${x}': '${breakdown(x)}'`)
98
98
  .join(',\n ')
99
99
 
100
+ let RouteRelation = Routes
101
+ .map(x => `'${x}': '${relation(x)}'`)
102
+ .join(',\n ')
103
+
100
104
  let RouteService = Routes
101
105
  .map(x => `'${x}': '${service(x)}'`)
102
106
  .join(',\n ')
@@ -117,6 +121,7 @@ Bun.write(
117
121
  .replace('/* pathname -> parameters */', PathnameParameters)
118
122
  .replace('/* parameter -> pattern */', ParameterPattern)
119
123
  .replace('/* route -> breakdown */', RouteBreakdown)
124
+ .replace('/* route -> relation */', RouteRelation)
120
125
  .replace('/* route -> service */', RouteService)
121
126
  .replace('/* service -> routes */', ServiceRoutes),
122
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 */
@@ -1047,6 +1047,104 @@ export const RouteBreakdown = Object.freeze(
1047
1047
  }),
1048
1048
  )
1049
1049
 
1050
+ export const RouteRelation = Object.freeze(
1051
+ /** @type {const} */ ({
1052
+ 'role': 'role',
1053
+ 'roles': 'role',
1054
+ 'user': 'user',
1055
+ 'user/id': 'user/id',
1056
+ 'user/password': 'user/password',
1057
+ 'user/role': 'user/role',
1058
+ 'user/city': 'user/city',
1059
+ 'user/cities': 'user/city',
1060
+ 'users': 'user',
1061
+ 'users/password': 'user/password',
1062
+ 'users/role': 'user/role',
1063
+ 'users/cities': 'user/city',
1064
+ 'checkin': 'checkin',
1065
+ 'cities': 'city',
1066
+ 'cities/country': 'city/country',
1067
+ 'cities/currency': 'city/currency',
1068
+ 'cities/timezone': 'city/timezone',
1069
+ 'cities/venues': 'city/venue',
1070
+ 'city': 'city',
1071
+ 'city/vk_group_token': 'city/vk_group_token',
1072
+ 'city/country': 'city/country',
1073
+ 'city/currency': 'city/currency',
1074
+ 'city/timezone': 'city/timezone',
1075
+ 'city/venue': 'city/venue',
1076
+ 'city/venues': 'city/venue',
1077
+ 'country': 'country',
1078
+ 'countries': 'country',
1079
+ 'currency': 'currency',
1080
+ 'currencies': 'currency',
1081
+ 'timezone': 'timezone',
1082
+ 'timezones': 'timezone',
1083
+ 'venue': 'venue',
1084
+ 'venue/city': 'venue/city',
1085
+ 'venues': 'venue',
1086
+ 'venues/city': 'venue/city',
1087
+ 'cover': 'cover',
1088
+ 'theme': 'theme',
1089
+ 'theme/cover': 'theme/cover',
1090
+ 'themes': 'theme',
1091
+ 'themes/cover': 'theme/cover',
1092
+ 'themes/games': 'theme/game',
1093
+ 'game': 'game',
1094
+ 'game/id': 'game/id',
1095
+ 'game/status': 'game/status',
1096
+ 'game/city': 'game/city',
1097
+ 'game/registration': 'game/registration',
1098
+ 'game/registration/status': 'registration/status',
1099
+ 'game/registration/lineup': 'registration/lineup',
1100
+ 'game/registrations': 'game/registration',
1101
+ 'game/registrations/status': 'registration/status',
1102
+ 'game/registrations/lineup': 'registration/lineup',
1103
+ 'game/registrations/export': 'registration/export',
1104
+ 'game/summary': 'game/summary',
1105
+ 'game/theme': 'game/theme',
1106
+ 'game/theme/cover': 'theme/cover',
1107
+ 'game/venue': 'game/venue',
1108
+ 'games': 'game',
1109
+ 'games/status': 'game/status',
1110
+ 'games/city': 'game/city',
1111
+ 'games/registrations': 'game/registration',
1112
+ 'games/registrations/export': 'registration/export',
1113
+ 'games/summary': 'game/summary',
1114
+ 'games/theme': 'game/theme',
1115
+ 'games/theme/cover': 'theme/cover',
1116
+ 'games/venue': 'game/venue',
1117
+ 'registration': 'registration',
1118
+ 'registration/status': 'registration/status',
1119
+ 'registration/creation': 'registration/creation',
1120
+ 'registration/confirmation': 'registration/confirmation',
1121
+ 'registration/cancellation': 'registration/cancellation',
1122
+ 'registration/lineup': 'registration/lineup',
1123
+ 'registration/channel': 'registration/channel',
1124
+ 'registration/export': 'registration/export',
1125
+ 'registration/city': 'registration/city',
1126
+ 'registration/game': 'registration/game',
1127
+ 'registration/game/theme': 'game/theme',
1128
+ 'registration/game/theme/cover': 'theme/cover',
1129
+ 'registration/game/venue': 'game/venue',
1130
+ 'registrations': 'registration',
1131
+ 'registrations/status': 'registration/status',
1132
+ 'registrations/lineup': 'registration/lineup',
1133
+ 'registrations/city': 'registration/city',
1134
+ 'registrations/game': 'registration/game',
1135
+ 'registrations/game/status': 'game/status',
1136
+ 'registrations/game/theme': 'game/theme',
1137
+ 'registrations/export': 'registration/export',
1138
+ 'telegram/webhook': 'telegram/webhook',
1139
+ 'telegram/registration/mailing': 'registration/mailing',
1140
+ 'chatapp/webhook': 'chatapp/webhook',
1141
+ 'chatapp/registration': 'chatapp/registration',
1142
+ 'chatapp/registration/mailing': 'registration/mailing',
1143
+ 'bitrix/registration': 'bitrix/registration',
1144
+ 'source': 'source',
1145
+ }),
1146
+ )
1147
+
1050
1148
  export const RouteService = Object.freeze(
1051
1149
  /** @type {const} */ ({
1052
1150
  'role': 'Roles',