@shakerquiz/utilities 0.5.188 → 0.5.190

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.5.188",
4
+ "version": "0.5.190",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -0,0 +1,4 @@
1
+ export const Category = Object.freeze({
2
+ 'Active': 'Active',
3
+ 'Rest': 'Rest',
4
+ })
@@ -1,6 +1,8 @@
1
+ import { Category } from '../category.js'
2
+ import { Mode } from '../mode.js'
1
3
  import { Role } from './role.js'
2
4
 
3
- export var GameStatus = /** @type {const} */ ({
5
+ export const GameStatus = Object.freeze({
4
6
  'REJECTED': 'REJECTED',
5
7
  'MODERATION': 'MODERATION',
6
8
  'APPROVED': 'APPROVED',
@@ -12,119 +14,89 @@ export var GameStatus = /** @type {const} */ ({
12
14
  'ARCHIVE': 'ARCHIVE',
13
15
  })
14
16
 
15
- export var GameStatuses = Object.values(GameStatus)
17
+ export const GameStatuses = Object.freeze(Object.values(GameStatus))
16
18
 
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
- }
19
+ export const GameStatusTitle = Object.freeze({
20
+ [GameStatus['REJECTED']]: 'Отклонено',
21
+ [GameStatus['MODERATION']]: 'На проверке',
22
+ [GameStatus['APPROVED']]: 'Одобрено',
23
+ [GameStatus['CLOSED']]: 'Закрыта',
24
+ [GameStatus['FORINVITES']]: 'По приглашению',
25
+ [GameStatus['PUBLISHED']]: 'Опубликовано',
26
+ [GameStatus['IS_RESERVE']]: 'В резерве',
27
+ [GameStatus['FINISHED']]: 'Завершено',
28
+ [GameStatus['ARCHIVE']]: 'В архиве',
29
+ })
52
30
 
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
- }
31
+ export const GameStatusIcon = Object.freeze({
32
+ [GameStatus['REJECTED']]: 'hero/outline/x-mark',
33
+ [GameStatus['MODERATION']]: 'hero/outline/clock',
34
+ [GameStatus['APPROVED']]: 'hero/outline/hand-thumb-up',
35
+ [GameStatus['CLOSED']]: 'hero/outline/exclamation-triangle',
36
+ [GameStatus['FORINVITES']]: 'hero/outline/lock-closed',
37
+ [GameStatus['PUBLISHED']]: 'hero/outline/check-circle',
38
+ [GameStatus['IS_RESERVE']]: 'hero/outline/user-plus',
39
+ [GameStatus['FINISHED']]: 'hero/outline/check',
40
+ [GameStatus['ARCHIVE']]: 'hero/outline/archive-box',
41
+ })
64
42
 
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
- }
43
+ export const RoleGameStatusGameStatuses = Object.freeze({
44
+ [Role['admin']]: Object.freeze({}),
77
45
 
78
- /** @type {{ [Key in Role]: Partial<Record<GameStatus, GameStatus[]>> }} */
79
- export var RoleGameStatusGameStatuses = {
80
- [Role.admin]: {},
46
+ [Role['organizer']]: Object.freeze({
47
+ [GameStatus['APPROVED']]: Object.freeze([
48
+ GameStatus['APPROVED'],
49
+ GameStatus['CLOSED'],
50
+ GameStatus['FORINVITES'],
51
+ GameStatus['PUBLISHED'],
52
+ GameStatus['IS_RESERVE'],
53
+ GameStatus['FINISHED'],
54
+ GameStatus['ARCHIVE'],
55
+ ]),
81
56
 
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
- ],
57
+ [GameStatus['MODERATION']]: Object.freeze([
58
+ GameStatus['MODERATION'],
59
+ ]),
92
60
 
93
- [GameStatus.MODERATION]: [
94
- GameStatus.MODERATION,
95
- ],
61
+ [GameStatus['REJECTED']]: Object.freeze([
62
+ GameStatus['REJECTED'],
63
+ GameStatus['MODERATION'],
64
+ ]),
65
+ }),
96
66
 
97
- [GameStatus.REJECTED]: [
98
- GameStatus.REJECTED,
99
- GameStatus.MODERATION,
100
- ],
101
- },
67
+ [Mode['Unknown']]: Object.freeze({}),
68
+ })
102
69
 
103
- [Role.default]: {},
104
- }
70
+ export const RoleGameStatuses = Object.freeze({
71
+ [Role['admin']]: Object.freeze([
72
+ GameStatus['APPROVED'],
73
+ GameStatus['ARCHIVE'],
74
+ GameStatus['CLOSED'],
75
+ GameStatus['FINISHED'],
76
+ GameStatus['FORINVITES'],
77
+ GameStatus['IS_RESERVE'],
78
+ GameStatus['MODERATION'],
79
+ GameStatus['PUBLISHED'],
80
+ GameStatus['REJECTED'],
81
+ ]),
105
82
 
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
- ],
83
+ [Role['organizer']]: Object.freeze([
84
+ GameStatus['ARCHIVE'],
85
+ GameStatus['CLOSED'],
86
+ GameStatus['FINISHED'],
87
+ GameStatus['FORINVITES'],
88
+ GameStatus['IS_RESERVE'],
89
+ GameStatus['PUBLISHED'],
90
+ ]),
119
91
 
120
- [Role.organizer]: [
121
- 'ARCHIVE',
122
- 'CLOSED',
123
- 'FINISHED',
124
- 'FORINVITES',
125
- 'IS_RESERVE',
126
- 'PUBLISHED',
127
- ],
92
+ [Mode['Unknown']]: Object.freeze([]),
93
+ })
128
94
 
129
- [Role.default]: [],
130
- }
95
+ export const CategoryGameStatuses = Object.freeze({
96
+ [Category['Active']]: Object.freeze([
97
+ GameStatus['CLOSED'],
98
+ GameStatus['FORINVITES'],
99
+ GameStatus['IS_RESERVE'],
100
+ GameStatus['PUBLISHED'],
101
+ ]),
102
+ })
package/source/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './enumerations/blend.js'
2
2
  export * from './enumerations/cardinality.js'
3
+ export * from './enumerations/category.js'
3
4
  export * from './enumerations/constants.js'
4
5
  export * from './enumerations/display.js'
5
6
  export * from './enumerations/gender.js'