@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,151 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteRelations = Object.freeze( /** @type {const} */ ([
4
- "role",
5
- "role",
6
- "user",
7
- "user/password",
8
- "user/role",
9
- "user/city",
10
- "user/cities",
11
- "user",
12
- "user/password",
13
- "user/role",
14
- "user/cities",
15
- "checkin",
16
- "city",
17
- "city/country",
18
- "city/currency",
19
- "city/timezone",
20
- "city/venues",
21
- "city",
22
- "city/vk_group_token",
23
- "city/country",
24
- "city/currency",
25
- "city/timezone",
26
- "city/venue",
27
- "city/venues",
28
- "country",
29
- "country",
30
- "currency",
31
- "currency",
32
- "timezone",
33
- "timezone",
34
- "venue",
35
- "venue/city",
36
- "venue",
37
- "venue/city",
38
- "theme",
39
- "theme/cover",
40
- "theme",
41
- "theme/cover",
42
- "theme/games",
43
- "game",
44
- "game/city",
45
- "game/registration",
46
- "game/registrations",
47
- "game/registrations/export",
48
- "game/summary",
49
- "game/theme",
50
- "game/theme/cover",
51
- "game/venue",
52
- "game",
53
- "game/city",
54
- "game/registrations",
55
- "game/registrations/export",
56
- "game/summary",
57
- "game/theme",
58
- "game/theme/cover",
59
- "game/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
- "registration",
72
- "registration/city",
73
- "registration/game",
74
- "registration/game/theme",
75
- "registration/export"
76
- ]))
77
-
78
- export const RouteRelation = Object.freeze(/** @type {const} */ ({
79
- "role": "role",
80
- "roles": "role",
81
- "user": "user",
82
- "user/password": "user/password",
83
- "user/role": "user/role",
84
- "user/city": "user/city",
85
- "user/cities": "user/cities",
86
- "users": "user",
87
- "users/password": "user/password",
88
- "users/role": "user/role",
89
- "users/cities": "user/cities",
90
- "checkin": "checkin",
91
- "cities": "city",
92
- "cities/country": "city/country",
93
- "cities/currency": "city/currency",
94
- "cities/timezone": "city/timezone",
95
- "cities/venues": "city/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/venues",
103
- "country": "country",
104
- "countries": "country",
105
- "currency": "currency",
106
- "currencies": "currency",
107
- "timezone": "timezone",
108
- "timezones": "timezone",
109
- "venue": "venue",
110
- "venue/city": "venue/city",
111
- "venues": "venue",
112
- "venues/city": "venue/city",
113
- "theme": "theme",
114
- "theme/cover": "theme/cover",
115
- "themes": "theme",
116
- "themes/cover": "theme/cover",
117
- "themes/games": "theme/games",
118
- "game": "game",
119
- "game/city": "game/city",
120
- "game/registration": "game/registration",
121
- "game/registrations": "game/registrations",
122
- "game/registrations/export": "game/registrations/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": "game",
128
- "games/city": "game/city",
129
- "games/registrations": "game/registrations",
130
- "games/registrations/export": "game/registrations/export",
131
- "games/summary": "game/summary",
132
- "games/theme": "game/theme",
133
- "games/theme/cover": "game/theme/cover",
134
- "games/venue": "game/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": "registration",
147
- "registrations/city": "registration/city",
148
- "registrations/game": "registration/game",
149
- "registrations/game/theme": "registration/game/theme",
150
- "registrations/export": "registration/export"
151
- }))
@@ -1,181 +0,0 @@
1
- /* --- AUTOGENERATED --- */
2
-
3
- export const RouteServices = Object.freeze( /** @type {const} */ ([
4
- "Roles",
5
- "Users",
6
- "Checkin",
7
- "Cities",
8
- "Locations",
9
- "Venues",
10
- "Themes",
11
- "Games",
12
- "Registrations"
13
- ]))
14
-
15
- export const RouteService = Object.freeze(/** @type {const} */ ({
16
- "role": "Roles",
17
- "roles": "Roles",
18
- "user": "Users",
19
- "user/password": "Users",
20
- "user/role": "Users",
21
- "user/city": "Users",
22
- "user/cities": "Users",
23
- "users": "Users",
24
- "users/password": "Users",
25
- "users/role": "Users",
26
- "users/cities": "Users",
27
- "checkin": "Checkin",
28
- "cities": "Cities",
29
- "cities/country": "Cities",
30
- "cities/currency": "Cities",
31
- "cities/timezone": "Cities",
32
- "cities/venues": "Cities",
33
- "city": "Cities",
34
- "city/vk_group_token": "Cities",
35
- "city/country": "Cities",
36
- "city/currency": "Cities",
37
- "city/timezone": "Cities",
38
- "city/venue": "Cities",
39
- "city/venues": "Cities",
40
- "country": "Locations",
41
- "countries": "Locations",
42
- "currency": "Locations",
43
- "currencies": "Locations",
44
- "timezone": "Locations",
45
- "timezones": "Locations",
46
- "venue": "Venues",
47
- "venue/city": "Venues",
48
- "venues": "Venues",
49
- "venues/city": "Venues",
50
- "theme": "Themes",
51
- "theme/cover": "Themes",
52
- "themes": "Themes",
53
- "themes/cover": "Themes",
54
- "themes/games": "Themes",
55
- "game": "Games",
56
- "game/city": "Games",
57
- "game/registration": "Games",
58
- "game/registrations": "Games",
59
- "game/registrations/export": "Games",
60
- "game/summary": "Games",
61
- "game/theme": "Games",
62
- "game/theme/cover": "Games",
63
- "game/venue": "Games",
64
- "games": "Games",
65
- "games/city": "Games",
66
- "games/registrations": "Games",
67
- "games/registrations/export": "Games",
68
- "games/summary": "Games",
69
- "games/theme": "Games",
70
- "games/theme/cover": "Games",
71
- "games/venue": "Games",
72
- "registration": "Registrations",
73
- "registration/cancellation": "Registrations",
74
- "registration/channel": "Registrations",
75
- "registration/confirmation": "Registrations",
76
- "registration/export": "Registrations",
77
- "registration/city": "Registrations",
78
- "registration/game": "Registrations",
79
- "registration/game/theme": "Registrations",
80
- "registration/game/theme/cover": "Registrations",
81
- "registration/game/venue": "Registrations",
82
- "registration/mailing": "Registrations",
83
- "registrations": "Registrations",
84
- "registrations/city": "Registrations",
85
- "registrations/game": "Registrations",
86
- "registrations/game/theme": "Registrations",
87
- "registrations/export": "Registrations"
88
- }))
89
-
90
- export const ServiceRoutes = Object.freeze(/** @type {const} */ ({
91
- "Roles": [
92
- "role",
93
- "roles"
94
- ],
95
- "Users": [
96
- "user",
97
- "user/password",
98
- "user/role",
99
- "user/city",
100
- "user/cities",
101
- "users",
102
- "users/password",
103
- "users/role",
104
- "users/cities"
105
- ],
106
- "Checkin": [
107
- "checkin"
108
- ],
109
- "Cities": [
110
- "cities",
111
- "cities/country",
112
- "cities/currency",
113
- "cities/timezone",
114
- "cities/venues",
115
- "city",
116
- "city/vk_group_token",
117
- "city/country",
118
- "city/currency",
119
- "city/timezone",
120
- "city/venue",
121
- "city/venues"
122
- ],
123
- "Locations": [
124
- "country",
125
- "countries",
126
- "currency",
127
- "currencies",
128
- "timezone",
129
- "timezones"
130
- ],
131
- "Venues": [
132
- "venue",
133
- "venue/city",
134
- "venues",
135
- "venues/city"
136
- ],
137
- "Themes": [
138
- "theme",
139
- "theme/cover",
140
- "themes",
141
- "themes/cover",
142
- "themes/games"
143
- ],
144
- "Games": [
145
- "game",
146
- "game/city",
147
- "game/registration",
148
- "game/registrations",
149
- "game/registrations/export",
150
- "game/summary",
151
- "game/theme",
152
- "game/theme/cover",
153
- "game/venue",
154
- "games",
155
- "games/city",
156
- "games/registrations",
157
- "games/registrations/export",
158
- "games/summary",
159
- "games/theme",
160
- "games/theme/cover",
161
- "games/venue"
162
- ],
163
- "Registrations": [
164
- "registration",
165
- "registration/cancellation",
166
- "registration/channel",
167
- "registration/confirmation",
168
- "registration/export",
169
- "registration/city",
170
- "registration/game",
171
- "registration/game/theme",
172
- "registration/game/theme/cover",
173
- "registration/game/venue",
174
- "registration/mailing",
175
- "registrations",
176
- "registrations/city",
177
- "registrations/game",
178
- "registrations/game/theme",
179
- "registrations/export"
180
- ]
181
- }))
@@ -1,6 +0,0 @@
1
- export const Runtime = Object.freeze({
2
- 'Bun': 'Bun',
3
- 'Deno': 'Deno',
4
- 'Node': 'Node',
5
- 'Vite': 'Vite',
6
- })
@@ -1,22 +0,0 @@
1
- export const Service = Object.freeze({
2
- 'Users': 'Users',
3
- 'Roles': 'Roles',
4
- 'Checkin': 'Checkin',
5
- 'Locations': 'Locations',
6
- 'Cities': 'Cities',
7
- 'Venues': 'Venues',
8
- 'Themes': 'Themes',
9
- 'Games': 'Games',
10
- 'Registrations': 'Registrations',
11
- 'Files': 'Files',
12
- 'Procedures': 'Procedures',
13
- 'Integrations': 'Integrations',
14
- 'Updates': 'Updates',
15
- 'Hub': 'Hub',
16
- 'Landing': 'Landing',
17
- 'Telegram': 'Telegram',
18
- 'Vkma': 'Vkma',
19
- 'Minio': 'Minio',
20
- })
21
-
22
- export const Services = Object.freeze(Object.values(Service))
@@ -1,29 +0,0 @@
1
- import { RouteParameter } from '../entities/route-parameter.js'
2
- import { RoutePathname } from '../entities/route-pathname.js'
3
- import { Route } from '../entities/route.js'
4
-
5
- import { access } from './access.js'
6
-
7
- export const hydrateRoutePathname = Object.freeze(
8
- /**
9
- * @template {keyof typeof import('../system/route.js').Route} RouteTemplate
10
- *
11
- * @param {RouteTemplate} maybeRoute
12
- * @param {any[]} maybeParams
13
- */
14
- (maybeRoute, maybeParams) => {
15
- if (!Array.isArray(maybeParams))
16
- throw TypeError(`Parameter 'params' must be 'Array'.`)
17
-
18
- var route = access(Route, maybeRoute)
19
-
20
- var pathname = access(RoutePathname, route)
21
-
22
- var params = access(RouteParameter, route)
23
-
24
- return params
25
- .split('/')
26
- .filter(Boolean)
27
- .reduce((pathname, param, index) => pathname.replace(param, maybeParams[index]), pathname)
28
- },
29
- )