@shakerquiz/utilities 2.0.0 → 4.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 (125) hide show
  1. package/.github/workflows/publish.yml +31 -0
  2. package/dprint.json +1 -4
  3. package/package.json +7 -13
  4. package/scripts/route-cardinality.js +23 -0
  5. package/scripts/route-parameter.js +29 -0
  6. package/scripts/route-pathname.js +37 -0
  7. package/scripts/route-relation.js +26 -0
  8. package/scripts/route-service.js +25 -0
  9. package/scripts/templates/route-cardinality.js +5 -0
  10. package/scripts/templates/route-parameter.js +5 -0
  11. package/scripts/templates/route-pathname.js +7 -0
  12. package/scripts/templates/route-relation.js +5 -0
  13. package/scripts/templates/route-service.js +7 -0
  14. package/source/entities/blend.js +5 -0
  15. package/source/entities/cardinality.js +4 -0
  16. package/source/entities/category.js +4 -0
  17. package/source/entities/city-affilation.js +10 -0
  18. package/source/entities/city-chatapp-version.js +9 -0
  19. package/source/{enumerations/misc → entities}/constants.js +1 -1
  20. package/source/entities/display.js +4 -0
  21. package/source/entities/game-status.js +98 -0
  22. package/source/entities/gender.js +13 -0
  23. package/source/entities/icon.js +654 -0
  24. package/source/entities/key.js +41 -0
  25. package/source/entities/method.js +22 -0
  26. package/source/entities/mode.js +9 -0
  27. package/source/entities/network.js +9 -0
  28. package/source/entities/numerosity.js +5 -0
  29. package/source/entities/pattern.js +7 -0
  30. package/source/entities/phase.js +15 -0
  31. package/source/entities/quantifier.js +41 -0
  32. package/source/entities/registration-attribute.js +61 -0
  33. package/source/entities/registration-channel.js +11 -0
  34. package/source/entities/registration-lineup.js +14 -0
  35. package/source/entities/registration-mailing.js +20 -0
  36. package/source/entities/registration-status.js +19 -0
  37. package/source/entities/role.js +16 -0
  38. package/source/entities/route-cardinality.js +149 -0
  39. package/source/entities/route-parameter.js +149 -0
  40. package/source/entities/route-pathname.js +223 -0
  41. package/source/entities/route-relation.js +149 -0
  42. package/source/entities/route-service.js +179 -0
  43. package/source/entities/route.js +82 -0
  44. package/source/entities/runtime.js +6 -0
  45. package/source/entities/segment.js +255 -0
  46. package/source/entities/service-runtime.js +22 -0
  47. package/source/entities/service.js +22 -0
  48. package/source/entities/theme-status.js +9 -0
  49. package/source/entities/venue-audience.js +9 -0
  50. package/source/entities/venue-status.js +9 -0
  51. package/source/helpers/access.js +161 -0
  52. package/source/helpers/hydrate-route-pathname.js +29 -0
  53. package/source/helpers/tag.js +35 -0
  54. package/source/index.js +40 -24
  55. package/source/enumerations/core/features.d.ts +0 -40
  56. package/source/enumerations/core/features.js +0 -205
  57. package/source/enumerations/core/kinds.d.ts +0 -1
  58. package/source/enumerations/core/kinds.js +0 -4
  59. package/source/enumerations/core/methods.d.ts +0 -8
  60. package/source/enumerations/core/methods.js +0 -25
  61. package/source/enumerations/core/networks.d.ts +0 -1
  62. package/source/enumerations/core/networks.js +0 -4
  63. package/source/enumerations/core/runtimes.d.ts +0 -1
  64. package/source/enumerations/core/runtimes.js +0 -4
  65. package/source/enumerations/core/scopes.d.ts +0 -5
  66. package/source/enumerations/core/scopes.js +0 -27
  67. package/source/enumerations/entities/city-affilations.d.ts +0 -1
  68. package/source/enumerations/entities/city-affilations.js +0 -4
  69. package/source/enumerations/entities/game-statuses.d.ts +0 -1
  70. package/source/enumerations/entities/game-statuses.js +0 -11
  71. package/source/enumerations/entities/registration-attributes.d.ts +0 -2
  72. package/source/enumerations/entities/registration-attributes.js +0 -57
  73. package/source/enumerations/entities/registration-channels.d.ts +0 -1
  74. package/source/enumerations/entities/registration-channels.js +0 -5
  75. package/source/enumerations/entities/registration-lineups.d.ts +0 -5
  76. package/source/enumerations/entities/registration-lineups.js +0 -43
  77. package/source/enumerations/entities/registration-mailings.d.ts +0 -1
  78. package/source/enumerations/entities/registration-mailings.js +0 -6
  79. package/source/enumerations/entities/registration-statuses.d.ts +0 -5
  80. package/source/enumerations/entities/registration-statuses.js +0 -54
  81. package/source/enumerations/entities/roles.d.ts +0 -1
  82. package/source/enumerations/entities/roles.js +0 -5
  83. package/source/enumerations/entities/venue-statuses.d.ts +0 -1
  84. package/source/enumerations/entities/venue-statuses.js +0 -4
  85. package/source/enumerations/misc/constants.d.ts +0 -3
  86. package/source/enumerations/misc/cookies.d.ts +0 -5
  87. package/source/enumerations/misc/cookies.js +0 -5
  88. package/source/enumerations/misc/icons.d.ts +0 -1
  89. package/source/enumerations/misc/icons.js +0 -326
  90. package/source/enumerations/misc/phases.d.ts +0 -1
  91. package/source/enumerations/misc/phases.js +0 -7
  92. package/source/enumerations/misc/regexps.d.ts +0 -5
  93. package/source/enumerations/misc/regexps.js +0 -6
  94. package/source/functions/tag.d.ts +0 -1
  95. package/source/functions/tag.js +0 -5
  96. package/source/index.d.ts +0 -27
  97. package/source/misc.d.ts +0 -79
  98. package/source/schemas/PATCH/Game/admin/schema.json +0 -34
  99. package/source/schemas/PATCH/Game/default/schema.json +0 -6
  100. package/source/schemas/PATCH/Game/organizer/schema.json +0 -34
  101. package/source/schemas/PATCH/Registration/admin/schema.json +0 -6
  102. package/source/schemas/PATCH/Registration/default/schema.json +0 -104
  103. package/source/schemas/PATCH/Registration/organizer/schema.json +0 -43
  104. package/source/schemas/PATCH/Venue/admin/schema.json +0 -40
  105. package/source/schemas/PATCH/Venue/default/schema.json +0 -6
  106. package/source/schemas/PATCH/Venue/organizer/schema.json +0 -43
  107. package/source/schemas/POST/Game/admin/schema.json +0 -27
  108. package/source/schemas/POST/Game/default/schema.json +0 -27
  109. package/source/schemas/POST/Game/organizer/schema.json +0 -27
  110. package/source/schemas/POST/Mailing/admin/schema.json +0 -6
  111. package/source/schemas/POST/Mailing/default/schema.json +0 -6
  112. package/source/schemas/POST/Mailing/organizer/schema.json +0 -12
  113. package/source/schemas/POST/Registration/admin/schema.json +0 -6
  114. package/source/schemas/POST/Registration/default/schema.json +0 -125
  115. package/source/schemas/POST/Registration/organizer/schema.json +0 -6
  116. package/source/schemas/POST/Venue/admin/schema.json +0 -6
  117. package/source/schemas/POST/Venue/default/schema.json +0 -6
  118. package/source/schemas/POST/Venue/organizer/schema.json +0 -49
  119. package/source/schemas/game.schema.json +0 -93
  120. package/source/schemas/registration.schema.json +0 -123
  121. package/source/schemas/theme.schema.json +0 -48
  122. package/source/schemas/venue.schema.json +0 -56
  123. package/source/scope.d.ts +0 -874
  124. package/source/server.d.ts +0 -5
  125. package/source/tables.d.ts +0 -187
