@shakerquiz/utilities 0.4.23 → 0.4.25

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.23",
4
+ "version": "0.4.25",
5
5
  "author": "yurkimus <yurkimus@gmail.com>",
6
6
  "license": "ISC",
7
7
  "exports": {
@@ -1,81 +1,21 @@
1
- export const Domains: readonly ["Asset", "User", "Role", "Country", "City", "Venue", "Theme", "ThemeAsset", "Game", "GameAsset", "Registration", "Mailing"];
1
+ export const Domains: readonly ["User", "Role", "Country", "City", "Venue", "Theme", "Game", "Registration"];
2
2
  /**
3
3
  * @type {Record<Domain, Icon>}
4
4
  */
5
5
  export const DomainIcon: Record<Domain, Icon>;
6
- export namespace DomainKindPathname {
7
- namespace User {
8
- let Unit: "/user/:user?";
9
- let Set: "/users";
10
- }
11
- namespace Role {
12
- let Unit_1: "/role/:role?";
13
- export { Unit_1 as Unit };
14
- let Set_1: "/roles";
15
- export { Set_1 as Set };
16
- }
17
- namespace Country {
18
- let Unit_2: "/country/:country?";
19
- export { Unit_2 as Unit };
20
- let Set_2: "/countries";
21
- export { Set_2 as Set };
22
- }
23
- namespace City {
24
- let Unit_3: "/city/:city?";
25
- export { Unit_3 as Unit };
26
- let Set_3: "/cities";
27
- export { Set_3 as Set };
28
- }
29
- namespace Venue {
30
- let Unit_4: "/venue/:venue?";
31
- export { Unit_4 as Unit };
32
- let Set_4: "/venues";
33
- export { Set_4 as Set };
34
- }
35
- namespace Theme {
36
- let Unit_5: "/theme/:theme?";
37
- export { Unit_5 as Unit };
38
- let Set_5: "/themes";
39
- export { Set_5 as Set };
40
- }
41
- namespace Game {
42
- let Unit_6: "/game/:game?";
43
- export { Unit_6 as Unit };
44
- let Set_6: "/games";
45
- export { Set_6 as Set };
46
- }
47
- namespace Registration {
48
- let Unit_7: "/registration/:registration?";
49
- export { Unit_7 as Unit };
50
- let Set_7: "/registrations";
51
- export { Set_7 as Set };
52
- }
53
- namespace Mailing {
54
- let Unit_8: "/mailing/:mailing?";
55
- export { Unit_8 as Unit };
56
- let Set_8: "/mailings";
57
- export { Set_8 as Set };
58
- }
59
- }
6
+ /**
7
+ * @type {Record<Domain, Record<Kind, string>>}
8
+ */
9
+ export const DomainKindPathname: Record<Domain, Record<Kind, string>>;
60
10
  export const Procedures: readonly ["Checkin", "Redirect"];
61
11
  /**
62
12
  * @type {Record<Procedure, Icon>}
63
13
  */
64
14
  export const ProcedureIcon: Record<Procedure, Icon>;
65
- export namespace ProcedureKindPathname {
66
- namespace Checkin {
67
- let Unit_9: "/checkin";
68
- export { Unit_9 as Unit };
69
- let Set_9: "/checkins";
70
- export { Set_9 as Set };
71
- }
72
- namespace Redirect {
73
- let Unit_10: "/redirect";
74
- export { Unit_10 as Unit };
75
- let Set_10: "/redirects";
76
- export { Set_10 as Set };
77
- }
78
- }
15
+ /**
16
+ * @type {Record<Procedure, Record<Kind, string>>}
17
+ */
18
+ export const ProcedureKindPathname: Record<Procedure, Record<Kind, string>>;
79
19
  /**
80
20
  * @type {Array<Domain | Procedure>}
81
21
  */
@@ -84,30 +24,10 @@ export const Features: Array<Domain | Procedure>;
84
24
  * @type {Record<Feature, Icon>}
85
25
  */
86
26
  export const FeatureIcon: Record<Feature, Icon>;
87
- export namespace FeatureKindPathname {
88
- export namespace Checkin_1 { }
89
- export { Checkin_1 as Checkin };
90
- export namespace Redirect_1 { }
91
- export { Redirect_1 as Redirect };
92
- export namespace User_1 { }
93
- export { User_1 as User };
94
- export namespace Role_1 { }
95
- export { Role_1 as Role };
96
- export namespace Country_1 { }
97
- export { Country_1 as Country };
98
- export namespace City_1 { }
99
- export { City_1 as City };
100
- export namespace Venue_1 { }
101
- export { Venue_1 as Venue };
102
- export namespace Theme_1 { }
103
- export { Theme_1 as Theme };
104
- export namespace Game_1 { }
105
- export { Game_1 as Game };
106
- export namespace Registration_1 { }
107
- export { Registration_1 as Registration };
108
- export namespace Mailing_1 { }
109
- export { Mailing_1 as Mailing };
110
- }
27
+ /**
28
+ * @type {Record<Feature, Record<Kind, string>>}
29
+ */
30
+ export const FeatureKindPathname: Record<Feature, Record<Kind, string>>;
111
31
  /**
112
32
  * @type {Array<[feature: Feature, kind: Kind, pathname: string]>}
113
33
  */
@@ -116,4 +36,5 @@ export const FeatureKindPathnames: Array<[feature: Feature, kind: Kind, pathname
116
36
  * @type {Array<[feature: Feature, kind: Kind, pattern: URLPattern]>}
117
37
  */
118
38
  export const FeatureKindPatterns: Array<[feature: Feature, kind: Kind, pattern: URLPattern]>;
119
- export function resolvePattern(feature: Feature, kind: Kind): URLPattern;
39
+ export function getPathname(feature: Feature, kind: Kind): string;
40
+ export function getPattern(feature: Feature, kind: Kind): any;
@@ -1,18 +1,18 @@
1
1
  import { Kinds } from './kinds.js'
2
2
 
3
3
  export var Domains = /** @type {const} */ ([
4
- 'Asset',
4
+ // 'Asset',
5
5
  'User',
6
6
  'Role',
7
7
  'Country',
8
8
  'City',
9
9
  'Venue',
10
10
  'Theme',
11
- 'ThemeAsset',
11
+ // 'ThemeAsset',
12
12
  'Game',
13
- 'GameAsset',
13
+ // 'GameAsset',
14
14
  'Registration',
15
- 'Mailing',
15
+ // 'Mailing',
16
16
  ])
17
17
 
18
18
  /**
@@ -31,7 +31,7 @@ export var DomainIcon = {
31
31
  }
32
32
 
33
33
  /**
34
- * @satisfies {Record<Domain, Record<Kind, string>>}
34
+ * @type {Record<Domain, Record<Kind, string>>}
35
35
  */
36
36
  export var DomainKindPathname = /** @type {const} */ ({
37
37
  'User': {
@@ -105,7 +105,7 @@ export var ProcedureIcon = {
105
105
  }
106
106
 
107
107
  /**
108
- * @satisfies {Record<Procedure, Record<Kind, string>>}
108
+ * @type {Record<Procedure, Record<Kind, string>>}
109
109
  */
110
110
  export var ProcedureKindPathname = /** @type {const} */ ({
111
111
  'Checkin': {
@@ -133,7 +133,7 @@ export var FeatureIcon = {
133
133
  }
134
134
 
135
135
  /**
136
- * @satisfies {Record<Feature, Record<Kind, string>>}
136
+ * @type {Record<Feature, Record<Kind, string>>}
137
137
  */
138
138
  export var FeatureKindPathname = {
139
139
  ...DomainKindPathname,
@@ -164,21 +164,35 @@ export var FeatureKindPatterns = FeatureKindPathnames
164
164
  /**
165
165
  * @param {Feature} feature
166
166
  * @param {Kind} kind
167
- *
168
- * @returns {URLPattern}
169
167
  */
170
- export let resolvePattern = (feature, kind) => {
168
+ export var getPathname = (feature, kind) => {
171
169
  if (!Features.includes(feature))
172
170
  throw TypeError(
173
- `Feature '${feature}' must be listed in 'Features'.`,
171
+ `[getPathname] Feature '${feature}' must be listed in 'Features'.`,
174
172
  )
175
173
 
176
174
  if (!Kinds.includes(kind))
177
175
  throw TypeError(
178
- `Kind '${kind}' must be listed in 'Kinds'.`,
176
+ `[getPathname] Kind '${kind}' must be listed in 'Kinds'.`,
179
177
  )
180
178
 
181
- return FeatureKindPatterns
182
- .find(([f, k]) => f == feature && k == kind)
183
- ?.at(2)
179
+ return FeatureKindPathname[feature][kind]
180
+ }
181
+
182
+ /**
183
+ * @param {Feature} feature
184
+ * @param {Kind} kind
185
+ */
186
+ export var getPattern = (feature, kind) => {
187
+ if (!Features.includes(feature))
188
+ throw TypeError(
189
+ `[getPattern] Feature '${feature}' must be listed in 'Features'.`,
190
+ )
191
+
192
+ if (!Kinds.includes(kind))
193
+ throw TypeError(
194
+ `[getPattern] Kind '${kind}' must be listed in 'Kinds'.`,
195
+ )
196
+
197
+ return FeatureKindPatterns.find(([f, k]) => f == feature && k == kind)[2]
184
198
  }
@@ -0,0 +1 @@
1
+ export const Networks: readonly ["Docker", "Public"];
@@ -0,0 +1,4 @@
1
+ export var Networks = /** @type {const} */ ([
2
+ 'Docker',
3
+ 'Public',
4
+ ])
@@ -0,0 +1 @@
1
+ export const Runtimes: readonly ["Next", "React"];
@@ -0,0 +1,4 @@
1
+ export var Runtimes = /** @type {const} */ ([
2
+ 'Next',
3
+ 'React',
4
+ ])
@@ -16,7 +16,7 @@ export var Scopes = Object
16
16
  *
17
17
  * @returns {Scope | ''}
18
18
  */
19
- export var resolveScope = request => {
19
+ export var getScope = request => {
20
20
  var found = FeatureKindPatterns
21
21
  .find(([, , pattern]) => pattern.test(request.url))
22
22
  ?.slice(0, -1)
package/source/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  /// <reference path="./misc.d.ts" />
2
- /// <reference path="./model.d.ts" />
3
2
  /// <reference path="./scope.d.ts" />
4
3
  /// <reference path="./server.d.ts" />
4
+ /// <reference path="./tables.d.ts" />
5
5
 
6
6
  export * from './enumerations/core/features.d.ts'
7
7
  export * from './enumerations/core/kinds.d.ts'
8
8
  export * from './enumerations/core/methods.d.ts'
9
+ export * from './enumerations/core/networks.d.ts'
10
+ export * from './enumerations/core/runtimes.d.ts'
9
11
  export * from './enumerations/core/scopes.d.ts'
10
12
 
11
13
  export * from './enumerations/misc/constants.d.ts'
package/source/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from './enumerations/core/features.js'
2
2
  export * from './enumerations/core/kinds.js'
3
3
  export * from './enumerations/core/methods.js'
4
+ export * from './enumerations/core/networks.js'
5
+ export * from './enumerations/core/runtimes.js'
4
6
  export * from './enumerations/core/scopes.js'
5
7
 
6
8
  export * from './enumerations/misc/constants.js'
package/source/misc.d.ts CHANGED
@@ -35,6 +35,12 @@ type Kind = (typeof import('./enumerations/core/kinds.js').Kinds)[number]
35
35
 
36
36
  type Scope = `${Method}/${Feature}/${Kind}`
37
37
 
38
+ type Runtime =
39
+ (typeof import('./enumerations/core/runtimes.js').Runtimes)[number]
40
+
41
+ type Network =
42
+ (typeof import('./enumerations/core/networks.js').Networks)[number]
43
+
38
44
  type Role = (typeof import('./enumerations/entities/roles.js').Roles)[number]
39
45
 
40
46
  type GameStatus =