@shakerquiz/utilities 2.0.0 → 3.0.0

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 (117) hide show
  1. package/dprint.json +1 -4
  2. package/package.json +4 -10
  3. package/source/enumerations/core/features.js +51 -200
  4. package/source/enumerations/core/methods.js +9 -18
  5. package/source/enumerations/core/networks.js +6 -4
  6. package/source/enumerations/core/runtimes.js +6 -4
  7. package/source/enumerations/entities/affilation.js +91 -0
  8. package/source/enumerations/entities/cities-mode.js +49 -0
  9. package/source/enumerations/entities/city/timezone-mode.js +44 -0
  10. package/source/enumerations/entities/city/venues-mode.js +60 -0
  11. package/source/enumerations/entities/game-status.js +130 -0
  12. package/source/enumerations/entities/password-mode.js +40 -0
  13. package/source/enumerations/entities/registration-attribute.js +83 -0
  14. package/source/enumerations/entities/registration-channel.js +26 -0
  15. package/source/enumerations/entities/registration-lineup.js +75 -0
  16. package/source/enumerations/entities/registration-mailing.js +24 -0
  17. package/source/enumerations/entities/registration-status.js +89 -0
  18. package/source/enumerations/entities/role-mode.js +40 -0
  19. package/source/enumerations/entities/role.js +82 -0
  20. package/source/enumerations/entities/venue/audience.js +100 -0
  21. package/source/enumerations/entities/venue/city-mode.js +44 -0
  22. package/source/enumerations/entities/venue/status.js +53 -0
  23. package/source/enumerations/entities/version.js +76 -0
  24. package/source/enumerations/misc/icons.js +653 -324
  25. package/source/enumerations/misc/keys.js +15 -0
  26. package/source/enumerations/misc/phases.js +42 -7
  27. package/source/enumerations/misc/regexps.js +1 -2
  28. package/source/enumerations/misc/routes.js +610 -0
  29. package/source/index.js +22 -12
  30. package/source/schemas/PATCH/city/admin.json +126 -0
  31. package/source/schemas/PATCH/city/currency/admin.json +173 -0
  32. package/source/schemas/PATCH/city/timezone/admin.json +501 -0
  33. package/source/schemas/PATCH/{Game/admin/schema.json → game/admin.json} +0 -4
  34. package/source/schemas/PATCH/{Game/organizer/schema.json → game/organizer.json} +0 -4
  35. package/source/schemas/PATCH/registration/cancellation/default.json +12 -0
  36. package/source/schemas/PATCH/registration/channel/default.json +22 -0
  37. package/source/schemas/PATCH/registration/confirmation/default.json +12 -0
  38. package/source/schemas/PATCH/registration/default.json +10 -0
  39. package/source/schemas/PATCH/registration/organizer.json +43 -0
  40. package/source/schemas/PATCH/theme/admin.json +19 -0
  41. package/source/schemas/PATCH/user/admin.json +30 -0
  42. package/source/schemas/PATCH/user/cities/admin.json +17 -0
  43. package/source/schemas/PATCH/user/password/admin.json +12 -0
  44. package/source/schemas/PATCH/user/role/admin.json +13 -0
  45. package/source/schemas/PATCH/{Venue/organizer/schema.json → venue/admin.json} +3 -2
  46. package/source/schemas/PATCH/{Venue/admin/schema.json → venue/organizer.json} +6 -2
  47. package/source/schemas/POST/checkin/default.json +16 -0
  48. package/source/schemas/POST/city/admin.json +696 -0
  49. package/source/schemas/POST/game/registrations/export/admin.json +17 -0
  50. package/source/schemas/POST/game/registrations/export/organizer.json +17 -0
  51. package/source/schemas/POST/registration/mailing/admin.json +16 -0
  52. package/source/schemas/POST/registration/mailing/organizer.json +16 -0
  53. package/source/schemas/POST/registrations/export/admin.json +17 -0
  54. package/source/schemas/POST/registrations/export/organizer.json +17 -0
  55. package/source/schemas/POST/theme/admin.json +24 -0
  56. package/source/schemas/POST/{Mailing/organizer/schema.json → user/admin.json} +2 -2
  57. package/source/schemas/POST/user/cities/admin.json +17 -0
  58. package/source/schemas/POST/user/password/admin.json +12 -0
  59. package/source/schemas/POST/user/role/admin.json +13 -0
  60. package/source/schemas/POST/{Venue/organizer/schema.json → venue/admin.json} +2 -13
  61. package/source/schemas/POST/venue/organizer.json +38 -0
  62. package/source/enumerations/core/features.d.ts +0 -40
  63. package/source/enumerations/core/kinds.d.ts +0 -1
  64. package/source/enumerations/core/kinds.js +0 -4
  65. package/source/enumerations/core/methods.d.ts +0 -8
  66. package/source/enumerations/core/networks.d.ts +0 -1
  67. package/source/enumerations/core/runtimes.d.ts +0 -1
  68. package/source/enumerations/core/scopes.d.ts +0 -5
  69. package/source/enumerations/core/scopes.js +0 -27
  70. package/source/enumerations/entities/city-affilations.d.ts +0 -1
  71. package/source/enumerations/entities/city-affilations.js +0 -4
  72. package/source/enumerations/entities/game-statuses.d.ts +0 -1
  73. package/source/enumerations/entities/game-statuses.js +0 -11
  74. package/source/enumerations/entities/registration-attributes.d.ts +0 -2
  75. package/source/enumerations/entities/registration-attributes.js +0 -57
  76. package/source/enumerations/entities/registration-channels.d.ts +0 -1
  77. package/source/enumerations/entities/registration-channels.js +0 -5
  78. package/source/enumerations/entities/registration-lineups.d.ts +0 -5
  79. package/source/enumerations/entities/registration-lineups.js +0 -43
  80. package/source/enumerations/entities/registration-mailings.d.ts +0 -1
  81. package/source/enumerations/entities/registration-mailings.js +0 -6
  82. package/source/enumerations/entities/registration-statuses.d.ts +0 -5
  83. package/source/enumerations/entities/registration-statuses.js +0 -54
  84. package/source/enumerations/entities/roles.d.ts +0 -1
  85. package/source/enumerations/entities/roles.js +0 -5
  86. package/source/enumerations/entities/venue-statuses.d.ts +0 -1
  87. package/source/enumerations/entities/venue-statuses.js +0 -4
  88. package/source/enumerations/misc/constants.d.ts +0 -3
  89. package/source/enumerations/misc/cookies.d.ts +0 -5
  90. package/source/enumerations/misc/cookies.js +0 -5
  91. package/source/enumerations/misc/icons.d.ts +0 -1
  92. package/source/enumerations/misc/phases.d.ts +0 -1
  93. package/source/enumerations/misc/regexps.d.ts +0 -5
  94. package/source/index.d.ts +0 -27
  95. package/source/misc.d.ts +0 -79
  96. package/source/schemas/PATCH/Game/default/schema.json +0 -6
  97. package/source/schemas/PATCH/Registration/admin/schema.json +0 -6
  98. package/source/schemas/PATCH/Registration/default/schema.json +0 -104
  99. package/source/schemas/PATCH/Venue/default/schema.json +0 -6
  100. package/source/schemas/POST/Game/organizer/schema.json +0 -27
  101. package/source/schemas/POST/Mailing/admin/schema.json +0 -6
  102. package/source/schemas/POST/Mailing/default/schema.json +0 -6
  103. package/source/schemas/POST/Registration/admin/schema.json +0 -6
  104. package/source/schemas/POST/Registration/organizer/schema.json +0 -6
  105. package/source/schemas/POST/Venue/admin/schema.json +0 -6
  106. package/source/schemas/POST/Venue/default/schema.json +0 -6
  107. package/source/schemas/game.schema.json +0 -93
  108. package/source/schemas/registration.schema.json +0 -123
  109. package/source/schemas/theme.schema.json +0 -48
  110. package/source/schemas/venue.schema.json +0 -56
  111. package/source/scope.d.ts +0 -874
  112. package/source/server.d.ts +0 -5
  113. package/source/tables.d.ts +0 -187
  114. /package/source/schemas/PATCH/{Registration/organizer/schema.json → registration/admin.json} +0 -0
  115. /package/source/schemas/POST/{Game/admin/schema.json → game/admin.json} +0 -0
  116. /package/source/schemas/POST/{Game/default/schema.json → game/organizer.json} +0 -0
  117. /package/source/schemas/POST/{Registration/default/schema.json → registration/default.json} +0 -0
