@shakerquiz/utilities 0.2.12 → 0.2.14

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakerquiz/utilities",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "author": "yurkimus <yurkimus@gmail.com>",
5
5
  "license": "ISC",
6
6
  "exports": {
@@ -3,60 +3,55 @@ import { URLOptions } from '@yurkimus/url'
3
3
  import { Kinds } from './kinds'
4
4
  import { Networks } from './networks'
5
5
 
6
- export let Features: {
7
- Checkin: 'Checkin'
6
+ // export let Features: {
7
+ // Checkin: 'Checkin'
8
8
 
9
- User: 'User'
10
- Users: 'Users'
9
+ // User: 'User'
10
+ // Users: 'Users'
11
11
 
12
- Theme: 'Theme'
13
- Themes: 'Themes'
12
+ // Theme: 'Theme'
13
+ // Themes: 'Themes'
14
14
 
15
- Game: 'Game'
16
- Games: 'Games'
15
+ // Game: 'Game'
16
+ // Games: 'Games'
17
17
 
18
- Registration: 'Registration'
19
- Registrations: 'Registrations'
18
+ // Registration: 'Registration'
19
+ // Registrations: 'Registrations'
20
20
 
21
- City: 'City'
22
- Cities: 'Cities'
21
+ // City: 'City'
22
+ // Cities: 'Cities'
23
23
 
24
- CityPublic: 'CityPublic'
25
- CitiesPublic: 'CitiesPublic'
24
+ // CityPublic: 'CityPublic'
25
+ // CitiesPublic: 'CitiesPublic'
26
26
 
27
- Location: 'Location'
28
- Locations: 'Locations'
29
- }
27
+ // Location: 'Location'
28
+ // Locations: 'Locations'
29
+ // }
30
30
 
31
- export let FeatureKinds: {
32
- [Features.Checkin]: Kinds.Item
31
+ // export let FeatureKinds: {
32
+ // [Features.Checkin]: Kinds.Item
33
33
 
34
- [Features.User]: Kinds.Item
35
- [Features.Users]: Kinds.List
34
+ // [Features.User]: Kinds.Item
35
+ // [Features.Users]: Kinds.List
36
36
 
37
- [Features.Theme]: Kinds.Item
38
- [Features.Themes]: Kinds.List
37
+ // [Features.Theme]: Kinds.Item
38
+ // [Features.Themes]: Kinds.List
39
39
 
40
- [Features.Game]: Kinds.Item
41
- [Features.Games]: Kinds.List
40
+ // [Features.Game]: Kinds.Item
41
+ // [Features.Games]: Kinds.List
42
42
 
43
- [Features.Registration]: Kinds.Item
44
- [Features.Registrations]: Kinds.List
43
+ // [Features.Registration]: Kinds.Item
44
+ // [Features.Registrations]: Kinds.List
45
45
 
46
- [Features.City]: Kinds.Item
47
- [Features.Cities]: Kinds.List
46
+ // [Features.City]: Kinds.Item
47
+ // [Features.Cities]: Kinds.List
48
48
 
49
- [Features.CityPublic]: Kinds.Item
50
- [Features.CitiesPublic]: Kinds.List
49
+ // [Features.CityPublic]: Kinds.Item
50
+ // [Features.CitiesPublic]: Kinds.List
51
51
 
52
- [Features.Location]: Kinds.Item
53
- [Features.Locations]: Kinds.List
54
- }
55
-
56
- export let FeatureRequests: Map<
57
- keyof typeof Features,
58
- Set<'DELETE' | 'GET' | 'OPTIONS' | 'POST' | 'PATCH'>
59
- >
52
+ // [Features.Location]: Kinds.Item
53
+ // [Features.Locations]: Kinds.List
54
+ // }
60
55
 
61
56
  export let FeatureUrls: Map<
62
57
  keyof typeof Features,
@@ -1,6 +1,6 @@
1
1
  import { Kinds } from './kinds.js'
2
2
 
3
- export let Features = {
3
+ export let Features = /** @type {const} */ ({
4
4
  Checkin: 'Checkin',
5
5
 
6
6
  User: 'User',
@@ -20,7 +20,7 @@ export let Features = {
20
20
 
21
21
  Location: 'Location',
22
22
  Locations: 'Locations',
23
- }
23
+ })
24
24
 
25
25
  export let FeatureKinds = {
26
26
  [Features.Checkin]: Kinds.Item,
@@ -44,6 +44,4 @@ export let FeatureKinds = {
44
44
  [Features.Locations]: Kinds.List,
45
45
  }
46
46
 
47
- export let FeatureRequests = new Map()
48
-
49
47
  export let FeatureUrls = new Map()
@@ -1,4 +1,4 @@
1
- export let Kinds = {
1
+ export let Kinds = /** @type {const} */ ({
2
2
  Item: 'Item',
3
3
  List: 'List',
4
- }
4
+ })
@@ -1,7 +1,7 @@
1
- export let Methods = {
1
+ export let Methods = /** @type {const} */ ({
2
2
  DELETE: 'DELETE',
3
3
  GET: 'GET',
4
4
  OPTIONS: 'OPTIONS',
5
5
  PATCH: 'PATCH',
6
6
  POST: 'POST',
7
- }
7
+ })
@@ -1,38 +1,38 @@
1
- import { Features } from './features'
1
+ import { Features } from './features.d.ts'
2
2
 
3
- export let Patterns = {
3
+ export let Patterns: {
4
4
  /**
5
5
  * Users
6
6
  */
7
- [Features.Checkin]: InstanceType<typeof URLPattern>,
7
+ [Features.Checkin]: InstanceType<typeof URLPattern>
8
8
 
9
- [Features.User]: InstanceType<typeof URLPattern>,
9
+ [Features.User]: InstanceType<typeof URLPattern>
10
10
 
11
- [Features.Users]: InstanceType<typeof URLPattern>,
11
+ [Features.Users]: InstanceType<typeof URLPattern>
12
12
 
13
13
  /**
14
14
  * Games
15
15
  */
16
- [Features.Theme]: InstanceType<typeof URLPattern>,
16
+ [Features.Theme]: InstanceType<typeof URLPattern>
17
17
 
18
- [Features.Themes]: InstanceType<typeof URLPattern>,
18
+ [Features.Themes]: InstanceType<typeof URLPattern>
19
19
 
20
- [Features.Game]: InstanceType<typeof URLPattern>,
20
+ [Features.Game]: InstanceType<typeof URLPattern>
21
21
 
22
- [Features.Games]: InstanceType<typeof URLPattern>,
22
+ [Features.Games]: InstanceType<typeof URLPattern>
23
23
 
24
- [Features.Registration]: InstanceType<typeof URLPattern>,
24
+ [Features.Registration]: InstanceType<typeof URLPattern>
25
25
 
26
- [Features.Registrations]: InstanceType<typeof URLPattern>,
26
+ [Features.Registrations]: InstanceType<typeof URLPattern>
27
27
 
28
28
  /**
29
29
  * Locations
30
30
  */
31
- [Features.City]: InstanceType<typeof URLPattern>,
31
+ [Features.City]: InstanceType<typeof URLPattern>
32
32
 
33
- [Features.Cities]: InstanceType<typeof URLPattern>,
33
+ [Features.Cities]: InstanceType<typeof URLPattern>
34
34
 
35
- [Features.Location]: InstanceType<typeof URLPattern>,
35
+ [Features.Location]: InstanceType<typeof URLPattern>
36
36
 
37
- [Features.Locations]: InstanceType<typeof URLPattern>,
37
+ [Features.Locations]: InstanceType<typeof URLPattern>
38
38
  }
@@ -3,11 +3,7 @@ import { MessageError } from '@yurkimus/errors'
3
3
  import * as message from '@yurkimus/message'
4
4
  import { ResponseStatus } from '@yurkimus/response-status'
5
5
 
6
- import {
7
- FeatureKinds,
8
- FeatureRequests,
9
- FeatureUrls,
10
- } from '../enumerations/features.js'
6
+ import { FeatureKinds, FeatureUrls } from '../enumerations/features.js'
11
7
  import { Kinds } from '../enumerations/kinds.js'
12
8
 
13
9
  let handleMessage = (feature, [response, body]) => {
@@ -96,19 +92,6 @@ export let Extensions = new WeakMap()
96
92
  * @param {Network} network
97
93
  */
98
94
  export let useRequest = (feature, method, network) => {
99
- if (
100
- !FeatureRequests
101
- .has(feature)
102
- )
103
- throw TypeError(`Feature '${feature}' must be listed in 'FeatureRequests'.`)
104
-
105
- if (
106
- !FeatureRequests
107
- .get(feature)
108
- .has(method)
109
- )
110
- throw TypeError(`Method '${method}' must be listed in 'FeatureRequests'.`)
111
-
112
95
  if (
113
96
  !FeatureUrls
114
97
  .has(feature)
package/source/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- /// <reference path="globals.d.ts" />
2
- /// <reference path="user.d.ts" />
3
- /// <reference path="role.d.ts" />
4
- /// <reference path="theme.d.ts" />
5
- /// <reference path="game.d.ts" />
6
- /// <reference path="registration.d.ts" />
7
- /// <reference path="city.d.ts" />
8
- /// <reference path="location.d.ts" />
1
+ /// <reference path="./globals.d.ts" />
2
+ /// <reference path="./user.d.ts" />
3
+ /// <reference path="./role.d.ts" />
4
+ /// <reference path="./theme.d.ts" />
5
+ /// <reference path="./game.d.ts" />
6
+ /// <reference path="./registration.d.ts" />
7
+ /// <reference path="./city.d.ts" />
8
+ /// <reference path="./location.d.ts" />
9
9
 
10
10
  export * from './enumerations/constants.js'
11
11
  export * from './enumerations/cookies.js'
@@ -18,4 +18,5 @@ export * from './enumerations/patterns.js'
18
18
  export * from './enumerations/phases.js'
19
19
  export * from './enumerations/regexps.js'
20
20
  export * from './enumerations/roles.js'
21
+
21
22
  export * from './functions/request.js'