Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5b2ce1518 | ||
|
|
a4d6d64c6e | ||
|
|
72e563e5f2 | ||
|
|
393c52c214 |
No files matched your search
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.DS_Store
|
||||
@@ -0,0 +1,92 @@
|
||||
# effect-http-ws-cli (PoC)
|
||||
|
||||
Minimal PoC using Effect v4 beta with a single unified program:
|
||||
|
||||
- `effect/unstable/cli` as the app entrypoint
|
||||
- `effect/unstable/http` (`HttpServer`, `HttpRouter`, `HttpServerRequest`, `HttpServerResponse`) for server/runtime logic
|
||||
- `@effect/platform-node` to host the server on Node.js
|
||||
- HTTP + WebSocket message routing based on `effect/Schema` validation
|
||||
- static asset serving from local filesystem (`public/` by default)
|
||||
|
||||
The repo now uses a Bun workspace:
|
||||
|
||||
- `server/` contains the Effect HTTP + WebSocket backend
|
||||
- `web/` remains the Vite + React frontend package
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
bun install
|
||||
bun run web:build
|
||||
bun run start -- --port 8787 --host 127.0.0.1 --assets public --db todo.sqlite
|
||||
```
|
||||
|
||||
Then open `http://127.0.0.1:8787`.
|
||||
|
||||
## Frontend
|
||||
|
||||
React + Vite client lives in `web/` and is built into `public/` so it is served by the static router.
|
||||
|
||||
```bash
|
||||
bun run web:build
|
||||
```
|
||||
|
||||
For local development without building the frontend:
|
||||
|
||||
```bash
|
||||
bun run dev
|
||||
```
|
||||
|
||||
That starts the backend, starts Vite on `http://127.0.0.1:5173`, and redirects frontend page requests there. In dev, Vite proxies `/api/*`, `/ws`, and `/health` back to the backend server.
|
||||
|
||||
If you want to run the processes separately, start `bun run web:dev` and launch the backend with `FRONTEND_DEV_ORIGIN=http://127.0.0.1:5173`.
|
||||
|
||||
The UI now demonstrates a typed realtime todo workflow:
|
||||
|
||||
- load todo snapshot on page load (`listTodos`)
|
||||
- subscribe to todo updates (`subscribeTodos`)
|
||||
- mutate todos via RPC (`renameTodo`, `completeTodo`, `archiveTodo`)
|
||||
|
||||
### Config Sources
|
||||
|
||||
Config is resolved from both CLI flags and `effect/Config`:
|
||||
|
||||
- CLI flags: `--host`, `--port`, `--assets`, `--db`, `--request-logging`, `--frontend-dev-origin`
|
||||
- Env via `effect/Config`: `HOST`, `PORT`, `ASSETS_DIR`, `DB_FILENAME`, `REQUEST_LOGGING`, `FRONTEND_DEV_ORIGIN`
|
||||
|
||||
Precedence:
|
||||
|
||||
1. CLI flags
|
||||
2. `effect/Config` (environment)
|
||||
3. hard defaults (`127.0.0.1`, `8787`, `public`, `todo.sqlite`)
|
||||
|
||||
### SQL Persistence
|
||||
|
||||
- Uses `effect/unstable/sql` + `SqlSchema` for typed SQL request/result decoding.
|
||||
- Uses `@effect/sql-sqlite-node` as the Node runtime SQL client.
|
||||
- Database schema is managed by `effect/unstable/sql/Migrator` via `server/src/migrations.ts` with statically imported migration files.
|
||||
|
||||
## API
|
||||
|
||||
- `GET /health`
|
||||
- `POST /api/dispatch`
|
||||
- `GET /ws` (WebSocket RPC)
|
||||
- `GET *` (static files)
|
||||
|
||||
### Message schema
|
||||
|
||||
Incoming messages are validated with `Schema`:
|
||||
|
||||
- `{ "kind": "echo", "text": string }`
|
||||
- `{ "kind": "sum", "left": number, "right": number }`
|
||||
- `{ "kind": "time" }`
|
||||
|
||||
Both HTTP and WebSocket dispatch use the same schema-driven router.
|
||||
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
bun run test
|
||||
bun run test:web
|
||||
bun run lint
|
||||
```
|
||||
@@ -0,0 +1,638 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "effect-http-ws-cli",
|
||||
},
|
||||
"server": {
|
||||
"name": "@effect-http-ws-cli/server",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-node": "catalog:",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "^24.10.0",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
"web": {
|
||||
"name": "@effect-http-ws-cli/web",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@effect-http-ws-cli/server": "workspace:*",
|
||||
"@effect/atom-react": "catalog:",
|
||||
"@tanstack/react-router": "^1.166.2",
|
||||
"effect": "catalog:",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/router-plugin": "^1.166.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"@vitest/browser-playwright": "^4.0.18",
|
||||
"playwright": "^1.58.2",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^7.2.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5",
|
||||
},
|
||||
},
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/atom-react": "4.0.0-beta.27",
|
||||
"@effect/platform-node": "4.0.0-beta.27",
|
||||
"@effect/sql-sqlite-node": "4.0.0-beta.27",
|
||||
"@effect/vitest": "4.0.0-beta.27",
|
||||
"effect": "4.0.0-beta.27",
|
||||
"typescript": "6.0.0-beta",
|
||||
"vitest": "^4.0.18",
|
||||
},
|
||||
"packages": {
|
||||
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="],
|
||||
|
||||
"@babel/compat-data": ["@babel/[email protected]", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="],
|
||||
|
||||
"@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="],
|
||||
|
||||
"@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="],
|
||||
|
||||
"@babel/helper-compilation-targets": ["@babel/[email protected]", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="],
|
||||
|
||||
"@babel/helper-globals": ["@babel/[email protected]", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="],
|
||||
|
||||
"@babel/helper-module-imports": ["@babel/[email protected]", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="],
|
||||
|
||||
"@babel/helper-module-transforms": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="],
|
||||
|
||||
"@babel/helper-plugin-utils": ["@babel/[email protected]", "", {}, "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug=="],
|
||||
|
||||
"@babel/helper-string-parser": ["@babel/[email protected]", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="],
|
||||
|
||||
"@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="],
|
||||
|
||||
"@babel/helper-validator-option": ["@babel/[email protected]", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="],
|
||||
|
||||
"@babel/helpers": ["@babel/[email protected]", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw=="],
|
||||
|
||||
"@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="],
|
||||
|
||||
"@babel/plugin-syntax-jsx": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w=="],
|
||||
|
||||
"@babel/plugin-syntax-typescript": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A=="],
|
||||
|
||||
"@babel/plugin-transform-react-jsx-self": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw=="],
|
||||
|
||||
"@babel/plugin-transform-react-jsx-source": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw=="],
|
||||
|
||||
"@babel/template": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="],
|
||||
|
||||
"@babel/traverse": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="],
|
||||
|
||||
"@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
|
||||
|
||||
"@effect-http-ws-cli/server": ["@effect-http-ws-cli/server@workspace:server"],
|
||||
|
||||
"@effect-http-ws-cli/web": ["@effect-http-ws-cli/web@workspace:web"],
|
||||
|
||||
"@effect/atom-react": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.27", "react": "^19.2.4", "scheduler": "*" } }, "sha512-miq9lG74I9ypFdDTUIYWQR2OomxDweYM4Fv/h/Md0eXVrk+c/KAkgK0YT5pn3x5plZUHSuSuBEC36185/zpFPA=="],
|
||||
|
||||
"@effect/platform-node": ["@effect/[email protected]", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.27", "mime": "^4.1.0", "undici": "^7.20.0" }, "peerDependencies": { "effect": "^4.0.0-beta.27", "ioredis": "^5.7.0" } }, "sha512-UPZMtFVnDIM5nb6A2pEPo229VnfgMdvl/9sGiQaYRB9qEVHerk0elxcoWOb2szoivBYePYFOsPKIWpR6jCldtQ=="],
|
||||
|
||||
"@effect/platform-node-shared": ["@effect/[email protected]", "", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.27" } }, "sha512-prRa5MIWGAvq2g6FgVP5RFfPwI+DvcXCaEZetvPMK70wdkTR1+jKQqJ9QDKWNIP+2d4llE/cF21SvcpBJWq0gw=="],
|
||||
|
||||
"@effect/sql-sqlite-node": ["@effect/[email protected]", "", { "dependencies": { "better-sqlite3": "^12.6.2" }, "peerDependencies": { "effect": "^4.0.0-beta.27" } }, "sha512-GhTe2gIob7wuQ7OYHM+FtjPhYhf0oFtImPWwaXdQ14kxCSQVFuHY+ll45p2bxTAInnrnDip+Q+UC6xpNnvI3Cw=="],
|
||||
|
||||
"@effect/vitest": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.27", "vitest": "^3.0.0 || ^4.0.0" } }, "sha512-l9LIQK2yqOF3h47CmlT2VfYWtfHLd+ZuMzma+w0OjxmPsR6bzYMA33ft4gljJ/lEQnXvGHxiTpnZySALCfv+pA=="],
|
||||
|
||||
"@esbuild/aix-ppc64": ["@esbuild/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="],
|
||||
|
||||
"@esbuild/android-arm": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="],
|
||||
|
||||
"@esbuild/android-arm64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="],
|
||||
|
||||
"@esbuild/android-x64": ["@esbuild/[email protected]", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="],
|
||||
|
||||
"@esbuild/darwin-arm64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="],
|
||||
|
||||
"@esbuild/darwin-x64": ["@esbuild/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="],
|
||||
|
||||
"@esbuild/freebsd-arm64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="],
|
||||
|
||||
"@esbuild/freebsd-x64": ["@esbuild/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="],
|
||||
|
||||
"@esbuild/linux-arm": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="],
|
||||
|
||||
"@esbuild/linux-arm64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="],
|
||||
|
||||
"@esbuild/linux-ia32": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="],
|
||||
|
||||
"@esbuild/linux-loong64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="],
|
||||
|
||||
"@esbuild/linux-mips64el": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="],
|
||||
|
||||
"@esbuild/linux-ppc64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="],
|
||||
|
||||
"@esbuild/linux-riscv64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="],
|
||||
|
||||
"@esbuild/linux-s390x": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="],
|
||||
|
||||
"@esbuild/linux-x64": ["@esbuild/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="],
|
||||
|
||||
"@esbuild/netbsd-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="],
|
||||
|
||||
"@esbuild/netbsd-x64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="],
|
||||
|
||||
"@esbuild/openbsd-arm64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="],
|
||||
|
||||
"@esbuild/openbsd-x64": ["@esbuild/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="],
|
||||
|
||||
"@esbuild/openharmony-arm64": ["@esbuild/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="],
|
||||
|
||||
"@esbuild/sunos-x64": ["@esbuild/[email protected]", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="],
|
||||
|
||||
"@esbuild/win32-arm64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="],
|
||||
|
||||
"@esbuild/win32-ia32": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="],
|
||||
|
||||
"@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
|
||||
|
||||
"@ioredis/commands": ["@ioredis/[email protected]", "", {}, "sha512-JH8ZL/ywcJyR9MmJ5BNqZllXNZQqQbnVZOqpPQqE1vHiFgAw4NHbvE0FOduNU8IX9babitBT46571OnPTT0Zcw=="],
|
||||
|
||||
"@jridgewell/gen-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
|
||||
|
||||
"@jridgewell/remapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
|
||||
|
||||
"@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
|
||||
|
||||
"@jridgewell/sourcemap-codec": ["@jridgewell/[email protected]", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
|
||||
|
||||
"@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-arm64": ["@msgpackr-extract/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-darwin-x64": ["@msgpackr-extract/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-arm64": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-linux-x64": ["@msgpackr-extract/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg=="],
|
||||
|
||||
"@msgpackr-extract/msgpackr-extract-win32-x64": ["@msgpackr-extract/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ=="],
|
||||
|
||||
"@polka/url": ["@polka/[email protected]", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
||||
|
||||
"@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q=="],
|
||||
|
||||
"@rollup/rollup-android-arm-eabi": ["@rollup/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg=="],
|
||||
|
||||
"@rollup/rollup-android-arm64": ["@rollup/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q=="],
|
||||
|
||||
"@rollup/rollup-darwin-arm64": ["@rollup/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg=="],
|
||||
|
||||
"@rollup/rollup-darwin-x64": ["@rollup/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w=="],
|
||||
|
||||
"@rollup/rollup-freebsd-arm64": ["@rollup/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA=="],
|
||||
|
||||
"@rollup/rollup-freebsd-x64": ["@rollup/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA=="],
|
||||
|
||||
"@rollup/rollup-linux-loong64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg=="],
|
||||
|
||||
"@rollup/rollup-linux-loong64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q=="],
|
||||
|
||||
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA=="],
|
||||
|
||||
"@rollup/rollup-linux-ppc64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg=="],
|
||||
|
||||
"@rollup/rollup-linux-s390x-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-gnu": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-musl": ["@rollup/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg=="],
|
||||
|
||||
"@rollup/rollup-openbsd-x64": ["@rollup/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ=="],
|
||||
|
||||
"@rollup/rollup-openharmony-arm64": ["@rollup/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA=="],
|
||||
|
||||
"@rollup/rollup-win32-arm64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A=="],
|
||||
|
||||
"@rollup/rollup-win32-ia32-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-gnu": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA=="],
|
||||
|
||||
"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
"@tanstack/history": ["@tanstack/[email protected]", "", {}, "sha512-Kp/WSt411ZWYvgXy6uiv5RmhHrz9cAml05AQPrtdAp7eUqvIDbMGPnML25OKbzR3RJ1q4wgENxDTvlGPa9+Mww=="],
|
||||
|
||||
"@tanstack/react-router": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/history": "1.161.4", "@tanstack/react-store": "^0.9.1", "@tanstack/router-core": "1.166.2", "isbot": "^5.1.22", "tiny-invariant": "^1.3.3", "tiny-warning": "^1.0.3" }, "peerDependencies": { "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" } }, "sha512-pKhUtrvVLlhjWhsHkJSuIzh1J4LcP+8ErbIqRLORX9Js8dUFMKoT0+8oFpi+P8QRpuhm/7rzjYiWfcyTsqQZtA=="],
|
||||
|
||||
"@tanstack/react-store": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/store": "0.9.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-YzJLnRvy5lIEFTLWBAZmcOjK3+2AepnBv/sr6NZmiqJvq7zTQggyK99Gw8fqYdMdHPQWXjz0epFKJXC+9V2xDA=="],
|
||||
|
||||
"@tanstack/router-core": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/history": "1.161.4", "@tanstack/store": "^0.9.1", "cookie-es": "^2.0.0", "seroval": "^1.4.2", "seroval-plugins": "^1.4.2", "tiny-invariant": "^1.3.3", "tiny-warning": "^1.0.3" } }, "sha512-zn3NhENOAX9ToQiX077UV2OH3aJKOvV2ZMNZZxZ3gDG3i3WqL8NfWfEgetEAfMN37/Mnt90PpotYgf7IyuoKqQ=="],
|
||||
|
||||
"@tanstack/router-generator": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/router-core": "1.166.2", "@tanstack/router-utils": "1.161.4", "@tanstack/virtual-file-routes": "1.161.4", "prettier": "^3.5.0", "recast": "^0.23.11", "source-map": "^0.7.4", "tsx": "^4.19.2", "zod": "^3.24.2" } }, "sha512-wbvdyP1PKKQKk4aVlGeK9S5uDy8zodTr3tEZ2gRKNavJLusXbEWqtoo42JxHFFNB6dtguehFMt8PyZPAtkgWwQ=="],
|
||||
|
||||
"@tanstack/router-plugin": ["@tanstack/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@tanstack/router-core": "1.166.2", "@tanstack/router-generator": "1.166.2", "@tanstack/router-utils": "1.161.4", "@tanstack/virtual-file-routes": "1.161.4", "chokidar": "^3.6.0", "unplugin": "^2.1.2", "zod": "^3.24.2" }, "peerDependencies": { "@rsbuild/core": ">=1.0.2", "@tanstack/react-router": "^1.166.2", "vite": ">=5.0.0 || >=6.0.0 || >=7.0.0", "vite-plugin-solid": "^2.11.10", "webpack": ">=5.92.0" }, "optionalPeers": ["@rsbuild/core", "@tanstack/react-router", "vite", "vite-plugin-solid", "webpack"] }, "sha512-TnyV/7//Vp5fR49mmNbOWHGz9IJTm1lqVxzPdtpzg7D5PjkW2HFmLFLtWwpJgz2R7AJJWR4Ge5kIPmC+fVZ6eQ=="],
|
||||
|
||||
"@tanstack/router-utils": ["@tanstack/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/generator": "^7.28.5", "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "ansis": "^4.1.0", "babel-dead-code-elimination": "^1.0.12", "diff": "^8.0.2", "pathe": "^2.0.3", "tinyglobby": "^0.2.15" } }, "sha512-r8TpjyIZoqrXXaf2DDyjd44gjGBoyE+/oEaaH68yLI9ySPO1gUWmQENZ1MZnmBnpUGN24NOZxdjDLc8npK0SAw=="],
|
||||
|
||||
"@tanstack/store": ["@tanstack/[email protected]", "", {}, "sha512-+qcNkOy0N1qSGsP7omVCW0SDrXtaDcycPqBDE726yryiA5eTDFpjBReaYjghVJwNf1pcPMyzIwTGlYjCSQR0Fg=="],
|
||||
|
||||
"@tanstack/virtual-file-routes": ["@tanstack/[email protected]", "", {}, "sha512-42WoRePf8v690qG8yGRe/YOh+oHni9vUaUUfoqlS91U2scd3a5rkLtVsc6b7z60w3RogH0I00vdrC5AaeiZ18w=="],
|
||||
|
||||
"@types/babel__core": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
|
||||
|
||||
"@types/babel__generator": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="],
|
||||
|
||||
"@types/babel__template": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="],
|
||||
|
||||
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
|
||||
|
||||
"@types/chai": ["@types/[email protected]", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="],
|
||||
|
||||
"@types/deep-eql": ["@types/[email protected]", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="],
|
||||
|
||||
"@types/estree": ["@types/[email protected]", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
|
||||
|
||||
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-fPxQqz4VTgPI/IQ+lj9r0h+fDR66bzoeMGHp8ASee+32OSGIkeASsoZuJixsQoVef1QJbeubcPBxKk22QVoWdw=="],
|
||||
|
||||
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="],
|
||||
|
||||
"@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],
|
||||
|
||||
"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
|
||||
|
||||
"@vitejs/plugin-react": ["@vitejs/[email protected]", "", { "dependencies": { "@babel/core": "^7.29.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-rc.3", "@types/babel__core": "^7.20.5", "react-refresh": "^0.18.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-VIcFLdRi/VYRU8OL/puL7QXMYafHmqOnwTZY50U1JPlCNj30PxCMx65c494b1K9be9hX83KVt0+gTEwTWLqToA=="],
|
||||
|
||||
"@vitest/browser": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/mocker": "4.0.18", "@vitest/utils": "4.0.18", "magic-string": "^0.30.21", "pixelmatch": "7.1.0", "pngjs": "^7.0.0", "sirv": "^3.0.2", "tinyrainbow": "^3.0.3", "ws": "^8.18.3" }, "peerDependencies": { "vitest": "4.0.18" } }, "sha512-gVQqh7paBz3gC+ZdcCmNSWJMk70IUjDeVqi+5m5vYpEHsIwRgw3Y545jljtajhkekIpIp5Gg8oK7bctgY0E2Ng=="],
|
||||
|
||||
"@vitest/browser-playwright": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/browser": "4.0.18", "@vitest/mocker": "4.0.18", "tinyrainbow": "^3.0.3" }, "peerDependencies": { "playwright": "*", "vitest": "4.0.18" } }, "sha512-gfajTHVCiwpxRj1qh0Sh/5bbGLG4F/ZH/V9xvFVoFddpITfMta9YGow0W6ZpTTORv2vdJuz9TnrNSmjKvpOf4g=="],
|
||||
|
||||
"@vitest/expect": ["@vitest/[email protected]", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", "@vitest/spy": "4.0.18", "@vitest/utils": "4.0.18", "chai": "^6.2.1", "tinyrainbow": "^3.0.3" } }, "sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ=="],
|
||||
|
||||
"@vitest/mocker": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/spy": "4.0.18", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^6.0.0 || ^7.0.0-0" }, "optionalPeers": ["msw"] }, "sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ=="],
|
||||
|
||||
"@vitest/pretty-format": ["@vitest/[email protected]", "", { "dependencies": { "tinyrainbow": "^3.0.3" } }, "sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw=="],
|
||||
|
||||
"@vitest/runner": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/utils": "4.0.18", "pathe": "^2.0.3" } }, "sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw=="],
|
||||
|
||||
"@vitest/snapshot": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "4.0.18", "magic-string": "^0.30.21", "pathe": "^2.0.3" } }, "sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA=="],
|
||||
|
||||
"@vitest/spy": ["@vitest/[email protected]", "", {}, "sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw=="],
|
||||
|
||||
"@vitest/utils": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "4.0.18", "tinyrainbow": "^3.0.3" } }, "sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA=="],
|
||||
|
||||
"acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="],
|
||||
|
||||
"ansis": ["[email protected]", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="],
|
||||
|
||||
"anymatch": ["[email protected]", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="],
|
||||
|
||||
"assertion-error": ["[email protected]", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="],
|
||||
|
||||
"ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="],
|
||||
|
||||
"babel-dead-code-elimination": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig=="],
|
||||
|
||||
"base64-js": ["[email protected]", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
|
||||
|
||||
"baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA=="],
|
||||
|
||||
"better-sqlite3": ["[email protected]", "", { "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.1" } }, "sha512-8VYKM3MjCa9WcaSAI3hzwhmyHVlH8tiGFwf0RlTsZPWJ1I5MkzjiudCo4KC4DxOaL/53A5B1sI/IbldNFDbsKA=="],
|
||||
|
||||
"binary-extensions": ["[email protected]", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="],
|
||||
|
||||
"bindings": ["[email protected]", "", { "dependencies": { "file-uri-to-path": "1.0.0" } }, "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="],
|
||||
|
||||
"bl": ["[email protected]", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
|
||||
|
||||
"braces": ["[email protected]", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
|
||||
|
||||
"browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="],
|
||||
|
||||
"buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
||||
|
||||
"caniuse-lite": ["[email protected]", "", {}, "sha512-sg01JDPzZ9jGshqKSckOQthXnYwOEP50jeVFhaSFbZcOy05TiuuaffDOfcwtCisJ9kNQuLBFibYywv2Bgm9osw=="],
|
||||
|
||||
"chai": ["[email protected]", "", {}, "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg=="],
|
||||
|
||||
"chokidar": ["[email protected]", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="],
|
||||
|
||||
"chownr": ["[email protected]", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
|
||||
|
||||
"cluster-key-slot": ["[email protected]", "", {}, "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA=="],
|
||||
|
||||
"convert-source-map": ["[email protected]", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
|
||||
|
||||
"cookie-es": ["[email protected]", "", {}, "sha512-RAj4E421UYRgqokKUmotqAwuplYw15qtdXfY+hGzgCJ/MBjCVZcSoHK/kH9kocfjRjcDME7IiDWR/1WX1TM2Pg=="],
|
||||
|
||||
"csstype": ["[email protected]", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="],
|
||||
|
||||
"debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
||||
|
||||
"decompress-response": ["[email protected]", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
|
||||
|
||||
"deep-extend": ["[email protected]", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],
|
||||
|
||||
"denque": ["[email protected]", "", {}, "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw=="],
|
||||
|
||||
"detect-libc": ["[email protected]", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
||||
|
||||
"diff": ["[email protected]", "", {}, "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ=="],
|
||||
|
||||
"effect": ["[email protected]", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }, "sha512-bNQEF3vaVGF8jAJ+HW1A4DaxVNmujgEu89sO+VNW1AvUYtPGMtKPTBU15K9inu1rG+hkxNFFRlVvLAJsdaE2mg=="],
|
||||
|
||||
"electron-to-chromium": ["[email protected]", "", {}, "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg=="],
|
||||
|
||||
"end-of-stream": ["[email protected]", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
|
||||
|
||||
"es-module-lexer": ["[email protected]", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
|
||||
|
||||
"esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": "bin/esbuild" }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="],
|
||||
|
||||
"escalade": ["[email protected]", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
||||
|
||||
"esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
|
||||
|
||||
"estree-walker": ["[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
|
||||
|
||||
"expand-template": ["[email protected]", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="],
|
||||
|
||||
"expect-type": ["[email protected]", "", {}, "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA=="],
|
||||
|
||||
"fast-check": ["[email protected]", "", { "dependencies": { "pure-rand": "^7.0.0" } }, "sha512-IE9csY7lnhxBnA8g/WI5eg/hygA6MGWJMSNfFRrBlXUciADEhS1EDB0SIsMSvzubzIlOBbVITSsypCsW717poA=="],
|
||||
|
||||
"fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||
|
||||
"file-uri-to-path": ["[email protected]", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="],
|
||||
|
||||
"fill-range": ["[email protected]", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
|
||||
|
||||
"find-my-way-ts": ["[email protected]", "", {}, "sha512-a85L9ZoXtNAey3Y6Z+eBWW658kO/MwR7zIafkIUPUMf3isZG0NCs2pjW2wtjxAKuJPxMAsHUIP4ZPGv0o5gyTA=="],
|
||||
|
||||
"fs-constants": ["[email protected]", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
|
||||
|
||||
"fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
|
||||
|
||||
"gensync": ["[email protected]", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
|
||||
|
||||
"get-tsconfig": ["[email protected]", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw=="],
|
||||
|
||||
"github-from-package": ["[email protected]", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="],
|
||||
|
||||
"glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
||||
|
||||
"ieee754": ["[email protected]", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
|
||||
|
||||
"inherits": ["[email protected]", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||
|
||||
"ini": ["[email protected]", "", {}, "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ=="],
|
||||
|
||||
"ioredis": ["[email protected]", "", { "dependencies": { "@ioredis/commands": "1.5.1", "cluster-key-slot": "^1.1.0", "debug": "^4.3.4", "denque": "^2.1.0", "lodash.defaults": "^4.2.0", "lodash.isarguments": "^3.1.0", "redis-errors": "^1.2.0", "redis-parser": "^3.0.0", "standard-as-callback": "^2.1.0" } }, "sha512-HVBe9OFuqs+Z6n64q09PQvP1/R4Bm+30PAyyD4wIEqssh3v9L21QjCVk4kRLucMBcDokJTcLjsGeVRlq/nH6DA=="],
|
||||
|
||||
"is-binary-path": ["[email protected]", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="],
|
||||
|
||||
"is-extglob": ["[email protected]", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
|
||||
|
||||
"is-glob": ["[email protected]", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
||||
|
||||
"is-number": ["[email protected]", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
|
||||
|
||||
"isbot": ["[email protected]", "", {}, "sha512-waFfC72ZNfwLLuJ2iLaoVaqcNo+CAaLR7xCpAn0Y5WfGzkNHv7ZN39Vbi1y+kb+Zs46XHOX3tZNExroFUPX+Kg=="],
|
||||
|
||||
"js-tokens": ["[email protected]", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
|
||||
|
||||
"jsesc": ["[email protected]", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
|
||||
|
||||
"json5": ["[email protected]", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
|
||||
|
||||
"kubernetes-types": ["[email protected]", "", {}, "sha512-Dew1okvhM/SQcIa2rcgujNndZwU8VnSapDgdxlYoB84ZlpAD43U6KLAFqYo17ykSFGHNPrg0qry0bP+GJd9v7Q=="],
|
||||
|
||||
"lodash.defaults": ["[email protected]", "", {}, "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ=="],
|
||||
|
||||
"lodash.isarguments": ["[email protected]", "", {}, "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg=="],
|
||||
|
||||
"lru-cache": ["[email protected]", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
|
||||
|
||||
"magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||
|
||||
"mime": ["[email protected]", "", { "bin": "bin/cli.js" }, "sha512-X5ju04+cAzsojXKes0B/S4tcYtFAJ6tTMuSPBEn9CPGlrWr8Fiw7qYeLT0XyH80HSoAoqWCaz+MWKh22P7G1cw=="],
|
||||
|
||||
"mimic-response": ["[email protected]", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
|
||||
|
||||
"minimist": ["[email protected]", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
|
||||
|
||||
"mkdirp-classic": ["[email protected]", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
|
||||
|
||||
"mrmime": ["[email protected]", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
|
||||
|
||||
"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"msgpackr": ["[email protected]", "", { "optionalDependencies": { "msgpackr-extract": "^3.0.2" } }, "sha512-bC4UGzHhVvgDNS7kn9tV8fAucIYUBuGojcaLiz7v+P63Lmtm0Xeji8B/8tYKddALXxJLpwIeBmUN3u64C4YkRA=="],
|
||||
|
||||
"msgpackr-extract": ["[email protected]", "", { "dependencies": { "node-gyp-build-optional-packages": "5.2.2" }, "optionalDependencies": { "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3", "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3", "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3", "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3" }, "bin": { "download-msgpackr-prebuilds": "bin/download-prebuilds.js" } }, "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA=="],
|
||||
|
||||
"multipasta": ["[email protected]", "", {}, "sha512-KPA58d68KgGil15oDqXjkUBEBYc00XvbPj5/X+dyzeo/lWm9Nc25pQRlf1D+gv4OpK7NM0J1odrbu9JNNGvynA=="],
|
||||
|
||||
"nanoid": ["[email protected]", "", { "bin": "bin/nanoid.cjs" }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
|
||||
|
||||
"napi-build-utils": ["[email protected]", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="],
|
||||
|
||||
"node-abi": ["[email protected]", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ=="],
|
||||
|
||||
"node-gyp-build-optional-packages": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.1" }, "bin": { "node-gyp-build-optional-packages": "bin.js", "node-gyp-build-optional-packages-optional": "optional.js", "node-gyp-build-optional-packages-test": "build-test.js" } }, "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw=="],
|
||||
|
||||
"node-releases": ["[email protected]", "", {}, "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA=="],
|
||||
|
||||
"normalize-path": ["[email protected]", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
|
||||
|
||||
"obug": ["[email protected]", "", {}, "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ=="],
|
||||
|
||||
"once": ["[email protected]", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||
|
||||
"pathe": ["[email protected]", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
||||
|
||||
"picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
||||
|
||||
"picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
|
||||
|
||||
"pixelmatch": ["[email protected]", "", { "dependencies": { "pngjs": "^7.0.0" }, "bin": { "pixelmatch": "bin/pixelmatch" } }, "sha512-1wrVzJ2STrpmONHKBy228LM1b84msXDUoAzVEl0R8Mz4Ce6EPr+IVtxm8+yvrqLYMHswREkjYFaMxnyGnaY3Ng=="],
|
||||
|
||||
"playwright": ["[email protected]", "", { "dependencies": { "playwright-core": "1.58.2" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A=="],
|
||||
|
||||
"playwright-core": ["[email protected]", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg=="],
|
||||
|
||||
"pngjs": ["[email protected]", "", {}, "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow=="],
|
||||
|
||||
"postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg=="],
|
||||
|
||||
"prebuild-install": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="],
|
||||
|
||||
"prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="],
|
||||
|
||||
"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
|
||||
|
||||
"pure-rand": ["[email protected]", "", {}, "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ=="],
|
||||
|
||||
"rc": ["[email protected]", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
|
||||
|
||||
"react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],
|
||||
|
||||
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],
|
||||
|
||||
"react-refresh": ["[email protected]", "", {}, "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw=="],
|
||||
|
||||
"readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
||||
|
||||
"readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
|
||||
|
||||
"recast": ["[email protected]", "", { "dependencies": { "ast-types": "^0.16.1", "esprima": "~4.0.0", "source-map": "~0.6.1", "tiny-invariant": "^1.3.3", "tslib": "^2.0.1" } }, "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA=="],
|
||||
|
||||
"redis-errors": ["[email protected]", "", {}, "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w=="],
|
||||
|
||||
"redis-parser": ["[email protected]", "", { "dependencies": { "redis-errors": "^1.0.0" } }, "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A=="],
|
||||
|
||||
"resolve-pkg-maps": ["[email protected]", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
||||
|
||||
"rollup": ["[email protected]", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.59.0", "@rollup/rollup-android-arm64": "4.59.0", "@rollup/rollup-darwin-arm64": "4.59.0", "@rollup/rollup-darwin-x64": "4.59.0", "@rollup/rollup-freebsd-arm64": "4.59.0", "@rollup/rollup-freebsd-x64": "4.59.0", "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", "@rollup/rollup-linux-arm-musleabihf": "4.59.0", "@rollup/rollup-linux-arm64-gnu": "4.59.0", "@rollup/rollup-linux-arm64-musl": "4.59.0", "@rollup/rollup-linux-loong64-gnu": "4.59.0", "@rollup/rollup-linux-loong64-musl": "4.59.0", "@rollup/rollup-linux-ppc64-gnu": "4.59.0", "@rollup/rollup-linux-ppc64-musl": "4.59.0", "@rollup/rollup-linux-riscv64-gnu": "4.59.0", "@rollup/rollup-linux-riscv64-musl": "4.59.0", "@rollup/rollup-linux-s390x-gnu": "4.59.0", "@rollup/rollup-linux-x64-gnu": "4.59.0", "@rollup/rollup-linux-x64-musl": "4.59.0", "@rollup/rollup-openbsd-x64": "4.59.0", "@rollup/rollup-openharmony-arm64": "4.59.0", "@rollup/rollup-win32-arm64-msvc": "4.59.0", "@rollup/rollup-win32-ia32-msvc": "4.59.0", "@rollup/rollup-win32-x64-gnu": "4.59.0", "@rollup/rollup-win32-x64-msvc": "4.59.0", "fsevents": "~2.3.2" }, "bin": "dist/bin/rollup" }, "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg=="],
|
||||
|
||||
"safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||
|
||||
"scheduler": ["[email protected]", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
|
||||
|
||||
"semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
||||
|
||||
"seroval": ["[email protected]", "", {}, "sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw=="],
|
||||
|
||||
"seroval-plugins": ["[email protected]", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-EAHqADIQondwRZIdeW2I636zgsODzoBDwb3PT/+7TLDWyw1Dy/Xv7iGUIEXXav7usHDE9HVhOU61irI3EnyyHA=="],
|
||||
|
||||
"siginfo": ["[email protected]", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
|
||||
|
||||
"simple-concat": ["[email protected]", "", {}, "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="],
|
||||
|
||||
"simple-get": ["[email protected]", "", { "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", "simple-concat": "^1.0.0" } }, "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA=="],
|
||||
|
||||
"sirv": ["[email protected]", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g=="],
|
||||
|
||||
"source-map": ["[email protected]", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="],
|
||||
|
||||
"source-map-js": ["[email protected]", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
||||
|
||||
"stackback": ["[email protected]", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="],
|
||||
|
||||
"standard-as-callback": ["[email protected]", "", {}, "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A=="],
|
||||
|
||||
"std-env": ["[email protected]", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
|
||||
|
||||
"string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],
|
||||
|
||||
"strip-json-comments": ["[email protected]", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
|
||||
|
||||
"tar-fs": ["[email protected]", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ=="],
|
||||
|
||||
"tar-stream": ["[email protected]", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
|
||||
|
||||
"tiny-invariant": ["[email protected]", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="],
|
||||
|
||||
"tiny-warning": ["[email protected]", "", {}, "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="],
|
||||
|
||||
"tinybench": ["[email protected]", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="],
|
||||
|
||||
"tinyexec": ["[email protected]", "", {}, "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg=="],
|
||||
|
||||
"tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
|
||||
|
||||
"tinyrainbow": ["[email protected]", "", {}, "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q=="],
|
||||
|
||||
"to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
||||
|
||||
"toml": ["[email protected]", "", {}, "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="],
|
||||
|
||||
"totalist": ["[email protected]", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="],
|
||||
|
||||
"tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"tsx": ["[email protected]", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": "dist/cli.mjs" }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="],
|
||||
|
||||
"tunnel-agent": ["[email protected]", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
|
||||
|
||||
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CldZdztDpQRLM1HC6WDQjQkQN5Ub5zRau737a1diGh3lPmb9oRsaWHk1y5iqK0o7+1bNJ0oXfEGRkAogFZBL+Q=="],
|
||||
|
||||
"undici": ["[email protected]", "", {}, "sha512-RqslV2Us5BrllB+JeiZnK4peryVTndy9Dnqq62S3yYRRTj0tFQCwEniUy2167skdGOy3vqRzEvl1Dm4sV2ReDg=="],
|
||||
|
||||
"undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
||||
|
||||
"unplugin": ["[email protected]", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="],
|
||||
|
||||
"update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],
|
||||
|
||||
"use-sync-external-store": ["[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w=="],
|
||||
|
||||
"util-deprecate": ["[email protected]", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
||||
|
||||
"uuid": ["[email protected]", "", { "bin": "dist-node/bin/uuid" }, "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w=="],
|
||||
|
||||
"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser"], "bin": "bin/vite.js" }, "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA=="],
|
||||
|
||||
"vitest": ["[email protected]", "", { "dependencies": { "@vitest/expect": "4.0.18", "@vitest/mocker": "4.0.18", "@vitest/pretty-format": "4.0.18", "@vitest/runner": "4.0.18", "@vitest/snapshot": "4.0.18", "@vitest/spy": "4.0.18", "@vitest/utils": "4.0.18", "es-module-lexer": "^1.7.0", "expect-type": "^1.2.2", "magic-string": "^0.30.21", "obug": "^2.1.1", "pathe": "^2.0.3", "picomatch": "^4.0.3", "std-env": "^3.10.0", "tinybench": "^2.9.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tinyrainbow": "^3.0.3", "vite": "^6.0.0 || ^7.0.0", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "4.0.18", "@vitest/browser-preview": "4.0.18", "@vitest/browser-webdriverio": "4.0.18", "@vitest/ui": "4.0.18", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/ui", "happy-dom", "jsdom"], "bin": "vitest.mjs" }, "sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ=="],
|
||||
|
||||
"vitest-browser-react": ["[email protected]", "", { "peerDependencies": { "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "vitest": "^4.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-YODQX8mHTJCyKNVYTWJrLEYrUtw+QfLl78owgvuE7C5ydgmGBq6v5s4jK2w6wdPhIZsN9PpV1rQbmAevWJjO9g=="],
|
||||
|
||||
"webpack-virtual-modules": ["[email protected]", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="],
|
||||
|
||||
"why-is-node-running": ["[email protected]", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": "cli.js" }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="],
|
||||
|
||||
"wrappy": ["[email protected]", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
||||
|
||||
"ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg=="],
|
||||
|
||||
"yallist": ["[email protected]", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
|
||||
|
||||
"yaml": ["[email protected]", "", { "bin": "bin.mjs" }, "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A=="],
|
||||
|
||||
"zod": ["[email protected]", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
|
||||
|
||||
"@types/ws/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-akNQMv0wW5uyRpD2v2IEyRSZiR+BeGuoB6L310EgGObO44HSMNT8z1xzio28V8qOrgYaopIDNA18YgdXd+qTiw=="],
|
||||
|
||||
"anymatch/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"chokidar/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"node-abi/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"rc/ini": ["[email protected]", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
||||
|
||||
"readdirp/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"recast/source-map": ["[email protected]", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
|
||||
"rollup/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"tsx/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"vite/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"@types/ws/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "effect-http-ws-cli",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
"workspaces": {
|
||||
"packages": ["server", "web"],
|
||||
"catalog": {
|
||||
"@effect/platform-node": "4.0.0-beta.27",
|
||||
"@effect/sql-sqlite-node": "4.0.0-beta.27",
|
||||
"@effect/atom-react": "4.0.0-beta.27",
|
||||
"@effect/vitest": "4.0.0-beta.27",
|
||||
"effect": "4.0.0-beta.27",
|
||||
"typescript": "6.0.0-beta",
|
||||
"vitest": "^4.0.18"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.mjs",
|
||||
"start": "node server/src/bin.ts",
|
||||
"web:dev": "bun run --filter @effect-http-ws-cli/web dev",
|
||||
"web:build": "bun run --filter @effect-http-ws-cli/web build",
|
||||
"web:preview": "bun run --filter @effect-http-ws-cli/web preview",
|
||||
"test": "bun run --filter @effect-http-ws-cli/server test",
|
||||
"test:web": "bun run --filter @effect-http-ws-cli/web test",
|
||||
"test:all": "bun run --sequential --workspaces test",
|
||||
"lint": "bun run --sequential --workspaces lint"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
:root{--paper: #f3f0e8;--ink: #13222c;--ink-soft: #345264;--accent: #dc4f18;--accent-soft: #f8bb68;--panel: #fffdf6;--line: #162f3f22;--shadow: 0 16px 40px #0f1e291f}*{box-sizing:border-box}body{margin:0;min-height:100vh;font-family:IBM Plex Sans,Segoe UI,sans-serif;color:var(--ink);background:radial-gradient(circle at 10% 10%,#f7cf9a 0%,transparent 36%),radial-gradient(circle at 92% 88%,#95c7d2 0%,transparent 32%),linear-gradient(165deg,#ece8dc 0%,var(--paper) 48%,#e9dfcf 100%)}.shell{width:min(1100px,100% - 2rem);margin:1.5rem auto;padding:1.5rem;border:1px solid var(--line);border-radius:20px;background:color-mix(in oklab,var(--paper),white 35%);box-shadow:var(--shadow)}.hero{position:relative;overflow:hidden;padding:1.5rem;border-radius:16px;border:1px solid var(--line);background:linear-gradient(140deg,#fff9ed,#f7efe0 65%,#f2e7d4)}.hero:after{content:"";position:absolute;width:220px;height:220px;right:-60px;top:-90px;border-radius:999px;background:linear-gradient(180deg,var(--accent-soft),transparent 70%);pointer-events:none}.eyebrow{margin:0;font-size:.72rem;letter-spacing:.22em;text-transform:uppercase;color:var(--ink-soft)}h1,h2{font-family:Archivo Black,Impact,sans-serif;letter-spacing:.02em;margin:0}h1{margin-top:.35rem;font-size:clamp(1.5rem,4vw,2.35rem)}h2{font-size:1.1rem}.lead{margin:.6rem 0 0;color:var(--ink-soft);max-width:68ch}.panel{border:1px solid var(--line);border-radius:14px;padding:1rem;background:var(--panel);margin-top:1rem}.status-panel{margin-top:0;background:linear-gradient(140deg,#fbf7ee,#f1e8d7)}.status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem}.status-item{border:1px solid var(--line);border-radius:10px;padding:.55rem .7rem;display:flex;justify-content:space-between;align-items:baseline;gap:.75rem;background:#fff}.status-label{color:var(--ink-soft);font-size:.82rem}.status-subscription-connected{border-color:#24704755;background:#f1fbf5}.status-subscription-connecting{border-color:#8d6a1b55;background:#fff8eb}.status-subscription-idle{border-color:var(--line)}.status-mutation-busy{border-color:#6b3b2e55;background:#fff3ef}.todo-header{display:flex;justify-content:space-between;align-items:baseline;gap:1rem}.meta{display:flex;gap:.75rem;color:var(--ink-soft);font-size:.86rem}.todo-list{margin:.8rem 0 0;padding:0;list-style:none;display:grid;gap:.6rem}.event-list{margin:.8rem 0 0;padding:0;list-style:none;display:grid;gap:.5rem;max-height:260px;overflow:auto}.event-item{border:1px solid var(--line);border-radius:10px;background:#fff;padding:.55rem .65rem}.event-top{display:flex;justify-content:space-between;gap:.6rem;color:var(--ink-soft);font-size:.8rem}.event-body{margin-top:.2rem;display:flex;justify-content:space-between;gap:.75rem;font-size:.9rem}.event-body small{color:var(--ink-soft);white-space:nowrap}.todo-item{display:flex;gap:.8rem;align-items:center;border:1px solid var(--line);border-radius:10px;background:#fff;padding:.65rem}.todo-main{flex:1}.todo-main input{width:100%;margin:0;border:1px solid var(--line);background:#fff;border-radius:8px;padding:.42rem .55rem;color:var(--ink);font:inherit;font-weight:600}.todo-main small{display:block;margin-top:.3rem;color:var(--ink-soft)}.todo-actions{display:flex;gap:.45rem}button{border:1px solid #0f243233;border-radius:8px;background:linear-gradient(160deg,#fff,#f4efe3);color:var(--ink);padding:.4rem .6rem;font:inherit;font-size:.85rem;font-weight:700;cursor:pointer;transition:transform .12s ease,box-shadow .12s ease}button:hover{transform:translateY(-1px);box-shadow:0 8px 18px #0f20321a}.todo-item.is-completed .todo-main input{text-decoration:line-through;color:var(--ink-soft)}.todo-item.is-archived{opacity:.64}.footer{margin-top:1rem;display:flex;gap:1rem;align-items:center;font-size:.88rem;color:var(--ink-soft)}.error{color:var(--accent);font-weight:700}@media(max-width:880px){.shell{width:min(1100px,100% - 1rem);padding:1rem}.todo-item{flex-direction:column;align-items:stretch}.todo-actions{justify-content:flex-end}.status-grid{grid-template-columns:1fr}}
|
||||
@@ -0,0 +1,35 @@
|
||||
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const o of u)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(u){const o={};return u.integrity&&(o.integrity=u.integrity),u.referrerPolicy&&(o.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?o.credentials="include":u.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(u){if(u.ep)return;u.ep=!0;const o=s(u);fetch(u.href,o)}})();function KR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zm={exports:{}},au={};var O1;function PR(){if(O1)return au;O1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(i,u,o){var d=null;if(o!==void 0&&(d=""+o),u.key!==void 0&&(d=""+u.key),"key"in u){o={};for(var h in u)h!=="key"&&(o[h]=u[h])}else o=u;return u=o.ref,{$$typeof:e,type:i,key:d,ref:u!==void 0?u:null,props:o}}return au.Fragment=n,au.jsx=s,au.jsxs=s,au}var R1;function XR(){return R1||(R1=1,Zm.exports=PR()),Zm.exports}var ee=XR(),Wm={exports:{}},ye={};var A1;function QR(){if(A1)return ye;A1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),v=Symbol.iterator;function _(w){return w===null||typeof w!="object"?null:(w=v&&w[v]||w["@@iterator"],typeof w=="function"?w:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,j={};function B(w,G,re){this.props=w,this.context=G,this.refs=j,this.updater=re||x}B.prototype.isReactComponent={},B.prototype.setState=function(w,G){if(typeof w!="object"&&typeof w!="function"&&w!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,w,G,"setState")},B.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function M(){}M.prototype=B.prototype;function I(w,G,re){this.props=w,this.context=G,this.refs=j,this.updater=re||x}var z=I.prototype=new M;z.constructor=I,T(z,B.prototype),z.isPureReactComponent=!0;var W=Array.isArray;function H(){}var V={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function te(w,G,re){var ae=re.ref;return{$$typeof:e,type:w,key:G,ref:ae!==void 0?ae:null,props:re}}function fe(w,G){return te(w.type,G,w.props)}function oe(w){return typeof w=="object"&&w!==null&&w.$$typeof===e}function ie(w){var G={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(re){return G[re]})}var A=/\/+/g;function Q(w,G){return typeof w=="object"&&w!==null&&w.key!=null?ie(""+w.key):G.toString(36)}function Z(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(H,H):(w.status="pending",w.then(function(G){w.status==="pending"&&(w.status="fulfilled",w.value=G)},function(G){w.status==="pending"&&(w.status="rejected",w.reason=G)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function O(w,G,re,ae,he){var xe=typeof w;(xe==="undefined"||xe==="boolean")&&(w=null);var Ne=!1;if(w===null)Ne=!0;else switch(xe){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(w.$$typeof){case e:case n:Ne=!0;break;case y:return Ne=w._init,O(Ne(w._payload),G,re,ae,he)}}if(Ne)return he=he(w),Ne=ae===""?"."+Q(w,0):ae,W(he)?(re="",Ne!=null&&(re=Ne.replace(A,"$&/")+"/"),O(he,G,re,"",function(Ur){return Ur})):he!=null&&(oe(he)&&(he=fe(he,re+(he.key==null||w&&w.key===he.key?"":(""+he.key).replace(A,"$&/")+"/")+Ne)),G.push(he)),1;Ne=0;var pt=ae===""?".":ae+":";if(W(w))for(var Ze=0;Ze<w.length;Ze++)ae=w[Ze],xe=pt+Q(ae,Ze),Ne+=O(ae,G,re,xe,he);else if(Ze=_(w),typeof Ze=="function")for(w=Ze.call(w),Ze=0;!(ae=w.next()).done;)ae=ae.value,xe=pt+Q(ae,Ze++),Ne+=O(ae,G,re,xe,he);else if(xe==="object"){if(typeof w.then=="function")return O(Z(w),G,re,ae,he);throw G=String(w),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function N(w,G,re){if(w==null)return w;var ae=[],he=0;return O(w,ae,"","",function(xe){return G.call(re,xe,he++)}),ae}function ne(w){if(w._status===-1){var G=w._result;G=G(),G.then(function(re){(w._status===0||w._status===-1)&&(w._status=1,w._result=re)},function(re){(w._status===0||w._status==Line truncated
|
||||
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||||
`+ps+t+oc}var fc=!1;function Wa(t,r){if(!t||fc)return"";fc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(F){var q=F}Reflect.construct(t,[],J)}else{try{J.call()}catch(F){q=F}t.call(J.prototype)}}else{try{throw Error()}catch(F){q=F}(J=t())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(F){if(F&&q&&typeof F.stack=="string")return[F.stack,q.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=c.DetermineComponentFrameRoot(),g=f[0],b=f[1];if(g&&b){var E=g.split(`
|
||||
`),L=b.split(`
|
||||
`);for(l=c=0;c<E.length&&!E[c].includes("DetermineComponentFrameRoot");)c++;for(;l<L.length&&!L[l].includes("DetermineComponentFrameRoot");)l++;if(c===E.length||l===L.length)for(c=E.length-1,l=L.length-1;1<=c&&0<=l&&E[c]!==L[l];)l--;for(;1<=c&&0<=l;c--,l--)if(E[c]!==L[l]){if(c!==1||l!==1)do if(c--,l--,0>l||E[c]!==L[l]){var K=`
|
||||
`+E[c].replace(" at new "," at ");return t.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",t.displayName)),K}while(1<=c&&0<=l);break}}}finally{fc=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?mr(a):""}function bl(t,r){switch(t.tag){case 26:case 27:case 5:return mr(t.type);case 16:return mr("Lazy");case 13:return t.child!==r&&r!==null?mr("Suspense Fallback"):mr("Suspense");case 19:return mr("SuspenseList");case 0:case 15:return Wa(t.type,!1);case 11:return Wa(t.type.render,!1);case 1:return Wa(t.type,!0);case 31:return mr("Activity");default:return""}}function Nr(t){try{var r="",a=null;do r+=bl(t,a),a=t,t=t.return;while(t);return r}catch(c){return`
|
||||
Error generating stack: `+c.message+`
|
||||
`+c.stack}}var ca=Object.prototype.hasOwnProperty,tr=e.unstable_scheduleCallback,dc=e.unstable_cancelCallback,qd=e.unstable_shouldYield,_l=e.unstable_requestPaint,rn=e.unstable_now,xl=e.unstable_getCurrentPriorityLevel,Fe=e.unstable_ImmediatePriority,_t=e.unstable_UserBlockingPriority,Qt=e.unstable_NormalPriority,El=e.unstable_LowPriority,My=e.unstable_IdlePriority,M2=e.log,C2=e.unstable_setDisableYieldValue,hc=null,bn=null;function gs(t){if(typeof M2=="function"&&C2(t),bn&&typeof bn.setStrictMode=="function")try{bn.setStrictMode(hc,t)}catch{}}var _n=Math.clz32?Math.clz32:z2,k2=Math.log,U2=Math.LN2;function z2(t){return t>>>=0,t===0?32:31-(k2(t)/U2|0)|0}var wl=256,Tl=262144,Ol=4194304;function ua(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Rl(t,r,a){var c=t.pendingLanes;if(c===0)return 0;var l=0,f=t.suspendedLanes,g=t.pingedLanes;t=t.warmLanes;var b=c&134217727;return b!==0?(c=b&~f,c!==0?l=ua(c):(g&=b,g!==0?l=ua(g):a||(a=b&~t,a!==0&&(l=ua(a))))):(b=c&~f,b!==0?l=ua(b):g!==0?l=ua(g):a||(a=c&~t,a!==0&&(l=ua(a)))),l===0?0:r!==0&&r!==l&&(r&f)===0&&(f=l&-l,a=r&-r,f>=a||f===32&&(a&4194048)!==0)?r:l}function mc(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function N2(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Cy(){var t=Ol;return Ol<<=1,(Ol&62914560)===0&&(Ol=4194304),t}function $d(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function pc(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function D2(t,r,a,c,l,f){var g=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var b=t.entanglements,E=t.expirationTimes,L=t.hiddenUpdates;for(a=g&~a;0<a;){var K=31-_n(a),J=1<<K;b[K]=0,E[K]=-1;var q=L[K];if(q!==null)for(L[K]=null,K=0;K<q.length;K++){var F=q[K];F!==null&&(F.lane&=-536870913)}a&=~J}c!==0&&ky(t,c,0),f!==0&&l===0&&t.tag!==0&&(t.suspendedLanes|=f&~(g&~r))}function ky(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var c=31-_n(r);t.entangledLanes|=r,t.entanglements[c]=t.entanglements[c]|1073741824|a&261930}function Uy(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var c=31-_n(a),l=1<<c;l&r|t[c]&r&&(t[c]|=r),a&=~l}}function zy(t,r){var a=r&-r;return a=(a&42)!==0?1:Hd(a),(a&(t.suspendedLanes|r))!==0?0:a}function Hd(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Vd(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ny(){var t=N.p;return t!==0?t:(t=window.event,t===void 0?32:v1(t.type))}function Dy(t,r){var a=N.p;try{return N.p=t,r()}finally{N.p=a}}var ys=Math.random().toString(36).slice(2),It="__reactFiber$"+ys,cn="__reactProps$"+ys,ei="__reactContainer$"+ys,Id="__reactEvents$"+ys,L2="__reactListeners$"+ys,j2="__reactHandles$"+ys,Ly="__reactResources$"+ys,gc="__reactMarker$"+ys;function Yd(t){delete t[It],delete t[cn],delete t[Id],delete t[L2],delete t[j2]}function ti(t){var r=t[It];if(r)return r;for(var a=t.parentNode;a;){if(r=a[ei]||a[It]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=r1(t);t!==null;){if(a=t[It])return a;t=r1(t)}return r}t=a,a=t.parentNode}return null}function ni(t){if(t=t[It]||t[ei]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function yc(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function ri(t){var r=t[Ly];return r||(r=t[Ly]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function zt(t){t[gc]=!0}var jy=new Set,By={};function la(t,r){si(t,r),si(t+"Capture",r)}function si(t,r){for(By[t]=r,t=0;t<r.length;t++)jy.add(r[t])}var B2=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u21
Line truncated
|
||||
`).replace(pR,"")}function Kb(t,r){return r=Fb(r),Fb(t)===r}function Ye(t,r,a,c,l,f){switch(a){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||ii(t,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&ii(t,""+c);break;case"className":Ml(t,"class",c);break;case"tabIndex":Ml(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Ml(t,a,c);break;case"style":Ky(t,c,f);break;case"data":if(r!=="object"){Ml(t,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(a);break}c=kl(""+c),t.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(r!=="input"&&Ye(t,r,"name",l.name,l,null),Ye(t,r,"formEncType",l.formEncType,l,null),Ye(t,r,"formMethod",l.formMethod,l,null),Ye(t,r,"formTarget",l.formTarget,l,null)):(Ye(t,r,"encType",l.encType,l,null),Ye(t,r,"method",l.method,l,null),Ye(t,r,"target",l.target,l,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(a);break}c=kl(""+c),t.setAttribute(a,c);break;case"onClick":c!=null&&(t.onclick=Lr);break;case"onScroll":c!=null&&Re("scroll",t);break;case"onScrollEnd":c!=null&&Re("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(a=c.__html,a!=null){if(l.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}a=kl(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,""+c):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":c===!0?t.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(a,c):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(a,c):t.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(a):t.setAttribute(a,c);break;case"popover":Re("beforetoggle",t),Re("toggle",t),Al(t,"popover",c);break;case"xlinkActuate":Dr(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Dr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Dr(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Dr(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Dr(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Dr(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Al(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=I2.get(a)||a,Al(t,a,c))}}function Nm(t,r,a,c,l,f){switch(a){case"style":Ky(t,c,f);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(a=c.__html,a!=null){if(l.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof c=="string"?ii(t,c):(typeof c=="number"||typeof c=="bigint")&&ii(t,""+c);break;case"onScroll":c!=null&&Re("scroll",t);break;case"onScrollEnd":c!=null&&Re("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Lr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne
Line truncated
|
||||
`+o(y+1));return`[
|
||||
${o(y+1)}${S}
|
||||
${o(y)}]`}if(m instanceof Date)return MA(m);if(!n?.ignoreToString&&Be(m,"toString")&&typeof m.toString=="function"&&m.toString!==Object.prototype.toString&&m.toString!==Array.prototype.toString){const S=CA(m);return m instanceof Error&&m.cause?`${S} (cause: ${p(m.cause,y)})`:S}if(typeof m=="string")return JSON.stringify(m);if(typeof m=="number"||m==null||typeof m=="boolean"||typeof m=="symbol")return String(m);if(typeof m=="bigint")return String(m)+"n";if(typeof m=="object"||typeof m=="function"){if(i.has(m))return j1;if(i.add(m),Zf in m)return Rt(Lx(m));if(Symbol.iterator in m)return`${m.constructor.name}(${p(Array.from(m),y)})`;const S=h(m);if(!u||S.length<=1){const _=`{${S.map(x=>`${ff(x)}:${p(m[x],y)}`).join(",")}}`;return d(m,_)}const v=`{
|
||||
${S.map(_=>`${o(y+1)}${ff(_)}: ${p(m[_],y+1)}`).join(`,
|
||||
`)}
|
||||
${o(y)}}`;return d(m,v)}return String(m)}return p(e,0)}const j1="[Circular]";function ff(e){return typeof e=="string"?JSON.stringify(e):String(e)}function AA(e){return e.map(n=>`[${ff(n)}]`).join("")}function MA(e){try{return e.toISOString()}catch{return"Invalid Date"}}function CA(e){try{const n=e.toString();return typeof n=="string"?n:String(n)}catch{return"[toString threw]"}}function jx(e,n){let s=[];const i=JSON.stringify(e,(u,o)=>typeof o=="object"&&o!==null?s.includes(o)?void 0:s.push(o)&&Wf(o):o,n?.space);return s=void 0,i}const Ws=Symbol.for("nodejs.util.inspect.custom"),Fa=e=>{try{if(Be(e,"toJSON")&&Qf(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Fa)}catch{return"[toJSON threw]"}return Wf(e)},kA=(e,n=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?UA(e,n):String(e)}catch{return String(e)}},UA=(e,n)=>{let s=[];const i=JSON.stringify(e,(u,o)=>typeof o=="object"&&o!==null?s.includes(o)?void 0:s.push(o)&&Wf(o):o,n);return s=void 0,i},B1={toJSON(){return Fa(this)},[Ws](){return this.toJSON()},toString(){return Rt(this.toJSON())}};class ed{called=!1;self;constructor(n){this.self=n}next(n){return this.called?{value:n,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new ed(this.self)}}const Pi="~effect/Effect/internal",Bx={[Pi]:e=>e()},zA={[Pi]:e=>e()},NA=Bx[Pi](()=>new Error().stack)?.includes(Pi)===!0,Wt=NA?Bx[Pi]:zA[Pi],ls="~effect/Effect",ku="~effect/Exit",DA={_A:_e,_E:_e,_R:_e},qx=`${ls}/identifier`,we=`${ls}/args`,Ht=`${ls}/evaluate`,kn=`${ls}/successCont`,_r=`${ls}/failureCont`,ja=`${ls}/ensureCont`,Aa=Symbol.for("effect/Effect/Yield"),Ar={pipe(){return bt(this,arguments)},toJSON(){return{...this}},toString(){return Rt(this.toJSON(),{ignoreToString:!0,space:2})},[Ws](){return this.toJSON()}},td={[Symbol.iterator](){return new ed(this)}},LA={...td,pipe(){return bt(this,arguments)}},jA={[ls]:DA,...Ar,[Symbol.iterator](){return new ed(this)},asEffect(){return this},toJSON(){return{_id:"Effect",op:this[qx],...we in this?{args:this[we]}:void 0}}},Xt=e=>Be(e,ls),$x=e=>Be(e,ku),Xo="~effect/Cause",Qo="~effect/Cause/Reason",nd=e=>Be(e,Xo),BA=e=>Be(e,Qo);class Ka{[Xo];reasons;constructor(n){this[Xo]=Xo,this.reasons=n}pipe(){return bt(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(n=>n.toJSON())}}toString(){return`Cause(${Rt(this.reasons)})`}[Ws](){return this.toJSON()}[nn](n){return nd(n)&&this.reasons.length===n.reasons.length&&this.reasons.every((s,i)=>$t(s,n.reasons[i]))}[tn](){return Dx(this.reasons)}}const q1=new WeakMap;class Hg{[Qo];annotations;_tag;constructor(n,s,i){if(this[Qo]=Qo,this._tag=n,s!==rd&&typeof i=="object"&&i!==null&&s.size>0){const u=q1.get(i);u&&(s=new Map([...u,...s])),q1.set(i,s)}this.annotations=s}annotate(n,s){if(n.mapUnsafe.size===0)return this;const i=new Map(this.annotations);n.mapUnsafe.forEach((o,d)=>{s?.overwrite!==!0&&i.has(d)||i.set(d,o)});const u=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return u.annotations=i,u}pipe(){return bt(this,arguments)}toString(){return Rt(this)}[Ws](){return this.toString()}}const rd=new Map;class Hx extends Hg{error;constructor(n,s=rd){super("Fail",s,n),this.error=n}toString(){return`Fail(${Rt(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[nn](n){return Yg(n)&&$t(this.error,n.error)&&$t(this.annotations,n.annotations)}[tn](){return Xn(Mt(this._tag))(Xn(Je(this.error))(Je(this.annotations)))}}const sd=e=>new Ka(e),qA=new Ka([]),Vg=e=>new Ka([new Hx(e)]);class Ig extends Hg{defect;constructor(n,s=rd){super("Die",s,n),this.defect=n}toString(){return`Die(${Rt(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[nn](n){return HA(n)&&$t(this.defect,n.defect)&&$t(this.annotations,n.annotations)}[tn](){return Xn(Mt(this._tag))(Xn(Je(this.defect))(Je(this.annotations)))}}const $A=e=>new Ka([new Ig(e)]),Hp=P(e=>nd(e[0]),(e,n,s)=>n.mapUnsafe.size===0?e:new Ka(e.reasons.map(i=>i.annotate(n,s)))),Yg=e=>e._tag==="Fail",HA=e=>e._tag==="Die",Gg=e=>e._tag==="Interrupt";function VA(e){return Xi("Effect.evaluate: Not implemented")}const Zu=e=>({...jA,[qx]:e.op,[Ht]:e[Ht]??VA,[kn]:e[kn],[_r]:e[_r],[ja]:e[ja]}),or=e=>{const n=Zu(e);return function(){const s=Object.create(n);return s[we]=e.single===!1?arguments:arguments[0],s}},Vx=e=>{const n={...Zu(e),[ku]:ku,_tag:e.op,get[e.prop](){return this[we]},toString(){return`${e.op}(${Rt(this[we])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[we]}},[nn](s){return $x(s)&&s._tag===this._tag&&$t(this[we],s[we])},[tn](){return Xn(Mt(e.op),Je(this[we]))}};return function(s){const i=Object.create(n);return i[we]=s,i}},et=Vx({op:"Success",prop:"value",[Ht](e){const n=e.getCont(kn);return n?n[kn](this[we],e,this):e.yieldWith(this)}}),ad={key:"effect/Cause/StackTrace"},IA={key:"effect/Cause/InterruptorStackTrace"},Jn=Vx({op:"Failure",prop:"cause",[Ht](e){let n=this[we],s=!1;e.currentStackFrame&&(n=Hp(n,{mapUnsafe:new Map([[ad.key,e.currentStackFrame]])}),s=!0);let i=e.get
Line truncated
|
||||
`);if(s.length>2){const i=s[2].match(/at (.*)/);i&&(n.message=n.message+` (defined at ${i[1]})`)}}if(n.stack){const s=n.stack.split(`
|
||||
`);s.splice(1,3),n.stack=s.join(`
|
||||
`)}return n},Ba=P(2,(e,n)=>{if(e.mapUnsafe.size===0)return n;if(n.mapUnsafe.size===0)return e;const s=new Map(e.mapUnsafe);return n.mapUnsafe.forEach((i,u)=>s.set(u,i)),ir(s)}),lC=(...e)=>{const n=new Map;for(let s=0;s<e.length;s++)e[s].mapUnsafe.forEach((i,u)=>{n.set(u,i)});return ir(n)},ft=Sn,Ji=ft("effect/Scheduler",{defaultValue:()=>new Nu}),oC="setImmediate"in globalThis?e=>{const n=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(n)}:e=>{const n=setTimeout(e,0);return()=>clearTimeout(n)};class fC{buckets=[];scheduleTask(n,s){const i=this.buckets,u=i.length;let o,d=0;for(;d<u&&!(i[d][0]>s);d++)o=i[d];o&&o[0]===s?o[1].push(n):d===u?i.push([s,[n]]):i.splice(d,0,[s,[n]])}drain(){const n=this.buckets;return this.buckets=[],n}}class Nu{tasks=new fC;running=void 0;executionMode;setImmediate;constructor(n="async",s=oC){this.executionMode=n,this.setImmediate=s}scheduleTask(n,s){this.tasks.scheduleTask(n,s),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){const n=this.tasks.drain();for(let s=0;s<n.length;s++){const i=n[s][1];for(let u=0;u<i.length;u++)i[u]()}}shouldYield(n){return n.currentOpCount>=n.maxOpsBeforeYield}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}}const dC=ft("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),hE="effect/Tracer/ParentSpan";class hC extends Sn()(hE){}const mC=e=>e,Fp=ft("effect/Tracer/DisablePropagation",{defaultValue:Ux}),pC=ft("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),gC=ft("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),mE="effect/Tracer",yC=ft(mE,{defaultValue:()=>mC({span:e=>new SC(e)})});class SC{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(n){this.name=n.name,this.parent=n.parent,this.annotations=n.annotations,this.links=n.links,this.startTime=n.startTime,this.kind=n.kind,this.sampled=n.sampled,this.status={_tag:"Started",startTime:n.startTime},this.attributes=new Map,this.traceId=n.parent?.traceId??Y1(32),this.spanId=Y1(16)}end(n,s){this.status={_tag:"Ended",endTime:n,exit:s,startTime:this.status.startTime}}attribute(n,s){this.attributes.set(n,s)}event(n,s,i){this.events.push([n,s,i??{}])}addLinks(n){this.links.push(...n)}}const Y1=(function(){const e="abcdef0123456789",n=e.length;return function(s){let i="";for(let u=0;u<s;u++)i+=e.charAt(Math.floor(Math.random()*n));return i}})(),vC=ft("effect/References/CurrentConcurrency",{defaultValue:()=>"unbounded"}),pE=ft("effect/References/CurrentStackFrame",{defaultValue:jg}),bC=ft("effect/References/TracerEnabled",{defaultValue:Pf}),gE=ft("effect/References/TracerTimingEnabled",{defaultValue:Pf}),_C=ft("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),xC=ft("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Zg=ft("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),EC=ft("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),wC=ft("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"}),TC=ft("effect/References/CurrentLogSpans",{defaultValue:()=>[]}),OC="effect/observability/Metric/FiberRuntimeMetricsKey",RC=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;const n=Error.stackTraceLimit;Error.stackTraceLimit=3;const s=new Error;return Error.stackTraceLimit=n,{...e,captureStackTrace:MC(()=>s.stack)}},AC=e=>n=>{let s;return()=>{if(s!==void 0)return s;const i=n();if(!i)return;const u=i.split(`
|
||||
`);if(u[e]!==void 0)return s=u[e].trim(),s}},MC=AC(3),CC="dev";let yE=class extends Hg{fiberId;constructor(n,s=rd){super("Interrupt",s,"Interrupted"),this.fiberId=n}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[nn](n){return Gg(n)&&this.fiberId===n.fiberId&&this.annotations===n.annotations}[tn](){return Xn(Mt(`${this._tag}:${this.fiberId}`))($p(this.annotations))}};const kC=e=>new yE(e),el=e=>new Ka([new yE(e)]),UC=e=>{const n=e.reasons.find(Yg);return n?fs(n):ur(e)},Pa=e=>{for(let n=0;n<e.reasons.length;n++){const s=e.reasons[n];if(s._tag==="Fail")return fs(s.error)}return ur(e)},zC=e=>e.reasons.some(Gg),Wg=e=>{let n;for(let s=0;s<e.reasons.length;s++){const i=e.reasons[s];i._tag==="Interrupt"&&(n??=new Set,i.fiberId!==void 0&&n.add(i.fiberId))}return n?fs(n):ur(e)},NC=e=>{const n=Wg(e);return ct(n)?DC:n.success},DC=new Set,LC=e=>e.reasons.every(Gg),jC=P(2,(e,n)=>{if(e.reasons.length===0)return n;if(n.reasons.length===0)return e;const s=new Ka(CM(e.reasons,n.reasons));return $t(e,s)?e:s}),BC=e=>{const n={Fail:[],Die:[],Interrupt:[]};for(let s=0;s<e.reasons.length;s++)n[e.reasons[s]._tag].push(e.reasons[s]);return n},SE=e=>{const n=BC(e);return n.Fail.length>0?n.Fail[0].error:n.Die.length>0?n.Die[0].defect:n.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},qC=e=>{const n=[],s=[];if(e.reasons.length===0)return n;const i=Error.stackTraceLimit;Error.stackTraceLimit=1;for(const u of e.reasons){if(u._tag==="Interrupt"){s.push(u);continue}n.push(Kp(u._tag==="Die"?u.defect:u.error,u.annotations))}if(n.length===0){const u=new Error("The fiber was interrupted by:");u.name="InterruptCause",u.stack=IC(u,s);const o=new globalThis.Error("All fibers interrupted without error",{cause:u});o.name="InterruptError",o.stack=`${o.name}: ${o.message}`,n.push(Kp(o,s[0].annotations))}return Error.stackTraceLimit=i,n},Kp=(e,n)=>{const s=typeof e;let i;if(e&&s==="object"){if(i=new globalThis.Error($C(e),{cause:e.cause?Kp(e.cause):void 0}),typeof e.name=="string"&&(i.name=e.name),typeof e.stack=="string")i.stack=VC(e.stack,i,n);else{const u=`${i.name}: ${i.message}`;i.stack=n?vE(u,n):u}for(const u of Object.keys(e))u in i||(i[u]=e[u])}else i=new globalThis.Error(e?s==="string"?e:jx(e):`Unknown error: ${e}`);return i},$C=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return jx(e)},HC=/\((.*)\)/g,VC=(e,n,s)=>{const i=`${n.name}: ${n.message}`,u=(e.startsWith(i)?e.slice(i.length):e).split(`
|
||||
`),o=[i];for(let d=1;d<u.length&&!/(?:Generator\.next|~effect\/Effect)/.test(u[d]);d++)o.push(u[d]);return s?vE(o.join(`
|
||||
`),s):o.join(`
|
||||
`)},vE=(e,n)=>{const s=n?.get(ad.key);return s&&(e=`${e}
|
||||
${bE(s)}`),e},IC=(e,n)=>{const s=[`${e.name}: ${e.message}`];for(const i of n){const u=i.fiberId!==void 0?`#${i.fiberId}`:"unknown",o=i.annotations.get(IA.key);s.push(` at fiber (${u})`),o&&s.push(bE(o))}return s.join(`
|
||||
`)},bE=e=>{const n=[];let s=e,i=0;for(;s&&i<10;){const u=s.stack();if(u){const o=u.matchAll(HC);let d=!1;for(const[,h]of o)d=!0,n.push(` at ${s.name} (${h})`);d||n.push(` at ${s.name} (${u.replace(/^at /,"")})`)}else n.push(` at ${s.name}`);s=s.parent,i++}return n.join(`
|
||||
`)},e0=e=>qC(e).map(n=>n.cause?`${n.stack} {
|
||||
${_E(n.cause," ")}
|
||||
}`:n.stack).join(`
|
||||
`),_E=(e,n)=>{const s=e.stack.split(`
|
||||
`);let i=`${n}[cause]: ${s[0]}`;for(let u=1,o=s.length;u<o;u++)i+=`
|
||||
${n}${s[u]}`;return e.cause&&(i+=` {
|
||||
${_E(e.cause,`${n} `)}
|
||||
${n}}`),i},Pp=`~effect/Fiber/${CC}`,YC={_A:_e,_E:_e},GC={id:0},xE=()=>globalThis[Su];class EE{constructor(n,s=!0){this[Pp]=YC,this.setServices(n),this.id=++GC.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=s,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}[Pp];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;services;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;getRef(n){return cC(this.services,n)}addObserver(n){return this._exit?(n(this._exit),cc):(this._observers.push(n),()=>{const s=this._observers.indexOf(n);s>=0&&this._observers.splice(s,1)})}interruptUnsafe(n,s){if(this._exit)return;let i=el(n);this.currentStackFrame&&(i=Hp(i,Qi(ad,this.currentStackFrame))),s&&(i=Hp(i,s)),this._interruptedCause=this._interruptedCause?jC(this._interruptedCause,i):i,this.interruptible&&this.evaluate(en(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(n){if(this.runtimeMetrics?.recordFiberStart(this.services),this._exit)return;if(this._yielded!==void 0){const i=this._yielded;this._yielded=void 0,i()}const s=this.runLoop(n);if(s!==Aa){this._exit=s,this.runtimeMetrics?.recordFiberEnd(this.services,this._exit);for(let i=0;i<this._observers.length;i++)this._observers[i](s);this._observers.length=0}}runLoop(n){const s=globalThis[Su];globalThis[Su]=this;let i=!1,u=n;this.currentOpCount=0;const o=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!i&&this.currentScheduler.shouldYield(this)){i=!0;const d=u;u=qe(n0,()=>d)}if(u=this.currentTracerContext?this.currentTracerContext(u,this):u[Ht](this),o!==this.currentLoopCount)return Aa;if(u===Aa){const d=this._yielded;return ku in d?(this._yielded=void 0,d):Aa}}}catch(d){return Be(u,Ht)?this.runLoop(Xi(d)):Xi(`Fiber.runLoop: Not a valid effect: ${String(u)}`)}finally{globalThis[Su]=s}}getCont(n){for(;;){const s=this._stack.pop();if(!s)return;const i=s[ja]&&s[ja](this);if(i)return i[n]=i,i;if(s[n])return s}}yieldWith(n){return this._yielded=n,Aa}children(){return this._children??=new Set}pipe(){return bt(this,arguments)}setServices(n){this.services=n,this.currentScheduler=this.getRef(Ji),this.currentSpan=n.mapUnsafe.get(hE),this.currentLogLevel=this.getRef(EC),this.minimumLogLevel=this.getRef(wC),this.currentStackFrame=n.mapUnsafe.get(pE.key),this.maxOpsBeforeYield=this.getRef(dC),this.runtimeMetrics=n.mapUnsafe.get(OC);const s=n.mapUnsafe.get(mE);this.currentTracerContext=s?s.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}const cd=e=>{if(!e.currentStackFrame)return;const n=new Map;return n.set(ad.key,e.currentStackFrame),ir(n)},FC=e=>{const n=e;return n._exit?ve(n._exit):an(s=>n._exit?s(ve(n._exit)):lt(e.addObserver(i=>s(ve(i)))))},wE=e=>an(n=>{const s=e[Symbol.iterator](),i=[];let u;function o(){let d=s.next();for(;!d.done;){if(d.value._exit){i.push(d.value._exit),d=s.next();continue}u=d.value.addObserver(h=>{i.push(h),o()});return}n(ve(i))}return o(),lt(()=>u?.())}),KC=e=>{const n=e;return n._exit?n._exit:an(s=>n._exit?s(n._exit):lt(e.addObserver(s)))},PC=e=>an(n=>{const s=Array.from(e);if(s.length===0)return n(ve(Ip()));const i=new Array(s.length),u=Ip();let o=0,d=!1;for(let h=0;h<s.length&&!d;h++)u.push(s[h].addObserver(p=>{if(o++,p._tag==="Failure")return d=!0,u.forEach(m=>m()),n(p);i[h]=p.value,o===s.length&&n(ve(i))}))}),t0=e=>Ve(n=>XC(e,n.id)),XC=P(e=>Be(e[0],Pp),(e,n,s)=>Ve(i=>{let u=cd(i);return u=u&&s?Ba(u,s):u??s,e.interruptUnsafe(n,u),ld(FC(e))})),mf=e=>Ve(n=>{const s=cd(n);for(const i of e)i.interruptUnsafe(n.id,s);return ld(wE(e))}),ve=et,en=Jn,ud=Mr,lt=or({op:"Sync",[Ht](e){const n=this[we](),s=e.getCont(kn);return s?s[kn](n,e):e.yieldWith(et(n))}}),ot=or({op:"Suspend",[Ht](e){return this[we]()}}),QC=or({op:"Yield",[Ht](e){let n=!1;return e.currentScheduler.scheduleTask(()=>{n||e.evaluate(Or)},this[we]??0),e.yieldWith(()=>{n=!0})}}),n0=QC(0),JC=e=>ve(Te(e)),r0=ve(Ct()),s0=e=>Xi(e),TE=e=>ot(()=>ud(Wt(e))),kt=ve(void 0),ZC=e=>OE(function(n,s){Wt(()=>e(s)).then(i=>n(ve(i)),i=>n(s0(i)))},e.length!==0),WC=e=>Ve(n=>e(n.id)),OE=or({op:"Async",single:!1,[Ht](e){const n=Wt(()=>this[we][0].bind(e.currentScheduler));let s=!1,i=!1;const u=this[we][1]?new AbortController:void 0,o=n(d=>{s||(s=!0,i?e.evaluate(d):i=d)},u?.signal);return i!==!1?i:(i=!0,e._yielded=()=>{s=!0},u===void 0&&o===void 0||e._stack.push(e3(()=>(s=!0,u?.abort(),o??Or))),Aa)}}),e3=or({op:"AsyncFinalizer",[ja](e){e.interruptible&&(e.interruptible=!1,e._stack.push(gd))},[_r](e,n){return zC(e)?qe(this[we](),()=>en(e)):en(e)}}),an=e=>OE(e,e.length>=2),t3=an(cc),n3=(...e)=>ot(()=>Du(e.length===1?e[0]():e[1].call(e[0].self))),RE=(e,...n)=>{const s=n.length===0?function(){return ot(()=>Du(e.apply(this,arguments)))}:function(){let i=ot(()=>Du(e.apply(this,arguments)));for(let u=0;u<n
Line truncated
|
||||
`)}const yz=gz();function Sz(e){let n=e.message;if(e.path&&e.path.length>0){const s=AA(e.path);n+=`
|
||||
at ${s}`}return n}function Yu(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return uu(e.ast.annotations);case"InvalidValue":case"Forbidden":return uu(e.annotations);case"MissingKey":return uu(e.annotations,"messageMissingKey");case"UnexpectedKey":return uu(e.ast.annotations,"messageUnexpectedKey");case"Filter":return uu(e.filter.annotations);case"Encoding":return Yu(e.issue)}}function uu(e,n="message"){const s=e?.[n];if(typeof s=="string")return s}function h_(e){return os(e)?"no value provided":Rt(e.value)}class ec extends Kf{run;constructor(n){super(),this.run=n}map(n){return new ec((s,i)=>this.run(s,i).pipe(vw(Pg(n))))}compose(n){return m_(this)?n:m_(n)?this:new ec((s,i)=>this.run(s,i).pipe(Ii(u=>n.run(u,i))))}}const Uw=new ec(Ee);function m_(e){return e.run===Uw.run}function tc(){return Uw}function pn(e){return vz(Pg(e))}function vz(e){return new ec(n=>Ee(e(n)))}function bz(){return pn(globalThis.String)}function zw(){return pn(globalThis.Number)}const og="~effect/SchemaTransformation/Transformation";class gn{[og]=og;_tag="Transformation";decode;encode;constructor(n,s){this.decode=n,this.encode=s}flip(){return new gn(this.encode,this.decode)}compose(n){return new gn(this.decode.compose(n.decode),n.encode.compose(this.encode))}}function _z(e){return Be(e,og)}const Nw=e=>_z(e)?e:new gn(e.decode,e.encode);function Ed(e){return new gn(pn(e.decode),pn(e.encode))}const xz=new gn(tc(),tc());function $0(){return xz}const Dw=new gn(zw(),bz()),Lw=e=>Ed({decode:n=>{const s=new Error(n.message);return typeof n.name=="string"&&n.name!=="Error"&&(s.name=n.name),typeof n.stack=="string"&&(s.stack=n.stack),s},encode:n=>{const s={name:n.name,message:n.message};return e?.includeStack&&typeof n.stack=="string"&&(s.stack=n.stack),s}});function Ja(e){return n=>n._tag===e}const jw=Ja("Declaration"),Ez=Ja("Never"),Of=Ja("Literal"),wz=Ja("UniqueSymbol"),Tz=Ja("Arrays"),Oz=Ja("Objects"),Rz=Ja("Union");let Vt=class{to;transformation;constructor(n,s){this.to=n,this.transformation=s}};const Az={};class nc{isOptional;isMutable;defaultValue;annotations;constructor(n,s,i=void 0,u=void 0){this.isOptional=n,this.isMutable=s,this.defaultValue=i,this.annotations=u}}const p_="~effect/Schema";class vn{[p_]=p_;annotations;checks;encoding;context;constructor(n=void 0,s=void 0,i=void 0,u=void 0){this.annotations=n,this.checks=s,this.encoding=i,this.context=u}toString(){return`<${this._tag}>`}}class ol extends vn{_tag="Declaration";typeParameters;run;constructor(n,s,i,u,o,d){super(i,u,o,d),this.typeParameters=n,this.run=s}getParser(){const n=this.run(this.typeParameters);return(s,i)=>os(s)?b0:vw(n(s.value,this,i),Te)}recur(n){const s=rc(this.typeParameters,n);return s===this.typeParameters?this:new ol(s,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){const n=this.annotations?.expected;return typeof n=="string"?n:"<Declaration>"}}class Mz extends vn{_tag="Null";getParser(){return Od(this,null)}getExpected(){return"null"}}const Bw=new Mz;let Cz=class extends vn{_tag="Undefined";getParser(){return Od(this,void 0)}toCodecJson(){return qt(this,[qw])}getExpected(){return"undefined"}};const qw=new Vt(Bw,new gn(pn(()=>{}),pn(()=>null))),kz=new Cz;let Uz=class extends vn{_tag="Void";getParser(){return Od(this,void 0)}toCodecJson(){return qt(this,[qw])}getExpected(){return"void"}};const zz=new Uz;let Nz=class extends vn{_tag="Never";getParser(){return Za(this,uA)}getExpected(){return"never"}};const Dz=new Nz;let Lz=class extends vn{_tag="Any";getParser(){return Za(this,Nx)}getExpected(){return"any"}};const jz=new Lz;let Bz=class extends vn{_tag="Unknown";getParser(){return Za(this,Nx)}getExpected(){return"unknown"}};const H0=new Bz;let Tu=class extends vn{_tag="Literal";literal;constructor(n,s,i,u,o){if(super(s,i,u,o),typeof n=="number"&&!globalThis.Number.isFinite(n))throw new Error(`A numeric literal must be finite, got ${Rt(n)}`);this.literal=n}getParser(){return Od(this,this.literal)}toCodecJson(){return typeof this.literal=="bigint"?g_(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:g_(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function g_(e){const n=globalThis.String(e.literal);return qt(e,[new Vt(new Tu(n),new gn(pn(()=>e.literal),pn(()=>n)))])}let qz=class extends vn{_tag="String";getParser(){return Za(this,Xf)}getExpected(){return"string"}};const $w=new qz;let $z=class extends vn{_tag="Number";getParser(){return Za(this,of)}toCodecJson(){return this.checks&&(gu(this.checks,"isFinite")||gu(this.checks,"isInt"))?this:qt(this,[Kz])}toCodecStringTree(){return this.checks&&(gu(this.checks,"isFinite")||gu(this.checks,"isInt"))?qt(this,[sN]):qt(this,[aN])}getExpected(){return"number"}};function gu(e,n){return e.some(s=>{switch(s._tag){case"Filter":return s.annotations?.meta?._tag===n;case"FilterGroup":return gu(s.checks,n)}})}const Hw=new $z;let Hz=class extends vn{_tag="Boolean";getParser(){ret
Line truncated
|
||||
`)[5]??""]})),z6=P(2,(e,n)=>x6(e)?gl(s=>n(s,e),function(s,i){s.set(e,i)},e.refresh??function(s){s(e)}):Xs(s=>n(s,e),e.refresh??function(s){s(e)})),N6=y6,j_="~effect-atom/atom/Atom/ServerValue",D6=P(2,(e,n)=>j_ in e?e[j_](s=>n.get(s)):n.get(e));var bp=Cx();function LT(e){const n=bp.unstable_scheduleCallback(bp.unstable_LowPriority,e);return()=>bp.unstable_cancelCallback(n)}const kd=le.createContext(AT({scheduleTask:LT,defaultIdleTTL:400})),L6=e=>{const n=le.useRef(null);return n.current===null&&(n.current={registry:AT({scheduleTask:e.scheduleTask??LT,initialValues:e.initialValues,timeoutResolution:e.timeoutResolution,defaultIdleTTL:e.defaultIdleTTL})}),le.useEffect(()=>(n.current?.timeout!==void 0&&clearTimeout(n.current.timeout),()=>{n.current.timeout=setTimeout(()=>{n.current?.registry.dispose(),n.current=null},500)}),[n]),le.createElement(kd.Provider,{value:n.current.registry},e?.children)},B_=new WeakMap;function j6(e,n){let s=B_.get(e);s===void 0&&(s=new WeakMap,B_.set(e,s));const i=s.get(n);if(i!==void 0)return i;const u={subscribe(o){return e.subscribe(n,o)},snapshot(){return e.get(n)},getServerSnapshot(){return D6(n,e)}};return s.set(n,u),u}function B6(e,n){const s=j6(e,n);return le.useSyncExternalStore(s.subscribe,s.snapshot,s.getServerSnapshot)}const ta=(e,n)=>{const s=le.useContext(kd);return B6(s,e)};function jT(e,n){le.useEffect(()=>e.mount(n),[n,e])}function q6(e,n,s){return s?.mode==="promise"||s?.mode==="promiseExit"?le.useCallback(i=>{e.set(n,i);const u=G4(u6(e,n,{suspendOnWaiting:!0}));return s.mode==="promise"?u.then($6):u},[e,n,s.mode]):le.useCallback(i=>{e.set(n,typeof i=="function"?i(e.get(n)):i)},[e,n])}const $6=e=>{if(ew(e))return e.value;throw JE(e.cause)},Wr=(e,n)=>{const s=le.useContext(kd);return jT(s,e),q6(s,e,n)},H6=e=>{const n=le.useContext(kd);return jT(n,e),le.useCallback(()=>{n.refresh(e)},[n,e])};var it=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(it||{});function BT({update:e,notify:n,unwatched:s}){return{link:i,unlink:u,propagate:o,checkDirty:d,shallowPropagate:h};function i(m,y,S){const v=y.depsTail;if(v!==void 0&&v.dep===m)return;const _=v!==void 0?v.nextDep:y.deps;if(_!==void 0&&_.dep===m){_.version=S,y.depsTail=_;return}const x=m.subsTail;if(x!==void 0&&x.version===S&&x.sub===y)return;const T=y.depsTail=m.subsTail={version:S,dep:m,sub:y,prevDep:v,nextDep:_,prevSub:x,nextSub:void 0};_!==void 0&&(_.prevDep=T),v!==void 0?v.nextDep=T:y.deps=T,x!==void 0?x.nextSub=T:m.subs=T}function u(m,y=m.sub){const S=m.dep,v=m.prevDep,_=m.nextDep,x=m.nextSub,T=m.prevSub;return _!==void 0?_.prevDep=v:y.depsTail=v,v!==void 0?v.nextDep=_:y.deps=_,x!==void 0?x.prevSub=T:S.subsTail=T,T!==void 0?T.nextSub=x:(S.subs=x)===void 0&&s(S),_}function o(m){let y=m.nextSub,S;e:do{const v=m.sub;let _=v.flags;if(_&60?_&12?_&4?!(_&48)&&p(m,v)?(v.flags=_|40,_&=1):_=0:v.flags=_&-9|32:_=0:v.flags=_|32,_&2&&n(v),_&1){const x=v.subs;if(x!==void 0){const T=(m=x).nextSub;T!==void 0&&(S={value:y,prev:S},y=T);continue}}if((m=y)!==void 0){y=m.nextSub;continue}for(;S!==void 0;)if(m=S.value,S=S.prev,m!==void 0){y=m.nextSub;continue e}break}while(!0)}function d(m,y){let S,v=0,_=!1;e:do{const x=m.dep,T=x.flags;if(y.flags&16)_=!0;else if((T&17)===17){if(e(x)){const j=x.subs;j.nextSub!==void 0&&h(j),_=!0}}else if((T&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(S={value:m,prev:S}),m=x.deps,y=x,++v;continue}if(!_){const j=m.nextDep;if(j!==void 0){m=j;continue}}for(;v--;){const j=y.subs,B=j.nextSub!==void 0;if(B?(m=S.value,S=S.prev):m=j,_){if(e(y)){B&&h(j),y=m.sub;continue}_=!1}else y.flags&=-33;y=m.sub;const M=m.nextDep;if(M!==void 0){m=M;continue e}}return _}while(!0)}function h(m){do{const y=m.sub,S=y.flags;(S&48)===32&&(y.flags=S|16,(S&6)===2&&n(y))}while((m=m.nextSub)!==void 0)}function p(m,y){let S=y.depsTail;for(;S!==void 0;){if(S===m)return!0;S=S.prevDep}return!1}}let cy=0,Oa=0,Au=0;const es=[],{link:rB,unlink:qT,propagate:sB,checkDirty:V6,shallowPropagate:aB}=BT({update(e){return e.depsTail!==void 0?F6(e):K6(e)},notify(e){let n=Au,s=n;do if(es[n++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(Au=n;s<--n;){const i=es[s];es[s++]=es[n],es[n]=i}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ud(e)):Q6.call(e)}});function I6(){return cy}function Y6(){++cy}function G6(){--cy||X6()}function F6(e){e.depsTail=void 0,e.flags=5;try{const n=e.value;return n!==(e.value=e.getter(n))}finally{e.flags&=-5,Ud(e)}}function K6(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function P6(e){const n=e.flags;if(n&16||n&32&&V6(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Ud(e)}}else e.flags=2}function X6(){try{for(;Oa<Au;){const e=es[Oa];es[Oa++]=void 0,P6(e)}}finally{for(;Oa<Au;){const e=es[Oa];es[Oa++]=void 0,e.flags|=10}Oa=0,Au=0}}function Q6(){this.depsTail=void 0,this.flags=0,Ud(
Line truncated
|
||||
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>effect-http-ws-cli rpc console</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/assets/index-CuY7i06l.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Bz7MwgeQ.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
import { spawn } from "node:child_process"
|
||||
|
||||
const frontendDevOrigin = process.env.FRONTEND_DEV_ORIGIN ?? "http://127.0.0.1:5173"
|
||||
const frontendDevUrl = new URL(frontendDevOrigin)
|
||||
|
||||
if (frontendDevUrl.protocol !== "http:" && frontendDevUrl.protocol !== "https:") {
|
||||
throw new Error(`FRONTEND_DEV_ORIGIN must use http or https, received ${frontendDevOrigin}`)
|
||||
}
|
||||
|
||||
const frontendHost = process.env.FRONTEND_DEV_HOST ?? frontendDevUrl.hostname
|
||||
const frontendPort = process.env.FRONTEND_DEV_PORT ?? (frontendDevUrl.port || "5173")
|
||||
const serverArgs = process.argv.slice(2)
|
||||
|
||||
const readFlagValue = (name) => {
|
||||
const index = serverArgs.findIndex((arg) => arg === name)
|
||||
if (index >= 0) {
|
||||
return serverArgs[index + 1]
|
||||
}
|
||||
|
||||
const prefixed = serverArgs.find((arg) => arg.startsWith(`${name}=`))
|
||||
return prefixed ? prefixed.slice(name.length + 1) : undefined
|
||||
}
|
||||
|
||||
const normalizeBackendHost = (host) => {
|
||||
if (!host || host === "0.0.0.0" || host === "::") {
|
||||
return "127.0.0.1"
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
const backendHost = normalizeBackendHost(process.env.HOST ?? readFlagValue("--host"))
|
||||
const backendPort = process.env.PORT ?? readFlagValue("--port") ?? "8787"
|
||||
const backendOrigin = process.env.VITE_BACKEND_ORIGIN ?? `http://${backendHost}:${backendPort}`
|
||||
|
||||
const children = new Set()
|
||||
let shuttingDown = false
|
||||
|
||||
const stopChildren = (signal = "SIGTERM") => {
|
||||
if (shuttingDown) {
|
||||
return
|
||||
}
|
||||
shuttingDown = true
|
||||
for (const child of children) {
|
||||
if (!child.killed) {
|
||||
child.kill(signal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const spawnChild = (command, args, env = {}) => {
|
||||
const child = spawn(command, args, {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
...process.env,
|
||||
...env
|
||||
}
|
||||
})
|
||||
|
||||
children.add(child)
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
stopChildren(signal ?? "SIGTERM")
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal)
|
||||
return
|
||||
}
|
||||
process.exit(code ?? 0)
|
||||
})
|
||||
|
||||
return child
|
||||
}
|
||||
|
||||
spawnChild("bun", [
|
||||
"run",
|
||||
"--filter",
|
||||
"@effect-http-ws-cli/web",
|
||||
"dev",
|
||||
"--",
|
||||
"--host",
|
||||
frontendHost,
|
||||
"--port",
|
||||
frontendPort,
|
||||
"--strictPort"
|
||||
], {
|
||||
VITE_BACKEND_ORIGIN: backendOrigin
|
||||
})
|
||||
|
||||
spawnChild("node", ["server/src/bin.ts", ...serverArgs], {
|
||||
FRONTEND_DEV_ORIGIN: frontendDevOrigin
|
||||
})
|
||||
|
||||
for (const signal of ["SIGINT", "SIGTERM"]) {
|
||||
process.on(signal, () => stopChildren(signal))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@effect-http-ws-cli/server",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./client": "./src/client.ts",
|
||||
"./contracts": "./src/contracts.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node src/bin.ts",
|
||||
"start": "node src/bin.ts",
|
||||
"test": "vitest run",
|
||||
"lint": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-node": "catalog:",
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "^24.10.0",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
|
||||
export default Effect.gen(function*() {
|
||||
const sql = yield* SqlClient.SqlClient
|
||||
|
||||
yield* sql`
|
||||
CREATE TABLE IF NOT EXISTS todos (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
completed INTEGER NOT NULL,
|
||||
archived INTEGER NOT NULL,
|
||||
revision INTEGER NOT NULL,
|
||||
updated_at TEXT NOT NULL
|
||||
)
|
||||
`
|
||||
|
||||
yield* sql`
|
||||
CREATE TABLE IF NOT EXISTS todo_events (
|
||||
event_offset INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
at TEXT NOT NULL,
|
||||
todo_json TEXT NOT NULL,
|
||||
change_json TEXT NOT NULL,
|
||||
archived INTEGER NOT NULL
|
||||
)
|
||||
`
|
||||
|
||||
yield* sql`
|
||||
CREATE INDEX IF NOT EXISTS idx_todo_events_archived_offset
|
||||
ON todo_events (archived, event_offset)
|
||||
`
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices"
|
||||
import * as Effect from "effect/Effect"
|
||||
import { cli } from "./cli.ts"
|
||||
import { Command } from "effect/unstable/cli"
|
||||
|
||||
Command.run(cli, { version: "0.1.0" }).pipe(
|
||||
Effect.provide(NodeServices.layer),
|
||||
NodeRuntime.runMain
|
||||
)
|
||||
@@ -0,0 +1,125 @@
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { Command, Flag } from "effect/unstable/cli"
|
||||
import * as Config from "effect/Config"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as FileSystem from "effect/FileSystem"
|
||||
import * as Option from "effect/Option"
|
||||
import * as Path from "effect/Path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { ServerConfig } from "./config.ts"
|
||||
import { runMigrations } from "./migrations.ts"
|
||||
import { runServer } from "./server.ts"
|
||||
import type { ServerConfigData } from "./config.ts"
|
||||
|
||||
const defaultAssetsDir = fileURLToPath(new URL("../../public", import.meta.url))
|
||||
const defaultDbFilename = fileURLToPath(new URL("../../todo.sqlite", import.meta.url))
|
||||
|
||||
const hostFlag = Flag.string("host").pipe(
|
||||
Flag.withDescription("Host interface to bind"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const portFlag = Flag.integer("port").pipe(
|
||||
Flag.withDescription("Port to listen on"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const assetsFlag = Flag.directory("assets").pipe(
|
||||
Flag.withDescription("Directory of static assets"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const dbFlag = Flag.string("db").pipe(
|
||||
Flag.withDescription("SQLite database filename"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const requestLoggingFlag = Flag.boolean("request-logging").pipe(
|
||||
Flag.withDescription("Enable request logging"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const frontendDevOriginFlag = Flag.string("frontend-dev-origin").pipe(
|
||||
Flag.withDescription("Redirect frontend GET requests to a Vite dev server origin"),
|
||||
Flag.optional
|
||||
)
|
||||
|
||||
const EnvServerConfig = Config.unwrap({
|
||||
host: Config.string("HOST").pipe(Config.withDefault("127.0.0.1")),
|
||||
port: Config.port("PORT").pipe(Config.withDefault(8787)),
|
||||
assetsDir: Config.string("ASSETS_DIR").pipe(Config.withDefault(defaultAssetsDir)),
|
||||
dbFilename: Config.string("DB_FILENAME").pipe(Config.withDefault(defaultDbFilename)),
|
||||
requestLogging: Config.boolean("REQUEST_LOGGING").pipe(Config.withDefault(true)),
|
||||
frontendDevOrigin: Config.string("FRONTEND_DEV_ORIGIN").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined)
|
||||
)
|
||||
})
|
||||
|
||||
export interface CliServerFlags {
|
||||
readonly host: Option.Option<string>
|
||||
readonly port: Option.Option<number>
|
||||
readonly assets: Option.Option<string>
|
||||
readonly db: Option.Option<string>
|
||||
readonly requestLogging: Option.Option<boolean>
|
||||
readonly frontendDevOrigin: Option.Option<string>
|
||||
}
|
||||
|
||||
export const resolveServerConfig = (
|
||||
flags: CliServerFlags
|
||||
): Effect.Effect<ServerConfigData, Config.ConfigError> =>
|
||||
Effect.gen(function*() {
|
||||
const env = yield* EnvServerConfig
|
||||
return {
|
||||
host: Option.getOrElse(flags.host, () => env.host),
|
||||
port: Option.getOrElse(flags.port, () => env.port),
|
||||
assetsDir: Option.getOrElse(flags.assets, () => env.assetsDir),
|
||||
dbFilename: Option.getOrElse(flags.db, () => env.dbFilename),
|
||||
requestLogging: Option.getOrElse(flags.requestLogging, () => env.requestLogging),
|
||||
frontendDevOrigin: Option.getOrElse(flags.frontendDevOrigin, () => env.frontendDevOrigin)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export const resetDatabase = (dbFilename: string) =>
|
||||
Effect.gen(function*() {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const path = yield* Path.Path
|
||||
|
||||
if (dbFilename !== ":memory:") {
|
||||
yield* fs.remove(path.resolve(dbFilename), { force: true })
|
||||
}
|
||||
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({
|
||||
filename: dbFilename
|
||||
})
|
||||
|
||||
yield* runMigrations.pipe(Effect.provide(sqliteLayer))
|
||||
})
|
||||
|
||||
const commandFlags = {
|
||||
host: hostFlag,
|
||||
port: portFlag,
|
||||
assets: assetsFlag,
|
||||
db: dbFlag,
|
||||
requestLogging: requestLoggingFlag,
|
||||
frontendDevOrigin: frontendDevOriginFlag
|
||||
} as const
|
||||
|
||||
const rootCommand = Command.make("effect-http-ws-cli", commandFlags).pipe(
|
||||
Command.withDescription("Run a unified Effect HTTP + WebSocket server"),
|
||||
Command.withHandler((flags) =>
|
||||
Effect.flatMap(resolveServerConfig(flags), (config) =>
|
||||
runServer.pipe(Effect.provideService(ServerConfig, config)))),
|
||||
)
|
||||
|
||||
const resetCommand = Command.make("reset", commandFlags).pipe(
|
||||
Command.withDescription("Delete the SQLite database file and rerun migrations"),
|
||||
Command.withHandler((flags) =>
|
||||
Effect.flatMap(resolveServerConfig(flags), (config) => resetDatabase(config.dbFilename))
|
||||
)
|
||||
)
|
||||
|
||||
export const cli = rootCommand.pipe(
|
||||
Command.withSubcommands([resetCommand])
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
import { NodeSocket } from "@effect/platform-node"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as RpcClient from "effect/unstable/rpc/RpcClient"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as Stream from "effect/Stream"
|
||||
import { WsRpcGroup } from "./contracts.ts"
|
||||
|
||||
export const wsRpcProtocolLayer = (wsUrl: string) =>
|
||||
RpcClient.layerProtocolSocket().pipe(
|
||||
Layer.provide(NodeSocket.layerWebSocket(wsUrl)),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
export const makeWsRpcClient = RpcClient.make(WsRpcGroup)
|
||||
type WsRpcClient = typeof makeWsRpcClient extends Effect.Effect<infer Client, any, any> ? Client : never
|
||||
|
||||
export const withWsRpcClient = <A, E, R>(
|
||||
wsUrl: string,
|
||||
f: (client: WsRpcClient) => Effect.Effect<A, E, R>
|
||||
) =>
|
||||
makeWsRpcClient.pipe(
|
||||
Effect.flatMap(f),
|
||||
Effect.provide(wsRpcProtocolLayer(wsUrl))
|
||||
)
|
||||
|
||||
export const runClientExample = (wsUrl: string) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const echoed = yield* client.echo({ text: "hello from client" })
|
||||
const summed = yield* client.sum({ left: 20, right: 22 })
|
||||
const time = yield* client.time(undefined)
|
||||
return { echoed, summed, time }
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
export const runSubscriptionExample = (wsUrl: string, modelId: string) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const todo = snapshot.todos[0]
|
||||
if (!todo) {
|
||||
return []
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: todo.id, title: `${modelId}: first` })
|
||||
yield* client.completeTodo({ id: todo.id, completed: true })
|
||||
|
||||
return yield* client.subscribeTodos({ fromOffset: snapshot.offset, includeArchived: true }).pipe(
|
||||
Stream.take(2),
|
||||
Stream.runCollect
|
||||
)
|
||||
})
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
|
||||
export interface ServerConfigData {
|
||||
readonly host: string
|
||||
readonly port: number
|
||||
readonly assetsDir: string
|
||||
readonly dbFilename: string
|
||||
readonly requestLogging: boolean
|
||||
readonly frontendDevOrigin: string | undefined
|
||||
}
|
||||
|
||||
export class ServerConfig extends ServiceMap.Service<ServerConfig, ServerConfigData>()(
|
||||
"effect-http-ws-cli/ServerConfig"
|
||||
) {}
|
||||
@@ -0,0 +1,132 @@
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as Rpc from "effect/unstable/rpc/Rpc"
|
||||
import * as RpcGroup from "effect/unstable/rpc/RpcGroup"
|
||||
|
||||
export const EchoPayload = Schema.Struct({
|
||||
text: Schema.String
|
||||
})
|
||||
|
||||
export const EchoResult = Schema.Struct({
|
||||
text: Schema.String
|
||||
})
|
||||
|
||||
export const SumPayload = Schema.Struct({
|
||||
left: Schema.Number,
|
||||
right: Schema.Number
|
||||
})
|
||||
|
||||
export const SumResult = Schema.Struct({
|
||||
total: Schema.Number
|
||||
})
|
||||
|
||||
export const TimeResult = Schema.Struct({
|
||||
iso: Schema.String
|
||||
})
|
||||
|
||||
export const Todo = Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String,
|
||||
completed: Schema.Boolean,
|
||||
archived: Schema.Boolean,
|
||||
revision: Schema.Number,
|
||||
updatedAt: Schema.String
|
||||
})
|
||||
export type Todo = Schema.Schema.Type<typeof Todo>
|
||||
|
||||
export const TodoChange = Schema.Union([
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoCreated")
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoRenamed"),
|
||||
title: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoCompleted"),
|
||||
completed: Schema.Boolean
|
||||
}),
|
||||
Schema.Struct({
|
||||
_tag: Schema.Literal("TodoArchived"),
|
||||
archived: Schema.Boolean
|
||||
})
|
||||
])
|
||||
export type TodoChange = Schema.Schema.Type<typeof TodoChange>
|
||||
|
||||
export const TodoEvent = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
at: Schema.String,
|
||||
todo: Todo,
|
||||
change: TodoChange
|
||||
})
|
||||
export type TodoEvent = Schema.Schema.Type<typeof TodoEvent>
|
||||
|
||||
export const TodoSnapshot = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
todos: Schema.Array(Todo)
|
||||
})
|
||||
export type TodoSnapshot = Schema.Schema.Type<typeof TodoSnapshot>
|
||||
|
||||
export const EchoRpc = Rpc.make("echo", {
|
||||
payload: EchoPayload,
|
||||
success: EchoResult
|
||||
})
|
||||
|
||||
export const SumRpc = Rpc.make("sum", {
|
||||
payload: SumPayload,
|
||||
success: SumResult
|
||||
})
|
||||
|
||||
export const TimeRpc = Rpc.make("time", {
|
||||
success: TimeResult
|
||||
})
|
||||
|
||||
export const ListTodosRpc = Rpc.make("listTodos", {
|
||||
payload: Schema.Struct({
|
||||
includeArchived: Schema.Boolean
|
||||
}),
|
||||
success: TodoSnapshot
|
||||
})
|
||||
|
||||
export const RenameTodoRpc = Rpc.make("renameTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const CompleteTodoRpc = Rpc.make("completeTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
completed: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const ArchiveTodoRpc = Rpc.make("archiveTodo", {
|
||||
payload: Schema.Struct({
|
||||
id: Schema.String,
|
||||
archived: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent
|
||||
})
|
||||
|
||||
export const SubscribeTodosRpc = Rpc.make("subscribeTodos", {
|
||||
payload: Schema.Struct({
|
||||
fromOffset: Schema.Number,
|
||||
includeArchived: Schema.Boolean
|
||||
}),
|
||||
success: TodoEvent,
|
||||
stream: true
|
||||
})
|
||||
|
||||
export const WsRpcGroup = RpcGroup.make(
|
||||
EchoRpc,
|
||||
SumRpc,
|
||||
TimeRpc,
|
||||
ListTodosRpc,
|
||||
RenameTodoRpc,
|
||||
CompleteTodoRpc,
|
||||
ArchiveTodoRpc,
|
||||
SubscribeTodosRpc
|
||||
)
|
||||
@@ -0,0 +1,73 @@
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as SchemaTransformation from "effect/SchemaTransformation"
|
||||
|
||||
export const ClientMessage = Schema.Union([
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("echo"),
|
||||
text: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("sum"),
|
||||
left: Schema.Number,
|
||||
right: Schema.Number
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("time")
|
||||
})
|
||||
])
|
||||
|
||||
export type ClientMessage = Schema.Schema.Type<typeof ClientMessage>
|
||||
|
||||
export const ServerMessage = Schema.Union([
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("echo"),
|
||||
text: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("sumResult"),
|
||||
total: Schema.Number
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("time"),
|
||||
iso: Schema.String
|
||||
}),
|
||||
Schema.Struct({
|
||||
kind: Schema.Literal("error"),
|
||||
error: Schema.String
|
||||
})
|
||||
])
|
||||
|
||||
|
||||
export type ServerMessage = Schema.Schema.Type<typeof ServerMessage>
|
||||
|
||||
export const decodeClientMessage = Schema.decodeUnknownEffect(ClientMessage)
|
||||
|
||||
const Utf8StringFromUint8Array = Schema.Uint8Array.pipe(
|
||||
Schema.decodeTo(
|
||||
Schema.String,
|
||||
SchemaTransformation.transform({
|
||||
decode: (bytes) => new TextDecoder().decode(bytes),
|
||||
encode: (text) => new TextEncoder().encode(text)
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
const ClientMessageFromWire = Schema.Union([
|
||||
Schema.String,
|
||||
Utf8StringFromUint8Array
|
||||
]).pipe(
|
||||
Schema.decodeTo(Schema.fromJsonString(ClientMessage))
|
||||
)
|
||||
|
||||
export const decodeWireClientMessage = Schema.decodeUnknownEffect(ClientMessageFromWire)
|
||||
|
||||
export const routeClientMessage = (message: ClientMessage): ServerMessage => {
|
||||
switch (message.kind) {
|
||||
case "echo":
|
||||
return { kind: "echo", text: message.text }
|
||||
case "sum":
|
||||
return { kind: "sumResult", total: message.left + message.right }
|
||||
case "time":
|
||||
return { kind: "time", iso: new Date().toISOString() }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* MigrationsLive - Migration runner with inline loader
|
||||
*
|
||||
* Uses Migrator.make with fromRecord to define migrations inline.
|
||||
* All migrations are statically imported - no dynamic file system loading.
|
||||
*
|
||||
* Migrations run automatically when the MigrationsLive layer is provided,
|
||||
* ensuring the database schema is up-to-date before the application starts.
|
||||
*/
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
import * as Migrator from "effect/unstable/sql/Migrator"
|
||||
import Migration0001 from "./Migrations/001_TodoSchema.ts"
|
||||
|
||||
const loader = Migrator.fromRecord({
|
||||
"1_TodoSchema": Migration0001
|
||||
})
|
||||
|
||||
const run = Migrator.make({})
|
||||
|
||||
export const runMigrations = Effect.gen(function*() {
|
||||
yield* Effect.log("Running migrations...")
|
||||
yield* run({ loader })
|
||||
yield* Effect.log("Migrations ran successfully")
|
||||
})
|
||||
|
||||
export interface MigrationsReadyApi {
|
||||
readonly ready: true
|
||||
}
|
||||
|
||||
export class MigrationsReady extends ServiceMap.Service<MigrationsReady, MigrationsReadyApi>()(
|
||||
"effect-http-ws-cli/MigrationsReady"
|
||||
) {}
|
||||
|
||||
export const MigrationsLive = Layer.effect(
|
||||
MigrationsReady,
|
||||
runMigrations.pipe(
|
||||
Effect.as(MigrationsReady.of({ ready: true }))
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,268 @@
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Option from "effect/Option"
|
||||
import * as PubSub from "effect/PubSub"
|
||||
import * as Schema from "effect/Schema"
|
||||
import * as ServiceMap from "effect/ServiceMap"
|
||||
import * as Stream from "effect/Stream"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import * as SqlSchema from "effect/unstable/sql/SqlSchema"
|
||||
import type { Todo, TodoChange, TodoEvent, TodoSnapshot } from "./contracts.ts"
|
||||
import { Todo as TodoSchema, TodoChange as TodoChangeSchema } from "./contracts.ts"
|
||||
import { MigrationsReady } from "./migrations.ts"
|
||||
|
||||
export interface TodoStoreApi {
|
||||
readonly list: (input: {
|
||||
readonly includeArchived: boolean
|
||||
}) => Effect.Effect<TodoSnapshot, never, SqlClient.SqlClient>
|
||||
readonly rename: (input: {
|
||||
readonly id: string
|
||||
readonly title: string
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly complete: (input: {
|
||||
readonly id: string
|
||||
readonly completed: boolean
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly archive: (input: {
|
||||
readonly id: string
|
||||
readonly archived: boolean
|
||||
}) => Effect.Effect<TodoEvent, never, SqlClient.SqlClient>
|
||||
readonly subscribe: (input: {
|
||||
readonly fromOffset: number
|
||||
readonly includeArchived: boolean
|
||||
}) => Stream.Stream<TodoEvent, never, SqlClient.SqlClient>
|
||||
}
|
||||
|
||||
export class TodoStore extends ServiceMap.Service<TodoStore, TodoStoreApi>()(
|
||||
"effect-http-ws-cli/TodoStore"
|
||||
) {}
|
||||
|
||||
const TodoRow = Schema.Struct({
|
||||
id: Schema.String,
|
||||
title: Schema.String,
|
||||
completed: Schema.BooleanFromBit,
|
||||
archived: Schema.BooleanFromBit,
|
||||
revision: Schema.Number,
|
||||
updatedAt: Schema.String
|
||||
})
|
||||
|
||||
const TodoEventRow = Schema.Struct({
|
||||
offset: Schema.Number,
|
||||
at: Schema.String,
|
||||
todo: Schema.fromJsonString(TodoSchema),
|
||||
change: Schema.fromJsonString(TodoChangeSchema)
|
||||
})
|
||||
|
||||
const EventInsertRequest = Schema.Struct({
|
||||
at: Schema.String,
|
||||
todo: Schema.fromJsonString(TodoSchema),
|
||||
change: Schema.fromJsonString(TodoChangeSchema),
|
||||
archived: Schema.BooleanFromBit
|
||||
})
|
||||
|
||||
const ListRequest = Schema.Struct({
|
||||
includeArchived: Schema.Boolean
|
||||
})
|
||||
|
||||
const CatchupRequest = Schema.Struct({
|
||||
fromOffset: Schema.Number,
|
||||
includeArchived: Schema.Boolean
|
||||
})
|
||||
|
||||
const OffsetRow = Schema.Struct({
|
||||
offset: Schema.Number
|
||||
})
|
||||
|
||||
const makeQueries = (sql: SqlClient.SqlClient) => {
|
||||
const listTodoRows = SqlSchema.findAll({
|
||||
Request: ListRequest,
|
||||
Result: TodoRow,
|
||||
execute: (request) =>
|
||||
request.includeArchived
|
||||
? sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
ORDER BY id
|
||||
`
|
||||
: sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
WHERE archived = 0
|
||||
ORDER BY id
|
||||
`
|
||||
})
|
||||
|
||||
const findTodoById = SqlSchema.findOneOption({
|
||||
Request: Schema.String,
|
||||
Result: TodoRow,
|
||||
execute: (id) => sql<Todo>`
|
||||
SELECT id, title, completed, archived, revision, updated_at AS updatedAt
|
||||
FROM todos
|
||||
WHERE id = ${id}
|
||||
`
|
||||
})
|
||||
|
||||
const upsertTodo = SqlSchema.void({
|
||||
Request: TodoRow,
|
||||
execute: (todo) => sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${todo.id}, ${todo.title}, ${todo.completed}, ${todo.archived}, ${todo.revision}, ${todo.updatedAt})
|
||||
ON CONFLICT(id) DO UPDATE SET
|
||||
title = excluded.title,
|
||||
completed = excluded.completed,
|
||||
archived = excluded.archived,
|
||||
revision = excluded.revision,
|
||||
updated_at = excluded.updated_at
|
||||
`
|
||||
})
|
||||
|
||||
const loadEventsSince = SqlSchema.findAll({
|
||||
Request: CatchupRequest,
|
||||
Result: TodoEventRow,
|
||||
execute: (request) =>
|
||||
request.includeArchived
|
||||
? sql<TodoEvent>`
|
||||
SELECT event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
FROM todo_events
|
||||
WHERE event_offset > ${request.fromOffset}
|
||||
ORDER BY event_offset
|
||||
`
|
||||
: sql<TodoEvent>`
|
||||
SELECT event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
FROM todo_events
|
||||
WHERE event_offset > ${request.fromOffset} AND archived = 0
|
||||
ORDER BY event_offset
|
||||
`
|
||||
})
|
||||
|
||||
const insertTodoEvent = SqlSchema.findOne({
|
||||
Request: EventInsertRequest,
|
||||
Result: TodoEventRow,
|
||||
execute: (request) => sql<TodoEvent>`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (${request.at}, ${request.todo}, ${request.change}, ${request.archived})
|
||||
RETURNING event_offset AS "offset", at, todo_json AS todo, change_json AS change
|
||||
`
|
||||
})
|
||||
|
||||
const currentOffset = SqlSchema.findOne({
|
||||
Request: Schema.Undefined,
|
||||
Result: OffsetRow,
|
||||
execute: () => sql<{ readonly offset: number }>`
|
||||
SELECT COALESCE(MAX(event_offset), 0) AS "offset"
|
||||
FROM todo_events
|
||||
`
|
||||
})
|
||||
|
||||
return {
|
||||
listTodoRows,
|
||||
findTodoById,
|
||||
upsertTodo,
|
||||
loadEventsSince,
|
||||
insertTodoEvent,
|
||||
currentOffset
|
||||
} as const
|
||||
}
|
||||
|
||||
export const layerTodoStore = Layer.effect(
|
||||
TodoStore,
|
||||
Effect.gen(function*() {
|
||||
yield* MigrationsReady
|
||||
const eventsPubSub = yield* PubSub.unbounded<TodoEvent>()
|
||||
|
||||
const append = (
|
||||
todoId: string,
|
||||
change: TodoChange,
|
||||
update: (todo: Todo) => Todo
|
||||
): Effect.Effect<TodoEvent, never, SqlClient.SqlClient> =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const queries = makeQueries(sql)
|
||||
return sql.withTransaction(
|
||||
queries.findTodoById(todoId).pipe(
|
||||
Effect.flatMap(
|
||||
Option.match({
|
||||
onNone: () => Effect.die(`Todo not found: ${todoId}`),
|
||||
onSome: (todo) => {
|
||||
const updated = update(todo)
|
||||
return queries.upsertTodo(updated).pipe(
|
||||
Effect.flatMap(() =>
|
||||
queries.insertTodoEvent({
|
||||
at: updated.updatedAt,
|
||||
todo: updated,
|
||||
change,
|
||||
archived: updated.archived
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(Effect.tap((event) => PubSub.publish(eventsPubSub, event)), Effect.orDie)
|
||||
|
||||
const visible = (todo: Todo, includeArchived: boolean) => includeArchived || !todo.archived
|
||||
|
||||
const subscribe = (input: {
|
||||
readonly fromOffset: number
|
||||
readonly includeArchived: boolean
|
||||
}): Stream.Stream<TodoEvent, never, SqlClient.SqlClient> => {
|
||||
const catchup = Stream.fromIterableEffect(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => makeQueries(sql).loadEventsSince(input))
|
||||
).pipe(Stream.orDie)
|
||||
|
||||
const live = Stream.fromPubSub(eventsPubSub).pipe(
|
||||
Stream.filter((event) => visible(event.todo, input.includeArchived))
|
||||
)
|
||||
|
||||
return Stream.concat(catchup, live)
|
||||
}
|
||||
|
||||
return TodoStore.of({
|
||||
list: ({ includeArchived }) =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const queries = makeQueries(sql)
|
||||
return Effect.all({
|
||||
todos: queries.listTodoRows({ includeArchived }),
|
||||
offset: queries.currentOffset(undefined).pipe(Effect.map(({ offset }) => offset))
|
||||
}).pipe(
|
||||
Effect.map(({ offset, todos }) => ({ offset, todos }))
|
||||
)
|
||||
}).pipe(Effect.orDie),
|
||||
rename: ({ id, title }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoRenamed", title },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
title,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
complete: ({ id, completed }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoCompleted", completed },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
completed,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
archive: ({ id, archived }) =>
|
||||
append(
|
||||
id,
|
||||
{ _tag: "TodoArchived", archived },
|
||||
(todo) => ({
|
||||
...todo,
|
||||
archived,
|
||||
revision: todo.revision + 1,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
),
|
||||
subscribe
|
||||
})
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,155 @@
|
||||
import { NodeHttpServer } from "@effect/platform-node"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as FileSystem from "effect/FileSystem"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Path from "effect/Path"
|
||||
import * as Http from "node:http"
|
||||
import {
|
||||
HttpRouter,
|
||||
HttpServerRequest,
|
||||
HttpServerResponse
|
||||
} from "effect/unstable/http"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as RpcServer from "effect/unstable/rpc/RpcServer"
|
||||
import * as Stream from "effect/Stream"
|
||||
import {
|
||||
ClientMessage,
|
||||
routeClientMessage,
|
||||
ServerMessage
|
||||
} from "./messages.ts"
|
||||
import { ServerConfig } from "./config.ts"
|
||||
import { WsRpcGroup } from "./contracts.ts"
|
||||
import { TodoStore, layerTodoStore } from "./model-store.ts"
|
||||
import { MigrationsLive } from "./migrations.ts"
|
||||
|
||||
const respondMessage = HttpServerResponse.schemaJson(ServerMessage)
|
||||
|
||||
const messageDispatchRoute = HttpRouter.add(
|
||||
"POST",
|
||||
"/api/dispatch",
|
||||
HttpServerRequest.schemaBodyJson(ClientMessage).pipe(
|
||||
Effect.flatMap((message) => respondMessage(routeClientMessage(message))),
|
||||
Effect.catchTag(
|
||||
"SchemaError",
|
||||
() => Effect.succeed(HttpServerResponse.jsonUnsafe({ kind: "error", error: "Invalid message schema" }, { status: 400 }))
|
||||
),
|
||||
Effect.catchTag(
|
||||
"HttpServerError",
|
||||
() => Effect.succeed(HttpServerResponse.jsonUnsafe({ kind: "error", error: "Invalid request body" }, { status: 400 }))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const websocketRpcRoute = RpcServer.layerHttp({
|
||||
group: WsRpcGroup,
|
||||
path: "/ws",
|
||||
protocol: "websocket"
|
||||
}).pipe(
|
||||
Layer.provide(WsRpcGroup.toLayer({
|
||||
echo: ({ text }) => Effect.succeed({ text }),
|
||||
sum: ({ left, right }) => Effect.succeed({ total: left + right }),
|
||||
time: () => Effect.sync(() => ({ iso: new Date().toISOString() })),
|
||||
listTodos: ({ includeArchived }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.list({ includeArchived })),
|
||||
renameTodo: ({ id, title }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.rename({ id, title })),
|
||||
completeTodo: ({ id, completed }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.complete({ id, completed })),
|
||||
archiveTodo: ({ id, archived }) =>
|
||||
Effect.flatMap(Effect.service(TodoStore), (store) => store.archive({ id, archived })),
|
||||
subscribeTodos: ({ fromOffset, includeArchived }) =>
|
||||
Stream.unwrap(
|
||||
Effect.map(
|
||||
Effect.service(TodoStore),
|
||||
(store) => store.subscribe({ fromOffset, includeArchived })
|
||||
)
|
||||
)
|
||||
})),
|
||||
Layer.provide(layerTodoStore),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
const staticRoute = HttpRouter.add(
|
||||
"GET",
|
||||
"*",
|
||||
(request) =>
|
||||
Effect.gen(function*() {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const path = yield* Path.Path
|
||||
const config = yield* ServerConfig
|
||||
const url = HttpServerRequest.toURL(request)
|
||||
if (!url) {
|
||||
return HttpServerResponse.text("Bad Request", { status: 400 })
|
||||
}
|
||||
|
||||
if (config.frontendDevOrigin) {
|
||||
return HttpServerResponse.redirect(
|
||||
new URL(`${url.pathname}${url.search}`, config.frontendDevOrigin),
|
||||
{
|
||||
status: 307,
|
||||
headers: { "cache-control": "no-store" }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const root = path.resolve(config.assetsDir)
|
||||
const decodedPath = decodeURIComponent(url.pathname)
|
||||
const target = decodedPath === "/"
|
||||
? "index.html"
|
||||
: decodedPath.endsWith("/")
|
||||
? `${decodedPath.slice(1)}index.html`
|
||||
: decodedPath.slice(1)
|
||||
|
||||
const normalizedTarget = path.normalize(target)
|
||||
const absoluteTarget = path.resolve(root, normalizedTarget)
|
||||
const relativeToRoot = path.relative(root, absoluteTarget)
|
||||
|
||||
if (relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot)) {
|
||||
return HttpServerResponse.text("Forbidden", { status: 403 })
|
||||
}
|
||||
|
||||
const exists = yield* fs.exists(absoluteTarget)
|
||||
if (!exists) {
|
||||
return HttpServerResponse.text("Not Found", { status: 404 })
|
||||
}
|
||||
|
||||
return yield* HttpServerResponse.file(absoluteTarget)
|
||||
}).pipe(Effect.catchCause(() => Effect.succeed(HttpServerResponse.text("Bad Request", { status: 400 }))))
|
||||
)
|
||||
|
||||
export const makeRoutesLayer =
|
||||
Layer.mergeAll(
|
||||
HttpRouter.add(
|
||||
"GET",
|
||||
"/health",
|
||||
HttpServerResponse.json({ ok: true })
|
||||
),
|
||||
messageDispatchRoute,
|
||||
websocketRpcRoute,
|
||||
staticRoute
|
||||
)
|
||||
|
||||
export const makeServerLayer = Layer.unwrap(
|
||||
Effect.gen(function*() {
|
||||
const config = yield* ServerConfig
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({
|
||||
filename: config.dbFilename
|
||||
})
|
||||
const persistenceLayer = MigrationsLive.pipe(
|
||||
Layer.provideMerge(sqliteLayer)
|
||||
)
|
||||
|
||||
return HttpRouter.serve(makeRoutesLayer, {
|
||||
disableLogger: !config.requestLogging
|
||||
}).pipe(
|
||||
Layer.provideMerge(persistenceLayer),
|
||||
Layer.provide(NodeHttpServer.layer(Http.createServer, {
|
||||
host: config.host,
|
||||
port: config.port
|
||||
}))
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
export const runServer = Layer.launch(makeServerLayer)
|
||||
@@ -0,0 +1,79 @@
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as ConfigProvider from "effect/ConfigProvider"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Option from "effect/Option"
|
||||
import { resolveServerConfig } from "../src/cli.ts"
|
||||
|
||||
describe("cli config resolution", () => {
|
||||
it.effect("falls back to effect/config values when flags are omitted", () =>
|
||||
Effect.gen(function*() {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
host: Option.none(),
|
||||
port: Option.none(),
|
||||
assets: Option.none(),
|
||||
db: Option.none(),
|
||||
requestLogging: Option.none(),
|
||||
frontendDevOrigin: Option.none()
|
||||
}).pipe(
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
HOST: "0.0.0.0",
|
||||
PORT: "4001",
|
||||
ASSETS_DIR: "public",
|
||||
DB_FILENAME: "dev.sqlite",
|
||||
REQUEST_LOGGING: "false",
|
||||
FRONTEND_DEV_ORIGIN: "http://127.0.0.1:5173"
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(resolved).toEqual({
|
||||
host: "0.0.0.0",
|
||||
port: 4001,
|
||||
assetsDir: "public",
|
||||
dbFilename: "dev.sqlite",
|
||||
requestLogging: false,
|
||||
frontendDevOrigin: "http://127.0.0.1:5173"
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
it.effect("uses CLI flags when provided", () =>
|
||||
Effect.gen(function*() {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
host: Option.some("127.0.0.1"),
|
||||
port: Option.some(8788),
|
||||
assets: Option.some("public"),
|
||||
db: Option.some("override.sqlite"),
|
||||
requestLogging: Option.some(true),
|
||||
frontendDevOrigin: Option.some("http://127.0.0.1:4173")
|
||||
}).pipe(
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
HOST: "0.0.0.0",
|
||||
PORT: "4001",
|
||||
ASSETS_DIR: "other",
|
||||
DB_FILENAME: "ignored.sqlite",
|
||||
REQUEST_LOGGING: "false",
|
||||
FRONTEND_DEV_ORIGIN: "http://127.0.0.1:5173"
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(resolved).toEqual({
|
||||
host: "127.0.0.1",
|
||||
port: 8788,
|
||||
assetsDir: "public",
|
||||
dbFilename: "override.sqlite",
|
||||
requestLogging: true,
|
||||
frontendDevOrigin: "http://127.0.0.1:4173"
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,90 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import * as FileSystem from "node:fs"
|
||||
import * as OS from "node:os"
|
||||
import * as NodePath from "node:path"
|
||||
import { resetDatabase } from "../src/cli.ts"
|
||||
import { MigrationsLive } from "../src/migrations.ts"
|
||||
|
||||
const countRows = (dbFilename: string, tableName: string) =>
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) =>
|
||||
sql<{ readonly count: number }>`SELECT COUNT(*) AS count FROM ${sql(tableName)}`.pipe(
|
||||
Effect.map((rows) => rows[0]?.count ?? 0)
|
||||
)
|
||||
).pipe(
|
||||
Effect.provide(SqliteNode.SqliteClient.layer({ filename: dbFilename }))
|
||||
)
|
||||
|
||||
const insertTodo = (dbFilename: string) =>
|
||||
Effect.scoped(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const now = new Date().toISOString()
|
||||
const id = "todo-reset-test"
|
||||
const title = "before-reset"
|
||||
return sql.withTransaction(
|
||||
sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${id}, ${title}, 0, 0, 1, ${now})
|
||||
`.pipe(
|
||||
Effect.flatMap(() =>
|
||||
sql`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (
|
||||
${now},
|
||||
${JSON.stringify({
|
||||
id,
|
||||
title,
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: now
|
||||
})},
|
||||
${JSON.stringify({ _tag: "TodoCreated" })},
|
||||
0
|
||||
)
|
||||
`
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(
|
||||
Effect.provide(MigrationsLive.pipe(Layer.provideMerge(SqliteNode.SqliteClient.layer({ filename: dbFilename }))))
|
||||
)
|
||||
)
|
||||
|
||||
describe("reset command", () => {
|
||||
it.effect("deletes the database and reruns migrations without reseeding todos", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-reset-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename)
|
||||
|
||||
const beforeCount = yield* countRows(dbFilename, "todos")
|
||||
expect(beforeCount).toBe(1)
|
||||
|
||||
yield* resetDatabase(dbFilename).pipe(
|
||||
Effect.provide(NodeServices.layer)
|
||||
)
|
||||
|
||||
const todoCount = yield* countRows(dbFilename, "todos")
|
||||
const migrationCount = yield* countRows(dbFilename, "effect_sql_migrations")
|
||||
|
||||
expect(todoCount).toBe(0)
|
||||
expect(migrationCount).toBe(1)
|
||||
|
||||
yield* Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,310 @@
|
||||
import { NodeHttpServer } from "@effect/platform-node"
|
||||
import * as SqliteNode from "@effect/sql-sqlite-node"
|
||||
import { describe, expect, it } from "@effect/vitest"
|
||||
import * as Effect from "effect/Effect"
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as Stream from "effect/Stream"
|
||||
import * as FileSystem from "node:fs"
|
||||
import * as OS from "node:os"
|
||||
import * as NodePath from "node:path"
|
||||
import {
|
||||
HttpBody,
|
||||
HttpClient,
|
||||
HttpClientResponse,
|
||||
HttpServer,
|
||||
HttpRouter
|
||||
} from "effect/unstable/http"
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
||||
import { ServerConfig } from "../src/config.ts"
|
||||
import { MigrationsLive } from "../src/migrations.ts"
|
||||
import { ServerMessage } from "../src/messages.ts"
|
||||
import { withWsRpcClient } from "../src/client.ts"
|
||||
import { makeRoutesLayer } from "../src/server.ts"
|
||||
|
||||
const testServerConfig = {
|
||||
host: "127.0.0.1",
|
||||
port: 0,
|
||||
assetsDir: new URL("../../public", import.meta.url).pathname,
|
||||
dbFilename: ":memory:",
|
||||
requestLogging: false,
|
||||
frontendDevOrigin: undefined
|
||||
}
|
||||
|
||||
const AppUnderTest = HttpRouter.serve(
|
||||
makeRoutesLayer,
|
||||
{
|
||||
disableListenLog: true,
|
||||
disableLogger: true
|
||||
}
|
||||
)
|
||||
|
||||
const persistenceLayer = (dbFilename: string) => {
|
||||
const sqliteLayer = SqliteNode.SqliteClient.layer({ filename: dbFilename })
|
||||
return MigrationsLive.pipe(Layer.provideMerge(sqliteLayer))
|
||||
}
|
||||
|
||||
const appLayer = (dbFilename: string) =>
|
||||
AppUnderTest.pipe(Layer.provideMerge(persistenceLayer(dbFilename)))
|
||||
|
||||
const insertTodo = (dbFilename: string, id: string, title: string) =>
|
||||
Effect.scoped(
|
||||
Effect.flatMap(Effect.service(SqlClient.SqlClient), (sql) => {
|
||||
const now = new Date().toISOString()
|
||||
return sql.withTransaction(
|
||||
sql`
|
||||
INSERT INTO todos (id, title, completed, archived, revision, updated_at)
|
||||
VALUES (${id}, ${title}, 0, 0, 1, ${now})
|
||||
`.pipe(
|
||||
Effect.flatMap(() =>
|
||||
sql`
|
||||
INSERT INTO todo_events (at, todo_json, change_json, archived)
|
||||
VALUES (
|
||||
${now},
|
||||
${JSON.stringify({
|
||||
id,
|
||||
title,
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: now
|
||||
})},
|
||||
${JSON.stringify({ _tag: "TodoCreated" })},
|
||||
0
|
||||
)
|
||||
`
|
||||
)
|
||||
)
|
||||
)
|
||||
}).pipe(
|
||||
Effect.provide(persistenceLayer(dbFilename))
|
||||
)
|
||||
)
|
||||
|
||||
describe("server", () => {
|
||||
it.effect("routes HTTP messages validated by Schema", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const client = yield* HttpClient.HttpClient
|
||||
const response = yield* client.post("/api/dispatch", {
|
||||
body: HttpBody.jsonUnsafe({ kind: "sum", left: 20, right: 22 })
|
||||
})
|
||||
|
||||
const parsed = yield* HttpClientResponse.schemaBodyJson(ServerMessage)(response)
|
||||
expect(parsed).toEqual({ kind: "sumResult", total: 42 })
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("serves static files from local filesystem", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const text = yield* HttpClient.get("/").pipe(
|
||||
Effect.flatMap((response) => response.text)
|
||||
)
|
||||
|
||||
expect(text).toContain("effect-http-ws-cli")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("redirects frontend requests to the Vite dev server when enabled", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
frontendDevOrigin: "http://127.0.0.1:5173"
|
||||
})
|
||||
)
|
||||
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(`http://127.0.0.1:${address.port}/todos?filter=active`, {
|
||||
redirect: "manual"
|
||||
})
|
||||
)
|
||||
|
||||
expect(response.status).toBe(307)
|
||||
expect(response.headers.get("location")).toBe("http://127.0.0.1:5173/todos?filter=active")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("routes WebSocket RPC messages with shared contracts", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
const response = yield* Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) => client.echo({ text: "hello from ws" }))
|
||||
)
|
||||
|
||||
expect(response).toEqual({ text: "hello from ws" })
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("routes WebSocket RPC calls for multiple procedures", () =>
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(testServerConfig.dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, testServerConfig)
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
const result = yield* Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.all({
|
||||
sum: client.sum({ left: 1, right: 2 }),
|
||||
time: client.time(undefined)
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(result.sum).toEqual({ total: 3 })
|
||||
expect(typeof result.time.iso).toBe("string")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("lists todos and streams todo updates from offset", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-stream-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename, "todo-stream-test", "stream-seed")
|
||||
|
||||
const events = yield* Effect.scoped(
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
dbFilename
|
||||
})
|
||||
)
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
|
||||
return yield* withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const firstTodo = snapshot.todos[0]
|
||||
if (!firstTodo) {
|
||||
return yield* Effect.die("Expected a todo fixture")
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: firstTodo.id, title: "alpha" })
|
||||
yield* client.completeTodo({ id: firstTodo.id, completed: true })
|
||||
yield* client.archiveTodo({ id: firstTodo.id, archived: true })
|
||||
|
||||
return yield* client.subscribeTodos({
|
||||
fromOffset: snapshot.offset,
|
||||
includeArchived: true
|
||||
}).pipe(
|
||||
Stream.take(3),
|
||||
Stream.runCollect
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
).pipe(
|
||||
Effect.ensuring(
|
||||
Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(events).toHaveLength(3)
|
||||
expect(events[0]?.change).toEqual({ _tag: "TodoRenamed", title: "alpha" })
|
||||
expect(events[1]?.change).toEqual({ _tag: "TodoCompleted", completed: true })
|
||||
expect(events[2]?.change).toEqual({ _tag: "TodoArchived", archived: true })
|
||||
expect(events[0]?.todo.title).toBe("alpha")
|
||||
expect(events[1]?.todo.completed).toBe(true)
|
||||
expect(events[2]?.todo.archived).toBe(true)
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
|
||||
it.effect("persists todos across server restarts when using a file database", () =>
|
||||
Effect.gen(function*() {
|
||||
const dbFilename = NodePath.join(
|
||||
OS.tmpdir(),
|
||||
`effect-http-ws-cli-${Date.now()}-${Math.random().toString(16).slice(2)}.sqlite`
|
||||
)
|
||||
|
||||
yield* insertTodo(dbFilename, "todo-persist-test", "persist-seed")
|
||||
|
||||
const withServer = <A, E, R>(f: (wsUrl: string) => Effect.Effect<A, E, R>) =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function*() {
|
||||
yield* Layer.build(appLayer(dbFilename)).pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
...testServerConfig,
|
||||
dbFilename
|
||||
})
|
||||
)
|
||||
|
||||
const server = yield* HttpServer.HttpServer
|
||||
const address = server.address as HttpServer.TcpAddress
|
||||
const wsUrl = `ws://127.0.0.1:${address.port}/ws`
|
||||
return yield* f(wsUrl)
|
||||
})
|
||||
)
|
||||
|
||||
const renamedTodoId = yield* withServer((wsUrl) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const firstTodo = snapshot.todos[0]
|
||||
if (!firstTodo) {
|
||||
return yield* Effect.die("Expected a todo fixture")
|
||||
}
|
||||
|
||||
yield* client.renameTodo({ id: firstTodo.id, title: "persisted-title" })
|
||||
return firstTodo.id
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const persistedTitle = yield* withServer((wsUrl) =>
|
||||
Effect.scoped(
|
||||
withWsRpcClient(wsUrl, (client) =>
|
||||
Effect.gen(function*() {
|
||||
const snapshot = yield* client.listTodos({ includeArchived: true })
|
||||
const persisted = snapshot.todos.find((todo) => todo.id === renamedTodoId)
|
||||
if (!persisted) {
|
||||
return yield* Effect.die("Expected persisted todo")
|
||||
}
|
||||
return persisted.title
|
||||
})
|
||||
)
|
||||
)
|
||||
).pipe(
|
||||
Effect.ensuring(
|
||||
Effect.sync(() => {
|
||||
try {
|
||||
FileSystem.rmSync(dbFilename, { force: true })
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
expect(persistedTitle).toBe("persisted-title")
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest))
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["src", "test", "vitest.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { defineConfig } from "vitest/config"
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
include: ["test/**/*.test.ts"],
|
||||
environment: "node"
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"rewriteRelativeImportExtensions": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["node", "vitest/globals"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>effect-http-ws-cli rpc console</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Sans:wght@400;500;700&display=swap" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@effect-http-ws-cli/web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"lint": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect-http-ws-cli/server": "workspace:*",
|
||||
"@effect/atom-react": "catalog:",
|
||||
"@tanstack/react-router": "^1.166.2",
|
||||
"effect": "catalog:",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/router-plugin": "^1.166.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"@vitest/browser-playwright": "^4.0.18",
|
||||
"playwright": "^1.58.2",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^7.2.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { StrictMode } from "react"
|
||||
import { createRoot } from "react-dom/client"
|
||||
import { RegistryProvider } from "@effect/atom-react"
|
||||
import { createBrowserHistory, RouterProvider } from "@tanstack/react-router"
|
||||
import { getRouter } from "./router"
|
||||
import "./styles.css"
|
||||
|
||||
const history = createBrowserHistory()
|
||||
const router = getRouter(history)
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<RegistryProvider>
|
||||
<RouterProvider router={router} />
|
||||
</RegistryProvider>
|
||||
</StrictMode>
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
// This file was automatically generated by TanStack Router.
|
||||
// You should NOT make any changes in this file as it will be overwritten.
|
||||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/'
|
||||
id: '__root__' | '/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface FileRoutesByPath {
|
||||
'/': {
|
||||
id: '/'
|
||||
path: '/'
|
||||
fullPath: '/'
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createRouter, type RouterHistory } from "@tanstack/react-router"
|
||||
import { routeTree } from "./routeTree.gen"
|
||||
|
||||
export const getRouter = (history: RouterHistory) =>
|
||||
createRouter({
|
||||
routeTree,
|
||||
history
|
||||
})
|
||||
|
||||
|
||||
declare module "@tanstack/react-router" {
|
||||
interface Register {
|
||||
router: ReturnType<typeof getRouter>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Outlet, createRootRoute } from "@tanstack/react-router"
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: Outlet
|
||||
})
|
||||
@@ -0,0 +1,460 @@
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
|
||||
|
||||
|
||||
import { useEffect, useRef } from "react"
|
||||
import * as Cause from "effect/Cause"
|
||||
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
||||
import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react"
|
||||
import type { Todo, TodoEvent, TodoChange } from "@effect-http-ws-cli/server/contracts"
|
||||
import {
|
||||
archiveTodoMutationAtom,
|
||||
completeTodoMutationAtom,
|
||||
renameTodoMutationAtom,
|
||||
subscribeTodosPullAtom,
|
||||
todosSnapshotAtom
|
||||
} from "../rpc"
|
||||
import {
|
||||
connectionAtom,
|
||||
eventsAtom,
|
||||
mutationBusyAtom,
|
||||
todoProjectionAtom
|
||||
} from "../state"
|
||||
|
||||
const reconnectBaseMs = 1_250
|
||||
const reconnectMaxMs = 20_000
|
||||
const maxReconnectAttempts = 8
|
||||
|
||||
|
||||
|
||||
export const Route = createFileRoute("/")({
|
||||
component: IndexRoute
|
||||
})
|
||||
|
||||
function IndexRoute() {
|
||||
const setProjection = useAtomSet(todoProjectionAtom)
|
||||
const setEvents = useAtomSet(eventsAtom)
|
||||
const setConnection = useAtomSet(connectionAtom)
|
||||
const setBusy = useAtomSet(mutationBusyAtom)
|
||||
|
||||
const snapshotResult = useAtomValue(todosSnapshotAtom)
|
||||
const subscriptionPullResult = useAtomValue(subscribeTodosPullAtom)
|
||||
const pullSubscription = useAtomSet(subscribeTodosPullAtom)
|
||||
const refreshSubscription = useAtomRefresh(subscribeTodosPullAtom)
|
||||
|
||||
const seenOffsetsRef = useRef<Set<number>>(new Set())
|
||||
const baselineOffsetRef = useRef(0)
|
||||
const hasInitializedRef = useRef(false)
|
||||
const hasStartedSubscriptionRef = useRef(false)
|
||||
const brokenSubscriptionRef = useRef(false)
|
||||
|
||||
const reconnectAttemptsRef = useRef(0)
|
||||
const reconnectTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
||||
const clearReconnectTimer = () => {
|
||||
if (reconnectTimerRef.current !== null) {
|
||||
clearTimeout(reconnectTimerRef.current)
|
||||
reconnectTimerRef.current = null
|
||||
}
|
||||
}
|
||||
|
||||
const startSubscriptionPull = () => {
|
||||
clearReconnectTimer()
|
||||
if (!hasStartedSubscriptionRef.current) {
|
||||
hasStartedSubscriptionRef.current = true
|
||||
}
|
||||
setConnection((current) => ({ ...current, subscriptionState: "connecting" }))
|
||||
refreshSubscription()
|
||||
pullSubscription(undefined)
|
||||
}
|
||||
|
||||
const scheduleReconnect = (lastError: string) => {
|
||||
brokenSubscriptionRef.current = true
|
||||
reconnectAttemptsRef.current += 1
|
||||
|
||||
if (reconnectAttemptsRef.current > maxReconnectAttempts) {
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError,
|
||||
subscriptionState: "idle"
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
const delayMs = Math.min(
|
||||
reconnectBaseMs * 2 ** Math.max(0, reconnectAttemptsRef.current - 1),
|
||||
reconnectMaxMs
|
||||
)
|
||||
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError,
|
||||
subscriptionState: "connecting"
|
||||
}))
|
||||
|
||||
clearReconnectTimer()
|
||||
reconnectTimerRef.current = setTimeout(() => {
|
||||
reconnectTimerRef.current = null
|
||||
startSubscriptionPull()
|
||||
}, delayMs)
|
||||
}
|
||||
|
||||
const addEvent = (event: TodoEvent): boolean => {
|
||||
if (event.offset <= baselineOffsetRef.current) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (seenOffsetsRef.current.has(event.offset)) {
|
||||
return false
|
||||
}
|
||||
|
||||
seenOffsetsRef.current.add(event.offset)
|
||||
setEvents((events) => [...events, event])
|
||||
return true
|
||||
}
|
||||
|
||||
const applyEvent = (event: TodoEvent) => {
|
||||
setProjection((current) => ({
|
||||
...current,
|
||||
lastOffset: Math.max(current.lastOffset, event.offset),
|
||||
todos: sortTodos(
|
||||
current.todos.some((todo) => todo.id === event.todo.id)
|
||||
? current.todos.map((todo) => (todo.id === event.todo.id ? event.todo : todo))
|
||||
: [...current.todos, event.todo]
|
||||
),
|
||||
titleDrafts: {
|
||||
...current.titleDrafts,
|
||||
[event.todo.id]: event.todo.title
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
const applyTodoEvent = (event: TodoEvent) => {
|
||||
const isNew = addEvent(event)
|
||||
if (isNew) {
|
||||
applyEvent(event)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (AsyncResult.isInitial(snapshotResult)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isFailure(snapshotResult)) {
|
||||
scheduleReconnect(Cause.pretty(snapshotResult.cause))
|
||||
return
|
||||
}
|
||||
|
||||
const snapshot = snapshotResult.value
|
||||
|
||||
setProjection({
|
||||
todos: sortTodos(snapshot.todos),
|
||||
lastOffset: snapshot.offset,
|
||||
titleDrafts: Object.fromEntries(snapshot.todos.map((todo) => [todo.id, todo.title]))
|
||||
})
|
||||
|
||||
if (!hasInitializedRef.current) {
|
||||
hasInitializedRef.current = true
|
||||
baselineOffsetRef.current = snapshot.offset
|
||||
seenOffsetsRef.current = new Set()
|
||||
setEvents([])
|
||||
startSubscriptionPull()
|
||||
}
|
||||
}, [snapshotResult, setEvents, setProjection])
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasStartedSubscriptionRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isInitial(subscriptionPullResult)) {
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
subscriptionState: subscriptionPullResult.waiting ? "connected" : "connecting"
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
if (AsyncResult.isFailure(subscriptionPullResult)) {
|
||||
scheduleReconnect(Cause.pretty(subscriptionPullResult.cause))
|
||||
return
|
||||
}
|
||||
|
||||
reconnectAttemptsRef.current = 0
|
||||
brokenSubscriptionRef.current = false
|
||||
|
||||
setConnection((current) => ({
|
||||
...current,
|
||||
lastError: null,
|
||||
subscriptionState: "connected"
|
||||
}))
|
||||
|
||||
for (const event of subscriptionPullResult.value.items) {
|
||||
applyTodoEvent(event)
|
||||
}
|
||||
|
||||
if (!subscriptionPullResult.value.done && !subscriptionPullResult.waiting) {
|
||||
pullSubscription(undefined)
|
||||
}
|
||||
}, [pullSubscription, setConnection, subscriptionPullResult])
|
||||
|
||||
useEffect(() => {
|
||||
const reconnectOnFocus = () => {
|
||||
if (document.visibilityState !== "visible") {
|
||||
return
|
||||
}
|
||||
|
||||
if (!brokenSubscriptionRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
reconnectAttemptsRef.current = 0
|
||||
startSubscriptionPull()
|
||||
}
|
||||
|
||||
window.addEventListener("focus", reconnectOnFocus)
|
||||
document.addEventListener("visibilitychange", reconnectOnFocus)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("focus", reconnectOnFocus)
|
||||
document.removeEventListener("visibilitychange", reconnectOnFocus)
|
||||
}
|
||||
}, [setConnection])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
clearReconnectTimer()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const runMutation: MutationRunner = (label, run, onSuccess) => {
|
||||
setBusy(label)
|
||||
setConnection((current) => ({ ...current, lastError: null }))
|
||||
|
||||
void run().then(
|
||||
(value) => {
|
||||
onSuccess(value)
|
||||
},
|
||||
(error) => {
|
||||
setConnection((current) => ({ ...current, lastError: Cause.pretty(error) }))
|
||||
}
|
||||
).finally(() => {
|
||||
setBusy(null)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="shell">
|
||||
<Status />
|
||||
|
||||
<section className="hero">
|
||||
<p className="eyebrow">effect-http-ws-cli</p>
|
||||
<h1>Realtime Todo Stream</h1>
|
||||
<p className="lead">
|
||||
Snapshot on load, then live updates over typed WebSocket RPC subscriptions.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<TodoPanel runMutation={runMutation} applyTodoEvent={applyTodoEvent} />
|
||||
<EventList />
|
||||
<Footer />
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
type MutationRunner = <A>(
|
||||
label: string,
|
||||
run: () => Promise<A>,
|
||||
onSuccess: (value: A) => void
|
||||
) => void
|
||||
|
||||
const sortTodos = (todos: ReadonlyArray<Todo>): ReadonlyArray<Todo> =>
|
||||
[...todos].sort((a, b) => {
|
||||
if (a.archived !== b.archived) return a.archived ? 1 : -1
|
||||
if (a.completed !== b.completed) return a.completed ? 1 : -1
|
||||
return a.id.localeCompare(b.id)
|
||||
})
|
||||
|
||||
const describeChange = (change: TodoChange): string => {
|
||||
switch (change._tag) {
|
||||
case "TodoCreated":
|
||||
return "created"
|
||||
case "TodoRenamed":
|
||||
return `renamed to "${change.title}"`
|
||||
case "TodoCompleted":
|
||||
return change.completed ? "completed" : "marked incomplete"
|
||||
case "TodoArchived":
|
||||
return change.archived ? "archived" : "unarchived"
|
||||
}
|
||||
}
|
||||
|
||||
const Status = () => {
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
const busy = useAtomValue(mutationBusyAtom)
|
||||
|
||||
return (
|
||||
<section className="panel status-panel">
|
||||
<div className="status-grid">
|
||||
<div className={`status-item status-subscription-${connection.subscriptionState}`}>
|
||||
<span className="status-label">Subscription</span>
|
||||
<strong>{connection.subscriptionState}</strong>
|
||||
</div>
|
||||
<div className={`status-item ${busy ? "status-mutation-busy" : "status-mutation-idle"}`}>
|
||||
<span className="status-label">Mutation</span>
|
||||
<strong>{busy ? busy : "idle"}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const TodoPanel = (props: {
|
||||
readonly runMutation: MutationRunner
|
||||
readonly applyTodoEvent: (event: TodoEvent) => void
|
||||
}) => {
|
||||
const projection = useAtomValue(todoProjectionAtom)
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
const setProjection = useAtomSet(todoProjectionAtom)
|
||||
const renameTodo = useAtomSet(renameTodoMutationAtom, { mode: "promise" })
|
||||
const completeTodo = useAtomSet(completeTodoMutationAtom, { mode: "promise" })
|
||||
const archiveTodo = useAtomSet(archiveTodoMutationAtom, { mode: "promise" })
|
||||
|
||||
return (
|
||||
<section className="panel todo-panel">
|
||||
<header className="todo-header">
|
||||
<h2>Todos</h2>
|
||||
<div className="meta">
|
||||
<span>offset #{projection.lastOffset}</span>
|
||||
<span>subscription: {connection.subscriptionState}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<ul className="todo-list">
|
||||
{projection.todos.map((todo) => (
|
||||
<li
|
||||
key={todo.id}
|
||||
className={`todo-item${todo.completed ? " is-completed" : ""}${todo.archived ? " is-archived" : ""}`}
|
||||
>
|
||||
<div className="todo-main">
|
||||
<input
|
||||
value={projection.titleDrafts[todo.id] ?? todo.title}
|
||||
onChange={(event) => {
|
||||
setProjection((current) => ({
|
||||
...current,
|
||||
titleDrafts: {
|
||||
...current.titleDrafts,
|
||||
[todo.id]: event.target.value
|
||||
}
|
||||
}))
|
||||
}}
|
||||
/>
|
||||
<small>
|
||||
rev {todo.revision} · {new Date(todo.updatedAt).toLocaleTimeString()}
|
||||
</small>
|
||||
</div>
|
||||
<div className="todo-actions">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`rename:${todo.id}`,
|
||||
() =>
|
||||
renameTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
title: projection.titleDrafts[todo.id] ?? todo.title
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
Rename
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`complete:${todo.id}`,
|
||||
() =>
|
||||
completeTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
completed: !todo.completed
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
{todo.completed ? "Undo" : "Complete"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
props.runMutation(
|
||||
`archive:${todo.id}`,
|
||||
() =>
|
||||
archiveTodo({
|
||||
payload: {
|
||||
id: todo.id,
|
||||
archived: !todo.archived
|
||||
}
|
||||
}),
|
||||
props.applyTodoEvent
|
||||
)
|
||||
}
|
||||
>
|
||||
{todo.archived ? "Unarchive" : "Archive"}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const EventList = () => {
|
||||
const events = useAtomValue(eventsAtom)
|
||||
|
||||
return (
|
||||
<section className="panel event-panel">
|
||||
<header className="todo-header">
|
||||
<h2>Events</h2>
|
||||
<div className="meta">
|
||||
<span>{events.length} total</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<ul className="event-list">
|
||||
{[...events].reverse().map((event) => (
|
||||
<li key={event.offset} className="event-item">
|
||||
<div className="event-top">
|
||||
<strong>#{event.offset}</strong>
|
||||
<span>{new Date(event.at).toLocaleTimeString()}</span>
|
||||
</div>
|
||||
<div className="event-body">
|
||||
<span>{event.todo.title}</span>
|
||||
<small>{describeChange(event.change)}</small>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const Footer = () => {
|
||||
const connection = useAtomValue(connectionAtom)
|
||||
|
||||
return (
|
||||
<footer className="footer">
|
||||
{connection.lastError ? <span className="error">{connection.lastError}</span> : <span>no errors</span>}
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import * as Layer from "effect/Layer"
|
||||
import * as RpcClient from "effect/unstable/rpc/RpcClient"
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization"
|
||||
import * as AtomRpc from "effect/unstable/reactivity/AtomRpc"
|
||||
import * as Socket from "effect/unstable/socket/Socket"
|
||||
import { WsRpcGroup } from "@effect-http-ws-cli/server/contracts"
|
||||
|
||||
const wsUrl = () => {
|
||||
const protocol = window.location.protocol === "https:" ? "wss" : "ws"
|
||||
return `${protocol}://${window.location.host}/ws`
|
||||
}
|
||||
|
||||
const protocolLayer = RpcClient.layerProtocolSocket({
|
||||
retryTransientErrors: true
|
||||
}).pipe(
|
||||
Layer.provide(Socket.layerWebSocket(wsUrl())),
|
||||
Layer.provide(Socket.layerWebSocketConstructorGlobal),
|
||||
Layer.provide(RpcSerialization.layerJson)
|
||||
)
|
||||
|
||||
export class TodoRpcClient extends AtomRpc.Service<TodoRpcClient>()("TodoRpcClient", {
|
||||
group: WsRpcGroup,
|
||||
protocol: protocolLayer
|
||||
}) {}
|
||||
|
||||
export const todosSnapshotAtom = TodoRpcClient.query(
|
||||
"listTodos",
|
||||
{ includeArchived: true }
|
||||
)
|
||||
|
||||
export const subscribeTodosPullAtom = TodoRpcClient.query(
|
||||
"subscribeTodos",
|
||||
{
|
||||
fromOffset: 0,
|
||||
includeArchived: true
|
||||
}
|
||||
)
|
||||
|
||||
export const renameTodoMutationAtom = TodoRpcClient.mutation("renameTodo")
|
||||
export const completeTodoMutationAtom = TodoRpcClient.mutation("completeTodo")
|
||||
export const archiveTodoMutationAtom = TodoRpcClient.mutation("archiveTodo")
|
||||
@@ -0,0 +1,34 @@
|
||||
import * as Atom from "effect/unstable/reactivity/Atom"
|
||||
import type { Todo, TodoEvent } from "@effect-http-ws-cli/server/contracts"
|
||||
|
||||
export type SubscriptionState = "connecting" | "connected" | "idle"
|
||||
|
||||
export interface TodoProjectionState {
|
||||
readonly todos: ReadonlyArray<Todo>
|
||||
readonly titleDrafts: Readonly<Record<string, string>>
|
||||
readonly lastOffset: number
|
||||
}
|
||||
|
||||
export interface ConnectionState {
|
||||
readonly subscriptionState: SubscriptionState
|
||||
readonly lastError: string | null
|
||||
}
|
||||
|
||||
export const todoProjectionAtom = Atom.make<TodoProjectionState>({
|
||||
todos: [],
|
||||
titleDrafts: {},
|
||||
lastOffset: 0
|
||||
}).pipe(Atom.withLabel("todo-projection"))
|
||||
|
||||
export const eventsAtom = Atom.make<ReadonlyArray<TodoEvent>>([]).pipe(
|
||||
Atom.withLabel("events")
|
||||
)
|
||||
|
||||
export const connectionAtom = Atom.make<ConnectionState>({
|
||||
subscriptionState: "idle",
|
||||
lastError: null
|
||||
}).pipe(Atom.withLabel("connection"))
|
||||
|
||||
export const mutationBusyAtom = Atom.make<string | null>(null).pipe(
|
||||
Atom.withLabel("mutation-busy")
|
||||
)
|
||||
@@ -0,0 +1,298 @@
|
||||
:root {
|
||||
--paper: #f3f0e8;
|
||||
--ink: #13222c;
|
||||
--ink-soft: #345264;
|
||||
--accent: #dc4f18;
|
||||
--accent-soft: #f8bb68;
|
||||
--panel: #fffdf6;
|
||||
--line: #162f3f22;
|
||||
--shadow: 0 16px 40px #0f1e291f;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
|
||||
color: var(--ink);
|
||||
background:
|
||||
radial-gradient(circle at 10% 10%, #f7cf9a 0%, transparent 36%),
|
||||
radial-gradient(circle at 92% 88%, #95c7d2 0%, transparent 32%),
|
||||
linear-gradient(165deg, #ece8dc 0%, var(--paper) 48%, #e9dfcf 100%);
|
||||
}
|
||||
|
||||
.shell {
|
||||
width: min(1100px, 100% - 2rem);
|
||||
margin: 1.5rem auto;
|
||||
padding: 1.5rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 20px;
|
||||
background: color-mix(in oklab, var(--paper), white 35%);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding: 1.5rem;
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--line);
|
||||
background: linear-gradient(140deg, #fff9ed 0%, #f7efe0 65%, #f2e7d4 100%);
|
||||
}
|
||||
|
||||
.hero::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
right: -60px;
|
||||
top: -90px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(180deg, var(--accent-soft), transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0;
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.22em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-family: "Archivo Black", Impact, sans-serif;
|
||||
letter-spacing: 0.02em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0.35rem;
|
||||
font-size: clamp(1.5rem, 4vw, 2.35rem);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.lead {
|
||||
margin: 0.6rem 0 0;
|
||||
color: var(--ink-soft);
|
||||
max-width: 68ch;
|
||||
}
|
||||
|
||||
.panel {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 14px;
|
||||
padding: 1rem;
|
||||
background: var(--panel);
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.status-panel {
|
||||
margin-top: 0;
|
||||
background: linear-gradient(140deg, #fbf7ee, #f1e8d7);
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.7rem;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
padding: 0.55rem 0.7rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 0.75rem;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.status-subscription-connected {
|
||||
border-color: #24704755;
|
||||
background: #f1fbf5;
|
||||
}
|
||||
|
||||
.status-subscription-connecting {
|
||||
border-color: #8d6a1b55;
|
||||
background: #fff8eb;
|
||||
}
|
||||
|
||||
.status-subscription-idle {
|
||||
border-color: var(--line);
|
||||
}
|
||||
|
||||
.status-mutation-busy {
|
||||
border-color: #6b3b2e55;
|
||||
background: #fff3ef;
|
||||
}
|
||||
|
||||
.todo-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.86rem;
|
||||
}
|
||||
|
||||
.todo-list {
|
||||
margin: 0.8rem 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
.event-list {
|
||||
margin: 0.8rem 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
max-height: 260px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 0.55rem 0.65rem;
|
||||
}
|
||||
|
||||
.event-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.6rem;
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.event-body {
|
||||
margin-top: 0.2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.event-body small {
|
||||
color: var(--ink-soft);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.todo-item {
|
||||
display: flex;
|
||||
gap: 0.8rem;
|
||||
align-items: center;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: 0.65rem;
|
||||
}
|
||||
|
||||
.todo-main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.todo-main input {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
border: 1px solid var(--line);
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 0.42rem 0.55rem;
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.todo-main small {
|
||||
display: block;
|
||||
margin-top: 0.3rem;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.todo-actions {
|
||||
display: flex;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 1px solid #0f243233;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(160deg, #fff, #f4efe3);
|
||||
color: var(--ink);
|
||||
padding: 0.4rem 0.6rem;
|
||||
font: inherit;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: transform 120ms ease, box-shadow 120ms ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 18px #0f20321a;
|
||||
}
|
||||
|
||||
.todo-item.is-completed .todo-main input {
|
||||
text-decoration: line-through;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.todo-item.is-archived {
|
||||
opacity: 0.64;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
font-size: 0.88rem;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.shell {
|
||||
width: min(1100px, 100% - 1rem);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.todo-item {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.todo-actions {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import * as React from "react"
|
||||
import { RegistryProvider } from "@effect/atom-react"
|
||||
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
||||
import * as Atom from "effect/unstable/reactivity/Atom"
|
||||
import { describe, expect, it, vi } from "vitest"
|
||||
import { render } from "vitest-browser-react"
|
||||
import { createMemoryHistory, RouterProvider } from "@tanstack/react-router"
|
||||
import { getRouter } from "../src/router"
|
||||
|
||||
vi.mock("../src/rpc.ts", () => {
|
||||
const initialSnapshot = AsyncResult.success({
|
||||
offset: 42,
|
||||
todos: [
|
||||
{
|
||||
id: "todo-1",
|
||||
title: "Harness Todo",
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: "2026-03-05T00:00:00.000Z"
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const noopSubscription = AsyncResult.initial<{
|
||||
readonly done: boolean
|
||||
readonly items: ReadonlyArray<unknown>
|
||||
}>(true)
|
||||
|
||||
const mutationResult = AsyncResult.success({
|
||||
offset: 43,
|
||||
at: "2026-03-05T00:00:01.000Z",
|
||||
todo: {
|
||||
id: "todo-1",
|
||||
title: "Harness Todo",
|
||||
completed: false,
|
||||
archived: false,
|
||||
revision: 1,
|
||||
updatedAt: "2026-03-05T00:00:01.000Z"
|
||||
},
|
||||
change: { _tag: "TodoRenamed", title: "Harness Todo" as const }
|
||||
})
|
||||
|
||||
return {
|
||||
todosSnapshotAtom: Atom.make(initialSnapshot),
|
||||
subscribeTodosPullAtom: Atom.writable(
|
||||
() => noopSubscription,
|
||||
() => {
|
||||
// no-op: smoke test doesn't exercise stream pulling
|
||||
}
|
||||
),
|
||||
renameTodoMutationAtom: Atom.make(mutationResult),
|
||||
completeTodoMutationAtom: Atom.make(mutationResult),
|
||||
archiveTodoMutationAtom: Atom.make(mutationResult)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
describe("web app harness", () => {
|
||||
it("renders App in browser mode", async () => {
|
||||
const history = createMemoryHistory()
|
||||
const router = getRouter(history)
|
||||
const screen = await render(
|
||||
<RegistryProvider>
|
||||
<RouterProvider router={router} />
|
||||
</RegistryProvider>
|
||||
)
|
||||
|
||||
await expect.element(screen.getByRole("heading", { name: "Realtime Todo Stream" })).toBeVisible()
|
||||
await expect.element(screen.getByRole("heading", { name: "Todos" })).toBeVisible()
|
||||
await expect.element(screen.getByRole("textbox")).toHaveValue("Harness Todo")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["src", "vite.config.ts", "vitest.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { defineConfig } from "vite"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { TanStackRouterVite } from "@tanstack/router-plugin/vite"
|
||||
|
||||
const backendOrigin = process.env.VITE_BACKEND_ORIGIN ?? "http://127.0.0.1:8787"
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [TanStackRouterVite(), react()],
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/health": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/ws": {
|
||||
target: backendOrigin,
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
outDir: "../public",
|
||||
emptyOutDir: true
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
import { playwright } from "@vitest/browser-playwright"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig } from "vitest/config"
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-dev-runtime",
|
||||
"@tanstack/react-router",
|
||||
"@effect/atom-react",
|
||||
"vitest-browser-react",
|
||||
"effect/unstable/reactivity/Atom",
|
||||
"effect/unstable/reactivity/AsyncResult"
|
||||
]
|
||||
},
|
||||
test: {
|
||||
include: ["test/**/*.browser.test.tsx"],
|
||||
browser: {
|
||||
enabled: true,
|
||||
provider: playwright(),
|
||||
instances: [
|
||||
{
|
||||
browser: "chromium"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -7,18 +7,18 @@
|
||||
"directory": "apps/server"
|
||||
},
|
||||
"bin": {
|
||||
"t3": "./dist/index.mjs"
|
||||
"t3": "./dist/bin.mjs"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run src/index.ts",
|
||||
"dev": "bun run src/bin.ts",
|
||||
"build": "node scripts/cli.ts build",
|
||||
"start": "node dist/index.mjs",
|
||||
"start": "node dist/bin.mjs",
|
||||
"prepare": "effect-language-service patch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "node scripts/typecheck.mjs",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -121,6 +121,7 @@ const buildCmd = Command.make(
|
||||
"build",
|
||||
{
|
||||
verbose: Flag.boolean("verbose").pipe(Flag.withDefault(false)),
|
||||
format: Flag.choice("format", ["esm", "cjs"]).pipe(Flag.withDefault("esm")),
|
||||
},
|
||||
(config) =>
|
||||
Effect.gen(function* () {
|
||||
@@ -137,7 +138,7 @@ const buildCmd = Command.make(
|
||||
stderr: "inherit",
|
||||
// Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
|
||||
shell: process.platform === "win32",
|
||||
})`bun tsdown`,
|
||||
})`bun tsdown --format ${config.format}`,
|
||||
);
|
||||
|
||||
const webDist = path.join(repoRoot, "apps/web/dist");
|
||||
@@ -177,7 +178,7 @@ const publishCmd = Command.make(
|
||||
const backupPath = `${packageJsonPath}.bak`;
|
||||
|
||||
// Assert build assets exist
|
||||
for (const relPath of ["dist/index.mjs", "dist/client/index.html"]) {
|
||||
for (const relPath of ["dist/bin.mjs", "dist/client/index.html"]) {
|
||||
const abs = path.join(serverDir, relPath);
|
||||
if (!(yield* fs.exists(abs))) {
|
||||
return yield* new CliError({
|
||||
@@ -195,8 +196,10 @@ const publishCmd = Command.make(
|
||||
const pkg = {
|
||||
name: serverPackageJson.name,
|
||||
repository: serverPackageJson.repository,
|
||||
bin: serverPackageJson.bin,
|
||||
type: serverPackageJson.type,
|
||||
bin: {
|
||||
t3: "./dist/bin.mjs",
|
||||
},
|
||||
version,
|
||||
engines: serverPackageJson.engines,
|
||||
files: serverPackageJson.files,
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const tscPath = require.resolve("typescript/bin/tsc");
|
||||
const cwd = path.resolve(import.meta.dirname, "..");
|
||||
|
||||
const child = spawn(process.execPath, [tscPath, "--noEmit"], {
|
||||
cwd,
|
||||
env: process.env,
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
|
||||
let output = "";
|
||||
|
||||
child.stdout.on("data", (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stdout.write(text);
|
||||
});
|
||||
|
||||
child.stderr.on("data", (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stderr.write(text);
|
||||
});
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
return;
|
||||
}
|
||||
|
||||
if (code === 0) {
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
const hasTypeScriptErrors = /error TS\d+:/.test(output);
|
||||
process.exit(hasTypeScriptErrors ? (code ?? 1) : 0);
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { Command } from "effect/unstable/cli";
|
||||
|
||||
import { t3Cli } from "./cli";
|
||||
import { version } from "../package.json" with { type: "json" };
|
||||
|
||||
const main = Command.run(t3Cli, { version }).pipe(
|
||||
Effect.provide(NodeServices.layer),
|
||||
) as Effect.Effect<void, unknown, never>;
|
||||
|
||||
NodeRuntime.runMain(main);
|
||||
@@ -0,0 +1,113 @@
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import { describe, expect, it } from "@effect/vitest";
|
||||
import * as ConfigProvider from "effect/ConfigProvider";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Option from "effect/Option";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
|
||||
import { resolveServerConfig, type CliInput } from "./cli";
|
||||
|
||||
const emptyInput = (): CliInput => ({
|
||||
mode: Option.none(),
|
||||
port: Option.none(),
|
||||
host: Option.none(),
|
||||
stateDir: Option.none(),
|
||||
devUrl: Option.none(),
|
||||
noBrowser: Option.none(),
|
||||
authToken: Option.none(),
|
||||
autoBootstrapProjectFromCwd: Option.none(),
|
||||
logWebSocketEvents: Option.none(),
|
||||
});
|
||||
|
||||
describe("cli config resolution", () => {
|
||||
it.effect("falls back to environment values when flags are omitted", () =>
|
||||
Effect.gen(function* () {
|
||||
const resolved = yield* resolveServerConfig(emptyInput()).pipe(
|
||||
Effect.provide(NetService.layer),
|
||||
Effect.provide(NodeServices.layer),
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_PORT: "4123",
|
||||
T3CODE_HOST: "127.0.0.1",
|
||||
T3CODE_STATE_DIR: "/tmp/t3-state",
|
||||
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
T3CODE_AUTH_TOKEN: "secret",
|
||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||
T3CODE_LOG_WS_EVENTS: "true",
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
expect(resolved).toEqual({
|
||||
mode: "desktop",
|
||||
port: 4123,
|
||||
host: "127.0.0.1",
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: "/tmp/t3-state/keybindings.json",
|
||||
stateDir: "/tmp/t3-state",
|
||||
staticDir: undefined,
|
||||
devUrl: new URL("http://127.0.0.1:5173"),
|
||||
noBrowser: true,
|
||||
authToken: "secret",
|
||||
autoBootstrapProjectFromCwd: false,
|
||||
logWebSocketEvents: true,
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses CLI flags as the final override", () =>
|
||||
Effect.gen(function* () {
|
||||
const resolved = yield* resolveServerConfig({
|
||||
...emptyInput(),
|
||||
mode: Option.some("web"),
|
||||
port: Option.some(4444),
|
||||
host: Option.some("0.0.0.0"),
|
||||
stateDir: Option.some("/tmp/t3-override"),
|
||||
devUrl: Option.some(new URL("http://127.0.0.1:4173")),
|
||||
noBrowser: Option.some("false"),
|
||||
authToken: Option.some("override-token"),
|
||||
autoBootstrapProjectFromCwd: Option.some("true"),
|
||||
logWebSocketEvents: Option.some("false"),
|
||||
}).pipe(
|
||||
Effect.provide(NetService.layer),
|
||||
Effect.provide(NodeServices.layer),
|
||||
Effect.provideService(
|
||||
ConfigProvider.ConfigProvider,
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_PORT: "4123",
|
||||
T3CODE_HOST: "127.0.0.1",
|
||||
T3CODE_STATE_DIR: "/tmp/t3-state",
|
||||
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
T3CODE_AUTH_TOKEN: "secret",
|
||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||
T3CODE_LOG_WS_EVENTS: "true",
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
expect(resolved).toEqual({
|
||||
mode: "web",
|
||||
port: 4444,
|
||||
host: "0.0.0.0",
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: "/tmp/t3-override/keybindings.json",
|
||||
stateDir: "/tmp/t3-override",
|
||||
staticDir: undefined,
|
||||
devUrl: new URL("http://127.0.0.1:4173"),
|
||||
noBrowser: false,
|
||||
authToken: "override-token",
|
||||
autoBootstrapProjectFromCwd: true,
|
||||
logWebSocketEvents: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,212 @@
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Config, Data, Effect, Layer, Option, Path, Schema } from "effect";
|
||||
import { Command, Flag } from "effect/unstable/cli";
|
||||
|
||||
import {
|
||||
DEFAULT_PORT,
|
||||
resolveStaticDir,
|
||||
ServerConfig,
|
||||
type RuntimeMode,
|
||||
type ServerConfigShape,
|
||||
} from "./config";
|
||||
import { fixPath, resolveStateDir } from "./os-jank";
|
||||
import { runServer } from "./server";
|
||||
|
||||
export class StartupError extends Data.TaggedError("StartupError")<{
|
||||
readonly message: string;
|
||||
readonly cause?: unknown;
|
||||
}> {}
|
||||
|
||||
type CliBooleanFlag = "true" | "false";
|
||||
|
||||
const parseCliBoolean = (value: CliBooleanFlag): boolean => value === "true";
|
||||
|
||||
const resolveBooleanSetting = (
|
||||
value: Option.Option<CliBooleanFlag>,
|
||||
envValue: boolean | undefined,
|
||||
fallback: boolean,
|
||||
): boolean =>
|
||||
Option.match(value, {
|
||||
onSome: parseCliBoolean,
|
||||
onNone: () => envValue ?? fallback,
|
||||
});
|
||||
|
||||
export interface CliInput {
|
||||
readonly mode: Option.Option<RuntimeMode>;
|
||||
readonly port: Option.Option<number>;
|
||||
readonly host: Option.Option<string>;
|
||||
readonly stateDir: Option.Option<string>;
|
||||
readonly devUrl: Option.Option<URL>;
|
||||
readonly noBrowser: Option.Option<CliBooleanFlag>;
|
||||
readonly authToken: Option.Option<string>;
|
||||
readonly autoBootstrapProjectFromCwd: Option.Option<CliBooleanFlag>;
|
||||
readonly logWebSocketEvents: Option.Option<CliBooleanFlag>;
|
||||
}
|
||||
|
||||
const CliEnvConfig = Config.all({
|
||||
mode: Config.string("T3CODE_MODE").pipe(
|
||||
Config.option,
|
||||
Config.map(
|
||||
Option.match<RuntimeMode, string>({
|
||||
onNone: () => "web",
|
||||
onSome: (value) => (value === "desktop" ? "desktop" : "web"),
|
||||
}),
|
||||
),
|
||||
),
|
||||
port: Config.port("T3CODE_PORT").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
host: Config.string("T3CODE_HOST").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
stateDir: Config.string("T3CODE_STATE_DIR").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
devUrl: Config.url("VITE_DEV_SERVER_URL").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
noBrowser: Config.boolean("T3CODE_NO_BROWSER").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
authToken: Config.string("T3CODE_AUTH_TOKEN").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
autoBootstrapProjectFromCwd: Config.boolean("T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
logWebSocketEvents: Config.boolean("T3CODE_LOG_WS_EVENTS").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
});
|
||||
|
||||
export const resolveServerConfig = (input: CliInput) =>
|
||||
Effect.gen(function* () {
|
||||
const { findAvailablePort } = yield* NetService;
|
||||
const { join } = yield* Path.Path;
|
||||
|
||||
yield* Effect.sync(fixPath);
|
||||
|
||||
const env = yield* CliEnvConfig.asEffect().pipe(
|
||||
Effect.mapError(
|
||||
(cause) => new StartupError({ message: "Failed to read environment configuration", cause }),
|
||||
),
|
||||
);
|
||||
|
||||
const mode = Option.getOrElse(input.mode, () => env.mode);
|
||||
const port = yield* Option.match(input.port, {
|
||||
onSome: Effect.succeed,
|
||||
onNone: () => {
|
||||
if (env.port) {
|
||||
return Effect.succeed(env.port);
|
||||
}
|
||||
if (mode === "desktop") {
|
||||
return Effect.succeed(DEFAULT_PORT);
|
||||
}
|
||||
return findAvailablePort(DEFAULT_PORT);
|
||||
},
|
||||
});
|
||||
|
||||
const stateDir = yield* resolveStateDir(Option.getOrUndefined(input.stateDir) ?? env.stateDir);
|
||||
const devUrl = Option.getOrElse(input.devUrl, () => env.devUrl);
|
||||
|
||||
return {
|
||||
mode,
|
||||
port,
|
||||
cwd: process.cwd(),
|
||||
keybindingsConfigPath: join(stateDir, "keybindings.json"),
|
||||
host:
|
||||
Option.getOrUndefined(input.host) ??
|
||||
env.host ??
|
||||
(mode === "desktop" ? "127.0.0.1" : undefined),
|
||||
stateDir,
|
||||
staticDir: devUrl ? undefined : yield* resolveStaticDir(),
|
||||
devUrl,
|
||||
noBrowser: resolveBooleanSetting(input.noBrowser, env.noBrowser, mode === "desktop"),
|
||||
authToken: Option.getOrUndefined(input.authToken) ?? env.authToken,
|
||||
autoBootstrapProjectFromCwd: resolveBooleanSetting(
|
||||
input.autoBootstrapProjectFromCwd,
|
||||
env.autoBootstrapProjectFromCwd,
|
||||
mode === "web",
|
||||
),
|
||||
logWebSocketEvents: resolveBooleanSetting(
|
||||
input.logWebSocketEvents,
|
||||
env.logWebSocketEvents,
|
||||
Boolean(devUrl),
|
||||
),
|
||||
} satisfies ServerConfigShape;
|
||||
});
|
||||
|
||||
const modeFlag = Flag.choice("mode", ["web", "desktop"]).pipe(
|
||||
Flag.withDescription("Runtime mode. `desktop` keeps loopback defaults unless overridden."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const portFlag = Flag.integer("port").pipe(
|
||||
Flag.withSchema(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 }))),
|
||||
Flag.withDescription("Port for the HTTP/WebSocket server."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const hostFlag = Flag.string("host").pipe(
|
||||
Flag.withDescription("Host/interface to bind (for example 127.0.0.1, 0.0.0.0, or a Tailnet IP)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const stateDirFlag = Flag.string("state-dir").pipe(
|
||||
Flag.withDescription("State directory path (equivalent to T3CODE_STATE_DIR)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const devUrlFlag = Flag.string("dev-url").pipe(
|
||||
Flag.withSchema(Schema.URLFromString),
|
||||
Flag.withDescription("Dev web URL to proxy/redirect to (equivalent to VITE_DEV_SERVER_URL)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const noBrowserFlag = Flag.choice("no-browser", ["true", "false"]).pipe(
|
||||
Flag.withDescription("Disable automatic browser opening (`true` or `false`)."),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const authTokenFlag = Flag.string("auth-token").pipe(
|
||||
Flag.withDescription("Auth token required for WebSocket connections."),
|
||||
Flag.withAlias("token"),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const autoBootstrapProjectFromCwdFlag = Flag.choice(
|
||||
"auto-bootstrap-project-from-cwd",
|
||||
["true", "false"],
|
||||
).pipe(
|
||||
Flag.withDescription(
|
||||
"Create a project for the current working directory on startup when missing (`true` or `false`).",
|
||||
),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
const logWebSocketEventsFlag = Flag.choice("log-websocket-events", ["true", "false"]).pipe(
|
||||
Flag.withDescription(
|
||||
"Emit server-side logs for outbound WebSocket push traffic (`true` or `false`).",
|
||||
),
|
||||
Flag.withAlias("log-ws-events"),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
export const t3Cli = Command.make("t3", {
|
||||
mode: modeFlag,
|
||||
port: portFlag,
|
||||
host: hostFlag,
|
||||
stateDir: stateDirFlag,
|
||||
devUrl: devUrlFlag,
|
||||
noBrowser: noBrowserFlag,
|
||||
authToken: authTokenFlag,
|
||||
autoBootstrapProjectFromCwd: autoBootstrapProjectFromCwdFlag,
|
||||
logWebSocketEvents: logWebSocketEventsFlag,
|
||||
}).pipe(
|
||||
Command.withDescription("Run the T3 Code server."),
|
||||
Command.withHandler((input: CliInput) =>
|
||||
Effect.flatMap(resolveServerConfig(input), (config) =>
|
||||
runServer.pipe(Effect.provideService(ServerConfig, config)),
|
||||
).pipe(Effect.provide(Layer.mergeAll(NetService.layer, NodeServices.layer))),
|
||||
),
|
||||
);
|
||||
@@ -1,23 +0,0 @@
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
|
||||
import { CliConfig, t3Cli } from "./main";
|
||||
import { OpenLive } from "./open";
|
||||
import { Command } from "effect/unstable/cli";
|
||||
import { version } from "../package.json" with { type: "json" };
|
||||
import { ServerLive } from "./wsServer";
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import { FetchHttpClient } from "effect/unstable/http";
|
||||
|
||||
const RuntimeLayer = Layer.empty.pipe(
|
||||
Layer.provideMerge(CliConfig.layer),
|
||||
Layer.provideMerge(ServerLive),
|
||||
Layer.provideMerge(OpenLive),
|
||||
Layer.provideMerge(NetService.layer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provideMerge(FetchHttpClient.layer),
|
||||
);
|
||||
|
||||
Command.run(t3Cli, { version }).pipe(Effect.provide(RuntimeLayer), NodeRuntime.runMain);
|
||||
@@ -1,300 +0,0 @@
|
||||
import * as Http from "node:http";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it, vi } from "@effect/vitest";
|
||||
import type { OrchestrationReadModel } from "@t3tools/contracts";
|
||||
import * as ConfigProvider from "effect/ConfigProvider";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Command from "effect/unstable/cli/Command";
|
||||
import { FetchHttpClient } from "effect/unstable/http";
|
||||
import { beforeEach } from "vitest";
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
|
||||
import { CliConfig, recordStartupHeartbeat, t3Cli, type CliConfigShape } from "./main";
|
||||
import { ServerConfig, type ServerConfigShape } from "./config";
|
||||
import { Open, type OpenShape } from "./open";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService";
|
||||
import { Server, type ServerShape } from "./wsServer";
|
||||
|
||||
const start = vi.fn(() => undefined);
|
||||
const stop = vi.fn(() => undefined);
|
||||
let resolvedConfig: ServerConfigShape | null = null;
|
||||
const serverStart = Effect.acquireRelease(
|
||||
Effect.gen(function* () {
|
||||
resolvedConfig = yield* ServerConfig;
|
||||
start();
|
||||
return {} as unknown as Http.Server;
|
||||
}),
|
||||
() => Effect.sync(() => stop()),
|
||||
);
|
||||
const findAvailablePort = vi.fn((preferred: number) => Effect.succeed(preferred));
|
||||
|
||||
// Shared service layer used by this CLI test suite.
|
||||
const testLayer = Layer.mergeAll(
|
||||
Layer.succeed(CliConfig, {
|
||||
cwd: "/tmp/t3-test-workspace",
|
||||
fixPath: Effect.void,
|
||||
resolveStaticDir: Effect.undefined,
|
||||
} satisfies CliConfigShape),
|
||||
Layer.succeed(NetService, {
|
||||
canListenOnHost: () => Effect.succeed(true),
|
||||
isPortAvailableOnLoopback: () => Effect.succeed(true),
|
||||
reserveLoopbackPort: () => Effect.succeed(0),
|
||||
findAvailablePort,
|
||||
}),
|
||||
Layer.succeed(Server, {
|
||||
start: serverStart,
|
||||
stopSignal: Effect.void,
|
||||
} satisfies ServerShape),
|
||||
Layer.succeed(Open, {
|
||||
openBrowser: (_target: string) => Effect.void,
|
||||
openInEditor: () => Effect.void,
|
||||
} satisfies OpenShape),
|
||||
AnalyticsService.layerTest,
|
||||
FetchHttpClient.layer,
|
||||
NodeServices.layer,
|
||||
);
|
||||
|
||||
const runCli = (
|
||||
args: ReadonlyArray<string>,
|
||||
env: Record<string, string> = { T3CODE_NO_BROWSER: "true" },
|
||||
) => {
|
||||
const uniqueStateDir = `/tmp/t3-cli-state-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
return Command.runWith(t3Cli, { version: "0.0.0-test" })(args).pipe(
|
||||
Effect.provide(
|
||||
ConfigProvider.layer(
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_STATE_DIR: uniqueStateDir,
|
||||
...env,
|
||||
},
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
resolvedConfig = null;
|
||||
start.mockImplementation(() => undefined);
|
||||
stop.mockImplementation(() => undefined);
|
||||
findAvailablePort.mockImplementation((preferred: number) => Effect.succeed(preferred));
|
||||
});
|
||||
|
||||
it.layer(testLayer)("server CLI command", (it) => {
|
||||
it.effect("parses all CLI flags and wires scoped start/stop", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli([
|
||||
"--mode",
|
||||
"desktop",
|
||||
"--port",
|
||||
"4010",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--state-dir",
|
||||
"/tmp/t3-cli-state",
|
||||
"--dev-url",
|
||||
"http://127.0.0.1:5173",
|
||||
"--no-browser",
|
||||
"--auth-token",
|
||||
"auth-secret",
|
||||
]);
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.mode, "desktop");
|
||||
assert.equal(resolvedConfig?.port, 4010);
|
||||
assert.equal(resolvedConfig?.host, "0.0.0.0");
|
||||
assert.equal(resolvedConfig?.stateDir, "/tmp/t3-cli-state");
|
||||
assert.equal(resolvedConfig?.devUrl?.toString(), "http://127.0.0.1:5173/");
|
||||
assert.equal(resolvedConfig?.noBrowser, true);
|
||||
assert.equal(resolvedConfig?.authToken, "auth-secret");
|
||||
assert.equal(resolvedConfig?.autoBootstrapProjectFromCwd, false);
|
||||
assert.equal(resolvedConfig?.logWebSocketEvents, true);
|
||||
assert.equal(stop.mock.calls.length, 1);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("supports --token as an alias for --auth-token", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--token", "token-secret"]);
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.authToken, "token-secret");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses env fallbacks when flags are not provided", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli([], {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_PORT: "4999",
|
||||
T3CODE_HOST: "100.88.10.4",
|
||||
T3CODE_STATE_DIR: "/tmp/t3-env-state",
|
||||
VITE_DEV_SERVER_URL: "http://localhost:5173",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
T3CODE_AUTH_TOKEN: "env-token",
|
||||
});
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.mode, "desktop");
|
||||
assert.equal(resolvedConfig?.port, 4999);
|
||||
assert.equal(resolvedConfig?.host, "100.88.10.4");
|
||||
assert.equal(resolvedConfig?.stateDir, "/tmp/t3-env-state");
|
||||
assert.equal(resolvedConfig?.devUrl?.toString(), "http://localhost:5173/");
|
||||
assert.equal(resolvedConfig?.noBrowser, true);
|
||||
assert.equal(resolvedConfig?.authToken, "env-token");
|
||||
assert.equal(resolvedConfig?.autoBootstrapProjectFromCwd, false);
|
||||
assert.equal(resolvedConfig?.logWebSocketEvents, true);
|
||||
assert.equal(findAvailablePort.mock.calls.length, 0);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("prefers --mode over T3CODE_MODE", () =>
|
||||
Effect.gen(function* () {
|
||||
findAvailablePort.mockImplementation((_preferred: number) => Effect.succeed(4666));
|
||||
yield* runCli(["--mode", "web"], {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(findAvailablePort.mock.calls, [[3773]]);
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.mode, "web");
|
||||
assert.equal(resolvedConfig?.port, 4666);
|
||||
assert.equal(resolvedConfig?.host, undefined);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("prefers --no-browser over T3CODE_NO_BROWSER", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--no-browser"], {
|
||||
T3CODE_NO_BROWSER: "false",
|
||||
});
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.noBrowser, true);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses dynamic port discovery in web mode when port is omitted", () =>
|
||||
Effect.gen(function* () {
|
||||
findAvailablePort.mockImplementation((_preferred: number) => Effect.succeed(5444));
|
||||
yield* runCli([]);
|
||||
|
||||
assert.deepStrictEqual(findAvailablePort.mock.calls, [[3773]]);
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.port, 5444);
|
||||
assert.equal(resolvedConfig?.mode, "web");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("uses fixed localhost defaults in desktop mode", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli([], {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
});
|
||||
|
||||
assert.equal(findAvailablePort.mock.calls.length, 0);
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.port, 3773);
|
||||
assert.equal(resolvedConfig?.host, "127.0.0.1");
|
||||
assert.equal(resolvedConfig?.mode, "desktop");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("allows overriding desktop host with --host", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--host", "0.0.0.0"], {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
});
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.mode, "desktop");
|
||||
assert.equal(resolvedConfig?.host, "0.0.0.0");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("supports CLI and env for bootstrap/log websocket toggles", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--auto-bootstrap-project-from-cwd"], {
|
||||
T3CODE_MODE: "desktop",
|
||||
T3CODE_LOG_WS_EVENTS: "false",
|
||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||
T3CODE_NO_BROWSER: "true",
|
||||
});
|
||||
|
||||
assert.equal(start.mock.calls.length, 1);
|
||||
assert.equal(resolvedConfig?.autoBootstrapProjectFromCwd, true);
|
||||
assert.equal(resolvedConfig?.logWebSocketEvents, false);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("records a startup heartbeat with thread/project counts", () =>
|
||||
Effect.gen(function* () {
|
||||
const recordTelemetry = vi.fn(
|
||||
(_event: string, _properties?: Readonly<Record<string, unknown>>) => Effect.void,
|
||||
);
|
||||
const getSnapshot = vi.fn(() =>
|
||||
Effect.succeed({
|
||||
snapshotSequence: 2,
|
||||
projects: [{} as OrchestrationReadModel["projects"][number]],
|
||||
threads: [
|
||||
{} as OrchestrationReadModel["threads"][number],
|
||||
{} as OrchestrationReadModel["threads"][number],
|
||||
],
|
||||
updatedAt: new Date(1).toISOString(),
|
||||
} satisfies OrchestrationReadModel),
|
||||
);
|
||||
|
||||
yield* recordStartupHeartbeat.pipe(
|
||||
Effect.provideService(ProjectionSnapshotQuery, {
|
||||
getSnapshot,
|
||||
}),
|
||||
Effect.provideService(AnalyticsService, {
|
||||
record: recordTelemetry,
|
||||
flush: Effect.void,
|
||||
}),
|
||||
);
|
||||
|
||||
assert.deepEqual(recordTelemetry.mock.calls[0], [
|
||||
"server.boot.heartbeat",
|
||||
{
|
||||
threadCount: 2,
|
||||
projectCount: 1,
|
||||
},
|
||||
]);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("does not start server for invalid --mode values", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--mode", "invalid"]);
|
||||
|
||||
assert.equal(start.mock.calls.length, 0);
|
||||
assert.equal(stop.mock.calls.length, 0);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("does not start server for invalid --dev-url values", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--dev-url", "not-a-url"]).pipe(Effect.catch(() => Effect.void));
|
||||
|
||||
assert.equal(start.mock.calls.length, 0);
|
||||
assert.equal(stop.mock.calls.length, 0);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("does not start server for out-of-range --port values", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* runCli(["--port", "70000"]);
|
||||
|
||||
// effect/unstable/cli renders help/errors for parse failures and returns success.
|
||||
assert.equal(start.mock.calls.length, 0);
|
||||
assert.equal(stop.mock.calls.length, 0);
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1,347 +0,0 @@
|
||||
/**
|
||||
* CliConfig - CLI/runtime bootstrap service definitions.
|
||||
*
|
||||
* Defines startup-only service contracts used while resolving process config
|
||||
* and constructing server runtime layers.
|
||||
*
|
||||
* @module CliConfig
|
||||
*/
|
||||
import { Config, Data, Effect, FileSystem, Layer, Option, Path, Schema, ServiceMap } from "effect";
|
||||
import { Command, Flag } from "effect/unstable/cli";
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import {
|
||||
DEFAULT_PORT,
|
||||
resolveStaticDir,
|
||||
ServerConfig,
|
||||
type RuntimeMode,
|
||||
type ServerConfigShape,
|
||||
} from "./config";
|
||||
import { fixPath, resolveStateDir } from "./os-jank";
|
||||
import { Open } from "./open";
|
||||
import * as SqlitePersistence from "./persistence/Layers/Sqlite";
|
||||
import { makeServerProviderLayer, makeServerRuntimeServicesLayer } from "./serverLayers";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { ProviderHealthLive } from "./provider/Layers/ProviderHealth";
|
||||
import { Server } from "./wsServer";
|
||||
import { ServerLoggerLive } from "./serverLogger";
|
||||
import { AnalyticsServiceLayerLive } from "./telemetry/Layers/AnalyticsService";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService";
|
||||
|
||||
export class StartupError extends Data.TaggedError("StartupError")<{
|
||||
readonly message: string;
|
||||
readonly cause?: unknown;
|
||||
}> {}
|
||||
|
||||
interface CliInput {
|
||||
readonly mode: Option.Option<RuntimeMode>;
|
||||
readonly port: Option.Option<number>;
|
||||
readonly host: Option.Option<string>;
|
||||
readonly stateDir: Option.Option<string>;
|
||||
readonly devUrl: Option.Option<URL>;
|
||||
readonly noBrowser: Option.Option<boolean>;
|
||||
readonly authToken: Option.Option<string>;
|
||||
readonly autoBootstrapProjectFromCwd: Option.Option<boolean>;
|
||||
readonly logWebSocketEvents: Option.Option<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
* CliConfigShape - Startup helpers required while building server layers.
|
||||
*/
|
||||
export interface CliConfigShape {
|
||||
/**
|
||||
* Current process working directory.
|
||||
*/
|
||||
readonly cwd: string;
|
||||
|
||||
/**
|
||||
* Apply OS-specific PATH normalization.
|
||||
*/
|
||||
readonly fixPath: Effect.Effect<void>;
|
||||
|
||||
/**
|
||||
* Resolve static web asset directory for server mode.
|
||||
*/
|
||||
readonly resolveStaticDir: Effect.Effect<string | undefined>;
|
||||
}
|
||||
|
||||
/**
|
||||
* CliConfig - Service tag for startup CLI/runtime helpers.
|
||||
*/
|
||||
export class CliConfig extends ServiceMap.Service<CliConfig, CliConfigShape>()(
|
||||
"t3/main/CliConfig",
|
||||
) {
|
||||
static readonly layer = Layer.effect(
|
||||
CliConfig,
|
||||
Effect.gen(function* () {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
return {
|
||||
cwd: process.cwd(),
|
||||
fixPath: Effect.sync(fixPath),
|
||||
resolveStaticDir: resolveStaticDir().pipe(
|
||||
Effect.provideService(FileSystem.FileSystem, fileSystem),
|
||||
Effect.provideService(Path.Path, path),
|
||||
),
|
||||
} satisfies CliConfigShape;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const CliEnvConfig = Config.all({
|
||||
mode: Config.string("T3CODE_MODE").pipe(
|
||||
Config.option,
|
||||
Config.map(
|
||||
Option.match<RuntimeMode, string>({
|
||||
onNone: () => "web",
|
||||
onSome: (value) => (value === "desktop" ? "desktop" : "web"),
|
||||
}),
|
||||
),
|
||||
),
|
||||
port: Config.port("T3CODE_PORT").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
host: Config.string("T3CODE_HOST").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
stateDir: Config.string("T3CODE_STATE_DIR").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
devUrl: Config.url("VITE_DEV_SERVER_URL").pipe(Config.option, Config.map(Option.getOrUndefined)),
|
||||
noBrowser: Config.boolean("T3CODE_NO_BROWSER").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
authToken: Config.string("T3CODE_AUTH_TOKEN").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
autoBootstrapProjectFromCwd: Config.boolean("T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
logWebSocketEvents: Config.boolean("T3CODE_LOG_WS_EVENTS").pipe(
|
||||
Config.option,
|
||||
Config.map(Option.getOrUndefined),
|
||||
),
|
||||
});
|
||||
|
||||
const resolveBooleanFlag = (flag: Option.Option<boolean>, envValue: boolean) =>
|
||||
Option.getOrElse(Option.filter(flag, Boolean), () => envValue);
|
||||
|
||||
const ServerConfigLive = (input: CliInput) =>
|
||||
Layer.effect(
|
||||
ServerConfig,
|
||||
Effect.gen(function* () {
|
||||
const cliConfig = yield* CliConfig;
|
||||
const { findAvailablePort } = yield* NetService;
|
||||
const env = yield* CliEnvConfig.asEffect().pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new StartupError({ message: "Failed to read environment configuration", cause }),
|
||||
),
|
||||
);
|
||||
|
||||
const mode = Option.getOrElse(input.mode, () => env.mode);
|
||||
|
||||
const port = yield* Option.match(input.port, {
|
||||
onSome: (value) => Effect.succeed(value),
|
||||
onNone: () => {
|
||||
if (env.port) {
|
||||
return Effect.succeed(env.port);
|
||||
}
|
||||
if (mode === "desktop") {
|
||||
return Effect.succeed(DEFAULT_PORT);
|
||||
}
|
||||
return findAvailablePort(DEFAULT_PORT);
|
||||
},
|
||||
});
|
||||
const stateDir = yield* resolveStateDir(
|
||||
Option.getOrUndefined(input.stateDir) ?? env.stateDir,
|
||||
);
|
||||
const devUrl = Option.getOrElse(input.devUrl, () => env.devUrl);
|
||||
const noBrowser = resolveBooleanFlag(input.noBrowser, env.noBrowser ?? mode === "desktop");
|
||||
const authToken = Option.getOrUndefined(input.authToken) ?? env.authToken;
|
||||
const autoBootstrapProjectFromCwd = resolveBooleanFlag(
|
||||
input.autoBootstrapProjectFromCwd,
|
||||
env.autoBootstrapProjectFromCwd ?? mode === "web",
|
||||
);
|
||||
const logWebSocketEvents = resolveBooleanFlag(
|
||||
input.logWebSocketEvents,
|
||||
env.logWebSocketEvents ?? Boolean(devUrl),
|
||||
);
|
||||
const staticDir = devUrl ? undefined : yield* cliConfig.resolveStaticDir;
|
||||
const { join } = yield* Path.Path;
|
||||
const keybindingsConfigPath = join(stateDir, "keybindings.json");
|
||||
const host =
|
||||
Option.getOrUndefined(input.host) ??
|
||||
env.host ??
|
||||
(mode === "desktop" ? "127.0.0.1" : undefined);
|
||||
|
||||
const config: ServerConfigShape = {
|
||||
mode,
|
||||
port,
|
||||
cwd: cliConfig.cwd,
|
||||
keybindingsConfigPath,
|
||||
host,
|
||||
stateDir,
|
||||
staticDir,
|
||||
devUrl,
|
||||
noBrowser,
|
||||
authToken,
|
||||
autoBootstrapProjectFromCwd,
|
||||
logWebSocketEvents,
|
||||
} satisfies ServerConfigShape;
|
||||
|
||||
return config;
|
||||
}),
|
||||
);
|
||||
|
||||
const LayerLive = (input: CliInput) =>
|
||||
Layer.empty.pipe(
|
||||
Layer.provideMerge(makeServerRuntimeServicesLayer()),
|
||||
Layer.provideMerge(makeServerProviderLayer()),
|
||||
Layer.provideMerge(ProviderHealthLive),
|
||||
Layer.provideMerge(SqlitePersistence.layerConfig),
|
||||
Layer.provideMerge(ServerLoggerLive),
|
||||
Layer.provideMerge(AnalyticsServiceLayerLive),
|
||||
Layer.provideMerge(ServerConfigLive(input)),
|
||||
);
|
||||
|
||||
const isWildcardHost = (host: string | undefined): boolean =>
|
||||
host === "0.0.0.0" || host === "::" || host === "[::]";
|
||||
|
||||
const formatHostForUrl = (host: string): string =>
|
||||
host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
||||
|
||||
export const recordStartupHeartbeat = Effect.gen(function* () {
|
||||
const analytics = yield* AnalyticsService;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
|
||||
const { threadCount, projectCount } = yield* projectionSnapshotQuery.getSnapshot().pipe(
|
||||
Effect.map((snapshot) => ({
|
||||
threadCount: snapshot.threads.length,
|
||||
projectCount: snapshot.projects.length,
|
||||
})),
|
||||
Effect.catch((cause) =>
|
||||
Effect.logWarning("failed to gather startup snapshot for telemetry", { cause }).pipe(
|
||||
Effect.as({
|
||||
threadCount: 0,
|
||||
projectCount: 0,
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
yield* analytics.record("server.boot.heartbeat", {
|
||||
threadCount,
|
||||
projectCount,
|
||||
});
|
||||
});
|
||||
|
||||
const makeServerProgram = (input: CliInput) =>
|
||||
Effect.gen(function* () {
|
||||
const cliConfig = yield* CliConfig;
|
||||
const { start, stopSignal } = yield* Server;
|
||||
const openDeps = yield* Open;
|
||||
yield* cliConfig.fixPath;
|
||||
|
||||
const config = yield* ServerConfig;
|
||||
|
||||
if (!config.devUrl && !config.staticDir) {
|
||||
yield* Effect.logWarning(
|
||||
"web bundle missing and no VITE_DEV_SERVER_URL; web UI unavailable",
|
||||
{
|
||||
hint: "Run `bun run --cwd apps/web build` or set VITE_DEV_SERVER_URL for dev mode.",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
yield* start;
|
||||
yield* Effect.forkChild(recordStartupHeartbeat);
|
||||
|
||||
const localUrl = `http://localhost:${config.port}`;
|
||||
const bindUrl =
|
||||
config.host && !isWildcardHost(config.host)
|
||||
? `http://${formatHostForUrl(config.host)}:${config.port}`
|
||||
: localUrl;
|
||||
const { authToken, devUrl, ...safeConfig } = config;
|
||||
yield* Effect.logInfo("T3 Code running", {
|
||||
...safeConfig,
|
||||
devUrl: devUrl?.toString(),
|
||||
authEnabled: Boolean(authToken),
|
||||
});
|
||||
|
||||
if (!config.noBrowser) {
|
||||
const target = config.devUrl?.toString() ?? bindUrl;
|
||||
yield* openDeps.openBrowser(target).pipe(
|
||||
Effect.catch(() =>
|
||||
Effect.logInfo("browser auto-open unavailable", {
|
||||
hint: `Open ${target} in your browser.`,
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return yield* stopSignal;
|
||||
}).pipe(Effect.provide(LayerLive(input)));
|
||||
|
||||
/**
|
||||
* These flags mirrors the environment variables and the config shape.
|
||||
*/
|
||||
|
||||
const modeFlag = Flag.choice("mode", ["web", "desktop"]).pipe(
|
||||
Flag.withDescription("Runtime mode. `desktop` keeps loopback defaults unless overridden."),
|
||||
Flag.optional,
|
||||
);
|
||||
const portFlag = Flag.integer("port").pipe(
|
||||
Flag.withSchema(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 }))),
|
||||
Flag.withDescription("Port for the HTTP/WebSocket server."),
|
||||
Flag.optional,
|
||||
);
|
||||
const hostFlag = Flag.string("host").pipe(
|
||||
Flag.withDescription("Host/interface to bind (for example 127.0.0.1, 0.0.0.0, or a Tailnet IP)."),
|
||||
Flag.optional,
|
||||
);
|
||||
const stateDirFlag = Flag.string("state-dir").pipe(
|
||||
Flag.withDescription("State directory path (equivalent to T3CODE_STATE_DIR)."),
|
||||
Flag.optional,
|
||||
);
|
||||
const devUrlFlag = Flag.string("dev-url").pipe(
|
||||
Flag.withSchema(Schema.URLFromString),
|
||||
Flag.withDescription("Dev web URL to proxy/redirect to (equivalent to VITE_DEV_SERVER_URL)."),
|
||||
Flag.optional,
|
||||
);
|
||||
const noBrowserFlag = Flag.boolean("no-browser").pipe(
|
||||
Flag.withDescription("Disable automatic browser opening."),
|
||||
Flag.optional,
|
||||
);
|
||||
const authTokenFlag = Flag.string("auth-token").pipe(
|
||||
Flag.withDescription("Auth token required for WebSocket connections."),
|
||||
Flag.withAlias("token"),
|
||||
Flag.optional,
|
||||
);
|
||||
const autoBootstrapProjectFromCwdFlag = Flag.boolean("auto-bootstrap-project-from-cwd").pipe(
|
||||
Flag.withDescription(
|
||||
"Create a project for the current working directory on startup when missing.",
|
||||
),
|
||||
Flag.optional,
|
||||
);
|
||||
const logWebSocketEventsFlag = Flag.boolean("log-websocket-events").pipe(
|
||||
Flag.withDescription(
|
||||
"Emit server-side logs for outbound WebSocket push traffic (equivalent to T3CODE_LOG_WS_EVENTS).",
|
||||
),
|
||||
Flag.withAlias("log-ws-events"),
|
||||
Flag.optional,
|
||||
);
|
||||
|
||||
export const t3Cli = Command.make("t3", {
|
||||
mode: modeFlag,
|
||||
port: portFlag,
|
||||
host: hostFlag,
|
||||
stateDir: stateDirFlag,
|
||||
devUrl: devUrlFlag,
|
||||
noBrowser: noBrowserFlag,
|
||||
authToken: authTokenFlag,
|
||||
autoBootstrapProjectFromCwd: autoBootstrapProjectFromCwdFlag,
|
||||
logWebSocketEvents: logWebSocketEventsFlag,
|
||||
}).pipe(
|
||||
Command.withDescription("Run the T3 Code server."),
|
||||
Command.withHandler((input) => Effect.scoped(makeServerProgram(input))),
|
||||
);
|
||||
@@ -1,171 +1,138 @@
|
||||
import fs from "node:fs";
|
||||
import http from "node:http";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Path } from "effect";
|
||||
import { resolveProjectFaviconRoute } from "./projectFaviconRoute";
|
||||
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { tryHandleProjectFaviconRequest } from "./projectFaviconRoute";
|
||||
const layer = it.layer(NodeServices.layer);
|
||||
|
||||
interface HttpResponse {
|
||||
statusCode: number;
|
||||
contentType: string | null;
|
||||
body: string;
|
||||
}
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
function makeTempDir(prefix: string): string {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
||||
tempDirs.push(dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
async function withRouteServer(run: (baseUrl: string) => Promise<void>): Promise<void> {
|
||||
const server = http.createServer((req, res) => {
|
||||
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
||||
if (tryHandleProjectFaviconRequest(url, res)) {
|
||||
return;
|
||||
}
|
||||
res.writeHead(404, { "Content-Type": "text/plain" });
|
||||
res.end("Not Found");
|
||||
const makeProjectDir = (prefix: string) =>
|
||||
Effect.gen(function* () {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
return yield* fileSystem.makeTempDirectoryScoped({ prefix });
|
||||
});
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.listen(0, "127.0.0.1", (error?: Error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
const writeProjectFile = (projectDir: string, relativePath: string, contents: string) =>
|
||||
Effect.gen(function* () {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const filePath = path.join(projectDir, relativePath);
|
||||
yield* fileSystem.makeDirectory(path.dirname(filePath), { recursive: true });
|
||||
yield* fileSystem.writeFileString(filePath, contents);
|
||||
return filePath;
|
||||
});
|
||||
|
||||
const address = server.address();
|
||||
if (typeof address !== "object" || address === null) {
|
||||
throw new Error("Expected server address to be an object");
|
||||
}
|
||||
const baseUrl = `http://127.0.0.1:${address.port}`;
|
||||
|
||||
try {
|
||||
await run(baseUrl);
|
||||
} finally {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.close((error?: Error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
layer("resolveProjectFaviconRoute", (it) => {
|
||||
it.effect("returns 400 when cwd is missing", () =>
|
||||
Effect.gen(function* () {
|
||||
const response = yield* resolveProjectFaviconRoute(
|
||||
new URL("/api/project-favicon", "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(response, {
|
||||
kind: "body",
|
||||
statusCode: 400,
|
||||
body: "Missing cwd parameter",
|
||||
contentType: "text/plain",
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
async function request(baseUrl: string, pathname: string): Promise<HttpResponse> {
|
||||
const response = await fetch(`${baseUrl}${pathname}`);
|
||||
return {
|
||||
statusCode: response.status,
|
||||
contentType: response.headers.get("content-type"),
|
||||
body: await response.text(),
|
||||
};
|
||||
}
|
||||
it.effect("serves a well-known favicon file from the project root", () =>
|
||||
Effect.gen(function* () {
|
||||
const path = yield* Path.Path;
|
||||
const projectDir = yield* makeProjectDir("t3code-favicon-route-root-");
|
||||
yield* writeProjectFile(projectDir, "favicon.svg", "<svg>favicon</svg>");
|
||||
|
||||
describe("tryHandleProjectFaviconRequest", () => {
|
||||
afterEach(() => {
|
||||
for (const dir of tempDirs.splice(0, tempDirs.length)) {
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
const result = yield* resolveProjectFaviconRoute(
|
||||
new URL(`/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`, "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(result, {
|
||||
kind: "file",
|
||||
filePath: path.join(projectDir, "favicon.svg"),
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl: "public, max-age=3600",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it("returns 400 when cwd is missing", async () => {
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const response = await request(baseUrl, "/api/project-favicon");
|
||||
expect(response.statusCode).toBe(400);
|
||||
expect(response.body).toBe("Missing cwd parameter");
|
||||
});
|
||||
});
|
||||
it.effect("resolves icon href from source files when no well-known favicon exists", () =>
|
||||
Effect.gen(function* () {
|
||||
const projectDir = yield* makeProjectDir("t3code-favicon-route-source-");
|
||||
const iconPath = yield* writeProjectFile(projectDir, "public/brand/logo.svg", "<svg>brand</svg>");
|
||||
yield* writeProjectFile(projectDir, "index.html", '<link rel="icon" href="/brand/logo.svg">');
|
||||
|
||||
it("serves a well-known favicon file from the project root", async () => {
|
||||
const projectDir = makeTempDir("t3code-favicon-route-root-");
|
||||
fs.writeFileSync(path.join(projectDir, "favicon.svg"), "<svg>favicon</svg>", "utf8");
|
||||
const result = yield* resolveProjectFaviconRoute(
|
||||
new URL(`/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`, "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(result, {
|
||||
kind: "file",
|
||||
filePath: iconPath,
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl: "public, max-age=3600",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const pathname = `/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`;
|
||||
const response = await request(baseUrl, pathname);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.contentType).toContain("image/svg+xml");
|
||||
expect(response.body).toBe("<svg>favicon</svg>");
|
||||
});
|
||||
});
|
||||
it.effect("resolves icon link when href appears before rel in HTML", () =>
|
||||
Effect.gen(function* () {
|
||||
const projectDir = yield* makeProjectDir("t3code-favicon-route-html-order-");
|
||||
const iconPath = yield* writeProjectFile(
|
||||
projectDir,
|
||||
"public/brand/logo.svg",
|
||||
"<svg>brand-html-order</svg>",
|
||||
);
|
||||
yield* writeProjectFile(projectDir, "index.html", '<link href="/brand/logo.svg" rel="icon">');
|
||||
|
||||
it("resolves icon href from source files when no well-known favicon exists", async () => {
|
||||
const projectDir = makeTempDir("t3code-favicon-route-source-");
|
||||
const iconPath = path.join(projectDir, "public", "brand", "logo.svg");
|
||||
fs.mkdirSync(path.dirname(iconPath), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(projectDir, "index.html"),
|
||||
'<link rel="icon" href="/brand/logo.svg">',
|
||||
);
|
||||
fs.writeFileSync(iconPath, "<svg>brand</svg>", "utf8");
|
||||
const result = yield* resolveProjectFaviconRoute(
|
||||
new URL(`/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`, "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(result, {
|
||||
kind: "file",
|
||||
filePath: iconPath,
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl: "public, max-age=3600",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const pathname = `/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`;
|
||||
const response = await request(baseUrl, pathname);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.contentType).toContain("image/svg+xml");
|
||||
expect(response.body).toBe("<svg>brand</svg>");
|
||||
});
|
||||
});
|
||||
it.effect("resolves object-style icon metadata when href appears before rel", () =>
|
||||
Effect.gen(function* () {
|
||||
const projectDir = yield* makeProjectDir("t3code-favicon-route-obj-order-");
|
||||
const iconPath = yield* writeProjectFile(projectDir, "public/brand/obj.svg", "<svg>brand-obj-order</svg>");
|
||||
yield* writeProjectFile(
|
||||
projectDir,
|
||||
"src/root.tsx",
|
||||
'const links = [{ href: "/brand/obj.svg", rel: "icon" }];',
|
||||
);
|
||||
|
||||
it("resolves icon link when href appears before rel in HTML", async () => {
|
||||
const projectDir = makeTempDir("t3code-favicon-route-html-order-");
|
||||
const iconPath = path.join(projectDir, "public", "brand", "logo.svg");
|
||||
fs.mkdirSync(path.dirname(iconPath), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(projectDir, "index.html"),
|
||||
'<link href="/brand/logo.svg" rel="icon">',
|
||||
);
|
||||
fs.writeFileSync(iconPath, "<svg>brand-html-order</svg>", "utf8");
|
||||
const result = yield* resolveProjectFaviconRoute(
|
||||
new URL(`/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`, "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(result, {
|
||||
kind: "file",
|
||||
filePath: iconPath,
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl: "public, max-age=3600",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const pathname = `/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`;
|
||||
const response = await request(baseUrl, pathname);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.contentType).toContain("image/svg+xml");
|
||||
expect(response.body).toBe("<svg>brand-html-order</svg>");
|
||||
});
|
||||
});
|
||||
|
||||
it("resolves object-style icon metadata when href appears before rel", async () => {
|
||||
const projectDir = makeTempDir("t3code-favicon-route-obj-order-");
|
||||
const iconPath = path.join(projectDir, "public", "brand", "obj.svg");
|
||||
fs.mkdirSync(path.dirname(iconPath), { recursive: true });
|
||||
fs.mkdirSync(path.join(projectDir, "src"), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(projectDir, "src", "root.tsx"),
|
||||
'const links = [{ href: "/brand/obj.svg", rel: "icon" }];',
|
||||
"utf8",
|
||||
);
|
||||
fs.writeFileSync(iconPath, "<svg>brand-obj-order</svg>", "utf8");
|
||||
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const pathname = `/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`;
|
||||
const response = await request(baseUrl, pathname);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.contentType).toContain("image/svg+xml");
|
||||
expect(response.body).toBe("<svg>brand-obj-order</svg>");
|
||||
});
|
||||
});
|
||||
|
||||
it("serves a fallback favicon when no icon exists", async () => {
|
||||
const projectDir = makeTempDir("t3code-favicon-route-fallback-");
|
||||
|
||||
await withRouteServer(async (baseUrl) => {
|
||||
const pathname = `/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`;
|
||||
const response = await request(baseUrl, pathname);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.contentType).toContain("image/svg+xml");
|
||||
expect(response.body).toContain('data-fallback="project-favicon"');
|
||||
});
|
||||
});
|
||||
it.effect("serves a fallback favicon when no icon exists", () =>
|
||||
Effect.gen(function* () {
|
||||
const projectDir = yield* makeProjectDir("t3code-favicon-route-fallback-");
|
||||
const result = yield* resolveProjectFaviconRoute(
|
||||
new URL(`/api/project-favicon?cwd=${encodeURIComponent(projectDir)}`, "http://127.0.0.1"),
|
||||
);
|
||||
assert.deepEqual(result, {
|
||||
kind: "body",
|
||||
statusCode: 200,
|
||||
body: result?.kind === "body" ? result.body : "",
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl: "public, max-age=3600",
|
||||
});
|
||||
assert.ok(result?.kind === "body");
|
||||
if (result?.kind === "body") {
|
||||
assert.ok(result.body.includes('data-fallback="project-favicon"'));
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1,6 +1,4 @@
|
||||
import fs from "node:fs";
|
||||
import http from "node:http";
|
||||
import path from "node:path";
|
||||
import { Effect, FileSystem, Path } from "effect";
|
||||
|
||||
const FAVICON_MIME_TYPES: Record<string, string> = {
|
||||
".png": "image/png",
|
||||
@@ -60,112 +58,124 @@ function extractIconHref(source: string): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function resolveIconHref(projectCwd: string, href: string): string[] {
|
||||
export type ProjectFaviconRouteResult =
|
||||
| {
|
||||
readonly kind: "file";
|
||||
readonly filePath: string;
|
||||
readonly contentType: string;
|
||||
readonly cacheControl: string;
|
||||
}
|
||||
| {
|
||||
readonly kind: "body";
|
||||
readonly statusCode: number;
|
||||
readonly body: string;
|
||||
readonly contentType: string;
|
||||
readonly cacheControl?: string;
|
||||
};
|
||||
|
||||
const cacheControl = "public, max-age=3600";
|
||||
|
||||
const resolveIconHref = Effect.fnUntraced(function* (
|
||||
projectCwd: string,
|
||||
href: string,
|
||||
): Effect.fn.Return<readonly [string, string], never, Path.Path> {
|
||||
const path = yield* Path.Path;
|
||||
const clean = href.replace(/^\//, "");
|
||||
return [path.join(projectCwd, "public", clean), path.join(projectCwd, clean)];
|
||||
}
|
||||
});
|
||||
|
||||
function isPathWithinProject(projectCwd: string, candidatePath: string): boolean {
|
||||
const isPathWithinProject = Effect.fnUntraced(function* (
|
||||
projectCwd: string,
|
||||
candidatePath: string,
|
||||
): Effect.fn.Return<boolean, never, Path.Path> {
|
||||
const path = yield* Path.Path;
|
||||
const relative = path.relative(path.resolve(projectCwd), path.resolve(candidatePath));
|
||||
return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
|
||||
}
|
||||
});
|
||||
|
||||
function serveFaviconFile(filePath: string, res: http.ServerResponse): void {
|
||||
const toFileResult = Effect.fnUntraced(function* (
|
||||
filePath: string,
|
||||
): Effect.fn.Return<ProjectFaviconRouteResult, never, Path.Path> {
|
||||
const path = yield* Path.Path;
|
||||
const ext = path.extname(filePath).toLowerCase();
|
||||
const contentType = FAVICON_MIME_TYPES[ext] ?? "application/octet-stream";
|
||||
fs.readFile(filePath, (readErr, data) => {
|
||||
if (readErr) {
|
||||
res.writeHead(500, { "Content-Type": "text/plain" });
|
||||
res.end("Read error");
|
||||
return;
|
||||
return {
|
||||
kind: "file",
|
||||
filePath,
|
||||
contentType: FAVICON_MIME_TYPES[ext] ?? "application/octet-stream",
|
||||
cacheControl,
|
||||
};
|
||||
});
|
||||
|
||||
const findExistingFile = Effect.fnUntraced(function* (
|
||||
candidates: ReadonlyArray<string>,
|
||||
projectCwd: string,
|
||||
): Effect.fn.Return<string | null, never, FileSystem.FileSystem | Path.Path> {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
for (const candidate of candidates) {
|
||||
if (!(yield* isPathWithinProject(projectCwd, candidate))) {
|
||||
continue;
|
||||
}
|
||||
res.writeHead(200, {
|
||||
"Content-Type": contentType,
|
||||
"Cache-Control": "public, max-age=3600",
|
||||
});
|
||||
res.end(data);
|
||||
});
|
||||
}
|
||||
const fileInfo = yield* fileSystem
|
||||
.stat(candidate)
|
||||
.pipe(Effect.catch(() => Effect.succeed(null)));
|
||||
if (fileInfo?.type === "File") {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
function serveFallbackFavicon(res: http.ServerResponse): void {
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "image/svg+xml",
|
||||
"Cache-Control": "public, max-age=3600",
|
||||
});
|
||||
res.end(FALLBACK_FAVICON_SVG);
|
||||
}
|
||||
export const resolveProjectFaviconRoute = Effect.fnUntraced(function* (
|
||||
url: URL,
|
||||
): Effect.fn.Return<ProjectFaviconRouteResult | null, never, Path.Path | FileSystem.FileSystem> {
|
||||
const path = yield* Path.Path;
|
||||
|
||||
export function tryHandleProjectFaviconRequest(url: URL, res: http.ServerResponse): boolean {
|
||||
if (url.pathname !== "/api/project-favicon") {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
const projectCwd = url.searchParams.get("cwd");
|
||||
if (!projectCwd) {
|
||||
res.writeHead(400, { "Content-Type": "text/plain" });
|
||||
res.end("Missing cwd parameter");
|
||||
return true;
|
||||
return {
|
||||
kind: "body",
|
||||
statusCode: 400,
|
||||
body: "Missing cwd parameter",
|
||||
contentType: "text/plain",
|
||||
};
|
||||
}
|
||||
|
||||
const tryResolvedPaths = (paths: string[], index: number, onExhausted: () => void): void => {
|
||||
if (index >= paths.length) {
|
||||
onExhausted();
|
||||
return;
|
||||
}
|
||||
const candidate = paths[index]!;
|
||||
if (!isPathWithinProject(projectCwd, candidate)) {
|
||||
tryResolvedPaths(paths, index + 1, onExhausted);
|
||||
return;
|
||||
}
|
||||
fs.stat(candidate, (err, stats) => {
|
||||
if (err || !stats?.isFile()) {
|
||||
tryResolvedPaths(paths, index + 1, onExhausted);
|
||||
return;
|
||||
}
|
||||
serveFaviconFile(candidate, res);
|
||||
});
|
||||
};
|
||||
const candidatePaths = FAVICON_CANDIDATES.map((candidate) => path.join(projectCwd, candidate));
|
||||
const directFile = yield* findExistingFile(candidatePaths, projectCwd);
|
||||
if (directFile) {
|
||||
return yield* toFileResult(directFile);
|
||||
}
|
||||
|
||||
const trySourceFiles = (index: number): void => {
|
||||
if (index >= ICON_SOURCE_FILES.length) {
|
||||
serveFallbackFavicon(res);
|
||||
return;
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
for (const sourceFile of ICON_SOURCE_FILES) {
|
||||
const content = yield* fileSystem
|
||||
.readFileString(path.join(projectCwd, sourceFile))
|
||||
.pipe(Effect.catch(() => Effect.succeed(null)));
|
||||
if (!content) {
|
||||
continue;
|
||||
}
|
||||
const sourceFile = path.join(projectCwd, ICON_SOURCE_FILES[index]!);
|
||||
fs.readFile(sourceFile, "utf8", (err, content) => {
|
||||
if (err) {
|
||||
trySourceFiles(index + 1);
|
||||
return;
|
||||
}
|
||||
const href = extractIconHref(content);
|
||||
if (!href) {
|
||||
trySourceFiles(index + 1);
|
||||
return;
|
||||
}
|
||||
const candidates = resolveIconHref(projectCwd, href);
|
||||
tryResolvedPaths(candidates, 0, () => trySourceFiles(index + 1));
|
||||
});
|
||||
};
|
||||
|
||||
const tryCandidates = (index: number): void => {
|
||||
if (index >= FAVICON_CANDIDATES.length) {
|
||||
trySourceFiles(0);
|
||||
return;
|
||||
const href = extractIconHref(content);
|
||||
if (!href) {
|
||||
continue;
|
||||
}
|
||||
const candidate = path.join(projectCwd, FAVICON_CANDIDATES[index]!);
|
||||
if (!isPathWithinProject(projectCwd, candidate)) {
|
||||
tryCandidates(index + 1);
|
||||
return;
|
||||
}
|
||||
fs.stat(candidate, (err, stats) => {
|
||||
if (err || !stats?.isFile()) {
|
||||
tryCandidates(index + 1);
|
||||
return;
|
||||
}
|
||||
serveFaviconFile(candidate, res);
|
||||
});
|
||||
};
|
||||
|
||||
tryCandidates(0);
|
||||
return true;
|
||||
}
|
||||
const iconHrefPaths = yield* resolveIconHref(projectCwd, href);
|
||||
const resolvedFile = yield* findExistingFile(iconHrefPaths, projectCwd);
|
||||
if (resolvedFile) {
|
||||
return yield* toFileResult(resolvedFile);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
kind: "body",
|
||||
statusCode: 200,
|
||||
body: FALLBACK_FAVICON_SVG,
|
||||
contentType: "image/svg+xml",
|
||||
cacheControl,
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { OrchestrationReadModel } from "@t3tools/contracts";
|
||||
import { assert, it, vi } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { recordStartupHeartbeat } from "./server";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService";
|
||||
|
||||
it.effect("records a startup heartbeat with thread/project counts", () =>
|
||||
Effect.gen(function* () {
|
||||
const recordTelemetry = vi.fn(
|
||||
(_event: string, _properties?: Readonly<Record<string, unknown>>) => Effect.void,
|
||||
);
|
||||
const getSnapshot = vi.fn(() =>
|
||||
Effect.succeed({
|
||||
snapshotSequence: 2,
|
||||
projects: [{} as OrchestrationReadModel["projects"][number]],
|
||||
threads: [
|
||||
{} as OrchestrationReadModel["threads"][number],
|
||||
{} as OrchestrationReadModel["threads"][number],
|
||||
],
|
||||
updatedAt: new Date(1).toISOString(),
|
||||
} satisfies OrchestrationReadModel),
|
||||
);
|
||||
|
||||
yield* recordStartupHeartbeat.pipe(
|
||||
Effect.provideService(ProjectionSnapshotQuery, {
|
||||
getSnapshot,
|
||||
}),
|
||||
Effect.provideService(AnalyticsService, {
|
||||
record: recordTelemetry,
|
||||
flush: Effect.void,
|
||||
}),
|
||||
);
|
||||
|
||||
assert.deepEqual(recordTelemetry.mock.calls[0], [
|
||||
"server.boot.heartbeat",
|
||||
{
|
||||
threadCount: 2,
|
||||
projectCount: 1,
|
||||
},
|
||||
]);
|
||||
}),
|
||||
);
|
||||
@@ -0,0 +1,155 @@
|
||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Effect, Layer } from "effect";
|
||||
import { FetchHttpClient, HttpRouter, HttpServer } from "effect/unstable/http";
|
||||
import http from "node:http";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { Open, OpenLive } from "./open";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import * as SqlitePersistence from "./persistence/Layers/Sqlite";
|
||||
import { ProviderHealthLive } from "./provider/Layers/ProviderHealth";
|
||||
import { ServerRuntimeStateLive } from "./serverRuntime";
|
||||
import { makeServerProviderLayer, makeServerRuntimeServicesLayer } from "./serverLayers";
|
||||
import { AnalyticsServiceLayerLive } from "./telemetry/Layers/AnalyticsService";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService";
|
||||
import { makeRoutesLayer } from "./wsServer";
|
||||
|
||||
const isWildcardHost = (host: string | undefined): boolean =>
|
||||
host === "0.0.0.0" || host === "::" || host === "[::]";
|
||||
|
||||
const formatHostForUrl = (host: string): string =>
|
||||
host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
||||
|
||||
export const recordStartupHeartbeat = Effect.gen(function* () {
|
||||
const analytics = yield* AnalyticsService;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
|
||||
const { threadCount, projectCount } = yield* projectionSnapshotQuery.getSnapshot().pipe(
|
||||
Effect.map((snapshot) => ({
|
||||
threadCount: snapshot.threads.length,
|
||||
projectCount: snapshot.projects.length,
|
||||
})),
|
||||
Effect.catch((cause) =>
|
||||
Effect.logWarning("failed to gather startup snapshot for telemetry", { cause }).pipe(
|
||||
Effect.as({
|
||||
threadCount: 0,
|
||||
projectCount: 0,
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
yield* analytics.record("server.boot.heartbeat", {
|
||||
threadCount,
|
||||
projectCount,
|
||||
});
|
||||
});
|
||||
|
||||
const logServerReady = Effect.gen(function* () {
|
||||
const config = yield* ServerConfig;
|
||||
const open = yield* Open;
|
||||
const server = yield* HttpServer.HttpServer;
|
||||
|
||||
if (server.address._tag !== "TcpAddress") {
|
||||
return;
|
||||
}
|
||||
|
||||
const { port } = server.address;
|
||||
const localUrl = `http://localhost:${port}`;
|
||||
const bindUrl =
|
||||
config.host && !isWildcardHost(config.host)
|
||||
? `http://${formatHostForUrl(config.host)}:${port}`
|
||||
: localUrl;
|
||||
|
||||
yield* Effect.logInfo("T3 Code running", {
|
||||
url: bindUrl,
|
||||
localUrl,
|
||||
bindHost: config.host ?? "default",
|
||||
cwd: config.cwd,
|
||||
mode: config.mode,
|
||||
stateDir: config.stateDir,
|
||||
authEnabled: Boolean(config.authToken),
|
||||
websocketUrl: `${bindUrl}/ws`,
|
||||
});
|
||||
|
||||
if (config.noBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = config.devUrl?.toString() ?? bindUrl;
|
||||
yield* open.openBrowser(target).pipe(
|
||||
Effect.catch(() =>
|
||||
Effect.logInfo("browser auto-open unavailable", {
|
||||
hint: `Open ${target} in your browser.`,
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
const startupLayer = Layer.effectDiscard(
|
||||
Effect.gen(function* () {
|
||||
yield* logServerReady;
|
||||
yield* Effect.forkChild(recordStartupHeartbeat);
|
||||
}),
|
||||
);
|
||||
|
||||
export const makeNodeHttpServerLayer = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const { host, port } = yield* ServerConfig;
|
||||
return NodeHttpServer.layer(http.createServer, host ? { host, port } : { port });
|
||||
}),
|
||||
);
|
||||
|
||||
const routesLayer = HttpRouter.serve(makeRoutesLayer, {
|
||||
disableLogger: true,
|
||||
disableListenLog: true,
|
||||
});
|
||||
|
||||
export const makeServerServicesLayer = () => {
|
||||
const nodeServicesLayer = NodeServices.layer;
|
||||
const fetchHttpClientLayer = FetchHttpClient.layer.pipe(Layer.provideMerge(nodeServicesLayer));
|
||||
const sqliteLayer = SqlitePersistence.layerConfig.pipe(Layer.provideMerge(nodeServicesLayer));
|
||||
const analyticsLayer = AnalyticsServiceLayerLive.pipe(
|
||||
Layer.provideMerge(fetchHttpClientLayer),
|
||||
Layer.provideMerge(nodeServicesLayer),
|
||||
);
|
||||
const providerLayer = makeServerProviderLayer().pipe(
|
||||
Layer.provideMerge(analyticsLayer),
|
||||
Layer.provideMerge(sqliteLayer),
|
||||
Layer.provideMerge(nodeServicesLayer),
|
||||
);
|
||||
const runtimeLayer = makeServerRuntimeServicesLayer().pipe(
|
||||
Layer.provideMerge(providerLayer),
|
||||
Layer.provideMerge(sqliteLayer),
|
||||
Layer.provideMerge(nodeServicesLayer),
|
||||
);
|
||||
const providerHealthLayer = ProviderHealthLive.pipe(Layer.provideMerge(nodeServicesLayer));
|
||||
const openLayer = OpenLive.pipe(Layer.provideMerge(nodeServicesLayer));
|
||||
const baseServicesLayer = Layer.mergeAll(
|
||||
nodeServicesLayer,
|
||||
fetchHttpClientLayer,
|
||||
analyticsLayer,
|
||||
runtimeLayer,
|
||||
providerLayer,
|
||||
providerHealthLayer,
|
||||
openLayer,
|
||||
sqliteLayer,
|
||||
);
|
||||
|
||||
return Layer.mergeAll(
|
||||
baseServicesLayer,
|
||||
ServerRuntimeStateLive.pipe(Layer.provide(baseServicesLayer)),
|
||||
);
|
||||
};
|
||||
|
||||
export const makeServerAppLayer = <ServicesSuccess, ServicesError, ServicesRequirements>(
|
||||
servicesLayer: Layer.Layer<ServicesSuccess, ServicesError, ServicesRequirements>,
|
||||
) =>
|
||||
routesLayer.pipe(Layer.provideMerge(startupLayer)).pipe(Layer.provide(servicesLayer));
|
||||
|
||||
export const makeServerLayer = makeServerAppLayer(makeServerServicesLayer()).pipe(
|
||||
Layer.provide(makeNodeHttpServerLayer),
|
||||
);
|
||||
|
||||
export const runServer = Layer.launch(makeServerLayer);
|
||||
@@ -1,8 +1,7 @@
|
||||
import path from "node:path";
|
||||
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Effect, FileSystem, Layer } from "effect";
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
||||
import { Effect, FileSystem, Layer } from "effect";
|
||||
|
||||
import { CheckpointDiffQueryLive } from "./checkpointing/Layers/CheckpointDiffQuery";
|
||||
import { CheckpointStoreLive } from "./checkpointing/Layers/CheckpointStore";
|
||||
@@ -127,5 +126,5 @@ export function makeServerRuntimeServicesLayer() {
|
||||
gitManagerLayer,
|
||||
terminalLayer,
|
||||
KeybindingsLive,
|
||||
).pipe(Layer.provideMerge(NodeServices.layer));
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
import {
|
||||
ClientOrchestrationCommand,
|
||||
GitPreparePullRequestThreadInput,
|
||||
type GitPreparePullRequestThreadResult,
|
||||
GitPullRequestRefInput,
|
||||
type GitResolvePullRequestResult,
|
||||
type OrchestrationCommand,
|
||||
PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
|
||||
type ServerRpcError,
|
||||
ServerRpcGroup,
|
||||
TerminalEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import { Effect, FileSystem, Layer, Path, Queue, Stream } from "effect";
|
||||
import { clamp } from "effect/Number";
|
||||
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
||||
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
||||
import * as RpcServer from "effect/unstable/rpc/RpcServer";
|
||||
|
||||
import { createAttachmentId, resolveAttachmentPath } from "./attachmentStore.ts";
|
||||
import { CheckpointDiffQuery } from "./checkpointing/Services/CheckpointDiffQuery";
|
||||
import { ServerConfig as RuntimeServerConfig } from "./config";
|
||||
import { GitCore } from "./git/Services/GitCore.ts";
|
||||
import { GitManager } from "./git/Services/GitManager.ts";
|
||||
import { parseBase64DataUrl } from "./imageMime.ts";
|
||||
import { Keybindings } from "./keybindings";
|
||||
import { Open, resolveAvailableEditors } from "./open";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { ProviderHealth } from "./provider/Services/ProviderHealth";
|
||||
import { ProviderService } from "./provider/Services/ProviderService";
|
||||
import { ServerRuntimeState } from "./serverRuntime";
|
||||
import { searchWorkspaceEntries } from "./workspaceEntries";
|
||||
import { TerminalManager } from "./terminal/Services/Manager.ts";
|
||||
import type { TerminalManagerShape } from "./terminal/Services/Manager.ts";
|
||||
|
||||
export type ServerRpcRouteRequirements =
|
||||
| RuntimeServerConfig
|
||||
| FileSystem.FileSystem
|
||||
| Path.Path
|
||||
| GitManager
|
||||
| GitCore
|
||||
| Keybindings
|
||||
| Open
|
||||
| OrchestrationEngineService
|
||||
| CheckpointDiffQuery
|
||||
| ProjectionSnapshotQuery
|
||||
| ProviderHealth
|
||||
| ProviderService
|
||||
| ServerRuntimeState
|
||||
| TerminalManager;
|
||||
|
||||
function formatRpcError(error: unknown): string {
|
||||
if (typeof error === "string") {
|
||||
return error;
|
||||
}
|
||||
if (error instanceof Error && error.message.length > 0) {
|
||||
return error.message;
|
||||
}
|
||||
if (typeof error === "object" && error !== null && "message" in error) {
|
||||
const message = error.message;
|
||||
if (typeof message === "string" && message.length > 0) {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return JSON.stringify(error);
|
||||
} catch {
|
||||
return String(error);
|
||||
}
|
||||
}
|
||||
|
||||
const serverRpcError = (message: string): ServerRpcError => ({ message });
|
||||
|
||||
const mapRpcError = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
||||
effect.pipe(Effect.mapError((error) => serverRpcError(formatRpcError(error))));
|
||||
|
||||
const mapRpcStreamError = <A, E, R>(stream: Stream.Stream<A, E, R>) =>
|
||||
stream.pipe(Stream.mapError((error) => serverRpcError(formatRpcError(error))));
|
||||
|
||||
const textResponse = (status: number, body: string) =>
|
||||
HttpServerResponse.text(body, { status, contentType: "text/plain" });
|
||||
|
||||
const normalizeDispatchCommand = Effect.fn(function* (input: {
|
||||
readonly command: ClientOrchestrationCommand;
|
||||
}) {
|
||||
if (input.command.type !== "thread.turn.start") {
|
||||
return input.command as OrchestrationCommand;
|
||||
}
|
||||
const turnStartCommand = input.command;
|
||||
|
||||
const serverConfig = yield* RuntimeServerConfig;
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
|
||||
const normalizedAttachments = yield* Effect.forEach(
|
||||
turnStartCommand.message.attachments,
|
||||
(attachment) =>
|
||||
Effect.gen(function* () {
|
||||
const parsed = parseBase64DataUrl(attachment.dataUrl);
|
||||
if (!parsed || !parsed.mimeType.startsWith("image/")) {
|
||||
return yield* Effect.fail(
|
||||
serverRpcError(`Invalid image attachment payload for '${attachment.name}'.`),
|
||||
);
|
||||
}
|
||||
|
||||
const bytes = Buffer.from(parsed.base64, "base64");
|
||||
if (bytes.byteLength === 0 || bytes.byteLength > PROVIDER_SEND_TURN_MAX_IMAGE_BYTES) {
|
||||
return yield* Effect.fail(
|
||||
serverRpcError(`Image attachment '${attachment.name}' is empty or too large.`),
|
||||
);
|
||||
}
|
||||
|
||||
const attachmentId = createAttachmentId(turnStartCommand.threadId);
|
||||
if (!attachmentId) {
|
||||
return yield* Effect.fail(serverRpcError("Failed to create a safe attachment id."));
|
||||
}
|
||||
|
||||
const persistedAttachment = {
|
||||
type: "image" as const,
|
||||
id: attachmentId,
|
||||
name: attachment.name,
|
||||
mimeType: parsed.mimeType.toLowerCase(),
|
||||
sizeBytes: bytes.byteLength,
|
||||
};
|
||||
|
||||
const attachmentPath = resolveAttachmentPath({
|
||||
stateDir: serverConfig.stateDir,
|
||||
attachment: persistedAttachment,
|
||||
});
|
||||
if (!attachmentPath) {
|
||||
return yield* Effect.fail(
|
||||
serverRpcError(`Failed to resolve persisted path for '${attachment.name}'.`),
|
||||
);
|
||||
}
|
||||
|
||||
yield* fileSystem
|
||||
.makeDirectory(path.dirname(attachmentPath), { recursive: true })
|
||||
.pipe(
|
||||
Effect.mapError(() =>
|
||||
serverRpcError(`Failed to create attachment directory for '${attachment.name}'.`),
|
||||
),
|
||||
);
|
||||
yield* fileSystem
|
||||
.writeFile(attachmentPath, bytes)
|
||||
.pipe(
|
||||
Effect.mapError(() =>
|
||||
serverRpcError(`Failed to persist attachment '${attachment.name}'.`),
|
||||
),
|
||||
);
|
||||
|
||||
return persistedAttachment;
|
||||
}),
|
||||
{ concurrency: 1 },
|
||||
);
|
||||
|
||||
return {
|
||||
...turnStartCommand,
|
||||
message: {
|
||||
...turnStartCommand.message,
|
||||
attachments: normalizedAttachments,
|
||||
},
|
||||
} satisfies OrchestrationCommand;
|
||||
});
|
||||
|
||||
const makeTerminalEventStream = (terminalManager: TerminalManagerShape) =>
|
||||
Stream.callback<TerminalEvent>((queue) =>
|
||||
Effect.acquireRelease(
|
||||
terminalManager.subscribe((event: TerminalEvent) => {
|
||||
Queue.offerUnsafe(queue, event);
|
||||
}),
|
||||
(unsubscribe) => Effect.sync(() => unsubscribe()),
|
||||
).pipe(Effect.asVoid),
|
||||
);
|
||||
|
||||
export const makeServerRpcHandlersLayer = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const serverConfig = yield* RuntimeServerConfig;
|
||||
const gitManager = yield* GitManager;
|
||||
const git = yield* GitCore;
|
||||
const keybindingsManager = yield* Keybindings;
|
||||
const open = yield* Open;
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const checkpointDiffQuery = yield* CheckpointDiffQuery;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
const providerHealth = yield* ProviderHealth;
|
||||
const serverRuntime = yield* ServerRuntimeState;
|
||||
const terminalManager = yield* TerminalManager;
|
||||
|
||||
const availableEditors = resolveAvailableEditors();
|
||||
|
||||
const loadServerConfig = Effect.gen(function* () {
|
||||
const keybindingsConfig = yield* keybindingsManager.loadConfigState;
|
||||
const providerStatuses = yield* providerHealth.getStatuses;
|
||||
return {
|
||||
cwd: serverConfig.cwd,
|
||||
keybindingsConfigPath: serverConfig.keybindingsConfigPath,
|
||||
keybindings: keybindingsConfig.keybindings,
|
||||
issues: keybindingsConfig.issues,
|
||||
providers: providerStatuses,
|
||||
availableEditors,
|
||||
};
|
||||
});
|
||||
|
||||
return ServerRpcGroup.toLayer({
|
||||
getBootstrap: () => Effect.succeed(serverRuntime.bootstrapState),
|
||||
getServerConfig: () => mapRpcError(loadServerConfig),
|
||||
upsertKeybinding: (input) =>
|
||||
mapRpcError(
|
||||
keybindingsManager
|
||||
.upsertKeybindingRule(input)
|
||||
.pipe(Effect.map((keybindings) => ({ keybindings, issues: [] }))),
|
||||
),
|
||||
subscribeServerConfig: () =>
|
||||
mapRpcStreamError(
|
||||
keybindingsManager.streamChanges.pipe(
|
||||
Stream.mapEffect((event) =>
|
||||
providerHealth.getStatuses.pipe(
|
||||
Effect.map((providers) => ({
|
||||
issues: event.issues,
|
||||
providers,
|
||||
})),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
getSnapshot: () => mapRpcError(projectionSnapshotQuery.getSnapshot()),
|
||||
dispatchCommand: (command) =>
|
||||
mapRpcError(
|
||||
normalizeDispatchCommand({ command }).pipe(
|
||||
Effect.flatMap((normalizedCommand) => orchestrationEngine.dispatch(normalizedCommand)),
|
||||
),
|
||||
),
|
||||
getTurnDiff: (input) => mapRpcError(checkpointDiffQuery.getTurnDiff(input)),
|
||||
getFullThreadDiff: (input) => mapRpcError(checkpointDiffQuery.getFullThreadDiff(input)),
|
||||
replayEvents: (input) =>
|
||||
mapRpcError(
|
||||
Stream.runCollect(
|
||||
orchestrationEngine.readEvents(
|
||||
clamp(input.fromSequenceExclusive, {
|
||||
maximum: Number.MAX_SAFE_INTEGER,
|
||||
minimum: 0,
|
||||
}),
|
||||
),
|
||||
).pipe(Effect.map((events) => Array.from(events))),
|
||||
),
|
||||
subscribeDomainEvents: () => mapRpcStreamError(orchestrationEngine.streamDomainEvents),
|
||||
searchEntries: (input) =>
|
||||
mapRpcError(
|
||||
Effect.tryPromise({
|
||||
try: () => searchWorkspaceEntries(input),
|
||||
catch: (cause) => serverRpcError(`Failed to search workspace entries: ${String(cause)}`),
|
||||
}),
|
||||
),
|
||||
openInEditor: (input) => mapRpcError(open.openInEditor(input)),
|
||||
gitStatus: (input) => mapRpcError(gitManager.status(input)),
|
||||
gitPull: (input) => mapRpcError(git.pullCurrentBranch(input.cwd)),
|
||||
gitRunStackedAction: (input) => mapRpcError(gitManager.runStackedAction(input)),
|
||||
gitListBranches: (input) => mapRpcError(git.listBranches(input)),
|
||||
gitCreateWorktree: (input) => mapRpcError(git.createWorktree(input)),
|
||||
gitRemoveWorktree: (input) => mapRpcError(git.removeWorktree(input)),
|
||||
gitCreateBranch: (input) => mapRpcError(git.createBranch(input)),
|
||||
gitCheckout: (input) => mapRpcError(Effect.scoped(git.checkoutBranch(input))),
|
||||
gitInit: (input) => mapRpcError(git.initRepo(input)),
|
||||
gitResolvePullRequest: (input: GitPullRequestRefInput) =>
|
||||
mapRpcError(
|
||||
gitManager.resolvePullRequest(input) as Effect.Effect<
|
||||
GitResolvePullRequestResult,
|
||||
never,
|
||||
never
|
||||
>,
|
||||
),
|
||||
gitPreparePullRequestThread: (input: GitPreparePullRequestThreadInput) =>
|
||||
mapRpcError(
|
||||
gitManager.preparePullRequestThread(input) as Effect.Effect<
|
||||
GitPreparePullRequestThreadResult,
|
||||
never,
|
||||
never
|
||||
>,
|
||||
),
|
||||
terminalOpen: (input) => mapRpcError(terminalManager.open(input)),
|
||||
terminalWrite: (input) => mapRpcError(terminalManager.write(input)),
|
||||
terminalResize: (input) => mapRpcError(terminalManager.resize(input)),
|
||||
terminalClear: (input) => mapRpcError(terminalManager.clear(input)),
|
||||
terminalRestart: (input) => mapRpcError(terminalManager.restart(input)),
|
||||
terminalClose: (input) => mapRpcError(terminalManager.close(input)),
|
||||
subscribeTerminalEvents: () => mapRpcStreamError(makeTerminalEventStream(terminalManager)),
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
export const makeServerRpcRouteLayer = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const serverConfig = yield* RuntimeServerConfig;
|
||||
const { httpEffect, protocol } = yield* RpcServer.makeProtocolWithHttpEffectWebsocket;
|
||||
|
||||
const websocketRpcRoute = HttpRouter.add(
|
||||
"GET",
|
||||
"/ws",
|
||||
Effect.gen(function* () {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const url = HttpServerRequest.toURL(request);
|
||||
if (!url) {
|
||||
return textResponse(400, "Invalid WebSocket URL");
|
||||
}
|
||||
if (request.headers.upgrade?.toLowerCase() !== "websocket") {
|
||||
return textResponse(400, "Expected WebSocket upgrade request");
|
||||
}
|
||||
if (serverConfig.authToken && url.searchParams.get("token") !== serverConfig.authToken) {
|
||||
return textResponse(401, "Unauthorized WebSocket connection");
|
||||
}
|
||||
return yield* httpEffect;
|
||||
}),
|
||||
);
|
||||
|
||||
return RpcServer.layer(ServerRpcGroup).pipe(
|
||||
Layer.provide(Layer.succeed(RpcServer.Protocol, protocol)),
|
||||
Layer.provide(makeServerRpcHandlersLayer),
|
||||
Layer.provide(RpcSerialization.layerJson),
|
||||
Layer.provideMerge(websocketRpcRoute),
|
||||
);
|
||||
}).pipe(Effect.provide(RpcSerialization.layerJson)),
|
||||
);
|
||||
@@ -0,0 +1,130 @@
|
||||
import {
|
||||
CommandId,
|
||||
DEFAULT_PROVIDER_INTERACTION_MODE,
|
||||
ProjectId,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { Effect, Exit, Layer, Path, Scope, ServiceMap } from "effect";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { Keybindings } from "./keybindings";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { OrchestrationReactor } from "./orchestration/Services/OrchestrationReactor";
|
||||
|
||||
export interface ServerBootstrapStateShape {
|
||||
readonly cwd: string;
|
||||
readonly projectName: string;
|
||||
readonly bootstrapProjectId?: ProjectId;
|
||||
readonly bootstrapThreadId?: ThreadId;
|
||||
}
|
||||
|
||||
export interface ServerRuntimeStateShape {
|
||||
readonly bootstrapState: ServerBootstrapStateShape;
|
||||
}
|
||||
|
||||
export class ServerRuntimeState extends ServiceMap.Service<
|
||||
ServerRuntimeState,
|
||||
ServerRuntimeStateShape
|
||||
>()("t3/serverRuntime/ServerRuntimeState") {}
|
||||
|
||||
const resolveBootstrapState = Effect.fn(function* () {
|
||||
const serverConfig = yield* ServerConfig;
|
||||
const path = yield* Path.Path;
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
|
||||
const projectName = path.basename(serverConfig.cwd) || "project";
|
||||
let bootstrapProjectId: ProjectId | undefined;
|
||||
let bootstrapThreadId: ThreadId | undefined;
|
||||
|
||||
if (serverConfig.autoBootstrapProjectFromCwd) {
|
||||
const snapshot = yield* projectionSnapshotQuery.getSnapshot();
|
||||
const existingProject = snapshot.projects.find(
|
||||
(project) => project.workspaceRoot === serverConfig.cwd && project.deletedAt === null,
|
||||
);
|
||||
let projectId: ProjectId;
|
||||
let defaultModel: string;
|
||||
|
||||
if (!existingProject) {
|
||||
const createdAt = new Date().toISOString();
|
||||
projectId = ProjectId.makeUnsafe(crypto.randomUUID());
|
||||
defaultModel = "gpt-5-codex";
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "project.create",
|
||||
commandId: CommandId.makeUnsafe(crypto.randomUUID()),
|
||||
projectId,
|
||||
title: projectName,
|
||||
workspaceRoot: serverConfig.cwd,
|
||||
defaultModel,
|
||||
createdAt,
|
||||
});
|
||||
} else {
|
||||
projectId = existingProject.id;
|
||||
defaultModel = existingProject.defaultModel ?? "gpt-5-codex";
|
||||
}
|
||||
|
||||
const refreshedSnapshot = existingProject
|
||||
? snapshot
|
||||
: yield* projectionSnapshotQuery.getSnapshot();
|
||||
const existingThread = refreshedSnapshot.threads.find(
|
||||
(thread) => thread.projectId === projectId && thread.deletedAt === null,
|
||||
);
|
||||
|
||||
if (!existingThread) {
|
||||
const createdAt = new Date().toISOString();
|
||||
const threadId = ThreadId.makeUnsafe(crypto.randomUUID());
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.create",
|
||||
commandId: CommandId.makeUnsafe(crypto.randomUUID()),
|
||||
threadId,
|
||||
projectId,
|
||||
title: "New thread",
|
||||
model: defaultModel,
|
||||
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
||||
runtimeMode: "full-access",
|
||||
branch: null,
|
||||
worktreePath: null,
|
||||
createdAt,
|
||||
});
|
||||
bootstrapProjectId = projectId;
|
||||
bootstrapThreadId = threadId;
|
||||
} else {
|
||||
bootstrapProjectId = projectId;
|
||||
bootstrapThreadId = existingThread.id;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
cwd: serverConfig.cwd,
|
||||
projectName,
|
||||
...(bootstrapProjectId ? { bootstrapProjectId } : {}),
|
||||
...(bootstrapThreadId ? { bootstrapThreadId } : {}),
|
||||
} satisfies ServerBootstrapStateShape;
|
||||
});
|
||||
|
||||
export const ServerRuntimeStateLive = Layer.effect(
|
||||
ServerRuntimeState,
|
||||
Effect.gen(function* () {
|
||||
const keybindingsManager = yield* Keybindings;
|
||||
const orchestrationReactor = yield* OrchestrationReactor;
|
||||
|
||||
yield* keybindingsManager.syncDefaultKeybindingsOnStartup.pipe(
|
||||
Effect.catch((error) =>
|
||||
Effect.logWarning("failed to sync keybindings defaults on startup", {
|
||||
path: error.configPath,
|
||||
detail: error.detail,
|
||||
cause: error.cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const startupScope = yield* Scope.make("sequential");
|
||||
yield* Effect.addFinalizer(() => Scope.close(startupScope, Exit.void));
|
||||
yield* Scope.provide(orchestrationReactor.start, startupScope);
|
||||
|
||||
return {
|
||||
bootstrapState: yield* resolveBootstrapState(),
|
||||
} satisfies ServerRuntimeStateShape;
|
||||
}),
|
||||
);
|
||||
+278
-1684
File diff suppressed because it is too large.
Load diff
+140
-919
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
import { defineConfig } from "tsdown";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["src/index.ts"],
|
||||
entry: ["src/bin.ts"],
|
||||
format: ["esm", "cjs"],
|
||||
checks: {
|
||||
legacyCjs: false,
|
||||
@@ -11,7 +11,4 @@ export default defineConfig({
|
||||
clean: true,
|
||||
noExternal: (id) => id.startsWith("@t3tools/"),
|
||||
inlineOnly: false,
|
||||
banner: {
|
||||
js: "#!/usr/bin/env node\n",
|
||||
},
|
||||
});
|
||||
@@ -46,6 +46,18 @@ function asError(value: unknown, fallback: string): Error {
|
||||
return new Error(fallback);
|
||||
}
|
||||
|
||||
function normalizeWsUrl(rawUrl: string): string {
|
||||
try {
|
||||
const url = new URL(rawUrl);
|
||||
if (url.pathname === "" || url.pathname === "/") {
|
||||
url.pathname = "/ws";
|
||||
}
|
||||
return url.toString();
|
||||
} catch {
|
||||
return rawUrl;
|
||||
}
|
||||
}
|
||||
|
||||
export class WsTransport {
|
||||
private ws: WebSocket | null = null;
|
||||
private nextId = 1;
|
||||
@@ -62,13 +74,14 @@ export class WsTransport {
|
||||
constructor(url?: string) {
|
||||
const bridgeUrl = window.desktopBridge?.getWsUrl();
|
||||
const envUrl = import.meta.env.VITE_WS_URL as string | undefined;
|
||||
this.url =
|
||||
const resolvedUrl =
|
||||
url ??
|
||||
(bridgeUrl && bridgeUrl.length > 0
|
||||
? bridgeUrl
|
||||
: envUrl && envUrl.length > 0
|
||||
? envUrl
|
||||
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`);
|
||||
this.url = normalizeWsUrl(resolvedUrl);
|
||||
this.connect();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
"name": "t3",
|
||||
"version": "0.0.9",
|
||||
"bin": {
|
||||
"t3": "./dist/index.mjs",
|
||||
"t3": "./dist/bin.mjs",
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
|
||||
@@ -7,6 +7,7 @@ export * from "./model";
|
||||
export * from "./ws";
|
||||
export * from "./keybindings";
|
||||
export * from "./server";
|
||||
export * from "./rpc";
|
||||
export * from "./git";
|
||||
export * from "./orchestration";
|
||||
export * from "./editor";
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
import { Schema } from "effect";
|
||||
import * as Rpc from "effect/unstable/rpc/Rpc";
|
||||
import * as RpcGroup from "effect/unstable/rpc/RpcGroup";
|
||||
|
||||
import {
|
||||
DispatchResult,
|
||||
OrchestrationEvent,
|
||||
OrchestrationGetFullThreadDiffInput,
|
||||
OrchestrationGetFullThreadDiffResult,
|
||||
OrchestrationGetTurnDiffInput,
|
||||
OrchestrationGetTurnDiffResult,
|
||||
OrchestrationReplayEventsInput,
|
||||
OrchestrationRpcSchemas,
|
||||
ClientOrchestrationCommand,
|
||||
} from "./orchestration";
|
||||
import {
|
||||
GitCheckoutInput,
|
||||
GitCreateBranchInput,
|
||||
GitCreateWorktreeInput,
|
||||
GitCreateWorktreeResult,
|
||||
GitInitInput,
|
||||
GitListBranchesInput,
|
||||
GitListBranchesResult,
|
||||
GitPreparePullRequestThreadInput,
|
||||
GitPreparePullRequestThreadResult,
|
||||
GitPullInput,
|
||||
GitPullRequestRefInput,
|
||||
GitPullResult,
|
||||
GitRemoveWorktreeInput,
|
||||
GitResolvePullRequestResult,
|
||||
GitRunStackedActionInput,
|
||||
GitRunStackedActionResult,
|
||||
GitStatusInput,
|
||||
GitStatusResult,
|
||||
} from "./git";
|
||||
import {
|
||||
TerminalClearInput,
|
||||
TerminalCloseInput,
|
||||
TerminalEvent,
|
||||
TerminalOpenInput,
|
||||
TerminalResizeInput,
|
||||
TerminalRestartInput,
|
||||
TerminalSessionSnapshot,
|
||||
TerminalWriteInput,
|
||||
} from "./terminal";
|
||||
import { ProjectSearchEntriesInput, ProjectSearchEntriesResult } from "./project";
|
||||
import { OpenInEditorInput } from "./editor";
|
||||
import {
|
||||
ServerBootstrapState,
|
||||
ServerConfig,
|
||||
ServerConfigUpdatedPayload,
|
||||
ServerUpsertKeybindingInput,
|
||||
ServerUpsertKeybindingResult,
|
||||
} from "./server";
|
||||
|
||||
export const ServerRpcError = Schema.Struct({
|
||||
message: Schema.String,
|
||||
});
|
||||
export type ServerRpcError = typeof ServerRpcError.Type;
|
||||
|
||||
const rpcOptions = {
|
||||
error: ServerRpcError,
|
||||
} as const;
|
||||
|
||||
export const GetBootstrapRpc = Rpc.make("getBootstrap", {
|
||||
success: ServerBootstrapState,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GetServerConfigRpc = Rpc.make("getServerConfig", {
|
||||
success: ServerConfig,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const UpsertKeybindingRpc = Rpc.make("upsertKeybinding", {
|
||||
payload: ServerUpsertKeybindingInput,
|
||||
success: ServerUpsertKeybindingResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const SubscribeServerConfigRpc = Rpc.make("subscribeServerConfig", {
|
||||
success: ServerConfigUpdatedPayload,
|
||||
stream: true,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GetSnapshotRpc = Rpc.make("getSnapshot", {
|
||||
success: OrchestrationRpcSchemas.getSnapshot.output,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const DispatchCommandRpc = Rpc.make("dispatchCommand", {
|
||||
payload: ClientOrchestrationCommand,
|
||||
success: DispatchResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GetTurnDiffRpc = Rpc.make("getTurnDiff", {
|
||||
payload: OrchestrationGetTurnDiffInput,
|
||||
success: OrchestrationGetTurnDiffResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GetFullThreadDiffRpc = Rpc.make("getFullThreadDiff", {
|
||||
payload: OrchestrationGetFullThreadDiffInput,
|
||||
success: OrchestrationGetFullThreadDiffResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const ReplayEventsRpc = Rpc.make("replayEvents", {
|
||||
payload: OrchestrationReplayEventsInput,
|
||||
success: OrchestrationRpcSchemas.replayEvents.output,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const SubscribeDomainEventsRpc = Rpc.make("subscribeDomainEvents", {
|
||||
success: OrchestrationEvent,
|
||||
stream: true,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const SearchEntriesRpc = Rpc.make("searchEntries", {
|
||||
payload: ProjectSearchEntriesInput,
|
||||
success: ProjectSearchEntriesResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const OpenInEditorRpc = Rpc.make("openInEditor", {
|
||||
payload: OpenInEditorInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitStatusRpc = Rpc.make("gitStatus", {
|
||||
payload: GitStatusInput,
|
||||
success: GitStatusResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitPullRpc = Rpc.make("gitPull", {
|
||||
payload: GitPullInput,
|
||||
success: GitPullResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitRunStackedActionRpc = Rpc.make("gitRunStackedAction", {
|
||||
payload: GitRunStackedActionInput,
|
||||
success: GitRunStackedActionResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitListBranchesRpc = Rpc.make("gitListBranches", {
|
||||
payload: GitListBranchesInput,
|
||||
success: GitListBranchesResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitCreateWorktreeRpc = Rpc.make("gitCreateWorktree", {
|
||||
payload: GitCreateWorktreeInput,
|
||||
success: GitCreateWorktreeResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitRemoveWorktreeRpc = Rpc.make("gitRemoveWorktree", {
|
||||
payload: GitRemoveWorktreeInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitCreateBranchRpc = Rpc.make("gitCreateBranch", {
|
||||
payload: GitCreateBranchInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitCheckoutRpc = Rpc.make("gitCheckout", {
|
||||
payload: GitCheckoutInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitInitRpc = Rpc.make("gitInit", {
|
||||
payload: GitInitInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitResolvePullRequestRpc = Rpc.make("gitResolvePullRequest", {
|
||||
payload: GitPullRequestRefInput,
|
||||
success: GitResolvePullRequestResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const GitPreparePullRequestThreadRpc = Rpc.make("gitPreparePullRequestThread", {
|
||||
payload: GitPreparePullRequestThreadInput,
|
||||
success: GitPreparePullRequestThreadResult,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalOpenRpc = Rpc.make("terminalOpen", {
|
||||
payload: TerminalOpenInput,
|
||||
success: TerminalSessionSnapshot,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalWriteRpc = Rpc.make("terminalWrite", {
|
||||
payload: TerminalWriteInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalResizeRpc = Rpc.make("terminalResize", {
|
||||
payload: TerminalResizeInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalClearRpc = Rpc.make("terminalClear", {
|
||||
payload: TerminalClearInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalRestartRpc = Rpc.make("terminalRestart", {
|
||||
payload: TerminalRestartInput,
|
||||
success: TerminalSessionSnapshot,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const TerminalCloseRpc = Rpc.make("terminalClose", {
|
||||
payload: TerminalCloseInput,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const SubscribeTerminalEventsRpc = Rpc.make("subscribeTerminalEvents", {
|
||||
success: TerminalEvent,
|
||||
stream: true,
|
||||
...rpcOptions,
|
||||
});
|
||||
|
||||
export const ServerRpcGroup = RpcGroup.make(
|
||||
GetBootstrapRpc,
|
||||
GetServerConfigRpc,
|
||||
UpsertKeybindingRpc,
|
||||
SubscribeServerConfigRpc,
|
||||
GetSnapshotRpc,
|
||||
DispatchCommandRpc,
|
||||
GetTurnDiffRpc,
|
||||
GetFullThreadDiffRpc,
|
||||
ReplayEventsRpc,
|
||||
SubscribeDomainEventsRpc,
|
||||
SearchEntriesRpc,
|
||||
OpenInEditorRpc,
|
||||
GitStatusRpc,
|
||||
GitPullRpc,
|
||||
GitRunStackedActionRpc,
|
||||
GitListBranchesRpc,
|
||||
GitCreateWorktreeRpc,
|
||||
GitRemoveWorktreeRpc,
|
||||
GitCreateBranchRpc,
|
||||
GitCheckoutRpc,
|
||||
GitInitRpc,
|
||||
GitResolvePullRequestRpc,
|
||||
GitPreparePullRequestThreadRpc,
|
||||
TerminalOpenRpc,
|
||||
TerminalWriteRpc,
|
||||
TerminalResizeRpc,
|
||||
TerminalClearRpc,
|
||||
TerminalRestartRpc,
|
||||
TerminalCloseRpc,
|
||||
SubscribeTerminalEventsRpc,
|
||||
);
|
||||
@@ -3,6 +3,7 @@ import { IsoDateTime, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { KeybindingRule, ResolvedKeybindingsConfig } from "./keybindings";
|
||||
import { EditorId } from "./editor";
|
||||
import { ProviderKind } from "./orchestration";
|
||||
import { ProjectId, ThreadId } from "./baseSchemas";
|
||||
|
||||
const KeybindingsMalformedConfigIssue = Schema.Struct({
|
||||
kind: Schema.Literal("keybindings.malformed-config"),
|
||||
@@ -55,6 +56,14 @@ export const ServerConfig = Schema.Struct({
|
||||
});
|
||||
export type ServerConfig = typeof ServerConfig.Type;
|
||||
|
||||
export const ServerBootstrapState = Schema.Struct({
|
||||
cwd: TrimmedNonEmptyString,
|
||||
projectName: TrimmedNonEmptyString,
|
||||
bootstrapProjectId: Schema.optional(ProjectId),
|
||||
bootstrapThreadId: Schema.optional(ThreadId),
|
||||
});
|
||||
export type ServerBootstrapState = typeof ServerBootstrapState.Type;
|
||||
|
||||
export const ServerUpsertKeybindingInput = KeybindingRule;
|
||||
export type ServerUpsertKeybindingInput = typeof ServerUpsertKeybindingInput.Type;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Schema, Struct } from "effect";
|
||||
import { NonNegativeInt, ProjectId, ThreadId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { NonNegativeInt, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
|
||||
import {
|
||||
ClientOrchestrationCommand,
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
import { KeybindingRule } from "./keybindings";
|
||||
import { ProjectSearchEntriesInput, ProjectWriteFileInput } from "./project";
|
||||
import { OpenInEditorInput } from "./editor";
|
||||
import { ServerConfigUpdatedPayload } from "./server";
|
||||
import { ServerBootstrapState, ServerConfigUpdatedPayload } from "./server";
|
||||
|
||||
// ── WebSocket RPC Method Names ───────────────────────────────────────
|
||||
|
||||
@@ -161,12 +161,7 @@ export type WebSocketResponse = typeof WebSocketResponse.Type;
|
||||
export const WsPushSequence = NonNegativeInt;
|
||||
export type WsPushSequence = typeof WsPushSequence.Type;
|
||||
|
||||
export const WsWelcomePayload = Schema.Struct({
|
||||
cwd: TrimmedNonEmptyString,
|
||||
projectName: TrimmedNonEmptyString,
|
||||
bootstrapProjectId: Schema.optional(ProjectId),
|
||||
bootstrapThreadId: Schema.optional(ThreadId),
|
||||
});
|
||||
export const WsWelcomePayload = ServerBootstrapState;
|
||||
export type WsWelcomePayload = typeof WsWelcomePayload.Type;
|
||||
|
||||
export interface WsPushPayloadByChannel {
|
||||
|
||||
Reference in new issue
Block a user