@@ -0,0 +1,31 @@
1
+ name: Publish
2
+
3
+ on:
4
+ pull_request:
5
+ types: [ closed ]
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ id-token: write
11
+ contents: write
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+ if: github.event.pull_request.merged == true
17
+ steps:
18
+ - uses: actions/checkout@v5
19
+ with:
20
+ fetch-depth: 0
21
+ - uses: actions/setup-node@v6
22
+ with:
23
+ node-version: 24
24
+ - uses: oven-sh/setup-bun@v2
25
+ - run: npm install -g npm@latest
26
+ - run: git config user.name "github-actions[bot]"
27
+ - run: git config user.email "github-actions[bot]@users.noreply.github.com"
28
+ - run: npm version patch
29
+ - run: npm ci
30
+ - run: npm publish
31
+ - run: git push --follow-tags
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": "4.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
- "types": "./source/index.d.ts",
13
- "default": "./source/index.js"
14
- },
15
- "./schemas/*.json": "./source/schemas/*.json"
16
- },
17
- "dependencies": {
18
- "urlpattern-polyfill": "10.1.0"
12
+ "default": "./source/index.js"
19
13
  },
20
- "devDependencies": {
21
- "typescript": "5.8.3"
14
+ "scripts": {
15
+ "prepublishOnly": "bun ./scripts/route-cardinality.js && bun ./scripts/route-parameter.js && bun ./scripts/route-pathname.js && bun ./scripts/route-relation.js && bun ./scripts/route-service.js"
22
16
  }
23
17
  }
