Add swagger, update TypeScript

This commit is contained in:
2024-12-05 00:45:37 +01:00
parent d75ecf61b6
commit 80c574dfd6
4 changed files with 87 additions and 20 deletions

View File

@@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"@elysiajs/cors": "catalog:", "@elysiajs/cors": "catalog:",
"@elysiajs/swagger": "catalog:",
"common": "workspace:^", "common": "workspace:^",
"elysia": "catalog:", "elysia": "catalog:",
"kysely": "catalog:", "kysely": "catalog:",

View File

@@ -1,4 +1,5 @@
import cors from "@elysiajs/cors"; import cors from "@elysiajs/cors";
import { swagger } from "@elysiajs/swagger";
import { AttachmentId, PieceId, RequestId, SessionId, Sha256 } from "common"; import { AttachmentId, PieceId, RequestId, SessionId, Sha256 } from "common";
import * as Function from "common/Function"; import * as Function from "common/Function";
import { Elysia, error, form, t } from "elysia"; import { Elysia, error, form, t } from "elysia";
@@ -11,6 +12,8 @@ const tbranded = <T>() => t.Transform(t.String())
const app = new Elysia() const app = new Elysia()
.use(swagger())
.use(cors({ origin: "localhost:5173" })) .use(cors({ origin: "localhost:5173" }))
.decorate("db", await initDatabase()) .decorate("db", await initDatabase())

100
pnpm-lock.yaml generated
View File