package/dprint.json CHANGED
@@ -19,9 +19,6 @@
19
19
  ],
20
20
  "plugins": [
21
21
  "https://plugins.dprint.dev/typescript-0.93.0.wasm",
22
- "https://plugins.dprint.dev/json-0.19.3.wasm",
23
- "https://plugins.dprint.dev/markdown-0.17.8.wasm",
24
- "https://plugins.dprint.dev/dockerfile-0.3.2.wasm",
25
- "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
22
+ "https://plugins.dprint.dev/json-0.19.3.wasm"
26
23
  ]
27
24
  }
package/package.json CHANGED
@@ -1,23 +1,17 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@shakerquiz/utilities",
4
- "version": "2.0.0",
4
+ "version": "3.0.0",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
- "scripts": {
8
- "type": "tsc --declaration --emitdeclarationonly --allowjs"
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/shaker-quiz/utilities.git"
9
10
  },
10
11
  "exports": {
11
12
  ".": {
12
- "types": "./source/index.d.ts",
13
13
  "default": "./source/index.js"
14
14
  },
15
15
  "./schemas/*.json": "./source/schemas/*.json"
16
- },
17
- "dependencies": {
18
- "urlpattern-polyfill": "10.1.0"
19
- },
20
- "devDependencies": {
21
- "typescript": "5.8.3"
22
16
  }