@@ -0,0 +1,23 @@
1
+ import template from './templates/route-cardinality.js' with { type: 'text' }
2
+
3
+ import { Routes } from '../source/entities/route.js'
4
+ import { Segment } from '../source/entities/segment.js'
5
+
6
+ let cardinalities = Routes.map(route => {
7
+ const cardinalities = route.split('/').map(key => Segment[key].cardinality)
8
+
9
+ return cardinalities.length > 1
10
+ ? cardinalities.at(0) + '/' + cardinalities.at(-1)
11
+ : cardinalities.at(0)
12
+ })
13
+
14
+ let RouteCardinalities = JSON.stringify(cardinalities, undefined, 2)
15
+
16
+ let RouteCardinality = JSON.stringify(Routes.reduce((o, x, i) => (o[x] = cardinalities[i], o), {}), null, 2)
17
+
18
+ Bun.write(
19
+ './source/entities/route-cardinality.js',
20
+ template
21
+ .replace('/* RouteCardinalities */', RouteCardinalities)
22
+ .replace('/* RouteCardinality */', RouteCardinality),
23
+ )
@@ -0,0 +1,29 @@
1
+ import template from './templates/route-parameter.js' with { type: 'text' }
2
+
3
+ import { Routes } from '../source/entities/route.js'
4
+ import { Segment } from '../source/entities/segment.js'
5
+
6
+ let pathnames = Routes.map(route =>
7
+ route
8
+ .split('/')
9
+ .map(key => Segment[key].cardinality === '1' ? key + '/:' + key : key)
10
+ .join('/')
11
+ )
12
+
13
+ let parameters = pathnames.map(pathname =>
14
+ pathname
15
+ .split('/')
16
+ .filter(key => key.includes(':'))
17
+ .join('/')
18
+ )
19
+
20
+ let RouteParameters = JSON.stringify(parameters, undefined, 2)
21
+
22
+ let RouteParameter = JSON.stringify(Routes.reduce((o, x, i) => (o[x] = parameters[i], o), {}), null, 2)
23
+
24
+ Bun.write(
25
+ './source/entities/route-parameter.js',
26
+ template
27
+ .replace('/* RouteParameters */', RouteParameters)
28
+ .replace('/* RouteParameter */', RouteParameter),
29
+ )
@@ -0,0 +1,37 @@
1
+ import template from './templates/route-pathname.js' with { type: 'text' }
2
+
3
+ import { Routes } from '../source/entities/route.js'
4
+ import { Segment } from '../source/entities/segment.js'
5
+
6
+ let pathnames = Routes.map(route =>
7
+ route
8
+ .split('/')
9
+ .map(key => Segment[key].cardinality === '1' ? key + '/:' + key : key)
10
+ .join('/')
11
+ )
12
+
13
+ let RoutePathnames = JSON.stringify(
14
+ pathnames,
15
+ undefined,
16
+ 2,
17
+ )
18
+
19
+ let RoutePathname = JSON.stringify(
20
+ Routes.reduce((o, x, i) => (o[x] = pathnames[i], o), {}),
21
+ null,
22
+ 2,
23
+ )
24
+
25
+ let PathnameRoute = JSON.stringify(
26
+ pathnames.reduce((o, x, i) => (o[x] = Routes[i], o), {}),
27
+ null,
28
+ 2,
29
+ )
30
+
31
+ Bun.write(
32
+ './source/entities/route-pathname.js',
33
+ template
34
+ .replace('/* RoutePathnames */', RoutePathnames)
35
+ .replace('/* RoutePathname */', RoutePathname)
36
+ .replace('/* PathnameRoute */', PathnameRoute),
37
+ )
@@ -0,0 +1,26 @@
1
+ import template from './templates/route-relation.js' with { type: 'text' }
2
+
3
+ import { Routes } from '../source/entities/route.js'
4
+ import { Segment } from '../source/entities/segment.js'
5
+
6
+ let relations = Routes.map(route =>
7
+ route
8
+ .split('/')
9
+ .map((key, index) =>
10
+ Segment[key].cardinality === '1' || index > 0
11
+ ? key
12
+ : Segment[key].relation ?? key
13
+ )
14
+ .join('/')
15
+ )
16
+
17
+ let RouteRelations = JSON.stringify(relations, undefined, 2)
18
+
19
+ let RouteRelation = JSON.stringify(Routes.reduce((o, x, i) => (o[x] = relations[i], o), {}), null, 2)
20
+
21
+ Bun.write(
22
+ './source/entities/route-relation.js',
23
+ template
24
+ .replace('/* RouteRelations */', RouteRelations)
25
+ .replace('/* RouteRelation */', RouteRelation),
26
+ )
@@ -0,0 +1,25 @@
1
+ import template from './templates/route-service.js' with { type: 'text' }
2
+
3
+ import { Routes } from '../source/entities/route.js'
4
+ import { Segment } from '../source/entities/segment.js'
5
+
6
+ let config = [undefined, 2]
7
+
8
+ let services = Routes.map(route => Segment[route.split('/').at(0)].service)
9
+
10
+ let RouteServices = services.filter((x, i, a) => a.indexOf(x) === i)
11
+
12
+ let RouteService = Routes.reduce((o, x, i) => (o[x] = services[i], o), {})
13
+
14
+ let ServiceRoutes = Object
15
+ .entries(Object.groupBy(Object.entries(RouteService), ([, service]) => service))
16
+ .map(([service, pairs]) => [service, pairs.map(([route]) => route)])
17
+ .reduce((o, [s, r]) => (o[s] = r, o), {})
18
+
19
+ Bun.write(
20
+ './source/entities/route-service.js',
21
+ template
22
+ .replace('/* RouteServices */', JSON.stringify(RouteServices, ...config))
23
+ .replace('/* RouteService */', JSON.stringify(RouteService, ...config))
24
+ .replace('/* ServiceRoutes */', JSON.stringify(ServiceRoutes, ...config)),
25
+ )
@@ -0,0 +1,5 @@
1
+ /* --- AUTOGENERATED --- */
2
+
3
+ export const RouteCardinalities = Object.freeze( /** @type {const} */ (/* RouteCardinalities */))
4
+
5
+ export const RouteCardinality = Object.freeze(/** @type {const} */ (/* RouteCardinality */))
@@ -0,0 +1,5 @@
1
+ /* --- AUTOGENERATED --- */
2
+
3
+ export const RouteParameters = Object.freeze( /** @type {const} */ (/* RouteParameters */))
4
+
5
+ export const RouteParameter = Object.freeze(/** @type {const} */ (/* RouteParameter */))
@@ -0,0 +1,7 @@
1
+ /* --- AUTOGENERATED --- */
2
+
3
+ export const RoutePathnames = Object.freeze( /** @type {const} */ (/* RoutePathnames */))
4
+
5
+ export const RoutePathname = Object.freeze(/** @type {const} */ (/* RoutePathname */))
6
+
7
+ export const PathnameRoute = Object.freeze(/** @type {const} */ (/* PathnameRoute */))
@@ -0,0 +1,5 @@
1
+ /* --- AUTOGENERATED --- */
2
+
3
+ export const RouteRelations = Object.freeze( /** @type {const} */ (/* RouteRelations */))
4
+
5
+ export const RouteRelation = Object.freeze(/** @type {const} */ (/* RouteRelation */))
@@ -0,0 +1,7 @@
1
+ /* --- AUTOGENERATED --- */
2
+
3
+ export const RouteServices = Object.freeze( /** @type {const} */ (/* RouteServices */))
4
+
5
+ export const RouteService = Object.freeze(/** @type {const} */ (/* RouteService */))
6
+
7
+ export const ServiceRoutes = Object.freeze(/** @type {const} */ (/* ServiceRoutes */))
@@ -0,0 +1,5 @@
1
+ export const Blend = Object.freeze({
2
+ 'Domain': 'Domain',
3
+ 'System': 'System',
4
+ 'Indifferent': 'Indifferent',
5
+ })
@@ -0,0 +1,4 @@
1
+ export const Cardinality = Object.freeze({
2
+ '1': '1',
3
+ 'n': 'n',
4
+ })
@@ -0,0 +1,4 @@
1
+ export const Category = Object.freeze({
2
+ 'Active': 'Active',
3
+ 'Rest': 'Rest',
4
+ })
@@ -0,0 +1,10 @@
1
+ export const CityAffilation = Object.freeze({
2
+ 'Branch': 'Branch',
3
+ 'Franchise': 'Franchise',
4
+ })
5
+
6
+ /** @satisfies {Array<keyof typeof CityAffilation>} */
7
+ export const CityAffilations = Object.freeze([
8
+ 'Branch',
9
+ 'Franchise',
10
+ ])
@@ -0,0 +1,9 @@
1
+ export const CityChatappVersion = Object.freeze({
2
+ 'Latest': 'Latest',
3
+ 'Legacy': 'Legacy',
4
+ })
5
+
6
+ export const CityChatappVersions = Object.freeze([
7
+ 'Latest',
8
+ 'Legacy',
9
+ ])
@@ -1,4 +1,4 @@
1
- export var Constants = /** @type {const} */ ({
1
+ export const Constants = Object.freeze({
2
2
  /**
3
3
  * @see https://www.rfc-editor.org/rfc/rfc9562.html#name-nil-uuid
4
4
  */
@@ -0,0 +1,4 @@
1
+ export const Display = Object.freeze({
2
+ 'Tag': 'Tag',
3
+ 'Chip': 'Chip',
4
+ })
@@ -0,0 +1,98 @@
1
+ import { Category } from './category.js'
2
+ import { Mode } from './mode.js'
3
+ import { Role } from './role.js'
4
+
5
+ export const GameStatus = Object.freeze({
6
+ 'REJECTED': 'REJECTED',
7
+ 'MODERATION': 'MODERATION',
8
+ 'APPROVED': 'APPROVED',
9
+ 'CLOSED': 'CLOSED',
10
+ 'FORINVITES': 'FORINVITES',
11
+ 'PUBLISHED': 'PUBLISHED',
12
+ 'IS_RESERVE': 'IS_RESERVE',
13
+ 'FINISHED': 'FINISHED',
14
+ 'ARCHIVE': 'ARCHIVE',
15
+ })
16
+
17
+ export const GameStatuses = Object.freeze(Object.values(GameStatus))
18
+
19
+ export const RoleGameStatusGameStatuses = Object.freeze({
20
+ [Role['admin']]: Object.freeze({}),
21
+
22
+ [Role['organizer']]: Object.freeze({
23
+ 'APPROVED': Object.freeze([
24
+ 'APPROVED',
25
+ 'CLOSED',
26
+ 'FORINVITES',
27
+ 'PUBLISHED',
28
+ 'IS_RESERVE',
29
+ 'FINISHED',
30
+ 'ARCHIVE',
31
+ ]),
32
+
33
+ 'MODERATION': Object.freeze([
34
+ 'MODERATION',
35
+ ]),
36
+
37
+ 'REJECTED': Object.freeze([
38
+ 'REJECTED',
39
+ 'MODERATION',
40
+ ]),
41
+ }),
42
+
43
+ [Mode['Unknown']]: Object.freeze({}),
44
+ })
45
+
46
+ export const RoleGameStatuses = Object.freeze({
47
+ [Role['admin']]: Object.freeze([
48
+ 'APPROVED',
49
+ 'ARCHIVE',
50
+ 'CLOSED',
51
+ 'FINISHED',
52
+ 'FORINVITES',
53
+ 'IS_RESERVE',
54
+ 'MODERATION',
55
+ 'PUBLISHED',
56
+ 'REJECTED',
57
+ ]),
58
+
59
+ [Role['organizer']]: Object.freeze([
60
+ 'ARCHIVE',
61
+ 'CLOSED',
62
+ 'FINISHED',
63
+ 'FORINVITES',
64
+ 'IS_RESERVE',
65
+ 'PUBLISHED',
66
+ ]),
67
+
68
+ [Mode['Unknown']]: Object.freeze([]),
69
+ })
70
+
71
+ export const CategoryGameStatuses = Object.freeze({
72
+ [Category['Active']]: Object.freeze([
73
+ 'CLOSED',
74
+ 'FORINVITES',
75
+ 'IS_RESERVE',
76
+ 'PUBLISHED',
77
+ ]),
78
+
79
+ 'REJECTED': Object.freeze([
80
+ 'REJECTED',
81
+ ]),
82
+
83
+ 'MODERATION': Object.freeze([
84
+ 'MODERATION',
85
+ ]),
86
+
87
+ 'APPROVED': Object.freeze([
88
+ 'APPROVED',
89
+ ]),
90
+
91
+ 'FINISHED': Object.freeze([
92
+ 'FINISHED',
93
+ ]),
94
+
95
+ 'ARCHIVE': Object.freeze([
96
+ 'ARCHIVE',
97
+ ]),
98
+ })
@@ -0,0 +1,13 @@
1
+ export const Gender = Object.freeze({
2
+ 'Masculine': 'Masculine',
3
+ 'Feminine': 'Feminine',
4
+ 'Neuter': 'Neuter',
5
+ 'Indeterminate': 'Indeterminate',
6
+ })
7
+
8
+ export const Genders = Object.freeze([
9
+ 'Masculine',
10
+ 'Feminine',
11
+ 'Neuter',
12
+ 'Indeterminate',
13
+ ])