@shakerquiz/utilities 0.5.43 → 0.5.45
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,52 +1,52 @@
|
|
|
1
1
|
export var Feature = /** @type {const} */ ({
|
|
2
|
-
'users': 'users',
|
|
3
|
-
'user': 'user',
|
|
4
|
-
'roles': 'roles',
|
|
5
2
|
'role': 'role',
|
|
6
|
-
'
|
|
3
|
+
'roles': 'roles',
|
|
4
|
+
'user': 'user',
|
|
5
|
+
'users': 'users',
|
|
7
6
|
'checkin': 'checkin',
|
|
8
|
-
'
|
|
7
|
+
'checkins': 'checkins',
|
|
9
8
|
'country': 'country',
|
|
10
|
-
'
|
|
9
|
+
'countries': 'countries',
|
|
11
10
|
'currency': 'currency',
|
|
12
|
-
'
|
|
11
|
+
'currencies': 'currencies',
|
|
13
12
|
'city': 'city',
|
|
14
|
-
'
|
|
13
|
+
'cities': 'cities',
|
|
15
14
|
'venue': 'venue',
|
|
16
|
-
'
|
|
17
|
-
'game': 'game',
|
|
18
|
-
'themes': 'themes',
|
|
15
|
+
'venues': 'venues',
|
|
19
16
|
'theme': 'theme',
|
|
20
|
-
'
|
|
17
|
+
'themes': 'themes',
|
|
18
|
+
'game': 'game',
|
|
19
|
+
'games': 'games',
|
|
21
20
|
'registration': 'registration',
|
|
22
|
-
'
|
|
21
|
+
'registrations': 'registrations',
|
|
23
22
|
'mailing': 'mailing',
|
|
23
|
+
'mailings': 'mailings',
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
export var Features = Object.values(Feature)
|
|
27
27
|
|
|
28
28
|
/** @type {Record<Feature, Icon>} */
|
|
29
29
|
export var FeatureIcon = {
|
|
30
|
-
[Feature.users]: 'hero/solid/users',
|
|
31
|
-
[Feature.user]: 'hero/solid/users',
|
|
32
|
-
[Feature.roles]: 'hero/solid/identification',
|
|
33
30
|
[Feature.role]: 'hero/solid/identification',
|
|
34
|
-
[Feature.
|
|
31
|
+
[Feature.roles]: 'hero/solid/identification',
|
|
32
|
+
[Feature.user]: 'hero/solid/users',
|
|
33
|
+
[Feature.users]: 'hero/solid/users',
|
|
35
34
|
[Feature.checkin]: 'arrow-right-end-on-rectangle',
|
|
36
|
-
[Feature.
|
|
35
|
+
[Feature.checkins]: 'arrow-right-end-on-rectangle',
|
|
37
36
|
[Feature.country]: 'hero/outline/no-symbol',
|
|
38
|
-
[Feature.
|
|
37
|
+
[Feature.countries]: 'hero/outline/no-symbol',
|
|
39
38
|
[Feature.currency]: 'hero/outline/banknotes',
|
|
40
|
-
[Feature.
|
|
39
|
+
[Feature.currencies]: 'hero/outline/banknotes',
|
|
41
40
|
[Feature.city]: 'hero/outline/building-office',
|
|
42
|
-
[Feature.
|
|
41
|
+
[Feature.cities]: 'hero/outline/building-office',
|
|
43
42
|
[Feature.venue]: 'hero/outline/map-pin',
|
|
44
|
-
[Feature.
|
|
45
|
-
[Feature.game]: 'hero/outline/newspaper',
|
|
46
|
-
[Feature.themes]: 'hero/outline/document-text',
|
|
43
|
+
[Feature.venues]: 'hero/outline/map-pin',
|
|
47
44
|
[Feature.theme]: 'hero/outline/document-text',
|
|
48
|
-
[Feature.
|
|
45
|
+
[Feature.themes]: 'hero/outline/document-text',
|
|
46
|
+
[Feature.game]: 'hero/outline/newspaper',
|
|
47
|
+
[Feature.games]: 'hero/outline/newspaper',
|
|
49
48
|
[Feature.registration]: 'hero/outline/user-group',
|
|
50
|
-
[Feature.
|
|
49
|
+
[Feature.registrations]: 'hero/outline/user-group',
|
|
51
50
|
[Feature.mailing]: 'hero/outline/envelope',
|
|
51
|
+
[Feature.mailings]: 'hero/outline/envelope',
|
|
52
52
|
}
|
|
@@ -3,6 +3,7 @@ export var Route = /** @type {const} */ ({
|
|
|
3
3
|
'roles': 'roles',
|
|
4
4
|
'user': 'user',
|
|
5
5
|
'users': 'users',
|
|
6
|
+
'checkin': 'checkin',
|
|
6
7
|
'user/password': 'user/password',
|
|
7
8
|
'user/role': 'user/role',
|
|
8
9
|
'user/cities': 'user/cities',
|
|
@@ -12,6 +13,7 @@ export var Route = /** @type {const} */ ({
|
|
|
12
13
|
'cities': 'cities',
|
|
13
14
|
'city/venues': 'city/venues',
|
|
14
15
|
'venue': 'venue',
|
|
16
|
+
'venues': 'venues',
|
|
15
17
|
'theme': 'theme',
|
|
16
18
|
'themes': 'themes',
|
|
17
19
|
'theme/cover': 'theme/cover',
|
|
@@ -19,7 +21,9 @@ export var Route = /** @type {const} */ ({
|
|
|
19
21
|
'game': 'game',
|
|
20
22
|
'games': 'games',
|
|
21
23
|
'registration': 'registration',
|
|
24
|
+
'registration/mailing': 'registration/mailing',
|
|
22
25
|
'registrations': 'registrations',
|
|
26
|
+
'mailing': 'mailing',
|
|
23
27
|
})
|
|
24
28
|
|
|
25
29
|
export var Routes = Object.values(Route)
|
|
@@ -29,6 +33,7 @@ export var RoutePathname = /** @type {const} */ ({
|
|
|
29
33
|
[Route['roles']]: 'roles',
|
|
30
34
|
[Route['user']]: 'user/:user',
|
|
31
35
|
[Route['users']]: 'users',
|
|
36
|
+
[Route['checkin']]: 'checkin',
|
|
32
37
|
[Route['user/password']]: 'user/:user/password',
|
|
33
38
|
[Route['user/role']]: 'user/:user/role',
|
|
34
39
|
[Route['user/cities']]: 'user/:user/cities',
|
|
@@ -38,6 +43,7 @@ export var RoutePathname = /** @type {const} */ ({
|
|
|
38
43
|
[Route['cities']]: 'cities',
|
|
39
44
|
[Route['city/venues']]: 'city/:city/venues',
|
|
40
45
|
[Route['venue']]: 'venue/:venue',
|
|
46
|
+
[Route['venues']]: 'venues',
|
|
41
47
|
[Route['theme']]: 'theme/:theme',
|
|
42
48
|
[Route['themes']]: 'themes',
|
|
43
49
|
[Route['theme/cover']]: 'theme/:theme/cover',
|
|
@@ -45,7 +51,67 @@ export var RoutePathname = /** @type {const} */ ({
|
|
|
45
51
|
[Route['game']]: 'game/:game',
|
|
46
52
|
[Route['games']]: 'games',
|
|
47
53
|
[Route['registration']]: 'registration/:registration',
|
|
54
|
+
[Route['registration/mailing']]: 'registration/:registration/mailing',
|
|
48
55
|
[Route['registrations']]: 'registrations',
|
|
56
|
+
[Route['mailing']]: 'mailing/:mailing',
|
|
49
57
|
})
|
|
50
58
|
|
|
51
59
|
export var RoutePathnames = Object.values(RoutePathname)
|
|
60
|
+
|
|
61
|
+
export var RouteParams = /** @type {const} */ ({
|
|
62
|
+
[Route['role']]: [':role'],
|
|
63
|
+
[Route['user']]: [':user'],
|
|
64
|
+
[Route['user/password']]: [':user'],
|
|
65
|
+
[Route['user/role']]: [':user'],
|
|
66
|
+
[Route['user/cities']]: [':user'],
|
|
67
|
+
[Route['city']]: [':city'],
|
|
68
|
+
[Route['city/venues']]: [':city'],
|
|
69
|
+
[Route['venue']]: [':venue'],
|
|
70
|
+
[Route['theme']]: [':theme'],
|
|
71
|
+
[Route['theme/cover']]: [':theme'],
|
|
72
|
+
[Route['game']]: [':game'],
|
|
73
|
+
[Route['registration']]: [':registration'],
|
|
74
|
+
[Route['registration/mailing']]: [':registration'],
|
|
75
|
+
[Route['mailing']]: [':mailing'],
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
export var RouteService = {
|
|
79
|
+
[Route['role']]: 'Users',
|
|
80
|
+
[Route['roles']]: 'Users',
|
|
81
|
+
[Route['user']]: 'Users',
|
|
82
|
+
[Route['users']]: 'Users',
|
|
83
|
+
[Route['checkin']]: 'Checkin',
|
|
84
|
+
[Route['user/password']]: 'Users',
|
|
85
|
+
[Route['user/role']]: 'Users',
|
|
86
|
+
[Route['user/cities']]: 'Users',
|
|
87
|
+
[Route['users/role']]: 'Users',
|
|
88
|
+
[Route['users/cities']]: 'Users',
|
|
89
|
+
[Route['city']]: 'Cities',
|
|
90
|
+
[Route['cities']]: 'Cities',
|
|
91
|
+
[Route['city/venues']]: 'Cities',
|
|
92
|
+
[Route['venue']]: 'Venues',
|
|
93
|
+
[Route['venues']]: 'Venues',
|
|
94
|
+
[Route['theme']]: 'Themes',
|
|
95
|
+
[Route['themes']]: 'Themes',
|
|
96
|
+
[Route['theme/cover']]: 'Themes',
|
|
97
|
+
[Route['themes/covers']]: 'Themes',
|
|
98
|
+
[Route['game']]: 'Games',
|
|
99
|
+
[Route['games']]: 'Games',
|
|
100
|
+
[Route['registration']]: 'Games',
|
|
101
|
+
[Route['registration/mailing']]: 'Games',
|
|
102
|
+
[Route['registrations']]: 'Games',
|
|
103
|
+
[Route['mailing']]: 'Games',
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @template {Route} R
|
|
108
|
+
* @template {typeof RouteParams[R]} P
|
|
109
|
+
*
|
|
110
|
+
* @param {R} route
|
|
111
|
+
* @param {Record<P[number] extends `:${infer Name}` ? Name : P[number], string>} params
|
|
112
|
+
*/
|
|
113
|
+
export var hydrateRoutePathname = (route, params) =>
|
|
114
|
+
RouteParams[route].reduce(
|
|
115
|
+
(pathname, param) => pathname.replace(param, params[param.replace(':', '')]),
|
|
116
|
+
RoutePathname[route],
|
|
117
|
+
)
|
package/source/misc.d.ts
CHANGED
|
@@ -60,3 +60,5 @@ type VenueStatus = keyof typeof import('./enumerations/entities/venue-status.js'
|
|
|
60
60
|
type Icon = typeof import('./enumerations/misc/icons.js').Icons[number]
|
|
61
61
|
|
|
62
62
|
type Phase = keyof typeof import('./enumerations/misc/phases.js').Phase
|
|
63
|
+
|
|
64
|
+
type Route = keyof typeof import('./enumerations/misc/routes.js').Route
|