@shakerquiz/utilities 0.5.208 → 0.5.210

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.208",
4
+ "version": "0.5.210",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -6,11 +6,13 @@ export const Affilation = Object.freeze({
6
6
  export const Affilations = Object.freeze([
7
7
  Affilation['Branch'],
8
8
  Affilation['Franchise'],
9
+ 'Unknown',
9
10
  ])
10
11
 
11
12
  export const AffilationTitle = Object.freeze({
12
13
  [Affilation['Branch']]: 'Филиал',
13
14
  [Affilation['Franchise']]: 'Франшиза',
15
+ ['Unknown']: 'Неизвестно',
14
16
  })
15
17
 
16
18
  export const AffilationIcon = Object.freeze({
@@ -19,31 +21,9 @@ export const AffilationIcon = Object.freeze({
19
21
  ['Unknown']: 'hero/outline/no-symbol',
20
22
  })
21
23
 
22
- const ValueAffilation = Object.freeze({
23
- 'false': Affilation['Branch'],
24
- 'true': Affilation['Franchise'],
25
- })
26
-
27
- const AffilationShape = Object.freeze({
28
- [Affilation['Branch']]: Object.freeze({
29
- is_franchise: false,
30
- }),
31
-
32
- [Affilation['Franchise']]: Object.freeze({
33
- is_franchise: true,
34
- }),
35
- })
36
-
37
24
  /** @returns {keyof typeof Affilation | 'Unknown'} */
38
25
  export const inferAffilation = Object.freeze(value =>
39
- ValueAffilation[value?.is_franchise]
40
- ?? ValueAffilation[value]
26
+ Affilation[value?.affilation]
41
27
  ?? Affilation[value]
42
28
  ?? 'Unknown'
43
29
  )
44
-
45
- /** @returns {typeof AffilationShape[keyof typeof AffilationShape] | { is_franchise: null }} */
46
- export const inferAffilationShape = Object.freeze(value =>
47
- AffilationShape[value]
48
- ?? { is_franchise: null }
49
- )
@@ -1,43 +1,23 @@
1
1
  export const Version = Object.freeze({
2
- 'Actual': 'Actual',
2
+ 'Latest': 'Latest',
3
3
  'Legacy': 'Legacy',
4
4
  })
5
5
 
6
6
  export const Versions = Object.freeze([
7
- Version['Actual'],
7
+ Version['Latest'],
8
8
  Version['Legacy'],
9
+ 'Unknown',
9
10
  ])
10
11
 
11
12
  export const VersionTitle = Object.freeze({
12
- [Version['Actual']]: 'Актуальная',
13
+ [Version['Latest']]: 'Актуальная',
13
14
  [Version['Legacy']]: 'Старая',
14
- })
15
-
16
- const ValueChatappVersion = Object.freeze({
17
- 'false': Version['Actual'],
18
- 'true': Version['Legacy'],
19
- })
20
-
21
- const ChatappVersionShape = Object.freeze({
22
- [Version['Actual']]: Object.freeze({
23
- chatapp_legacy: false,
24
- }),
25
-
26
- [Version['Legacy']]: Object.freeze({
27
- chatapp_legacy: true,
28
- }),
15
+ ['Unknown']: 'Неизвестно',
29
16
  })
30
17
 
31
18
  /** @returns {keyof typeof Version | 'Unknown'} */
32
19
  export const inferVersion = Object.freeze(value =>
33
- ValueChatappVersion[value?.chatapp_legacy]
34
- ?? ValueChatappVersion[value]
20
+ Version[value?.chatapp_version]
35
21
  ?? Version[value]
36
22
  ?? 'Unknown'
37
23
  )
38
-
39
- /** @returns {typeof ChatappVersionShape[keyof typeof ChatappVersionShape] | { chatapp_legacy: null }} */
40
- export const inferVersionShape = Object.freeze(value =>
41
- ChatappVersionShape[value]
42
- ?? { chatapp_legacy: null }
43
- )
@@ -167,6 +167,11 @@ export const RouteRelation = Object.freeze({
167
167
  [Route['venues/city']]: Route['venue/city'],
168
168
  })
169
169
 
170
+ export const RouteItems = Object.freeze({
171
+ [Route['user/role']]: Route['roles'],
172
+ [Route['user/city']]: Route['cities'],
173
+ })
174
+
170
175
  export const RoutePathname = Object.freeze({
171
176
  [Route['checkin']]: 'checkin',
172
177
  [Route['cities']]: 'cities',
@@ -484,6 +489,11 @@ export const inferRouteRelation = Object.freeze(
484
489
  x => RouteRelation[x] ?? 'Unknown',
485
490
  )
486
491
 
492
+ export const inferRouteItems = Object.freeze(
493
+ /** @returns {typeof RouteItems[keyof typeof RouteItems] | 'Unknown'} */
494
+ x => RouteItems[x] ?? 'Unknown',
495
+ )
496
+
487
497
  export const inferRoutePathname = Object.freeze(
488
498
  /** @returns {typeof RoutePathname[keyof typeof RoutePathname] | 'Unknown'} */
489
499
  x => RoutePathname[x] ?? 'Unknown',