@shakerquiz/utilities 0.4.86 → 0.5.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.
- package/package.json +2 -5
- package/source/enumerations/core/features.js +0 -348
- package/source/enumerations/core/methods.js +9 -18
- package/source/enumerations/core/networks.js +6 -4
- package/source/enumerations/core/runtimes.js +6 -4
- package/source/enumerations/entities/{game-statuses.js → game-status.js} +56 -39
- package/source/enumerations/entities/{registration-statuses.js → registration-status.js} +1 -3
- package/source/enumerations/entities/role.js +50 -0
- package/source/enumerations/entities/{venue-statuses.js → venue-status.js} +10 -8
- package/source/enumerations/misc/icons.js +2 -1
- package/source/index.js +9 -14
- package/source/misc.d.ts +13 -50
- package/source/enumerations/core/kinds.js +0 -4
- package/source/enumerations/core/scopes.js +0 -27
- package/source/enumerations/entities/roles.js +0 -13
- package/source/enumerations/misc/constants.d.ts +0 -3
- package/source/enumerations/misc/cookies.d.ts +0 -5
- package/source/enumerations/misc/cookies.js +0 -5
- package/source/enumerations/misc/regexps.d.ts +0 -5
- package/source/scope.d.ts +0 -874
- package/source/server.d.ts +0 -8
- /package/source/enumerations/entities/{city-affilations.js → city-affilation.js} +0 -0
- /package/source/enumerations/entities/{registration-attributes.js → registration-attribute.js} +0 -0
- /package/source/enumerations/entities/{registration-channels.js → registration-channel.js} +0 -0
- /package/source/enumerations/entities/{registration-lineups.js → registration-lineup.js} +0 -0
- /package/source/enumerations/entities/{registration-mailings.js → registration-mailing.js} +0 -0
package/source/index.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
/// <reference path="./misc.d.ts" />
|
|
2
|
-
/// <reference path="./scope.d.ts" />
|
|
3
|
-
/// <reference path="./server.d.ts" />
|
|
4
2
|
/// <reference path="./tables.d.ts" />
|
|
5
3
|
|
|
6
4
|
export * from './enumerations/core/features.js'
|
|
7
|
-
export * from './enumerations/core/kinds.js'
|
|
8
5
|
export * from './enumerations/core/methods.js'
|
|
9
6
|
export * from './enumerations/core/networks.js'
|
|
10
7
|
export * from './enumerations/core/runtimes.js'
|
|
11
|
-
export * from './enumerations/core/scopes.js'
|
|
12
8
|
|
|
13
9
|
export * from './enumerations/misc/constants.js'
|
|
14
|
-
export * from './enumerations/misc/cookies.js'
|
|
15
10
|
export * from './enumerations/misc/icons.js'
|
|
16
11
|
export * from './enumerations/misc/phases.js'
|
|
17
12
|
export * from './enumerations/misc/regexps.js'
|
|
18
13
|
|
|
19
|
-
export * from './enumerations/entities/city-
|
|
20
|
-
export * from './enumerations/entities/game-
|
|
21
|
-
export * from './enumerations/entities/registration-
|
|
22
|
-
export * from './enumerations/entities/registration-
|
|
23
|
-
export * from './enumerations/entities/registration-
|
|
24
|
-
export * from './enumerations/entities/registration-
|
|
25
|
-
export * from './enumerations/entities/registration-
|
|
26
|
-
export * from './enumerations/entities/
|
|
27
|
-
export * from './enumerations/entities/venue-
|
|
14
|
+
export * from './enumerations/entities/city-affilation.js'
|
|
15
|
+
export * from './enumerations/entities/game-status.js'
|
|
16
|
+
export * from './enumerations/entities/registration-attribute.js'
|
|
17
|
+
export * from './enumerations/entities/registration-channel.js'
|
|
18
|
+
export * from './enumerations/entities/registration-lineup.js'
|
|
19
|
+
export * from './enumerations/entities/registration-mailing.js'
|
|
20
|
+
export * from './enumerations/entities/registration-status.js'
|
|
21
|
+
export * from './enumerations/entities/role.js'
|
|
22
|
+
export * from './enumerations/entities/venue-status.js'
|
|
28
23
|
|
|
29
24
|
export * from './functions/tag.js'
|
package/source/misc.d.ts
CHANGED
|
@@ -22,78 +22,41 @@ type UseState<T> = [
|
|
|
22
22
|
* core
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
type Method = (typeof import('./enumerations/core/methods.js').Methods)[number]
|
|
26
|
-
|
|
27
25
|
type Feature = keyof typeof import('./enumerations/core/features.js').Feature
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
* @deprecated
|
|
31
|
-
*/
|
|
32
|
-
type Kind = (typeof import('./enumerations/core/kinds.js').Kinds)[number]
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated
|
|
36
|
-
*/
|
|
37
|
-
type Scope = `${Method}/${Feature}/${Kind}`
|
|
27
|
+
type Method = keyof typeof import('./enumerations/core/methods.js').Method
|
|
38
28
|
|
|
39
|
-
type
|
|
29
|
+
type Network = keyof typeof import('./enumerations/core/networks.js').Network
|
|
40
30
|
|
|
41
|
-
type
|
|
31
|
+
type Runtime = keyof typeof import('./enumerations/core/runtimes.js').Runtime
|
|
42
32
|
|
|
43
33
|
/**
|
|
44
34
|
* entities
|
|
45
35
|
*/
|
|
46
36
|
|
|
47
|
-
type CityAffilation = keyof typeof import('./enumerations/entities/city-
|
|
37
|
+
type CityAffilation = keyof typeof import('./enumerations/entities/city-affilation.js').CityAffilation
|
|
48
38
|
|
|
49
|
-
type GameStatus = keyof typeof import('./enumerations/entities/game-
|
|
39
|
+
type GameStatus = keyof typeof import('./enumerations/entities/game-status.js').GameStatus
|
|
50
40
|
|
|
51
41
|
type RegistrationAttribute =
|
|
52
|
-
keyof typeof import('./enumerations/entities/registration-
|
|
42
|
+
keyof typeof import('./enumerations/entities/registration-attribute.js').RegistrationAttribute
|
|
53
43
|
|
|
54
|
-
type RegistrationChannel = keyof typeof import('./enumerations/entities/registration-
|
|
44
|
+
type RegistrationChannel = keyof typeof import('./enumerations/entities/registration-channel.js').RegistrationChannel
|
|
55
45
|
|
|
56
|
-
type RegistrationLineup = keyof typeof import('./enumerations/entities/registration-
|
|
46
|
+
type RegistrationLineup = keyof typeof import('./enumerations/entities/registration-lineup.js').RegistrationLineup
|
|
57
47
|
|
|
58
|
-
type RegistrationMailing = keyof typeof import('./enumerations/entities/registration-
|
|
48
|
+
type RegistrationMailing = keyof typeof import('./enumerations/entities/registration-mailing.js').RegistrationMailing
|
|
59
49
|
|
|
60
|
-
type RegistrationStatus = keyof typeof import('./enumerations/entities/registration-
|
|
50
|
+
type RegistrationStatus = keyof typeof import('./enumerations/entities/registration-status.js').RegistrationStatus
|
|
61
51
|
|
|
62
|
-
type Role =
|
|
52
|
+
type Role = keyof typeof import('./enumerations/entities/role.js').Role
|
|
63
53
|
|
|
64
|
-
type VenueStatus = keyof typeof import('./enumerations/entities/venue-
|
|
54
|
+
type VenueStatus = keyof typeof import('./enumerations/entities/venue-status.js').VenueStatus
|
|
65
55
|
|
|
66
56
|
/**
|
|
67
57
|
* misc
|
|
68
58
|
*/
|
|
69
59
|
|
|
70
|
-
type Icon =
|
|
60
|
+
type Icon = typeof import('./enumerations/misc/icons.js').Icons[number]
|
|
71
61
|
|
|
72
62
|
type Phase = keyof typeof import('./enumerations/misc/phases.js').Phase
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* products
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated
|
|
80
|
-
*/
|
|
81
|
-
type ScopePhase = Record<Scope, Phase>
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated
|
|
85
|
-
*/
|
|
86
|
-
type ScopeState = Record<Scope, any>
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated
|
|
90
|
-
*/
|
|
91
|
-
type ScopeController = Record<Scope, AbortController | null>
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Server
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
type Routes = keyof typeof import('./enumerations/core/features.js').RoutePathname
|
|
98
|
-
|
|
99
|
-
type Pathnames = typeof import('./enumerations/core/features.js').RoutePathname[Routes]
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FeatureKindPatterns, Features } from './features.js'
|
|
2
|
-
import { Kinds } from './kinds.js'
|
|
3
|
-
import { Methods } from './methods.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @type {Scope[]}
|
|
7
|
-
*/
|
|
8
|
-
export var Scopes = Object
|
|
9
|
-
.values(Methods)
|
|
10
|
-
.flatMap(method => Object.values(Features).map(feature => [method, feature]))
|
|
11
|
-
.flatMap(array => Object.values(Kinds).map(kind => array.concat(kind)))
|
|
12
|
-
.map(array => array.join('/'))
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {Request} request
|
|
16
|
-
*
|
|
17
|
-
* @returns {Scope | ''}
|
|
18
|
-
*/
|
|
19
|
-
export var getScope = request => {
|
|
20
|
-
var found = FeatureKindPatterns
|
|
21
|
-
.find(([, , pattern]) => pattern.test(request.url))
|
|
22
|
-
?.slice(0, -1)
|
|
23
|
-
|
|
24
|
-
return found
|
|
25
|
-
? request.method + '/' + found[0] + '/' + found[1]
|
|
26
|
-
: ''
|
|
27
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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)
|