@shakerquiz/utilities 0.5.174 → 0.5.176

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 (32) hide show
  1. package/package.json +1 -1
  2. package/source/enumerations/blend.js +4 -4
  3. package/source/enumerations/cardinality.js +4 -2
  4. package/source/enumerations/constants.js +1 -1
  5. package/source/enumerations/display.js +0 -1
  6. package/source/enumerations/entities/role.js +11 -11
  7. package/source/enumerations/icon.js +1 -1
  8. package/source/enumerations/method.js +0 -2
  9. package/source/enumerations/mode.js +24 -34
  10. package/source/enumerations/network.js +4 -2
  11. package/source/enumerations/pattern.js +4 -0
  12. package/source/enumerations/phase.js +7 -7
  13. package/source/enumerations/quantifier.js +33 -70
  14. package/source/enumerations/route.js +34 -191
  15. package/source/enumerations/runtime.js +1 -3
  16. package/source/enumerations/service.js +3 -5
  17. package/source/enumerations/store.js +16 -13
  18. package/source/enumerations/venue/audience.js +19 -20
  19. package/source/enumerations/venue/status.js +4 -4
  20. package/source/index.js +1 -2
  21. package/source/schemas/PATCH/games/admin.json +34 -0
  22. package/source/schemas/PATCH/games/organizer.json +34 -0
  23. package/source/schemas/PATCH/users/cities/admin.json +19 -0
  24. package/source/schemas/PATCH/users/role/admin.json +19 -0
  25. package/source/enumerations/kind.js +0 -5
  26. package/source/enumerations/regexp.js +0 -4
  27. /package/source/schemas/PATCH/registration/{default.json → Unknown.json} +0 -0
  28. /package/source/schemas/PATCH/registration/cancellation/{default.json → Unknown.json} +0 -0
  29. /package/source/schemas/PATCH/registration/channel/{default.json → Unknown.json} +0 -0
  30. /package/source/schemas/PATCH/registration/confirmation/{default.json → Unknown.json} +0 -0
  31. /package/source/schemas/POST/checkin/{default.json → Unknown.json} +0 -0
  32. /package/source/schemas/POST/registration/{default.json → Unknown.json} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "0.5.174",
4
+ "version": "0.5.176",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -5,7 +5,7 @@ export const Blend = Object.freeze({
5
5
  'Indifferent': 'Indifferent',
6
6
  })
7
7
 
8
- /** @returns {typeof Blend[keyof typeof Blend]} */
9
- export const inferBlend = value =>
10
- Blend[value]
11
- ?? 'Unset'
8
+ export const inferBlend = Object.freeze(
9
+ /** @returns {typeof Blend[keyof typeof Blend]} */
10
+ value => Blend[value] ?? 'Unset',
11
+ )
@@ -7,5 +7,7 @@ export const Cardinality = Object.freeze({
7
7
  'N-N': 'N-N',
8
8
  })
9
9
 