@@ -12,6 +12,9 @@ catalogs:
'@elysiajs/eden': '@elysiajs/eden':
specifier: ^1.1.3 specifier: ^1.1.3
version: 1.1.3 version: 1.1.3
'@elysiajs/swagger':
specifier: ^1.1.6
version: 1.1.6
'@radix-ui/react-dialog': '@radix-ui/react-dialog':
specifier: ^1.1.2 specifier: ^1.1.2
version: 1.1.2 version: 1.1.2
@@ -82,8 +85,8 @@ catalogs:
specifier: ^1.0.7 specifier: ^1.0.7
version: 1.0.7 version: 1.0.7
typescript: typescript:
specifier: ^5.6.3 specifier: ^5.7.2
version: 5.6.3 version: 5.7.2
vite: vite:
specifier: ^5.4.11 specifier: ^5.4.11
version: 5.4.11 version: 5.4.11
@@ -94,19 +97,22 @@ importers:
devDependencies: devDependencies:
typescript: typescript:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.6.3 version: 5.7.2
packages/backend: packages/backend:
dependencies: dependencies:
'@elysiajs/cors': '@elysiajs/cors':
specifier: 'catalog:' specifier: 'catalog:'
version: 1.1.1(elysia@1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3)) version: 1.1.1(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))
'@elysiajs/swagger':
specifier: 'catalog:'
version: 1.1.6(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))
common: common:
specifier: workspace:^ specifier: workspace:^
version: link:../common version: link:../common
elysia: elysia:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3) version: 1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2)
kysely: kysely:
specifier: 'catalog:' specifier: 'catalog:'
version: 0.27.4 version: 0.27.4
@@ -119,19 +125,19 @@ importers:
version: 1.1.13 version: 1.1.13
typescript: typescript:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.6.3 version: 5.7.2
packages/common: packages/common:
devDependencies: devDependencies:
typescript: typescript:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.6.3 version: 5.7.2
packages/frontend: packages/frontend:
dependencies: dependencies:
'@elysiajs/eden': '@elysiajs/eden':
specifier: 'catalog:' specifier: 'catalog:'
version: 1.1.3(elysia@1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3)) version: 1.1.3(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))
'@radix-ui/react-dialog': '@radix-ui/react-dialog':
specifier: 'catalog:' specifier: 'catalog:'
version: 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) version: 1.1.2(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -192,7 +198,7 @@ importers:
version: 0.7.1 version: 0.7.1
elysia: elysia:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3) version: 1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2)
postcss: postcss:
specifier: 'catalog:' specifier: 'catalog:'
version: 8.4.49 version: 8.4.49
@@ -201,7 +207,7 @@ importers:
version: 3.4.15 version: 3.4.15
typescript: typescript:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.6.3 version: 5.7.2
vite: vite:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.4.11(@types/node@20.12.14) version: 5.4.11(@types/node@20.12.14)
@@ -305,6 +311,11 @@ packages:
peerDependencies: peerDependencies:
elysia: '>= 1.1.0' elysia: '>= 1.1.0'
'@elysiajs/swagger@1.1.6':
resolution: {integrity: sha512-B1airTG3eh6eFgFxGS2UtsdZ7Xc2vrn3YKIFLFai9YeZVROSHmi3ZaXZvGAn3DnkXHT6I+qx960xnrqoNiopUw==}
peerDependencies:
elysia: '>= 1.1.0'
'@esbuild/aix-ppc64@0.21.5': '@esbuild/aix-ppc64@0.21.5':
resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
@@ -894,6 +905,14 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@scalar/openapi-types@0.1.1':
resolution: {integrity: sha512-NMy3QNk6ytcCoPUGJH0t4NNr36OWXgZhA3ormr3TvhX1NDgoF95wFyodGVH8xiHeUyn2/FxtETm8UBLbB5xEmg==}
engines: {node: '>=18'}
'@scalar/types@0.0.12':
resolution: {integrity: sha512-XYZ36lSEx87i4gDqopQlGCOkdIITHHEvgkuJFrXFATQs9zHARop0PN0g4RZYWj+ZpCUclOcaOjbCt8JGe22mnQ==}
engines: {node: '>=18'}
'@sinclair/typebox@0.33.7': '@sinclair/typebox@0.33.7':
resolution: {integrity: sha512-et38XPs6GMoB6XugH+Spp/HRv5gHYffw7rXC3caen/dIKC7Q6sqs6eEH9Yd9UKziUkOQdrLr9OXUULAc+pRMng==} resolution: {integrity: sha512-et38XPs6GMoB6XugH+Spp/HRv5gHYffw7rXC3caen/dIKC7Q6sqs6eEH9Yd9UKziUkOQdrLr9OXUULAc+pRMng==}
@@ -937,6 +956,9 @@ packages:
'@types/ws@8.5.12': '@types/ws@8.5.12':
resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==}
'@unhead/schema@1.11.13':
resolution: {integrity: sha512-fIpQx6GCpl99l4qJXsPqkXxO7suMccuLADbhaMSkeXnVEi4ZIle+l+Ri0z+GHAEpJj17FMaQdO5n9FMSOMUxkw==}
'@vitejs/plugin-react@4.3.3': '@vitejs/plugin-react@4.3.3':
resolution: {integrity: sha512-NooDe9GpHGqNns1i8XDERg0Vsg5SSYRhRxxyTGogUdkdNt47jal+fbuYi+Yfq6pzRCKXyoPcWisfxE6RIM3GKA==} resolution: {integrity: sha512-NooDe9GpHGqNns1i8XDERg0Vsg5SSYRhRxxyTGogUdkdNt47jal+fbuYi+Yfq6pzRCKXyoPcWisfxE6RIM3GKA==}
engines: {node: ^14.18.0 || >=16.0.0} engines: {node: ^14.18.0 || >=16.0.0}
@@ -1320,6 +1342,9 @@ packages:
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
hookable@5.5.3:
resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}
http-cache-semantics@4.1.1: http-cache-semantics@4.1.1:
resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==}
@@ -1617,6 +1642,9 @@ packages:
once@1.4.0: once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
openapi-types@12.1.3:
resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}
opensheetmusicdisplay@1.8.9: opensheetmusicdisplay@1.8.9:
resolution: {integrity: sha512-j5pDBln24iA1kbxe+BEZBkhMCg0A7lnBPWWpaKGLi1RoP5j6MOBQTh+jBkG9yytDOfbafwQ+PrnYd4AdCnLASA==} resolution: {integrity: sha512-j5pDBln24iA1kbxe+BEZBkhMCg0A7lnBPWWpaKGLi1RoP5j6MOBQTh+jBkG9yytDOfbafwQ+PrnYd4AdCnLASA==}
@@ -1645,6 +1673,9 @@ packages:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'} engines: {node: '>=16 || 14 >=14.18'}
pathe@1.1.2:
resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==}
picocolors@1.0.1: picocolors@1.0.1:
resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}
@@ -1991,8 +2022,8 @@ packages:
typescript-collections@1.3.3: typescript-collections@1.3.3:
resolution: {integrity: sha512-7sI4e/bZijOzyURng88oOFZCISQPTHozfE2sUu5AviFYk5QV7fYGb6YiDl+vKjF/pICA354JImBImL9XJWUvdQ==} resolution: {integrity: sha512-7sI4e/bZijOzyURng88oOFZCISQPTHozfE2sUu5AviFYk5QV7fYGb6YiDl+vKjF/pICA354JImBImL9XJWUvdQ==}
typescript@5.6.3: typescript@5.7.2:
resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==}
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
@@ -2110,6 +2141,9 @@ packages:
engines: {node: '>= 14'} engines: {node: '>= 14'}
hasBin: true hasBin: true
zhead@2.2.4:
resolution: {integrity: sha512-8F0OI5dpWIA5IGG5NHUg9staDwz/ZPxZtvGVf01j7vHqSyZ0raHY+78atOVxRqb73AotX22uV1pXt3gYSstGag==}
snapshots: snapshots:
'@alloc/quick-lru@5.2.0': {} '@alloc/quick-lru@5.2.0': {}
@@ -2229,13 +2263,20 @@ snapshots:
'@babel/helper-string-parser': 7.25.9 '@babel/helper-string-parser': 7.25.9
'@babel/helper-validator-identifier': 7.25.9 '@babel/helper-validator-identifier': 7.25.9
'@elysiajs/cors@1.1.1(elysia@1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3))': '@elysiajs/cors@1.1.1(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))':
dependencies: dependencies:
elysia: 1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3) elysia: 1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2)
'@elysiajs/eden@1.1.3(elysia@1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3))': '@elysiajs/eden@1.1.3(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))':
dependencies: dependencies:
elysia: 1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3) elysia: 1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2)
'@elysiajs/swagger@1.1.6(elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2))':
dependencies:
'@scalar/types': 0.0.12
elysia: 1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2)
openapi-types: 12.1.3
pathe: 1.1.2
'@esbuild/aix-ppc64@0.21.5': '@esbuild/aix-ppc64@0.21.5':
optional: true optional: true
@@ -2704,6 +2745,13 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.27.2': '@rollup/rollup-win32-x64-msvc@4.27.2':
optional: true optional: true
'@scalar/openapi-types@0.1.1': {}
'@scalar/types@0.0.12':
dependencies:
'@scalar/openapi-types': 0.1.1
'@unhead/schema': 1.11.13
'@sinclair/typebox@0.33.7': {} '@sinclair/typebox@0.33.7': {}
'@tootallnate/once@2.0.0': '@tootallnate/once@2.0.0':
@@ -2757,6 +2805,11 @@ snapshots:
dependencies: dependencies:
'@types/node': 20.12.14 '@types/node': 20.12.14
'@unhead/schema@1.11.13':
dependencies:
hookable: 5.5.3
zhead: 2.2.4
'@vitejs/plugin-react@4.3.3(vite@5.4.11(@types/node@20.12.14))': '@vitejs/plugin-react@4.3.3(vite@5.4.11(@types/node@20.12.14))':
dependencies: dependencies:
'@babel/core': 7.26.0 '@babel/core': 7.26.0
@@ -3012,13 +3065,14 @@ snapshots:
electron-to-chromium@1.5.62: {} electron-to-chromium@1.5.62: {}
elysia@1.1.25(@sinclair/typebox@0.33.7)(typescript@5.6.3): elysia@1.1.25(@sinclair/typebox@0.33.7)(openapi-types@12.1.3)(typescript@5.7.2):
dependencies: dependencies:
'@sinclair/typebox': 0.33.7 '@sinclair/typebox': 0.33.7
cookie: 1.0.1 cookie: 1.0.1
fast-decode-uri-component: 1.0.1 fast-decode-uri-component: 1.0.1
optionalDependencies: optionalDependencies:
typescript: 5.6.3 openapi-types: 12.1.3
typescript: 5.7.2
emoji-regex@8.0.0: {} emoji-regex@8.0.0: {}
@@ -3206,6 +3260,8 @@ snapshots:
dependencies: dependencies:
function-bind: 1.1.2 function-bind: 1.1.2
hookable@5.5.3: {}
http-cache-semantics@4.1.1: http-cache-semantics@4.1.1:
optional: true optional: true
@@ -3530,6 +3586,8 @@ snapshots:
wrappy: 1.0.2 wrappy: 1.0.2
optional: true optional: true
openapi-types@12.1.3: {}
opensheetmusicdisplay@1.8.9: opensheetmusicdisplay@1.8.9:
dependencies: dependencies:
'@types/vexflow': 1.2.42 '@types/vexflow': 1.2.42
@@ -3564,6 +3622,8 @@ snapshots:
lru-cache: 10.4.3 lru-cache: 10.4.3
minipass: 7.1.2 minipass: 7.1.2
pathe@1.1.2: {}
picocolors@1.0.1: {} picocolors@1.0.1: {}
picocolors@1.1.1: {} picocolors@1.1.1: {}
@@ -3990,7 +4050,7 @@ snapshots:
typescript-collections@1.3.3: {} typescript-collections@1.3.3: {}
typescript@5.6.3: {} typescript@5.7.2: {}
undici-types@5.26.5: {} undici-types@5.26.5: {}
@@ -4077,3 +4137,5 @@ snapshots:
optional: true optional: true
yaml@2.6.0: {} yaml@2.6.0: {}
zhead@2.2.4: {}

View File

@@ -4,6 +4,7 @@ packages:
catalog: catalog:
'@elysiajs/cors': '^1.1.1' '@elysiajs/cors': '^1.1.1'
'@elysiajs/eden': '^1.1.3' '@elysiajs/eden': '^1.1.3'
'@elysiajs/swagger': '^1.1.6'
'@radix-ui/react-dialog': '^1.1.2' '@radix-ui/react-dialog': '^1.1.2'
'@radix-ui/react-dropdown-menu': '^2.1.2' '@radix-ui/react-dropdown-menu': '^2.1.2'
'@radix-ui/react-label': '^2.1.0' '@radix-ui/react-label': '^2.1.0'
@@ -27,5 +28,5 @@ catalog:
tailwind-merge: '^2.5.5' tailwind-merge: '^2.5.5'
tailwindcss: '^3.4.15' tailwindcss: '^3.4.15'
tailwindcss-animate: '^1.0.7' tailwindcss-animate: '^1.0.7'
typescript: '^5.6.3' typescript: '^5.7.2'
vite: '^5.4.11' vite: '^5.4.11'