@shakerquiz/utilities 0.5.194 → 0.5.195
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/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
|
+
)
|
|
@@ -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
|
-
}
|