23
17
  }
@@ -1,205 +1,56 @@
1
- import { Kinds } from './kinds.js'
2
-
3
- export var Domains = /** @type {const} */ ([
4
- // 'Asset',
5
- 'User',
6
- 'Role',
7
- 'Country',
8
- 'Currency',
9
- 'City',
10
- 'Venue',
11
- 'Theme',
12
- // 'ThemeAsset',
13
- 'Game',
14
- // 'GameAsset',
15
- 'Registration',
16
- 'Mailing',
17
- ])
18
-
19
- /**
20
- * @type {Record<Domain, Icon>}
21
- */
22
- export var DomainIcon = {
23
- 'User': 'users',
24
- 'Role': 'identification',
25
- 'Country': 'no-symbol',
26
- 'Currency': 'no-symbol',
27
- 'City': 'building-office',
28
- 'Venue': 'map-pin',
29
- 'Theme': 'document-text',
30
- 'Game': 'newspaper',
31
- 'Registration': 'user-group',
32
- 'Mailing': 'envelope',
33
- }
34
-
35
- /**
36
- * @type {Record<Domain, Record<Kind, string>>}
37
- */
38
- export var DomainKindPathname = /** @type {const} */ ({
39
- 'User': {
40
- 'Unit': '/user/:user?',
41
- 'Set': '/users',
42
- },
43
-
44
- 'Role': {
45
- 'Unit': '/role/:role?',
46
- 'Set': '/roles',
47
- },
48
-
49
- 'Country': {
50
- 'Unit': '/country/:country?',
51
- 'Set': '/countries',
52
- },
53
-
54
- 'Currency': {
55
- 'Unit': '/currency/:currency?',
56
- 'Set': '/currencies',
57
- },
58
-
59
- 'City': {
60
- 'Unit': '/city/:city?',
61
- 'Set': '/cities',
62
- },
63
-
64
- 'Venue': {
65
- 'Unit': '/venue/:venue?',
66
- 'Set': '/venues',
67
- },
68
-
69
- 'Theme': {
70
- 'Unit': '/theme/:theme?',
71
- 'Set': '/themes',
72
- },
73
-
74
- 'Game': {
75
- /**
76
- * Parameter "game" can be one of:
77
- * - UUID of a Game,
78
- * - Game alias combined with City (UUID, alias or VK group ID),
79
- * - UUID of a Registration
80
- */
81
- 'Unit': '/game/:game?',
82
- 'Set': '/games',
83
- },
84
-
85
- 'Registration': {
86
- /**
87
- * Parameter "registration" can be one of:
88
- * - UUID of a Registration,
89
- * - VK identifier of a Registration
90
- */
91
- 'Unit': '/registration/:registration?',
92
- 'Set': '/registrations',
93
- },
94
-
95
- 'Mailing': {
96
- 'Unit': '/mailing/:mailing?',
97
- 'Set': '/mailings',
98
- },
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',
99
26
  })
100
27
 
