@shakerquiz/utilities 0.5.194 → 0.5.196
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 +1 -1
- package/source/enumerations/entities/registration-lineup.js +35 -61
- package/source/enumerations/registration/status.js +62 -0
- package/source/enumerations/route.js +25 -0
- package/source/enumerations/venue/audience.js +3 -3
- package/source/index.js +1 -1
- package/source/enumerations/entities/registration-status.js +0 -89
package/package.json
CHANGED
|
@@ -1,75 +1,49 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const RegistrationLineup = Object.freeze({
|
|
2
2
|
'Main': 'Main',
|
|
3
3
|
'Reserve': 'Reserve',
|
|
4
4
|
})
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const RegistrationLineups = Object.freeze([
|
|
7
|
+
RegistrationLineup['Main'],
|
|
8
|
+
RegistrationLineup['Reserve'],
|
|
9
|
+
])
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[RegistrationLineup
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** @type {Record<RegistrationLineup, string>} */
|
|
15
|
-
export var RegistrationLineupTitle = {
|
|
16
|
-
[RegistrationLineup.Main]: 'Основа',
|
|
17
|
-
[RegistrationLineup.Reserve]: 'Резерв',
|
|
18
|
-
}
|
|
11
|
+
export const RegistrationLineupTitle = Object.freeze({
|
|
12
|
+
[RegistrationLineup['Main']]: 'Основа',
|
|
13
|
+
[RegistrationLineup['Reserve']]: 'Резерв',
|
|
14
|
+
})
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[RegistrationLineup
|
|
23
|
-
|
|
24
|
-
}
|
|
16
|
+
export const RegistrationLineupIcon = Object.freeze({
|
|
17
|
+
[RegistrationLineup['Main']]: 'hero/outline/user-circle',
|
|
18
|
+
[RegistrationLineup['Reserve']]: 'hero/outline/pause-circle',
|
|
19
|
+
})
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[RegistrationLineup
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
export const RegistrationLineupEmoji = Object.freeze({
|
|
22
|
+
[RegistrationLineup['Main']]: '🟢',
|
|
23
|
+
[RegistrationLineup['Reserve']]: '🟡',
|
|
24
|
+
})
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
26
|
+
export const ValueRegistrationLineup = Object.freeze({
|
|
27
|
+
'false': RegistrationLineup['Main'],
|
|
28
|
+
'true': RegistrationLineup['Reserve'],
|
|
29
|
+
})
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[RegistrationLineup.Main]: {
|
|
31
|
+
export const RegistrationLineupShape = Object.freeze({
|
|
32
|
+
[RegistrationLineup['Main']]: Object.freeze({
|
|
41
33
|
is_reserve: false,
|
|
42
|
-
},
|
|
34
|
+
}),
|
|
43
35
|
|
|
44
|
-
[RegistrationLineup
|
|
36
|
+
[RegistrationLineup['Reserve']]: Object.freeze({
|
|
45
37
|
is_reserve: true,
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @param {RegistrationLineup | typeof RegistrationLineupShape[RegistrationLineup]} value
|
|
51
|
-
*/
|
|
52
|
-
export var getRegistrationLineup = value => {
|
|
53
|
-
switch (typeof value) {
|
|
54
|
-
case 'object':
|
|
55
|
-
let found = Object
|
|
56
|
-
.entries(RegistrationLineupShape)
|
|
57
|
-
.find(([, object]) => object.is_reserve === value.is_reserve)
|
|
58
|
-
?.at(0)
|
|
59
|
-
|
|
60
|
-
if (!RegistrationLineups.includes(found))
|
|
61
|
-
throw TypeError(
|
|
62
|
-
`[Function: getRegistrationLineup] Parameter 'found': '${found}' must be a member of 'Lineups'.`,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
return found
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
66
40
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
41
|
+
export const inferRegistrationLineup = Object.freeze(
|
|
42
|
+
/** @returns {keyof typeof RegistrationLineup | 'Unknown'} */
|
|
43
|
+
x => ValueRegistrationLineup[x?.is_reserve] ?? RegistrationLineup[x] ?? 'Unknown',
|
|
44
|
+
)
|
|
72
45
|
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
46
|
+
export const inferRegistrationLineupShape = Object.freeze(
|
|
47
|
+
/** @returns {typeof RegistrationLineupShape[keyof typeof RegistrationLineupShape] | { is_reserve: null }} */
|
|
48
|
+
x => RegistrationLineupShape[x] ?? { is_reserve: null },
|
|
49
|
+
)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const RegistrationStatus = Object.freeze({
|
|
2
|
+
'Confirmed': 'Confirmed',
|
|
3
|
+
'Created': 'Created',
|
|
4
|
+
'Cancelled': 'Cancelled',
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const RegistrationStatuses = Object.freeze([
|
|
8
|
+
RegistrationStatus['Created'],
|
|
9
|
+
RegistrationStatus['Confirmed'],
|
|
10
|
+
RegistrationStatus['Cancelled'],
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
export const RegistrationStatusTitle = Object.freeze({
|
|
14
|
+
[RegistrationStatus['Confirmed']]: 'Подтверждена',
|
|
15
|
+
[RegistrationStatus['Created']]: 'Создана',
|
|
16
|
+
[RegistrationStatus['Cancelled']]: 'Отменена',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const RegistrationStatusIcon = Object.freeze({
|
|
20
|
+
[RegistrationStatus['Confirmed']]: 'hero/outline/check-circle',
|
|
21
|
+
[RegistrationStatus['Created']]: 'hero/outline/check',
|
|
22
|
+
[RegistrationStatus['Cancelled']]: 'hero/outline/x-mark',
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const RegistrationStatusEmoji = Object.freeze({
|
|
26
|
+
[RegistrationStatus['Confirmed']]: '✅',
|
|
27
|
+
[RegistrationStatus['Created']]: '📝',
|
|
28
|
+
[RegistrationStatus['Cancelled']]: '❌',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const ValueRegistrationStatus = Object.freeze({
|
|
32
|
+
'false/false': RegistrationStatus['Created'],
|
|
33
|
+
'false/true': RegistrationStatus['Confirmed'],
|
|
34
|
+
'true/false': RegistrationStatus['Cancelled'],
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const RegistrationStatusShape = Object.freeze({
|
|
38
|
+
[RegistrationStatus['Created']]: Object.freeze({
|
|
39
|
+
is_canceled: false,
|
|
40
|
+
is_confirm: false,
|
|
41
|
+
}),
|
|
42
|
+
|
|
43
|
+
[RegistrationStatus['Confirmed']]: Object.freeze({
|
|
44
|
+
is_canceled: false,
|
|
45
|
+
is_confirm: true,
|
|
46
|
+
}),
|
|
47
|
+
|
|
48
|
+
[RegistrationStatus['Cancelled']]: Object.freeze({
|
|
49
|
+
is_canceled: true,
|
|
50
|
+
is_confirm: false,
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export const inferRegistrationStatus = Object.freeze(
|
|
55
|
+
/** @returns {keyof typeof RegistrationStatus | 'Unknown'} */
|
|
56
|
+
x => ValueRegistrationStatus[x?.is_canceled + '/' + x?.is_confirm] ?? ValueRegistrationStatus[x] ?? 'Unknown',
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
export const inferRegistrationStatusShape = Object.freeze(
|
|
60
|
+
/** @returns {typeof RegistrationStatusShape[keyof typeof RegistrationStatusShape] | { is_canceled: null, is_confirm: null }} */
|
|
61
|
+
x => RegistrationStatusShape[x] ?? { is_canceled: null, is_confirm: null },
|
|
62
|
+
)
|
|
@@ -39,8 +39,12 @@ export const Route = Object.freeze({
|
|
|
39
39
|
'registration/confirmation': 'registration/confirmation',
|
|
40
40
|
'registration/export': 'registration/export',
|
|
41
41
|
'registration/game': 'registration/game',
|
|
42
|
+
'registration/game/theme': 'registration/game/theme',
|
|
42
43
|
'registration/mailing': 'registration/mailing',
|
|
43
44
|
'registrations': 'registrations',
|
|
45
|
+
'registrations/city': 'registrations/city',
|
|
46
|
+
'registrations/game': 'registrations/game',
|
|
47
|
+
'registrations/game/theme': 'registrations/game/theme',
|
|
44
48
|
'registrations/export': 'registrations/export',
|
|
45
49
|
'role': 'role',
|
|
46
50
|
'roles': 'roles',
|
|
@@ -100,8 +104,12 @@ export const RouteCardinality = Object.freeze({
|
|
|
100
104
|
[Route['games/theme']]: Cardinality['N-1'],
|
|
101
105
|
[Route['games/venue']]: Cardinality['N-1'],
|
|
102
106
|
[Route['registration']]: Cardinality['1'],
|
|
107
|
+
[Route['registration/game/theme']]: Cardinality['1-1'],
|
|
103
108
|
[Route['registration/export']]: Cardinality['1'],
|
|
104
109
|
[Route['registrations']]: Cardinality['N'],
|
|
110
|
+
[Route['registrations/city']]: Cardinality['N-1'],
|
|
111
|
+
[Route['registrations/game']]: Cardinality['N-1'],
|
|
112
|
+
[Route['registrations/game/theme']]: Cardinality['N-1'],
|
|
105
113
|
[Route['registrations/export']]: Cardinality['1'],
|
|
106
114
|
[Route['role']]: Cardinality['1'],
|
|
107
115
|
[Route['roles']]: Cardinality['N'],
|
|
@@ -142,6 +150,9 @@ export const RouteRelation = Object.freeze({
|
|
|
142
150
|
[Route['games/theme']]: Route['game/theme'],
|
|
143
151
|
[Route['games/venue']]: Route['game/venue'],
|
|
144
152
|
[Route['registrations']]: Route['registration'],
|
|
153
|
+
[Route['registrations/city']]: Route['registration/city'],
|
|
154
|
+
[Route['registrations/game']]: Route['registration/game'],
|
|
155
|
+
[Route['registrations/game/theme']]: Route['registration/game/theme'],
|
|
145
156
|
[Route['roles']]: Route['role'],
|
|
146
157
|
[Route['themes']]: Route['theme'],
|
|
147
158
|
[Route['themes/cover']]: Route['theme/cover'],
|
|
@@ -192,8 +203,12 @@ export const RoutePathname = Object.freeze({
|
|
|
192
203
|
[Route['registration/confirmation']]: 'registration/:registration/confirmation',
|
|
193
204
|
[Route['registration/export']]: 'registration/:registration/export',
|
|
194
205
|
[Route['registration/game']]: 'registration/:registration/game',
|
|
206
|
+
[Route['registration/game/theme']]: 'registration/:registration/game/theme',
|
|
195
207
|
[Route['registration/mailing']]: 'registration/:registration/mailing',
|
|
196
208
|
[Route['registrations']]: 'registrations',
|
|
209
|
+
[Route['registrations/city']]: 'registrations/city',
|
|
210
|
+
[Route['registrations/game']]: 'registrations/game',
|
|
211
|
+
[Route['registrations/game/theme']]: 'registrations/game/theme',
|
|
197
212
|
[Route['registrations/export']]: 'registrations/export',
|
|
198
213
|
[Route['role']]: 'role/:role',
|
|
199
214
|
[Route['roles']]: 'roles',
|
|
@@ -257,8 +272,12 @@ export const RouteParams = Object.freeze({
|
|
|
257
272
|
[Route['registration/confirmation']]: [':registration'],
|
|
258
273
|
[Route['registration/export']]: [':registration'],
|
|
259
274
|
[Route['registration/game']]: [':registration'],
|
|
275
|
+
[Route['registration/game/theme']]: [':registration'],
|
|
260
276
|
[Route['registration/mailing']]: [':registration'],
|
|
261
277
|
[Route['registrations']]: [],
|
|
278
|
+
[Route['registrations/city']]: [],
|
|
279
|
+
[Route['registrations/game']]: [],
|
|
280
|
+
[Route['registrations/game/theme']]: [],
|
|
262
281
|
[Route['registrations/export']]: [],
|
|
263
282
|
[Route['role']]: [':role'],
|
|
264
283
|
[Route['roles']]: [],
|
|
@@ -320,6 +339,9 @@ export const RouteService = Object.freeze({
|
|
|
320
339
|
[Route['registration/game']]: Service['Registrations'],
|
|
321
340
|
[Route['registration/mailing']]: Service['Registrations'],
|
|
322
341
|
[Route['registrations']]: Service['Registrations'],
|
|
342
|
+
[Route['registrations/city']]: Service['Registrations'],
|
|
343
|
+
[Route['registrations/game']]: Service['Registrations'],
|
|
344
|
+
[Route['registrations/game/theme']]: Service['Registrations'],
|
|
323
345
|
[Route['registrations/export']]: Service['Registrations'],
|
|
324
346
|
[Route['role']]: Service['Roles'],
|
|
325
347
|
[Route['roles']]: Service['Roles'],
|
|
@@ -423,6 +445,9 @@ export const ServiceRoutes = Object.freeze({
|
|
|
423
445
|
Route['registration/game'],
|
|
424
446
|
Route['registration/mailing'],
|
|
425
447
|
Route['registrations'],
|
|
448
|
+
Route['registrations/city'],
|
|
449
|
+
Route['registrations/game'],
|
|
450
|
+
Route['registrations/game/theme'],
|
|
426
451
|
Route['registrations/export'],
|
|
427
452
|
]),
|
|
428
453
|
|
|
@@ -19,8 +19,8 @@ export const VenueAudienceIcon = Object.freeze({
|
|
|
19
19
|
})
|
|
20
20
|
|
|
21
21
|
const ValueVenueAudience = Object.freeze({
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
'false': VenueAudience['Open'],
|
|
23
|
+
'true': VenueAudience['Restricted'],
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
const VenueAudienceShape = /** @type {const} */ (Object.freeze({
|
|
@@ -39,6 +39,6 @@ export const inferVenueAudience = Object.freeze(
|
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
export const inferVenueAudienceShape = Object.freeze(
|
|
42
|
-
/** @returns {typeof VenueAudienceShape[keyof typeof VenueAudienceShape] | {
|
|
42
|
+
/** @returns {typeof VenueAudienceShape[keyof typeof VenueAudienceShape] | { is_adult: null }} */
|
|
43
43
|
x => VenueAudienceShape[x] ?? { is_adult: null },
|
|
44
44
|
)
|
package/source/index.js
CHANGED
|
@@ -22,10 +22,10 @@ export * from './enumerations/entities/registration-attribute.js'
|
|
|
22
22
|
export * from './enumerations/entities/registration-channel.js'
|
|
23
23
|
export * from './enumerations/entities/registration-lineup.js'
|
|
24
24
|
export * from './enumerations/entities/registration-mailing.js'
|
|
25
|
-
export * from './enumerations/entities/registration-status.js'
|
|
26
25
|
export * from './enumerations/entities/role.js'
|
|
27
26
|
export * from './enumerations/entities/version.js'
|
|
28
27
|
|
|
28
|
+
export * from './enumerations/registration/status.js'
|
|
29
29
|
export * from './enumerations/venue/audience.js'
|
|
30
30
|
export * from './enumerations/venue/status.js'
|
|
31
31
|
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export var RegistrationStatus = /** @type {const} */ ({
|
|
2
|
-
'Confirmed': 'Confirmed',
|
|
3
|
-
'Created': 'Created',
|
|
4
|
-
'Cancelled': 'Cancelled',
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
export var RegistrationStatuses = Object.values(RegistrationStatus)
|
|
8
|
-
|
|
9
|
-
export var RegistrationStatusWeight = {
|
|
10
|
-
[RegistrationStatus.Confirmed]: 0,
|
|
11
|
-
[RegistrationStatus.Created]: 1,
|
|
12
|
-
[RegistrationStatus.Cancelled]: 2,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export var RegistrationStatusTitle = {
|
|
16
|
-
[RegistrationStatus.Confirmed]: 'Подтверждена',
|
|
17
|
-
[RegistrationStatus.Created]: 'Создана',
|
|
18
|
-
[RegistrationStatus.Cancelled]: 'Отменена',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** @type {Record<RegistrationStatus, Icon>} */
|
|
22
|
-
export var RegistrationStatusIcon = {
|
|
23
|
-
[RegistrationStatus.Confirmed]: 'hero/outline/check-circle',
|
|
24
|
-
[RegistrationStatus.Created]: 'hero/outline/check',
|
|
25
|
-
[RegistrationStatus.Cancelled]: 'hero/outline/x-mark',
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @type {Record<RegistrationStatus, Icon>} */
|
|
29
|
-
export var RegistrationStatusEmoji = {
|
|
30
|
-
[RegistrationStatus.Confirmed]: '✅',
|
|
31
|
-
[RegistrationStatus.Created]: '📝',
|
|
32
|
-
[RegistrationStatus.Cancelled]: '❌',
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @type {Record<RegistrationStatus, string>} */
|
|
36
|
-
export var RegistrationStatusColor = {
|
|
37
|
-
[RegistrationStatus.Confirmed]: 'text-success',
|
|
38
|
-
[RegistrationStatus.Created]: 'text-default-700',
|
|
39
|
-
[RegistrationStatus.Cancelled]: 'text-danger',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** @type {Record<RegistrationStatus, Pick<RegistrationTable, 'is_canceled' | 'is_confirm'>>} */
|
|
43
|
-
export var RegistrationStatusShape = {
|
|
44
|
-
[RegistrationStatus.Confirmed]: {
|
|
45
|
-
is_canceled: false,
|
|
46
|
-
is_confirm: true,
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
[RegistrationStatus.Created]: {
|
|
50
|
-
is_canceled: false,
|
|
51
|
-
is_confirm: false,
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
[RegistrationStatus.Cancelled]: {
|
|
55
|
-
is_canceled: true,
|
|
56
|
-
is_confirm: false,
|
|
57
|
-
},
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @param {RegistrationStatus | typeof RegistrationStatusShape[RegistrationStatus]} value
|
|
62
|
-
*/
|
|
63
|
-
export var getRegistrationStatus = value => {
|
|
64
|
-
switch (typeof value) {
|
|
65
|
-
case 'object':
|
|
66
|
-
let found = Object
|
|
67
|
-
.entries(RegistrationStatusShape)
|
|
68
|
-
.find(([, object]) =>
|
|
69
|
-
object.is_canceled === value.is_canceled
|
|
70
|
-
&& object.is_confirm === value.is_confirm
|
|
71
|
-
)
|
|
72
|
-
?.at(0)
|
|
73
|
-
|
|
74
|
-
if (!RegistrationStatuses.includes(found))
|
|
75
|
-
throw TypeError(
|
|
76
|
-
`[Function: getRegistrationStatus] Parameter 'found': '${found}' must be a member of 'RegistrationStatuses'.`,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
return found
|
|
80
|
-
|
|
81
|
-
case 'string':
|
|
82
|
-
if (!RegistrationStatuses.includes(value))
|
|
83
|
-
throw TypeError(
|
|
84
|
-
`[Function: getRegistrationStatus] Parameter 'value': '${value}' must be a member of 'RegistrationStatuses'.`,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return RegistrationStatusShape[value]
|
|
88
|
-
}
|
|
89
|
-
}
|