moriajs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +380 -0
- package/apps/playground/dist/index.d.ts +8 -0
- package/apps/playground/dist/index.d.ts.map +1 -0
- package/apps/playground/dist/index.js +36 -0
- package/apps/playground/dist/index.js.map +1 -0
- package/apps/playground/node_modules/.bin/rimraf +17 -0
- package/apps/playground/node_modules/.bin/rimraf.CMD +12 -0
- package/apps/playground/node_modules/.bin/rimraf.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsc +17 -0
- package/apps/playground/node_modules/.bin/tsc.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsc.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsserver +17 -0
- package/apps/playground/node_modules/.bin/tsserver.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsserver.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsx +17 -0
- package/apps/playground/node_modules/.bin/tsx.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsx.ps1 +41 -0
- package/apps/playground/package.json +25 -0
- package/apps/playground/src/index.ts +41 -0
- package/apps/playground/tsconfig.json +10 -0
- package/package.json +23 -0
- package/packages/auth/dist/index.d.ts +84 -0
- package/packages/auth/dist/index.d.ts.map +1 -0
- package/packages/auth/dist/index.js +78 -0
- package/packages/auth/dist/index.js.map +1 -0
- package/packages/auth/node_modules/.bin/rimraf +17 -0
- package/packages/auth/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/auth/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsc +17 -0
- package/packages/auth/node_modules/.bin/tsc.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsserver +17 -0
- package/packages/auth/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/auth/package.json +34 -0
- package/packages/auth/src/index.ts +138 -0
- package/packages/auth/tsconfig.json +10 -0
- package/packages/cli/dist/bin.d.ts +7 -0
- package/packages/cli/dist/bin.d.ts.map +1 -0
- package/packages/cli/dist/bin.js +8 -0
- package/packages/cli/dist/bin.js.map +1 -0
- package/packages/cli/dist/index.d.ts +8 -0
- package/packages/cli/dist/index.d.ts.map +1 -0
- package/packages/cli/dist/index.js +60 -0
- package/packages/cli/dist/index.js.map +1 -0
- package/packages/cli/node_modules/.bin/rimraf +17 -0
- package/packages/cli/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/cli/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsc +17 -0
- package/packages/cli/node_modules/.bin/tsc.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsserver +17 -0
- package/packages/cli/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/cli/package.json +33 -0
- package/packages/cli/src/bin.ts +10 -0
- package/packages/cli/src/index.ts +71 -0
- package/packages/cli/tsconfig.json +10 -0
- package/packages/core/dist/app.d.ts +42 -0
- package/packages/core/dist/app.d.ts.map +1 -0
- package/packages/core/dist/app.js +65 -0
- package/packages/core/dist/app.js.map +1 -0
- package/packages/core/dist/config.d.ts +61 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +18 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/index.d.ts +13 -0
- package/packages/core/dist/index.d.ts.map +1 -0
- package/packages/core/dist/index.js +10 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/core/dist/plugins.d.ts +38 -0
- package/packages/core/dist/plugins.d.ts.map +1 -0
- package/packages/core/dist/plugins.js +19 -0
- package/packages/core/dist/plugins.js.map +1 -0
- package/packages/core/node_modules/.bin/pino-pretty +17 -0
- package/packages/core/node_modules/.bin/pino-pretty.CMD +12 -0
- package/packages/core/node_modules/.bin/pino-pretty.ps1 +41 -0
- package/packages/core/node_modules/.bin/rimraf +17 -0
- package/packages/core/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/core/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsc +17 -0
- package/packages/core/node_modules/.bin/tsc.CMD +12 -0
- package/packages/core/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsserver +17 -0
- package/packages/core/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/core/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/core/package.json +35 -0
- package/packages/core/src/app.ts +103 -0
- package/packages/core/src/config.ts +66 -0
- package/packages/core/src/index.ts +14 -0
- package/packages/core/src/plugins.ts +42 -0
- package/packages/core/tsconfig.json +10 -0
- package/packages/create-moria/dist/bin.d.ts +7 -0
- package/packages/create-moria/dist/bin.d.ts.map +1 -0
- package/packages/create-moria/dist/bin.js +8 -0
- package/packages/create-moria/dist/bin.js.map +1 -0
- package/packages/create-moria/dist/index.d.ts +13 -0
- package/packages/create-moria/dist/index.d.ts.map +1 -0
- package/packages/create-moria/dist/index.js +142 -0
- package/packages/create-moria/dist/index.js.map +1 -0
- package/packages/create-moria/node_modules/.bin/rimraf +17 -0
- package/packages/create-moria/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsc +17 -0
- package/packages/create-moria/node_modules/.bin/tsc.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsserver +17 -0
- package/packages/create-moria/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/create-moria/package.json +28 -0
- package/packages/create-moria/src/bin.ts +10 -0
- package/packages/create-moria/src/index.ts +168 -0
- package/packages/create-moria/tsconfig.json +10 -0
- package/packages/db/dist/index.d.ts +71 -0
- package/packages/db/dist/index.d.ts.map +1 -0
- package/packages/db/dist/index.js +89 -0
- package/packages/db/dist/index.js.map +1 -0
- package/packages/db/node_modules/.bin/rimraf +17 -0
- package/packages/db/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/db/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsc +17 -0
- package/packages/db/node_modules/.bin/tsc.CMD +12 -0
- package/packages/db/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsserver +17 -0
- package/packages/db/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/db/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/db/package.json +37 -0
- package/packages/db/src/index.ts +119 -0
- package/packages/db/tsconfig.json +10 -0
- package/packages/renderer/dist/index.d.ts +55 -0
- package/packages/renderer/dist/index.d.ts.map +1 -0
- package/packages/renderer/dist/index.js +85 -0
- package/packages/renderer/dist/index.js.map +1 -0
- package/packages/renderer/node_modules/.bin/rimraf +17 -0
- package/packages/renderer/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/renderer/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsc +17 -0
- package/packages/renderer/node_modules/.bin/tsc.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsserver +17 -0
- package/packages/renderer/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/renderer/package.json +34 -0
- package/packages/renderer/src/index.ts +110 -0
- package/packages/renderer/tsconfig.json +14 -0
- package/packages/ui/dist/index.d.ts +76 -0
- package/packages/ui/dist/index.d.ts.map +1 -0
- package/packages/ui/dist/index.js +176 -0
- package/packages/ui/dist/index.js.map +1 -0
- package/packages/ui/node_modules/.bin/rimraf +17 -0
- package/packages/ui/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/ui/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsc +17 -0
- package/packages/ui/node_modules/.bin/tsc.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsserver +17 -0
- package/packages/ui/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/ui/package.json +29 -0
- package/packages/ui/src/index.ts +230 -0
- package/packages/ui/tsconfig.json +16 -0
- package/pnpm-workspace.yaml +3 -0
- package/tsconfig.base.json +25 -0
- package/turbo.json +35 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\tsx\dist\cli.mjs" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\tsx\dist\cli.mjs" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules\tsx\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\tsx@4.21.0\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/tsx@4.21.0/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moriajs/playground",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "MoriaJS internal playground for testing framework features",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsx src/index.ts",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"typecheck": "tsc --noEmit",
|
|
11
|
+
"clean": "rimraf dist .turbo"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@moriajs/core": "workspace:*",
|
|
15
|
+
"@moriajs/renderer": "workspace:*",
|
|
16
|
+
"@moriajs/db": "workspace:*",
|
|
17
|
+
"@moriajs/auth": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.7.0",
|
|
21
|
+
"tsx": "^4.19.0",
|
|
22
|
+
"rimraf": "^6.0.0",
|
|
23
|
+
"@types/node": "^22.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MoriaJS Playground
|
|
3
|
+
*
|
|
4
|
+
* A minimal application to test the MoriaJS framework.
|
|
5
|
+
* Run with: pnpm dev (uses tsx for direct TS execution)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createApp, defineConfig } from '@moriajs/core';
|
|
9
|
+
|
|
10
|
+
const config = defineConfig({
|
|
11
|
+
server: {
|
|
12
|
+
port: 3000,
|
|
13
|
+
logLevel: 'info',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
async function main() {
|
|
18
|
+
const app = await createApp({ config });
|
|
19
|
+
|
|
20
|
+
// Example route
|
|
21
|
+
app.server.get('/', async () => {
|
|
22
|
+
return {
|
|
23
|
+
framework: 'MoriaJS',
|
|
24
|
+
version: '0.0.1',
|
|
25
|
+
message: '🏔️ Welcome to MoriaJS — The Mithril.js Meta-Framework',
|
|
26
|
+
routes: {
|
|
27
|
+
health: '/health',
|
|
28
|
+
api: '/api (coming soon)',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Start the server
|
|
34
|
+
const address = await app.listen();
|
|
35
|
+
console.log(`\n🏔️ MoriaJS Playground running at ${address}\n`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main().catch((err) => {
|
|
39
|
+
console.error('Failed to start:', err);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "moriajs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "A full-stack meta-framework for Mithril.js built on Fastify",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "turbo dev",
|
|
9
|
+
"build": "turbo build",
|
|
10
|
+
"lint": "turbo lint",
|
|
11
|
+
"test": "turbo test",
|
|
12
|
+
"clean": "turbo clean",
|
|
13
|
+
"typecheck": "turbo typecheck"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"turbo": "^2.4.0",
|
|
17
|
+
"typescript": "^5.7.0"
|
|
18
|
+
},
|
|
19
|
+
"packageManager": "pnpm@9.15.0",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @moriajs/auth
|
|
3
|
+
*
|
|
4
|
+
* Pluggable authentication system for MoriaJS.
|
|
5
|
+
* Default: JWT + httpOnly cookies.
|
|
6
|
+
* Architecture: Provider-based for future OAuth, sessions, etc.
|
|
7
|
+
*/
|
|
8
|
+
import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
9
|
+
/**
|
|
10
|
+
* User payload stored in JWT token.
|
|
11
|
+
* Extend this via TypeScript module augmentation in your app.
|
|
12
|
+
*/
|
|
13
|
+
export interface AuthUser {
|
|
14
|
+
id: string | number;
|
|
15
|
+
email?: string;
|
|
16
|
+
role?: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for the auth plugin.
|
|
21
|
+
*/
|
|
22
|
+
export interface AuthConfig {
|
|
23
|
+
/** JWT secret key (required) */
|
|
24
|
+
secret: string;
|
|
25
|
+
/** Token expiration (default: '7d') */
|
|
26
|
+
expiresIn?: string;
|
|
27
|
+
/** Cookie name for JWT storage (default: 'moria_token') */
|
|
28
|
+
cookieName?: string;
|
|
29
|
+
/** Use secure cookies (default: true in production) */
|
|
30
|
+
secureCookies?: boolean;
|
|
31
|
+
/** Cookie path (default: '/') */
|
|
32
|
+
cookiePath?: string;
|
|
33
|
+
/** SameSite cookie attribute (default: 'lax') */
|
|
34
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Auth provider interface for pluggable authentication strategies.
|
|
38
|
+
*/
|
|
39
|
+
export interface AuthProvider {
|
|
40
|
+
/** Provider name (e.g., 'jwt', 'session', 'oauth-google') */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Verify a request and return the authenticated user, or null */
|
|
43
|
+
verify: (request: FastifyRequest) => Promise<AuthUser | null>;
|
|
44
|
+
/** Create a token/session for a user */
|
|
45
|
+
sign: (user: AuthUser, reply: FastifyReply) => Promise<string>;
|
|
46
|
+
/** Invalidate a token/session */
|
|
47
|
+
revoke?: (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create the JWT auth plugin for MoriaJS.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { createApp } from '@moriajs/core';
|
|
55
|
+
* import { createAuthPlugin } from '@moriajs/auth';
|
|
56
|
+
*
|
|
57
|
+
* const app = await createApp();
|
|
58
|
+
* await app.use(createAuthPlugin({
|
|
59
|
+
* secret: process.env.JWT_SECRET!,
|
|
60
|
+
* expiresIn: '24h',
|
|
61
|
+
* }));
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function createAuthPlugin(config: AuthConfig): {
|
|
65
|
+
name: string;
|
|
66
|
+
register({ server }: {
|
|
67
|
+
server: any;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Route-level authentication guard.
|
|
72
|
+
* Use as a Fastify preHandler hook.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* server.get('/protected', { preHandler: [requireAuth()] }, async (req) => {
|
|
77
|
+
* return { user: req.user };
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare function requireAuth(options?: {
|
|
82
|
+
role?: string;
|
|
83
|
+
}): (request: FastifyRequest, reply: FastifyReply) => Promise<undefined>;
|
|
84
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAmB,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,MAAM,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC9D,wCAAwC;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,iCAAiC;IACjC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU;;yBAIhB;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE;EAoCjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,IACrC,SAAS,cAAc,EAAE,OAAO,YAAY,wBAe7D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @moriajs/auth
|
|
3
|
+
*
|
|
4
|
+
* Pluggable authentication system for MoriaJS.
|
|
5
|
+
* Default: JWT + httpOnly cookies.
|
|
6
|
+
* Architecture: Provider-based for future OAuth, sessions, etc.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Create the JWT auth plugin for MoriaJS.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { createApp } from '@moriajs/core';
|
|
14
|
+
* import { createAuthPlugin } from '@moriajs/auth';
|
|
15
|
+
*
|
|
16
|
+
* const app = await createApp();
|
|
17
|
+
* await app.use(createAuthPlugin({
|
|
18
|
+
* secret: process.env.JWT_SECRET!,
|
|
19
|
+
* expiresIn: '24h',
|
|
20
|
+
* }));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function createAuthPlugin(config) {
|
|
24
|
+
return {
|
|
25
|
+
name: '@moriajs/auth',
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
async register({ server }) {
|
|
28
|
+
const jwt = await import('@fastify/jwt');
|
|
29
|
+
await server.register(jwt.default, {
|
|
30
|
+
secret: config.secret,
|
|
31
|
+
cookie: {
|
|
32
|
+
cookieName: config.cookieName ?? 'moria_token',
|
|
33
|
+
signed: false,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
// Auth utility: sign JWT and set cookie
|
|
37
|
+
server.decorate('signIn', async (user, reply) => {
|
|
38
|
+
const token = server.jwt.sign({ ...user }, { expiresIn: config.expiresIn ?? '7d' });
|
|
39
|
+
reply.header('Set-Cookie', `${config.cookieName ?? 'moria_token'}=${token}; HttpOnly; Path=${config.cookiePath ?? '/'}; SameSite=${config.sameSite ?? 'Lax'}${(config.secureCookies ?? process.env.NODE_ENV === 'production') ? '; Secure' : ''}`);
|
|
40
|
+
return token;
|
|
41
|
+
});
|
|
42
|
+
// Auth utility: sign out (clear cookie)
|
|
43
|
+
server.decorate('signOut', async (_request, reply) => {
|
|
44
|
+
reply.header('Set-Cookie', `${config.cookieName ?? 'moria_token'}=; HttpOnly; Path=${config.cookiePath ?? '/'}; Max-Age=0`);
|
|
45
|
+
});
|
|
46
|
+
server.log.info('@moriajs/auth: JWT auth plugin registered');
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Route-level authentication guard.
|
|
52
|
+
* Use as a Fastify preHandler hook.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* server.get('/protected', { preHandler: [requireAuth()] }, async (req) => {
|
|
57
|
+
* return { user: req.user };
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function requireAuth(options) {
|
|
62
|
+
return async (request, reply) => {
|
|
63
|
+
try {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
await request.jwtVerify();
|
|
66
|
+
if (options?.role) {
|
|
67
|
+
const user = request.user;
|
|
68
|
+
if (user.role !== options.role) {
|
|
69
|
+
return reply.status(403).send({ error: 'Forbidden' });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return reply.status(401).send({ error: 'Unauthorized' });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+CH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IAC/C,OAAO;QACH,IAAI,EAAE,eAAe;QACrB,8DAA8D;QAC9D,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAmB;YACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;YAEzC,MAAO,MAA0B,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE;gBACpD,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE;oBACJ,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,aAAa;oBAC9C,MAAM,EAAE,KAAK;iBAChB;aACJ,CAAC,CAAC;YAEH,wCAAwC;YACxC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAc,EAAE,KAAmB,EAAE,EAAE;gBACpE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CACzB,EAAE,GAAG,IAAI,EAAE,EACX,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI,EAAE,CAC1C,CAAC;gBAEF,KAAK,CAAC,MAAM,CAAC,YAAY,EACrB,GAAG,MAAM,CAAC,UAAU,IAAI,aAAa,IAAI,KAAK,oBAAoB,MAAM,CAAC,UAAU,IAAI,GAAG,cAAc,MAAM,CAAC,QAAQ,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAClN,EAAE,CACL,CAAC;gBAEF,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,wCAAwC;YACxC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,QAAwB,EAAE,KAAmB,EAAE,EAAE;gBAC/E,KAAK,CAAC,MAAM,CAAC,YAAY,EACrB,GAAG,MAAM,CAAC,UAAU,IAAI,aAAa,qBAAqB,MAAM,CAAC,UAAU,IAAI,GAAG,aAAa,CAClG,CAAC;YACN,CAAC,CAAC,CAAC;YAEF,MAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QACtF,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACnD,OAAO,KAAK,EAAE,OAAuB,EAAE,KAAmB,EAAE,EAAE;QAC1D,IAAI,CAAC;YACD,8DAA8D;YAC9D,MAAO,OAAe,CAAC,SAAS,EAAE,CAAC;YAEnC,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;gBAChB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAgB,CAAC;gBACtC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;oBAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC1D,CAAC;YACL,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../rimraf/dist/esm/bin.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../rimraf/dist/esm/bin.mjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\rimraf\dist\esm\bin.mjs" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\rimraf\dist\esm\bin.mjs" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsc" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\typescript\bin\tsc" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsserver" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\typescript\bin\tsserver" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@moriajs/auth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MoriaJS auth — JWT + httpOnly cookies, pluggable auth system",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"clean": "rimraf dist .turbo"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@fastify/jwt": "^10.0.0",
|
|
22
|
+
"@fastify/cookie": "^11.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.7.0",
|
|
26
|
+
"rimraf": "^6.0.0",
|
|
27
|
+
"@types/node": "^22.0.0",
|
|
28
|
+
"fastify": "^5.2.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@moriajs/core": "workspace:*"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT"
|
|
34
|
+
}
|