@shakerquiz/utilities 3.0.0 → 4.0.1

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 (116) hide show
  1. package/.github/workflows/publish.yml +32 -0
  2. package/package.json +5 -5
  3. package/scripts/route-cardinality.js +23 -0
  4. package/scripts/route-parameter.js +29 -0
  5. package/scripts/route-pathname.js +37 -0
  6. package/scripts/route-relation.js +26 -0
  7. package/scripts/route-service.js +25 -0
  8. package/scripts/templates/route-cardinality.js +5 -0
  9. package/scripts/templates/route-parameter.js +5 -0
  10. package/scripts/templates/route-pathname.js +7 -0
  11. package/scripts/templates/route-relation.js +5 -0
  12. package/scripts/templates/route-service.js +7 -0
  13. package/source/entities/blend.js +5 -0
  14. package/source/entities/cardinality.js +4 -0
  15. package/source/entities/category.js +4 -0
  16. package/source/entities/city-affilation.js +10 -0
  17. package/source/entities/city-chatapp-version.js +9 -0
  18. package/source/{enumerations/misc → entities}/constants.js +1 -1
  19. package/source/entities/display.js +4 -0
  20. package/source/entities/game-status.js +98 -0
  21. package/source/entities/gender.js +13 -0
  22. package/source/entities/icon.js +654 -0
  23. package/source/entities/key.js +41 -0
  24. package/source/{enumerations/core/methods.js → entities/method.js} +10 -4
  25. package/source/entities/mode.js +9 -0
  26. package/source/entities/network.js +9 -0
  27. package/source/entities/numerosity.js +5 -0
  28. package/source/entities/pattern.js +7 -0
  29. package/source/entities/phase.js +15 -0
  30. package/source/entities/quantifier.js +41 -0
  31. package/source/entities/registration-attribute.js +61 -0
  32. package/source/entities/registration-channel.js +11 -0
  33. package/source/entities/registration-lineup.js +14 -0
  34. package/source/entities/registration-mailing.js +20 -0
  35. package/source/entities/registration-status.js +19 -0
  36. package/source/entities/role.js +16 -0
  37. package/source/entities/route-cardinality.js +151 -0
  38. package/source/entities/route-parameter.js +151 -0
  39. package/source/entities/route-pathname.js +226 -0
  40. package/source/entities/route-relation.js +151 -0
  41. package/source/entities/route-service.js +181 -0
  42. package/source/entities/route.js +83 -0
  43. package/source/entities/runtime.js +6 -0
  44. package/source/entities/segment.js +255 -0
  45. package/source/entities/service-runtime.js +22 -0
  46. package/source/entities/service.js +22 -0
  47. package/source/entities/theme-status.js +9 -0
  48. package/source/entities/venue-audience.js +9 -0
  49. package/source/entities/venue-status.js +9 -0
  50. package/source/helpers/access.js +161 -0
  51. package/source/helpers/hydrate-route-pathname.js +29 -0
  52. package/source/helpers/tag.js +35 -0
  53. package/source/index.js +40 -34
  54. package/source/enumerations/core/features.js +0 -56
  55. package/source/enumerations/core/networks.js +0 -6
  56. package/source/enumerations/core/runtimes.js +0 -6
  57. package/source/enumerations/entities/affilation.js +0 -91
  58. package/source/enumerations/entities/cities-mode.js +0 -49
  59. package/source/enumerations/entities/city/timezone-mode.js +0 -44
  60. package/source/enumerations/entities/city/venues-mode.js +0 -60
  61. package/source/enumerations/entities/game-status.js +0 -130
  62. package/source/enumerations/entities/password-mode.js +0 -40
  63. package/source/enumerations/entities/registration-attribute.js +0 -83
  64. package/source/enumerations/entities/registration-channel.js +0 -26
  65. package/source/enumerations/entities/registration-lineup.js +0 -75
  66. package/source/enumerations/entities/registration-mailing.js +0 -24
  67. package/source/enumerations/entities/registration-status.js +0 -89
  68. package/source/enumerations/entities/role-mode.js +0 -40
  69. package/source/enumerations/entities/role.js +0 -82
  70. package/source/enumerations/entities/venue/audience.js +0 -100
  71. package/source/enumerations/entities/venue/city-mode.js +0 -44
  72. package/source/enumerations/entities/venue/status.js +0 -53
  73. package/source/enumerations/entities/version.js +0 -76
  74. package/source/enumerations/misc/icons.js +0 -655
  75. package/source/enumerations/misc/keys.js +0 -15
  76. package/source/enumerations/misc/phases.js +0 -42
  77. package/source/enumerations/misc/regexps.js +0 -5
  78. package/source/enumerations/misc/routes.js +0 -610
  79. package/source/functions/tag.d.ts +0 -1
  80. package/source/functions/tag.js +0 -5
  81. package/source/schemas/PATCH/city/admin.json +0 -126
  82. package/source/schemas/PATCH/city/currency/admin.json +0 -173
  83. package/source/schemas/PATCH/city/timezone/admin.json +0 -501
  84. package/source/schemas/PATCH/game/admin.json +0 -30
  85. package/source/schemas/PATCH/game/organizer.json +0 -30
  86. package/source/schemas/PATCH/registration/admin.json +0 -43
  87. package/source/schemas/PATCH/registration/cancellation/default.json +0 -12
  88. package/source/schemas/PATCH/registration/channel/default.json +0 -22
  89. package/source/schemas/PATCH/registration/confirmation/default.json +0 -12
  90. package/source/schemas/PATCH/registration/default.json +0 -10
  91. package/source/schemas/PATCH/registration/organizer.json +0 -43
  92. package/source/schemas/PATCH/theme/admin.json +0 -19
  93. package/source/schemas/PATCH/user/admin.json +0 -30
  94. package/source/schemas/PATCH/user/cities/admin.json +0 -17
  95. package/source/schemas/PATCH/user/password/admin.json +0 -12
  96. package/source/schemas/PATCH/user/role/admin.json +0 -13
  97. package/source/schemas/PATCH/venue/admin.json +0 -44
  98. package/source/schemas/PATCH/venue/organizer.json +0 -44
  99. package/source/schemas/POST/checkin/default.json +0 -16
  100. package/source/schemas/POST/city/admin.json +0 -696
  101. package/source/schemas/POST/game/admin.json +0 -27
  102. package/source/schemas/POST/game/organizer.json +0 -27
  103. package/source/schemas/POST/game/registrations/export/admin.json +0 -17
  104. package/source/schemas/POST/game/registrations/export/organizer.json +0 -17
  105. package/source/schemas/POST/registration/default.json +0 -125
  106. package/source/schemas/POST/registration/mailing/admin.json +0 -16
  107. package/source/schemas/POST/registration/mailing/organizer.json +0 -16
  108. package/source/schemas/POST/registrations/export/admin.json +0 -17
  109. package/source/schemas/POST/registrations/export/organizer.json +0 -17
  110. package/source/schemas/POST/theme/admin.json +0 -24
  111. package/source/schemas/POST/user/admin.json +0 -12
  112. package/source/schemas/POST/user/cities/admin.json +0 -17
  113. package/source/schemas/POST/user/password/admin.json +0 -12
  114. package/source/schemas/POST/user/role/admin.json +0 -13
  115. package/source/schemas/POST/venue/admin.json +0 -38
  116. package/source/schemas/POST/venue/organizer.json +0 -38
