@shakerquiz/utilities 4.0.1 → 4.0.3

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.
Files changed (36) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/dprint.json +0 -3
  3. package/jsconfig.json +5 -8
  4. package/package.json +6 -2
  5. package/scripts/codegen.js +104 -0
  6. package/scripts/template.js +55 -0
  7. package/source/codegen/autogenerated.js +782 -0
  8. package/source/entities/key.js +6 -4
  9. package/source/entities/pattern.js +3 -3
  10. package/source/entities/{route.js → routes.js} +0 -7
  11. package/source/entities/runtimes.js +14 -0
  12. package/source/entities/segment.js +36 -4
  13. package/source/entities/service-runtime.js +2 -2
  14. package/source/entities/services.js +28 -0
  15. package/source/helpers/access.js +11 -13
  16. package/source/helpers/route-pathname.js +26 -0
  17. package/source/helpers/tag.js +32 -29
  18. package/source/index.js +5 -9
  19. package/scripts/route-cardinality.js +0 -23
  20. package/scripts/route-parameter.js +0 -29
  21. package/scripts/route-pathname.js +0 -37
  22. package/scripts/route-relation.js +0 -26
  23. package/scripts/route-service.js +0 -25
  24. package/scripts/templates/route-cardinality.js +0 -5
  25. package/scripts/templates/route-parameter.js +0 -5
  26. package/scripts/templates/route-pathname.js +0 -7
  27. package/scripts/templates/route-relation.js +0 -5
  28. package/scripts/templates/route-service.js +0 -7
  29. package/source/entities/route-cardinality.js +0 -151
  30. package/source/entities/route-parameter.js +0 -151
  31. package/source/entities/route-pathname.js +0 -226
  32. package/source/entities/route-relation.js +0 -151
  33. package/source/entities/route-service.js +0 -181
  34. package/source/entities/runtime.js +0 -6
  35. package/source/entities/service.js +0 -22
  36. package/source/helpers/hydrate-route-pathname.js +0 -29
