@shakerquiz/utilities 0.6.18 → 2.0.0
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/dprint.json +4 -1
- package/package.json +13 -7
- package/source/enumerations/core/features.d.ts +40 -0
- package/source/enumerations/core/features.js +205 -0
- package/source/enumerations/core/kinds.d.ts +1 -0
- package/source/enumerations/core/kinds.js +4 -0
- package/source/enumerations/core/methods.d.ts +8 -0
- package/source/enumerations/core/methods.js +25 -0
- package/source/enumerations/core/networks.d.ts +1 -0
- package/source/enumerations/core/networks.js +4 -0
- package/source/enumerations/core/runtimes.d.ts +1 -0
- package/source/enumerations/core/runtimes.js +4 -0
- package/source/enumerations/core/scopes.d.ts +5 -0
- package/source/enumerations/core/scopes.js +27 -0
- package/source/enumerations/entities/city-affilations.d.ts +1 -0
- package/source/enumerations/entities/city-affilations.js +4 -0
- package/source/enumerations/entities/game-statuses.d.ts +1 -0
- package/source/enumerations/entities/game-statuses.js +11 -0
- package/source/enumerations/entities/registration-attributes.d.ts +2 -0
- package/source/enumerations/entities/registration-attributes.js +57 -0
- package/source/enumerations/entities/registration-channels.d.ts +1 -0
- package/source/enumerations/entities/registration-channels.js +5 -0
- package/source/enumerations/entities/registration-lineups.d.ts +5 -0
- package/source/enumerations/entities/registration-lineups.js +43 -0
- package/source/enumerations/entities/registration-mailings.d.ts +1 -0
- package/source/enumerations/entities/registration-mailings.js +6 -0
- package/source/enumerations/entities/registration-statuses.d.ts +5 -0
- package/source/enumerations/entities/registration-statuses.js +54 -0
- package/source/enumerations/entities/roles.d.ts +1 -0
- package/source/enumerations/entities/roles.js +5 -0
- package/source/enumerations/entities/venue-statuses.d.ts +1 -0
- package/source/enumerations/entities/venue-statuses.js +4 -0
- package/source/enumerations/misc/constants.d.ts +3 -0
- package/source/{entities → enumerations/misc}/constants.js +1 -1
- package/source/enumerations/misc/cookies.d.ts +5 -0
- package/source/enumerations/misc/cookies.js +5 -0
- package/source/enumerations/misc/icons.d.ts +1 -0
- package/source/enumerations/misc/icons.js +326 -0
- package/source/enumerations/misc/phases.d.ts +1 -0
- package/source/enumerations/misc/phases.js +7 -0
- package/source/enumerations/misc/regexps.d.ts +5 -0
- package/source/enumerations/misc/regexps.js +6 -0
- package/source/functions/tag.d.ts +1 -0
- package/source/functions/tag.js +5 -0
- package/source/index.d.ts +27 -0
- package/source/index.js +24 -40
- package/source/misc.d.ts +79 -0
- package/source/schemas/PATCH/Game/admin/schema.json +34 -0
- package/source/schemas/PATCH/Game/default/schema.json +6 -0
- package/source/schemas/PATCH/Game/organizer/schema.json +34 -0
- package/source/schemas/PATCH/Registration/admin/schema.json +6 -0
- package/source/schemas/PATCH/Registration/default/schema.json +104 -0
- package/source/schemas/PATCH/Registration/organizer/schema.json +43 -0
- package/source/schemas/PATCH/Venue/admin/schema.json +40 -0
- package/source/schemas/PATCH/Venue/default/schema.json +6 -0
- package/source/schemas/PATCH/Venue/organizer/schema.json +43 -0
- package/source/schemas/POST/Game/admin/schema.json +27 -0
- package/source/schemas/POST/Game/default/schema.json +27 -0
- package/source/schemas/POST/Game/organizer/schema.json +27 -0
- package/source/schemas/POST/Mailing/admin/schema.json +6 -0
- package/source/schemas/POST/Mailing/default/schema.json +6 -0
- package/source/schemas/POST/Mailing/organizer/schema.json +12 -0
- package/source/schemas/POST/Registration/admin/schema.json +6 -0
- package/source/schemas/POST/Registration/default/schema.json +125 -0
- package/source/schemas/POST/Registration/organizer/schema.json +6 -0
- package/source/schemas/POST/Venue/admin/schema.json +6 -0
- package/source/schemas/POST/Venue/default/schema.json +6 -0
- package/source/schemas/POST/Venue/organizer/schema.json +49 -0
- package/source/schemas/game.schema.json +93 -0
- package/source/schemas/registration.schema.json +123 -0
- package/source/schemas/theme.schema.json +48 -0
- package/source/schemas/venue.schema.json +56 -0
- package/source/scope.d.ts +874 -0
- package/source/server.d.ts +5 -0
- package/source/tables.d.ts +187 -0
- package/.github/workflows/publish.yml +0 -31
- package/scripts/route-cardinality.js +0 -23
- package/scripts/route-parameter.js +0 -29
- package/scripts/route-pathname.js +0 -37
- package/scripts/route-relation.js +0 -26
- package/scripts/route-service.js +0 -25
- package/scripts/templates/route-cardinality.js +0 -5
- package/scripts/templates/route-parameter.js +0 -5
- package/scripts/templates/route-pathname.js +0 -7
- package/scripts/templates/route-relation.js +0 -5
- package/scripts/templates/route-service.js +0 -7
- package/source/entities/blend.js +0 -5
- package/source/entities/cardinality.js +0 -4
- package/source/entities/category.js +0 -4
- package/source/entities/city-affilation.js +0 -10
- package/source/entities/city-chatapp-version.js +0 -9
- package/source/entities/display.js +0 -4
- package/source/entities/game-status.js +0 -98
- package/source/entities/gender.js +0 -13
- package/source/entities/icon.js +0 -654
- package/source/entities/key.js +0 -41
- package/source/entities/method.js +0 -22
- package/source/entities/mode.js +0 -9
- package/source/entities/network.js +0 -9
- package/source/entities/numerosity.js +0 -5
- package/source/entities/pattern.js +0 -7
- package/source/entities/phase.js +0 -15
- package/source/entities/quantifier.js +0 -41
- package/source/entities/registration-attribute.js +0 -61
- package/source/entities/registration-channel.js +0 -11
- package/source/entities/registration-lineup.js +0 -14
- package/source/entities/registration-mailing.js +0 -20
- package/source/entities/registration-status.js +0 -19
- package/source/entities/role.js +0 -16
- package/source/entities/route-cardinality.js +0 -149
- package/source/entities/route-parameter.js +0 -149
- package/source/entities/route-pathname.js +0 -223
- package/source/entities/route-relation.js +0 -149
- package/source/entities/route-service.js +0 -179
- package/source/entities/route.js +0 -82
- package/source/entities/runtime.js +0 -6
- package/source/entities/segment.js +0 -255
- package/source/entities/service-runtime.js +0 -22
- package/source/entities/service.js +0 -22
- package/source/entities/theme-status.js +0 -9
- package/source/entities/venue-audience.js +0 -9
- package/source/entities/venue-status.js +0 -9
- package/source/helpers/access.js +0 -161
- package/source/helpers/hydrate-route-pathname.js +0 -29
- package/source/helpers/tag.js +0 -35
package/dprint.json
CHANGED
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
],
|
|
20
20
|
"plugins": [
|
|
21
21
|
"https://plugins.dprint.dev/typescript-0.93.0.wasm",
|
|
22
|
-
"https://plugins.dprint.dev/json-0.19.3.wasm"
|
|
22
|
+
"https://plugins.dprint.dev/json-0.19.3.wasm",
|
|
23
|
+
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
|
|
24
|
+
"https://plugins.dprint.dev/dockerfile-0.3.2.wasm",
|
|
25
|
+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
|
|
23
26
|
]
|
|
24
27
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@shakerquiz/utilities",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "yurkimus <yurkimus@gmail.com>",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"
|
|
8
|
-
"type": "
|
|
9
|
-
"url": "https://github.com/shaker-quiz/utilities.git"
|
|
7
|
+
"scripts": {
|
|
8
|
+
"type": "tsc --declaration --emitdeclarationonly --allowjs"
|
|
10
9
|
},
|
|
11
10
|
"exports": {
|
|
12
|
-
"
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./source/index.d.ts",
|
|
13
|
+
"default": "./source/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./schemas/*.json": "./source/schemas/*.json"
|
|
13
16
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"urlpattern-polyfill": "10.1.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "5.8.3"
|
|
16
22
|
}
|
|
17
23
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const Domains: readonly ["User", "Role", "Country", "Currency", "City", "Venue", "Theme", "Game", "Registration"];
|
|
2
|
+
/**
|
|
3
|
+
* @type {Record<Domain, Icon>}
|
|
4
|
+
*/
|
|
5
|
+
export const DomainIcon: Record<Domain, Icon>;
|
|
6
|
+
/**
|
|
7
|
+
* @type {Record<Domain, Record<Kind, string>>}
|
|
8
|
+
*/
|
|
9
|
+
export const DomainKindPathname: Record<Domain, Record<Kind, string>>;
|
|
10
|
+
export const Procedures: readonly ["Checkin", "Redirect"];
|
|
11
|
+
/**
|
|
12
|
+
* @type {Record<Procedure, Icon>}
|
|
13
|
+
*/
|
|
14
|
+
export const ProcedureIcon: Record<Procedure, Icon>;
|
|
15
|
+
/**
|
|
16
|
+
* @type {Record<Procedure, Record<Kind, string>>}
|
|
17
|
+
*/
|
|
18
|
+
export const ProcedureKindPathname: Record<Procedure, Record<Kind, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* @type {Array<Domain | Procedure>}
|
|
21
|
+
*/
|
|
22
|
+
export const Features: Array<Domain | Procedure>;
|
|
23
|
+
/**
|
|
24
|
+
* @type {Record<Feature, Icon>}
|
|
25
|
+
*/
|
|
26
|
+
export const FeatureIcon: Record<Feature, Icon>;
|
|
27
|
+
/**
|
|
28
|
+
* @type {Record<Feature, Record<Kind, string>>}
|
|
29
|
+
*/
|
|
30
|
+
export const FeatureKindPathname: Record<Feature, Record<Kind, string>>;
|
|
31
|
+
/**
|
|
32
|
+
* @type {Array<[feature: Feature, kind: Kind, pathname: string]>}
|
|
33
|
+
*/
|
|
34
|
+
export const FeatureKindPathnames: Array<[feature: Feature, kind: Kind, pathname: string]>;
|
|
35
|
+
/**
|
|
36
|
+
* @type {Array<[feature: Feature, kind: Kind, pattern: URLPattern]>}
|
|
37
|
+
*/
|
|
38
|
+
export const FeatureKindPatterns: Array<[feature: Feature, kind: Kind, pattern: URLPattern]>;
|
|
39
|
+
export function getPathname(feature: Feature, kind: Kind): string;
|
|
40
|
+
export function getPattern(feature: Feature, kind: Kind): any;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Kinds } from './kinds.js'
|
|
2
|
+
|
|
3
|
+
export var Domains = /** @type {const} */ ([
|
|
4
|
+
// 'Asset',
|
|
5
|
+
'User',
|
|
6
|
+
'Role',
|
|
7
|
+
'Country',
|
|
8
|
+
'Currency',
|
|
9
|
+
'City',
|
|
10
|
+
'Venue',
|
|
11
|
+
'Theme',
|
|
12
|
+
// 'ThemeAsset',
|
|
13
|
+
'Game',
|
|
14
|
+
// 'GameAsset',
|
|
15
|
+
'Registration',
|
|
16
|
+
'Mailing',
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {Record<Domain, Icon>}
|
|
21
|
+
*/
|
|
22
|
+
export var DomainIcon = {
|
|
23
|
+
'User': 'users',
|
|
24
|
+
'Role': 'identification',
|
|
25
|
+
'Country': 'no-symbol',
|
|
26
|
+
'Currency': 'no-symbol',
|
|
27
|
+
'City': 'building-office',
|
|
28
|
+
'Venue': 'map-pin',
|
|
29
|
+
'Theme': 'document-text',
|
|
30
|
+
'Game': 'newspaper',
|
|
31
|
+
'Registration': 'user-group',
|
|
32
|
+
'Mailing': 'envelope',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @type {Record<Domain, Record<Kind, string>>}
|
|
37
|
+
*/
|
|
38
|
+
export var DomainKindPathname = /** @type {const} */ ({
|
|
39
|
+
'User': {
|
|
40
|
+
'Unit': '/user/:user?',
|
|
41
|
+
'Set': '/users',
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
'Role': {
|
|
45
|
+
'Unit': '/role/:role?',
|
|
46
|
+
'Set': '/roles',
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
'Country': {
|
|
50
|
+
'Unit': '/country/:country?',
|
|
51
|
+
'Set': '/countries',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
'Currency': {
|
|
55
|
+
'Unit': '/currency/:currency?',
|
|
56
|
+
'Set': '/currencies',
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
'City': {
|
|
60
|
+
'Unit': '/city/:city?',
|
|
61
|
+
'Set': '/cities',
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
'Venue': {
|
|
65
|
+
'Unit': '/venue/:venue?',
|
|
66
|
+
'Set': '/venues',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
'Theme': {
|
|
70
|
+
'Unit': '/theme/:theme?',
|
|
71
|
+
'Set': '/themes',
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
'Game': {
|
|
75
|
+
/**
|
|
76
|
+
* Parameter "game" can be one of:
|
|
77
|
+
* - UUID of a Game,
|
|
78
|
+
* - Game alias combined with City (UUID, alias or VK group ID),
|
|
79
|
+
* - UUID of a Registration
|
|
80
|
+
*/
|
|
81
|
+
'Unit': '/game/:game?',
|
|
82
|
+
'Set': '/games',
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
'Registration': {
|
|
86
|
+
/**
|
|
87
|
+
* Parameter "registration" can be one of:
|
|
88
|
+
* - UUID of a Registration,
|
|
89
|
+
* - VK identifier of a Registration
|
|
90
|
+
*/
|
|
91
|
+
'Unit': '/registration/:registration?',
|
|
92
|
+
'Set': '/registrations',
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
'Mailing': {
|
|
96
|
+
'Unit': '/mailing/:mailing?',
|
|
97
|
+
'Set': '/mailings',
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
export var Procedures = /** @type {const} */ ([
|
|
102
|
+
'Checkin',
|
|
103
|
+
'Redirect',
|
|
104
|
+
])
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @type {Record<Procedure, Icon>}
|
|
108
|
+
*/
|
|
109
|
+
export var ProcedureIcon = {
|
|
110
|
+
'Checkin': 'arrow-right-end-on-rectangle',
|
|
111
|
+
'Redirect': 'no-symbol',
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @type {Record<Procedure, Record<Kind, string>>}
|
|
116
|
+
*/
|
|
117
|
+
export var ProcedureKindPathname = /** @type {const} */ ({
|
|
118
|
+
'Checkin': {
|
|
119
|
+
'Unit': '/checkin',
|
|
120
|
+
'Set': '/checkins',
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
'Redirect': {
|
|
124
|
+
'Unit': '/redirect',
|
|
125
|
+
'Set': '/redirects',
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @type {Array<Domain | Procedure>}
|
|
131
|
+
*/
|
|
132
|
+
export var Features = Domains.concat(Procedures)
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @type {Record<Feature, Icon>}
|
|
136
|
+
*/
|
|
137
|
+
export var FeatureIcon = {
|
|
138
|
+
...DomainIcon,
|
|
139
|
+
...ProcedureIcon,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @type {Record<Feature, Record<Kind, string>>}
|
|
144
|
+
*/
|
|
145
|
+
export var FeatureKindPathname = {
|
|
146
|
+
...DomainKindPathname,
|
|
147
|
+
...ProcedureKindPathname,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @type {Array<[feature: Feature, kind: Kind, pathname: string]>}
|
|
152
|
+
*/
|
|
153
|
+
export var FeatureKindPathnames = Object
|
|
154
|
+
.keys(FeatureKindPathname)
|
|
155
|
+
.flatMap(feature =>
|
|
156
|
+
Object
|
|
157
|
+
.keys(FeatureKindPathname[feature])
|
|
158
|
+
.map(kind => [feature, kind, FeatureKindPathname[feature][kind]])
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @type {Array<[feature: Feature, kind: Kind, pattern: URLPattern]>}
|
|
163
|
+
*/
|
|
164
|
+
export var FeatureKindPatterns = FeatureKindPathnames
|
|
165
|
+
.map(([feature, kind, pathname]) => [
|
|
166
|
+
feature,
|
|
167
|
+
kind,
|
|
168
|
+
new URLPattern({ pathname }),
|
|
169
|
+
])
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @param {Feature} feature
|
|
173
|
+
* @param {Kind} kind
|
|
174
|
+
*/
|
|
175
|
+
export var getPathname = (feature, kind) => {
|
|
176
|
+
if (!Features.includes(feature))
|
|
177
|
+
throw TypeError(
|
|
178
|
+
`[getPathname] Feature '${feature}' must be listed in 'Features'.`,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
if (!Kinds.includes(kind))
|
|
182
|
+
throw TypeError(
|
|
183
|
+
`[getPathname] Kind '${kind}' must be listed in 'Kinds'.`,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
return FeatureKindPathname[feature][kind]
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {Feature} feature
|
|
191
|
+
* @param {Kind} kind
|
|
192
|
+
*/
|
|
193
|
+
export var getPattern = (feature, kind) => {
|
|
194
|
+
if (!Features.includes(feature))
|
|
195
|
+
throw TypeError(
|
|
196
|
+
`[getPattern] Feature '${feature}' must be listed in 'Features'.`,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
if (!Kinds.includes(kind))
|
|
200
|
+
throw TypeError(
|
|
201
|
+
`[getPattern] Kind '${kind}' must be listed in 'Kinds'.`,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
return FeatureKindPatterns.find(([f, k]) => f == feature && k == kind)[2]
|
|
205
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Kinds: readonly ["Unit", "Set"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Related specifications:
|
|
3
|
+
* - HTTP/1.1 (Core Methods): {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3}
|
|
4
|
+
* - PATCH: {@link https://datatracker.ietf.org/doc/html/rfc5789}
|
|
5
|
+
* - CONNECT: {@link https://datatracker.ietf.org/doc/html/rfc9110}
|
|
6
|
+
* - WebDAV Extensions {@link https://datatracker.ietf.org/doc/html/rfc4918}
|
|
7
|
+
*/
|
|
8
|
+
export const Methods: readonly ["DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT"];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Related specifications:
|
|
3
|
+
* - HTTP/1.1 (Core Methods): {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3}
|
|
4
|
+
* - PATCH: {@link https://datatracker.ietf.org/doc/html/rfc5789}
|
|
5
|
+
* - CONNECT: {@link https://datatracker.ietf.org/doc/html/rfc9110}
|
|
6
|
+
* - WebDAV Extensions {@link https://datatracker.ietf.org/doc/html/rfc4918}
|
|
7
|
+
*/
|
|
8
|
+
export var Methods = /** @type {const} */ ([
|
|
9
|
+
// 'CONNECT',
|
|
10
|
+
// 'COPY',
|
|
11
|
+
'DELETE',
|
|
12
|
+
'GET',
|
|
13
|
+
// 'HEAD',
|
|
14
|
+
// 'LOCK',
|
|
15
|
+
// 'MKCOL',
|
|
16
|
+
// 'MOVE',
|
|
17
|
+
'OPTIONS',
|
|
18
|
+
'PATCH',
|
|
19
|
+
'POST',
|
|
20
|
+
// 'PROPFIND',
|
|
21
|
+
// 'PROPPATCH',
|
|
22
|
+
'PUT',
|
|
23
|
+
// 'TRACE',
|
|
24
|
+
// 'UNLOCK',
|
|
25
|
+
])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Networks: readonly ["Docker", "Public"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Runtimes: readonly ["Next", "React"];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FeatureKindPatterns, Features } from './features.js'
|
|
2
|
+
import { Kinds } from './kinds.js'
|
|
3
|
+
import { Methods } from './methods.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @type {Scope[]}
|
|
7
|
+
*/
|
|
8
|
+
export var Scopes = Object
|
|
9
|
+
.values(Methods)
|
|
10
|
+
.flatMap(method => Object.values(Features).map(feature => [method, feature]))
|
|
11
|
+
.flatMap(array => Object.values(Kinds).map(kind => array.concat(kind)))
|
|
12
|
+
.map(array => array.join('/'))
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {Request} request
|
|
16
|
+
*
|
|
17
|
+
* @returns {Scope | ''}
|
|
18
|
+
*/
|
|
19
|
+
export var getScope = request => {
|
|
20
|
+
var found = FeatureKindPatterns
|
|
21
|
+
.find(([, , pattern]) => pattern.test(request.url))
|
|
22
|
+
?.slice(0, -1)
|
|
23
|
+
|
|
24
|
+
return found
|
|
25
|
+
? request.method + '/' + found[0] + '/' + found[1]
|
|
26
|
+
: ''
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CityAffilations: readonly ["Branch", "Franchise"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GameStatuses: readonly ["APPROVED", "ARCHIVE", "CLOSED", "FINISHED", "FORINVITES", "MODERATION", "PUBLISHED", "REJECTED", "IS_RESERVE"];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getTag } from '../../functions/tag.js'
|
|
2
|
+
|
|
3
|
+
export var RegistrationAttributes = /** @type {const} */ ([
|
|
4
|
+
'Alone',
|
|
5
|
+
'Birthday',
|
|
6
|
+
'Newcomer',
|
|
7
|
+
'Public',
|
|
8
|
+
])
|
|
9
|
+
|
|
10
|
+
var RegistrationAttributeRegistrationProperties = /** @type {const} */ ([
|
|
11
|
+
'is_alone',
|
|
12
|
+
'is_birthday',
|
|
13
|
+
'is_first',
|
|
14
|
+
'is_extensible',
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
var RegistrationAttributeRegistrationProperty = /** @type {const} */ ({
|
|
18
|
+
'Alone': 'is_alone',
|
|
19
|
+
'Birthday': 'is_birthday',
|
|
20
|
+
'Newcomer': 'is_first',
|
|
21
|
+
'Public': 'is_extensible',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
var RegistrationPropertyRegistrationAttribute = /** @type {const} */ ({
|
|
25
|
+
'is_alone': 'Alone',
|
|
26
|
+
'is_birthday': 'Birthday',
|
|
27
|
+
'is_first': 'Newcomer',
|
|
28
|
+
'is_extensible': 'Public',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {RegistrationAttribute[] | Partial<Pick<RegistrationTable, 'is_alone' | 'is_birthday' | 'is_extensible' | 'is_first'>>} value
|
|
33
|
+
*/
|
|
34
|
+
export var getRegistrationAttributes = value => {
|
|
35
|
+
switch (getTag(value)) {
|
|
36
|
+
case 'Object':
|
|
37
|
+
return RegistrationAttributeRegistrationProperties
|
|
38
|
+
.map(property => value[property] ? RegistrationPropertyRegistrationAttribute[property] : '')
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
|
|
41
|
+
case 'Array':
|
|
42
|
+
if (!value.every(attribute => RegistrationAttributes.includes(attribute)))
|
|
43
|
+
throw TypeError(
|
|
44
|
+
`[Function: getRegistrationAttributes] Parameter 'value': '${value}' of type 'Array' must include only members of 'RegistrationAttributes'.`,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return value.reduce((attributes, attribute) => {
|
|
48
|
+
attributes[RegistrationAttributeRegistrationProperty[attribute]] = true
|
|
49
|
+
return attributes
|
|
50
|
+
}, {})
|
|
51
|
+
|
|
52
|
+
default:
|
|
53
|
+
throw TypeError(
|
|
54
|
+
`[Function: getRegistrationAttributes] Parameter 'value': '${value}' must be of types: 'Object', 'Array'.`,
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RegistrationChannels: readonly ["email", "telegramBot", "vkontakte"];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const RegistrationLineups: readonly ["Main", "Reserve"];
|
|
2
|
+
export function getRegistrationLineup(value: RegistrationLineup | (typeof RegistrationLineupShape)[RegistrationLineup]): any;
|
|
3
|
+
/** @type {Record<RegistrationLineup, Pick<RegistrationTable, 'is_reserve'>>} */
|
|
4
|
+
declare let RegistrationLineupShape: Record<RegistrationLineup, Pick<RegistrationTable, "is_reserve">>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export var RegistrationLineups = /** @type {const} */ ([
|
|
2
|
+
'Main',
|
|
3
|
+
'Reserve',
|
|
4
|
+
])
|
|
5
|
+
|
|
6
|
+
/** @type {Record<RegistrationLineup, Pick<RegistrationTable, 'is_reserve'>>} */
|
|
7
|
+
let RegistrationLineupShape = {
|
|
8
|
+
'Main': {
|
|
9
|
+
is_reserve: false,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
'Reserve': {
|
|
13
|
+
is_reserve: true,
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {RegistrationLineup | typeof RegistrationLineupShape[RegistrationLineup]} value
|
|
19
|
+
*/
|
|
20
|
+
export var getRegistrationLineup = value => {
|
|
21
|
+
switch (typeof value) {
|
|
22
|
+
case 'object':
|
|
23
|
+
let found = Object
|
|
24
|
+
.entries(RegistrationLineupShape)
|
|
25
|
+
.find(([, object]) => object.is_reserve === value.is_reserve)
|
|
26
|
+
?.at(0)
|
|
27
|
+
|
|
28
|
+
if (!RegistrationLineups.includes(found))
|
|
29
|
+
throw TypeError(
|
|
30
|
+
`[Function: getRegistrationLineup] Parameter 'found': '${found}' must be a member of 'Lineups'.`,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return found
|
|
34
|
+
|
|
35
|
+
case 'string':
|
|
36
|
+
if (!RegistrationLineups.includes(value))
|
|
37
|
+
throw TypeError(
|
|
38
|
+
`[Function: getRegistrationLineup] Parameter 'value': '${value}' must be a member of 'Lineups'.`,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return RegistrationLineupShape[value]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RegistrationMailings: readonly ["Idle", "Pending", "Delivered", "Failed"];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const RegistrationStatuses: readonly ["Created", "Confirmed", "Cancelled"];
|
|
2
|
+
export function getRegistrationStatus(value: RegistrationStatus | (typeof RegistrationStatusShape)[RegistrationStatus]): any;
|
|
3
|
+
/** @type {Record<RegistrationStatus, Pick<RegistrationTable, 'is_canceled' | 'is_confirm'>>} */
|
|
4
|
+
declare let RegistrationStatusShape: Record<RegistrationStatus, Pick<RegistrationTable, "is_canceled" | "is_confirm">>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export var RegistrationStatuses = /** @type {const} */ ([
|
|
2
|
+
'Created',
|
|
3
|
+
'Confirmed',
|
|
4
|
+
'Cancelled',
|
|
5
|
+
])
|
|
6
|
+
|
|
7
|
+
/** @type {Record<RegistrationStatus, Pick<RegistrationTable, 'is_canceled' | 'is_confirm'>>} */
|
|
8
|
+
let RegistrationStatusShape = {
|
|
9
|
+
'Created': {
|
|
10
|
+
is_canceled: false,
|
|
11
|
+
is_confirm: false,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
'Confirmed': {
|
|
15
|
+
is_canceled: false,
|
|
16
|
+
is_confirm: true,
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
'Cancelled': {
|
|
20
|
+
is_canceled: true,
|
|
21
|
+
is_confirm: false,
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {RegistrationStatus | typeof RegistrationStatusShape[RegistrationStatus]} value
|
|
27
|
+
*/
|
|
28
|
+
export let getRegistrationStatus = value => {
|
|
29
|
+
switch (typeof value) {
|
|
30
|
+
case 'object':
|
|
31
|
+
let found = Object
|
|
32
|
+
.entries(RegistrationStatusShape)
|
|
33
|
+
.find(([, object]) =>
|
|
34
|
+
object.is_canceled === value.is_canceled
|
|
35
|
+
&& object.is_confirm === value.is_confirm
|
|
36
|
+
)
|
|
37
|
+
?.at(0)
|
|
38
|
+
|
|
39
|
+
if (!RegistrationStatuses.includes(found))
|
|
40
|
+
throw TypeError(
|
|
41
|
+
`[Function: getRegistrationStatus] Parameter 'found': '${found}' must be a member of 'RegistrationStatuses'.`,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return found
|
|
45
|
+
|
|
46
|
+
case 'string':
|
|
47
|
+
if (!RegistrationStatuses.includes(value))
|
|
48
|
+
throw TypeError(
|
|
49
|
+
`[Function: getRegistrationStatus] Parameter 'value': '${value}' must be a member of 'RegistrationStatuses'.`,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return RegistrationStatusShape[value]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Roles: readonly ["admin", "default", "organizer"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VenueStatuses: readonly ['ACTIVE', 'ARCHIVE']
|