@shakerquiz/utilities 0.4.77 → 0.4.78

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "0.4.77",
4
+ "version": "0.4.78",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "scripts": {
@@ -1,4 +1,11 @@
1
- export var CityAffilations = /** @type {const} */ ([
2
- 'Branch',
3
- 'Franchise',
4
- ])
1
+ export var CityAffilation = /** @type {const} */ ({
2
+ 'Branch': 'Branch',
3
+ 'Franchise': 'Franchise',
4
+ })
5
+
6
+ export var CityAffilationWeight = {
7
+ [CityAffilation.Branch]: 0,
8
+ [CityAffilation.Franchise]: 1,
9
+ }
10
+
11
+ export var CityAffilations = Object.values(CityAffilation)
@@ -1,11 +1,113 @@
1
- export var GameStatuses = /** @type {const} */ ([
2
- 'APPROVED',
3
- 'ARCHIVE',
4
- 'CLOSED',
5
- 'FINISHED',
6
- 'FORINVITES',
7
- 'MODERATION',
8
- 'PUBLISHED',
9
- 'REJECTED',
10
- 'IS_RESERVE',
11
- ])
1
+ export var GameStatus = /** @type {const} */ ({
2
+ 'REJECTED': 'REJECTED',
3
+ 'MODERATION': 'MODERATION',
4
+ 'APPROVED': 'APPROVED',
5
+ 'CLOSED': 'CLOSED',
6
+ 'FORINVITES': 'FORINVITES',
7
+ 'PUBLISHED': 'PUBLISHED',
8
+ 'IS_RESERVE': 'IS_RESERVE',
9
+ 'FINISHED': 'FINISHED',
10
+ 'ARCHIVE': 'ARCHIVE',
11
+ })
12
+
13
+ export var GameStatuses = Object.values(GameStatus)
14
+
15
+ export var GameStatusWeight = {
16
+ [GameStatus.REJECTED]: 0,
17
+ [GameStatus.MODERATION]: 1,
18
+ [GameStatus.APPROVED]: 2,
19
+ [GameStatus.CLOSED]: 3,
20
+ [GameStatus.FORINVITES]: 4,
21
+ [GameStatus.PUBLISHED]: 5,
22
+ [GameStatus.IS_RESERVE]: 6,
23
+ [GameStatus.FINISHED]: 7,
24
+ [GameStatus.ARCHIVE]: 8,
25
+ }
26
+
27
+ export var GameStatusTitle = {
28
+ [GameStatus.REJECTED]: 'Отклонено',
29
+ [GameStatus.MODERATION]: 'На проверке',
30
+ [GameStatus.APPROVED]: 'Одобрено',
31
+ [GameStatus.CLOSED]: 'Закрыта',
32
+ [GameStatus.FORINVITES]: 'По приглашению',
33
+ [GameStatus.PUBLISHED]: 'Опубликовано',
34
+ [GameStatus.IS_RESERVE]: 'В резерве',
35
+ [GameStatus.FINISHED]: 'Завершено',
36
+ [GameStatus.ARCHIVE]: 'В архиве',
37
+ }
38
+
39
+ /** @type {Record<GameStatus, Icon>} */
40
+ export var GameStatusIcon = {
41
+ [GameStatus.REJECTED]: 'hero/outline/x-mark',
42
+ [GameStatus.MODERATION]: 'hero/outline/clock',
43
+ [GameStatus.APPROVED]: 'hero/outline/hand-thumb-up',
44
+ [GameStatus.CLOSED]: 'hero/outline/exclamation-triangle',
45
+ [GameStatus.FORINVITES]: 'hero/outline/lock-closed',
46
+ [GameStatus.PUBLISHED]: 'hero/outline/check-circle',
47
+ [GameStatus.IS_RESERVE]: 'hero/outline/user-plus',
48
+ [GameStatus.FINISHED]: 'hero/outline/check',
49
+ [GameStatus.ARCHIVE]: 'hero/outline/archive-box',
50
+ }
51
+
52
+ export var GameStatusColor = {
53
+ [GameStatus.REJECTED]: 'text-danger',
54
+ [GameStatus.MODERATION]: 'text-primary',
55
+ [GameStatus.APPROVED]: 'text-success',
56
+ [GameStatus.CLOSED]: 'text-warning',
57
+ [GameStatus.FORINVITES]: 'text-current',
58
+ [GameStatus.PUBLISHED]: 'text-secondary',
59
+ [GameStatus.IS_RESERVE]: 'text-blue-900',
60
+ [GameStatus.FINISHED]: 'text-success',
61
+ [GameStatus.ARCHIVE]: 'text-current',
62
+ }
63
+
64
+ /** @type {Record<Role, Record<GameStatus | 'DEFAULT', GameStatus[]>>} */
65
+ export var RoleGameStatusGameStatuses = {
66
+ 'admin': {
67
+ 'DEFAULT': [
68
+ GameStatus.REJECTED,
69
+ GameStatus.MODERATION,
70
+ GameStatus.APPROVED,
71
+ GameStatus.CLOSED,
72
+ GameStatus.FORINVITES,
73
+ GameStatus.PUBLISHED,
74
+ GameStatus.IS_RESERVE,
75
+ GameStatus.FINISHED,
76
+ GameStatus.ARCHIVE,
77
+ ],
78
+ },
79
+
80
+ 'organizer': {
81
+ [GameStatus.APPROVED]: [
82
+ GameStatus.APPROVED,
83
+ GameStatus.CLOSED,
84
+ GameStatus.FORINVITES,
85
+ GameStatus.PUBLISHED,
86
+ GameStatus.IS_RESERVE,
87
+ GameStatus.FINISHED,
88
+ GameStatus.ARCHIVE,
89
+ ],
90
+
91
+ [GameStatus.MODERATION]: [
92
+ GameStatus.MODERATION,
93
+ ],
94
+
95
+ [GameStatus.REJECTED]: [
96
+ GameStatus.REJECTED,
97
+ GameStatus.MODERATION,
98
+ ],
99
+
100
+ 'DEFAULT': [
101
+ GameStatus.CLOSED,
102
+ GameStatus.FORINVITES,
103
+ GameStatus.PUBLISHED,
104
+ GameStatus.IS_RESERVE,
105
+ GameStatus.FINISHED,
106
+ GameStatus.ARCHIVE,
107
+ ],
108
+ },
109
+
110
+ 'default': {
111
+ 'DEFAULT': [],
112
+ },
113
+ }
@@ -1,33 +1,59 @@
1
1
  import { getTag } from '../../functions/tag.js'
2
2
 
3
- export var RegistrationAttributes = /** @type {const} */ ([
4
- 'Alone',
5
- 'Birthday',
6
- 'Newcomer',
7
- 'Public',
8
- ])
9
-
10
- var RegistrationAttributeRegistrationProperties = /** @type {const} */ ([
11
- 'is_alone',
12
- 'is_birthday',
13
- 'is_first',
14
- 'is_extensible',
15
- ])
16
-
17
- var RegistrationAttributeRegistrationProperty = /** @type {const} */ ({
18
- 'Alone': 'is_alone',
19
- 'Birthday': 'is_birthday',
20
- 'Newcomer': 'is_first',
21
- 'Public': 'is_extensible',
3
+ export var RegistrationAttribute = /** @type {const} */ ({
4
+ 'Alone': 'Alone',
5
+ 'Newcomer': 'Newcomer',
6
+ 'Birthday': 'Birthday',
7
+ 'Public': 'Public',
22
8
  })
23
9
 
24
- var RegistrationPropertyRegistrationAttribute = /** @type {const} */ ({
25
- 'is_alone': 'Alone',
26
- 'is_birthday': 'Birthday',
27
- 'is_first': 'Newcomer',
28
- 'is_extensible': 'Public',
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',
29
46
  })
30
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
+
31
57
  /**
32
58
  * @param {RegistrationAttribute[] | Partial<Pick<RegistrationTable, 'is_alone' | 'is_birthday' | 'is_extensible' | 'is_first'>>} value
33
59
  */
@@ -1,5 +1,26 @@
1
- export var RegistrationChannels = /** @type {const} */ ([
2
- 'email',
3
- 'telegramBot',
4
- 'vkontakte',
5
- ])
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,15 +1,47 @@
1
- export var RegistrationLineups = /** @type {const} */ ([
2
- 'Main',
3
- 'Reserve',
4
- ])
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
+ }
5
37
 
6
38
  /** @type {Record<RegistrationLineup, Pick<RegistrationTable, 'is_reserve'>>} */
7
- let RegistrationLineupShape = {
8
- 'Main': {
39
+ export var RegistrationLineupShape = {
40
+ [RegistrationLineup.Main]: {
9
41
  is_reserve: false,
10
42
  },
11
43
 
12
- 'Reserve': {
44
+ [RegistrationLineup.Reserve]: {
13
45
  is_reserve: true,
14
46
  },
15
47
  }
@@ -1,6 +1,24 @@
1
- export var RegistrationMailings = /** @type {const} */ ([
2
- 'Idle',
3
- 'Pending',
4
- 'Delivered',
5
- 'Failed',
6
- ])
1
+ export var RegistrationMailing = /** @type {const} */ ({
2
+ 'Idle': 'Idle',
3
+ 'Pending': 'Pending',
4
+ 'Delivered': 'Delivered',
5
+ 'Failed': 'Failed',
6
+ })
7
+
8
+ export var RegistrationMailings = Object.values(RegistrationMailing)
9
+
10
+ /** @type {Record<RegistrationMailing, number>} */
11
+ export var RegistrationMailingWeight = {
12
+ [RegistrationMailing.Idle]: 0,
13
+ [RegistrationMailing.Pending]: 1,
14
+ [RegistrationMailing.Delivered]: 2,
15
+ [RegistrationMailing.Failed]: 3,
16
+ }
17
+
18
+ /** @type {Record<RegistrationMailing, string>} */
19
+ export var RegistrationMailingColor = {
20
+ [RegistrationMailing.Idle]: 'default',
21
+ [RegistrationMailing.Pending]: 'warning',
22
+ [RegistrationMailing.Delivered]: 'success',
23
+ [RegistrationMailing.Failed]: 'danger',
24
+ }
@@ -1,22 +1,59 @@
1
- export var RegistrationStatuses = /** @type {const} */ ([
2
- 'Created',
3
- 'Confirmed',
4
- 'Cancelled',
5
- ])
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
+ /** @type {Record<RegistrationStatus, number>} */
10
+ export var RegistrationStatusWeight = {
11
+ [RegistrationStatus.Confirmed]: 0,
12
+ [RegistrationStatus.Created]: 1,
13
+ [RegistrationStatus.Cancelled]: 2,
14
+ }
15
+
16
+ /** @type {Record<RegistrationStatus, string>} */
17
+ export var RegistrationStatusTitle = {
18
+ [RegistrationStatus.Confirmed]: 'Подтверждена',
19
+ [RegistrationStatus.Created]: 'Пройдена',
20
+ [RegistrationStatus.Cancelled]: 'Отменена',
21
+ }
22
+
23
+ /** @type {Record<RegistrationStatus, Icon>} */
24
+ export var RegistrationStatusIcon = {
25
+ [RegistrationStatus.Confirmed]: 'hero/outline/check-circle',
26
+ [RegistrationStatus.Created]: 'hero/outline/check',
27
+ [RegistrationStatus.Cancelled]: 'hero/outline/x-mark',
28
+ }
29
+
30
+ /** @type {Record<RegistrationStatus, Icon>} */
31
+ export var RegistrationStatusEmoji = {
32
+ [RegistrationStatus.Confirmed]: '✅',
33
+ [RegistrationStatus.Created]: '📝',
34
+ [RegistrationStatus.Cancelled]: '❌',
35
+ }
36
+
37
+ /** @type {Record<RegistrationStatus, string>} */
38
+ export var RegistrationStatusColor = {
39
+ [RegistrationStatus.Confirmed]: 'text-success',
40
+ [RegistrationStatus.Created]: 'text-default-700',
41
+ [RegistrationStatus.Cancelled]: 'text-danger',
42
+ }
6
43
 
7
44
  /** @type {Record<RegistrationStatus, Pick<RegistrationTable, 'is_canceled' | 'is_confirm'>>} */
8
- let RegistrationStatusShape = {
9
- 'Created': {
45
+ export var RegistrationStatusShape = {
46
+ [RegistrationStatus.Confirmed]: {
10
47
  is_canceled: false,
11
- is_confirm: false,
48
+ is_confirm: true,
12
49
  },
13
50
 
14
- 'Confirmed': {
51
+ [RegistrationStatus.Created]: {
15
52
  is_canceled: false,
16
- is_confirm: true,
53
+ is_confirm: false,
17
54
  },
18
55
 
19
- 'Cancelled': {
56
+ [RegistrationStatus.Cancelled]: {
20
57
  is_canceled: true,
21
58
  is_confirm: false,
22
59
  },
@@ -25,7 +62,7 @@ let RegistrationStatusShape = {
25
62
  /**
26
63
  * @param {RegistrationStatus | typeof RegistrationStatusShape[RegistrationStatus]} value
27
64
  */
28
- export let getRegistrationStatus = value => {
65
+ export var getRegistrationStatus = value => {
29
66
  switch (typeof value) {
30
67
  case 'object':
31
68
  let found = Object
@@ -1,5 +1,13 @@
1
- export var Roles = /** @type {const} */ ([
2
- 'admin',
3
- 'default',
4
- 'organizer',
5
- ])
1
+ export var Role = /** @type {const} */ ({
2
+ 'admin': 'admin',
3
+ 'organizer': 'organizer',
4
+ 'default': 'default',
5
+ })
6
+
7
+ export var RoleWeight = {
8
+ [Role.admin]: 0,
9
+ [Role.organizer]: 1,
10
+ [Role.default]: 2,
11
+ }
12
+
13
+ export var Roles = Object.values(Role)
@@ -1,4 +1,30 @@
1
- export var VenueStatuses = /** @type {const} */ ([
2
- 'ACTIVE',
3
- 'ARCHIVE',
4
- ])
1
+ export var VenueStatus = /** @type {const} */ ({
2
+ 'ACTIVE': 'ACTIVE',
3
+ 'ARCHIVE': 'ARCHIVE',
4
+ })
5
+
6
+ export var VenueStatuses = Object.values(VenueStatus)
7
+
8
+ /** @type {Record<VenueStatus, number>} */
9
+ export var VenueStatusWeight = {
10
+ [VenueStatus.ACTIVE]: 0,
11
+ [VenueStatus.ARCHIVE]: 1,
12
+ }
13
+
14
+ /** @type {Record<VenueStatus, string>} */
15
+ export var VenueStatusTitle = {
16
+ [VenueStatus.ACTIVE]: 'В пользовании',
17
+ [VenueStatus.ARCHIVE]: 'В архиве',
18
+ }
19
+
20
+ /** @type {Record<VenueStatus, Icon>} */
21
+ export var VenueStatusIcon = {
22
+ [VenueStatus.ACTIVE]: 'hero/outline/check',
23
+ [VenueStatus.ARCHIVE]: 'hero/outline/archive-box',
24
+ }
25
+
26
+ /** @type {Record<VenueStatus, string>} */
27
+ export var VenueStatusColor = {
28
+ [VenueStatus.ACTIVE]: 'text-success',
29
+ [VenueStatus.ARCHIVE]: 'text-current',
30
+ }