@@ -1,25 +0,0 @@
1
- import template from './templates/route-service.js' with { type: 'text' }
2
-
3
- import { Routes } from '../source/entities/route.js'
4
- import { Segment } from '../source/entities/segment.js'
5
-
6
- let config = [undefined, 2]
7
-
8
- let services = Routes.map(route => Segment[route.split('/').at(0)].service)
9
-
10
- let RouteServices = services.filter((x, i, a) => a.indexOf(x) === i)
11
-
12
- let RouteService = Routes.reduce((o, x, i) => (o[x] = services[i], o), {})
13
-
14
- let ServiceRoutes = Object
15
- .entries(Object.groupBy(Object.entries(RouteService), ([, service]) => service))
16
- .map(([service, pairs]) => [service, pairs.map(([route]) => route)])
17
- .reduce((o, [s, r]) => (o[s] = r, o), {})
18
-
19
- Bun.write(
20
- './source/entities/route-service.js',
21
- template
22
- .replace('/* RouteServices */', JSON.stringify(RouteServices, ...config))
23
- .replace('/* RouteService */', JSON.stringify(RouteService, ...config))
24
- .replace('/* ServiceRoutes */', JSON.stringify(ServiceRoutes, ...config)),
25
- )
@@ -1,5 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteCardinalities = Object.freeze( /** @type {const} */ (/* RouteCardinalities */))
4
-
5
- export const RouteCardinality = Object.freeze(/** @type {const} */ (/* RouteCardinality */))
@@ -1,5 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteParameters = Object.freeze( /** @type {const} */ (/* RouteParameters */))
4
-
5
- export const RouteParameter = Object.freeze(/** @type {const} */ (/* RouteParameter */))
@@ -1,7 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RoutePathnames = Object.freeze( /** @type {const} */ (/* RoutePathnames */))
4
-
5
- export const RoutePathname = Object.freeze(/** @type {const} */ (/* RoutePathname */))
6
-
7
- export const PathnameRoute = Object.freeze(/** @type {const} */ (/* PathnameRoute */))
@@ -1,5 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteRelations = Object.freeze( /** @type {const} */ (/* RouteRelations */))
4
-
5
- export const RouteRelation = Object.freeze(/** @type {const} */ (/* RouteRelation */))
@@ -1,7 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteServices = Object.freeze( /** @type {const} */ (/* RouteServices */))
4
-
5
- export const RouteService = Object.freeze(/** @type {const} */ (/* RouteService */))
6
-
7
- export const ServiceRoutes = Object.freeze(/** @type {const} */ (/* ServiceRoutes */))
@@ -1,151 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteCardinalities = Object.freeze( /** @type {const} */ ([
4
- "1",
5
- "n",
6
- "1",
7
- "1/1",
8
- "1/1",
9
- "1/1",
10
- "1/n",
11
- "n",
12
- "n/1",
13
- "n/1",
14
- "n/n",
15
- "1",
16
- "n",
17
- "n/1",
18
- "n/1",
19
- "n/1",
20
- "n/n",
21
- "1",
22
- "1/1",
23
- "1/1",
24
- "1/1",
25
- "1/1",
26
- "1/1",
27
- "1/n",
28
- "1",
29
- "n",
30
- "1",
31
- "n",
32
- "1",
33
- "n",
34
- "1",
35
- "1/1",
36
- "n",
37
- "n/1",
38
- "1",
39
- "1/1",
40
- "n",
41
- "n/1",
42
- "n/n",
43
- "1",
44
- "1/1",
45
- "1/1",
46
- "1/n",
47
- "1/1",
48
- "1/1",
49
- "1/1",
50
- "1/1",
51
- "1/1",
52
- "n",
53
- "n/1",
54
- "n/n",
55
- "n/1",
56
- "n/1",
57
- "n/1",
58
- "n/1",
59
- "n/1",
60
- "1",
61
- "1/1",
62
- "1/1",
63
- "1/1",
64
- "1/1",
65
- "1/1",
66
- "1/1",
67
- "1/1",
68
- "1/1",
69
- "1/1",
70
- "1/1",
71
- "n",
72
- "n/1",
73
- "n/1",
74
- "n/1",
75
- "n/1"
76
- ]))
77
-
78
- export const RouteCardinality = Object.freeze(/** @type {const} */ ({
79
- "role": "1",
80
- "roles": "n",
81
- "user": "1",
82
- "user/password": "1/1",
83
- "user/role": "1/1",
84
- "user/city": "1/1",
85
- "user/cities": "1/n",
86
- "users": "n",
87
- "users/password": "n/1",
88
- "users/role": "n/1",
89
- "users/cities": "n/n",
90
- "checkin": "1",
91
- "cities": "n",
92
- "cities/country": "n/1",
93
- "cities/currency": "n/1",
94
- "cities/timezone": "n/1",
95
- "cities/venues": "n/n",
96
- "city": "1",
97
- "city/vk_group_token": "1/1",
98
- "city/country": "1/1",
99
- "city/currency": "1/1",
100
- "city/timezone": "1/1",
101
- "city/venue": "1/1",
102
- "city/venues": "1/n",
103
- "country": "1",
104
- "countries": "n",
105
- "currency": "1",
106
- "currencies": "n",
107
- "timezone": "1",
108
- "timezones": "n",
109
- "venue": "1",
110
- "venue/city": "1/1",
111
- "venues": "n",
112
- "venues/city": "n/1",
113
- "theme": "1",
114
- "theme/cover": "1/1",
115
- "themes": "n",
116
- "themes/cover": "n/1",
117
- "themes/games": "n/n",
118
- "game": "1",
119
- "game/city": "1/1",
120
- "game/registration": "1/1",
121
- "game/registrations": "1/n",
122
- "game/registrations/export": "1/1",
123
- "game/summary": "1/1",
124
- "game/theme": "1/1",
125
- "game/theme/cover": "1/1",
126
- "game/venue": "1/1",
127
- "games": "n",
128
- "games/city": "n/1",
129
- "games/registrations": "n/n",
130
- "games/registrations/export": "n/1",
131
- "games/summary": "n/1",
132
- "games/theme": "n/1",
133
- "games/theme/cover": "n/1",
134
- "games/venue": "n/1",
135
- "registration": "1",
136
- "registration/cancellation": "1/1",
137
- "registration/channel": "1/1",
138
- "registration/confirmation": "1/1",
139
- "registration/export": "1/1",
140
- "registration/city": "1/1",
141
- "registration/game": "1/1",
142
- "registration/game/theme": "1/1",
143
- "registration/game/theme/cover": "1/1",
144
- "registration/game/venue": "1/1",
145
- "registration/mailing": "1/1",
146
- "registrations": "n",
147
- "registrations/city": "n/1",
148
- "registrations/game": "n/1",
149
- "registrations/game/theme": "n/1",
150
- "registrations/export": "n/1"
151
- }))
@@ -1,151 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteParameters = Object.freeze( /** @type {const} */ ([
4
- ":role",
5
- "",
6
- ":user",
7
- ":user/:password",
8
- ":user/:role",
9
- ":user/:city",
10
- ":user",
11
- "",
12
- ":password",
13
- ":role",
14
- "",
15
- ":checkin",
16
- "",
17
- ":country",
18
- ":currency",
19
- ":timezone",
20
- "",
21
- ":city",
22
- ":city/:vk_group_token",
23
- ":city/:country",
24
- ":city/:currency",
25
- ":city/:timezone",
26
- ":city/:venue",
27
- ":city",
28
- ":country",
29
- "",
30
- ":currency",
31
- "",
32
- ":timezone",
33
- "",
34
- ":venue",
35
- ":venue/:city",
36
- "",
37
- ":city",
38
- ":theme",
39
- ":theme/:cover",
40
- "",
41
- ":cover",
42
- "",
43
- ":game",
44
- ":game/:city",
45
- ":game/:registration",
46
- ":game",
47
- ":game/:export",
48
- ":game/:summary",
49
- ":game/:theme",
50
- ":game/:theme/:cover",
51
- ":game/:venue",
52
- "",
53
- ":city",
54
- "",
55
- ":export",
56
- ":summary",
57
- ":theme",
58
- ":theme/:cover",
59
- ":venue",
60
- ":registration",
61
- ":registration/:cancellation",
62
- ":registration/:channel",
63
- ":registration/:confirmation",
64
- ":registration/:export",
65
- ":registration/:city",
66
- ":registration/:game",
67
- ":registration/:game/:theme",
68
- ":registration/:game/:theme/:cover",
69
- ":registration/:game/:venue",
70
- ":registration/:mailing",
71
- "",
72
- ":city",
73
- ":game",
74
- ":game/:theme",
75
- ":export"
76
- ]))
77
-
78
- export const RouteParameter = Object.freeze(/** @type {const} */ ({
79
- "role": ":role",
80
- "roles": "",
81
- "user": ":user",
82
- "user/password": ":user/:password",
83
- "user/role": ":user/:role",
84
- "user/city": ":user/:city",
85
- "user/cities": ":user",
86
- "users": "",
87
- "users/password": ":password",
88
- "users/role": ":role",
89
- "users/cities": "",
90
- "checkin": ":checkin",
91
- "cities": "",
92
- "cities/country": ":country",
93
- "cities/currency": ":currency",
94
- "cities/timezone": ":timezone",
95
- "cities/venues": "",
96
- "city": ":city",
97
- "city/vk_group_token": ":city/:vk_group_token",
98
- "city/country": ":city/:country",
99
- "city/currency": ":city/:currency",
100
- "city/timezone": ":city/:timezone",
101
- "city/venue": ":city/:venue",
102
- "city/venues": ":city",
103
- "country": ":country",
104
- "countries": "",
105
- "currency": ":currency",
106
- "currencies": "",
107
- "timezone": ":timezone",
108
- "timezones": "",
109
- "venue": ":venue",
110
- "venue/city": ":venue/:city",
111
- "venues": "",
112
- "venues/city": ":city",
113
- "theme": ":theme",
114
- "theme/cover": ":theme/:cover",
115
- "themes": "",
116
- "themes/cover": ":cover",
117
- "themes/games": "",
118
- "game": ":game",
119
- "game/city": ":game/:city",
120
- "game/registration": ":game/:registration",
121
- "game/registrations": ":game",
122
- "game/registrations/export": ":game/:export",
123
- "game/summary": ":game/:summary",
124
- "game/theme": ":game/:theme",
125
- "game/theme/cover": ":game/:theme/:cover",
126
- "game/venue": ":game/:venue",
127
- "games": "",
128
- "games/city": ":city",
129
- "games/registrations": "",
130
- "games/registrations/export": ":export",
131
- "games/summary": ":summary",
132
- "games/theme": ":theme",
133
- "games/theme/cover": ":theme/:cover",
134
- "games/venue": ":venue",
135
- "registration": ":registration",
136
- "registration/cancellation": ":registration/:cancellation",
137
- "registration/channel": ":registration/:channel",
138
- "registration/confirmation": ":registration/:confirmation",
139
- "registration/export": ":registration/:export",
140
- "registration/city": ":registration/:city",
141
- "registration/game": ":registration/:game",
142
- "registration/game/theme": ":registration/:game/:theme",
143
- "registration/game/theme/cover": ":registration/:game/:theme/:cover",
144
- "registration/game/venue": ":registration/:game/:venue",
145
- "registration/mailing": ":registration/:mailing",
146
- "registrations": "",
147
- "registrations/city": ":city",
148
- "registrations/game": ":game",
149
- "registrations/game/theme": ":game/:theme",
150
- "registrations/export": ":export"
151
- }))
@@ -1,226 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RoutePathnames = Object.freeze( /** @type {const} */ ([
4
- "role/:role",
5
- "roles",
6
- "user/:user",
7
- "user/:user/password/:password",
8
- "user/:user/role/:role",
9
- "user/:user/city/:city",
10
- "user/:user/cities",
11
- "users",
12
- "users/password/:password",
13
- "users/role/:role",
14
- "users/cities",
15
- "checkin/:checkin",
16
- "cities",
17
- "cities/country/:country",
18
- "cities/currency/:currency",
19
- "cities/timezone/:timezone",
20
- "cities/venues",
21
- "city/:city",
22
- "city/:city/vk_group_token/:vk_group_token",
23
- "city/:city/country/:country",
24
- "city/:city/currency/:currency",
25
- "city/:city/timezone/:timezone",
26
- "city/:city/venue/:venue",
27
- "city/:city/venues",
28
- "country/:country",
29
- "countries",
30
- "currency/:currency",
31
- "currencies",
32
- "timezone/:timezone",
33
- "timezones",
34
- "venue/:venue",
35
- "venue/:venue/city/:city",
36
- "venues",
37
- "venues/city/:city",
38
- "theme/:theme",
39
- "theme/:theme/cover/:cover",
40
- "themes",
41
- "themes/cover/:cover",
42
- "themes/games",
43
- "game/:game",
44
- "game/:game/city/:city",
45
- "game/:game/registration/:registration",
46
- "game/:game/registrations",
47
- "game/:game/registrations/export/:export",
48
- "game/:game/summary/:summary",
49
- "game/:game/theme/:theme",
50
- "game/:game/theme/:theme/cover/:cover",
51
- "game/:game/venue/:venue",
52
- "games",
53
- "games/city/:city",
54
- "games/registrations",
55
- "games/registrations/export/:export",
56
- "games/summary/:summary",
57
- "games/theme/:theme",
58
- "games/theme/:theme/cover/:cover",
59
- "games/venue/:venue",
60
- "registration/:registration",
61
- "registration/:registration/cancellation/:cancellation",
62
- "registration/:registration/channel/:channel",
63
- "registration/:registration/confirmation/:confirmation",
64
- "registration/:registration/export/:export",
65
- "registration/:registration/city/:city",
66
- "registration/:registration/game/:game",
67
- "registration/:registration/game/:game/theme/:theme",
68
- "registration/:registration/game/:game/theme/:theme/cover/:cover",
69
- "registration/:registration/game/:game/venue/:venue",
70
- "registration/:registration/mailing/:mailing",
71
- "registrations",
72
- "registrations/city/:city",
73
- "registrations/game/:game",
74
- "registrations/game/:game/theme/:theme",
75
- "registrations/export/:export"
76
- ]))
77
-
78
- export const RoutePathname = Object.freeze(/** @type {const} */ ({
79
- "role": "role/:role",
80
- "roles": "roles",
81
- "user": "user/:user",
82
- "user/password": "user/:user/password/:password",
83
- "user/role": "user/:user/role/:role",
84
- "user/city": "user/:user/city/:city",
85
- "user/cities": "user/:user/cities",
86
- "users": "users",
87
- "users/password": "users/password/:password",
88
- "users/role": "users/role/:role",
89
- "users/cities": "users/cities",
90
- "checkin": "checkin/:checkin",
91
- "cities": "cities",
92
- "cities/country": "cities/country/:country",
93
- "cities/currency": "cities/currency/:currency",
94
- "cities/timezone": "cities/timezone/:timezone",
95
- "cities/venues": "cities/venues",
96
- "city": "city/:city",
97
- "city/vk_group_token": "city/:city/vk_group_token/:vk_group_token",
98
- "city/country": "city/:city/country/:country",
99
- "city/currency": "city/:city/currency/:currency",
100
- "city/timezone": "city/:city/timezone/:timezone",
101
- "city/venue": "city/:city/venue/:venue",
102
- "city/venues": "city/:city/venues",
103
- "country": "country/:country",
104
- "countries": "countries",
105
- "currency": "currency/:currency",
106
- "currencies": "currencies",
107
- "timezone": "timezone/:timezone",
108
- "timezones": "timezones",
109
- "venue": "venue/:venue",
110
- "venue/city": "venue/:venue/city/:city",
111
- "venues": "venues",
112
- "venues/city": "venues/city/:city",
113
- "theme": "theme/:theme",
114
- "theme/cover": "theme/:theme/cover/:cover",
115
- "themes": "themes",
116
- "themes/cover": "themes/cover/:cover",
117
- "themes/games": "themes/games",
118
- "game": "game/:game",
119
- "game/city": "game/:game/city/:city",
120
- "game/registration": "game/:game/registration/:registration",
121
- "game/registrations": "game/:game/registrations",
122
- "game/registrations/export": "game/:game/registrations/export/:export",
123
- "game/summary": "game/:game/summary/:summary",
124
- "game/theme": "game/:game/theme/:theme",
125
- "game/theme/cover": "game/:game/theme/:theme/cover/:cover",
126
- "game/venue": "game/:game/venue/:venue",
127
- "games": "games",
128
- "games/city": "games/city/:city",
129
- "games/registrations": "games/registrations",
130
- "games/registrations/export": "games/registrations/export/:export",
131
- "games/summary": "games/summary/:summary",
132
- "games/theme": "games/theme/:theme",
133
- "games/theme/cover": "games/theme/:theme/cover/:cover",
134
- "games/venue": "games/venue/:venue",
135
- "registration": "registration/:registration",
136
- "registration/cancellation": "registration/:registration/cancellation/:cancellation",
137
- "registration/channel": "registration/:registration/channel/:channel",
138
- "registration/confirmation": "registration/:registration/confirmation/:confirmation",
139
- "registration/export": "registration/:registration/export/:export",
140
- "registration/city": "registration/:registration/city/:city",
141
- "registration/game": "registration/:registration/game/:game",
142
- "registration/game/theme": "registration/:registration/game/:game/theme/:theme",
143
- "registration/game/theme/cover": "registration/:registration/game/:game/theme/:theme/cover/:cover",
144
- "registration/game/venue": "registration/:registration/game/:game/venue/:venue",
145
- "registration/mailing": "registration/:registration/mailing/:mailing",
146
- "registrations": "registrations",
147
- "registrations/city": "registrations/city/:city",
148
- "registrations/game": "registrations/game/:game",
149
- "registrations/game/theme": "registrations/game/:game/theme/:theme",
150
- "registrations/export": "registrations/export/:export"
151
- }))
152
-
153
- export const PathnameRoute = Object.freeze(/** @type {const} */ ({
154
- "role/:role": "role",
155
- "roles": "roles",
156
- "user/:user": "user",
157
- "user/:user/password/:password": "user/password",
158
- "user/:user/role/:role": "user/role",
159
- "user/:user/city/:city": "user/city",
160
- "user/:user/cities": "user/cities",
161
- "users": "users",
162
- "users/password/:password": "users/password",
163
- "users/role/:role": "users/role",
164
- "users/cities": "users/cities",
165
- "checkin/:checkin": "checkin",
166
- "cities": "cities",
167
- "cities/country/:country": "cities/country",
168
- "cities/currency/:currency": "cities/currency",
169
- "cities/timezone/:timezone": "cities/timezone",
170
- "cities/venues": "cities/venues",
171
- "city/:city": "city",
172
- "city/:city/vk_group_token/:vk_group_token": "city/vk_group_token",
173
- "city/:city/country/:country": "city/country",
174
- "city/:city/currency/:currency": "city/currency",
175
- "city/:city/timezone/:timezone": "city/timezone",
176
- "city/:city/venue/:venue": "city/venue",
177
- "city/:city/venues": "city/venues",
178
- "country/:country": "country",
179
- "countries": "countries",
180
- "currency/:currency": "currency",
181
- "currencies": "currencies",
182
- "timezone/:timezone": "timezone",
183
- "timezones": "timezones",
184
- "venue/:venue": "venue",
185
- "venue/:venue/city/:city": "venue/city",
186
- "venues": "venues",
187
- "venues/city/:city": "venues/city",
188
- "theme/:theme": "theme",
189
- "theme/:theme/cover/:cover": "theme/cover",
190
- "themes": "themes",
191
- "themes/cover/:cover": "themes/cover",
192
- "themes/games": "themes/games",
193
- "game/:game": "game",
194
- "game/:game/city/:city": "game/city",
195
- "game/:game/registration/:registration": "game/registration",
196
- "game/:game/registrations": "game/registrations",
197
- "game/:game/registrations/export/:export": "game/registrations/export",
198
- "game/:game/summary/:summary": "game/summary",
199
- "game/:game/theme/:theme": "game/theme",
200
- "game/:game/theme/:theme/cover/:cover": "game/theme/cover",
201
- "game/:game/venue/:venue": "game/venue",
202
- "games": "games",
203
- "games/city/:city": "games/city",
204
- "games/registrations": "games/registrations",
205
- "games/registrations/export/:export": "games/registrations/export",
206
- "games/summary/:summary": "games/summary",
207
- "games/theme/:theme": "games/theme",
208
- "games/theme/:theme/cover/:cover": "games/theme/cover",
209
- "games/venue/:venue": "games/venue",
210
- "registration/:registration": "registration",
211
- "registration/:registration/cancellation/:cancellation": "registration/cancellation",
212
- "registration/:registration/channel/:channel": "registration/channel",
213
- "registration/:registration/confirmation/:confirmation": "registration/confirmation",
214
- "registration/:registration/export/:export": "registration/export",
215
- "registration/:registration/city/:city": "registration/city",
216
- "registration/:registration/game/:game": "registration/game",
217
- "registration/:registration/game/:game/theme/:theme": "registration/game/theme",
218
- "registration/:registration/game/:game/theme/:theme/cover/:cover": "registration/game/theme/cover",
219
- "registration/:registration/game/:game/venue/:venue": "registration/game/venue",
220
- "registration/:registration/mailing/:mailing": "registration/mailing",
221
- "registrations": "registrations",
222
- "registrations/city/:city": "registrations/city",
223
- "registrations/game/:game": "registrations/game",
224
- "registrations/game/:game/theme/:theme": "registrations/game/theme",
225
- "registrations/export/:export": "registrations/export"
226
- }))