mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-19 14:16:29 +00:00
feat(mcp): add OAuth 2.1 support (#505)
* feat(mcp): add OAuth 2.1 support with dynamic client registration * feat(api): alias bare oauth-authorization-server discovery endpoint * fix(auth): preserve user session on OAuth sign-in redirect to consent
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
### Added
|
||||
|
||||
* **mcp**: Shumai now has a built-in MCP server at `https://<your-shumai-host>/mcp`, so external AI agents such as Claude Code, Cursor, or Kiro can browse projects and create, rename, move, or delete folders and files with your API token and permissions. Like other MCP servers, it can also be served from its own host name, such as `https://mcp.example.com/mcp`
|
||||
* **mcp**: Shumai now has a built-in MCP server at `https://<your-shumai-host>/mcp`, supporting both OAuth 2.1 with Dynamic Client Registration and API token authentication, so external AI agents such as Claude Code, Cursor, or Kiro can browse projects and create, rename, move, or delete folders and files with your permissions. Like other MCP servers, it can also be served from its own host name, such as `https://mcp.example.com/mcp`
|
||||
* **agent**: The built-in agent can now list the projects you have access to, so it can find a project's root folder on its own. Team owners can turn this off per agent like other tools
|
||||
* **mcp**: External AI agents connected to Shumai's MCP server can now look at your files: images, video frames, PDF pages, 3D model views, and text files. Images are attached so the AI can see them, along with links that stay valid for about an hour. They can also get download links for files, as the web preview or the original upload
|
||||
* **cli**: New `shumai-cli download` command saves files to your computer, up to 50 at a time: the smaller web preview by default, or the original upload with `--original`
|
||||
|
||||
@@ -134,6 +134,7 @@ async function run() {
|
||||
const routes: Record<string, any> = {
|
||||
'/api/*': app.fetch,
|
||||
'/files/*': app.fetch,
|
||||
'/.well-known/*': app.fetch,
|
||||
// Shumai's MCP server; without this entry the SPA catch-all (`/*`) would serve it HTML.
|
||||
'/mcp': app.fetch,
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
"name": "@shumai/api",
|
||||
"version": "0.6.1",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -213,6 +214,8 @@
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.74",
|
||||
"@aws-sdk/client-s3": "3.1121.0",
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.28.0",
|
||||
@@ -223,7 +226,7 @@
|
||||
"@sinclair/typebox": "0.34.52",
|
||||
"adm-zip": "0.6.0",
|
||||
"ai": "7.0.84",
|
||||
"better-auth": "1.6.11",
|
||||
"better-auth": "1.7.12",
|
||||
"csv-parse": "7.0.2",
|
||||
"date-fns": "4.4.0",
|
||||
"dotenv": "17.4.2",
|
||||
@@ -316,6 +319,7 @@
|
||||
"version": "0.6.1",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.7.0",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@dnd-kit/abstract": "0.5.0",
|
||||
"@dnd-kit/dom": "0.5.0",
|
||||
"@dnd-kit/react": "0.5.0",
|
||||
@@ -367,7 +371,7 @@
|
||||
"@uppy/aws-s3": "6.0.0",
|
||||
"@uppy/core": "6.0.0",
|
||||
"@uppy/xhr-upload": "6.0.0",
|
||||
"better-auth": "1.6.11",
|
||||
"better-auth": "1.7.12",
|
||||
"class-variance-authority": "0.7.1",
|
||||
"clsx": "2.1.1",
|
||||
"cmdk": "1.1.1",
|
||||
@@ -587,23 +591,27 @@
|
||||
|
||||
"@base-ui/utils": ["@base-ui/utils@0.3.2", "", { "dependencies": { "@babel/runtime": "^7.29.2", "@floating-ui/utils": "^0.2.12", "reselect": "^5.2.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-oWy1aq/I2GmYjpl4PhEAhzflF8VPGKgZeq0xAWTbfD5KBWyxcN0ZP2+WHSUm/5Z6lVMBDLReLcoXwSYoRc/zNQ=="],
|
||||
|
||||
"@better-auth/core": ["@better-auth/core@1.6.11", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.39.0", "@standard-schema/spec": "^1.1.0", "zod": "^4.3.6" }, "peerDependencies": { "@better-auth/utils": "0.4.0", "@better-fetch/fetch": "1.1.21", "@cloudflare/workers-types": ">=4", "@opentelemetry/api": "^1.9.0", "better-call": "1.3.5", "jose": "^6.1.0", "kysely": "^0.28.5", "nanostores": "^1.0.1" }, "optionalPeers": ["@cloudflare/workers-types", "@opentelemetry/api"] }, "sha512-LrwidLCV8azdMGjvtwp30nj9tIv1BwI3VhtC0UaGSjQkAVWw4bN42I8qwbxRziPeSQoj+zUVkOpxZzAWBDARtQ=="],
|
||||
"@better-auth/core": ["@better-auth/core@1.7.12", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "zod": "^4.5.4" }, "peerDependencies": { "@better-auth/utils": "^0.4.2 || ^0.5.0", "@better-fetch/fetch": "1.3.2", "@opentelemetry/api": "^1.9.0", "better-call": "1.4.4", "jose": "^6.1.0", "kysely": "^0.28.5 || ^0.29.0", "nanostores": "^1.0.1" }, "optionalPeers": ["@opentelemetry/api"] }, "sha512-SUStBGHJ13KnSO6+7U/1DSlfuOtln4jtOrFZqzQtxZVHZIrAoMjwHNGitlF+s7hvKbuC3Z14xjnqfLLqIqGfxw=="],
|
||||
|
||||
"@better-auth/drizzle-adapter": ["@better-auth/drizzle-adapter@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0", "drizzle-orm": "^0.45.2" }, "optionalPeers": ["drizzle-orm"] }, "sha512-4jpkETIGZOHCf7BK4jnu22fdN6jjomH0/HhEzkaWy3+Eppi5PYlHTF/460jrTmA3Xc+Vqwp9t282ymHiEPypGw=="],
|
||||
"@better-auth/drizzle-adapter": ["@better-auth/drizzle-adapter@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0" }, "optionalPeers": ["drizzle-orm"] }, "sha512-Qzoyuf05aK01Pc0k3EXv8Xj3XCT2m2dCWc5HoB7x+xX6N3Pm2eQsca+UIArsJcbuNEWWP3L51oIebnBoHJ5DTw=="],
|
||||
|
||||
"@better-auth/kysely-adapter": ["@better-auth/kysely-adapter@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0", "kysely": "^0.28.17" }, "optionalPeers": ["kysely"] }, "sha512-/g8M9RfIjdcZDnbstSUvQiINkvdNlCeZr248zwqx2/PVksQI1MhQofbzUn3RnQnbPKp0EPwpX/dR3oudRFenUg=="],
|
||||
"@better-auth/kysely-adapter": ["@better-auth/kysely-adapter@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "kysely": "^0.28.17 || ^0.29.0" }, "optionalPeers": ["kysely"] }, "sha512-1PaFXktLv4n3DmrGbPaCj5SsvcT40NnWw7NLua5/J1+8/A051N5ZzqOwJifXEIQX5k6NdwvmymwDQxKytduEAQ=="],
|
||||
|
||||
"@better-auth/memory-adapter": ["@better-auth/memory-adapter@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0" } }, "sha512-hpdfw0BBf8MuzLkIdmbcUZICbY9r/bhLO2RxSnkzT5+/O+0I0u2I8+m0YUP7vNllP/ZCKASHOYgXPLO75Z0f9Q=="],
|
||||
"@better-auth/mcp": ["@better-auth/mcp@1.7.12", "", { "dependencies": { "@better-auth/oauth-provider": "^1.7.12", "jose": "^6.1.3" }, "peerDependencies": { "@better-auth/core": "^1.7.12", "better-auth": "^1.7.12", "better-call": "1.4.4" } }, "sha512-iiD6qW/aSBznMJ/t9v9/a3Obd1T2QeiBbbHZTLwusCLm+tzeH6fLHIgB7631TYQBuB/iEA+xpEs9mCy14MpQ8Q=="],
|
||||
|
||||
"@better-auth/mongo-adapter": ["@better-auth/mongo-adapter@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0", "mongodb": "^6.0.0 || ^7.0.0" }, "optionalPeers": ["mongodb"] }, "sha512-3Tor8rSv8vSEIMEaV2PFpPEuVhqc1gNoZ6eGvoh3LwExXXuj8madew6ob+H1pH7Aphn3Ar5PQ08AguT8TbwFAA=="],
|
||||
"@better-auth/memory-adapter": ["@better-auth/memory-adapter@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0" } }, "sha512-glaDwXzDptnddHqRuu7fj47FAssUcOzLNgdlTGJoEPrspkX69x2vnXwgAzNuApjZI21WLtPH/rQ6CN+DQGybPA=="],
|
||||
|
||||
"@better-auth/prisma-adapter": ["@better-auth/prisma-adapter@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@prisma/client", "prisma"] }, "sha512-Pw+7q7zTp+VSci1V+CYMvuxIbAeVMZLe4lRo46LJoAKMHfjFl5T/ycsyFvWs/DkWC7n9gZZzRDEbHp0I5FiKKw=="],
|
||||
"@better-auth/mongo-adapter": ["@better-auth/mongo-adapter@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "mongodb": "^6.0.0 || ^7.0.0" }, "optionalPeers": ["mongodb"] }, "sha512-HKV4sgYSw/Gdt9AuHlESMkiKL72SWdGweDy1Wsyxoh06BpG7aNu4aSJ7marNpMdKZteyRbxWWqQkA9ediA8qFw=="],
|
||||
|
||||
"@better-auth/telemetry": ["@better-auth/telemetry@1.6.11", "", { "peerDependencies": { "@better-auth/core": "^1.6.11", "@better-auth/utils": "0.4.0", "@better-fetch/fetch": "1.1.21" } }, "sha512-hsjDHc8MZbm6/AHeNdtywrWedXevnBjmdvnHTcZub+rTVjOv+Td0roI8USKuC6uUibmrl//2rJfVCsGbopihNA=="],
|
||||
"@better-auth/oauth-provider": ["@better-auth/oauth-provider@1.7.12", "", { "dependencies": { "jose": "^6.2.3", "zod": "^4.5.4" }, "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "@better-fetch/fetch": "1.3.2", "better-auth": "^1.7.12", "better-call": "1.4.4" } }, "sha512-XzjlApbWtuuoEK63CUNHbgs8zpr3AjlQeGbT1vWEPqvOvI2z4lOaIvIsogomfqFAgj/jgB0zMGYjt0MRyW0T7w=="],
|
||||
|
||||
"@better-auth/utils": ["@better-auth/utils@0.4.0", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-RpMtLUIQAEWMgdPLNVbIF5ON2mm+CH0U3rCdUCU1VyeAUui4m38DyK7/aXMLZov2YDjG684pS1D0MBllrmgjQA=="],
|
||||
"@better-auth/prisma-adapter": ["@better-auth/prisma-adapter@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@prisma/client", "prisma"] }, "sha512-FZRX6ORbwhDmeYE1Tl0IPtUn8v3BlVFgbJxDnm/DCNHxuFRf+0t4HfddUgYeYehHFR8aSDsdYX44fEFWM9877w=="],
|
||||
|
||||
"@better-fetch/fetch": ["@better-fetch/fetch@1.1.21", "", {}, "sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A=="],
|
||||
"@better-auth/telemetry": ["@better-auth/telemetry@1.7.12", "", { "peerDependencies": { "@better-auth/core": "^1.7.12", "@better-auth/utils": "^0.4.2 || ^0.5.0", "@better-fetch/fetch": "1.3.2" } }, "sha512-DaDkKNnI99vKGGbWq9KJg2uYeaOjsK9nIBw9T2m2KG/RkxpvQRjYkZ00++up2bZQkR5pB1nukGbplza3UJG/Xg=="],
|
||||
|
||||
"@better-auth/utils": ["@better-auth/utils@0.5.0", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA=="],
|
||||
|
||||
"@better-fetch/fetch": ["@better-fetch/fetch@1.3.2", "", {}, "sha512-Gs7n99b5tqUC6cQAPbV0uED3IraHB6xQbHLQ/C3l7ZFafHScOx9pQ+DYmP5blbLFShVWLqxNUlI9wi4xU/X+ow=="],
|
||||
|
||||
"@date-fns/tz": ["@date-fns/tz@1.5.0", "", {}, "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg=="],
|
||||
|
||||
@@ -1689,9 +1697,9 @@
|
||||
|
||||
"bcrypt-pbkdf": ["bcrypt-pbkdf@1.0.2", "", { "dependencies": { "tweetnacl": "^0.14.3" } }, "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w=="],
|
||||
|
||||
"better-auth": ["better-auth@1.6.11", "", { "dependencies": { "@better-auth/core": "1.6.11", "@better-auth/drizzle-adapter": "1.6.11", "@better-auth/kysely-adapter": "1.6.11", "@better-auth/memory-adapter": "1.6.11", "@better-auth/mongo-adapter": "1.6.11", "@better-auth/prisma-adapter": "1.6.11", "@better-auth/telemetry": "1.6.11", "@better-auth/utils": "0.4.0", "@better-fetch/fetch": "1.1.21", "@noble/ciphers": "^2.1.1", "@noble/hashes": "^2.0.1", "better-call": "1.3.5", "defu": "^6.1.4", "jose": "^6.1.3", "kysely": "^0.28.17", "nanostores": "^1.1.1", "zod": "^4.3.6" }, "peerDependencies": { "@lynx-js/react": "*", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "@sveltejs/kit": "^2.0.0", "@tanstack/react-start": "^1.0.0", "@tanstack/solid-start": "^1.0.0", "better-sqlite3": "^12.0.0", "drizzle-kit": ">=0.31.4", "drizzle-orm": "^0.45.2", "mongodb": "^6.0.0 || ^7.0.0", "mysql2": "^3.0.0", "next": "^14.0.0 || ^15.0.0 || ^16.0.0", "pg": "^8.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "solid-js": "^1.0.0", "svelte": "^4.0.0 || ^5.0.0", "vitest": "^2.0.0 || ^3.0.0 || ^4.0.0", "vue": "^3.0.0" }, "optionalPeers": ["@lynx-js/react", "@prisma/client", "@sveltejs/kit", "@tanstack/react-start", "@tanstack/solid-start", "better-sqlite3", "drizzle-kit", "drizzle-orm", "mongodb", "mysql2", "next", "pg", "prisma", "react", "react-dom", "solid-js", "svelte", "vitest", "vue"] }, "sha512-Wwt6+q07dwIhsp6XiM7L1qSXVUWBEtNl+eZvwM778CguFqDZFBN9Pt6LtFaHl55t8Z+Zc//5kxcbgDY8/79vFQ=="],
|
||||
"better-auth": ["better-auth@1.7.12", "", { "dependencies": { "@better-auth/core": "1.7.12", "@better-auth/drizzle-adapter": "1.7.12", "@better-auth/kysely-adapter": "1.7.12", "@better-auth/memory-adapter": "1.7.12", "@better-auth/mongo-adapter": "1.7.12", "@better-auth/prisma-adapter": "1.7.12", "@better-auth/telemetry": "1.7.12", "@better-auth/utils": "0.5.0", "@better-fetch/fetch": "1.3.2", "@noble/ciphers": "^2.2.0", "@noble/hashes": "^2.2.0", "better-call": "1.4.4", "defu": "^6.1.4", "jose": "^6.2.3", "kysely": "^0.28.17 || ^0.29.0", "nanostores": "^1.3.0", "zod": "^4.5.4" }, "peerDependencies": { "@lynx-js/react": "*", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "@sveltejs/kit": "^2.0.0 || ^3.0.0", "@tanstack/react-start": "^1.0.0", "@tanstack/solid-start": "^1.0.0", "drizzle-kit": ">=0.31.4 || >=1.0.0-beta.1", "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0", "mongodb": "^6.0.0 || ^7.0.0", "mysql2": "^3.0.0", "next": "^14.0.0 || ^15.0.0 || ^16.0.0", "pg": "^8.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0", "solid-js": "^1.0.0", "svelte": "^4.0.0 || ^5.0.0", "vitest": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", "vue": "^3.0.0" }, "optionalPeers": ["@lynx-js/react", "@prisma/client", "@sveltejs/kit", "@tanstack/react-start", "@tanstack/solid-start", "drizzle-kit", "drizzle-orm", "mongodb", "mysql2", "next", "pg", "prisma", "react", "react-dom", "solid-js", "svelte", "vitest", "vue"] }, "sha512-f1fEG0QdTslzbmFA+vOGFFW/XXCWkG4kBxLeH9n1vp1otTH9+ZzV6EJ6797GStWeiYYgS5Vnt9xqE12KwSyAAw=="],
|
||||
|
||||
"better-call": ["better-call@1.3.5", "", { "dependencies": { "@better-auth/utils": "^0.4.0", "@better-fetch/fetch": "^1.1.21", "rou3": "^0.7.12", "set-cookie-parser": "^3.0.1" }, "peerDependencies": { "zod": "^4.0.0" }, "optionalPeers": ["zod"] }, "sha512-kOFJkBP7utAQLEYrobZm3vkTH8mXq5GNgvjc5/XEST1ilVHaxXUXfeDeFlqoETMtyqS4+3/h4ONX2i++ebZrvA=="],
|
||||
"better-call": ["better-call@1.4.4", "", { "dependencies": { "@better-auth/utils": "^0.5.0", "@better-fetch/fetch": "^1.3.1", "rou3": "^0.9.1", "set-cookie-parser": "^3.1.2" }, "peerDependencies": { "zod": "^4.0.0" }, "optionalPeers": ["zod"] }, "sha512-Gq4XdGFy4dmUxFEAX2nj0ycFcFbD9ZWh8YROouZoyXeF1M11TpYbplk0pDByTFF8Wz+MYa6W9052c9m7dD+mfw=="],
|
||||
|
||||
"better-result": ["better-result@2.10.0", "", {}, "sha512-oQhh0y1qo2/ZKdAAEvHZAqKKiHOFU5k/bW96fE2ScgQOVkJRiHwB+nOS1SgFsYqRlxMDWvefXi9Q3px7QvgNDw=="],
|
||||
|
||||
@@ -2693,7 +2701,7 @@
|
||||
|
||||
"rolldown": ["rolldown@1.2.6", "", { "dependencies": { "@oxc-project/types": "=0.147.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.6", "@rolldown/binding-android-arm64": "1.2.6", "@rolldown/binding-darwin-arm64": "1.2.6", "@rolldown/binding-darwin-x64": "1.2.6", "@rolldown/binding-freebsd-x64": "1.2.6", "@rolldown/binding-linux-arm-gnueabihf": "1.2.6", "@rolldown/binding-linux-arm64-gnu": "1.2.6", "@rolldown/binding-linux-arm64-musl": "1.2.6", "@rolldown/binding-linux-ppc64-gnu": "1.2.6", "@rolldown/binding-linux-s390x-gnu": "1.2.6", "@rolldown/binding-linux-x64-gnu": "1.2.6", "@rolldown/binding-linux-x64-musl": "1.2.6", "@rolldown/binding-openharmony-arm64": "1.2.6", "@rolldown/binding-win32-arm64-msvc": "1.2.6", "@rolldown/binding-win32-x64-msvc": "1.2.6" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA=="],
|
||||
|
||||
"rou3": ["rou3@0.7.12", "", {}, "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg=="],
|
||||
"rou3": ["rou3@0.9.2", "", {}, "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="],
|
||||
|
||||
"safe-array-concat": ["safe-array-concat@1.1.4", "", { "dependencies": { "call-bind": "^1.0.9", "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "has-symbols": "^1.1.0", "isarray": "^2.0.5" } }, "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg=="],
|
||||
|
||||
@@ -3213,8 +3221,6 @@
|
||||
|
||||
"bcrypt-pbkdf/tweetnacl": ["tweetnacl@0.14.5", "", {}, "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="],
|
||||
|
||||
"better-call/@better-auth/utils": ["@better-auth/utils@0.4.2", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-AUxrvu+HaaODsUyzDxFgwd/8RZ1yZaYo42LXKSrU2oGgR38pS1ij8nqQKNgtTWoYGpNevNXtCfgTy6loHveW9A=="],
|
||||
|
||||
"better-call/@better-fetch/fetch": ["@better-fetch/fetch@1.3.1", "", {}, "sha512-ABkD1WhyfPZprKRQI3bhATjeiFuNWC9PXhfGWqL+sg/gKrM977oFrYkdb4msM3hgUGonr7KlOsOFT5TU2rht9g=="],
|
||||
|
||||
"bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { Hono } from 'hono'
|
||||
import agentRoute from './agent'
|
||||
import chatRoute from './chat'
|
||||
@@ -80,11 +81,18 @@ const apiRoute = new Hono<{ Variables: { user: User } }>()
|
||||
.route('/', kanbanRoute)
|
||||
.route('/', mediaGenerationRoute)
|
||||
|
||||
// RFC 8414 & RFC 9728 OAuth discovery endpoints
|
||||
app.on(['GET', 'HEAD', 'OPTIONS'], '/.well-known/oauth-authorization-server', (c) => {
|
||||
const url = new URL(c.req.raw.url)
|
||||
url.pathname = '/.well-known/oauth-authorization-server/api/auth'
|
||||
return auth.handler(new Request(url.toString(), c.req.raw))
|
||||
})
|
||||
app.on(['GET', 'HEAD', 'OPTIONS'], '/.well-known/*', (c) => auth.handler(c.req.raw))
|
||||
|
||||
// Shumai's MCP server lives at the root (`/mcp`), next to the API rather than inside it, so
|
||||
// it can also be served from a dedicated host (e.g. `https://mcp.example.com/mcp`). It takes
|
||||
// API tokens only. The `/api/mcp/servers` routes are a separate feature: external MCP servers
|
||||
// that Shumai's own agent connects to.
|
||||
app.use('/mcp', requireApiTokenMiddleware)
|
||||
// it can also be served from a dedicated host (e.g. `https://mcp.example.com/mcp`). It supports
|
||||
// both static API tokens and OAuth 2.1 authentication. The `/api/mcp/servers` routes are a separate
|
||||
// feature: external MCP servers that Shumai's own agent connects to.
|
||||
app.route('/', mcpServerRoute)
|
||||
|
||||
app.route('/files', s3Route)
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { createHash, randomBytes } from 'node:crypto'
|
||||
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'
|
||||
import { prisma, type User } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import { authBaseUrl, hashPassword, mcpResource } from '@shumai/core/src/auth/auth'
|
||||
import app from './index'
|
||||
|
||||
function base64url(buffer: Buffer): string {
|
||||
return buffer.toString('base64url')
|
||||
}
|
||||
|
||||
describe('MCP server OAuth 2.1 & Dual Auth', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let user: User
|
||||
let apiToken: string
|
||||
let teamId: string
|
||||
let projectId: string
|
||||
let rootFolderId: string
|
||||
const clients: Client[] = []
|
||||
|
||||
beforeEach(async () => {
|
||||
user = await prisma.user.create({
|
||||
data: { name: 'OAuth User', email: 'oauth-user@test.com' },
|
||||
})
|
||||
await prisma.account.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
providerId: 'credential',
|
||||
accountId: user.id,
|
||||
password: await hashPassword('password123'),
|
||||
},
|
||||
})
|
||||
const team = await prisma.team.create({ data: { name: 'OAuth Team' } })
|
||||
teamId = team.id
|
||||
await prisma.teamMember.create({ data: { teamId, userId: user.id, role: 'owner' } })
|
||||
const project = await projectService.createProject(user, { teamId, name: 'OAuth Project' })
|
||||
projectId = project.id
|
||||
rootFolderId = project.rootFolder!
|
||||
|
||||
apiToken = (await apiTokenService.createToken(user.id, 'dual-auth-test')).token
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(clients.splice(0).map((c) => c.close()))
|
||||
})
|
||||
|
||||
it('serves RFC 8414 and RFC 9728 discovery endpoints', async () => {
|
||||
// RFC 9728 Protected Resource Metadata
|
||||
const resourceMetaRes = await app.request('/.well-known/oauth-protected-resource')
|
||||
expect(resourceMetaRes.status).toBe(200)
|
||||
const resourceMeta = await resourceMetaRes.json()
|
||||
expect(resourceMeta.resource).toBe(mcpResource)
|
||||
expect(resourceMeta.authorization_servers).toContain(`${authBaseUrl}/api/auth`)
|
||||
|
||||
// RFC 9728 resource-specific metadata
|
||||
const resourcePathMetaRes = await app.request('/.well-known/oauth-protected-resource/mcp')
|
||||
expect(resourcePathMetaRes.status).toBe(200)
|
||||
const resourcePathMeta = await resourcePathMetaRes.json()
|
||||
expect(resourcePathMeta.resource).toBe(mcpResource)
|
||||
|
||||
// RFC 8414 Authorization Server Metadata (supports both standard path-inserted and bare root paths)
|
||||
const authServerMetaRes = await app.request('/.well-known/oauth-authorization-server/api/auth')
|
||||
expect(authServerMetaRes.status).toBe(200)
|
||||
const authServerMeta = await authServerMetaRes.json()
|
||||
expect(authServerMeta.issuer).toBe(`${authBaseUrl}/api/auth`)
|
||||
expect(authServerMeta.authorization_endpoint).toBe(`${authBaseUrl}/api/auth/oauth2/authorize`)
|
||||
expect(authServerMeta.token_endpoint).toBe(`${authBaseUrl}/api/auth/oauth2/token`)
|
||||
expect(authServerMeta.registration_endpoint).toBe(`${authBaseUrl}/api/auth/oauth2/register`)
|
||||
expect(authServerMeta.jwks_uri).toBe(`${authBaseUrl}/api/auth/jwks`)
|
||||
|
||||
const bareAuthServerMetaRes = await app.request('/.well-known/oauth-authorization-server')
|
||||
expect(bareAuthServerMetaRes.status).toBe(200)
|
||||
const bareAuthServerMeta = await bareAuthServerMetaRes.json()
|
||||
expect(bareAuthServerMeta.issuer).toBe(authServerMeta.issuer)
|
||||
expect(bareAuthServerMeta.authorization_endpoint).toBe(authServerMeta.authorization_endpoint)
|
||||
|
||||
// JWKS
|
||||
const jwksRes = await app.request('/api/auth/jwks')
|
||||
expect(jwksRes.status).toBe(200)
|
||||
const jwks = await jwksRes.json()
|
||||
expect(Array.isArray(jwks.keys)).toBe(true)
|
||||
expect(jwks.keys.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('returns 401 with RFC 9728 WWW-Authenticate header when unauthenticated', async () => {
|
||||
const initialize = JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
id: 1,
|
||||
method: 'initialize',
|
||||
params: {
|
||||
protocolVersion: '2025-06-18',
|
||||
capabilities: {},
|
||||
clientInfo: { name: 'test', version: '1' },
|
||||
},
|
||||
})
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json, text/event-stream',
|
||||
}
|
||||
|
||||
// Missing token
|
||||
const resNoToken = await app.request('/mcp', { method: 'POST', headers, body: initialize })
|
||||
expect(resNoToken.status).toBe(401)
|
||||
const authHeader = resNoToken.headers.get('WWW-Authenticate')
|
||||
expect(authHeader).toContain('Bearer')
|
||||
expect(authHeader).toContain('resource_metadata=')
|
||||
|
||||
// Invalid JWT / OAuth token
|
||||
const resInvalidToken = await app.request('/mcp', {
|
||||
method: 'POST',
|
||||
headers: { ...headers, Authorization: 'Bearer invalid.jwt.token' },
|
||||
body: initialize,
|
||||
})
|
||||
expect(resInvalidToken.status).toBe(401)
|
||||
expect(resInvalidToken.headers.get('WWW-Authenticate')).toContain('Bearer')
|
||||
|
||||
// Invalid Shumai API token
|
||||
const resInvalidApiKey = await app.request('/mcp', {
|
||||
method: 'POST',
|
||||
headers: { ...headers, Authorization: 'Bearer shumai_invalid' },
|
||||
body: initialize,
|
||||
})
|
||||
expect(resInvalidApiKey.status).toBe(401)
|
||||
})
|
||||
|
||||
it('completes Dynamic Client Registration, PKCE authorization, and MCP tool calls via OAuth 2.1', async () => {
|
||||
// 1. Dynamic Client Registration (DCR)
|
||||
const registerRes = await app.request('/api/auth/oauth2/register', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_name: 'Test MCP Client',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
redirect_uris: ['http://127.0.0.1:9999/callback'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
grant_types: ['authorization_code', 'refresh_token'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
response_types: ['code'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
token_endpoint_auth_method: 'none',
|
||||
}),
|
||||
})
|
||||
expect(registerRes.status).toBe(201)
|
||||
const clientData = await registerRes.json()
|
||||
const clientId = clientData.client_id
|
||||
expect(clientId).toBeDefined()
|
||||
|
||||
// 2. Sign in user to obtain session cookie
|
||||
const signInRes = await app.request('/api/auth/sign-in/email', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email: 'oauth-user@test.com', password: 'password123' }),
|
||||
})
|
||||
expect(signInRes.status).toBe(200)
|
||||
const cookieHeader = signInRes.headers.get('set-cookie')
|
||||
expect(cookieHeader).toBeDefined()
|
||||
|
||||
// 3. Initiate PKCE Authorization
|
||||
const codeVerifier = base64url(randomBytes(32))
|
||||
const codeChallenge = base64url(createHash('sha256').update(codeVerifier).digest())
|
||||
|
||||
const authUrl = new URL('/api/auth/oauth2/authorize', authBaseUrl)
|
||||
authUrl.searchParams.set('response_type', 'code')
|
||||
authUrl.searchParams.set('client_id', clientId)
|
||||
authUrl.searchParams.set('redirect_uri', 'http://127.0.0.1:9999/callback')
|
||||
authUrl.searchParams.set('scope', 'openid profile email offline_access mcp')
|
||||
authUrl.searchParams.set('code_challenge', codeChallenge)
|
||||
authUrl.searchParams.set('code_challenge_method', 'S256')
|
||||
authUrl.searchParams.set('resource', mcpResource)
|
||||
|
||||
const authorizeRes = await app.request(authUrl.pathname + authUrl.search, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Cookie: cookieHeader!,
|
||||
},
|
||||
redirect: 'manual',
|
||||
})
|
||||
|
||||
// Better Auth redirects either directly with `code` (if skip consent) or to `/consent`
|
||||
let code: string | null
|
||||
const location = authorizeRes.headers.get('location')
|
||||
expect(location).toBeDefined()
|
||||
|
||||
if (location!.includes('/consent')) {
|
||||
// User consent step
|
||||
const consentUrl = new URL(location!, authBaseUrl)
|
||||
const consentRes = await app.request('/api/auth/oauth2/consent', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: cookieHeader!,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
accept: true,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
oauth_query: consentUrl.search.replace(/^\?/, ''),
|
||||
}),
|
||||
})
|
||||
expect(consentRes.status).toBe(200)
|
||||
const consentData = await consentRes.json()
|
||||
expect(consentData.redirect).toBe(true)
|
||||
const redirectUrl = new URL(consentData.url)
|
||||
code = redirectUrl.searchParams.get('code')
|
||||
} else {
|
||||
const redirectUrl = new URL(location!, 'http://127.0.0.1:9999')
|
||||
code = redirectUrl.searchParams.get('code')
|
||||
}
|
||||
|
||||
expect(code).toBeDefined()
|
||||
|
||||
// 4. Token exchange with PKCE code_verifier
|
||||
const tokenRes = await app.request('/api/auth/oauth2/token', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: new URLSearchParams([
|
||||
['grant_type', 'authorization_code'],
|
||||
['code', code!],
|
||||
['redirect_uri', 'http://127.0.0.1:9999/callback'],
|
||||
['client_id', clientId],
|
||||
['code_verifier', codeVerifier],
|
||||
['resource', mcpResource],
|
||||
]).toString(),
|
||||
})
|
||||
|
||||
expect(tokenRes.status).toBe(200)
|
||||
const tokenData = await tokenRes.json()
|
||||
expect(tokenData.access_token).toBeDefined()
|
||||
expect(tokenData.token_type).toMatch(/Bearer/i)
|
||||
|
||||
const oauthAccessToken = tokenData.access_token
|
||||
|
||||
// 5. Connect official MCP Client using OAuth 2.1 access token
|
||||
const oauthTransport = new StreamableHTTPClientTransport(new URL('http://localhost:3000/mcp'), {
|
||||
requestInit: { headers: { Authorization: `Bearer ${oauthAccessToken}` } },
|
||||
fetch: async (input, init) => app.request(String(input), init),
|
||||
})
|
||||
const oauthMcpClient = new Client({ name: 'oauth-integration-client', version: '1.0.0' })
|
||||
await oauthMcpClient.connect(oauthTransport)
|
||||
clients.push(oauthMcpClient)
|
||||
|
||||
// Call list_projects tool
|
||||
const projects = await oauthMcpClient.callTool({ name: 'list_projects', arguments: {} })
|
||||
expect(projects.structuredContent).toEqual({
|
||||
data: [{ id: projectId, name: 'OAuth Project', teamId, rootFolderId }],
|
||||
})
|
||||
|
||||
// Call create_folder tool
|
||||
const createdFolder = await oauthMcpClient.callTool({
|
||||
name: 'create_folder',
|
||||
arguments: { parent: rootFolderId, name: 'From OAuth MCP' },
|
||||
})
|
||||
expect(createdFolder.isError).toBeFalsy()
|
||||
const folderId = (createdFolder.structuredContent as { id: string }).id
|
||||
const folder = await prisma.asset.findUniqueOrThrow({ where: { id: folderId } })
|
||||
expect(folder).toMatchObject({ name: 'From OAuth MCP', creatorId: user.id })
|
||||
|
||||
// Verify audit log has via: 'mcp'
|
||||
const audit = await prisma.auditLog.findFirstOrThrow({
|
||||
where: { action: 'folder_create', itemId: folderId },
|
||||
})
|
||||
expect(audit).toMatchObject({ userId: user.id, via: 'mcp' })
|
||||
|
||||
// 6. Verify static API token still works on the exact same endpoint simultaneously!
|
||||
const apiKeyTransport = new StreamableHTTPClientTransport(
|
||||
new URL('http://localhost:3000/mcp'),
|
||||
{
|
||||
requestInit: { headers: { Authorization: `Bearer ${apiToken}` } },
|
||||
fetch: async (input, init) => app.request(String(input), init),
|
||||
},
|
||||
)
|
||||
const apiKeyMcpClient = new Client({ name: 'api-key-client', version: '1.0.0' })
|
||||
await apiKeyMcpClient.connect(apiKeyTransport)
|
||||
clients.push(apiKeyMcpClient)
|
||||
|
||||
const apiKeyCreated = await apiKeyMcpClient.callTool({
|
||||
name: 'create_folder',
|
||||
arguments: { parent: rootFolderId, name: 'From API Key MCP' },
|
||||
})
|
||||
expect(apiKeyCreated.isError).toBeFalsy()
|
||||
})
|
||||
|
||||
it('starts OAuth authorization without a session, redirects to login, signs in, and completes authorization', async () => {
|
||||
// 1. Dynamic Client Registration
|
||||
const registerRes = await app.request('/api/auth/oauth2/register', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_name: 'Test Logged-Out Client',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
redirect_uris: ['http://127.0.0.1:9999/callback'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
grant_types: ['authorization_code'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
response_types: ['code'],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
token_endpoint_auth_method: 'none',
|
||||
}),
|
||||
})
|
||||
expect(registerRes.status).toBe(201)
|
||||
const clientData = await registerRes.json()
|
||||
const clientId = clientData.client_id
|
||||
|
||||
// 2. Initiate PKCE authorization without session cookie
|
||||
const codeVerifier = base64url(randomBytes(32))
|
||||
const codeChallenge = base64url(createHash('sha256').update(codeVerifier).digest())
|
||||
|
||||
const authUrl = new URL('/api/auth/oauth2/authorize', authBaseUrl)
|
||||
authUrl.searchParams.set('response_type', 'code')
|
||||
authUrl.searchParams.set('client_id', clientId)
|
||||
authUrl.searchParams.set('redirect_uri', 'http://127.0.0.1:9999/callback')
|
||||
authUrl.searchParams.set('scope', 'openid profile email offline_access mcp')
|
||||
authUrl.searchParams.set('code_challenge', codeChallenge)
|
||||
authUrl.searchParams.set('code_challenge_method', 'S256')
|
||||
authUrl.searchParams.set('resource', mcpResource)
|
||||
|
||||
const unauthAuthorizeRes = await app.request(authUrl.pathname + authUrl.search, {
|
||||
method: 'GET',
|
||||
redirect: 'manual',
|
||||
})
|
||||
|
||||
// Expect redirect to login page (/login)
|
||||
expect(unauthAuthorizeRes.status).toBe(302)
|
||||
const loginRedirect = unauthAuthorizeRes.headers.get('location')
|
||||
expect(loginRedirect).toBeDefined()
|
||||
expect(loginRedirect).toContain('/login')
|
||||
|
||||
// 3. User signs in on the login page
|
||||
const signInRes = await app.request('/api/auth/sign-in/email', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email: 'oauth-user@test.com', password: 'password123' }),
|
||||
})
|
||||
expect(signInRes.status).toBe(200)
|
||||
const cookieHeader = signInRes.headers.get('set-cookie')
|
||||
expect(cookieHeader).toBeDefined()
|
||||
|
||||
// 4. Verify server session is valid via /api/auth/get-session
|
||||
const sessionRes = await app.request('/api/auth/get-session', {
|
||||
headers: { Cookie: cookieHeader! },
|
||||
})
|
||||
expect(sessionRes.status).toBe(200)
|
||||
const sessionData = await sessionRes.json()
|
||||
expect(sessionData?.user?.id).toBe(user.id)
|
||||
|
||||
// 5. User accesses the consent page / resumes authorize with the session cookie
|
||||
const authorizedRes = await app.request(authUrl.pathname + authUrl.search, {
|
||||
method: 'GET',
|
||||
headers: { Cookie: cookieHeader! },
|
||||
redirect: 'manual',
|
||||
})
|
||||
const consentLocation = authorizedRes.headers.get('location')
|
||||
expect(consentLocation).toBeDefined()
|
||||
|
||||
let code: string | null
|
||||
if (consentLocation!.includes('/consent')) {
|
||||
// Grant consent
|
||||
const consentUrl = new URL(consentLocation!, authBaseUrl)
|
||||
const consentRes = await app.request('/api/auth/oauth2/consent', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: cookieHeader!,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
accept: true,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
oauth_query: consentUrl.search.replace(/^\?/, ''),
|
||||
}),
|
||||
})
|
||||
expect(consentRes.status).toBe(200)
|
||||
const consentData = await consentRes.json()
|
||||
expect(consentData.redirect).toBe(true)
|
||||
const redirectUrl = new URL(consentData.url)
|
||||
code = redirectUrl.searchParams.get('code')
|
||||
} else {
|
||||
const cbUrl = new URL(consentLocation!)
|
||||
code = cbUrl.searchParams.get('code')
|
||||
}
|
||||
|
||||
expect(code).toBeDefined()
|
||||
|
||||
// 6. Exchange code for OAuth 2.1 access token
|
||||
const tokenRes = await app.request('/api/auth/oauth2/token', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: new URLSearchParams({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
grant_type: 'authorization_code',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_id: clientId,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
redirect_uri: 'http://127.0.0.1:9999/callback',
|
||||
code: code!,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
code_verifier: codeVerifier,
|
||||
resource: mcpResource,
|
||||
}).toString(),
|
||||
})
|
||||
expect(tokenRes.status).toBe(200)
|
||||
const tokenData = await tokenRes.json()
|
||||
expect(tokenData.access_token).toBeDefined()
|
||||
|
||||
// 7. Verify MCP access with the issued token
|
||||
const oauthTransport = new StreamableHTTPClientTransport(new URL('http://localhost:3000/mcp'), {
|
||||
requestInit: { headers: { Authorization: `Bearer ${tokenData.access_token}` } },
|
||||
fetch: async (input, init) => app.request(String(input), init),
|
||||
})
|
||||
const oauthMcpClient = new Client({ name: 'oauth-logged-out-client', version: '1.0.0' })
|
||||
await oauthMcpClient.connect(oauthTransport)
|
||||
clients.push(oauthMcpClient)
|
||||
|
||||
const projects = await oauthMcpClient.callTool({ name: 'list_projects', arguments: {} })
|
||||
expect(projects.structuredContent).toEqual({
|
||||
data: [{ id: projectId, name: 'OAuth Project', teamId, rootFolderId }],
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Hono } from 'hono'
|
||||
import { createMcpHandler, McpServer, type CallToolResult } from '@modelcontextprotocol/server'
|
||||
import { requireMcpAuth } from '@better-auth/mcp'
|
||||
import type { z } from 'zod'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { dropNullOptionals } from '@shumai/operations'
|
||||
import { getOperationsForSurface, runOperation, type Operation } from '@shumai/core/src/operations'
|
||||
import { auth, authBaseUrl, mcpResource } from '@shumai/core/src/auth/auth'
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import { mcpExtensions, type McpToolExtension } from './mcp-extensions'
|
||||
import { assertWritableInDemoMode, describeOperationError } from './operation-support'
|
||||
|
||||
@@ -131,12 +134,80 @@ const mcpHandler = createMcpHandler(({ authInfo }) => {
|
||||
return buildMcpServer(userId)
|
||||
})
|
||||
|
||||
/** Shumai's MCP server (Streamable HTTP). Mounted at `/mcp` behind API token auth. */
|
||||
const route = new Hono<{ Variables: { user: User } }>().all('/mcp', (c) => {
|
||||
const user = c.get('user')
|
||||
return mcpHandler.fetch(c.req.raw, {
|
||||
authInfo: { token: '', clientId: user.id, scopes: [], extra: { userId: user.id } },
|
||||
})
|
||||
const oauthHandler = requireMcpAuth(
|
||||
auth,
|
||||
(req, claims) => {
|
||||
const userId = claims.sub
|
||||
if (!userId) {
|
||||
throw new Error('OAuth token has no sub claim')
|
||||
}
|
||||
const clientId = (claims.azp as string) ?? (claims.client_id as string) ?? ''
|
||||
const scopes =
|
||||
typeof claims.scope === 'string'
|
||||
? claims.scope.split(' ')
|
||||
: ((claims.scopes as string[]) ?? [])
|
||||
return mcpHandler.fetch(req, {
|
||||
authInfo: {
|
||||
token: '',
|
||||
clientId,
|
||||
scopes,
|
||||
extra: { userId },
|
||||
},
|
||||
})
|
||||
},
|
||||
{
|
||||
resource: mcpResource,
|
||||
// In-process verification: avoids HTTP loopback round-trip and works even in test environments
|
||||
// where no HTTP port is bound.
|
||||
jwksUrl: (async () => {
|
||||
const res = await auth.handler(new Request(`${authBaseUrl}/api/auth/jwks`))
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to load JWKS in-process: ${res.statusText}`)
|
||||
}
|
||||
return await res.json()
|
||||
}) as unknown as string,
|
||||
},
|
||||
)
|
||||
|
||||
/** Shumai's MCP server (Streamable HTTP). Mounted at `/mcp` with dual API token and OAuth 2.1 auth. */
|
||||
const route = new Hono<{ Variables: { user: User } }>().all('/mcp', async (c) => {
|
||||
const existingUser = c.get('user')
|
||||
if (existingUser?.id) {
|
||||
return mcpHandler.fetch(c.req.raw, {
|
||||
authInfo: {
|
||||
token: '',
|
||||
clientId: existingUser.id,
|
||||
scopes: [],
|
||||
extra: { userId: existingUser.id },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const authHeader = c.req.header('Authorization')
|
||||
const apiKeyHeader = c.req.header('x-api-key')
|
||||
let bearerToken: string | null = null
|
||||
if (authHeader && authHeader.startsWith('Bearer ')) {
|
||||
bearerToken = authHeader.substring(7).trim()
|
||||
}
|
||||
const candidateToken = bearerToken || apiKeyHeader || null
|
||||
|
||||
if (candidateToken && (candidateToken.startsWith('shumai_') || apiKeyHeader)) {
|
||||
const user = await apiTokenService.validateToken(candidateToken)
|
||||
if (!user) {
|
||||
c.header('WWW-Authenticate', 'Bearer realm="shumai"')
|
||||
return c.json({ error: 'Unauthorized: Invalid API Key' }, 401)
|
||||
}
|
||||
return mcpHandler.fetch(c.req.raw, {
|
||||
authInfo: {
|
||||
token: candidateToken,
|
||||
clientId: user.id,
|
||||
scopes: [],
|
||||
extra: { userId: user.id },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return oauthHandler(c.req.raw)
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
"@anthropic-ai/sandbox-runtime": "0.0.74",
|
||||
"@aws-sdk/client-s3": "3.1121.0",
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@earendil-works/pi-ai": "0.82.1",
|
||||
"@google/genai": "2.28.0",
|
||||
@@ -37,7 +39,7 @@
|
||||
"@sinclair/typebox": "0.34.52",
|
||||
"adm-zip": "0.6.0",
|
||||
"ai": "7.0.84",
|
||||
"better-auth": "1.6.11",
|
||||
"better-auth": "1.7.12",
|
||||
"csv-parse": "7.0.2",
|
||||
"date-fns": "4.4.0",
|
||||
"dotenv": "17.4.2",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { AsyncLocalStorage } from 'node:async_hooks'
|
||||
import { betterAuth } from 'better-auth'
|
||||
import { jwt } from 'better-auth/plugins'
|
||||
import { mcp } from '@better-auth/mcp'
|
||||
import { prismaAdapter } from 'better-auth/adapters/prisma'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
@@ -14,10 +16,28 @@ interface GeneratedResetLink {
|
||||
|
||||
const resetLinkStorage = new AsyncLocalStorage<GeneratedResetLink>()
|
||||
|
||||
export const authBaseUrl =
|
||||
process.env.BETTER_AUTH_URL || `http://localhost:${process.env.SHUMAI_SERVER_PORT || '3000'}`
|
||||
export const mcpResource = `${authBaseUrl}/mcp`
|
||||
export { hashPassword } from 'better-auth/crypto'
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: prismaAdapter(prisma, {
|
||||
provider: 'postgresql',
|
||||
}),
|
||||
plugins: [
|
||||
jwt(),
|
||||
mcp({
|
||||
loginPage: '/login',
|
||||
consentPage: '/consent',
|
||||
resource: mcpResource,
|
||||
resources: [{ identifier: mcpResource, allowedScopes: ['mcp'] }],
|
||||
scopes: ['openid', 'profile', 'email', 'offline_access', 'mcp'],
|
||||
allowDynamicClientRegistration: true,
|
||||
allowUnauthenticatedClientRegistration: true,
|
||||
clientRegistrationDefaultApplicationType: 'infer',
|
||||
}),
|
||||
],
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
minPasswordLength: 3,
|
||||
@@ -33,8 +53,7 @@ export const auth = betterAuth({
|
||||
},
|
||||
secret: process.env.BETTER_AUTH_SECRET,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
baseURL:
|
||||
process.env.BETTER_AUTH_URL || `http://localhost:${process.env.SHUMAI_SERVER_PORT || '3000'}`,
|
||||
baseURL: authBaseUrl,
|
||||
basePath: '/api/auth',
|
||||
trustedOrigins: [
|
||||
`http://localhost:${process.env.SHUMAI_SERVER_PORT || '3000'}`,
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "jwks" (
|
||||
"id" TEXT NOT NULL,
|
||||
"public_key" TEXT NOT NULL,
|
||||
"private_key" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"expires_at" TIMESTAMP(3),
|
||||
"alg" TEXT,
|
||||
"crv" TEXT,
|
||||
|
||||
CONSTRAINT "jwks_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_clients" (
|
||||
"id" TEXT NOT NULL,
|
||||
"client_id" TEXT NOT NULL,
|
||||
"client_secret" TEXT,
|
||||
"client_discovery_id" TEXT,
|
||||
"disabled" BOOLEAN DEFAULT false,
|
||||
"skip_consent" BOOLEAN,
|
||||
"enable_end_session" BOOLEAN,
|
||||
"subject_type" TEXT,
|
||||
"scopes" TEXT[],
|
||||
"client_credentials_scopes" TEXT[] DEFAULT ARRAY[]::TEXT[],
|
||||
"user_id" TEXT,
|
||||
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3),
|
||||
"name" TEXT,
|
||||
"uri" TEXT,
|
||||
"icon" TEXT,
|
||||
"contacts" TEXT[],
|
||||
"tos" TEXT,
|
||||
"policy" TEXT,
|
||||
"software_id" TEXT,
|
||||
"software_version" TEXT,
|
||||
"software_statement" TEXT,
|
||||
"redirect_uris" TEXT[],
|
||||
"post_logout_redirect_uris" TEXT[],
|
||||
"backchannel_logout_uri" TEXT,
|
||||
"backchannel_logout_session_required" BOOLEAN,
|
||||
"token_endpoint_auth_method" TEXT,
|
||||
"application_type" TEXT,
|
||||
"jwks" TEXT,
|
||||
"jwks_uri" TEXT,
|
||||
"grant_types" TEXT[],
|
||||
"response_types" TEXT[],
|
||||
"require_pkce" BOOLEAN,
|
||||
"dpop_bound_access_tokens" BOOLEAN DEFAULT false,
|
||||
"reference_id" TEXT,
|
||||
"metadata" JSONB,
|
||||
|
||||
CONSTRAINT "oauth_clients_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_resources" (
|
||||
"id" TEXT NOT NULL,
|
||||
"identifier" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"access_token_ttl" INTEGER,
|
||||
"refresh_token_ttl" INTEGER,
|
||||
"signing_algorithm" TEXT,
|
||||
"signing_key_id" TEXT,
|
||||
"allowed_scopes" TEXT[],
|
||||
"custom_claims" JSONB,
|
||||
"dpop_bound_access_tokens_required" BOOLEAN DEFAULT false,
|
||||
"disabled" BOOLEAN DEFAULT false,
|
||||
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3),
|
||||
"policy_version" INTEGER DEFAULT 1,
|
||||
"metadata" JSONB,
|
||||
|
||||
CONSTRAINT "oauth_resources_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_client_resources" (
|
||||
"id" TEXT NOT NULL,
|
||||
"client_id" TEXT NOT NULL,
|
||||
"resource_id" TEXT NOT NULL,
|
||||
"metadata" JSONB,
|
||||
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "oauth_client_resources_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_refresh_tokens" (
|
||||
"id" TEXT NOT NULL,
|
||||
"token" TEXT NOT NULL,
|
||||
"client_id" TEXT NOT NULL,
|
||||
"session_id" TEXT,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"reference_id" TEXT,
|
||||
"authorization_code_id" TEXT,
|
||||
"resources" TEXT[],
|
||||
"requested_user_info_claims" TEXT[],
|
||||
"expires_at" TIMESTAMP(3) NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"revoked" TIMESTAMP(3),
|
||||
"rotated_at" TIMESTAMP(3),
|
||||
"rotation_replay_response" TEXT,
|
||||
"rotation_replay_expires_at" TIMESTAMP(3),
|
||||
"auth_time" TIMESTAMP(3),
|
||||
"confirmation" JSONB,
|
||||
"scopes" TEXT[],
|
||||
|
||||
CONSTRAINT "oauth_refresh_tokens_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_access_tokens" (
|
||||
"id" TEXT NOT NULL,
|
||||
"token" TEXT NOT NULL,
|
||||
"client_id" TEXT NOT NULL,
|
||||
"session_id" TEXT,
|
||||
"user_id" TEXT,
|
||||
"reference_id" TEXT,
|
||||
"authorization_code_id" TEXT,
|
||||
"resources" TEXT[],
|
||||
"requested_user_info_claims" TEXT[],
|
||||
"refresh_id" TEXT,
|
||||
"expires_at" TIMESTAMP(3) NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"revoked" TIMESTAMP(3),
|
||||
"confirmation" JSONB,
|
||||
"scopes" TEXT[],
|
||||
|
||||
CONSTRAINT "oauth_access_tokens_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_consents" (
|
||||
"id" TEXT NOT NULL,
|
||||
"client_id" TEXT NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"reference_id" TEXT,
|
||||
"resources" TEXT[],
|
||||
"requested_user_info_claims" TEXT[],
|
||||
"scopes" TEXT[],
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "oauth_consents_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "oauth_client_assertions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expires_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "oauth_client_assertions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "oauth_clients_client_id_key" ON "oauth_clients"("client_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "oauth_resources_identifier_key" ON "oauth_resources"("identifier");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "oauth_client_resources_client_id_resource_id_key" ON "oauth_client_resources"("client_id", "resource_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "oauth_refresh_tokens_token_key" ON "oauth_refresh_tokens"("token");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "oauth_access_tokens_token_key" ON "oauth_access_tokens"("token");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_clients" ADD CONSTRAINT "oauth_clients_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_client_resources" ADD CONSTRAINT "oauth_client_resources_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "oauth_clients"("client_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_client_resources" ADD CONSTRAINT "oauth_client_resources_resource_id_fkey" FOREIGN KEY ("resource_id") REFERENCES "oauth_resources"("identifier") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_refresh_tokens" ADD CONSTRAINT "oauth_refresh_tokens_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "oauth_clients"("client_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_refresh_tokens" ADD CONSTRAINT "oauth_refresh_tokens_session_id_fkey" FOREIGN KEY ("session_id") REFERENCES "sessions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_refresh_tokens" ADD CONSTRAINT "oauth_refresh_tokens_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_access_tokens" ADD CONSTRAINT "oauth_access_tokens_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "oauth_clients"("client_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_access_tokens" ADD CONSTRAINT "oauth_access_tokens_session_id_fkey" FOREIGN KEY ("session_id") REFERENCES "sessions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_access_tokens" ADD CONSTRAINT "oauth_access_tokens_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_access_tokens" ADD CONSTRAINT "oauth_access_tokens_refresh_id_fkey" FOREIGN KEY ("refresh_id") REFERENCES "oauth_refresh_tokens"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_consents" ADD CONSTRAINT "oauth_consents_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "oauth_clients"("client_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "oauth_consents" ADD CONSTRAINT "oauth_consents_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,25 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "oauth_access_tokens" ALTER COLUMN "resources" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "requested_user_info_claims" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "scopes" SET DEFAULT ARRAY[]::TEXT[];
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "oauth_clients" ALTER COLUMN "scopes" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "contacts" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "redirect_uris" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "post_logout_redirect_uris" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "grant_types" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "response_types" SET DEFAULT ARRAY[]::TEXT[];
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "oauth_consents" ALTER COLUMN "resources" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "requested_user_info_claims" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "scopes" SET DEFAULT ARRAY[]::TEXT[];
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "oauth_refresh_tokens" ALTER COLUMN "resources" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "requested_user_info_claims" SET DEFAULT ARRAY[]::TEXT[],
|
||||
ALTER COLUMN "scopes" SET DEFAULT ARRAY[]::TEXT[];
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "oauth_resources" ALTER COLUMN "allowed_scopes" SET DEFAULT ARRAY[]::TEXT[];
|
||||
@@ -249,6 +249,10 @@ model User {
|
||||
kanbanTaskComments KanbanTaskComment[]
|
||||
kanbanTaskEvents KanbanTaskEvent[]
|
||||
recentFiles RecentFileItem[]
|
||||
oauthClients OauthClient[]
|
||||
oauthRefreshTokens OauthRefreshToken[]
|
||||
oauthAccessTokens OauthAccessToken[]
|
||||
oauthConsents OauthConsent[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -264,6 +268,9 @@ model Session {
|
||||
userId String @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
oauthRefreshTokens OauthRefreshToken[]
|
||||
oauthAccessTokens OauthAccessToken[]
|
||||
|
||||
@@map("sessions")
|
||||
}
|
||||
|
||||
@@ -1344,5 +1351,178 @@ model RecentFileItem {
|
||||
@@map("recent_file_items")
|
||||
}
|
||||
|
||||
model Jwks {
|
||||
id String @id @default(ulid())
|
||||
publicKey String @map("public_key")
|
||||
privateKey String @map("private_key")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
alg String?
|
||||
crv String?
|
||||
|
||||
@@map("jwks")
|
||||
}
|
||||
|
||||
model OauthClient {
|
||||
id String @id @default(ulid())
|
||||
clientId String @unique @map("client_id")
|
||||
clientSecret String? @map("client_secret")
|
||||
clientDiscoveryId String? @map("client_discovery_id")
|
||||
disabled Boolean? @default(false)
|
||||
skipConsent Boolean? @map("skip_consent")
|
||||
enableEndSession Boolean? @map("enable_end_session")
|
||||
subjectType String? @map("subject_type")
|
||||
scopes String[] @default([])
|
||||
clientCredentialsScopes String[] @default([]) @map("client_credentials_scopes")
|
||||
userId String? @map("user_id")
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime? @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
name String?
|
||||
uri String?
|
||||
icon String?
|
||||
contacts String[] @default([])
|
||||
tos String?
|
||||
policy String?
|
||||
softwareId String? @map("software_id")
|
||||
softwareVersion String? @map("software_version")
|
||||
softwareStatement String? @map("software_statement")
|
||||
redirectUris String[] @default([]) @map("redirect_uris")
|
||||
postLogoutRedirectUris String[] @default([]) @map("post_logout_redirect_uris")
|
||||
backchannelLogoutUri String? @map("backchannel_logout_uri")
|
||||
backchannelLogoutSessionRequired Boolean? @map("backchannel_logout_session_required")
|
||||
tokenEndpointAuthMethod String? @map("token_endpoint_auth_method")
|
||||
applicationType String? @map("application_type")
|
||||
jwks String?
|
||||
jwksUri String? @map("jwks_uri")
|
||||
grantTypes String[] @default([]) @map("grant_types")
|
||||
responseTypes String[] @default([]) @map("response_types")
|
||||
requirePKCE Boolean? @map("require_pkce")
|
||||
dpopBoundAccessTokens Boolean? @default(false) @map("dpop_bound_access_tokens")
|
||||
referenceId String? @map("reference_id")
|
||||
/// [OauthMetadata]
|
||||
metadata Json?
|
||||
|
||||
clientResources OauthClientResource[]
|
||||
refreshTokens OauthRefreshToken[]
|
||||
accessTokens OauthAccessToken[]
|
||||
consents OauthConsent[]
|
||||
|
||||
@@map("oauth_clients")
|
||||
}
|
||||
|
||||
model OauthResource {
|
||||
id String @id @default(ulid())
|
||||
identifier String @unique
|
||||
name String
|
||||
accessTokenTtl Int? @map("access_token_ttl")
|
||||
refreshTokenTtl Int? @map("refresh_token_ttl")
|
||||
signingAlgorithm String? @map("signing_algorithm")
|
||||
signingKeyId String? @map("signing_key_id")
|
||||
allowedScopes String[] @default([]) @map("allowed_scopes")
|
||||
/// [OauthCustomClaims]
|
||||
customClaims Json? @map("custom_claims")
|
||||
dpopBoundAccessTokensRequired Boolean? @default(false) @map("dpop_bound_access_tokens_required")
|
||||
disabled Boolean? @default(false)
|
||||
createdAt DateTime? @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
policyVersion Int? @default(1) @map("policy_version")
|
||||
/// [OauthMetadata]
|
||||
metadata Json?
|
||||
|
||||
clientResources OauthClientResource[]
|
||||
|
||||
@@map("oauth_resources")
|
||||
}
|
||||
|
||||
model OauthClientResource {
|
||||
id String @id @default(ulid())
|
||||
clientId String @map("client_id")
|
||||
client OauthClient @relation(fields: [clientId], references: [clientId], onDelete: Cascade)
|
||||
resourceId String @map("resource_id")
|
||||
resource OauthResource @relation(fields: [resourceId], references: [identifier], onDelete: Cascade)
|
||||
/// [OauthMetadata]
|
||||
metadata Json?
|
||||
createdAt DateTime? @default(now()) @map("created_at")
|
||||
|
||||
@@unique([clientId, resourceId])
|
||||
@@map("oauth_client_resources")
|
||||
}
|
||||
|
||||
model OauthRefreshToken {
|
||||
id String @id @default(ulid())
|
||||
token String @unique
|
||||
clientId String @map("client_id")
|
||||
client OauthClient @relation(fields: [clientId], references: [clientId], onDelete: Cascade)
|
||||
sessionId String? @map("session_id")
|
||||
session Session? @relation(fields: [sessionId], references: [id], onDelete: SetNull)
|
||||
userId String @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
referenceId String? @map("reference_id")
|
||||
authorizationCodeId String? @map("authorization_code_id")
|
||||
resources String[] @default([])
|
||||
requestedUserInfoClaims String[] @default([]) @map("requested_user_info_claims")
|
||||
expiresAt DateTime @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
revoked DateTime?
|
||||
rotatedAt DateTime? @map("rotated_at")
|
||||
rotationReplayResponse String? @map("rotation_replay_response")
|
||||
rotationReplayExpiresAt DateTime? @map("rotation_replay_expires_at")
|
||||
authTime DateTime? @map("auth_time")
|
||||
/// [OauthConfirmation]
|
||||
confirmation Json?
|
||||
scopes String[] @default([])
|
||||
|
||||
accessTokens OauthAccessToken[]
|
||||
|
||||
@@map("oauth_refresh_tokens")
|
||||
}
|
||||
|
||||
model OauthAccessToken {
|
||||
id String @id @default(ulid())
|
||||
token String @unique
|
||||
clientId String @map("client_id")
|
||||
client OauthClient @relation(fields: [clientId], references: [clientId], onDelete: Cascade)
|
||||
sessionId String? @map("session_id")
|
||||
session Session? @relation(fields: [sessionId], references: [id], onDelete: SetNull)
|
||||
userId String? @map("user_id")
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
referenceId String? @map("reference_id")
|
||||
authorizationCodeId String? @map("authorization_code_id")
|
||||
resources String[] @default([])
|
||||
requestedUserInfoClaims String[] @default([]) @map("requested_user_info_claims")
|
||||
refreshId String? @map("refresh_id")
|
||||
refreshToken OauthRefreshToken? @relation(fields: [refreshId], references: [id], onDelete: Cascade)
|
||||
expiresAt DateTime @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
revoked DateTime?
|
||||
/// [OauthConfirmation]
|
||||
confirmation Json?
|
||||
scopes String[] @default([])
|
||||
|
||||
@@map("oauth_access_tokens")
|
||||
}
|
||||
|
||||
model OauthConsent {
|
||||
id String @id @default(ulid())
|
||||
clientId String @map("client_id")
|
||||
client OauthClient @relation(fields: [clientId], references: [clientId], onDelete: Cascade)
|
||||
userId String? @map("user_id")
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
referenceId String? @map("reference_id")
|
||||
resources String[] @default([])
|
||||
requestedUserInfoClaims String[] @default([]) @map("requested_user_info_claims")
|
||||
scopes String[] @default([])
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@map("oauth_consents")
|
||||
}
|
||||
|
||||
model OauthClientAssertion {
|
||||
id String @id @default(ulid())
|
||||
expiresAt DateTime @map("expires_at")
|
||||
|
||||
@@map("oauth_client_assertions")
|
||||
}
|
||||
|
||||
|
||||
+40
@@ -277,3 +277,43 @@ export type KanbanTaskEvent = Prisma.KanbanTaskEventModel
|
||||
*
|
||||
*/
|
||||
export type RecentFileItem = Prisma.RecentFileItemModel
|
||||
/**
|
||||
* Model Jwks
|
||||
*
|
||||
*/
|
||||
export type Jwks = Prisma.JwksModel
|
||||
/**
|
||||
* Model OauthClient
|
||||
*
|
||||
*/
|
||||
export type OauthClient = Prisma.OauthClientModel
|
||||
/**
|
||||
* Model OauthResource
|
||||
*
|
||||
*/
|
||||
export type OauthResource = Prisma.OauthResourceModel
|
||||
/**
|
||||
* Model OauthClientResource
|
||||
*
|
||||
*/
|
||||
export type OauthClientResource = Prisma.OauthClientResourceModel
|
||||
/**
|
||||
* Model OauthRefreshToken
|
||||
*
|
||||
*/
|
||||
export type OauthRefreshToken = Prisma.OauthRefreshTokenModel
|
||||
/**
|
||||
* Model OauthAccessToken
|
||||
*
|
||||
*/
|
||||
export type OauthAccessToken = Prisma.OauthAccessTokenModel
|
||||
/**
|
||||
* Model OauthConsent
|
||||
*
|
||||
*/
|
||||
export type OauthConsent = Prisma.OauthConsentModel
|
||||
/**
|
||||
* Model OauthClientAssertion
|
||||
*
|
||||
*/
|
||||
export type OauthClientAssertion = Prisma.OauthClientAssertionModel
|
||||
|
||||
+40
@@ -301,3 +301,43 @@ export type KanbanTaskEvent = Prisma.KanbanTaskEventModel
|
||||
*
|
||||
*/
|
||||
export type RecentFileItem = Prisma.RecentFileItemModel
|
||||
/**
|
||||
* Model Jwks
|
||||
*
|
||||
*/
|
||||
export type Jwks = Prisma.JwksModel
|
||||
/**
|
||||
* Model OauthClient
|
||||
*
|
||||
*/
|
||||
export type OauthClient = Prisma.OauthClientModel
|
||||
/**
|
||||
* Model OauthResource
|
||||
*
|
||||
*/
|
||||
export type OauthResource = Prisma.OauthResourceModel
|
||||
/**
|
||||
* Model OauthClientResource
|
||||
*
|
||||
*/
|
||||
export type OauthClientResource = Prisma.OauthClientResourceModel
|
||||
/**
|
||||
* Model OauthRefreshToken
|
||||
*
|
||||
*/
|
||||
export type OauthRefreshToken = Prisma.OauthRefreshTokenModel
|
||||
/**
|
||||
* Model OauthAccessToken
|
||||
*
|
||||
*/
|
||||
export type OauthAccessToken = Prisma.OauthAccessTokenModel
|
||||
/**
|
||||
* Model OauthConsent
|
||||
*
|
||||
*/
|
||||
export type OauthConsent = Prisma.OauthConsentModel
|
||||
/**
|
||||
* Model OauthClientAssertion
|
||||
*
|
||||
*/
|
||||
export type OauthClientAssertion = Prisma.OauthClientAssertionModel
|
||||
|
||||
+84
-4
File diff suppressed because one or more lines are too long
+765
-2
@@ -448,7 +448,15 @@ export const ModelName = {
|
||||
KanbanTaskAsset: 'KanbanTaskAsset',
|
||||
KanbanTaskComment: 'KanbanTaskComment',
|
||||
KanbanTaskEvent: 'KanbanTaskEvent',
|
||||
RecentFileItem: 'RecentFileItem'
|
||||
RecentFileItem: 'RecentFileItem',
|
||||
Jwks: 'Jwks',
|
||||
OauthClient: 'OauthClient',
|
||||
OauthResource: 'OauthResource',
|
||||
OauthClientResource: 'OauthClientResource',
|
||||
OauthRefreshToken: 'OauthRefreshToken',
|
||||
OauthAccessToken: 'OauthAccessToken',
|
||||
OauthConsent: 'OauthConsent',
|
||||
OauthClientAssertion: 'OauthClientAssertion'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -464,7 +472,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -4316,6 +4324,598 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
Jwks: {
|
||||
payload: Prisma.$JwksPayload<ExtArgs>
|
||||
fields: Prisma.JwksFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.JwksFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.JwksFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.JwksFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.JwksFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.JwksFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.JwksCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.JwksCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.JwksCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.JwksDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.JwksUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.JwksDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.JwksUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.JwksUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.JwksUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$JwksPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.JwksAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateJwks>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.JwksGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.JwksGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.JwksCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.JwksCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthClient: {
|
||||
payload: Prisma.$OauthClientPayload<ExtArgs>
|
||||
fields: Prisma.OauthClientFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthClientFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthClientFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthClientFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthClientFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthClientFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthClientCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthClientCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthClientCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthClientDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthClientUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthClientDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthClientUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthClientUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthClientUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthClientAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthClient>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthClientGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthClientCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthResource: {
|
||||
payload: Prisma.$OauthResourcePayload<ExtArgs>
|
||||
fields: Prisma.OauthResourceFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthResourceFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthResourceFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthResourceFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthResourceFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthResourceFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthResourceCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthResourceCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthResourceCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthResourceDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthResourceUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthResourceDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthResourceUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthResourceUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthResourceUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthResourcePayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthResourceAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthResource>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthResourceGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthResourceGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthResourceCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthResourceCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthClientResource: {
|
||||
payload: Prisma.$OauthClientResourcePayload<ExtArgs>
|
||||
fields: Prisma.OauthClientResourceFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthClientResourceFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthClientResourceFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthClientResourceFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthClientResourceFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthClientResourceFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthClientResourceCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthClientResourceCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthClientResourceCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthClientResourceDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthClientResourceUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthClientResourceDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthClientResourceUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthClientResourceUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthClientResourceUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientResourcePayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthClientResourceAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthClientResource>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthClientResourceGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientResourceGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthClientResourceCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientResourceCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthRefreshToken: {
|
||||
payload: Prisma.$OauthRefreshTokenPayload<ExtArgs>
|
||||
fields: Prisma.OauthRefreshTokenFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthRefreshTokenFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthRefreshTokenFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthRefreshTokenFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthRefreshTokenFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthRefreshTokenFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthRefreshTokenCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthRefreshTokenCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthRefreshTokenCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthRefreshTokenDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthRefreshTokenUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthRefreshTokenDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthRefreshTokenUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthRefreshTokenUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthRefreshTokenUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthRefreshTokenPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthRefreshTokenAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthRefreshToken>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthRefreshTokenGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthRefreshTokenGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthRefreshTokenCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthRefreshTokenCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthAccessToken: {
|
||||
payload: Prisma.$OauthAccessTokenPayload<ExtArgs>
|
||||
fields: Prisma.OauthAccessTokenFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthAccessTokenFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthAccessTokenFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthAccessTokenFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthAccessTokenFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthAccessTokenFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthAccessTokenCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthAccessTokenCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthAccessTokenCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthAccessTokenDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthAccessTokenUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthAccessTokenDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthAccessTokenUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthAccessTokenUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthAccessTokenUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthAccessTokenPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthAccessTokenAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthAccessToken>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthAccessTokenGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthAccessTokenGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthAccessTokenCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthAccessTokenCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthConsent: {
|
||||
payload: Prisma.$OauthConsentPayload<ExtArgs>
|
||||
fields: Prisma.OauthConsentFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthConsentFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthConsentFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthConsentFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthConsentFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthConsentFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthConsentCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthConsentCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthConsentCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthConsentDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthConsentUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthConsentDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthConsentUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthConsentUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthConsentUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthConsentPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthConsentAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthConsent>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthConsentGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthConsentGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthConsentCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthConsentCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
OauthClientAssertion: {
|
||||
payload: Prisma.$OauthClientAssertionPayload<ExtArgs>
|
||||
fields: Prisma.OauthClientAssertionFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.OauthClientAssertionFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.OauthClientAssertionFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.OauthClientAssertionFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.OauthClientAssertionFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.OauthClientAssertionFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.OauthClientAssertionCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.OauthClientAssertionCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.OauthClientAssertionCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.OauthClientAssertionDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.OauthClientAssertionUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.OauthClientAssertionDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.OauthClientAssertionUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.OauthClientAssertionUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.OauthClientAssertionUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$OauthClientAssertionPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.OauthClientAssertionAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateOauthClientAssertion>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.OauthClientAssertionGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientAssertionGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.OauthClientAssertionCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.OauthClientAssertionCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} & {
|
||||
other: {
|
||||
@@ -5111,6 +5711,161 @@ export const RecentFileItemScalarFieldEnum = {
|
||||
export type RecentFileItemScalarFieldEnum = (typeof RecentFileItemScalarFieldEnum)[keyof typeof RecentFileItemScalarFieldEnum]
|
||||
|
||||
|
||||
export const JwksScalarFieldEnum = {
|
||||
id: 'id',
|
||||
publicKey: 'publicKey',
|
||||
privateKey: 'privateKey',
|
||||
createdAt: 'createdAt',
|
||||
expiresAt: 'expiresAt',
|
||||
alg: 'alg',
|
||||
crv: 'crv'
|
||||
} as const
|
||||
|
||||
export type JwksScalarFieldEnum = (typeof JwksScalarFieldEnum)[keyof typeof JwksScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
clientSecret: 'clientSecret',
|
||||
clientDiscoveryId: 'clientDiscoveryId',
|
||||
disabled: 'disabled',
|
||||
skipConsent: 'skipConsent',
|
||||
enableEndSession: 'enableEndSession',
|
||||
subjectType: 'subjectType',
|
||||
scopes: 'scopes',
|
||||
clientCredentialsScopes: 'clientCredentialsScopes',
|
||||
userId: 'userId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
name: 'name',
|
||||
uri: 'uri',
|
||||
icon: 'icon',
|
||||
contacts: 'contacts',
|
||||
tos: 'tos',
|
||||
policy: 'policy',
|
||||
softwareId: 'softwareId',
|
||||
softwareVersion: 'softwareVersion',
|
||||
softwareStatement: 'softwareStatement',
|
||||
redirectUris: 'redirectUris',
|
||||
postLogoutRedirectUris: 'postLogoutRedirectUris',
|
||||
backchannelLogoutUri: 'backchannelLogoutUri',
|
||||
backchannelLogoutSessionRequired: 'backchannelLogoutSessionRequired',
|
||||
tokenEndpointAuthMethod: 'tokenEndpointAuthMethod',
|
||||
applicationType: 'applicationType',
|
||||
jwks: 'jwks',
|
||||
jwksUri: 'jwksUri',
|
||||
grantTypes: 'grantTypes',
|
||||
responseTypes: 'responseTypes',
|
||||
requirePKCE: 'requirePKCE',
|
||||
dpopBoundAccessTokens: 'dpopBoundAccessTokens',
|
||||
referenceId: 'referenceId',
|
||||
metadata: 'metadata'
|
||||
} as const
|
||||
|
||||
export type OauthClientScalarFieldEnum = (typeof OauthClientScalarFieldEnum)[keyof typeof OauthClientScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthResourceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
identifier: 'identifier',
|
||||
name: 'name',
|
||||
accessTokenTtl: 'accessTokenTtl',
|
||||
refreshTokenTtl: 'refreshTokenTtl',
|
||||
signingAlgorithm: 'signingAlgorithm',
|
||||
signingKeyId: 'signingKeyId',
|
||||
allowedScopes: 'allowedScopes',
|
||||
customClaims: 'customClaims',
|
||||
dpopBoundAccessTokensRequired: 'dpopBoundAccessTokensRequired',
|
||||
disabled: 'disabled',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
policyVersion: 'policyVersion',
|
||||
metadata: 'metadata'
|
||||
} as const
|
||||
|
||||
export type OauthResourceScalarFieldEnum = (typeof OauthResourceScalarFieldEnum)[keyof typeof OauthResourceScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientResourceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
resourceId: 'resourceId',
|
||||
metadata: 'metadata',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type OauthClientResourceScalarFieldEnum = (typeof OauthClientResourceScalarFieldEnum)[keyof typeof OauthClientResourceScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthRefreshTokenScalarFieldEnum = {
|
||||
id: 'id',
|
||||
token: 'token',
|
||||
clientId: 'clientId',
|
||||
sessionId: 'sessionId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
authorizationCodeId: 'authorizationCodeId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
revoked: 'revoked',
|
||||
rotatedAt: 'rotatedAt',
|
||||
rotationReplayResponse: 'rotationReplayResponse',
|
||||
rotationReplayExpiresAt: 'rotationReplayExpiresAt',
|
||||
authTime: 'authTime',
|
||||
confirmation: 'confirmation',
|
||||
scopes: 'scopes'
|
||||
} as const
|
||||
|
||||
export type OauthRefreshTokenScalarFieldEnum = (typeof OauthRefreshTokenScalarFieldEnum)[keyof typeof OauthRefreshTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthAccessTokenScalarFieldEnum = {
|
||||
id: 'id',
|
||||
token: 'token',
|
||||
clientId: 'clientId',
|
||||
sessionId: 'sessionId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
authorizationCodeId: 'authorizationCodeId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
refreshId: 'refreshId',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
revoked: 'revoked',
|
||||
confirmation: 'confirmation',
|
||||
scopes: 'scopes'
|
||||
} as const
|
||||
|
||||
export type OauthAccessTokenScalarFieldEnum = (typeof OauthAccessTokenScalarFieldEnum)[keyof typeof OauthAccessTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthConsentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
scopes: 'scopes',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type OauthConsentScalarFieldEnum = (typeof OauthConsentScalarFieldEnum)[keyof typeof OauthConsentScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientAssertionScalarFieldEnum = {
|
||||
id: 'id',
|
||||
expiresAt: 'expiresAt'
|
||||
} as const
|
||||
|
||||
export type OauthClientAssertionScalarFieldEnum = (typeof OauthClientAssertionScalarFieldEnum)[keyof typeof OauthClientAssertionScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
@@ -5822,6 +6577,14 @@ export type GlobalOmitConfig = {
|
||||
kanbanTaskComment?: Prisma.KanbanTaskCommentOmit
|
||||
kanbanTaskEvent?: Prisma.KanbanTaskEventOmit
|
||||
recentFileItem?: Prisma.RecentFileItemOmit
|
||||
jwks?: Prisma.JwksOmit
|
||||
oauthClient?: Prisma.OauthClientOmit
|
||||
oauthResource?: Prisma.OauthResourceOmit
|
||||
oauthClientResource?: Prisma.OauthClientResourceOmit
|
||||
oauthRefreshToken?: Prisma.OauthRefreshTokenOmit
|
||||
oauthAccessToken?: Prisma.OauthAccessTokenOmit
|
||||
oauthConsent?: Prisma.OauthConsentOmit
|
||||
oauthClientAssertion?: Prisma.OauthClientAssertionOmit
|
||||
}
|
||||
|
||||
/* Types for Logging */
|
||||
|
||||
+164
-1
@@ -102,7 +102,15 @@ export const ModelName = {
|
||||
KanbanTaskAsset: 'KanbanTaskAsset',
|
||||
KanbanTaskComment: 'KanbanTaskComment',
|
||||
KanbanTaskEvent: 'KanbanTaskEvent',
|
||||
RecentFileItem: 'RecentFileItem'
|
||||
RecentFileItem: 'RecentFileItem',
|
||||
Jwks: 'Jwks',
|
||||
OauthClient: 'OauthClient',
|
||||
OauthResource: 'OauthResource',
|
||||
OauthClientResource: 'OauthClientResource',
|
||||
OauthRefreshToken: 'OauthRefreshToken',
|
||||
OauthAccessToken: 'OauthAccessToken',
|
||||
OauthConsent: 'OauthConsent',
|
||||
OauthClientAssertion: 'OauthClientAssertion'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -877,6 +885,161 @@ export const RecentFileItemScalarFieldEnum = {
|
||||
export type RecentFileItemScalarFieldEnum = (typeof RecentFileItemScalarFieldEnum)[keyof typeof RecentFileItemScalarFieldEnum]
|
||||
|
||||
|
||||
export const JwksScalarFieldEnum = {
|
||||
id: 'id',
|
||||
publicKey: 'publicKey',
|
||||
privateKey: 'privateKey',
|
||||
createdAt: 'createdAt',
|
||||
expiresAt: 'expiresAt',
|
||||
alg: 'alg',
|
||||
crv: 'crv'
|
||||
} as const
|
||||
|
||||
export type JwksScalarFieldEnum = (typeof JwksScalarFieldEnum)[keyof typeof JwksScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
clientSecret: 'clientSecret',
|
||||
clientDiscoveryId: 'clientDiscoveryId',
|
||||
disabled: 'disabled',
|
||||
skipConsent: 'skipConsent',
|
||||
enableEndSession: 'enableEndSession',
|
||||
subjectType: 'subjectType',
|
||||
scopes: 'scopes',
|
||||
clientCredentialsScopes: 'clientCredentialsScopes',
|
||||
userId: 'userId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
name: 'name',
|
||||
uri: 'uri',
|
||||
icon: 'icon',
|
||||
contacts: 'contacts',
|
||||
tos: 'tos',
|
||||
policy: 'policy',
|
||||
softwareId: 'softwareId',
|
||||
softwareVersion: 'softwareVersion',
|
||||
softwareStatement: 'softwareStatement',
|
||||
redirectUris: 'redirectUris',
|
||||
postLogoutRedirectUris: 'postLogoutRedirectUris',
|
||||
backchannelLogoutUri: 'backchannelLogoutUri',
|
||||
backchannelLogoutSessionRequired: 'backchannelLogoutSessionRequired',
|
||||
tokenEndpointAuthMethod: 'tokenEndpointAuthMethod',
|
||||
applicationType: 'applicationType',
|
||||
jwks: 'jwks',
|
||||
jwksUri: 'jwksUri',
|
||||
grantTypes: 'grantTypes',
|
||||
responseTypes: 'responseTypes',
|
||||
requirePKCE: 'requirePKCE',
|
||||
dpopBoundAccessTokens: 'dpopBoundAccessTokens',
|
||||
referenceId: 'referenceId',
|
||||
metadata: 'metadata'
|
||||
} as const
|
||||
|
||||
export type OauthClientScalarFieldEnum = (typeof OauthClientScalarFieldEnum)[keyof typeof OauthClientScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthResourceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
identifier: 'identifier',
|
||||
name: 'name',
|
||||
accessTokenTtl: 'accessTokenTtl',
|
||||
refreshTokenTtl: 'refreshTokenTtl',
|
||||
signingAlgorithm: 'signingAlgorithm',
|
||||
signingKeyId: 'signingKeyId',
|
||||
allowedScopes: 'allowedScopes',
|
||||
customClaims: 'customClaims',
|
||||
dpopBoundAccessTokensRequired: 'dpopBoundAccessTokensRequired',
|
||||
disabled: 'disabled',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
policyVersion: 'policyVersion',
|
||||
metadata: 'metadata'
|
||||
} as const
|
||||
|
||||
export type OauthResourceScalarFieldEnum = (typeof OauthResourceScalarFieldEnum)[keyof typeof OauthResourceScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientResourceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
resourceId: 'resourceId',
|
||||
metadata: 'metadata',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type OauthClientResourceScalarFieldEnum = (typeof OauthClientResourceScalarFieldEnum)[keyof typeof OauthClientResourceScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthRefreshTokenScalarFieldEnum = {
|
||||
id: 'id',
|
||||
token: 'token',
|
||||
clientId: 'clientId',
|
||||
sessionId: 'sessionId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
authorizationCodeId: 'authorizationCodeId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
revoked: 'revoked',
|
||||
rotatedAt: 'rotatedAt',
|
||||
rotationReplayResponse: 'rotationReplayResponse',
|
||||
rotationReplayExpiresAt: 'rotationReplayExpiresAt',
|
||||
authTime: 'authTime',
|
||||
confirmation: 'confirmation',
|
||||
scopes: 'scopes'
|
||||
} as const
|
||||
|
||||
export type OauthRefreshTokenScalarFieldEnum = (typeof OauthRefreshTokenScalarFieldEnum)[keyof typeof OauthRefreshTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthAccessTokenScalarFieldEnum = {
|
||||
id: 'id',
|
||||
token: 'token',
|
||||
clientId: 'clientId',
|
||||
sessionId: 'sessionId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
authorizationCodeId: 'authorizationCodeId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
refreshId: 'refreshId',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
revoked: 'revoked',
|
||||
confirmation: 'confirmation',
|
||||
scopes: 'scopes'
|
||||
} as const
|
||||
|
||||
export type OauthAccessTokenScalarFieldEnum = (typeof OauthAccessTokenScalarFieldEnum)[keyof typeof OauthAccessTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthConsentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
clientId: 'clientId',
|
||||
userId: 'userId',
|
||||
referenceId: 'referenceId',
|
||||
resources: 'resources',
|
||||
requestedUserInfoClaims: 'requestedUserInfoClaims',
|
||||
scopes: 'scopes',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type OauthConsentScalarFieldEnum = (typeof OauthConsentScalarFieldEnum)[keyof typeof OauthConsentScalarFieldEnum]
|
||||
|
||||
|
||||
export const OauthClientAssertionScalarFieldEnum = {
|
||||
id: 'id',
|
||||
expiresAt: 'expiresAt'
|
||||
} as const
|
||||
|
||||
export type OauthClientAssertionScalarFieldEnum = (typeof OauthClientAssertionScalarFieldEnum)[keyof typeof OauthClientAssertionScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
|
||||
+8
@@ -60,4 +60,12 @@ export type * from './models/KanbanTaskAsset.ts'
|
||||
export type * from './models/KanbanTaskComment.ts'
|
||||
export type * from './models/KanbanTaskEvent.ts'
|
||||
export type * from './models/RecentFileItem.ts'
|
||||
export type * from './models/Jwks.ts'
|
||||
export type * from './models/OauthClient.ts'
|
||||
export type * from './models/OauthResource.ts'
|
||||
export type * from './models/OauthClientResource.ts'
|
||||
export type * from './models/OauthRefreshToken.ts'
|
||||
export type * from './models/OauthAccessToken.ts'
|
||||
export type * from './models/OauthConsent.ts'
|
||||
export type * from './models/OauthClientAssertion.ts'
|
||||
export type * from './commonInputTypes.ts'
|
||||
+1207
File diff suppressed because it is too large
Load Diff
+2300
File diff suppressed because it is too large
Load Diff
+3480
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1659
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1702
File diff suppressed because it is too large
Load Diff
+283
@@ -209,6 +209,8 @@ export type SessionWhereInput = {
|
||||
userAgent?: Prisma.StringNullableFilter<"Session"> | string | null
|
||||
userId?: Prisma.StringFilter<"Session"> | string
|
||||
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenListRelationFilter
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenListRelationFilter
|
||||
}
|
||||
|
||||
export type SessionOrderByWithRelationInput = {
|
||||
@@ -221,6 +223,8 @@ export type SessionOrderByWithRelationInput = {
|
||||
userAgent?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userId?: Prisma.SortOrder
|
||||
user?: Prisma.UserOrderByWithRelationInput
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenOrderByRelationAggregateInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type SessionWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -236,6 +240,8 @@ export type SessionWhereUniqueInput = Prisma.AtLeast<{
|
||||
userAgent?: Prisma.StringNullableFilter<"Session"> | string | null
|
||||
userId?: Prisma.StringFilter<"Session"> | string
|
||||
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenListRelationFilter
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenListRelationFilter
|
||||
}, "id" | "token">
|
||||
|
||||
export type SessionOrderByWithAggregationInput = {
|
||||
@@ -275,6 +281,8 @@ export type SessionCreateInput = {
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
user: Prisma.UserCreateNestedOneWithoutSessionsInput
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenCreateNestedManyWithoutSessionInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedCreateInput = {
|
||||
@@ -286,6 +294,8 @@ export type SessionUncheckedCreateInput = {
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
userId: string
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionUpdateInput = {
|
||||
@@ -297,6 +307,8 @@ export type SessionUpdateInput = {
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
user?: Prisma.UserUpdateOneRequiredWithoutSessionsNestedInput
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUpdateManyWithoutSessionNestedInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedUpdateInput = {
|
||||
@@ -308,6 +320,8 @@ export type SessionUncheckedUpdateInput = {
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionCreateManyInput = {
|
||||
@@ -385,6 +399,11 @@ export type SessionMinOrderByAggregateInput = {
|
||||
userId?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type SessionNullableScalarRelationFilter = {
|
||||
is?: Prisma.SessionWhereInput | null
|
||||
isNot?: Prisma.SessionWhereInput | null
|
||||
}
|
||||
|
||||
export type SessionCreateNestedManyWithoutUserInput = {
|
||||
create?: Prisma.XOR<Prisma.SessionCreateWithoutUserInput, Prisma.SessionUncheckedCreateWithoutUserInput> | Prisma.SessionCreateWithoutUserInput[] | Prisma.SessionUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.SessionCreateOrConnectWithoutUserInput | Prisma.SessionCreateOrConnectWithoutUserInput[]
|
||||
@@ -427,6 +446,38 @@ export type SessionUncheckedUpdateManyWithoutUserNestedInput = {
|
||||
deleteMany?: Prisma.SessionScalarWhereInput | Prisma.SessionScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type SessionCreateNestedOneWithoutOauthRefreshTokensInput = {
|
||||
create?: Prisma.XOR<Prisma.SessionCreateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedCreateWithoutOauthRefreshTokensInput>
|
||||
connectOrCreate?: Prisma.SessionCreateOrConnectWithoutOauthRefreshTokensInput
|
||||
connect?: Prisma.SessionWhereUniqueInput
|
||||
}
|
||||
|
||||
export type SessionUpdateOneWithoutOauthRefreshTokensNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.SessionCreateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedCreateWithoutOauthRefreshTokensInput>
|
||||
connectOrCreate?: Prisma.SessionCreateOrConnectWithoutOauthRefreshTokensInput
|
||||
upsert?: Prisma.SessionUpsertWithoutOauthRefreshTokensInput
|
||||
disconnect?: Prisma.SessionWhereInput | boolean
|
||||
delete?: Prisma.SessionWhereInput | boolean
|
||||
connect?: Prisma.SessionWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.SessionUpdateToOneWithWhereWithoutOauthRefreshTokensInput, Prisma.SessionUpdateWithoutOauthRefreshTokensInput>, Prisma.SessionUncheckedUpdateWithoutOauthRefreshTokensInput>
|
||||
}
|
||||
|
||||
export type SessionCreateNestedOneWithoutOauthAccessTokensInput = {
|
||||
create?: Prisma.XOR<Prisma.SessionCreateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedCreateWithoutOauthAccessTokensInput>
|
||||
connectOrCreate?: Prisma.SessionCreateOrConnectWithoutOauthAccessTokensInput
|
||||
connect?: Prisma.SessionWhereUniqueInput
|
||||
}
|
||||
|
||||
export type SessionUpdateOneWithoutOauthAccessTokensNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.SessionCreateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedCreateWithoutOauthAccessTokensInput>
|
||||
connectOrCreate?: Prisma.SessionCreateOrConnectWithoutOauthAccessTokensInput
|
||||
upsert?: Prisma.SessionUpsertWithoutOauthAccessTokensInput
|
||||
disconnect?: Prisma.SessionWhereInput | boolean
|
||||
delete?: Prisma.SessionWhereInput | boolean
|
||||
connect?: Prisma.SessionWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.SessionUpdateToOneWithWhereWithoutOauthAccessTokensInput, Prisma.SessionUpdateWithoutOauthAccessTokensInput>, Prisma.SessionUncheckedUpdateWithoutOauthAccessTokensInput>
|
||||
}
|
||||
|
||||
export type SessionCreateWithoutUserInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
@@ -435,6 +486,8 @@ export type SessionCreateWithoutUserInput = {
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenCreateNestedManyWithoutSessionInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedCreateWithoutUserInput = {
|
||||
@@ -445,6 +498,8 @@ export type SessionUncheckedCreateWithoutUserInput = {
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionCreateOrConnectWithoutUserInput = {
|
||||
@@ -487,6 +542,134 @@ export type SessionScalarWhereInput = {
|
||||
userId?: Prisma.StringFilter<"Session"> | string
|
||||
}
|
||||
|
||||
export type SessionCreateWithoutOauthRefreshTokensInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
token: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
user: Prisma.UserCreateNestedOneWithoutSessionsInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedCreateWithoutOauthRefreshTokensInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
token: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
userId: string
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionCreateOrConnectWithoutOauthRefreshTokensInput = {
|
||||
where: Prisma.SessionWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.SessionCreateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedCreateWithoutOauthRefreshTokensInput>
|
||||
}
|
||||
|
||||
export type SessionUpsertWithoutOauthRefreshTokensInput = {
|
||||
update: Prisma.XOR<Prisma.SessionUpdateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedUpdateWithoutOauthRefreshTokensInput>
|
||||
create: Prisma.XOR<Prisma.SessionCreateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedCreateWithoutOauthRefreshTokensInput>
|
||||
where?: Prisma.SessionWhereInput
|
||||
}
|
||||
|
||||
export type SessionUpdateToOneWithWhereWithoutOauthRefreshTokensInput = {
|
||||
where?: Prisma.SessionWhereInput
|
||||
data: Prisma.XOR<Prisma.SessionUpdateWithoutOauthRefreshTokensInput, Prisma.SessionUncheckedUpdateWithoutOauthRefreshTokensInput>
|
||||
}
|
||||
|
||||
export type SessionUpdateWithoutOauthRefreshTokensInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
user?: Prisma.UserUpdateOneRequiredWithoutSessionsNestedInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedUpdateWithoutOauthRefreshTokensInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionCreateWithoutOauthAccessTokensInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
token: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
user: Prisma.UserCreateNestedOneWithoutSessionsInput
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedCreateWithoutOauthAccessTokensInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
token: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
ipAddress?: string | null
|
||||
userAgent?: string | null
|
||||
userId: string
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedCreateNestedManyWithoutSessionInput
|
||||
}
|
||||
|
||||
export type SessionCreateOrConnectWithoutOauthAccessTokensInput = {
|
||||
where: Prisma.SessionWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.SessionCreateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedCreateWithoutOauthAccessTokensInput>
|
||||
}
|
||||
|
||||
export type SessionUpsertWithoutOauthAccessTokensInput = {
|
||||
update: Prisma.XOR<Prisma.SessionUpdateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedUpdateWithoutOauthAccessTokensInput>
|
||||
create: Prisma.XOR<Prisma.SessionCreateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedCreateWithoutOauthAccessTokensInput>
|
||||
where?: Prisma.SessionWhereInput
|
||||
}
|
||||
|
||||
export type SessionUpdateToOneWithWhereWithoutOauthAccessTokensInput = {
|
||||
where?: Prisma.SessionWhereInput
|
||||
data: Prisma.XOR<Prisma.SessionUpdateWithoutOauthAccessTokensInput, Prisma.SessionUncheckedUpdateWithoutOauthAccessTokensInput>
|
||||
}
|
||||
|
||||
export type SessionUpdateWithoutOauthAccessTokensInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
user?: Prisma.UserUpdateOneRequiredWithoutSessionsNestedInput
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedUpdateWithoutOauthAccessTokensInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expiresAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionCreateManyUserInput = {
|
||||
id?: string
|
||||
expiresAt: Date | string
|
||||
@@ -505,6 +688,8 @@ export type SessionUpdateWithoutUserInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUpdateManyWithoutSessionNestedInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedUpdateWithoutUserInput = {
|
||||
@@ -515,6 +700,8 @@ export type SessionUncheckedUpdateWithoutUserInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
ipAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userAgent?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
oauthRefreshTokens?: Prisma.OauthRefreshTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
oauthAccessTokens?: Prisma.OauthAccessTokenUncheckedUpdateManyWithoutSessionNestedInput
|
||||
}
|
||||
|
||||
export type SessionUncheckedUpdateManyWithoutUserInput = {
|
||||
@@ -528,6 +715,44 @@ export type SessionUncheckedUpdateManyWithoutUserInput = {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count Type SessionCountOutputType
|
||||
*/
|
||||
|
||||
export type SessionCountOutputType = {
|
||||
oauthRefreshTokens: number
|
||||
oauthAccessTokens: number
|
||||
}
|
||||
|
||||
export type SessionCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
oauthRefreshTokens?: boolean | SessionCountOutputTypeCountOauthRefreshTokensArgs
|
||||
oauthAccessTokens?: boolean | SessionCountOutputTypeCountOauthAccessTokensArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* SessionCountOutputType without action
|
||||
*/
|
||||
export type SessionCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the SessionCountOutputType
|
||||
*/
|
||||
select?: Prisma.SessionCountOutputTypeSelect<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* SessionCountOutputType without action
|
||||
*/
|
||||
export type SessionCountOutputTypeCountOauthRefreshTokensArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.OauthRefreshTokenWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* SessionCountOutputType without action
|
||||
*/
|
||||
export type SessionCountOutputTypeCountOauthAccessTokensArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.OauthAccessTokenWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type SessionSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -539,6 +764,9 @@ export type SessionSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
userAgent?: boolean
|
||||
userId?: boolean
|
||||
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
|
||||
oauthRefreshTokens?: boolean | Prisma.Session$oauthRefreshTokensArgs<ExtArgs>
|
||||
oauthAccessTokens?: boolean | Prisma.Session$oauthAccessTokensArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.SessionCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["session"]>
|
||||
|
||||
export type SessionSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
@@ -579,6 +807,9 @@ export type SessionSelectScalar = {
|
||||
export type SessionOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "expiresAt" | "token" | "createdAt" | "updatedAt" | "ipAddress" | "userAgent" | "userId", ExtArgs["result"]["session"]>
|
||||
export type SessionInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
|
||||
oauthRefreshTokens?: boolean | Prisma.Session$oauthRefreshTokensArgs<ExtArgs>
|
||||
oauthAccessTokens?: boolean | Prisma.Session$oauthAccessTokensArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.SessionCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type SessionIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
|
||||
@@ -591,6 +822,8 @@ export type $SessionPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
name: "Session"
|
||||
objects: {
|
||||
user: Prisma.$UserPayload<ExtArgs>
|
||||
oauthRefreshTokens: Prisma.$OauthRefreshTokenPayload<ExtArgs>[]
|
||||
oauthAccessTokens: Prisma.$OauthAccessTokenPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -996,6 +1229,8 @@ readonly fields: SessionFieldRefs;
|
||||
export interface Prisma__SessionClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
user<T extends Prisma.UserDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.UserDefaultArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
oauthRefreshTokens<T extends Prisma.Session$oauthRefreshTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Session$oauthRefreshTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OauthRefreshTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
oauthAccessTokens<T extends Prisma.Session$oauthAccessTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Session$oauthAccessTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OauthAccessTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1433,6 +1668,54 @@ export type SessionDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Session.oauthRefreshTokens
|
||||
*/
|
||||
export type Session$oauthRefreshTokensArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the OauthRefreshToken
|
||||
*/
|
||||
select?: Prisma.OauthRefreshTokenSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the OauthRefreshToken
|
||||
*/
|
||||
omit?: Prisma.OauthRefreshTokenOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.OauthRefreshTokenInclude<ExtArgs> | null
|
||||
where?: Prisma.OauthRefreshTokenWhereInput
|
||||
orderBy?: Prisma.OauthRefreshTokenOrderByWithRelationInput | Prisma.OauthRefreshTokenOrderByWithRelationInput[]
|
||||
cursor?: Prisma.OauthRefreshTokenWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.OauthRefreshTokenScalarFieldEnum | Prisma.OauthRefreshTokenScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Session.oauthAccessTokens
|
||||
*/
|
||||
export type Session$oauthAccessTokensArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the OauthAccessToken
|
||||
*/
|
||||
select?: Prisma.OauthAccessTokenSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the OauthAccessToken
|
||||
*/
|
||||
omit?: Prisma.OauthAccessTokenOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.OauthAccessTokenInclude<ExtArgs> | null
|
||||
where?: Prisma.OauthAccessTokenWhereInput
|
||||
orderBy?: Prisma.OauthAccessTokenOrderByWithRelationInput | Prisma.OauthAccessTokenOrderByWithRelationInput[]
|
||||
cursor?: Prisma.OauthAccessTokenWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.OauthAccessTokenScalarFieldEnum | Prisma.OauthAccessTokenScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Session without action
|
||||
*/
|
||||
|
||||
+1470
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,29 @@ const globalForPrisma = globalThis as unknown as {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let prismaTestingHelper: PrismaTestingHelper<any> | null = null
|
||||
|
||||
function sanitizeArrayFields<T>(data: T): T {
|
||||
if (data && typeof data === 'object') {
|
||||
const record = data as Record<string, unknown>
|
||||
const arrayFields = [
|
||||
'scopes',
|
||||
'allowedScopes',
|
||||
'resources',
|
||||
'requestedUserInfoClaims',
|
||||
'contacts',
|
||||
'redirectUris',
|
||||
'postLogoutRedirectUris',
|
||||
'grantTypes',
|
||||
'responseTypes',
|
||||
]
|
||||
for (const field of arrayFields) {
|
||||
if (record[field] === null) {
|
||||
record[field] = []
|
||||
}
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
function createPrismaClient() {
|
||||
const connectionString = process.env.DATABASE_URL
|
||||
const pool = new Pool({ connectionString })
|
||||
@@ -49,6 +72,80 @@ function createPrismaClient() {
|
||||
|
||||
return client.$extends({
|
||||
query: {
|
||||
oauthResource: {
|
||||
async create({ args, query }) {
|
||||
sanitizeArrayFields(args.data)
|
||||
try {
|
||||
return await query(args)
|
||||
} catch (e: unknown) {
|
||||
if (
|
||||
e &&
|
||||
typeof e === 'object' &&
|
||||
'code' in e &&
|
||||
e.code === 'P2002' &&
|
||||
args.data.identifier
|
||||
) {
|
||||
const existing = await client.oauthResource.findUnique({
|
||||
where: { identifier: args.data.identifier },
|
||||
})
|
||||
if (existing) return existing
|
||||
}
|
||||
throw e
|
||||
}
|
||||
},
|
||||
async update({ args, query }) {
|
||||
sanitizeArrayFields(args.data)
|
||||
return query(args)
|
||||
},
|
||||
async upsert({ args, query }) {
|
||||
sanitizeArrayFields(args.create)
|
||||
sanitizeArrayFields(args.update)
|
||||
return query(args)
|
||||
},
|
||||
async findUnique({ args, query }) {
|
||||
const result = await query(args)
|
||||
if (result && Array.isArray(result.allowedScopes) && result.allowedScopes.length === 0) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(result as any).allowedScopes = null
|
||||
}
|
||||
return result
|
||||
},
|
||||
async findFirst({ args, query }) {
|
||||
const result = await query(args)
|
||||
if (result && Array.isArray(result.allowedScopes) && result.allowedScopes.length === 0) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(result as any).allowedScopes = null
|
||||
}
|
||||
return result
|
||||
},
|
||||
async findMany({ args, query }) {
|
||||
const results = await query(args)
|
||||
if (Array.isArray(results)) {
|
||||
for (const r of results) {
|
||||
if (r && Array.isArray(r.allowedScopes) && r.allowedScopes.length === 0) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
;(r as any).allowedScopes = null
|
||||
}
|
||||
}
|
||||
}
|
||||
return results
|
||||
},
|
||||
},
|
||||
oauthClient: {
|
||||
async create({ args, query }) {
|
||||
sanitizeArrayFields(args.data)
|
||||
return query(args)
|
||||
},
|
||||
async update({ args, query }) {
|
||||
sanitizeArrayFields(args.data)
|
||||
return query(args)
|
||||
},
|
||||
async upsert({ args, query }) {
|
||||
sanitizeArrayFields(args.create)
|
||||
sanitizeArrayFields(args.update)
|
||||
return query(args)
|
||||
},
|
||||
},
|
||||
workflowTask: {
|
||||
async create({ args, query }) {
|
||||
const result = await query(args)
|
||||
|
||||
@@ -571,5 +571,12 @@ declare global {
|
||||
proxyType?: 'image' | 'video' | 'audio' | 'pdf' | '3d' | null
|
||||
}
|
||||
export type KanbanCommentAttachmentList = KanbanCommentAttachment[]
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Better Auth OAuth
|
||||
// ----------------------------------------------------------------------
|
||||
export type OauthMetadata = Record<string, unknown>
|
||||
export type OauthCustomClaims = Record<string, unknown>
|
||||
export type OauthConfirmation = Record<string, unknown>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { createAuthClient } from 'better-auth/react'
|
||||
import { oauthProviderClient } from '@better-auth/oauth-provider/client'
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
baseURL: window.location.origin,
|
||||
baseURL: typeof window !== 'undefined' ? window.location.origin : '',
|
||||
plugins: [oauthProviderClient()],
|
||||
})
|
||||
|
||||
export const getAuthSession = async () => authClient.getSession()
|
||||
|
||||
export const { signIn, signUp, useSession, signOut, resetPassword } = authClient
|
||||
|
||||
@@ -1593,5 +1593,16 @@
|
||||
"hide_agent": "Hide Agent",
|
||||
"hide_agent_description": "Hide the AGENTS.md button, agent-chat sidebar, and chatbot trigger button across the entire team.",
|
||||
"appearance_settings_updated": "Appearance settings updated",
|
||||
"failed_update_appearance_settings": "Failed to update appearance settings"
|
||||
"failed_update_appearance_settings": "Failed to update appearance settings",
|
||||
"authorize_application": "Authorize Application",
|
||||
"authorize_application_subtitle": "An application is requesting access to your Shumai account and tools.",
|
||||
"application_client_id": "Client ID",
|
||||
"requested_permissions": "Requested Permissions",
|
||||
"logged_in_as": "Logged in as",
|
||||
"authorize": "Authorize",
|
||||
"authorizing": "Authorizing...",
|
||||
"deny": "Deny",
|
||||
"denying": "Denying...",
|
||||
"consent_failed": "Failed to process authorization",
|
||||
"mcp_access_scope_desc": "Full user-level access to Shumai workspace and MCP tools"
|
||||
}
|
||||
|
||||
@@ -1593,5 +1593,16 @@
|
||||
"hide_agent": "隐藏 Agent",
|
||||
"hide_agent_description": "在整个团队中隐藏 AGENTS.md 按钮、Agent 聊天侧边栏和触发按钮。",
|
||||
"appearance_settings_updated": "外观设置已更新",
|
||||
"failed_update_appearance_settings": "更新外观设置失败"
|
||||
"failed_update_appearance_settings": "更新外观设置失败",
|
||||
"authorize_application": "授权应用",
|
||||
"authorize_application_subtitle": "某个应用正在请求访问您的 Shumai 账户及相关工具。",
|
||||
"application_client_id": "客户端 ID",
|
||||
"requested_permissions": "请求的权限",
|
||||
"logged_in_as": "当前登录账号",
|
||||
"authorize": "授权",
|
||||
"authorizing": "授权中...",
|
||||
"deny": "拒绝",
|
||||
"denying": "拒绝中...",
|
||||
"consent_failed": "处理授权失败",
|
||||
"mcp_access_scope_desc": "以当前用户权限完全访问 Shumai 工作空间及 MCP 工具"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"main": "./index.html",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.7.0",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@dnd-kit/abstract": "0.5.0",
|
||||
"@dnd-kit/dom": "0.5.0",
|
||||
"@dnd-kit/react": "0.5.0",
|
||||
@@ -57,7 +58,7 @@
|
||||
"@uppy/aws-s3": "6.0.0",
|
||||
"@uppy/core": "6.0.0",
|
||||
"@uppy/xhr-upload": "6.0.0",
|
||||
"better-auth": "1.6.11",
|
||||
"better-auth": "1.7.12",
|
||||
"class-variance-authority": "0.7.1",
|
||||
"clsx": "2.1.1",
|
||||
"cmdk": "1.1.1",
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as SignupRouteImport } from './routes/signup'
|
||||
import { Route as ResetPasswordRouteImport } from './routes/reset-password'
|
||||
import { Route as LoginRouteImport } from './routes/login'
|
||||
import { Route as ConsentRouteImport } from './routes/consent'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ShareShareIdRouteImport } from './routes/share/$shareId'
|
||||
import { Route as TeamsTeamIdIndexRouteImport } from './routes/teams/$teamId/index'
|
||||
@@ -48,6 +49,11 @@ const LoginRoute = LoginRouteImport.update({
|
||||
path: '/login',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ConsentRoute = ConsentRouteImport.update({
|
||||
id: '/consent',
|
||||
path: '/consent',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any).lazy(() => import('./routes/consent.lazy').then((d) => d.Route))
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
@@ -165,6 +171,7 @@ const ProjectsProjectIdFoldersFolderIdAgentsmdRoute =
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/consent': typeof ConsentRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/reset-password': typeof ResetPasswordRoute
|
||||
'/signup': typeof SignupRoute
|
||||
@@ -190,6 +197,7 @@ export interface FileRoutesByFullPath {
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/consent': typeof ConsentRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/reset-password': typeof ResetPasswordRoute
|
||||
'/signup': typeof SignupRoute
|
||||
@@ -215,6 +223,7 @@ export interface FileRoutesByTo {
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/consent': typeof ConsentRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/reset-password': typeof ResetPasswordRoute
|
||||
'/signup': typeof SignupRoute
|
||||
@@ -242,6 +251,7 @@ export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/consent'
|
||||
| '/login'
|
||||
| '/reset-password'
|
||||
| '/signup'
|
||||
@@ -267,6 +277,7 @@ export interface FileRouteTypes {
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
| '/consent'
|
||||
| '/login'
|
||||
| '/reset-password'
|
||||
| '/signup'
|
||||
@@ -291,6 +302,7 @@ export interface FileRouteTypes {
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/consent'
|
||||
| '/login'
|
||||
| '/reset-password'
|
||||
| '/signup'
|
||||
@@ -317,6 +329,7 @@ export interface FileRouteTypes {
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
ConsentRoute: typeof ConsentRoute
|
||||
LoginRoute: typeof LoginRoute
|
||||
ResetPasswordRoute: typeof ResetPasswordRoute
|
||||
SignupRoute: typeof SignupRoute
|
||||
@@ -361,6 +374,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof LoginRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/consent': {
|
||||
id: '/consent'
|
||||
path: '/consent'
|
||||
fullPath: '/consent'
|
||||
preLoaderRoute: typeof ConsentRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/': {
|
||||
id: '/'
|
||||
path: '/'
|
||||
@@ -520,6 +540,7 @@ const ShareShareIdRouteWithChildren = ShareShareIdRoute._addFileChildren(ShareSh
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
ConsentRoute: ConsentRoute,
|
||||
LoginRoute: LoginRoute,
|
||||
ResetPasswordRoute: ResetPasswordRoute,
|
||||
SignupRoute: SignupRoute,
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
import { AuthLayout } from '@/ui/components/auth-layout'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import { authClient } from '@/ui/lib/auth-client'
|
||||
import { useAuthStore } from '@/ui/stores/auth'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { createLazyFileRoute } from '@tanstack/react-router'
|
||||
import { Check, Key, Loader2, ShieldCheck, User, X } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
|
||||
export const Route = createLazyFileRoute('/consent')({
|
||||
component: ConsentPage,
|
||||
})
|
||||
|
||||
function ConsentPage() {
|
||||
const search = Route.useSearch()
|
||||
const rawUser = useAuthStore((state) => state.user)
|
||||
const user =
|
||||
rawUser && typeof rawUser === 'object' ? (rawUser as { email?: string; name?: string }) : null
|
||||
const [loading, setLoading] = useState<'accept' | 'deny' | null>(null)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const clientId = search.client_id || 'MCP Client'
|
||||
const scopes = search.scope ? search.scope.split(' ') : ['mcp']
|
||||
|
||||
const handleConsent = async (accept: boolean) => {
|
||||
setLoading(accept ? 'accept' : 'deny')
|
||||
setError(null)
|
||||
try {
|
||||
const res = await authClient.oauth2.consent({
|
||||
accept,
|
||||
})
|
||||
|
||||
if (res.data?.url) {
|
||||
window.location.href = res.data.url
|
||||
} else if (res.error) {
|
||||
setError(res.error.message || m.consent_failed())
|
||||
setLoading(null)
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : m.consent_failed())
|
||||
setLoading(null)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-2 mb-2 text-primary">
|
||||
<ShieldCheck className="w-6 h-6" />
|
||||
<h1 className="text-2xl font-bold tracking-tight text-foreground">
|
||||
{m.authorize_application()}
|
||||
</h1>
|
||||
</div>
|
||||
<p className="text-muted-foreground text-sm">{m.authorize_application_subtitle()}</p>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="mb-6 p-3 bg-destructive/10 border border-destructive/20 text-destructive rounded-xl text-sm text-center font-medium">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-4 rounded-xl border border-border bg-card p-4 mb-6 shadow-xs">
|
||||
<div className="flex items-center justify-between text-sm pb-3 border-b border-border">
|
||||
<span className="text-muted-foreground flex items-center gap-1.5">
|
||||
<Key className="w-4 h-4" />
|
||||
{m.application_client_id()}
|
||||
</span>
|
||||
<span className="font-mono font-medium text-foreground text-xs bg-muted px-2 py-0.5 rounded">
|
||||
{clientId}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{user && (
|
||||
<div className="flex items-center justify-between text-sm pb-3 border-b border-border">
|
||||
<span className="text-muted-foreground flex items-center gap-1.5">
|
||||
<User className="w-4 h-4" />
|
||||
{m.logged_in_as()}
|
||||
</span>
|
||||
<span className="font-medium text-foreground text-xs">{user.email || user.name}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="pt-1">
|
||||
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground block mb-2">
|
||||
{m.requested_permissions()}
|
||||
</span>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-start gap-2 text-sm bg-muted/50 p-2.5 rounded-lg border border-border/50">
|
||||
<Check className="w-4 h-4 text-emerald-500 mt-0.5 shrink-0" />
|
||||
<div>
|
||||
<p className="font-medium text-foreground text-xs">{m.mcp_access_scope_desc()}</p>
|
||||
<div className="flex flex-wrap gap-1 mt-1">
|
||||
{scopes.map((s) => (
|
||||
<span
|
||||
key={s}
|
||||
className="font-mono text-[10px] text-muted-foreground bg-background px-1.5 py-0.5 rounded border border-border"
|
||||
>
|
||||
{s}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-3">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="flex-1 h-11 rounded-xl cursor-pointer"
|
||||
disabled={loading !== null}
|
||||
onClick={() => handleConsent(false)}
|
||||
>
|
||||
{loading === 'deny' ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 animate-spin mr-2" />
|
||||
{m.denying()}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<X className="w-4 h-4 mr-1.5" />
|
||||
{m.deny()}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
className="flex-1 h-11 bg-primary text-primary-foreground font-semibold rounded-xl shadow-xs cursor-pointer"
|
||||
disabled={loading !== null}
|
||||
onClick={() => handleConsent(true)}
|
||||
>
|
||||
{loading === 'accept' ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 animate-spin mr-2" />
|
||||
{m.authorizing()}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Check className="w-4 h-4 mr-1.5" />
|
||||
{m.authorize()}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
||||
import * as authClientModule from '@/ui/lib/auth-client'
|
||||
import { useAuthStore } from '@/ui/stores/auth'
|
||||
import { Route } from './consent'
|
||||
|
||||
describe('Consent Route beforeLoad guard', () => {
|
||||
beforeEach(() => {
|
||||
useAuthStore.getState().clearAuth()
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('redirects to /login when user is not authenticated in store or server session', async () => {
|
||||
vi.spyOn(authClientModule, 'getAuthSession').mockResolvedValue({
|
||||
data: null,
|
||||
error: null,
|
||||
} as unknown as Awaited<ReturnType<typeof authClientModule.getAuthSession>>)
|
||||
const beforeLoad = Route.options.beforeLoad
|
||||
expect(beforeLoad).toBeDefined()
|
||||
await expect(
|
||||
beforeLoad!({
|
||||
search: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_id: 'client-1',
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TanStack router internal BeforeLoadContextOptions in test
|
||||
} as any),
|
||||
).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('populates user in auth store and allows access when server session exists', async () => {
|
||||
vi.spyOn(authClientModule, 'getAuthSession').mockResolvedValue({
|
||||
data: {
|
||||
user: { id: 'user-oauth', email: 'oauth@example.com' },
|
||||
session: { id: 'session-1' },
|
||||
},
|
||||
error: null,
|
||||
} as unknown as Awaited<ReturnType<typeof authClientModule.getAuthSession>>)
|
||||
|
||||
const beforeLoad = Route.options.beforeLoad
|
||||
expect(beforeLoad).toBeDefined()
|
||||
await expect(
|
||||
beforeLoad!({
|
||||
search: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_id: 'client-1',
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TanStack router internal BeforeLoadContextOptions in test
|
||||
} as any),
|
||||
).resolves.not.toThrow()
|
||||
|
||||
expect(useAuthStore.getState().user).toEqual({ id: 'user-oauth', email: 'oauth@example.com' })
|
||||
})
|
||||
|
||||
it('allows access when user is already authenticated in store without calling getSession', async () => {
|
||||
useAuthStore.getState().setUser({ id: 'user-1', email: 'test@example.com' })
|
||||
const getSessionSpy = vi.spyOn(authClientModule, 'getAuthSession')
|
||||
|
||||
const beforeLoad = Route.options.beforeLoad
|
||||
expect(beforeLoad).toBeDefined()
|
||||
await expect(
|
||||
beforeLoad!({
|
||||
search: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_id: 'client-1',
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TanStack router internal BeforeLoadContextOptions in test
|
||||
} as any),
|
||||
).resolves.not.toThrow()
|
||||
|
||||
expect(getSessionSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,38 @@
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router'
|
||||
import { getAuthSession } from '@/ui/lib/auth-client'
|
||||
import { useAuthStore } from '@/ui/stores/auth'
|
||||
import { z } from 'zod'
|
||||
|
||||
const searchSchema = z
|
||||
.object({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
client_id: z.string().optional().catch(''),
|
||||
scope: z.string().optional().catch(''),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
redirect_uri: z.string().optional().catch(''),
|
||||
})
|
||||
.passthrough()
|
||||
|
||||
export const Route = createFileRoute('/consent')({
|
||||
validateSearch: (search) => searchSchema.parse(search),
|
||||
beforeLoad: async () => {
|
||||
let currentUser = useAuthStore.getState().user
|
||||
if (!currentUser) {
|
||||
try {
|
||||
const sessionData = await getAuthSession()
|
||||
if (sessionData?.data?.user) {
|
||||
useAuthStore.getState().setUser(sessionData.data.user)
|
||||
currentUser = sessionData.data.user
|
||||
}
|
||||
} catch {
|
||||
// Fall through to redirect
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentUser) {
|
||||
throw redirect({
|
||||
to: '/login',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@/ui/components/ui/button'
|
||||
import { ShumaiLogo } from '@/ui/components/ui/icons'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { Label } from '@/ui/components/ui/label'
|
||||
import { signIn } from '@/ui/lib/auth-client'
|
||||
import { getAuthSession, signIn } from '@/ui/lib/auth-client'
|
||||
import { useAuthStore } from '@/ui/stores/auth'
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
@@ -44,6 +44,16 @@ function LoginPage() {
|
||||
}
|
||||
}, [signupInfo, navigate])
|
||||
|
||||
useEffect(() => {
|
||||
const user = useAuthStore.getState().user
|
||||
if (user && typeof window !== 'undefined') {
|
||||
const searchParams = new URLSearchParams(window.location.search)
|
||||
if (searchParams.has('client_id')) {
|
||||
window.location.href = `/api/auth/oauth2/authorize?${searchParams.toString()}`
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
const isDemoEnv = signupInfo?.demoMode === true
|
||||
|
||||
const form = useForm<LoginSchema>({
|
||||
@@ -65,7 +75,23 @@ function LoginPage() {
|
||||
}
|
||||
|
||||
if (session) {
|
||||
setUser(session.user)
|
||||
const redirectUrl = (session as { url?: string }).url
|
||||
if (redirectUrl) {
|
||||
try {
|
||||
const sessionData = await getAuthSession()
|
||||
if (sessionData?.data?.user) {
|
||||
setUser(sessionData.data.user)
|
||||
}
|
||||
} catch {
|
||||
// Ignore and continue redirect
|
||||
}
|
||||
window.location.href = redirectUrl
|
||||
return
|
||||
}
|
||||
|
||||
if ('user' in session && session.user) {
|
||||
setUser(session.user)
|
||||
}
|
||||
navigate({ to: '/' })
|
||||
}
|
||||
}
|
||||
@@ -89,7 +115,23 @@ function LoginPage() {
|
||||
}
|
||||
|
||||
if (session) {
|
||||
setUser(session.user)
|
||||
const redirectUrl = (session as { url?: string }).url
|
||||
if (redirectUrl) {
|
||||
try {
|
||||
const sessionData = await getAuthSession()
|
||||
if (sessionData?.data?.user) {
|
||||
setUser(sessionData.data.user)
|
||||
}
|
||||
} catch {
|
||||
// Ignore and continue redirect
|
||||
}
|
||||
window.location.href = redirectUrl
|
||||
return
|
||||
}
|
||||
|
||||
if ('user' in session && session.user) {
|
||||
setUser(session.user)
|
||||
}
|
||||
navigate({ to: '/' })
|
||||
}
|
||||
}
|
||||
@@ -245,6 +287,12 @@ function LoginPage() {
|
||||
export const Route = createFileRoute('/login')({
|
||||
component: LoginPage,
|
||||
beforeLoad: () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
const searchParams = new URLSearchParams(window.location.search)
|
||||
if (searchParams.has('client_id')) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (useAuthStore.getState().user) {
|
||||
throw redirect({
|
||||
to: '/',
|
||||
|
||||
Reference in New Issue
Block a user