@shakerquiz/utilities 0.5.220 → 0.5.222
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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const RegistrationLineup = Object.freeze({
|
|
2
|
+
'Main': 'Main',
|
|
3
|
+
'Reserve': 'Reserve',
|
|
4
|
+
})
|
|
5
|
+
|
|
6
|
+
/** @satisfies {Array<keyof typeof RegistrationLineup>} */
|
|
7
|
+
export const RegistrationLineups = Object.freeze([
|
|
8
|
+
'Main',
|
|
9
|
+
'Reserve',
|
|
10
|
+
])
|
|
11
|
+
|
|
12
|
+
/** @satisfies {Record<keyof typeof RegistrationLineup, string>} */
|
|
13
|
+
export const RegistrationLineupTitle = Object.freeze({
|
|
14
|
+
'Main': 'Основа',
|
|
15
|
+
'Reserve': 'Резерв',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/** @satisfies {Record<keyof typeof RegistrationLineup, string>} */
|
|
19
|
+
export const RegistrationLineupIcon = Object.freeze({
|
|
20
|
+
'Main': 'hero/outline/user-circle',
|
|
21
|
+
'Reserve': 'hero/outline/pause-circle',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/** @satisfies {Record<keyof typeof RegistrationLineup, string>} */
|
|
25
|
+
export const RegistrationLineupEmoji = Object.freeze({
|
|
26
|
+
'Main': '🟢',
|
|
27
|
+
'Reserve': '🟡',
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export const inferRegistrationLineup = Object.freeze(
|
|
31
|
+
/** @returns {keyof typeof RegistrationLineup | 'Unknown'} */
|
|
32
|
+
x => RegistrationLineup[x?.lineup ?? x] ?? 'Unknown',
|
|
33
|
+
)
|
|
@@ -4,59 +4,35 @@ export const RegistrationStatus = Object.freeze({
|
|
|
4
4
|
'Cancelled': 'Cancelled',
|
|
5
5
|
})
|
|
6
6
|
|
|
7
|
+
/** @satisfies {Array<keyof typeof RegistrationStatus>} */
|
|
7
8
|
export const RegistrationStatuses = Object.freeze([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
'Created',
|
|
10
|
+
'Confirmed',
|
|
11
|
+
'Cancelled',
|
|
11
12
|
])
|
|
12
13
|
|
|
14
|
+
/** @satisfies {Record<keyof typeof RegistrationStatus, string>} */
|
|
13
15
|
export const RegistrationStatusTitle = Object.freeze({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
'Confirmed': 'Подтверждена',
|
|
17
|
+
'Created': 'Создана',
|
|
18
|
+
'Cancelled': 'Отменена',
|
|
17
19
|
})
|
|
18
20
|
|
|
21
|
+
/** @satisfies {Record<keyof typeof RegistrationStatus, string>} */
|
|
19
22
|
export const RegistrationStatusIcon = Object.freeze({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
'Confirmed': 'hero/outline/check-circle',
|
|
24
|
+
'Created': 'hero/outline/check',
|
|
25
|
+
'Cancelled': 'hero/outline/x-mark',
|
|
23
26
|
})
|
|
24
27
|
|
|
28
|
+
/** @satisfies {Record<keyof typeof RegistrationStatus, string>} */
|
|
25
29
|
export const RegistrationStatusEmoji = Object.freeze({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
}),
|
|
30
|
+
'Confirmed': '✅',
|
|
31
|
+
'Created': '📝',
|
|
32
|
+
'Cancelled': '❌',
|
|
52
33
|
})
|
|
53
34
|
|
|
54
35
|
export const inferRegistrationStatus = Object.freeze(
|
|
55
36
|
/** @returns {keyof typeof RegistrationStatus | 'Unknown'} */
|
|
56
|
-
x =>
|
|
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 },
|
|
37
|
+
x => RegistrationStatus[x?.status ?? x] ?? 'Unknown',
|
|
62
38
|
)
|
|
@@ -8,19 +8,19 @@ export const tag = Object.freeze(
|
|
|
8
8
|
* @template {keyof typeof import('../enumerations/route.js').Route} R
|
|
9
9
|
* @template {typeof import('../enumerations/route.js').RoutePathname[R]} P
|
|
10
10
|
*
|
|
11
|
-
* @param {M}
|
|
12
|
-
* @param {R}
|
|
13
|
-
* @param {
|
|
11
|
+
* @param {M} method
|
|
12
|
+
* @param {R} route
|
|
13
|
+
* @param {any[]} params
|
|
14
14
|
*
|
|
15
15
|
* @returns {`${M}/${P}`}
|
|
16
16
|
*/
|
|
17
|
-
(
|
|
18
|
-
var method = inferMethod(
|
|
17
|
+
(method, route, params) => {
|
|
18
|
+
var method = inferMethod(method)
|
|
19
19
|
|
|
20
20
|
if (method === 'Unknown')
|
|
21
|
-
throw TypeError(`Could not infer method of: '${
|
|
21
|
+
throw TypeError(`Could not infer method of: '${method}'.`)
|
|
22
22
|
|
|
23
|
-
return method + '/' + hydrateRoutePathname(
|
|
23
|
+
return method + '/' + hydrateRoutePathname(route, params)
|
|
24
24
|
},
|
|
25
25
|
)
|
|
26
26
|
|
|
@@ -29,9 +29,9 @@ export const tagexp = Object.freeze(
|
|
|
29
29
|
* @template {keyof typeof import('../enumerations/method.js').Method} M
|
|
30
30
|
* @template {keyof typeof import('../enumerations/route.js').Route} R
|
|
31
31
|
*
|
|
32
|
-
* @param {M}
|
|
33
|
-
* @param {R}
|
|
34
|
-
* @param {
|
|
32
|
+
* @param {M} method
|
|
33
|
+
* @param {R} route
|
|
34
|
+
* @param {any[]} params
|
|
35
35
|
*/
|
|
36
|
-
(
|
|
36
|
+
(method, route, params) => new RegExp(`^${tag(method, route, params)}$`),
|
|
37
37
|
)
|
package/source/index.js
CHANGED
|
@@ -20,7 +20,6 @@ export * from './enumerations/entities/affilation.js'
|
|
|
20
20
|
export * from './enumerations/entities/game-status.js'
|
|
21
21
|
export * from './enumerations/entities/registration-attribute.js'
|
|
22
22
|
export * from './enumerations/entities/registration-channel.js'
|
|
23
|
-
export * from './enumerations/entities/registration-lineup.js'
|
|
24
23
|
export * from './enumerations/entities/registration-mailing.js'
|
|
25
24
|
export * from './enumerations/entities/role.js'
|
|
26
25
|
export * from './enumerations/entities/version.js'
|
|
@@ -30,9 +29,10 @@ export * from './enumerations/venue/status.js'
|
|
|
30
29
|
|
|
31
30
|
export * from './enumerations/theme/status.js'
|
|
32
31
|
|
|
32
|
+
export * from './enumerations/registration/lineup.js'
|
|
33
33
|
export * from './enumerations/registration/status.js'
|
|
34
34
|
|
|
35
35
|
export * from './functions/hydrate-route-params.js'
|
|
36
36
|
export * from './functions/hydrate-route-pathname.js'
|
|
37
|
-
export * from './functions/key.js'
|
|
38
37
|
export * from './functions/string-tag.js'
|
|
38
|
+
export * from './functions/tag.js'
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export const RegistrationLineup = Object.freeze({
|
|
2
|
-
'Main': 'Main',
|
|
3
|
-
'Reserve': 'Reserve',
|
|
4
|
-
})
|
|
5
|
-
|
|
6
|
-
export const RegistrationLineups = Object.freeze([
|
|
7
|
-
RegistrationLineup['Main'],
|
|
8
|
-
RegistrationLineup['Reserve'],
|
|
9
|
-
])
|
|
10
|
-
|
|
11
|
-
export const RegistrationLineupTitle = Object.freeze({
|
|
12
|
-
[RegistrationLineup['Main']]: 'Основа',
|
|
13
|
-
[RegistrationLineup['Reserve']]: 'Резерв',
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export const RegistrationLineupIcon = Object.freeze({
|
|
17
|
-
[RegistrationLineup['Main']]: 'hero/outline/user-circle',
|
|
18
|
-
[RegistrationLineup['Reserve']]: 'hero/outline/pause-circle',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export const RegistrationLineupEmoji = Object.freeze({
|
|
22
|
-
[RegistrationLineup['Main']]: '🟢',
|
|
23
|
-
[RegistrationLineup['Reserve']]: '🟡',
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
export const ValueRegistrationLineup = Object.freeze({
|
|
27
|
-
'false': RegistrationLineup['Main'],
|
|
28
|
-
'true': RegistrationLineup['Reserve'],
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
export const RegistrationLineupShape = Object.freeze({
|
|
32
|
-
[RegistrationLineup['Main']]: Object.freeze({
|
|
33
|
-
is_reserve: false,
|
|
34
|
-
}),
|
|
35
|
-
|
|
36
|
-
[RegistrationLineup['Reserve']]: Object.freeze({
|
|
37
|
-
is_reserve: true,
|
|
38
|
-
}),
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
export const inferRegistrationLineup = Object.freeze(
|
|
42
|
-
/** @returns {keyof typeof RegistrationLineup | 'Unknown'} */
|
|
43
|
-
x => ValueRegistrationLineup[x?.is_reserve] ?? RegistrationLineup[x] ?? 'Unknown',
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
export const inferRegistrationLineupShape = Object.freeze(
|
|
47
|
-
/** @returns {typeof RegistrationLineupShape[keyof typeof RegistrationLineupShape] | { is_reserve: null }} */
|
|
48
|
-
x => RegistrationLineupShape[x] ?? { is_reserve: null },
|
|
49
|
-
)
|