@shakerquiz/utilities 0.2.17 → 0.2.18

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.17",
3
+ "version": "0.2.18",
4
4
  "author": "yurkimus <yurkimus@gmail.com>",
5
5
  "license": "ISC",
6
6
  "exports": {
@@ -1,3 +1,3 @@
1
- export let Constants: {
1
+ export var Constants: {
2
2
  NilUuid: '00000000-0000-0000-0000-000000000000'
3
3
  }
@@ -1,6 +1,6 @@
1
- export let Constants = {
1
+ export var Constants = /** @type {const} */ ({
2
2
  /**
3
3
  * @see https://www.rfc-editor.org/rfc/rfc9562.html#name-nil-uuid
4
4
  */
5
5
  NilUuid: '00000000-0000-0000-0000-000000000000',
6
- }
6
+ })
@@ -1,5 +1,5 @@
1
- export let Cookies: {
2
- Token: 'shaker-quiz-token',
3
- Refresh: 'shaker-quiz-refresh-token',
4
- Role: 'shaker-quiz-user-role',
1
+ export var Cookies: {
2
+ Token: 'shaker-quiz-token'
3
+ Refresh: 'shaker-quiz-refresh-token'
4
+ Role: 'shaker-quiz-user-role'
5
5
  }
@@ -1,4 +1,4 @@
1
- export let Cookies = {
1
+ export var Cookies = {
2
2
  Token: 'shaker-quiz-token',
3
3
  Refresh: 'shaker-quiz-refresh-token',
4
4
  Role: 'shaker-quiz-user-role',
@@ -1,70 +1,147 @@
1
1
  import { Kinds } from './kinds.js'
2
- import { Services } from './services.js'
2
+ import { Networks } from './networks.js'
3
3
 
4
- export let Features = /** @type {const} */ ({
4
+ export var Features = /** @type {const} */ ({
5
5
  Checkin: 'Checkin',
6
-
7
- User: 'User',
8
- Users: 'Users',
9
-
10
- Theme: 'Theme',
11
- Themes: 'Themes',
12
-
6
+ Cities: 'Cities',
7
+ City: 'City',
13
8
  Game: 'Game',
14
9
  Games: 'Games',
15
-
16
- Registration: 'Registration',
17
- Registrations: 'Registrations',
18
-
19
- City: 'City',
20
- Cities: 'Cities',
21
-
22
10
  Location: 'Location',
23
11
  Locations: 'Locations',
12
+ Registration: 'Registration',
13
+ Registrations: 'Registrations',
14
+ Theme: 'Theme',
15
+ Themes: 'Themes',
16
+ User: 'User',
17
+ Users: 'Users',
24
18
  })
25
19
 
26
- export let FeatureKinds = {
20
+ export var FeatureKinds = {
27
21
  [Features.Checkin]: Kinds.Item,
28
-
29
- [Features.User]: Kinds.Item,
30
- [Features.Users]: Kinds.List,
31
-
32
- [Features.Theme]: Kinds.Item,
33
- [Features.Themes]: Kinds.List,
34
-
22
+ [Features.Cities]: Kinds.List,
23
+ [Features.City]: Kinds.Item,
35
24
  [Features.Game]: Kinds.Item,
36
25
  [Features.Games]: Kinds.List,
37
-
38
- [Features.Registration]: Kinds.Item,
39
- [Features.Registrations]: Kinds.List,
40
-
41
- [Features.City]: Kinds.Item,
42
- [Features.Cities]: Kinds.List,
43
-
44
26
  [Features.Location]: Kinds.Item,
45
27
  [Features.Locations]: Kinds.List,
28
+ [Features.Registration]: Kinds.Item,
29
+ [Features.Registrations]: Kinds.List,
30
+ [Features.Theme]: Kinds.Item,
31
+ [Features.Themes]: Kinds.List,
32
+ [Features.User]: Kinds.Item,
33
+ [Features.Users]: Kinds.List,
46
34
  }
47
35
 
48
- export let FeatureServices = {
49
- [Features.Checkin]: Services.Users,
50
-
51
- [Features.User]: Services.Users,
52
- [Features.Users]: Services.Users,
53
-
54
- [Features.Theme]: Services.Games,
55
- [Features.Themes]: Services.Games,
56
-
57
- [Features.Game]: Services.Games,
58
- [Features.Games]: Services.Games,
59
-
60
- [Features.Registration]: Services.Games,
61
- [Features.Registrations]: Services.Games,
62
-
63
- [Features.City]: Services.Locations,
64
- [Features.Cities]: Services.Locations,
36
+ export var FeaturePathnames = /** @type {const} */ ({
37
+ [Features.Checkin]: '/checkin',
38
+ [Features.Cities]: '/cities',
39
+ [Features.City]: '/city/:city?',
40
+ [Features.Game]: '/game/:game?',
41
+ [Features.Games]: '/games',
42
+ [Features.Location]: '/location/:location?',
43
+ [Features.Locations]: '/locations',
44
+ [Features.Registration]: '/registration/:registration?',
45
+ [Features.Registrations]: '/registrations',
46
+ [Features.Theme]: '/theme/:theme?',
47
+ [Features.Themes]: '/themes',
48
+ [Features.User]: '/user/:user?',
49
+ [Features.Users]: '/users',
50
+ })
65
51
 
66
- [Features.Location]: Services.Locations,
67
- [Features.Locations]: Services.Locations,
52
+ export var FeaturePatterns = {
53
+ [Features.Checkin]: new URLPattern({
54
+ pathname: FeaturePathnames[Features.Checkin],
55
+ }),
56
+ [Features.Cities]: new URLPattern({
57
+ pathname: FeaturePathnames[Features.Cities],
58
+ }),
59
+ [Features.City]: new URLPattern({
60
+ pathname: FeaturePathnames[Features.City],
61
+ }),
62
+ [Features.Game]: new URLPattern({
63
+ pathname: FeaturePathnames[Features.Game],
64
+ }),
65
+ [Features.Games]: new URLPattern({
66
+ pathname: FeaturePathnames[Features.Games],
67
+ }),
68
+ [Features.Location]: new URLPattern({
69
+ pathname: FeaturePathnames[Features.Location],
70
+ }),
71
+ [Features.Locations]: new URLPattern({
72
+ pathname: FeaturePathnames[Features.Locations],
73
+ }),
74
+ [Features.Registration]: new URLPattern({
75
+ pathname: FeaturePathnames[Features.Registration],
76
+ }),
77
+ [Features.Registrations]: new URLPattern({
78
+ pathname: FeaturePathnames[Features.Registrations],
79
+ }),
80
+ [Features.Theme]: new URLPattern({
81
+ pathname: FeaturePathnames[Features.Theme],
82
+ }),
83
+ [Features.Themes]: new URLPattern({
84
+ pathname: FeaturePathnames[Features.Themes],
85
+ }),
86
+ [Features.User]: new URLPattern({
87
+ pathname: FeaturePathnames[Features.User],
88
+ }),
89
+ [Features.Users]: new URLPattern({
90
+ pathname: FeaturePathnames[Features.Users],
91
+ }),
68
92
  }
69
93
 
70
- export let FeatureOrigins = new Map()
94
+ export var FeatureNetworkOrigins = /** @type {const} */ ({
95
+ [Features.Checkin]: {
96
+ [Networks.Private]: 'http://users/',
97
+ [Networks.Public]: 'https://users.backend.shakerquiz.ru/',
98
+ },
99
+ [Features.Cities]: {
100
+ [Networks.Private]: 'http://locations/',
101
+ [Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
102
+ },
103
+ [Features.City]: {
104
+ [Networks.Private]: 'http://locations/',
105
+ [Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
106
+ },
107
+ [Features.Game]: {
108
+ [Networks.Private]: 'http://games/',
109
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
110
+ },
111
+ [Features.Games]: {
112
+ [Networks.Private]: 'http://games/',
113
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
114
+ },
115
+ [Features.Location]: {
116
+ [Networks.Private]: 'http://locations/',
117
+ [Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
118
+ },
119
+ [Features.Locations]: {
120
+ [Networks.Private]: 'http://locations/',
121
+ [Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
122
+ },
123
+ [Features.Registration]: {
124
+ [Networks.Private]: 'http://games/',
125
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
126
+ },
127
+ [Features.Registrations]: {
128
+ [Networks.Private]: 'http://games/',
129
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
130
+ },
131
+ [Features.Theme]: {
132
+ [Networks.Private]: 'http://games/',
133
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
134
+ },
135
+ [Features.Themes]: {
136
+ [Networks.Private]: 'http://games/',
137
+ [Networks.Public]: 'https://games.backend.shakerquiz.ru/',
138
+ },
139
+ [Features.User]: {
140
+ [Networks.Private]: 'http://users/',
141
+ [Networks.Public]: 'https://users.backend.shakerquiz.ru/',
142
+ },
143
+ [Features.Users]: {
144
+ [Networks.Private]: 'http://users/',
145
+ [Networks.Public]: 'https://users.backend.shakerquiz.ru/',
146
+ },
147
+ })
@@ -1,6 +1,6 @@
1
1
  import { Roles } from './roles.js'
2
2
 
3
- export let GameStatuses: {
3
+ export var GameStatuses: {
4
4
  Approved: 'APPROVED'
5
5
  Archive: 'ARCHIVE'
6
6
  Closed: 'CLOSED'
@@ -12,7 +12,7 @@ export let GameStatuses: {
12
12
  Reserved: 'IS_RESERVE'
13
13
  }
14
14
 
15
- export let RoleGameStatuses: {
15
+ export var RoleGameStatuses: {
16
16
  [Roles.Admin]: [
17
17
  typeof GameStatuses.Approved,
18
18
  typeof GameStatuses.Moderation,
@@ -37,7 +37,3 @@ export let RoleGameStatuses: {
37
37
 
38
38
  [Roles.Default]: []
39
39
  }
40
-
41
- type GameStatuses = typeof GameStatuses
42
-
43
- type GameStatusesUnion = GameStatuses[keyof GameStatuses]
@@ -1,38 +1,38 @@
1
1
  import { Roles } from './roles.js'
2
2
 
3
- export let GameStatuses = {
4
- Approved: 'APPROVED',
5
- Archive: 'ARCHIVE',
6
- Closed: 'CLOSED',
7
- Finished: 'FINISHED',
8
- Invitation: 'FORINVITES',
9
- Moderation: 'MODERATION',
10
- Published: 'PUBLISHED',
11
- Rejected: 'REJECTED',
12
- Reserved: 'IS_RESERVE',
13
- }
3
+ export var GameStatuses = /** @type {const} */ ({
4
+ APPROVED: 'APPROVED',
5
+ ARCHIVE: 'ARCHIVE',
6
+ CLOSED: 'CLOSED',
7
+ FINISHED: 'FINISHED',
8
+ FORINVITES: 'FORINVITES',
9
+ MODERATION: 'MODERATION',
10
+ PUBLISHED: 'PUBLISHED',
11
+ REJECTED: 'REJECTED',
12
+ IS_RESERVE: 'IS_RESERVE',
13
+ })
14
14
 
15
- export let RoleGameStatuses = {
15
+ export var RoleGameStatuses = {
16
16
  [Roles.Admin]: [
17
- GameStatuses.Approved,
18
- GameStatuses.Moderation,
19
- GameStatuses.Published,
20
- GameStatuses.Rejected,
21
- GameStatuses.Finished,
22
- GameStatuses.Archive,
23
- GameStatuses.Invitation,
24
- GameStatuses.Reserved,
25
- GameStatuses.Closed,
17
+ GameStatuses.APPROVED,
18
+ GameStatuses.MODERATION,
19
+ GameStatuses.PUBLISHED,
20
+ GameStatuses.REJECTED,
21
+ GameStatuses.FINISHED,
22
+ GameStatuses.ARCHIVE,
23
+ GameStatuses.FORINVITES,
24
+ GameStatuses.IS_RESERVE,
25
+ GameStatuses.CLOSED,
26
26
  ],
27
27
 
28
28
  [Roles.Organizer]: [
29
- GameStatuses.Approved,
30
- GameStatuses.Published,
31
- GameStatuses.Finished,
32
- GameStatuses.Archive,
33
- GameStatuses.Invitation,
34
- GameStatuses.Reserved,
35
- GameStatuses.Closed,
29
+ GameStatuses.APPROVED,
30
+ GameStatuses.PUBLISHED,
31
+ GameStatuses.FINISHED,
32
+ GameStatuses.ARCHIVE,
33
+ GameStatuses.FORINVITES,
34
+ GameStatuses.IS_RESERVE,
35
+ GameStatuses.CLOSED,
36
36
  ],
37
37
 
38
38
  [Roles.Default]: [],
@@ -1,4 +1,4 @@
1
- export let Kinds: {
1
+ export var Kinds: {
2
2
  Item: 'Item'
3
3
  List: 'List'
4
4
  }
@@ -1,4 +1,4 @@
1
- export let Kinds = /** @type {const} */ ({
1
+ export var Kinds = /** @type {const} */ ({
2
2
  Item: 'Item',
3
3
  List: 'List',
4
4
  })
@@ -1,7 +1,8 @@
1
- export let Methods: {
1
+ export var Methods: {
2
2
  DELETE: 'DELETE'
3
3
  GET: 'GET'
4
4
  OPTIONS: 'OPTIONS'
5
5
  PATCH: 'PATCH'
6
6
  POST: 'POST'
7
+ PUT: 'PUT'
7
8
  }
@@ -1,7 +1,8 @@
1
- export let Methods = /** @type {const} */ ({
1
+ export var Methods = /** @type {const} */ ({
2
2
  DELETE: 'DELETE',
3
3
  GET: 'GET',
4
4
  OPTIONS: 'OPTIONS',
5
5
  PATCH: 'PATCH',
6
6
  POST: 'POST',
7
+ PUT: 'PUT',
7
8
  })
@@ -1,4 +1,6 @@
1
- export let Networks: {
1
+ import { Features } from './features.d.ts'
2
+
3
+ export var Networks: {
2
4
  Private: 'Private'
3
5
  Public: 'Public'
4
6
  }
@@ -1,4 +1,4 @@
1
- export let Networks = {
1
+ export var Networks = /** @type {const} */ ({
2
2
  Private: 'Private',
3
3
  Public: 'Public',
4
- }
4
+ })
@@ -1,8 +1,6 @@
1
1
  export let RegExps = {
2
2
  Uuid: /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,
3
-
4
3
  ElementId:
5
4
  /\d+:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:\d+/,
6
-
7
5
  Jwt: /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$/,
8
6
  }
@@ -1,5 +1,5 @@
1
- export let Roles = {
1
+ export var Roles = /** @type {const} */ ({
2
2
  Admin: 'admin',
3
3
  Organizer: 'organizer',
4
4
  Default: 'default',
5
- }
5
+ })
@@ -5,7 +5,7 @@ import { Features } from '../enumerations/features'
5
5
  import { Methods } from '../enumerations/methods'
6
6
  import { Networks } from '../enumerations/networks'
7
7
 
8
- type RequestResults = {
8
+ type FetchResults = {
9
9
  [Features.Checkin]: {
10
10
  [Methods.DELETE]: {
11
11
  [Roles.Admin]: unknown
@@ -433,7 +433,7 @@ export let Extensions: WeakMap<
433
433
  >
434
434
  >
435
435
 
436
- export let useRequest: <
436
+ export let useFetch: <
437
437
  Feature extends keyof typeof Features,
438
438
  Method extends keyof typeof Methods,
439
439
  Network extends keyof typeof Networks,
@@ -444,4 +444,4 @@ export let useRequest: <
444
444
  ) => <Role extends Roles[RolesUnion] = Roles['Default']>(
445
445
  options: URLOptions,
446
446
  init: RequestInit,
447
- ) => Promise<RequestResults[Feature][Method][Role]>
447
+ ) => Promise<FetchResults[Feature][Method][Role]>
@@ -2,15 +2,18 @@ import * as cookies from '@yurkimus/cookies'
2
2
  import { MessageError } from '@yurkimus/errors'
3
3
  import * as message from '@yurkimus/message'
4
4
  import { ResponseStatus } from '@yurkimus/response-status'
5
+ import { url } from '@yurkimus/url'
5
6
 
6
7
  import { Cookies } from '../enumerations/cookies.js'
7
8
  import {
8
9
  FeatureKinds,
9
- FeatureOrigins,
10
- FeatureServices,
10
+ FeatureNetworkOrigins,
11
+ FeaturePathnames,
12
+ Features,
11
13
  } from '../enumerations/features.js'
12
14
  import { Kinds } from '../enumerations/kinds.js'
13
- import { FeaturePatterns } from '../enumerations/patterns.js'
15
+ import { Methods } from '../enumerations/methods.js'
16
+ import { Networks } from '../enumerations/networks.js'
14
17
 
15
18
  let handleMessage = (feature, [response, body]) => {
16
19
  switch (response.status) {
@@ -27,28 +30,18 @@ let handleMessage = (feature, [response, body]) => {
27
30
  return []
28
31
  }
29
32
 
30
- case 400:
31
- case 401:
32
- case 403:
33
- case 404:
34
- case 409:
35
- case 415:
36
- case 500:
37
- case 502:
33
+ default:
38
34
  throw MessageError(
39
- body.message,
35
+ body?.message ?? '',
40
36
  ResponseStatus(response.status),
41
37
  )
42
-
43
- default:
44
- throw body
45
38
  }
46
39
  }
47
40
 
48
41
  /**
49
- * @template {FeaturesUnion} Feature
50
- * @template {MethodsUnion} Method
51
- * @template {NetworksUnion} Network
42
+ * @template {keyof typeof Features} Feature
43
+ * @template {keyof typeof Methods} Method
44
+ * @template {keyof typeof Networks} Network
52
45
  *
53
46
  * @param {Feature} feature
54
47
  * @param {Method} method
@@ -56,36 +49,37 @@ let handleMessage = (feature, [response, body]) => {
56
49
  * @param {import('@yurkimus/url').URLOptions | undefined} options
57
50
  * @param {RequestInit} init
58
51
  */
59
- let makeRequest = (feature, method, network, options, init) => {
52
+ let request = (feature, method, network, options, init) => {
60
53
  if (!('method' in init))
61
54
  init.method = method
62
55
 
63
- let url = FeatureOrigins
64
- .get(FeatureServices[feature])
65
- .get(network)
66
- .call(
67
- undefined,
68
- FeaturePatterns[feature].pathname,
56
+ let instance = new Request(
57
+ url(
58
+ FeatureNetworkOrigins[feature][network],
59
+ FeaturePathnames[feature],
69
60
  options,
70
- )
71
-
72
- let request = new Request(url, init)
61
+ ),
62
+ init,
63
+ )
73
64
 
74
- if (!request.headers.has('Content-Type'))
75
- request.headers.set(
65
+ if (!instance.headers.has('Content-Type'))
66
+ instance.headers.set(
76
67
  'Content-Type',
77
68
  'application/json',
78
69
  )
79
70
 
80
71
  if ('cookie' in init)
81
- request.headers.set(
72
+ instance.headers.set(
82
73
  'Authorization',
83
74
  cookies.read(Cookies.Token, init.cookie),
84
75
  )
85
76
 
86
- return fetch(request)
77
+ return fetch(instance)
87
78
  .then(message.read)
88
- .then(handleMessage.bind(undefined, feature))
79
+ .then(handleMessage.bind(
80
+ undefined,
81
+ feature,
82
+ ))
89
83
  }
90
84
 
91
85
  /**
@@ -102,37 +96,42 @@ export let Extensions = new WeakMap()
102
96
  * @param {Method} method
103
97
  * @param {Network} network
104
98
  */
105
- export let useRequest = (feature, method, network) => {
106
- if (!(feature in FeatureServices))
99
+ export let useFetch = (feature, method, network) => {
100
+ if (!(feature in Features))
101
+ throw TypeError(
102
+ `Feature '${feature}' must be listed in 'Features'.`,
103
+ )
104
+
105
+ if (!(method in Methods))
107
106
  throw TypeError(
108
- `Feature '${feature}' must be listed in 'FeatureServices'.`,
107
+ `Method '${method}' must be listed in 'Methods'.`,
109
108
  )
110
109
 
111
- if (!(feature in FeaturePatterns))
110
+ if (!(feature in FeaturePathnames))
112
111
  throw TypeError(
113
- `Feature '${feature}' must be listed in 'FeaturePatterns'.`,
112
+ `Feature '${feature}' must be listed in 'FeaturePathnames'.`,
114
113
  )
115
114
 
116
- if (!FeatureOrigins.has(FeatureServices[feature]))
115
+ if (!(feature in FeatureNetworkOrigins))
117
116
  throw TypeError(
118
- `Service '${
119
- FeatureServices[feature]
120
- }' must be listed in 'FeatureOrigins'.`,
117
+ `Feature '${feature}' must be listed in 'FeatureNetworkOrigins'.`,
121
118
  )
122
119
 
123
- if (!FeatureOrigins.get(FeatureServices[feature]).has(network))
120
+ if (!(network in FeatureNetworkOrigins[feature]))
124
121
  throw TypeError(
125
- `Network '${network}' must be listed in '${FeatureServices[feature]}'.`,
122
+ `Network '${
123
+ FeatureNetworkOrigins[feature]
124
+ }' must be listed in 'FeatureNetworkOrigins[feature]'.`,
126
125
  )
127
126
 
128
127
  /**
129
128
  * @param {import('@yurkimus/url').URLOptions} options
130
129
  * @param {RequestInit} init
131
130
  */
132
- let request = (options, init) => {
131
+ let fetch = (options, init) => {
133
132
  let onbefore = parameters => {
134
133
  let predicates = Extensions
135
- .get(request)
134
+ .get(fetch)
136
135
  .get('onbefore')
137
136
 
138
137
  return (predicates.size > 0)
@@ -147,7 +146,7 @@ export let useRequest = (feature, method, network) => {
147
146
 
148
147
  let onfulfilled = contract => {
149
148
  let predicates = Extensions
150
- .get(request)
149
+ .get(fetch)
151
150
  .get('onfulfilled')
152
151
 
153
152
  return (predicates.size > 0)
@@ -162,7 +161,7 @@ export let useRequest = (feature, method, network) => {
162
161
 
163
162
  let onrejected = reason => {
164
163
  let predicates = Extensions
165
- .get(request)
164
+ .get(fetch)
166
165
  .get('onrejected')
167
166
 
168
167
  Array
@@ -180,7 +179,7 @@ export let useRequest = (feature, method, network) => {
180
179
  }
181
180
  })
182
181
  .then(([options, init]) =>
183
- makeRequest(
182
+ request(
184
183
  feature,
185
184
  method,
186
185
  network,
@@ -193,7 +192,7 @@ export let useRequest = (feature, method, network) => {
193
192
  }
194
193
 
195
194
  Extensions.set(
196
- request,
195
+ fetch,
197
196
  new Map([
198
197
  ['onbefore', new Set([])],
199
198
  ['onfulfilled', new Set([])],
@@ -201,5 +200,5 @@ export let useRequest = (feature, method, network) => {
201
200
  ]),
202
201
  )
203
202
 
204
- return request
203
+ return fetch
205
204
  }
package/source/index.d.ts CHANGED
@@ -18,6 +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
- export * from './enumerations/services.js'
22
21
 
23
- export * from './functions/request.js'
22
+ export * from './functions/fetch.js'
package/source/index.js CHANGED
@@ -9,5 +9,5 @@ export * from './enumerations/patterns.js'
9
9
  export * from './enumerations/phases.js'
10
10
  export * from './enumerations/regexps.js'
11
11
  export * from './enumerations/roles.js'
12
- export * from './enumerations/services.js'
13
- export * from './functions/request.js'
12
+
13
+ export * from './functions/fetch.js'
@@ -1,83 +0,0 @@
1
- import { URLOptions } from '@yurkimus/url'
2
-
3
- import { Kinds } from './kinds.d.ts'
4
- import { Networks } from './networks.d.ts'
5
- import { Services } from './services.d.ts'
6
-
7
- export let Features: {
8
- Checkin: 'Checkin'
9
-
10
- User: 'User'
11
- Users: 'Users'
12
-
13
- Theme: 'Theme'
14
- Themes: 'Themes'
15
-
16
- Game: 'Game'
17
- Games: 'Games'
18
-
19
- Registration: 'Registration'
20
- Registrations: 'Registrations'
21
-
22
- City: 'City'
23
- Cities: 'Cities'
24
-
25
- Location: 'Location'
26
- Locations: 'Locations'
27
- }
28
-
29
- export let FeatureKinds: {
30
- [Features.Checkin]: Kinds.Item
31
-
32
- [Features.User]: Kinds.Item
33
- [Features.Users]: Kinds.List
34
-
35
- [Features.Theme]: Kinds.Item
36
- [Features.Themes]: Kinds.List
37
-
38
- [Features.Game]: Kinds.Item
39
- [Features.Games]: Kinds.List
40
-
41
- [Features.Registration]: Kinds.Item
42
- [Features.Registrations]: Kinds.List
43
-
44
- [Features.City]: Kinds.Item
45
- [Features.Cities]: Kinds.List
46
-
47
- [Features.Location]: Kinds.Item
48
- [Features.Locations]: Kinds.List
49
- }
50
-
51
- export let FeatureServices: {
52
- [Features.Checkin]: Services.Users
53
-
54
- [Features.User]: Services.Users
55
- [Features.Users]: Services.Users
56
-
57
- [Features.Theme]: Services.Games
58
- [Features.Themes]: Services.Games
59
-
60
- [Features.Game]: Services.Games
61
- [Features.Games]: Services.Games
62
-
63
- [Features.Registration]: Services.Games
64
- [Features.Registrations]: Services.Games
65
-
66
- [Features.City]: Services.Locations
67
- [Features.Cities]: Services.Locations
68
-
69
- [Features.Location]: Services.Locations
70
- [Features.Locations]: Services.Locations
71
- }
72
-
73
- export let FeatureOrigins: Map<
74
- keyof typeof Services,
75
- Map<
76
- keyof typeof Networks,
77
- (pathname: string, options: URLOptions) => URL
78
- >
79
- >
80
-
81
- type Features = typeof Features
82
-
83
- type FeaturesUnion = Features[keyof Features]
@@ -1,38 +0,0 @@
1
- import { Features } from './features.d.ts'
2
-
3
- export let FeaturePatterns: {
4
- /**
5
- * Users
6
- */
7
- [Features.Checkin]: InstanceType<typeof URLPattern>
8
-
9
- [Features.User]: InstanceType<typeof URLPattern>
10
-
11
- [Features.Users]: InstanceType<typeof URLPattern>
12
-
13
- /**
14
- * Games
15
- */
16
- [Features.Theme]: InstanceType<typeof URLPattern>
17
-
18
- [Features.Themes]: InstanceType<typeof URLPattern>
19
-
20
- [Features.Game]: InstanceType<typeof URLPattern>
21
-
22
- [Features.Games]: InstanceType<typeof URLPattern>
23
-
24
- [Features.Registration]: InstanceType<typeof URLPattern>
25
-
26
- [Features.Registrations]: InstanceType<typeof URLPattern>
27
-
28
- /**
29
- * Locations
30
- */
31
- [Features.City]: InstanceType<typeof URLPattern>
32
-
33
- [Features.Cities]: InstanceType<typeof URLPattern>
34
-
35
- [Features.Location]: InstanceType<typeof URLPattern>
36
-
37
- [Features.Locations]: InstanceType<typeof URLPattern>
38
- }
@@ -1,66 +0,0 @@
1
- import 'urlpattern-polyfill'
2
-
3
- import { Features } from './features.js'
4
-
5
- export let FeaturePatterns = {
6
- /**
7
- * Users
8
- */
9
- [Features.Checkin]: new URLPattern({
10
- pathname: '/checkin',
11
- }),
12
-
13
- [Features.User]: new URLPattern({
14
- pathname: '/user/:user?',
15
- }),
16
-
17
- [Features.Users]: new URLPattern({
18
- pathname: '/users',
19
- }),
20
-
21
- /**
22
- * Games
23
- */
24
- [Features.Theme]: new URLPattern({
25
- pathname: '/theme/:theme?',
26
- }),
27
-
28
- [Features.Themes]: new URLPattern({
29
- pathname: '/themes',
30
- }),
31
-
32
- [Features.Game]: new URLPattern({
33
- pathname: '/game/:game?',
34
- }),
35
-
36
- [Features.Games]: new URLPattern({
37
- pathname: '/games',
38
- }),
39
-
40
- [Features.Registration]: new URLPattern({
41
- pathname: '/registration/:registration?',
42
- }),
43
-
44
- [Features.Registrations]: new URLPattern({
45
- pathname: '/registrations',
46
- }),
47
-
48
- /**
49
- * Locations
50
- */
51
- [Features.City]: new URLPattern({
52
- pathname: '/city/:city?',
53
- }),
54
-
55
- [Features.Cities]: new URLPattern({
56
- pathname: '/cities',
57
- }),
58
-
59
- [Features.Location]: new URLPattern({
60
- pathname: '/location/:location?',
61
- }),
62
-
63
- [Features.Locations]: new URLPattern({
64
- pathname: '/locations',
65
- }),
66
- }
@@ -1,5 +0,0 @@
1
- export let Services: {
2
- Games: 'Games'
3
- Locations: 'Locations'
4
- Users: 'Users'
5
- }
@@ -1,5 +0,0 @@
1
- export let Services = /** @type {const} */ ({
2
- Games: 'Games',
3
- Locations: 'Locations',
4
- Users: 'Users',
5
- })