10
- /** @returns {keyof typeof Cardinality | 'Unknown'} */
11
- export const inferCardinality = x => Cardinality[x] ?? 'Unknown'
10
+ export const inferCardinality = Object.freeze(
11
+ /** @returns {keyof typeof Cardinality | 'Unknown'} */
12
+ x => Cardinality[x] ?? 'Unknown',
13
+ )
@@ -1,4 +1,4 @@
1
- export var Constants = /** @type {const} */ ({
1
+ export const Constants = Object.freeze({
2
2
  /**
3
3
  * @see https://www.rfc-editor.org/rfc/rfc9562.html#name-nil-uuid
4
4
  */
@@ -1,5 +1,4 @@
1
1
  export const Display = Object.freeze({
2
2
  'Tag': 'Tag',
3
3
  'Chip': 'Chip',
4
- 'Alert': 'Alert',
5
4
  })
@@ -1,4 +1,4 @@
1
- export var Role = /** @type {const} */ ({
1
+ export const Role = Object.freeze({
2
2
  'admin': 'admin',
3
3
  'organizer': 'organizer',
4
4
  'captain': 'captain',
@@ -7,34 +7,34 @@ export var Role = /** @type {const} */ ({
7
7
  'manager': 'manager',
8
8
  })
9
9
 
10
- export var Roles = [
10
+ export const Roles = Object.freeze([
11
11
  Role['admin'],
12
12
  Role['organizer'],
13
13
  Role['captain'],
14
14
  Role['player'],
15
15
  Role['user'],
16
16
  Role['manager'],
17
- ]
17
+ ])
18
18
 
19
- export var RoleTitle = {
19
+ export const RoleTitle = Object.freeze({
20
20
  [Role['admin']]: 'Администратор',
21
21
  [Role['organizer']]: 'Организатор',
22
22
  [Role['captain']]: 'Капитан',
23
23
  [Role['player']]: 'Игрок',
24
24
  [Role['user']]: 'Пользователь',
25
25
  [Role['manager']]: 'Менеджер',
26
- }
26
+ })
27
27
 
28
- export var RoleIcon = {
28
+ export const RoleIcon = Object.freeze({
29
29
  [Role['admin']]: 'hero/outline/user',
30
30
  [Role['organizer']]: 'hero/outline/user',
31
31
  [Role['captain']]: 'hero/outline/user',
32
32
  [Role['player']]: 'hero/outline/user',
33
33
  [Role['user']]: 'hero/outline/user',
34
34
  [Role['manager']]: 'hero/outline/user',
35
- }
35
+ })
36
36
 
37
- /** @returns {keyof typeof Role | 'Unknown'} */
38
- export var inferRole = value =>
39
- Role[value?.role?.name ?? value]
40
- ?? 'Unknown'
37
+ export const inferRole = Object.freeze(
38
+ /** @returns {keyof typeof Role | 'Unknown'} */
39
+ x => Role[x?.role?.name ?? x] ?? 'Unknown',
40
+ )
@@ -1,4 +1,4 @@
1
- export var Icons = /** @type {const} */ ([
1
+ export const Icons = Object.freeze([
2
2
  'hero/solid/academic-cap',
3
3
  'hero/solid/adjustments-horizontal',
4
4
  'hero/solid/adjustments-vertical',
@@ -1,5 +1,3 @@
1
- import { Mode } from './mode.js'
2
-
3
1
  /**
4
2
  * Related specifications:
5
3
  * - HTTP/1.1 (Core Methods): {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3}
@@ -1,58 +1,48 @@
1
1
  import { Gender } from './gender.js'
2
2
  import { Numerosity } from './numerosity.js'
3
3
 
4
- export var Mode = /** @type {const} */ ({
4
+ export const Mode = Object.freeze({
5
5
  'Known': 'Known',
6
6
  'Unknown': 'Unknown',
7
7
  })
8
8
 
9
- export var Modes = [
9
+ export const Modes = Object.freeze([
10
10
  Mode['Known'],
11
11
  Mode['Unknown'],
12
- ]
12
+ ])
13
13
 
14
- export var ModeModes = {
15
- [Mode['Known']]: [
16
- Mode['Known'],
17
- ],
18
-
19
- [Mode['Unknown']]: [
20
- Mode['Unknown'],
21
- ],
22
- }
23
-
24
- export var ModeIcon = {
14
+ export const ModeIcon = Object.freeze({
25
15
  [Mode['Known']]: 'hero/outline/check',
26
16
  [Mode['Unknown']]: 'hero/outline/no-symbol',
27
- }
17
+ })
28
18
 
29
- export var ModeTitle = {
30
- [Numerosity['Singular']]: {
31
- [Gender['Masculine']]: {
19
+ export const ModeTitle = Object.freeze({
20
+ [Numerosity['Singular']]: Object.freeze({
21
+ [Gender['Masculine']]: Object.freeze({
32
22
  [Mode['Known']]: 'Назначен',
33
23
  [Mode['Unknown']]: 'Не назначен',
34
- },
24
+ }),
35
25
 
36
- [Gender['Feminine']]: {
26
+ [Gender['Feminine']]: Object.freeze({
37
27
  [Mode['Known']]: 'Назначена',
38
28
  [Mode['Unknown']]: 'Не назначена',
39
- },
29
+ }),
40
30
 
41
- [Gender['Neuter']]: {
31
+ [Gender['Neuter']]: Object.freeze({
42
32
  [Mode['Known']]: 'Назначено',
43
33
  [Mode['Unknown']]: 'Не назначено',
44
- },
45
- },
34
+ }),
35
+ }),
46
36
 
47
- [Numerosity['Plural']]: {
48
- [Gender['Indeterminate']]: {
37
+ [Numerosity['Plural']]: Object.freeze({
38
+ [Gender['Indeterminate']]: Object.freeze({
49
39
  [Mode['Known']]: 'Назначены',
50
40
  [Mode['Unknown']]: 'Не назначены',
51
- },
52
- },
53
- }
54
-
55
- /** @returns {typeof Mode[keyof typeof Mode]} */
56
- export var inferMode = value =>
57
- Mode[value?.mode ?? value]
58
- ?? 'Unknown'
41
+ }),
42
+ }),
43
+ })
44
+
45
+ export var inferMode = Object.freeze(
46
+ /** @returns {typeof Mode[keyof typeof Mode]} */
47
+ x => Mode[x?.mode ?? x] ?? 'Unknown',
48
+ )
@@ -3,5 +3,7 @@ export const Network = Object.freeze({
3
3
  'Public': 'Public',
4
4
  })
5
5
 
6
- /** @returns {keyof typeof Network | 'Unknown'} */
7
- export const inferNetwork = x => Network[x] ?? 'Unknown'
6
+ export const inferNetwork = Object.freeze(
7
+ /** @returns {keyof typeof Network | 'Unknown'} */
8
+ x => Network[x] ?? 'Unknown',
9
+ )
@@ -0,0 +1,4 @@
1
+ export const Pattern = Object.freeze({
2
+ UUID: /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,
3
+ JWT: /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$/,
4
+ })
@@ -1,4 +1,4 @@
1
- export var Phase = /** @type {const} */ ({
1
+ export const Phase = Object.freeze({
2
2
  'Idle': 'Idle',
3
3
  'Loading': 'Loading',
4
4
  'Loaded': 'Loaded',
@@ -6,26 +6,26 @@ export var Phase = /** @type {const} */ ({
6
6
  'Failed': 'Failed',
7
7
  })
8
8
 
9
- export var Phases = [
9
+ export const Phases = Object.freeze([
10
10
  Phase['Idle'],
11
11
  Phase['Loading'],
12
12
  Phase['Loaded'],
13
13
  Phase['Aborted'],
14
14
  Phase['Failed'],
15
- ]
15
+ ])
16
16
 
17
- export var PhaseTitle = {
17
+ export const PhaseTitle = Object.freeze({
18
18
  [Phase['Idle']]: 'Простой',
19
19
  [Phase['Loading']]: 'В процессе',
20
20
  [Phase['Loaded']]: 'Завершено',
21
21
  [Phase['Aborted']]: 'Оборвано',
22
22
  [Phase['Failed']]: 'Ошибка',
23
- }
23
+ })
24
24
 
25
- export var PhaseIcon = {
25
+ export const PhaseIcon = Object.freeze({
26
26
  [Phase['Idle']]: 'hero/outline/clock',
27
27
  [Phase['Loading']]: 'hero/outline/clock',
28
28
  [Phase['Loaded']]: 'hero/outline/check',
29
29
  [Phase['Aborted']]: 'hero/outline/signal-slash',
30
30
  [Phase['Failed']]: 'hero/outline/x-mark',
31
- }
31
+ })
@@ -1,8 +1,7 @@
1
- import { inferTag } from '../functions/tag.js'
2
1
  import { Gender } from './gender.js'
3
2
  import { Numerosity } from './numerosity.js'
4
3
 
5
- export var Quantifier = /** @type {const} */ ({
4
+ export const Quantifier = Object.freeze({
6
5
  'Any': 'Any',
7
6
  'None': 'None',
8
7
  'Single': 'Single',
@@ -10,115 +9,79 @@ export var Quantifier = /** @type {const} */ ({
10
9
  'All': 'All',
11
10
  })
12
11
 
13
- export var Quantifiers = [
12
+ export const Quantifiers = Object.freeze([
14
13
  Quantifier['Any'],
15
14
  Quantifier['None'],
16
15
  Quantifier['Single'],
17
16
  Quantifier['Many'],
18
17
  Quantifier['All'],
19
- ]
18
+ ])
20
19
 
21
- export var QuantifierQuantifiers = {
22
- [Quantifier['Any']]: [
20
+ export const QuantifierQuantifiers = Object.freeze({
21
+ [Quantifier['Any']]: Object.freeze([
23
22
  Quantifier['Any'],
24
23
  Quantifier['None'],
25
24
  Quantifier['Single'],
26
25
  Quantifier['Many'],
27
26
  Quantifier['All'],
28
- ],
27
+ ]),
29
28
 
30
- [Quantifier['None']]: [
29
+ [Quantifier['None']]: Object.freeze([
31
30
  Quantifier['None'],
32
- ],
31
+ ]),
33
32
 
34
- [Quantifier['Single']]: [
33
+ [Quantifier['Single']]: Object.freeze([
35
34
  Quantifier['Single'],
36
- ],
35
+ ]),
37
36
 
38
- [Quantifier['Many']]: [
37
+ [Quantifier['Many']]: Object.freeze([
39
38
  Quantifier['Many'],
40
- ],
39
+ ]),
41
40
 
42
- [Quantifier['All']]: [
41
+ [Quantifier['All']]: Object.freeze([
43
42
  Quantifier['All'],
44
- ],
45
- }
43
+ ]),
44
+ })
46
45
 
47
- export var QuantifierTitle = {
48
- [Numerosity['Singular']]: {
49
- [Gender['Masculine']]: {
46
+ export const QuantifierTitle = Object.freeze({
47
+ [Numerosity['Singular']]: Object.freeze({
48
+ [Gender['Masculine']]: Object.freeze({
50
49
  [Quantifier['Any']]: 'Любой',
51
50
  [Quantifier['None']]: 'Отсутствует',
52
51
  [Quantifier['Single']]: 'Один',
53
52
  [Quantifier['Many']]: 'Много',
54
53
  [Quantifier['All']]: 'Все',
55
- },
54
+ }),
56
55
 
57
- [Gender['Feminine']]: {
56
+ [Gender['Feminine']]: Object.freeze({
58
57
  [Quantifier['Any']]: 'Любая',
59
58
  [Quantifier['None']]: 'Отсутствует',
60
59
  [Quantifier['Single']]: 'Одна',
61
60
  [Quantifier['Many']]: 'Много',
62
61
  [Quantifier['All']]: 'Все',
63
- },
62
+ }),
64
63
 
65
- [Gender['Neuter']]: {
64
+ [Gender['Neuter']]: Object.freeze({
66
65
  [Quantifier['Any']]: 'Любое',
67
66
  [Quantifier['None']]: 'Отсутствует',
68
67
  [Quantifier['Single']]: 'Одно',
69
68
  [Quantifier['Many']]: 'Много',
70
69
  [Quantifier['All']]: 'Все',
71
- },
72
- },
70
+ }),
71
+ }),
73
72
 
74
- [Numerosity['Plural']]: {
75
- [Gender['Indeterminate']]: {
73
+ [Numerosity['Plural']]: Object.freeze({
74
+ [Gender['Indeterminate']]: Object.freeze({
76
75
  [Quantifier['Any']]: 'Любые',
77
76
  [Quantifier['None']]: 'Отсутствуют',
78
77
  [Quantifier['Single']]: 'Один',
79
78
  [Quantifier['Many']]: 'Много',
80
79
  [Quantifier['All']]: 'Все',
81
- },
82
- },
83
- }
84
-
85
- /**
86
- * @returns {typeof Quantifier[keyof typeof Quantifier]}
87
- */
88
- export var inferQuantifier = value => {
89
- switch (typeof value) {
90
- case 'string':
91
- return value in Quantifier
92
- ? Quantifier[value]
93
- : Quantifier['None']
94
-
95
- case 'object':
96
- switch (inferTag(value)) {
97
- case 'Object':
98
- return inferQuantifier(value?.quantifier)
99
-
100
- case 'Array':
101
- if (value.length === 1)
102
- return Quantifier['Single']
103
- else if (value.length > 1)
104
- return Quantifier['Many']
105
- else
106
- return Quantifier['None']
107
-
108
- case 'Map':
109
- case 'Set':
110
- if (value.size === 1)
111
- return Quantifier['Single']
112
- else if (value.size > 1)
113
- return Quantifier['Many']
114
- else
115
- return Quantifier['None']
116
-
117
- default:
118
- return Quantifier['None']
119
- }
80
+ }),
81
+ }),
82
+ })
120
83
 
121
- default:
122
- return Quantifier['None']
123
- }
124
- }
84
+ export const inferQuantifier = Object.freeze(
85
+ /** @returns {typeof Quantifier[keyof typeof Quantifier]} */
86
+ x => Quantifier[x?.quantifier ?? x] ?? Quantifier['None'],
87
+ )
@@ -1,6 +1,4 @@
1
1
  import { Cardinality } from './cardinality.js'
2
- import { Kind } from './kind.js'
3
- import { Numerosity } from './numerosity.js'
4
2
  import { Service } from './service.js'
5
3
 
6
4
  export const Route = Object.freeze({
@@ -125,68 +123,6 @@ export const RouteCardinality = Object.freeze({
125
123
  [Route['venues/city']]: Cardinality['N-1'],
126
124
  })
127
125
 
128
- export const RouteNumerosity = Object.freeze({
129
- [Route['checkin']]: Numerosity['Singular'],
130
- [Route['checkins']]: Numerosity['Plural'],
131
- [Route['cities']]: Numerosity['Plural'],
132
- [Route['cities/country']]: Numerosity['Plural'],
133
- [Route['cities/currency']]: Numerosity['Plural'],
134
- [Route['cities/timezone']]: Numerosity['Plural'],
135
- [Route['cities/venues']]: Numerosity['Plural'],
136
- [Route['city']]: Numerosity['Singular'],
137
- [Route['city/country']]: Numerosity['Singular'],
138
- [Route['city/currency']]: Numerosity['Singular'],
139
- [Route['city/timezone']]: Numerosity['Singular'],
140
- [Route['city/venues']]: Numerosity['Singular'],
141
- [Route['countries']]: Numerosity['Plural'],
142
- [Route['country']]: Numerosity['Singular'],
143
- [Route['currencies']]: Numerosity['Plural'],
144
- [Route['currency']]: Numerosity['Singular'],
145
- [Route['game']]: Numerosity['Singular'],
146
- [Route['game/city']]: Numerosity['Singular'],
147
- [Route['game/registrations']]: Numerosity['Plural'],
148
- [Route['game/registrations/export']]: Numerosity['Singular'],
149
- [Route['game/summary']]: Numerosity['Singular'],
150
- [Route['game/theme']]: Numerosity['Singular'],
151
- [Route['game/venue']]: Numerosity['Singular'],
152
- [Route['games']]: Numerosity['Plural'],
153
- [Route['games/city']]: Numerosity['Plural'],
154
- [Route['games/registrations']]: Numerosity['Plural'],
155
- [Route['games/registrations/export']]: Numerosity['Plural'],
156
- [Route['games/summary']]: Numerosity['Plural'],
157
- [Route['games/theme']]: Numerosity['Plural'],
158
- [Route['games/venue']]: Numerosity['Plural'],
159
- [Route['registration']]: Numerosity['Singular'],
160
- [Route['registration/cancellation']]: Numerosity['Singular'],
161
- [Route['registration/channel']]: Numerosity['Singular'],
162
- [Route['registration/confirmation']]: Numerosity['Singular'],
163
- [Route['registration/export']]: Numerosity['Singular'],
164
- [Route['registration/game']]: Numerosity['Singular'],
165
- [Route['registration/mailing']]: Numerosity['Singular'],
166
- [Route['registrations']]: Numerosity['Plural'],
167
- [Route['registrations/export']]: Numerosity['Singular'],
168
- [Route['role']]: Numerosity['Singular'],
169
- [Route['roles']]: Numerosity['Plural'],
170
- [Route['theme']]: Numerosity['Singular'],
171
- [Route['theme/cover']]: Numerosity['Singular'],
172
- [Route['themes']]: Numerosity['Plural'],
173
- [Route['themes/cover']]: Numerosity['Plural'],
174
- [Route['timezone']]: Numerosity['Singular'],
175
- [Route['timezones']]: Numerosity['Plural'],
176
- [Route['user']]: Numerosity['Singular'],
177
- [Route['user/cities']]: Numerosity['Plural'],
178
- [Route['user/password']]: Numerosity['Singular'],
179
- [Route['user/role']]: Numerosity['Singular'],
180
- [Route['users']]: Numerosity['Plural'],
181
- [Route['users/cities']]: Numerosity['Plural'],
182
- [Route['users/password']]: Numerosity['Plural'],
183
- [Route['users/role']]: Numerosity['Plural'],
184
- [Route['venue']]: Numerosity['Singular'],
185
- [Route['venue/city']]: Numerosity['Singular'],
186
- [Route['venues']]: Numerosity['Plural'],
187
- [Route['venues/city']]: Numerosity['Plural'],
188
- })
189
-
190
126
  export const RouteRelation = Object.freeze({
191
127
  [Route['cities']]: Route['city'],
192
128
  [Route['cities/country']]: Route['city/country'],
@@ -279,104 +215,6 @@ export const RoutePathname = Object.freeze({
279
215
  [Route['venues/city']]: 'venues/city',
280
216
  })
281
217
 
282
- export const RouteKind = Object.freeze({
283
- [Route['checkin']]: Kind['Atomic'],
284
- [Route['checkins']]: Kind['Atomic'],
285
- [Route['cities']]: Kind['Atomic'],
286
- [Route['cities/country']]: Kind['Composite'],
287
- [Route['cities/currency']]: Kind['Composite'],
288
- [Route['cities/timezone']]: Kind['Composite'],
289
- [Route['cities/venues']]: Kind['Composite'],
290
- [Route['city']]: Kind['Atomic'],
291
- [Route['city/country']]: Kind['Composite'],
292
- [Route['city/currency']]: Kind['Composite'],
293
- [Route['city/timezone']]: Kind['Composite'],
294
- [Route['city/venues']]: Kind['Composite'],
295
- [Route['countries']]: Kind['Atomic'],
296
- [Route['country']]: Kind['Atomic'],
297
- [Route['currencies']]: Kind['Atomic'],
298
- [Route['currency']]: Kind['Atomic'],
299
- [Route['game']]: Kind['Atomic'],
300
- [Route['game/city']]: Kind['Composite'],
301
- [Route['game/registrations']]: Kind['Composite'],
302
- [Route['game/registrations/export']]: Kind['Procedure'],
303
- [Route['game/summary']]: Kind['Composite'],
304
- [Route['game/theme']]: Kind['Composite'],
305
- [Route['game/venue']]: Kind['Composite'],
306
- [Route['games']]: Kind['Atomic'],
307
- [Route['games/city']]: Kind['Composite'],
308
- [Route['games/registrations']]: Kind['Composite'],
309
- [Route['games/registrations/export']]: Kind['Procedure'],
310
- [Route['games/summary']]: Kind['Composite'],
311
- [Route['games/theme']]: Kind['Composite'],
312
- [Route['games/venue']]: Kind['Composite'],
313
- [Route['registration']]: Kind['Atomic'],
314
- [Route['registration/cancellation']]: Kind['Composite'],
315
- [Route['registration/channel']]: Kind['Composite'],
316
- [Route['registration/confirmation']]: Kind['Composite'],
317
- [Route['registration/export']]: Kind['Procedure'],
318
- [Route['registration/game']]: Kind['Composite'],
319
- [Route['registration/mailing']]: Kind['Composite'],
320
- [Route['registrations']]: Kind['Atomic'],
321
- [Route['registrations/export']]: Kind['Procedure'],
322
- [Route['role']]: Kind['Atomic'],
323
- [Route['roles']]: Kind['Atomic'],
324
- [Route['theme']]: Kind['Atomic'],
325
- [Route['theme/cover']]: Kind['Composite'],
326
- [Route['themes']]: Kind['Atomic'],
327
- [Route['themes/cover']]: Kind['Composite'],
328
- [Route['timezone']]: Kind['Atomic'],
329
- [Route['timezones']]: Kind['Atomic'],
330
- [Route['user']]: Kind['Atomic'],
331
- [Route['user/cities']]: Kind['Composite'],
332
- [Route['user/password']]: Kind['Composite'],
333
- [Route['user/role']]: Kind['Composite'],
334
- [Route['users']]: Kind['Atomic'],
335
- [Route['users/cities']]: Kind['Composite'],
336
- [Route['users/password']]: Kind['Composite'],
337
- [Route['users/role']]: Kind['Composite'],
338
- [Route['venue']]: Kind['Atomic'],
339
- [Route['venue/city']]: Kind['Composite'],
340
- [Route['venues']]: Kind['Atomic'],
341
- [Route['venues/city']]: Kind['Composite'],
342
- })
343
-
344
- export const CompositeRouteField = Object.freeze({
345
- [Route['cities/country']]: 'country',
346
- [Route['cities/currency']]: 'currency',
347
- [Route['cities/timezone']]: 'timezone',
348
- [Route['cities/venues']]: 'venues',
349
- [Route['city/country']]: 'country',
350
- [Route['city/currency']]: 'currency',
351
- [Route['city/timezone']]: 'timezone',
352
- [Route['city/venues']]: 'venues',
353
- [Route['game/city']]: 'city',
354
- [Route['game/registrations']]: 'registrations',
355
- [Route['game/summary']]: 'summary',
356
- [Route['game/theme']]: 'theme',
357
- [Route['game/venue']]: 'venue',
358
- [Route['games/city']]: 'city',
359
- [Route['games/registrations']]: 'registrations',
360
- [Route['games/summary']]: 'summary',
361
- [Route['games/theme']]: 'theme',
362
- [Route['games/venue']]: 'venue',
363
- [Route['registration/cancellation']]: 'cancellation',
364
- [Route['registration/channel']]: 'channel',
365
- [Route['registration/confirmation']]: 'confirmation',
366
- [Route['registration/game']]: 'game',
367
- [Route['registration/mailing']]: 'mailing',
368
- [Route['theme/cover']]: 'cover',
369
- [Route['themes/cover']]: 'cover',
370
- [Route['user/cities']]: 'cities',
371
- [Route['user/password']]: 'password',
372
- [Route['user/role']]: 'role',
373
- [Route['users/cities']]: 'cities',
374
- [Route['users/password']]: 'password',
375
- [Route['users/role']]: 'role',
376
- [Route['venue/city']]: 'city',
377
- [Route['venues/city']]: 'city',
378
- })
379
-
380
218
  export const RouteParams = Object.freeze({
381
219
  [Route['checkin']]: [],
382
220
  [Route['checkins']]: [],
@@ -597,32 +435,37 @@ export const ServiceRoutes = Object.freeze({
597
435
  [Service['Vkma']]: Object.freeze([]),
598
436
  })
599
437
 
600
- /** @returns {typeof Route[keyof typeof Route] | 'Unknown'} */
601
- export const inferRoute = x => Route[x] ?? 'Unknown'
602
-
603
- /** @returns {typeof RouteCardinality[keyof typeof RouteCardinality] | 'Unknown'} */
604
- export const inferRouteCardinality = x => RouteCardinality[x] ?? 'Unknown'
605
-
606
- /** @returns {typeof RouteNumerosity[keyof typeof RouteNumerosity] | 'Unknown'} */
607
- export const inferRouteNumerosity = x => RouteNumerosity[x] ?? 'Unknown'
608
-
609
- /** @returns {typeof RouteRelation[keyof typeof RouteRelation] | 'Unknown'} */
610
- export const inferRouteRelation = x => RouteRelation[x] ?? 'Unknown'
611
-
612
- /** @returns {typeof RoutePathname[keyof typeof RoutePathname] | 'Unknown'} */
613
- export const inferRoutePathname = x => RoutePathname[x] ?? 'Unknown'
614
-
615
- /** @returns {typeof RouteKind[keyof typeof RouteKind] | 'Unknown'} */
616
- export const inferRouteKind = x => RouteKind[x] ?? 'Unknown'
617
-
618
- /** @returns {typeof CompositeRouteField[keyof typeof CompositeRouteField] | 'Unknown'} */
619
- export const inferCompositeRouteField = x => CompositeRouteField[x] ?? 'Unknown'
620
-
621
- /** @returns {typeof RouteParams[keyof typeof RouteParams] | 'Unknown'} */
622
- export const inferRouteParams = x => RouteParams[x] ?? 'Unknown'
623
-
624
- /** @returns {typeof RouteService[keyof typeof RouteService] | 'Unknown'} */
625
- export const inferRouteService = x => RouteService[x] ?? 'Unknown'
626
-
627
- /** @returns {typeof ServiceRoutes[keyof typeof ServiceRoutes] | 'Unknown'} */
628
- export const inferServiceRoutes = x => ServiceRoutes[x] ?? 'Unknown'
438
+ export const inferRoute = Object.freeze(
439
+ /** @returns {typeof Route[keyof typeof Route] | 'Unknown'} */
440
+ x => Route[x] ?? 'Unknown',
441
+ )
442
+
443
+ export const inferRouteCardinality = Object.freeze(
444
+ /** @returns {typeof RouteCardinality[keyof typeof RouteCardinality] | 'Unknown'} */
445
+ x => RouteCardinality[x] ?? 'Unknown',
446
+ )
447
+
448
+ export const inferRouteRelation = Object.freeze(
449
+ /** @returns {typeof RouteRelation[keyof typeof RouteRelation] | 'Unknown'} */
450
+ x => RouteRelation[x] ?? 'Unknown',
451
+ )
452
+
453
+ export const inferRoutePathname = Object.freeze(
454
+ /** @returns {typeof RoutePathname[keyof typeof RoutePathname] | 'Unknown'} */
455
+ x => RoutePathname[x] ?? 'Unknown',
456
+ )
457
+
458
+ export const inferRouteParams = Object.freeze(
459
+ /** @returns {typeof RouteParams[keyof typeof RouteParams] | 'Unknown'} */
460
+ x => RouteParams[x] ?? 'Unknown',
461
+ )
462
+
463
+ export const inferRouteService = Object.freeze(
464
+ /** @returns {typeof RouteService[keyof typeof RouteService] | 'Unknown'} */
465
+ x => RouteService[x] ?? 'Unknown',
466
+ )
467
+
468
+ export const inferServiceRoutes = Object.freeze(
469
+ /** @returns {typeof ServiceRoutes[keyof typeof ServiceRoutes] | 'Unknown'} */
470
+ x => ServiceRoutes[x] ?? 'Unknown',
471
+ )
@@ -1,6 +1,4 @@
1
- export var Runtime = /** @type {const} */ ({
1
+ export const Runtime = Object.freeze({
2
2
  'Next': 'Next',
3
3
  'React': 'React',
4
4
  })
5
-
6
- export var Runtimes = Object.values(Runtime)
@@ -1,6 +1,4 @@
1
- import { Mode } from './mode.js'
2
-
3
- export var Service = /** @type {const} */ ({
1
+ export const Service = Object.freeze({
4
2
  'Users': 'Users',
5
3
  'Roles': 'Roles',
6
4
  'Checkin': 'Checkin',
@@ -20,7 +18,7 @@ export var Service = /** @type {const} */ ({
20
18
  'Minio': 'Minio',
21
19
  })
22
20
 
23
- export var Services = [
21
+ export const Services = Object.freeze([
24
22
  Service['Users'],
25
23
  Service['Roles'],
26
24
  Service['Checkin'],
@@ -38,4 +36,4 @@ export var Services = [
38
36
  Service['Landing'],
39
37
  Service['Vkma'],
40
38
  Service['Minio'],
41
- ]
39
+ ])
@@ -1,13 +1,16 @@
1
- export var StoreKey = {
2
- 'checkin': /^GET\/checkin$/,
3
- 'user': /^GET\/user\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
4
- 'role': /^GET\/role\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
5
- 'country': /^GET\/country\/[A-Z]{2}$/,
6
- 'currency': /^GET\/currency\/.+$/,
7
- 'timezone': /^GET\/timezone\/[A-Za-z_]+\/[A-Za-z_]+$/,
8
- 'city': /^GET\/city\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
9
- 'venue': /^GET\/venue\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
10
- 'theme': /^GET\/theme\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
11
- 'game': /^GET\/game\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
12
- 'registration': /^GET\/registration\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
13
- }
1
+ import { Pattern } from './pattern.js'
2
+ import { Route } from './route.js'
3
+
4
+ export const StoreKey = Object.freeze({
5
+ [Route.checkin]: /GET\/checkin/,
6
+ [Route.user]: new RegExp(`GET/user/${Pattern.UUID.source}`),
7
+ [Route.role]: new RegExp(`GET/role/${Pattern.UUID.source}`),
8
+ [Route.country]: /GET\/country\/[A-Z]{2}/,
9
+ [Route.currency]: /GET\/currency\/.+/,
10
+ [Route.timezone]: /GET\/timezone\/[A-Za-z_]+\/[A-Za-z_]+/,
11
+ [Route.city]: new RegExp(`GET/city/${Pattern.UUID.source}`),
12
+ [Route.venue]: new RegExp(`GET/venue/${Pattern.UUID.source}`),
13
+ [Route.theme]: new RegExp(`GET/theme/${Pattern.UUID.source}`),
14
+ [Route.game]: new RegExp(`GET/game/${Pattern.UUID.source}`),
15
+ [Route.registration]: new RegExp(`GET/registration/${Pattern.UUID.source}`),
16
+ })
@@ -1,29 +1,29 @@
1
- export var VenueAudience = /** @type {const} */ ({
1
+ export const VenueAudience = Object.freeze({
2
2
  'Open': 'Open',
3
3
  'Restricted': 'Restricted',
4
4
  })
5
5
 
6
- export var VenueAudiences = [
6
+ export const VenueAudiences = Object.freeze([
7
7
  VenueAudience['Open'],
8
8
  VenueAudience['Restricted'],
9
- ]
9
+ ])
10
10
 
11
- export var VenueAudienceTitle = {
11
+ export const VenueAudienceTitle = Object.freeze({
12
12
  [VenueAudience['Open']]: 'Без ограничений',
13
13
  [VenueAudience['Restricted']]: 'Только взрослые',
14
- }
14
+ })
15
15
 
16
- export var VenueAudienceIcon = {
16
+ export const VenueAudienceIcon = Object.freeze({
17
17
  [VenueAudience['Open']]: 'hero/outline/lock-open',
18
18
  [VenueAudience['Restricted']]: 'hero/outline/lock-closed',
19
- }
19
+ })
20
20
 
21
- var ValueVenueAudience = {
21
+ const ValueVenueAudience = Object.freeze({
22
22
  ['false']: VenueAudience['Open'],
23
23
  ['true']: VenueAudience['Restricted'],
24
- }
24
+ })
25
25
 
26
- var VenueAudienceShape = /** @type {const} */ ({
26
+ const VenueAudienceShape = /** @type {const} */ (Object.freeze({
27
27
  [VenueAudience['Open']]: {
28
28
  is_adult: false,
29
29
  },
@@ -31,15 +31,14 @@ var VenueAudienceShape = /** @type {const} */ ({
31
31
  [VenueAudience['Restricted']]: {
32
32
  is_adult: true,
33
33
  },
34
- })
34
+ }))
35
35
 
36
- /** @returns {keyof typeof VenueAudience | 'Unknown'} */
37
- export var inferVenueAudience = value =>
38
- ValueVenueAudience[value?.is_adult]
39
- ?? VenueAudience[value]
40
- ?? 'Unknown'
36
+ export const inferVenueAudience = Object.freeze(
37
+ /** @returns {keyof typeof VenueAudience | 'Unknown'} */
38
+ x => ValueVenueAudience[x?.is_adult] ?? VenueAudience[x] ?? 'Unknown',
39
+ )
41
40
 
42
- /** @returns {typeof VenueAudienceShape[keyof typeof VenueAudienceShape] | { readonly is_adult: null }} */
43
- export var inferVenueAudienceShape = value =>
44
- VenueAudienceShape[value]
45
- ?? { is_adult: null }
41
+ export const inferVenueAudienceShape = Object.freeze(
42
+ /** @returns {typeof VenueAudienceShape[keyof typeof VenueAudienceShape] | { readonly is_adult: null }} */
43
+ x => VenueAudienceShape[x] ?? { is_adult: null },
44
+ )
@@ -18,7 +18,7 @@ export var VenueStatusIcon = {
18
18
  [VenueStatus['ARCHIVE']]: 'hero/outline/archive-box',
19
19
  }
20
20
 
21
- /** @returns {keyof typeof VenueStatus | 'Unknown'} */
22
- export var inferVenueStatus = value =>
23
- VenueStatus[value?.status ?? value]
24
- ?? 'Unknown'
21
+ export var inferVenueStatus = Object.freeze(
22
+ /** @returns {keyof typeof VenueStatus | 'Unknown'} */
23
+ x => VenueStatus[x?.status ?? x] ?? 'Unknown',
24
+ )
package/source/index.js CHANGED
@@ -4,14 +4,13 @@ export * from './enumerations/constants.js'
4
4
  export * from './enumerations/display.js'
5
5
  export * from './enumerations/gender.js'
6
6
  export * from './enumerations/icon.js'
7
- export * from './enumerations/kind.js'
8
7
  export * from './enumerations/method.js'
9
8
  export * from './enumerations/mode.js'
10
9
  export * from './enumerations/network.js'
11
10
  export * from './enumerations/numerosity.js'
12
11
  export * from './enumerations/phase.js'
13
12
  export * from './enumerations/quantifier.js'
14
- export * from './enumerations/regexp.js'
13
+ export * from './enumerations/pattern.js'
15
14
  export * from './enumerations/route.js'
16
15
  export * from './enumerations/runtime.js'
17
16
  export * from './enumerations/service.js'
@@ -0,0 +1,34 @@
1
+ {
2
+ "types": "array",
3
+ "items": {
4
+ "type": "object",
5
+ "properties": {
6
+ "location_id": {
7
+ "type": "string",
8
+ "format": "uuid"
9
+ },
10
+ "number": {
11
+ "type": "string"
12
+ },
13
+ "event_time": {
14
+ "type": "string",
15
+ "format": "iso-date-time"
16
+ },
17
+ "price": {
18
+ "type": "number"
19
+ },
20
+ "min_members_count": {
21
+ "type": "integer"
22
+ },
23
+ "max_members_count": {
24
+ "type": "integer"
25
+ },
26
+ "status": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [],
31
+ "additionalProperties": false
32
+ },
33
+ "uniqueItems": true
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "type": "array",
3
+ "items": {
4
+ "type": "object",
5
+ "properties": {
6
+ "location_id": {
7
+ "type": "string",
8
+ "format": "uuid"
9
+ },
10
+ "number": {
11
+ "type": "string"
12
+ },
13
+ "event_time": {
14
+ "type": "string",
15
+ "format": "iso-date-time"
16
+ },
17
+ "price": {
18
+ "type": "number"
19
+ },
20
+ "min_members_count": {
21
+ "type": "integer"
22
+ },
23
+ "max_members_count": {
24
+ "type": "integer"
25
+ },
26
+ "status": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [],
31
+ "additionalProperties": false
32
+ },
33
+ "uniqueItems": true
34
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "type": "array",
3
+ "items": {
4
+ "type": "object",
5
+ "properties": {
6
+ "id": {
7
+ "type": "string",
8
+ "format": "uuid"
9
+ },
10
+ "cities": {
11
+ "type": "array",
12
+ "items": {
13
+ "type": "object",
14
+ "properties": {}
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "type": "array",
3
+ "items": {
4
+ "type": "object",
5
+ "properties": {
6
+ "id": {
7
+ "type": "string"
8
+ },
9
+ "role": {
10
+ "type": "object",
11
+ "properties": {
12
+ "id": {
13
+ "type": "string"
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -1,5 +0,0 @@
1
- export const Kind = Object.freeze({
2
- 'Atomic': 'Atomic',
3
- 'Composite': 'Composite',
4
- 'Procedure': 'Procedure',
5
- })
@@ -1,4 +0,0 @@
1
- export var RegExps = {
2
- Uuid: /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,
3
- Jwt: /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$/,
4
- }