101
- export var Procedures = /** @type {const} */ ([
102
- 'Checkin',
103
- 'Redirect',
104
- ])
105
-
106
- /**
107
- * @type {Record<Procedure, Icon>}
108
- */
109
- export var ProcedureIcon = {
110
- 'Checkin': 'arrow-right-end-on-rectangle',
111
- 'Redirect': 'no-symbol',
112
- }
113
-
114
- /**
115
- * @type {Record<Procedure, Record<Kind, string>>}
116
- */
117
- export var ProcedureKindPathname = /** @type {const} */ ({
118
- 'Checkin': {
119
- 'Unit': '/checkin',
120
- 'Set': '/checkins',
121
- },
28
+ export var Features = Object.values(Feature)
122
29
 
123
- 'Redirect': {
124
- 'Unit': '/redirect',
125
- 'Set': '/redirects',
126
- },
127
- })
128
-
129
- /**
130
- * @type {Array<Domain | Procedure>}
131
- */
132
- export var Features = Domains.concat(Procedures)
133
-
134
- /**
135
- * @type {Record<Feature, Icon>}
136
- */
30
+ /** @type {Record<Feature, Icon>} */
137
31
  export var FeatureIcon = {
138
- ...DomainIcon,
139
- ...ProcedureIcon,
140
- }
141
-
142
- /**
143
- * @type {Record<Feature, Record<Kind, string>>}
144
- */
145
- export var FeatureKindPathname = {
146
- ...DomainKindPathname,
147
- ...ProcedureKindPathname,
148
- }
149
-
150
- /**
151
- * @type {Array<[feature: Feature, kind: Kind, pathname: string]>}
152
- */
153
- export var FeatureKindPathnames = Object
154
- .keys(FeatureKindPathname)
155
- .flatMap(feature =>
156
- Object
157
- .keys(FeatureKindPathname[feature])
158
- .map(kind => [feature, kind, FeatureKindPathname[feature][kind]])
159
- )
160
-
161
- /**
162
- * @type {Array<[feature: Feature, kind: Kind, pattern: URLPattern]>}
163
- */
164
- export var FeatureKindPatterns = FeatureKindPathnames
165
- .map(([feature, kind, pathname]) => [
166
- feature,
167
- kind,
168
- new URLPattern({ pathname }),
169
- ])
170
-
171
- /**
172
- * @param {Feature} feature
173
- * @param {Kind} kind
174
- */
175
- export var getPathname = (feature, kind) => {
176
- if (!Features.includes(feature))
177
- throw TypeError(
178
- `[getPathname] Feature '${feature}' must be listed in 'Features'.`,
179
- )
180
-
181
- if (!Kinds.includes(kind))
182
- throw TypeError(
183
- `[getPathname] Kind '${kind}' must be listed in 'Kinds'.`,
184
- )
185
-
186
- return FeatureKindPathname[feature][kind]
187
- }
188
-
189
- /**
190
- * @param {Feature} feature
191
- * @param {Kind} kind
192
- */
193
- export var getPattern = (feature, kind) => {
194
- if (!Features.includes(feature))
195
- throw TypeError(
196
- `[getPattern] Feature '${feature}' must be listed in 'Features'.`,
197
- )
198
-
199
- if (!Kinds.includes(kind))
200
- throw TypeError(
201
- `[getPattern] Kind '${kind}' must be listed in 'Kinds'.`,
202
- )
203
-
204
- return FeatureKindPatterns.find(([f, k]) => f == feature && k == kind)[2]
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',
205
56
  }
@@ -5,21 +5,12 @@
5
5
  * - CONNECT: {@link https://datatracker.ietf.org/doc/html/rfc9110}
6
6
  * - WebDAV Extensions {@link https://datatracker.ietf.org/doc/html/rfc4918}
7
7
  */
8
- export var Methods = /** @type {const} */ ([
9
- // 'CONNECT',
10
- // 'COPY',
11
- 'DELETE',
12
- 'GET',
13
- // 'HEAD',
14
- // 'LOCK',
15
- // 'MKCOL',
16
- // 'MOVE',
17
- 'OPTIONS',
18
- 'PATCH',
19
- 'POST',
20
- // 'PROPFIND',
21
- // 'PROPPATCH',
22
- 'PUT',
23
- // 'TRACE',
24
- // 'UNLOCK',
25
- ])
8
+ export var Method = /** @type {const} */ ({
9
+ 'DELETE': 'DELETE',
10
+ 'GET': 'GET',
11
+ 'OPTIONS': 'OPTIONS',
12
+ 'PATCH': 'PATCH',
13
+ 'POST': 'POST',
14
+ })
15
+
16
+ export var Methods = Object.values(Method)
@@ -1,4 +1,6 @@
1
- export var Networks = /** @type {const} */ ([
2
- 'Docker',
3
- 'Public',
4
- ])
1
+ export var Network = /** @type {const} */ ({
2
+ 'Docker': 'Docker',
3
+ 'Public': 'Public',
4
+ })
5
+
6
+ export var Networks = Object.values(Network)
@@ -1,4 +1,6 @@
1
- export var Runtimes = /** @type {const} */ ([
2
- 'Next',
3
- 'React',
4
- ])
1
+ export var Runtime = /** @type {const} */ ({
2
+ 'Next': 'Next',
3
+ 'React': 'React',
4
+ })
5
+
6
+ export var Runtimes = Object.values(Runtime)
@@ -0,0 +1,91 @@
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
+ }
@@ -0,0 +1,49 @@
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
+ }
@@ -0,0 +1,44 @@
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
+ }
@@ -0,0 +1,60 @@
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
+ }