@@ -1,56 +0,0 @@
1
- export var Feature = /** @type {const} */ ({
2
- 'role': 'role',
3
- 'roles': 'roles',
4
- 'user': 'user',
5
- 'users': 'users',
6
- 'checkin': 'checkin',
7
- 'checkins': 'checkins',
8
- 'country': 'country',
9
- 'countries': 'countries',
10
- 'currency': 'currency',
11
- 'currencies': 'currencies',
12
- 'timezone': 'timezone',
13
- 'timezones': 'timezones',
14
- 'city': 'city',
15
- 'cities': 'cities',
16
- 'venue': 'venue',
17
- 'venues': 'venues',
18
- 'theme': 'theme',
19
- 'themes': 'themes',
20
- 'game': 'game',
21
- 'games': 'games',
22
- 'registration': 'registration',
23
- 'registrations': 'registrations',
24
- 'mailing': 'mailing',
25
- 'mailings': 'mailings',
26
- })
27
-
28
- export var Features = Object.values(Feature)
29
-
30
- /** @type {Record<Feature, Icon>} */
31
- export var FeatureIcon = {
32
- [Feature.role]: 'hero/solid/identification',
33
- [Feature.roles]: 'hero/solid/identification',
34
- [Feature.user]: 'hero/solid/users',
35
- [Feature.users]: 'hero/solid/users',
36
- [Feature.checkin]: 'arrow-right-end-on-rectangle',
37
- [Feature.checkins]: 'arrow-right-end-on-rectangle',
38
- [Feature.country]: 'hero/outline/no-symbol',
39
- [Feature.countries]: 'hero/outline/no-symbol',
40
- [Feature.currency]: 'hero/outline/banknotes',
41
- [Feature.currencies]: 'hero/outline/banknotes',
42
- [Feature.timezone]: 'hero/outline/no-symbol',
43
- [Feature.timezones]: 'hero/outline/no-symbol',
44
- [Feature.city]: 'hero/outline/building-office',
45
- [Feature.cities]: 'hero/outline/building-office',
46
- [Feature.venue]: 'hero/outline/map-pin',
47
- [Feature.venues]: 'hero/outline/map-pin',
48
- [Feature.theme]: 'hero/outline/document-text',
49
- [Feature.themes]: 'hero/outline/document-text',
50
- [Feature.game]: 'hero/outline/newspaper',
51
- [Feature.games]: 'hero/outline/newspaper',
52
- [Feature.registration]: 'hero/outline/user-group',
53
- [Feature.registrations]: 'hero/outline/user-group',
54
- [Feature.mailing]: 'hero/outline/envelope',
55
- [Feature.mailings]: 'hero/outline/envelope',
56
- }
@@ -1,6 +0,0 @@
1
- export var Network = /** @type {const} */ ({
2
- 'Docker': 'Docker',
3
- 'Public': 'Public',
4
- })
5
-
6
- export var Networks = Object.values(Network)
@@ -1,6 +0,0 @@
1
- export var Runtime = /** @type {const} */ ({
2
- 'Next': 'Next',
3
- 'React': 'React',
4
- })
5
-
6
- export var Runtimes = Object.values(Runtime)
@@ -1,91 +0,0 @@
1
- export var Affilation = /** @type {const} */ ({
2
- 'Branch': 'Branch',
3
- 'Franchise': 'Franchise',
4
- 'Unknown': 'Unknown',
5
- })
6
-
7
- export var Affilations = Object.values(Affilation)
8
-
9
- export var AffilationWeight = {
10
- [Affilation['Branch']]: 0,
11
- [Affilation['Franchise']]: 1,
12
- [Affilation['Unknown']]: 2,
13
- }
14
-
15
- export var AffilationTitle = {
16
- [Affilation['Branch']]: 'Филиал',
17
- [Affilation['Franchise']]: 'Франшиза',
18
- [Affilation['Unknown']]: 'Неизвестно',
19
- }
20
-
21
- export var AffilationActionTitle = {
22
- [Affilation['Branch']]: '',
23
- [Affilation['Franchise']]: '',
24
- [Affilation['Unknown']]: '',
25
- }
26
-
27
- export var AffilationActionDescpription = {
28
- [Affilation['Branch']]: '',
29
- [Affilation['Franchise']]: '',
30
- [Affilation['Unknown']]: '',
31
- }
32
-
33
- export var AffilationColor = {
34
- [Affilation['Branch']]: 'primary',
35
- [Affilation['Franchise']]: 'secondary',
36
- [Affilation['Unknown']]: 'danger',
37
- }
38
-
39
- export var AffilationTextColor = {
40
- [Affilation['Branch']]: 'text-primary',
41
- [Affilation['Franchise']]: 'text-secondary',
42
- [Affilation['Unknown']]: 'text-danger',
43
- }
44
-
45
- /** @type {Record<Affilation, Icon>} */
46
- export var AffilationIcon = {
47
- [Affilation['Branch']]: 'hero/outline/building-office-2',
48
- [Affilation['Franchise']]: 'hero/outline/building-storefront',
49
- [Affilation['Unknown']]: 'hero/outline/no-symbol',
50
- }
51
-
52
- /** @type {Record<Affilation, Pick<CityTable, 'is_franchise'>>} */
53
- export var AffilationShape = {
54
- [Affilation['Branch']]: {
55
- is_franchise: false,
56
- },
57
-
58
- [Affilation['Franchise']]: {
59
- is_franchise: true,
60
- },
61
-
62
- [Affilation['Unknown']]: {
63
- is_franchise: null,
64
- },
65
- }
66
-
67
- export var AffilationShapes = Object.entries(AffilationShape)
68
-
69
- /**
70
- * @param {Affilation | typeof AffilationShape[Affilation]} value
71
- */
72
- export var getAffilation = value => {
73
- if (value === null)
74
- return Affilation['Unknown']
75
-
76
- switch (typeof value) {
77
- case 'object':
78
- return AffilationShapes
79
- .find(([, object]) => object.is_franchise === value.is_franchise)
80
- ?.at(0)
81
- ?? Affilation['Unknown']
82
-
83
- case 'string':
84
- return value in AffilationShape
85
- ? AffilationShape[value]
86
- : AffilationShape[Affilation['Unknown']]
87
-
88
- default:
89
- return Affilation['Unknown']
90
- }
91
- }
@@ -1,49 +0,0 @@
1
- export var CitiesMode = /** @type {const} */ ({
2
- 'all': 'all',
3
- 'many': 'many',
4
- 'single': 'single',
5
- 'none': 'none',
6
- 'unknown': 'unknown',
7
- })
8
-
9
- export var CitiesModes = Object.values(CitiesMode)
10
-
11
- export var CitiesModeTitle = {
12
- [CitiesMode.all]: 'Все',
13
- [CitiesMode.many]: 'Несколько',
14
- [CitiesMode.single]: 'Один',
15
- [CitiesMode.none]: 'Пусто',
16
- [CitiesMode.unknown]: 'Не назначено',
17
- }
18
-
19
- export var CitiesModeWeigth = {
20
- [CitiesMode.all]: 0,
21
- [CitiesMode.many]: 1,
22
- [CitiesMode.single]: 2,
23
- [CitiesMode.none]: 3,
24
- [CitiesMode.unknown]: 4,
25
- }
26
-
27
- /**
28
- * @param {keyof typeof CitiesMode} value
29
- */
30
- var getter = value =>
31
- value in CitiesMode
32
- ? value
33
- : CitiesMode['unknown']
34
-
35
- export var getCitiesMode = value => {
36
- if (value === null)
37
- return getter(undefined)
38
-
39
- switch (typeof value) {
40
- case 'string':
41
- return getter(value)
42
-
43
- case 'object':
44
- return getter(value?.mode)
45
-
46
- default:
47
- return getter(undefined)
48
- }
49
- }
@@ -1,44 +0,0 @@
1
- export var CityTimezoneMode = /** @type {const} */ ({
2
- 'Any': 'Any',
3
- 'Known': 'Known',
4
- 'Unknown': 'Unknown',
5
- })
6
-
7
- export var CityTimezoneModes = [
8
- CityTimezoneMode['Any'],
9
- CityTimezoneMode['Known'],
10
- CityTimezoneMode['Unknown'],
11
- ]
12
-
13
- export var CityTimezoneModeTitle = {
14
- [CityTimezoneMode['Any']]: 'Любой',
15
- [CityTimezoneMode['Known']]: 'Назначено',
16
- [CityTimezoneMode['Unknown']]: 'Неизвестно',
17
- }
18
-
19
- export var CityTimezoneModeIcon = {
20
- [CityTimezoneMode['Any']]: 'hero/outline/square-2-stack',
21
- [CityTimezoneMode['Known']]: 'hero/outline/check',
22
- [CityTimezoneMode['Unknown']]: 'hero/outline/no-symbol',
23
- }
24
-
25
- /**
26
- * @returns {keyof typeof CityTimezoneMode} value
27
- */
28
- var inferString = value =>
29
- value in CityTimezoneMode
30
- ? value
31
- : CityTimezoneMode['Unknown']
32
-
33
- export var inferCityTimezoneMode = value => {
34
- switch (typeof value) {
35
- case 'string':
36
- return inferString(value)
37
-
38
- case 'object':
39
- return inferString(value?.mode)
40
-
41
- default:
42
- return CityTimezoneMode['Unknown']
43
- }
44
- }
@@ -1,60 +0,0 @@
1
- export var CityVenuesMode = /** @type {const} */ ({
2
- 'Any': 'Any',
3
- 'None': 'None',
4
- 'Single': 'Single',
5
- 'Many': 'Many',
6
- 'Unknown': 'Unknown',
7
- })
8
-
9
- export var CityVenuesModes = [
10
- CityVenuesMode['Any'],
11
- CityVenuesMode['None'],
12
- CityVenuesMode['Single'],
13
- CityVenuesMode['Many'],
14
- CityVenuesMode['Unknown'],
15
- ]
16
-
17
- export var CityVenuesModeTitle = {
18
- [CityVenuesMode['None']]: 'Любые',
19
- [CityVenuesMode['None']]: 'Пусто',
20
- [CityVenuesMode['Single']]: 'Одно',
21
- [CityVenuesMode['Many']]: 'Несколько',
22
- [CityVenuesMode['Unknown']]: 'Неизвестно',
23
- }
24
-
25
- export var CityVenuesModeIcon = {
26
- [CityVenuesMode['Any']]: 'hero/outline/square-2-stack',
27
- [CityVenuesMode['None']]: 'hero/outline/no-symbol',
28
- [CityVenuesMode['Single']]: 'hero/outline/no-symbol',
29
- [CityVenuesMode['Many']]: 'hero/outline/no-symbol',
30
- [CityVenuesMode['Unknown']]: 'hero/outline/no-symbol',
31
- }
32
-
33
- /**
34
- * @returns {keyof typeof CityVenuesMode} value
35
- */
36
- var fromString = value =>
37
- value in CityVenuesMode
38
- ? value
39
- : CityVenuesMode['Unknown']
40
-
41
- /**
42
- * @returns {keyof typeof CityVenuesMode} value
43
- */
44
- var fromObject = value =>
45
- value?.mode in CityVenuesMode
46
- ? value.mode
47
- : CityVenuesMode['Unknown']
48
-
49
- export var inferCityVenuesMode = value => {
50
- switch (typeof value) {
51
- case 'string':
52
- return fromString(value)
53
-
54
- case 'object':
55
- return fromObject(value)
56
-
57
- default:
58
- return CityVenuesMode['Unknown']
59
- }
60
- }
@@ -1,130 +0,0 @@
1
- import { Role } from './role.js'
2
-
3
- export var GameStatus = /** @type {const} */ ({
4
- 'REJECTED': 'REJECTED',
5
- 'MODERATION': 'MODERATION',
6
- 'APPROVED': 'APPROVED',
7
- 'CLOSED': 'CLOSED',
8
- 'FORINVITES': 'FORINVITES',
9
- 'PUBLISHED': 'PUBLISHED',
10
- 'IS_RESERVE': 'IS_RESERVE',
11
- 'FINISHED': 'FINISHED',
12
- 'ARCHIVE': 'ARCHIVE',
13
- })
14
-
15
- export var GameStatuses = Object.values(GameStatus)
16
-
17
- export var GameStatusWeight = {
18
- [GameStatus.REJECTED]: 0,
19
- [GameStatus.MODERATION]: 1,
20
- [GameStatus.APPROVED]: 2,
21
- [GameStatus.CLOSED]: 3,
22
- [GameStatus.FORINVITES]: 4,
23
- [GameStatus.PUBLISHED]: 5,
24
- [GameStatus.IS_RESERVE]: 6,
25
- [GameStatus.FINISHED]: 7,
26
- [GameStatus.ARCHIVE]: 8,
27
- }
28
-
29
- export var GameStatusTitle = {
30
- [GameStatus.REJECTED]: 'Отклонено',
31
- [GameStatus.MODERATION]: 'На проверке',
32
- [GameStatus.APPROVED]: 'Одобрено',
33
- [GameStatus.CLOSED]: 'Закрыта',
34
- [GameStatus.FORINVITES]: 'По приглашению',
35
- [GameStatus.PUBLISHED]: 'Опубликовано',
36
- [GameStatus.IS_RESERVE]: 'В резерве',
37
- [GameStatus.FINISHED]: 'Завершено',
38
- [GameStatus.ARCHIVE]: 'В архиве',
39
- }
40
-
41
- export var GameStatusColor = {
42
- [GameStatus.REJECTED]: 'danger',
43
- [GameStatus.MODERATION]: 'primary',
44
- [GameStatus.APPROVED]: 'success',
45
- [GameStatus.CLOSED]: 'warning',
46
- [GameStatus.FORINVITES]: 'current',
47
- [GameStatus.PUBLISHED]: 'secondary',
48
- [GameStatus.IS_RESERVE]: 'blue-900',
49
- [GameStatus.FINISHED]: 'success',
50
- [GameStatus.ARCHIVE]: 'current',
51
- }
52
-
53
- export var GameStatusTextColor = {
54
- [GameStatus.REJECTED]: 'text-danger',
55
- [GameStatus.MODERATION]: 'text-primary',
56
- [GameStatus.APPROVED]: 'text-success',
57
- [GameStatus.CLOSED]: 'text-warning',
58
- [GameStatus.FORINVITES]: 'text-current',
59
- [GameStatus.PUBLISHED]: 'text-secondary',
60
- [GameStatus.IS_RESERVE]: 'text-blue-900',
61
- [GameStatus.FINISHED]: 'text-success',
62
- [GameStatus.ARCHIVE]: 'text-current',
63
- }
64
-
65
- /** @type {Record<GameStatus, Icon>} */
66
- export var GameStatusIcon = {
67
- [GameStatus.REJECTED]: 'hero/outline/x-mark',
68
- [GameStatus.MODERATION]: 'hero/outline/clock',
69
- [GameStatus.APPROVED]: 'hero/outline/hand-thumb-up',
70
- [GameStatus.CLOSED]: 'hero/outline/exclamation-triangle',
71
- [GameStatus.FORINVITES]: 'hero/outline/lock-closed',
72
- [GameStatus.PUBLISHED]: 'hero/outline/check-circle',
73
- [GameStatus.IS_RESERVE]: 'hero/outline/user-plus',
74
- [GameStatus.FINISHED]: 'hero/outline/check',
75
- [GameStatus.ARCHIVE]: 'hero/outline/archive-box',
76
- }
77
-
78
- /** @type {{ [Key in Role]: Partial<Record<GameStatus, GameStatus[]>> }} */
79
- export var RoleGameStatusGameStatuses = {
80
- [Role.admin]: {},
81
-
82
- [Role.organizer]: {
83
- [GameStatus.APPROVED]: [
84
- GameStatus.APPROVED,
85
- GameStatus.CLOSED,
86
- GameStatus.FORINVITES,
87
- GameStatus.PUBLISHED,
88
- GameStatus.IS_RESERVE,
89
- GameStatus.FINISHED,
90
- GameStatus.ARCHIVE,
91
- ],
92
-
93
- [GameStatus.MODERATION]: [
94
- GameStatus.MODERATION,
95
- ],
96
-
97
- [GameStatus.REJECTED]: [
98
- GameStatus.REJECTED,
99
- GameStatus.MODERATION,
100
- ],
101
- },
102
-
103
- [Role.default]: {},
104
- }
105
-
106
- /** @type {{ [Key in Role]: GameStatus[] }} */
107
- export var RoleDefaultGameStatuses = {
108
- [Role.admin]: [
109
- 'APPROVED',
110
- 'ARCHIVE',
111
- 'CLOSED',
112
- 'FINISHED',
113
- 'FORINVITES',
114
- 'IS_RESERVE',
115
- 'MODERATION',
116
- 'PUBLISHED',
117
- 'REJECTED',
118
- ],
119
-
120
- [Role.organizer]: [
121
- 'ARCHIVE',
122
- 'CLOSED',
123
- 'FINISHED',
124
- 'FORINVITES',
125
- 'IS_RESERVE',
126
- 'PUBLISHED',
127
- ],
128
-
129
- [Role.default]: [],
130
- }
@@ -1,40 +0,0 @@
1
- export var PasswordMode = /** @type {const} */ ({
2
- 'known': 'known',
3
- 'unknown': 'unknown',
4
- })
5
-
6
- export var PasswordModes = Object.values(PasswordMode)
7
-
8
- export var PasswordModeTitle = {
9
- [PasswordMode.known]: 'Назначен',
10
- [PasswordMode.unknown]: 'Неизвестно',
11
- }
12
-
13
- export var PasswordModeWeight = {
14
- [PasswordMode.known]: 0,
15
- [PasswordMode.unknown]: 1,
16
- }
17
-
18
- /**
19
- * @param {keyof typeof PasswordMode} value
20
- */
21
- var getter = value =>
22
- value in PasswordMode
23
- ? value
24
- : PasswordMode['unknown']
25
-
26
- export var getPasswordMode = value => {
27
- if (value === null)
28
- return getter(undefined)
29
-
30
- switch (typeof value) {
31
- case 'string':
32
- return getter(value)
33
-
34
- case 'object':
35
- return getter(value?.mode)
36
-
37
- default:
38
- return getter(undefined)
39
- }
40
- }
@@ -1,83 +0,0 @@
1
- import { getTag } from '../../functions/tag.js'
2
-
3
- export var RegistrationAttribute = /** @type {const} */ ({
4
- 'Alone': 'Alone',
5
- 'Newcomer': 'Newcomer',
6
- 'Birthday': 'Birthday',
7
- 'Public': 'Public',
8
- })
9
-
10
- export var RegistrationAttributes = Object.values(RegistrationAttribute)
11
-
12
- export var RegistrationAttributeWeight = {
13
- [RegistrationAttribute.Alone]: 0,
14
- [RegistrationAttribute.Newcomer]: 1,
15
- [RegistrationAttribute.Birthday]: 2,
16
- [RegistrationAttribute.Public]: 3,
17
- }
18
-
19
- export var RegistrationAttributeTitle = {
20
- [RegistrationAttribute.Alone]: 'Без команды',
21
- [RegistrationAttribute.Newcomer]: 'Новичок',
22
- [RegistrationAttribute.Birthday]: 'День рождения',
23
- [RegistrationAttribute.Public]: 'Принимаем людей',
24
- }
25
-
26
- /** @type {Record<RegistrationAttribute, Icon>} */
27
- export var RegistrationAttributeIcon = {
28
- [RegistrationAttribute.Alone]: 'hero/outline/user',
29
- [RegistrationAttribute.Newcomer]: 'hero/outline/sparkles',
30
- [RegistrationAttribute.Birthday]: 'hero/outline/cake',
31
- [RegistrationAttribute.Public]: 'hero/outline/user-plus',
32
- }
33
-
34
- export var RegistrationAttributeEmoji = {
35
- [RegistrationAttribute.Alone]: '👤',
36
- [RegistrationAttribute.Newcomer]: '✨',
37
- [RegistrationAttribute.Birthday]: '🎂',
38
- [RegistrationAttribute.Public]: '🫂',
39
- }
40
-
41
- export var RegistrationAttributeRegistrationProperty = /** @type {const} */ ({
42
- [RegistrationAttribute.Alone]: 'is_alone',
43
- [RegistrationAttribute.Newcomer]: 'is_first',
44
- [RegistrationAttribute.Birthday]: 'is_birthday',
45
- [RegistrationAttribute.Public]: 'is_extensible',
46
- })
47
-
48
- export var RegistrationAttributeRegistrationProperties = Object.values(RegistrationAttributeRegistrationProperty)
49
-
50
- export var RegistrationPropertyRegistrationAttribute = {
51
- [RegistrationAttributeRegistrationProperty[RegistrationAttribute.Alone]]: RegistrationAttribute.Alone,
52
- [RegistrationAttributeRegistrationProperty[RegistrationAttribute.Newcomer]]: RegistrationAttribute.Newcomer,
53
- [RegistrationAttributeRegistrationProperty[RegistrationAttribute.Birthday]]: RegistrationAttribute.Birthday,
54
- [RegistrationAttributeRegistrationProperty[RegistrationAttribute.Public]]: RegistrationAttribute.Public,
55
- }
56
-
57
- /**
58
- * @param {RegistrationAttribute[] | Partial<Pick<RegistrationTable, 'is_alone' | 'is_birthday' | 'is_extensible' | 'is_first'>>} value
59
- */
60
- export var getRegistrationAttributes = value => {
61
- switch (getTag(value)) {
62
- case 'Object':
63
- return RegistrationAttributeRegistrationProperties
64
- .map(property => value[property] ? RegistrationPropertyRegistrationAttribute[property] : '')
65
- .filter(Boolean)
66
-
67
- case 'Array':
68
- if (!value.every(attribute => RegistrationAttributes.includes(attribute)))
69
- throw TypeError(
70
- `[Function: getRegistrationAttributes] Parameter 'value': '${value}' of type 'Array' must include only members of 'RegistrationAttributes'.`,
71
- )
72
-
73
- return value.reduce((attributes, attribute) => {
74
- attributes[RegistrationAttributeRegistrationProperty[attribute]] = true
75
- return attributes
76
- }, {})
77
-
78
- default:
79
- throw TypeError(
80
- `[Function: getRegistrationAttributes] Parameter 'value': '${value}' must be of types: 'Object', 'Array'.`,
81
- )
82
- }
83
- }
@@ -1,26 +0,0 @@
1
- export var RegistrationChannel = /** @type {const} */ ({
2
- 'vkontakte': 'vkontakte',
3
- 'telegramBot': 'telegramBot',
4
- 'email': 'email',
5
- })
6
-
7
- export var RegistrationChannels = Object.values(RegistrationChannel)
8
-
9
- export var RegistrationChannelWeight = {
10
- [RegistrationChannel.vkontakte]: 0,
11
- [RegistrationChannel.telegramBot]: 1,
12
- [RegistrationChannel.email]: 2,
13
- }
14
-
15
- export var RegistationChannelTitle = {
16
- [RegistrationChannel.vkontakte]: 'Вконтакте',
17
- [RegistrationChannel.telegramBot]: 'Телеграм',
18
- [RegistrationChannel.email]: 'Электронная почта',
19
- }
20
-
21
- /** @type {Record<RegistrationChannel, Icon>} */
22
- export var RegistationChannelIcon = {
23
- [RegistrationChannel.vkontakte]: 'brand/solid/vk',
24
- [RegistrationChannel.telegramBot]: 'brand/solid/telegram',
25
- [RegistrationChannel.email]: 'hero/solid/at-symbol',
26
- }
@@ -1,75 +0,0 @@
1
- export var RegistrationLineup = /** @type {const} */ ({
2
- 'Main': 'Main',
3
- 'Reserve': 'Reserve',
4
- })
5
-
6
- export var RegistrationLineups = Object.values(RegistrationLineup)
7
-
8
- /** @type {Record<RegistrationLineup, number>} */
9
- export var RegistrationLineupWeight = {
10
- [RegistrationLineup.Main]: 0,
11
- [RegistrationLineup.Reserve]: 1,
12
- }
13
-
14
- /** @type {Record<RegistrationLineup, string>} */
15
- export var RegistrationLineupTitle = {
16
- [RegistrationLineup.Main]: 'Основа',
17
- [RegistrationLineup.Reserve]: 'Резерв',
18
- }
19
-
20
- /** @type {Record<RegistrationLineup, Icon>} */
21
- export var RegistrationLineupIcon = {
22
- [RegistrationLineup.Main]: 'hero/outline/user-circle',
23
- [RegistrationLineup.Reserve]: 'hero/outline/pause-circle',
24
- }
25
-
26
- /** @type {Record<RegistrationLineup, string>} */
27
- export var RegistrationLineupEmoji = {
28
- [RegistrationLineup.Main]: '🟢',
29
- [RegistrationLineup.Reserve]: '🟡',
30
- }
31
-
32
- /** @type {Record<RegistrationLineup, string>} */
33
- export var RegistrationLineupColor = {
34
- [RegistrationLineup.Main]: 'text-primary',
35
- [RegistrationLineup.Reserve]: 'text-secondary',
36
- }
37
-
38
- /** @type {Record<RegistrationLineup, Pick<RegistrationTable, 'is_reserve'>>} */
39
- export var RegistrationLineupShape = {
40
- [RegistrationLineup.Main]: {
41
- is_reserve: false,
42
- },
43
-
44
- [RegistrationLineup.Reserve]: {
45
- 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
66
-
67
- case 'string':
68
- if (!RegistrationLineups.includes(value))
69
- throw TypeError(
70
- `[Function: getRegistrationLineup] Parameter 'value': '${value}' must be a member of 'Lineups'.`,
71
- )
72
-
73
- return RegistrationLineupShape[value]
74
- }
75
- }