mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 10:55:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c0fd29b7f | ||
|
|
ffef67be8f | ||
|
|
4d100bf542 | ||
|
|
8a75d015a1 | ||
|
|
f806272c06 | ||
|
|
4935eeff28 | ||
|
|
eed0264b9c | ||
|
|
dd82daf65c | ||
|
|
55d9596835 | ||
|
|
cb1c1c502b | ||
|
|
6d4f62d6f6 | ||
|
|
43808216e6 | ||
|
|
f66bb7af73 | ||
|
|
ae86d56a7d | ||
|
|
1cee103b1c | ||
|
|
3c3b6880e4 |
@@ -37,6 +37,7 @@ But Shumai goes beyond being a Frame.io alternative. With modern models like GPT
|
|||||||
* **Isolated Sandbox Execution**: Run agent-submitted scripts safely in a sandboxed environment.
|
* **Isolated Sandbox Execution**: Run agent-submitted scripts safely in a sandboxed environment.
|
||||||
* **AI Metadata Autofill**: Automatically fill in custom metadata for new assets.
|
* **AI Metadata Autofill**: Automatically fill in custom metadata for new assets.
|
||||||
* **Semantic Search**: Find assets by visual or conceptual meaning using vector embeddings (Gemini Embedding 2).
|
* **Semantic Search**: Find assets by visual or conceptual meaning using vector embeddings (Gemini Embedding 2).
|
||||||
|
* **Resource Quotas**: Set usage limits on AI tokens, costs, and tool execution per member, role, or team-wide, with real-time tracking.
|
||||||
|
|
||||||
Here is a short demo video showing what the Shumai agent can do:
|
Here is a short demo video showing what the Shumai agent can do:
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ Shumai 是一个开源的 Frame.io 替代方案,专为创意团队打造,让
|
|||||||
* **沙箱隔离执行**:Agent 生成的脚本会在隔离环境里运行,更安全。
|
* **沙箱隔离执行**:Agent 生成的脚本会在隔离环境里运行,更安全。
|
||||||
* **AI 自动补全元数据**:新素材上传后,系统可以自动帮你补一些元数据。
|
* **AI 自动补全元数据**:新素材上传后,系统可以自动帮你补一些元数据。
|
||||||
* **语义搜索**:支持按画面内容或语义找素材,底层用的是向量 embedding(Gemini Embedding 2)。
|
* **语义搜索**:支持按画面内容或语义找素材,底层用的是向量 embedding(Gemini Embedding 2)。
|
||||||
|
* **资源配额**:支持按成员、角色或全团队对 AI Token、成本和工具调用设置使用上限与实时用量监控。
|
||||||
|
|
||||||
下面是一个简短的 demo 视频,展示了 Shumai Agent 能做什么:
|
下面是一个简短的 demo 视频,展示了 Shumai Agent 能做什么:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/agent-app",
|
"name": "@shumai/agent-app",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/cli",
|
"name": "@shumai/cli",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/transcode-app",
|
"name": "@shumai/transcode-app",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ apps/web/e2e/
|
|||||||
| Owner invites a member via invite link and the invitee joins | `tests/team/invite-member.spec.ts` |
|
| Owner invites a member via invite link and the invitee joins | `tests/team/invite-member.spec.ts` |
|
||||||
| Owner removes a member via the members dialog; the membership is deleted from the DB | `tests/team/remove-member.spec.ts` |
|
| Owner removes a member via the members dialog; the membership is deleted from the DB | `tests/team/remove-member.spec.ts` |
|
||||||
| Owner changes a team member role in the members dialog and permissions update | `tests/team/change-member-role.spec.ts` |
|
| Owner changes a team member role in the members dialog and permissions update | `tests/team/change-member-role.spec.ts` |
|
||||||
|
| Owner manages resource quotas in settings and resets usage from the dashboard | `tests/team/quotas-settings.spec.ts` |
|
||||||
|
|
||||||
### project
|
### project
|
||||||
| Test | File |
|
| Test | File |
|
||||||
@@ -80,6 +81,10 @@ apps/web/e2e/
|
|||||||
| Owner drags a file into a folder and a folder into another folder | `tests/project/move-folder-file.spec.ts` |
|
| Owner drags a file into a folder and a folder into another folder | `tests/project/move-folder-file.spec.ts` |
|
||||||
| Owner drags a file onto a file to create a version stack | `tests/project/version-stack-create.spec.ts` |
|
| Owner drags a file onto a file to create a version stack | `tests/project/version-stack-create.spec.ts` |
|
||||||
| Owner drags a file onto a version stack to add a new version | `tests/project/version-stack-add-version.spec.ts` |
|
| Owner drags a file onto a version stack to add a new version | `tests/project/version-stack-add-version.spec.ts` |
|
||||||
|
| Owner manages version stack: removes version from 3-version stack | `tests/project/version-stack-manage.spec.ts` |
|
||||||
|
| Owner removes version from 2-version stack which dissolves into standalone files | `tests/project/version-stack-manage.spec.ts` |
|
||||||
|
| Dissolving a shared version stack renders the remaining standalone file name on the share page | `tests/project/version-stack-manage.spec.ts` |
|
||||||
|
| Moving a shared file into a shared version stack leaves only 1 stack card on the share page | `tests/project/version-stack-manage.spec.ts` |
|
||||||
| Owner searches the file list by an English name keyword | `tests/project/search-file-list.spec.ts` |
|
| Owner searches the file list by an English name keyword | `tests/project/search-file-list.spec.ts` |
|
||||||
| Owner searches the file list by Chinese, Japanese, and Korean name keywords | `tests/project/search-file-list.spec.ts` |
|
| Owner searches the file list by Chinese, Japanese, and Korean name keywords | `tests/project/search-file-list.spec.ts` |
|
||||||
| Owner searches the file list with a keyword and a filter condition | `tests/project/search-file-list.spec.ts` |
|
| Owner searches the file list with a keyword and a filter condition | `tests/project/search-file-list.spec.ts` |
|
||||||
|
|||||||
+16
-11
@@ -21,19 +21,23 @@ const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
|||||||
const envPath = path.resolve(currentDir, '.env.e2e')
|
const envPath = path.resolve(currentDir, '.env.e2e')
|
||||||
const fixturesDir = path.resolve(currentDir, '../../../packages/e2e/fixtures')
|
const fixturesDir = path.resolve(currentDir, '../../../packages/e2e/fixtures')
|
||||||
|
|
||||||
// Load E2E environment variables if present
|
function loadEnv() {
|
||||||
if (fs.existsSync(envPath)) {
|
if (fs.existsSync(envPath)) {
|
||||||
const content = fs.readFileSync(envPath, 'utf8')
|
const content = fs.readFileSync(envPath, 'utf8')
|
||||||
content.split('\n').forEach((line) => {
|
content.split('\n').forEach((line) => {
|
||||||
const parts = line.split('=')
|
const parts = line.split('=')
|
||||||
if (parts.length >= 2) {
|
if (parts.length >= 2) {
|
||||||
const key = parts[0].trim()
|
const key = parts[0].trim()
|
||||||
const value = parts.slice(1).join('=').trim()
|
const value = parts.slice(1).join('=').trim()
|
||||||
process.env[key] = value
|
process.env[key] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load E2E environment variables if present
|
||||||
|
loadEnv()
|
||||||
|
|
||||||
export interface OwnerFixture {
|
export interface OwnerFixture {
|
||||||
/** Page opened in a browser context logged in as the team owner. */
|
/** Page opened in a browser context logged in as the team owner. */
|
||||||
page: Page
|
page: Page
|
||||||
@@ -104,6 +108,7 @@ export const test = base.extend<{
|
|||||||
prisma: [
|
prisma: [
|
||||||
// eslint-disable-next-line no-empty-pattern
|
// eslint-disable-next-line no-empty-pattern
|
||||||
async ({}, use) => {
|
async ({}, use) => {
|
||||||
|
loadEnv()
|
||||||
const connectionString = process.env.DATABASE_URL
|
const connectionString = process.env.DATABASE_URL
|
||||||
const pool = new Pool({ connectionString })
|
const pool = new Pool({ connectionString })
|
||||||
const adapter = new PrismaPg(pool)
|
const adapter = new PrismaPg(pool)
|
||||||
|
|||||||
@@ -0,0 +1,233 @@
|
|||||||
|
import { expect, test } from '../../fixtures'
|
||||||
|
import { seedFile } from '../../helpers/assets'
|
||||||
|
import { dragCard } from '../../helpers/dnd'
|
||||||
|
import { apiAddAssetsToShare, apiCreateShare, fileCard } from '../../helpers/files'
|
||||||
|
|
||||||
|
test('owner manages versions: removes a version from a 3-version stack', async ({
|
||||||
|
project,
|
||||||
|
prisma,
|
||||||
|
}) => {
|
||||||
|
const { page, projectId, rootFolderId } = project
|
||||||
|
|
||||||
|
const fileA = await seedFile(prisma, projectId, rootFolderId, `e2e-mng-a-${Date.now()}`)
|
||||||
|
const fileB = await seedFile(prisma, projectId, rootFolderId, `e2e-mng-b-${Date.now()}`)
|
||||||
|
const fileC = await seedFile(prisma, projectId, rootFolderId, `e2e-mng-c-${Date.now()}`)
|
||||||
|
|
||||||
|
await page.goto(`/projects/${projectId}`)
|
||||||
|
await expect(fileCard(page, fileA.name)).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileB.name)).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileC.name)).toBeVisible()
|
||||||
|
|
||||||
|
// 1. Create a 3-version stack: B on A -> stack (v2), then C on stack -> stack (v3)
|
||||||
|
await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name))
|
||||||
|
await expect(page.getByText('v2', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
await dragCard(page, fileCard(page, fileC.name), fileCard(page, fileB.name))
|
||||||
|
await expect(page.getByText('v3', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
const stack = await prisma.asset.findFirstOrThrow({
|
||||||
|
where: { projectId, parentId: rootFolderId, type: 'version_stack' },
|
||||||
|
})
|
||||||
|
expect(stack.fileCount).toBe(3)
|
||||||
|
|
||||||
|
// 2. Navigate to file viewer for the stack
|
||||||
|
await page.goto(`/projects/${projectId}/files/${stack.id}`)
|
||||||
|
|
||||||
|
// 3. Open breadcrumb menu and click "Manage versions..."
|
||||||
|
// Click on the asset name / badge dropdown trigger
|
||||||
|
await page.getByRole('button', { name: new RegExp(fileC.name) }).click()
|
||||||
|
// Hover or click on Versions sub-menu trigger
|
||||||
|
await page.getByRole('menuitem', { name: 'Versions', exact: true }).hover()
|
||||||
|
// Click "Manage versions..."
|
||||||
|
await page.getByRole('button', { name: /manage versions$/i }).click()
|
||||||
|
|
||||||
|
// 4. Verify Manage versions dialog is visible with all 3 versions
|
||||||
|
const dialog = page.getByRole('dialog')
|
||||||
|
await expect(dialog).toBeVisible()
|
||||||
|
await expect(dialog.getByText('Manage versions')).toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileA.name)).toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileB.name)).toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileC.name)).toBeVisible()
|
||||||
|
|
||||||
|
// 5. Remove fileB from stack: hover its row and click Remove from stack
|
||||||
|
const rowB = dialog.locator('div.group', { hasText: fileB.name })
|
||||||
|
await rowB.hover()
|
||||||
|
const moreButton = rowB.getByRole('button', { name: 'More options' })
|
||||||
|
await moreButton.click()
|
||||||
|
await page.getByRole('menuitem', { name: /remove from stack/i }).click()
|
||||||
|
|
||||||
|
// 6. Verify toast and that fileB is removed from dialog
|
||||||
|
await expect(page.getByText(/version removed from stack/i)).toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileB.name)).not.toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileA.name)).toBeVisible()
|
||||||
|
await expect(dialog.getByText(fileC.name)).toBeVisible()
|
||||||
|
|
||||||
|
// DB: stack now has 2 versions (fileA and fileC), and fileB is standalone in root folder
|
||||||
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
const s = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||||
|
return s?.fileCount
|
||||||
|
})
|
||||||
|
.toBe(2)
|
||||||
|
|
||||||
|
const updatedFileB = await prisma.asset.findUnique({ where: { id: fileB.id } })
|
||||||
|
expect(updatedFileB?.parentId).toBe(rootFolderId)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('owner removes version from 2-version stack dissolving the stack into standalone files', async ({
|
||||||
|
project,
|
||||||
|
prisma,
|
||||||
|
}) => {
|
||||||
|
const { page, projectId, rootFolderId } = project
|
||||||
|
|
||||||
|
const fileA = await seedFile(prisma, projectId, rootFolderId, `e2e-dis-a-${Date.now()}`)
|
||||||
|
const fileB = await seedFile(prisma, projectId, rootFolderId, `e2e-dis-b-${Date.now()}`)
|
||||||
|
|
||||||
|
await page.goto(`/projects/${projectId}`)
|
||||||
|
await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name))
|
||||||
|
await expect(page.getByText('v2', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
const stack = await prisma.asset.findFirstOrThrow({
|
||||||
|
where: { projectId, parentId: rootFolderId, type: 'version_stack' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Open file view
|
||||||
|
await page.goto(`/projects/${projectId}/files/${stack.id}`)
|
||||||
|
|
||||||
|
// Open breadcrumb menu and click "Manage versions..."
|
||||||
|
await page.getByRole('button', { name: new RegExp(fileB.name) }).click()
|
||||||
|
await page.getByRole('menuitem', { name: 'Versions', exact: true }).hover()
|
||||||
|
await page.getByRole('button', { name: /manage versions$/i }).click()
|
||||||
|
|
||||||
|
const dialog = page.getByRole('dialog')
|
||||||
|
await expect(dialog).toBeVisible()
|
||||||
|
|
||||||
|
// Remove fileB -> stack dissolves -> only fileA remains
|
||||||
|
const rowB = dialog.locator('div.group', { hasText: fileB.name })
|
||||||
|
await rowB.hover()
|
||||||
|
const moreButton = rowB.getByRole('button', { name: 'More options' })
|
||||||
|
await moreButton.click()
|
||||||
|
await page.getByRole('menuitem', { name: /remove from stack/i }).click()
|
||||||
|
|
||||||
|
// Dialog should close automatically when stack dissolves
|
||||||
|
await expect(dialog).not.toBeVisible()
|
||||||
|
|
||||||
|
// DB: stack asset is deleted
|
||||||
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
const s = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||||
|
return s === null
|
||||||
|
})
|
||||||
|
.toBe(true)
|
||||||
|
|
||||||
|
// Both fileA and fileB are now standalone files in rootFolder
|
||||||
|
const updatedFileA = await prisma.asset.findUnique({ where: { id: fileA.id } })
|
||||||
|
const updatedFileB = await prisma.asset.findUnique({ where: { id: fileB.id } })
|
||||||
|
expect(updatedFileA?.parentId).toBe(rootFolderId)
|
||||||
|
expect(updatedFileB?.parentId).toBe(rootFolderId)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('dissolving a shared version stack renders the remaining standalone file name on the share page', async ({
|
||||||
|
project,
|
||||||
|
prisma,
|
||||||
|
}) => {
|
||||||
|
const { page, projectId, rootFolderId } = project
|
||||||
|
|
||||||
|
const fileA = await seedFile(prisma, projectId, rootFolderId, `e2e-shd-a-${Date.now()}`)
|
||||||
|
const fileB = await seedFile(prisma, projectId, rootFolderId, `e2e-shd-b-${Date.now()}`)
|
||||||
|
|
||||||
|
await page.goto(`/projects/${projectId}`)
|
||||||
|
await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name))
|
||||||
|
await expect(page.getByText('v2', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
const stack = await prisma.asset.findFirstOrThrow({
|
||||||
|
where: { projectId, parentId: rootFolderId, type: 'version_stack' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Share the version stack
|
||||||
|
await fileCard(page, fileB.name).click({ button: 'right' })
|
||||||
|
await page.getByRole('menuitem', { name: 'Create Share Link' }).click()
|
||||||
|
const toast = page.locator('[data-sonner-toast]').filter({ hasText: 'Share link created' })
|
||||||
|
await expect(toast).toBeVisible()
|
||||||
|
|
||||||
|
const share = await prisma.shareLink.findFirstOrThrow({
|
||||||
|
where: { projectId },
|
||||||
|
orderBy: { createdAt: 'desc' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Open file viewer for the stack
|
||||||
|
await page.goto(`/projects/${projectId}/files/${stack.id}`)
|
||||||
|
|
||||||
|
// Open breadcrumb menu and click "Manage versions"
|
||||||
|
await page.getByRole('button', { name: new RegExp(fileB.name) }).click()
|
||||||
|
await page.getByRole('menuitem', { name: 'Versions', exact: true }).hover()
|
||||||
|
await page.getByRole('button', { name: /manage versions$/i }).click()
|
||||||
|
|
||||||
|
const dialog = page.getByRole('dialog')
|
||||||
|
await expect(dialog).toBeVisible()
|
||||||
|
|
||||||
|
// Remove fileB -> stack dissolves -> only fileA remains
|
||||||
|
const rowB = dialog.locator('div.group', { hasText: fileB.name })
|
||||||
|
await rowB.hover()
|
||||||
|
const moreButton = rowB.getByRole('button', { name: 'More options' })
|
||||||
|
await moreButton.click()
|
||||||
|
await page.getByRole('menuitem', { name: /remove from stack/i }).click()
|
||||||
|
|
||||||
|
await expect(dialog).not.toBeVisible()
|
||||||
|
|
||||||
|
// Navigate to public share page: verify fileA is displayed with its non-empty name
|
||||||
|
await page.goto(`/share/${share.id}`)
|
||||||
|
await expect(fileCard(page, fileA.name)).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileB.name)).not.toBeVisible()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('moving a shared file into a shared version stack leaves only 1 stack card on the share page', async ({
|
||||||
|
project,
|
||||||
|
prisma,
|
||||||
|
}) => {
|
||||||
|
const { page, projectId, rootFolderId } = project
|
||||||
|
|
||||||
|
const fileA = await seedFile(prisma, projectId, rootFolderId, `e2e-mvsh-a-${Date.now()}`)
|
||||||
|
const fileB = await seedFile(prisma, projectId, rootFolderId, `e2e-mvsh-b-${Date.now()}`)
|
||||||
|
const fileC = await seedFile(prisma, projectId, rootFolderId, `e2e-mvsh-c-${Date.now()}`)
|
||||||
|
|
||||||
|
await page.goto(`/projects/${projectId}`)
|
||||||
|
|
||||||
|
// 1. Create a version stack from file B and file A (stack has v2, displays file B)
|
||||||
|
await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name))
|
||||||
|
await expect(page.getByText('v2', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
const stack = await prisma.asset.findFirstOrThrow({
|
||||||
|
where: { projectId, parentId: rootFolderId, type: 'version_stack' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// 2. Create a share link and add both stack AB and file C to it
|
||||||
|
const share = await apiCreateShare(project.context.request, projectId, `Test Share ${Date.now()}`)
|
||||||
|
await apiAddAssetsToShare(project.context.request, share.id, [stack.id, fileC.id])
|
||||||
|
|
||||||
|
// Verify initial share page has both stack and file C
|
||||||
|
await page.goto(`/share/${share.id}`)
|
||||||
|
await expect(fileCard(page, fileB.name)).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileC.name)).toBeVisible()
|
||||||
|
|
||||||
|
// 3. In project page, drop file C onto stack card (displays file B)
|
||||||
|
await page.goto(`/projects/${projectId}`)
|
||||||
|
await dragCard(page, fileCard(page, fileC.name), fileCard(page, fileB.name))
|
||||||
|
await expect(page.getByText('v3', { exact: true })).toBeVisible()
|
||||||
|
|
||||||
|
// 4. Return to public share page: now only 1 card exists (the stack showing file C with v3)
|
||||||
|
await page.goto(`/share/${share.id}`)
|
||||||
|
await expect(page.getByText('v3', { exact: true })).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileC.name)).toBeVisible()
|
||||||
|
await expect(fileCard(page, fileB.name)).not.toBeVisible()
|
||||||
|
|
||||||
|
// DB: share rootFolder fileCount is 1 and exactly 1 symlink exists
|
||||||
|
const symlinks = await prisma.asset.findMany({
|
||||||
|
where: { parentId: share.rootFolderId, type: 'symlink' },
|
||||||
|
})
|
||||||
|
expect(symlinks).toHaveLength(1)
|
||||||
|
expect(symlinks[0].targetId).toBe(stack.id)
|
||||||
|
|
||||||
|
const updatedShareRoot = await prisma.asset.findUnique({ where: { id: share.rootFolderId } })
|
||||||
|
expect(updatedShareRoot?.fileCount).toBe(1)
|
||||||
|
})
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
import { expect, test } from '../../fixtures'
|
||||||
|
|
||||||
|
test('owner manages resource quotas in settings and resets usage from the dashboard', async ({
|
||||||
|
owner,
|
||||||
|
prisma,
|
||||||
|
}) => {
|
||||||
|
const { page, teamId, email } = owner
|
||||||
|
|
||||||
|
// 1. Navigate to team settings
|
||||||
|
await page.goto(`/teams/${teamId}/settings`)
|
||||||
|
|
||||||
|
// 2. Click the Quotas sidebar tab
|
||||||
|
await page.getByRole('button', { name: /Quotas|配额/i }).click()
|
||||||
|
|
||||||
|
// 3. Verify Quotas settings card is displayed with empty state
|
||||||
|
await expect(page.getByRole('heading', { name: /^(Resource Quotas|资源配额)$/i })).toBeVisible()
|
||||||
|
await expect(page.getByText(/No resource quotas configured|暂未配置资源配额/i)).toBeVisible()
|
||||||
|
|
||||||
|
// 4. Open Create Quota Dialog
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: /Add Quota|添加配额/i })
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
await expect(page.getByText(/Create Quota Rule|创建配额规则/i)).toBeVisible()
|
||||||
|
|
||||||
|
// 5. Fill and submit new quota rule
|
||||||
|
await page.fill('#quota-limit', '50000')
|
||||||
|
await page.getByRole('button', { name: /^(Create|创建)$/i }).click()
|
||||||
|
|
||||||
|
// 6. Verify quota rule card appears in the list
|
||||||
|
await expect(page.getByText(/50,000 tokens|50000 tokens/i)).toBeVisible()
|
||||||
|
await expect(page.getByText(/Each Member|每个成员/i)).toBeVisible()
|
||||||
|
|
||||||
|
// Verify in database
|
||||||
|
const createdRule = await prisma.quotaRule.findFirst({
|
||||||
|
where: { teamId, limit: 50000 },
|
||||||
|
})
|
||||||
|
expect(createdRule).not.toBeNull()
|
||||||
|
expect(createdRule?.enabled).toBe(true)
|
||||||
|
|
||||||
|
// 7. Usage is now monitored from the dashboard, not the settings rule card.
|
||||||
|
await expect(page.getByRole('button', { name: /View Usage|查看使用量/i })).not.toBeVisible()
|
||||||
|
|
||||||
|
// 8. Toggle quota rule switch
|
||||||
|
await page.getByRole('switch').click()
|
||||||
|
await expect(page.getByRole('switch')).not.toBeChecked()
|
||||||
|
const disabledRule = await prisma.quotaRule.findFirst({
|
||||||
|
where: { id: createdRule?.id },
|
||||||
|
})
|
||||||
|
expect(disabledRule?.enabled).toBe(false)
|
||||||
|
|
||||||
|
// Toggle back on
|
||||||
|
await page.getByRole('switch').click()
|
||||||
|
await expect(page.getByRole('switch')).toBeChecked()
|
||||||
|
|
||||||
|
// 9. Open Edit Dialog by clicking the quota card
|
||||||
|
await page.getByText(/50,000 tokens|50000 tokens/i).click()
|
||||||
|
await expect(page.getByText(/Edit Quota Rule|编辑配额规则/i)).toBeVisible()
|
||||||
|
await expect(page.getByRole('button', { name: /Each Member|每个成员/i })).toBeDisabled()
|
||||||
|
await expect(page.locator('#quota-resource')).toBeDisabled()
|
||||||
|
|
||||||
|
// 10. Update limit
|
||||||
|
await page.fill('#quota-limit', '75000')
|
||||||
|
await page.getByRole('button', { name: /^(Save|保存)$/i }).click()
|
||||||
|
|
||||||
|
// Verify updated limit in UI and DB
|
||||||
|
await expect(page.getByText(/75,000 tokens|75000 tokens/i)).toBeVisible()
|
||||||
|
const updatedRule = await prisma.quotaRule.findFirst({
|
||||||
|
where: { id: createdRule?.id },
|
||||||
|
})
|
||||||
|
expect(updatedRule?.limit).toBe(75000)
|
||||||
|
|
||||||
|
// 11. Verify quota usage and reset it from the dashboard
|
||||||
|
const ownerUser = await prisma.user.findUnique({ where: { email } })
|
||||||
|
expect(ownerUser).not.toBeNull()
|
||||||
|
await prisma.quotaRecord.create({
|
||||||
|
data: {
|
||||||
|
ruleId: createdRule?.id as string,
|
||||||
|
teamId,
|
||||||
|
userId: ownerUser?.id,
|
||||||
|
periodStart: new Date(),
|
||||||
|
periodEnd: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
||||||
|
consumed: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await page.goto(`/teams/${teamId}/dashboard`)
|
||||||
|
await page.getByRole('button', { name: /Quotas|配额/i }).click()
|
||||||
|
await expect(
|
||||||
|
page.getByText(/Monitor live quota usage|在仪表盘中监控实时配额使用情况/),
|
||||||
|
).toBeVisible()
|
||||||
|
|
||||||
|
const quotaRuleButton = page.getByRole('button', { name: /Expand quota rule|展开配额规则/i })
|
||||||
|
await quotaRuleButton.click()
|
||||||
|
await expect(page.getByText(/^100 \/ 75,000 tokens$|^100 \/ 75000 tokens$/i)).toBeVisible()
|
||||||
|
await page.getByRole('button', { name: /Reset Usage|重置使用量/i }).click()
|
||||||
|
await expect(page.getByRole('alertdialog')).toBeVisible()
|
||||||
|
await page.getByRole('button', { name: /Confirm|确认/i }).click()
|
||||||
|
await expect(page.getByText(/^0 \/ 75,000 tokens$|^0 \/ 75000 tokens$/i)).toBeVisible()
|
||||||
|
|
||||||
|
const resetRecord = await prisma.quotaRecord.findFirst({
|
||||||
|
where: { ruleId: createdRule?.id, userId: ownerUser?.id },
|
||||||
|
})
|
||||||
|
expect(resetRecord?.consumed).toBe(0)
|
||||||
|
|
||||||
|
// 12. Delete quota rule from settings
|
||||||
|
await page.goto(`/teams/${teamId}/settings`)
|
||||||
|
await page.getByRole('button', { name: /Quotas|配额/i }).click()
|
||||||
|
await page.getByRole('button', { name: 'Quota actions' }).first().click()
|
||||||
|
await page.getByRole('menuitem', { name: /Delete|删除/i }).click()
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: /Delete|删除/i })
|
||||||
|
.last()
|
||||||
|
.click()
|
||||||
|
|
||||||
|
// Verify empty state returns
|
||||||
|
await expect(page.getByText(/No resource quotas configured|暂未配置资源配额/i)).toBeVisible()
|
||||||
|
const deletedRule = await prisma.quotaRule.findFirst({
|
||||||
|
where: { id: createdRule?.id },
|
||||||
|
})
|
||||||
|
expect(deletedRule).toBeNull()
|
||||||
|
})
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/web-app",
|
"name": "@shumai/web-app",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
"apps/agent": {
|
"apps/agent": {
|
||||||
"name": "@shumai/agent-app",
|
"name": "@shumai/agent-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-agent": "./src/index.ts",
|
"shumai-agent": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"apps/cli": {
|
"apps/cli": {
|
||||||
"name": "@shumai/cli",
|
"name": "@shumai/cli",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-cli": "./src/index.ts",
|
"shumai-cli": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
},
|
},
|
||||||
"apps/transcode": {
|
"apps/transcode": {
|
||||||
"name": "@shumai/transcode-app",
|
"name": "@shumai/transcode-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-transcode": "./src/index.ts",
|
"shumai-transcode": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
"apps/web": {
|
"apps/web": {
|
||||||
"name": "@shumai/web-app",
|
"name": "@shumai/web-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/agent": "workspace:*",
|
"@shumai/agent": "workspace:*",
|
||||||
"@shumai/api": "workspace:*",
|
"@shumai/api": "workspace:*",
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
},
|
},
|
||||||
"packages/agent": {
|
"packages/agent": {
|
||||||
"name": "@shumai/agent",
|
"name": "@shumai/agent",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
},
|
},
|
||||||
"packages/api": {
|
"packages/api": {
|
||||||
"name": "@shumai/api",
|
"name": "@shumai/api",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hono/zod-validator": "0.7.6",
|
"@hono/zod-validator": "0.7.6",
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
},
|
},
|
||||||
"packages/core": {
|
"packages/core": {
|
||||||
"name": "@shumai/core",
|
"name": "@shumai/core",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@earendil-works/pi-ai": "0.82.1",
|
"@earendil-works/pi-ai": "0.82.1",
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
},
|
},
|
||||||
"packages/db": {
|
"packages/db": {
|
||||||
"name": "@shumai/db",
|
"name": "@shumai/db",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@prisma/adapter-pg": "7.8.0",
|
"@prisma/adapter-pg": "7.8.0",
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
},
|
},
|
||||||
"packages/dtos": {
|
"packages/dtos": {
|
||||||
"name": "@shumai/dtos",
|
"name": "@shumai/dtos",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"zod": "4.4.3",
|
"zod": "4.4.3",
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
},
|
},
|
||||||
"packages/e2e": {
|
"packages/e2e": {
|
||||||
"name": "@shumai/e2e",
|
"name": "@shumai/e2e",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@google/genai": "1.52.0",
|
"@google/genai": "1.52.0",
|
||||||
@@ -205,11 +205,11 @@
|
|||||||
},
|
},
|
||||||
"packages/tableprinter": {
|
"packages/tableprinter": {
|
||||||
"name": "@shumai/tableprinter",
|
"name": "@shumai/tableprinter",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
},
|
},
|
||||||
"packages/transcode": {
|
"packages/transcode": {
|
||||||
"name": "@shumai/transcode",
|
"name": "@shumai/transcode",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
},
|
},
|
||||||
"packages/webui": {
|
"packages/webui": {
|
||||||
"name": "@shumai/webui",
|
"name": "@shumai/webui",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@base-ui/react": "1.5.0",
|
"@base-ui/react": "1.5.0",
|
||||||
"@dnd-kit/abstract": "0.4.0",
|
"@dnd-kit/abstract": "0.4.0",
|
||||||
@@ -321,7 +321,7 @@
|
|||||||
},
|
},
|
||||||
"packages/workflow-core": {
|
"packages/workflow-core": {
|
||||||
"name": "@shumai/workflow-core",
|
"name": "@shumai/workflow-core",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Code Quality Review: Quota Usage Dashboard
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
The change moves quota usage monitoring from the settings rule-card dialog to an owner-only dashboard section, adds collapsible rule/record display, and adds an audited manual record reset operation.
|
||||||
|
|
||||||
|
## Review
|
||||||
|
|
||||||
|
### Correctness
|
||||||
|
|
||||||
|
- The reset service validates team ownership, scope mode, membership, role filters, and selected-member membership.
|
||||||
|
- Reset and first-use record creation are serialized with a quota-rule row lock.
|
||||||
|
- Reset starts a new window at the current time and clears consumption.
|
||||||
|
- API and service tests cover shared records, member records, invalid targets, cross-team access, request validation, and audit logging.
|
||||||
|
- The application E2E test covers the settings/dashboard flow and verifies the persisted reset.
|
||||||
|
|
||||||
|
### Readability and architecture
|
||||||
|
|
||||||
|
- Business logic remains in `QuotaService`; the API only validates, authorizes, invokes the service, and maps the audit action.
|
||||||
|
- The dashboard owns usage presentation, while quota formatting metadata is shared between dashboard and settings.
|
||||||
|
- The removed usage dialog and obsolete translation messages are not referenced after the refactor.
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- The reset endpoint retains owner-level team authorization.
|
||||||
|
- Request input is validated with Zod.
|
||||||
|
- SQL uses Prisma tagged-template parameters and does not interpolate raw user input.
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
- Usage records are queried only after a rule is expanded.
|
||||||
|
- Expanded rules refresh every ten seconds, matching the previous usage dialog behavior.
|
||||||
|
- Quota rules retain the existing bounded list endpoint and descending ID ordering.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `bun run lint` passed.
|
||||||
|
- `bun run format` passed.
|
||||||
|
- `bun run typecheck` passed.
|
||||||
|
- `bun run test` passed: 124 files, 1190 tests.
|
||||||
|
- Quota API/core tests passed: 2 files, 30 tests.
|
||||||
|
- Quota application E2E passed.
|
||||||
|
- WebUI harness E2E passed: 9 tests.
|
||||||
|
- Workflow E2E passed: 14 files, 58 tests.
|
||||||
|
- `git diff --check` passed.
|
||||||
|
|
||||||
|
## Verdict
|
||||||
|
|
||||||
|
Approve. No critical or required findings remain.
|
||||||
+3
-2
@@ -43,6 +43,7 @@
|
|||||||
"pages": [
|
"pages": [
|
||||||
"using-shumai/agent-providers",
|
"using-shumai/agent-providers",
|
||||||
"using-shumai/agents",
|
"using-shumai/agents",
|
||||||
|
"using-shumai/agents-md",
|
||||||
"using-shumai/agent-skills",
|
"using-shumai/agent-skills",
|
||||||
"using-shumai/agent-tools",
|
"using-shumai/agent-tools",
|
||||||
"using-shumai/mcp-servers",
|
"using-shumai/mcp-servers",
|
||||||
@@ -50,8 +51,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "Media Transcoding Settings",
|
"group": "Team Settings",
|
||||||
"pages": ["using-shumai/transcode-settings"]
|
"pages": ["using-shumai/transcode-settings", "using-shumai/quotas-settings"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "Configuration",
|
"group": "Configuration",
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
title: AGENTS.md Context & Instructions
|
||||||
|
description: Provide hierarchical, folder-specific instructions and context to AI agents.
|
||||||
|
---
|
||||||
|
|
||||||
|
In addition to global agent system prompts and skills, Shumai allows you to define project-level and folder-level instructions using **`AGENTS.md`**.
|
||||||
|
|
||||||
|
When an AI agent (such as a Chat Agent or Autofill Agent) operates within a project or folder, Shumai automatically loads the corresponding `AGENTS.md` files to provide context, operational rules, and project-specific knowledge.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hierarchical Traversal & Inheritance
|
||||||
|
|
||||||
|
Shumai uses a hierarchical context model for `AGENTS.md`:
|
||||||
|
|
||||||
|
- **Upward Traversal**: When an agent works on a file or folder, Shumai traverses the folder tree upwards from the current folder all the way to the **project root level**.
|
||||||
|
- **Combined Context**: All `AGENTS.md` files found along this path are loaded into the agent's context in order (from the project root down to the current folder).
|
||||||
|
- **Layered Rules**: This lets you define broad, project-wide rules and guidelines at the project root `AGENTS.md`, while adding specific rules, vocabulary, or autofill hints in nested subfolder `AGENTS.md` files.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What to Include in AGENTS.md
|
||||||
|
|
||||||
|
You can use `AGENTS.md` to define any instructions you want the agent to follow when working in that folder or project:
|
||||||
|
|
||||||
|
- **Project & Folder Overview**: Describe what assets are stored in the folder and how they relate to the broader project.
|
||||||
|
- **Agent Behavioral Rules**: Specify guardrails, tone, required formats, or things the agent should and shouldn't do when answering queries or leaving comments.
|
||||||
|
- **Terminology & Domain Knowledge**: Define specialized vocabulary, acronyms, brand naming conventions, or project-specific jargon.
|
||||||
|
- **Metadata & Autofill Instructions**: Guide the **Autofill Agent** on how to summarize assets, generate tags, or populate specific custom metadata fields for files in this folder.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Accessing and Editing AGENTS.md
|
||||||
|
|
||||||
|
### Opening the Editor
|
||||||
|
|
||||||
|
To view or edit `AGENTS.md`:
|
||||||
|
|
||||||
|
1. Open any project or folder in the Shumai web application.
|
||||||
|
2. Click the **`AGENTS.md`** button in the top navigation toolbar, or right-click any folder in the file browser and choose **AGENTS.md**.
|
||||||
|
3. A dedicated WYSIWYG Markdown editor opens with full formatting support (headings, lists, code blocks, bold/italics, and links).
|
||||||
|
|
||||||
|
### Auto-Save
|
||||||
|
|
||||||
|
As you make changes in the editor, Shumai automatically saves your edits in the background with visual save status indicators (`Saving...`, `Saved`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Permissions & Read-Only Mode
|
||||||
|
|
||||||
|
- **Viewing**: All team members who have read access to the project can view `AGENTS.md`.
|
||||||
|
- **Editing**: **Only Team Owners** are permitted to create, edit, or delete `AGENTS.md` files.
|
||||||
|
- **Read-Only State**: Non-owner members will see a clear read-only indicator in the toolbar explaining that only team owners can edit instructions for the file.
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
---
|
||||||
|
title: Resource Quotas
|
||||||
|
description: Configure team resource quotas, monitor live usage, and reset quota windows from the dashboard.
|
||||||
|
---
|
||||||
|
|
||||||
|
AI workflows and media processing tools can consume significant compute and API credits. Shumai provides a **Resource Quotas** system that allows Team Owners to set granular rate limits, govern budgets, and monitor real-time usage across team members and roles.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Resource Quotas allow you to define maximum usage limits across specific time windows (e.g., hourly, daily, or weekly). When a member or team reaches their assigned quota, further actions for that resource are safely blocked until the quota period resets.
|
||||||
|
|
||||||
|
Quota configuration and usage monitoring are separate parts of the team experience:
|
||||||
|
|
||||||
|
- To create and manage quota rules, open **Team Settings** and navigate to the **Quotas** tab.
|
||||||
|
- To monitor live usage, open the **Team Dashboard** and select **Quotas** under the **TEAM** section.
|
||||||
|
|
||||||
|
The quota dashboard is available to Team Owners.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scope Modes
|
||||||
|
|
||||||
|
When creating or editing a quota rule, you can define how the limit is applied:
|
||||||
|
|
||||||
|
### 1. Each Member
|
||||||
|
|
||||||
|
- **Behavior**: Every member in the scope receives their own independent limit. Usage by one member does not affect the remaining quota of others.
|
||||||
|
- **Optional Role Filter**: You can restrict the quota to members with a specific role (e.g. only **Editors** or **Reviewers**), or apply it to the entire team.
|
||||||
|
- **Use Case**: Give each editor a daily budget of 100,000 tokens.
|
||||||
|
|
||||||
|
### 2. All Members (Shared Pool)
|
||||||
|
|
||||||
|
- **Behavior**: The quota limit is shared as a collective pool across all matching members. Every member's consumption draws from the same total.
|
||||||
|
- **Optional Role Filter**: Apply the shared pool to all team members or restrict it to a specific role.
|
||||||
|
- **Use Case**: Cap the total team spending on AI models to $50 per day.
|
||||||
|
|
||||||
|
### 3. Selected Members
|
||||||
|
|
||||||
|
- **Behavior**: Assign individual limits to specific chosen team members.
|
||||||
|
- **Use Case**: Grant higher limits to senior artists or technical directors while keeping standard limits for others.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Supported Resource Types
|
||||||
|
|
||||||
|
Shumai supports quota enforcement across multiple layers of the AI and agent architecture:
|
||||||
|
|
||||||
|
| Resource Type | Description | Target Specification |
|
||||||
|
| :-------------------------- | :-------------------------------------------------------------------------------------- | :----------------------------------- |
|
||||||
|
| **Total Tokens** | Total LLM input and output tokens consumed in chat, comments, and autofill. | Team, Role, or Members |
|
||||||
|
| **AI Cost ($)** | Dollar expenditure accrued from AI model providers. | Team, Role, or Members |
|
||||||
|
| **MCP Server Calls** | Number of tool invocations directed to a connected Model Context Protocol (MCP) server. | Target MCP Server ID |
|
||||||
|
| **Sandboxed Bash Commands** | Shell commands executed by the agent inside the isolated sandbox. | Wildcard pattern (e.g. `npm *`, `*`) |
|
||||||
|
| **Agent Tool Calls** | Calls to specific native tools (e.g. `analyze_image`, `screenshot`, `create_file`). | Tool name |
|
||||||
|
|
||||||
|
### Bash Command Wildcard Matching
|
||||||
|
|
||||||
|
For sandboxed bash execution, you can restrict specific command patterns using wildcards (`*` and `?`):
|
||||||
|
|
||||||
|
- `*`: Matches any bash command execution.
|
||||||
|
- `npm *`: Matches any npm command (e.g., `npm install`, `npm test`).
|
||||||
|
- `git commit*`: Matches git commit invocations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Time Periods & Rollover
|
||||||
|
|
||||||
|
Quotas can be configured with the following reset periods:
|
||||||
|
|
||||||
|
- **1 Hour** (`1hour`)
|
||||||
|
- **5 Hours** (`5hour`)
|
||||||
|
- **1 Day** (`1day`)
|
||||||
|
- **7 Days** (`7day`)
|
||||||
|
|
||||||
|
### Lazy Reset Mechanism
|
||||||
|
|
||||||
|
Shumai tracks usage windows automatically. When a period window expires, the system resets the quota upon the member's next request, seamlessly starting a fresh window without requiring background maintenance tasks.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Monitoring Live Usage
|
||||||
|
|
||||||
|
Team Owners can inspect live consumption from the team dashboard:
|
||||||
|
|
||||||
|
1. Open the **Team Dashboard**.
|
||||||
|
2. Select **Quotas** under the **TEAM** section.
|
||||||
|
3. Quota rules are shown as first-level collapsible entries.
|
||||||
|
4. Expand a rule to view its usage records.
|
||||||
|
|
||||||
|
Each usage record displays:
|
||||||
|
|
||||||
|
- **Consumption Status**: Progress bar showing consumed units versus the total limit.
|
||||||
|
- **Remaining Allowance**: Percentage and numerical amount remaining.
|
||||||
|
- **Refresh Countdown**: Remaining time until the active window resets (e.g., _"Refreshes in 45m"_).
|
||||||
|
- **Target**: The team shared pool, role pool, or individual member associated with the record.
|
||||||
|
- **Member Search**: For member-scoped rules, search the usage records by member name or email.
|
||||||
|
|
||||||
|
Usage records are loaded when a rule is expanded and refresh automatically while the rule is open.
|
||||||
|
|
||||||
|
### Manually Resetting a Usage Record
|
||||||
|
|
||||||
|
Each usage record includes a **Reset Usage** action. After confirming the action:
|
||||||
|
|
||||||
|
- Consumption is set to zero.
|
||||||
|
- The quota period starts immediately.
|
||||||
|
- The period ends after the configured quota duration.
|
||||||
|
- For example, resetting a one-day quota at 10:00 starts a new window from 10:00 until 10:00 the following day.
|
||||||
|
|
||||||
|
A reset can also initialize a zero-consumption record for a member or shared pool that has not received usage yet. Resets are recorded in the team audit log.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Managing Quota Rules
|
||||||
|
|
||||||
|
- **Enable / Disable**: Toggle the switch on any quota card in Team Settings to temporarily pause or resume enforcement without deleting the rule.
|
||||||
|
- **Edit Rules**: Click any quota card in Team Settings to update limits, change reset periods, or adjust member selections.
|
||||||
|
- **Delete Rules**: Open the card action menu (`⋮`) in Team Settings and select **Delete** to remove the quota rule.
|
||||||
|
|
||||||
|
Quota usage is monitored and reset from the Team Dashboard rather than from the settings rule cards.
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "shumai",
|
"name": "shumai",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/agent",
|
"name": "@shumai/agent",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
generateSessionNameActivity,
|
generateSessionNameActivity,
|
||||||
type GenerateSessionNameParams,
|
type GenerateSessionNameParams,
|
||||||
getUserTeamInfoActivity,
|
getUserTeamInfoActivity,
|
||||||
|
formatProjectContextPrompt,
|
||||||
} from './agent'
|
} from './agent'
|
||||||
import * as piAgent from '../index'
|
import * as piAgent from '../index'
|
||||||
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
||||||
@@ -513,6 +514,11 @@ describe('Agent Activities', () => {
|
|||||||
describe('Agent Database Activities Integration', () => {
|
describe('Agent Database Activities Integration', () => {
|
||||||
setupTestDbHooks()
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
// Space out comment creations: ULID ids have 1ms timestamp granularity, so
|
||||||
|
// back-to-back creates landing in the same millisecond sort by random suffix
|
||||||
|
// and can break the id-ordered DAG spine in initializeAgentSessionActivity.
|
||||||
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
|
|
||||||
let team: Team
|
let team: Team
|
||||||
let user: User
|
let user: User
|
||||||
let project: Project
|
let project: Project
|
||||||
@@ -570,6 +576,7 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await sleep(2)
|
||||||
// Create second comment that user responds with, triggering session initialization
|
// Create second comment that user responds with, triggering session initialization
|
||||||
const userComment = await prisma.assetComment.create({
|
const userComment = await prisma.assetComment.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -617,11 +624,13 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
const mainComment1 = await prisma.assetComment.create({
|
const mainComment1 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'Main Comment 1', creatorId: user.id },
|
data: { assetId: asset.id, message: 'Main Comment 1', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
const mainComment2 = await prisma.assetComment.create({
|
const mainComment2 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'Main Comment 2', creatorId: user.id },
|
data: { assetId: asset.id, message: 'Main Comment 2', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
|
||||||
// 2. Thread reply under mainComment1
|
// 2. Thread reply under mainComment1
|
||||||
|
await sleep(2)
|
||||||
const threadReply1 = await prisma.assetComment.create({
|
const threadReply1 = await prisma.assetComment.create({
|
||||||
data: {
|
data: {
|
||||||
assetId: asset.id,
|
assetId: asset.id,
|
||||||
@@ -730,10 +739,12 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
const msg1 = await prisma.assetComment.create({
|
const msg1 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg2 (top level)
|
// msg2 (top level)
|
||||||
const msg2 = await prisma.assetComment.create({
|
const msg2 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg3 (top level asking agent)
|
// msg3 (top level asking agent)
|
||||||
const msg3 = await prisma.assetComment.create({
|
const msg3 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: '[ask agent] msg3', creatorId: user.id },
|
data: { assetId: asset.id, message: '[ask agent] msg3', creatorId: user.id },
|
||||||
@@ -748,6 +759,7 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// agent response msg4
|
// agent response msg4
|
||||||
|
await sleep(2)
|
||||||
const msg4 = await prisma.assetComment.create({
|
const msg4 = await prisma.assetComment.create({
|
||||||
data: {
|
data: {
|
||||||
assetId: asset.id,
|
assetId: asset.id,
|
||||||
@@ -759,6 +771,7 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// msg5 (top level asking agent)
|
// msg5 (top level asking agent)
|
||||||
|
await sleep(2)
|
||||||
const msg5 = await prisma.assetComment.create({
|
const msg5 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: '[ask agent] msg5', creatorId: user.id },
|
data: { assetId: asset.id, message: '[ask agent] msg5', creatorId: user.id },
|
||||||
})
|
})
|
||||||
@@ -782,6 +795,7 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
expect(session3Id).not.toBe(session5Id)
|
expect(session3Id).not.toBe(session5Id)
|
||||||
|
|
||||||
// msg7 (reply to msg3 asking agent again)
|
// msg7 (reply to msg3 asking agent again)
|
||||||
|
await sleep(2)
|
||||||
const msg7 = await prisma.assetComment.create({
|
const msg7 = await prisma.assetComment.create({
|
||||||
data: {
|
data: {
|
||||||
assetId: asset.id,
|
assetId: asset.id,
|
||||||
@@ -830,10 +844,12 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
const msg1 = await prisma.assetComment.create({
|
const msg1 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg2 (top level)
|
// msg2 (top level)
|
||||||
const msg2 = await prisma.assetComment.create({
|
const msg2 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg3 (top level asking agent)
|
// msg3 (top level asking agent)
|
||||||
const msg3 = await prisma.assetComment.create({
|
const msg3 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: '<@shumai-x1> what did i say', creatorId: user.id },
|
data: { assetId: asset.id, message: '<@shumai-x1> what did i say', creatorId: user.id },
|
||||||
@@ -868,10 +884,12 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
const msg1 = await prisma.assetComment.create({
|
const msg1 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg1', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg2 (top level)
|
// msg2 (top level)
|
||||||
const msg2 = await prisma.assetComment.create({
|
const msg2 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
data: { assetId: asset.id, message: 'msg2', creatorId: user.id },
|
||||||
})
|
})
|
||||||
|
await sleep(2)
|
||||||
// msg3 (top level asking agent)
|
// msg3 (top level asking agent)
|
||||||
const msg3 = await prisma.assetComment.create({
|
const msg3 = await prisma.assetComment.create({
|
||||||
data: { assetId: asset.id, message: '<@shumai-x1> what did i say', creatorId: user.id },
|
data: { assetId: asset.id, message: '<@shumai-x1> what did i say', creatorId: user.id },
|
||||||
@@ -1085,6 +1103,55 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
expect(chatCtx.enabledSkillIds).toEqual([enabledSkill.id])
|
expect(chatCtx.enabledSkillIds).toEqual([enabledSkill.id])
|
||||||
expect(chatCtx.teamSkills.map((s) => s.id)).not.toContain(disabledSkill.id)
|
expect(chatCtx.teamSkills.map((s) => s.id)).not.toContain(disabledSkill.id)
|
||||||
|
|
||||||
|
// Test permission enforcement in getAgentChatContextActivity
|
||||||
|
// Create owner-only agent
|
||||||
|
const ownerAgentUser = await prisma.user.create({
|
||||||
|
data: { name: 'Owner Bot', email: `ownerbot-${Date.now()}@shumai.ai`, type: 'agent' },
|
||||||
|
})
|
||||||
|
const ownerAgent = await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: ownerAgentUser.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'owner',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
config: { provider: 'openai', model: 'gpt-4' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create owner and reviewer members
|
||||||
|
const ownerUser = await prisma.user.create({
|
||||||
|
data: { name: 'Owner User', email: `owner-${Date.now()}@shumai.ai` },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: ownerUser.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviewerUser = await prisma.user.create({
|
||||||
|
data: { name: 'Reviewer User', email: `reviewer-${Date.now()}@shumai.ai` },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: reviewerUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Owner should succeed
|
||||||
|
const ownerCtx = await getAgentChatContextActivity({
|
||||||
|
teamId: team.id,
|
||||||
|
agentId: ownerAgent.id,
|
||||||
|
userId: ownerUser.id,
|
||||||
|
})
|
||||||
|
expect(ownerCtx.agent.id).toBe(ownerAgent.id)
|
||||||
|
|
||||||
|
// Reviewer should fail with non-retryable ApplicationFailure
|
||||||
|
await expect(
|
||||||
|
getAgentChatContextActivity({
|
||||||
|
teamId: team.id,
|
||||||
|
agentId: ownerAgent.id,
|
||||||
|
userId: reviewerUser.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('Permission denied')
|
||||||
|
|
||||||
// Create User for autofill agent
|
// Create User for autofill agent
|
||||||
const autofillUser = await prisma.user.create({
|
const autofillUser = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -2041,4 +2108,113 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
expect(piAgent.createAgentSession).not.toHaveBeenCalled()
|
expect(piAgent.createAgentSession).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('Nested AGENTS.md prompt injection', () => {
|
||||||
|
it('formatProjectContextPrompt formats context files into XML project_context block', () => {
|
||||||
|
expect(formatProjectContextPrompt([])).toBe('')
|
||||||
|
|
||||||
|
const formatted = formatProjectContextPrompt([
|
||||||
|
{ path: '/AGENTS.md', content: 'Root rules' },
|
||||||
|
{ path: '/subfolder/AGENTS.md', content: 'Subfolder rules' },
|
||||||
|
])
|
||||||
|
|
||||||
|
expect(formatted).toBe(
|
||||||
|
'\n\n<project_context>\n\nProject-specific instructions and guidelines:\n\n<project_instructions path="/AGENTS.md">\nRoot rules\n</project_instructions>\n\n<project_instructions path="/subfolder/AGENTS.md">\nSubfolder rules\n</project_instructions>\n\n</project_context>',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('agentChatActivity injects nested AGENTS.md instructions into systemPrompt', async () => {
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'User_Chat_Md', email: `chat-md-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Team_Chat_Md_' + Date.now() },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project_Chat_Md', teamId: team.id },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.root,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.assetAgentMd.create({
|
||||||
|
data: {
|
||||||
|
assetId: rootFolder.id,
|
||||||
|
content: '# Root Policy',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const subfolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'subfolder',
|
||||||
|
type: AssetType.folder,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.assetAgentMd.create({
|
||||||
|
data: {
|
||||||
|
assetId: subfolder.id,
|
||||||
|
content: '# Subfolder Policy',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const mockHarness = {
|
||||||
|
subscribe: vi.fn(),
|
||||||
|
prompt: vi.fn().mockResolvedValue({
|
||||||
|
content: [{ type: 'text', text: 'Chat reply' }],
|
||||||
|
usage: { input: 10, output: 20 },
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
const mockSession = {
|
||||||
|
getEntries: vi.fn().mockResolvedValue([]),
|
||||||
|
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
|
||||||
|
}
|
||||||
|
|
||||||
|
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
|
||||||
|
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock AgentHarness instance for activity test
|
||||||
|
harness: mockHarness as unknown as AgentHarness<any, any, any, any>,
|
||||||
|
})
|
||||||
|
|
||||||
|
const context = {
|
||||||
|
agent: { id: 'agent-1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
|
||||||
|
dbProviders: [],
|
||||||
|
teamSkills: [],
|
||||||
|
allowedDomains: [],
|
||||||
|
} as unknown as AgentExecutionContext
|
||||||
|
|
||||||
|
await agentChatActivity({
|
||||||
|
teamId: team.id,
|
||||||
|
agentId: 'agent-1',
|
||||||
|
message: 'Hello',
|
||||||
|
imageUrls: [],
|
||||||
|
projectId: project.id,
|
||||||
|
folderId: subfolder.id,
|
||||||
|
assetId: subfolder.id,
|
||||||
|
sessionId: 'mock-session-id',
|
||||||
|
userId: user.id,
|
||||||
|
context,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(piAgent.createAgentSession).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
systemPrompt: expect.stringContaining('<project_context>'),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
const lastCall = vi.mocked(piAgent.createAgentSession).mock.calls.at(-1)
|
||||||
|
const systemPromptArg = lastCall?.[0].systemPrompt as string
|
||||||
|
expect(systemPromptArg).toContain(
|
||||||
|
'<project_instructions path="/AGENTS.md">\n# Root Policy\n</project_instructions>',
|
||||||
|
)
|
||||||
|
expect(systemPromptArg).toContain(
|
||||||
|
'<project_instructions path="/subfolder/AGENTS.md">\n# Subfolder Policy\n</project_instructions>',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import {
|
|||||||
} from '@earendil-works/pi-agent-core'
|
} from '@earendil-works/pi-agent-core'
|
||||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||||
import { assetService } from '@shumai/core/src/asset/asset'
|
import { assetService } from '@shumai/core/src/asset/asset'
|
||||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
import {
|
||||||
|
authzService,
|
||||||
|
Permission,
|
||||||
|
ResourceType,
|
||||||
|
resolveEffectiveRole,
|
||||||
|
} from '@shumai/core/src/authz/authz'
|
||||||
import { logger } from '@shumai/core/src/logger'
|
import { logger } from '@shumai/core/src/logger'
|
||||||
import { mcpService } from '@shumai/core/src/mcp/mcp-service'
|
import { mcpService } from '@shumai/core/src/mcp/mcp-service'
|
||||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||||
@@ -13,6 +18,7 @@ import { encodeCursor, paginateQuery } from '@shumai/core/src/pagination'
|
|||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { uploadService } from '@shumai/core/src/upload/upload'
|
import { uploadService } from '@shumai/core/src/upload/upload'
|
||||||
import { VersionStackService } from '@shumai/core/src/versionStack/versionStack'
|
import { VersionStackService } from '@shumai/core/src/versionStack/versionStack'
|
||||||
|
import { getAgentRequiredLevel, getRoleLevel } from '@shumai/core/src/agent/permissions'
|
||||||
import { AssetType, prisma, Prisma, type Skill } from '@shumai/db'
|
import { AssetType, prisma, Prisma, type Skill } from '@shumai/db'
|
||||||
import { registerLocalCancelHandler, unregisterLocalCancelHandler } from '@shumai/workflow-core'
|
import { registerLocalCancelHandler, unregisterLocalCancelHandler } from '@shumai/workflow-core'
|
||||||
import { ApplicationFailure, Context } from '@temporalio/activity'
|
import { ApplicationFailure, Context } from '@temporalio/activity'
|
||||||
@@ -27,6 +33,7 @@ import {
|
|||||||
} from '../index'
|
} from '../index'
|
||||||
|
|
||||||
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
|
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
|
||||||
|
import { quotaService, QuotaExceededError } from '@shumai/core/src/quota/quota-service'
|
||||||
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
|
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
|
||||||
|
|
||||||
export interface Usage {
|
export interface Usage {
|
||||||
@@ -65,6 +72,18 @@ export interface AgentExecutionContext {
|
|||||||
allowedDomains: string[]
|
allowedDomains: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatProjectContextPrompt(
|
||||||
|
contextFiles: Array<{ path: string; content: string }>,
|
||||||
|
): string {
|
||||||
|
if (contextFiles.length === 0) return ''
|
||||||
|
let prompt = '\n\n<project_context>\n\nProject-specific instructions and guidelines:\n\n'
|
||||||
|
for (const { path: filePath, content } of contextFiles) {
|
||||||
|
prompt += `<project_instructions path="${filePath}">\n${content}\n</project_instructions>\n\n`
|
||||||
|
}
|
||||||
|
prompt += '</project_context>'
|
||||||
|
return prompt
|
||||||
|
}
|
||||||
|
|
||||||
async function executeAgentPrompt(params: {
|
async function executeAgentPrompt(params: {
|
||||||
taskId?: string
|
taskId?: string
|
||||||
teamId: string
|
teamId: string
|
||||||
@@ -75,6 +94,7 @@ async function executeAgentPrompt(params: {
|
|||||||
sessionId?: string
|
sessionId?: string
|
||||||
userId?: string
|
userId?: string
|
||||||
projectId?: string
|
projectId?: string
|
||||||
|
assetId?: string
|
||||||
userCommentId?: string | null
|
userCommentId?: string | null
|
||||||
tools?: AgentTool[]
|
tools?: AgentTool[]
|
||||||
context: AgentExecutionContext
|
context: AgentExecutionContext
|
||||||
@@ -114,6 +134,40 @@ When creating a file or version, you may attach metadata (for example, the AI mo
|
|||||||
// Note: params.agentsInstruction is no longer appended to systemPrompt here.
|
// Note: params.agentsInstruction is no longer appended to systemPrompt here.
|
||||||
// Instead, it is persisted as a custom message session entry in the conversation history below.
|
// Instead, it is persisted as a custom message session entry in the conversation history below.
|
||||||
|
|
||||||
|
let targetAssetId = params.assetId
|
||||||
|
if (!targetAssetId) {
|
||||||
|
if (params.userCommentId) {
|
||||||
|
const comment = await prisma.assetComment.findUnique({
|
||||||
|
where: { id: params.userCommentId },
|
||||||
|
select: { assetId: true },
|
||||||
|
})
|
||||||
|
if (comment?.assetId) {
|
||||||
|
targetAssetId = comment.assetId
|
||||||
|
}
|
||||||
|
} else if (params.taskId) {
|
||||||
|
const task = await prisma.workflowTask.findUnique({
|
||||||
|
where: { id: params.taskId },
|
||||||
|
select: { assetId: true },
|
||||||
|
})
|
||||||
|
if (task?.assetId) {
|
||||||
|
targetAssetId = task.assetId
|
||||||
|
}
|
||||||
|
} else if (params.projectId) {
|
||||||
|
const project = await prisma.project.findUnique({
|
||||||
|
where: { id: params.projectId },
|
||||||
|
select: { rootFolderId: true },
|
||||||
|
})
|
||||||
|
if (project?.rootFolderId) {
|
||||||
|
targetAssetId = project.rootFolderId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const contextFiles = targetAssetId ? await assetService.getNestedAgentsMd(targetAssetId) : []
|
||||||
|
if (contextFiles.length > 0) {
|
||||||
|
systemPrompt += formatProjectContextPrompt(contextFiles)
|
||||||
|
}
|
||||||
|
|
||||||
const modelConfig = agent.modelRef?.config
|
const modelConfig = agent.modelRef?.config
|
||||||
if (modelConfig?.input) {
|
if (modelConfig?.input) {
|
||||||
systemPrompt += `\n\nYour current model supports the following input types: ${modelConfig.input.join(', ')}.`
|
systemPrompt += `\n\nYour current model supports the following input types: ${modelConfig.input.join(', ')}.`
|
||||||
@@ -126,7 +180,12 @@ When creating a file or version, you may attach metadata (for example, the AI mo
|
|||||||
// sessions never receive MCP tools even if a server is assigned.
|
// sessions never receive MCP tools even if a server is assigned.
|
||||||
const mcpTools =
|
const mcpTools =
|
||||||
agent.type === 'chat'
|
agent.type === 'chat'
|
||||||
? await mcpService.buildAgentTools(params.agentId, params.teamId, params.userId)
|
? await mcpService.buildAgentTools(
|
||||||
|
params.agentId,
|
||||||
|
params.teamId,
|
||||||
|
params.userId,
|
||||||
|
params.projectId,
|
||||||
|
)
|
||||||
: []
|
: []
|
||||||
|
|
||||||
const { session, harness } = await createAgentSession({
|
const { session, harness } = await createAgentSession({
|
||||||
@@ -239,6 +298,39 @@ When creating a file or version, you may attach metadata (for example, the AI mo
|
|||||||
let grandTotalTokens = 0
|
let grandTotalTokens = 0
|
||||||
let totalCost = 0
|
let totalCost = 0
|
||||||
|
|
||||||
|
const effectiveRole = params.userId
|
||||||
|
? await resolveEffectiveRole(params.teamId, params.projectId, params.userId)
|
||||||
|
: undefined
|
||||||
|
|
||||||
|
try {
|
||||||
|
await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof QuotaExceededError) {
|
||||||
|
throw ApplicationFailure.create({
|
||||||
|
message: err.message,
|
||||||
|
nonRetryable: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
|
||||||
harness.subscribe(async (event) => {
|
harness.subscribe(async (event) => {
|
||||||
if (event.type === 'message_end' && event.message.role === 'assistant') {
|
if (event.type === 'message_end' && event.message.role === 'assistant') {
|
||||||
const assistantMsg = event.message
|
const assistantMsg = event.message
|
||||||
@@ -269,6 +361,29 @@ When creating a file or version, you may attach metadata (for example, the AI mo
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error({ err }, 'Failed to record AI usage')
|
logger.error({ err }, 'Failed to record AI usage')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
totalTokens,
|
||||||
|
)
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
cost,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Failed to record quota usage for AI call')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -281,6 +396,29 @@ When creating a file or version, you may attach metadata (for example, the AI mo
|
|||||||
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
|
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
|
||||||
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
|
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
|
||||||
totalCost = assistantMessage.usage.cost?.total || 0
|
totalCost = assistantMessage.usage.cost?.total || 0
|
||||||
|
|
||||||
|
try {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
grandTotalTokens,
|
||||||
|
)
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
role: effectiveRole,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
totalCost,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Failed to record fallback quota usage for AI call')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionEntries = await session.getEntries()
|
const sessionEntries = await session.getEntries()
|
||||||
@@ -349,6 +487,7 @@ export interface AgentChatParams {
|
|||||||
imageUrls: string[]
|
imageUrls: string[]
|
||||||
projectId: string
|
projectId: string
|
||||||
folderId: string
|
folderId: string
|
||||||
|
assetId?: string
|
||||||
agentsInstruction?: string
|
agentsInstruction?: string
|
||||||
sessionId: string
|
sessionId: string
|
||||||
userId?: string
|
userId?: string
|
||||||
@@ -414,6 +553,7 @@ export async function agentChatActivity(params: AgentChatParams) {
|
|||||||
sessionId,
|
sessionId,
|
||||||
userId: params.userId,
|
userId: params.userId,
|
||||||
projectId: params.projectId,
|
projectId: params.projectId,
|
||||||
|
assetId: params.assetId || params.folderId,
|
||||||
userCommentId: params.userCommentId,
|
userCommentId: params.userCommentId,
|
||||||
context: params.context,
|
context: params.context,
|
||||||
attachedAssets: params.attachedAssets,
|
attachedAssets: params.attachedAssets,
|
||||||
@@ -425,6 +565,8 @@ export interface AutofillAiParams {
|
|||||||
images: string[]
|
images: string[]
|
||||||
fields: AutofillField[]
|
fields: AutofillField[]
|
||||||
context: AgentExecutionContext
|
context: AgentExecutionContext
|
||||||
|
assetId?: string
|
||||||
|
projectId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function autofillAiActivity(params: AutofillAiParams) {
|
export async function autofillAiActivity(params: AutofillAiParams) {
|
||||||
@@ -458,6 +600,8 @@ export async function autofillAiActivity(params: AutofillAiParams) {
|
|||||||
agentsInstruction: '',
|
agentsInstruction: '',
|
||||||
sessionId: undefined,
|
sessionId: undefined,
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
|
projectId: params.projectId,
|
||||||
|
assetId: params.assetId,
|
||||||
tools: [autofillTool],
|
tools: [autofillTool],
|
||||||
context: params.context,
|
context: params.context,
|
||||||
})
|
})
|
||||||
@@ -833,6 +977,8 @@ export async function updateCommentActivity(params: {
|
|||||||
export async function getAgentChatContextActivity(params: {
|
export async function getAgentChatContextActivity(params: {
|
||||||
teamId: string
|
teamId: string
|
||||||
agentId: string
|
agentId: string
|
||||||
|
userId?: string
|
||||||
|
projectId?: string
|
||||||
}): Promise<AgentExecutionContext> {
|
}): Promise<AgentExecutionContext> {
|
||||||
const team = await prisma.team.findUnique({
|
const team = await prisma.team.findUnique({
|
||||||
where: { id: params.teamId },
|
where: { id: params.teamId },
|
||||||
@@ -860,6 +1006,18 @@ export async function getAgentChatContextActivity(params: {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.userId) {
|
||||||
|
const effectiveRole = await resolveEffectiveRole(params.teamId, params.projectId, params.userId)
|
||||||
|
const userLevel = getRoleLevel(effectiveRole)
|
||||||
|
const requiredLevel = getAgentRequiredLevel(agent.permission)
|
||||||
|
if (userLevel < requiredLevel) {
|
||||||
|
throw ApplicationFailure.create({
|
||||||
|
message: `Permission denied: Insufficient role to use agent "${params.agentId}". Minimum required role is "${agent.permission}".`,
|
||||||
|
nonRetryable: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!agent.provider) {
|
if (!agent.provider) {
|
||||||
throw ApplicationFailure.create({
|
throw ApplicationFailure.create({
|
||||||
message: 'agent has no provider configured',
|
message: 'agent has no provider configured',
|
||||||
@@ -881,10 +1039,22 @@ export async function getAgentChatContextActivity(params: {
|
|||||||
include: { models: true },
|
include: { models: true },
|
||||||
})
|
})
|
||||||
|
|
||||||
// Only advertise skills that are explicitly enabled for this agent (agent_skills).
|
// Only advertise skills that are explicitly enabled for this agent (agent_skills)
|
||||||
// Disabled skills must not be listed in the system prompt nor loadable via read_skill.
|
// AND permitted for the requesting user's effective role. Disabled or
|
||||||
|
// un-permitted skills must not be listed in the system prompt nor loadable
|
||||||
|
// via read_skill (read_skill keeps its own permission check as a backstop).
|
||||||
const enabledSkills = (agent.skills ?? []).map((as) => as.skill)
|
const enabledSkills = (agent.skills ?? []).map((as) => as.skill)
|
||||||
const enabledSkillIds = enabledSkills.map((s) => s.id)
|
let permittedSkills = enabledSkills
|
||||||
|
if (params.userId) {
|
||||||
|
const effectiveRole = await resolveEffectiveRole(params.teamId, params.projectId, params.userId)
|
||||||
|
if (!effectiveRole) {
|
||||||
|
permittedSkills = []
|
||||||
|
} else {
|
||||||
|
const userLevel = getRoleLevel(effectiveRole)
|
||||||
|
permittedSkills = enabledSkills.filter((s) => (getRoleLevel(s.permission) || 1) <= userLevel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const enabledSkillIds = permittedSkills.map((s) => s.id)
|
||||||
|
|
||||||
// Fetch the agent's assigned MCP servers
|
// Fetch the agent's assigned MCP servers
|
||||||
const assignments = await prisma.agentMcpServer.findMany({
|
const assignments = await prisma.agentMcpServer.findMany({
|
||||||
@@ -901,7 +1071,7 @@ export async function getAgentChatContextActivity(params: {
|
|||||||
return {
|
return {
|
||||||
agent,
|
agent,
|
||||||
dbProviders,
|
dbProviders,
|
||||||
teamSkills: enabledSkills,
|
teamSkills: permittedSkills,
|
||||||
mcpServers,
|
mcpServers,
|
||||||
enabledSkillIds,
|
enabledSkillIds,
|
||||||
allowedDomains,
|
allowedDomains,
|
||||||
@@ -1192,9 +1362,7 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
{ first: limit, after },
|
{ first: limit, after },
|
||||||
)
|
)
|
||||||
|
|
||||||
const stackIds = assets
|
const stackIds = assets.filter((a) => a.type === AssetType.version_stack).map((a) => a.id)
|
||||||
.filter((a) => a.type === AssetType.version_stack && (!a.name || a.name === ''))
|
|
||||||
.map((a) => a.id)
|
|
||||||
|
|
||||||
const latestVersionsMap = new Map<string, Prisma.AssetGetPayload<Record<string, never>>>()
|
const latestVersionsMap = new Map<string, Prisma.AssetGetPayload<Record<string, never>>>()
|
||||||
|
|
||||||
@@ -1215,10 +1383,7 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
const latestVersion = latestVersionsMap.get(a.id)
|
const latestVersion = latestVersionsMap.get(a.id)
|
||||||
return {
|
return {
|
||||||
id: a.id,
|
id: a.id,
|
||||||
name:
|
name: a.type === AssetType.version_stack ? (latestVersion?.name ?? a.name) : a.name,
|
||||||
a.type === AssetType.version_stack && (!a.name || a.name === '')
|
|
||||||
? (latestVersion?.name ?? a.name)
|
|
||||||
: a.name,
|
|
||||||
type: a.type,
|
type: a.type,
|
||||||
size:
|
size:
|
||||||
a.type === AssetType.version_stack && latestVersion
|
a.type === AssetType.version_stack && latestVersion
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from './index'
|
} from './index'
|
||||||
import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
||||||
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
|
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
|
||||||
|
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { setupTestDbHooks } from '@shumai/db/test'
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
import { type TSchema } from 'typebox'
|
import { type TSchema } from 'typebox'
|
||||||
@@ -1173,4 +1174,86 @@ describe('createAgentSession enabled skill filtering', () => {
|
|||||||
initializeSpy.mockRestore()
|
initializeSpy.mockRestore()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('enforces agent tool call count quota on tool execution', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Tool Quota Enforcement Team' } })
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Member User', email: 'member-tool-quota@shumai.ai', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: user.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
id: 'tool-quota-agent',
|
||||||
|
name: 'Tool Quota Agent',
|
||||||
|
email: 'tool-quota-agent@shumai.ai',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: 'tool-quota-agent',
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
config: { provider: 'google', model: 'gemini' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: 'read_thread' },
|
||||||
|
limit: 1,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
|
||||||
|
try {
|
||||||
|
const { harness } = await createAgentSession({
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
agentId: 'tool-quota-agent',
|
||||||
|
providerName: 'google',
|
||||||
|
modelId: 'gemini',
|
||||||
|
systemPrompt: 'prompt',
|
||||||
|
teamSkills: [],
|
||||||
|
enabledSkillIds: [],
|
||||||
|
allowedDomains: [],
|
||||||
|
providers: mockProviders,
|
||||||
|
})
|
||||||
|
|
||||||
|
const readThreadTool = harness.getTools().find((t) => t.name === 'read_thread')
|
||||||
|
expect(readThreadTool).toBeDefined()
|
||||||
|
|
||||||
|
// First call executes and consumes quota
|
||||||
|
const res1 = await readThreadTool!.execute(
|
||||||
|
'call-1',
|
||||||
|
{ threadId: 'non-existent' },
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
)
|
||||||
|
expect(res1).toBeDefined()
|
||||||
|
|
||||||
|
// Second call exceeds quota and returns error
|
||||||
|
const res2 = await readThreadTool!.execute(
|
||||||
|
'call-2',
|
||||||
|
{ threadId: 'non-existent' },
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
)
|
||||||
|
expect(res2).toBeDefined()
|
||||||
|
const textContent = res2.content[0]
|
||||||
|
if (textContent && textContent.type === 'text') {
|
||||||
|
expect(textContent.text).toContain('Quota exceeded')
|
||||||
|
} else {
|
||||||
|
expect.unreachable('Expected text content')
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
initializeSpy.mockRestore()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
+62
-22
@@ -9,7 +9,10 @@ import type { Api, Model } from '@earendil-works/pi-ai'
|
|||||||
import { createModels, InMemoryCredentialStore } from '@earendil-works/pi-ai'
|
import { createModels, InMemoryCredentialStore } from '@earendil-works/pi-ai'
|
||||||
import { builtinProviders } from '@earendil-works/pi-ai/providers/all'
|
import { builtinProviders } from '@earendil-works/pi-ai/providers/all'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
import { prisma, type TeamMemberRole } from '@shumai/db'
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
import { quotaService, QuotaExceededError } from '@shumai/core/src/quota/quota-service'
|
||||||
|
import { logger } from '@shumai/core/src/logger'
|
||||||
|
import { prisma } from '@shumai/db'
|
||||||
import { Type, type TSchema } from 'typebox'
|
import { Type, type TSchema } from 'typebox'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
@@ -112,18 +115,6 @@ export interface CreateAgentSessionParams {
|
|||||||
baseDelayMs?: number
|
baseDelayMs?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveTeamMemberRole(
|
|
||||||
teamId: string,
|
|
||||||
userId?: string,
|
|
||||||
): Promise<TeamMemberRole | undefined> {
|
|
||||||
if (!userId) return undefined
|
|
||||||
const member = await prisma.teamMember.findUnique({
|
|
||||||
where: { teamIdUserId: { teamId, userId } },
|
|
||||||
select: { role: true },
|
|
||||||
})
|
|
||||||
return member?.role
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security instructions appended to the system prompt when the requesting user is not a team
|
* Security instructions appended to the system prompt when the requesting user is not a team
|
||||||
* owner (i.e. editor/reviewer). These complement the hard enforcement in the bash tool itself
|
* owner (i.e. editor/reviewer). These complement the hard enforcement in the bash tool itself
|
||||||
@@ -185,6 +176,9 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
blockedHost: '',
|
blockedHost: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const role = userId ? await resolveEffectiveRole(teamId, projectId, userId) : undefined
|
||||||
|
const isOwner = !userId || role === 'owner'
|
||||||
|
const restricted = !isOwner
|
||||||
const sandboxAskCallback = async ({ host }: { host: string; port?: number }) => {
|
const sandboxAskCallback = async ({ host }: { host: string; port?: number }) => {
|
||||||
try {
|
try {
|
||||||
const sandbox = await prisma.sandbox.findUnique({
|
const sandbox = await prisma.sandbox.findUnique({
|
||||||
@@ -217,6 +211,54 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wrapToolWithQuota = (tool: AgentTool): AgentTool => {
|
||||||
|
const originalExecute = tool.execute
|
||||||
|
return {
|
||||||
|
...tool,
|
||||||
|
execute: async (toolCallId, args, signal, onUpdate) => {
|
||||||
|
try {
|
||||||
|
await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId,
|
||||||
|
userId,
|
||||||
|
role,
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: tool.name, toolName: tool.name },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof QuotaExceededError) {
|
||||||
|
return {
|
||||||
|
content: [{ type: 'text', text: `Quota exceeded: ${err.message}` }],
|
||||||
|
details: { error: err.message },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await originalExecute(toolCallId, args, signal, onUpdate)
|
||||||
|
|
||||||
|
try {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId,
|
||||||
|
userId,
|
||||||
|
role,
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: tool.name, toolName: tool.name },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Failed to record quota usage for agent tool call')
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SandboxManager.initialize is a global operation that applies to the entire process.
|
// SandboxManager.initialize is a global operation that applies to the entire process.
|
||||||
// We reset it first to ensure any previous process-global SOCKS/HTTP proxy servers
|
// We reset it first to ensure any previous process-global SOCKS/HTTP proxy servers
|
||||||
// and callbacks are cleaned up, allowing the new callback and allowedDomains to take effect.
|
// and callbacks are cleaned up, allowing the new callback and allowedDomains to take effect.
|
||||||
@@ -242,13 +284,6 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
Object.assign(skillEnvs, envs)
|
Object.assign(skillEnvs, envs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the requesting user's team role to enforce owner-only bash privileges.
|
|
||||||
// A user who is not a member of the team is treated as restricted (fail-closed),
|
|
||||||
// while flows without a user context (e.g. autofill) remain unrestricted.
|
|
||||||
const role = await resolveTeamMemberRole(teamId, userId)
|
|
||||||
const isOwner = !userId || role === 'owner'
|
|
||||||
const restricted = !isOwner
|
|
||||||
|
|
||||||
// Restore env variables from previously loaded skills in this session
|
// Restore env variables from previously loaded skills in this session
|
||||||
let skillLoadedInSession = false
|
let skillLoadedInSession = false
|
||||||
if (sessionId) {
|
if (sessionId) {
|
||||||
@@ -294,6 +329,9 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
const deniedTools = agentConfig?.deniedTools || []
|
const deniedTools = agentConfig?.deniedTools || []
|
||||||
|
|
||||||
const sandboxedBash = createSandboxedBashTool(process.cwd(), skillEnvs, {
|
const sandboxedBash = createSandboxedBashTool(process.cwd(), skillEnvs, {
|
||||||
|
teamId,
|
||||||
|
userId,
|
||||||
|
role,
|
||||||
getBlockedHost: () => sandboxState.blockedHost,
|
getBlockedHost: () => sandboxState.blockedHost,
|
||||||
clearBlockedHost: () => {
|
clearBlockedHost: () => {
|
||||||
sandboxState.blockedHost = ''
|
sandboxState.blockedHost = ''
|
||||||
@@ -314,7 +352,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
bashInjected = true
|
bashInjected = true
|
||||||
// Pass the full post-update tool list as activeToolNames: setTools only updates the
|
// Pass the full post-update tool list as activeToolNames: setTools only updates the
|
||||||
// registry otherwise, and the model would never see the bash tool on the next turn.
|
// registry otherwise, and the model would never see the bash tool on the next turn.
|
||||||
const next = [...harness.getTools(), sandboxedBash]
|
const next = [...harness.getTools(), wrapToolWithQuota(sandboxedBash)]
|
||||||
await harness.setTools(
|
await harness.setTools(
|
||||||
next,
|
next,
|
||||||
next.map((t) => t.name),
|
next.map((t) => t.name),
|
||||||
@@ -325,6 +363,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
onEnvsAdded,
|
onEnvsAdded,
|
||||||
restricted ? onSkillLoaded : undefined,
|
restricted ? onSkillLoaded : undefined,
|
||||||
enabledSkillIds,
|
enabledSkillIds,
|
||||||
|
projectId,
|
||||||
)
|
)
|
||||||
|
|
||||||
const systemTools: AgentTool[] = []
|
const systemTools: AgentTool[] = []
|
||||||
@@ -340,7 +379,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const readThread = createReadThreadTool()
|
const readThread = createReadThreadTool()
|
||||||
const allTools = [
|
const rawTools = [
|
||||||
...mediaTools,
|
...mediaTools,
|
||||||
readSkill,
|
readSkill,
|
||||||
readThread,
|
readThread,
|
||||||
@@ -348,6 +387,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
...systemTools,
|
...systemTools,
|
||||||
...customTools,
|
...customTools,
|
||||||
]
|
]
|
||||||
|
const allTools = rawTools.map((tool) => wrapToolWithQuota(tool))
|
||||||
const enabledTools = disableTools
|
const enabledTools = disableTools
|
||||||
? []
|
? []
|
||||||
: allTools.filter((tool) => !deniedTools.includes(tool.name))
|
: allTools.filter((tool) => !deniedTools.includes(tool.name))
|
||||||
|
|||||||
@@ -307,6 +307,77 @@ describe('readSkillTool', () => {
|
|||||||
reviewerTool.execute('1', { skillId: ownerSkill.id }, undefined, undefined),
|
reviewerTool.execute('1', { skillId: ownerSkill.id }, undefined, undefined),
|
||||||
).rejects.toThrow('Permission denied')
|
).rejects.toThrow('Permission denied')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('uses the effective project role for skill permission checks', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Project Skill Team' } })
|
||||||
|
const project = await prisma.project.create({ data: { name: 'Skill Proj', teamId: team.id } })
|
||||||
|
const editorSkill = await prisma.skill.create({
|
||||||
|
data: {
|
||||||
|
name: 'Editor Project Skill',
|
||||||
|
assetId: 'asset1',
|
||||||
|
hash: 'proj-editor-hash',
|
||||||
|
teamId: team.id,
|
||||||
|
permission: 'editor',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team editor demoted to project reviewer: denied inside the project
|
||||||
|
const demoted = await prisma.user.create({
|
||||||
|
data: { name: 'Demoted Skill', email: 'dem-skill@test.com' },
|
||||||
|
})
|
||||||
|
const demotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: demoted.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: demotedTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const demotedTool = createReadSkillTool(
|
||||||
|
demoted.id,
|
||||||
|
() => {},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
project.id,
|
||||||
|
)
|
||||||
|
await expect(
|
||||||
|
demotedTool.execute('1', { skillId: editorSkill.id }, undefined, undefined),
|
||||||
|
).rejects.toThrow('Permission denied')
|
||||||
|
|
||||||
|
// Project-scoped member invited as editor: allowed
|
||||||
|
const projEditor = await prisma.user.create({
|
||||||
|
data: { name: 'PE Skill', email: 'pe-skill@test.com' },
|
||||||
|
})
|
||||||
|
const projEditorTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: projEditor.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: projEditorTm.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
vi.spyOn(fs, 'existsSync').mockReturnValue(true)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mocking node fs calls
|
||||||
|
vi.spyOn(fs, 'readFileSync').mockImplementation((path: any) => {
|
||||||
|
if (path.toString().endsWith('.hash')) return 'proj-editor-hash'
|
||||||
|
if (path.toString().endsWith('SKILL.md')) return '# Editor Project Skill Content'
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const projEditorTool = createReadSkillTool(
|
||||||
|
projEditor.id,
|
||||||
|
() => {},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
project.id,
|
||||||
|
)
|
||||||
|
const result = await projEditorTool.execute(
|
||||||
|
'1',
|
||||||
|
{ skillId: editorSkill.id },
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
expect((result.content[0] as any).text).toBe('# Editor Project Skill Content')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('onSkillLoaded callback', () => {
|
describe('onSkillLoaded callback', () => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { prisma } from '@shumai/db'
|
|||||||
import { Type } from 'typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
|
||||||
const readSkillSchema = Type.Object({
|
const readSkillSchema = Type.Object({
|
||||||
skillId: Type.String({ description: 'The ID of the skill to read' }),
|
skillId: Type.String({ description: 'The ID of the skill to read' }),
|
||||||
@@ -18,6 +19,7 @@ export const createReadSkillTool = (
|
|||||||
onEnvsAdded: (envs: Record<string, string>) => void,
|
onEnvsAdded: (envs: Record<string, string>) => void,
|
||||||
onSkillLoaded?: () => Promise<void> | void,
|
onSkillLoaded?: () => Promise<void> | void,
|
||||||
enabledSkillIds?: string[],
|
enabledSkillIds?: string[],
|
||||||
|
projectId?: string,
|
||||||
): AgentTool<typeof readSkillSchema, { skillId: string }> => ({
|
): AgentTool<typeof readSkillSchema, { skillId: string }> => ({
|
||||||
name: 'read_skill',
|
name: 'read_skill',
|
||||||
label: 'Read Agent Skill',
|
label: 'Read Agent Skill',
|
||||||
@@ -39,17 +41,14 @@ export const createReadSkillTool = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const requiredLevel = ROLE_HIERARCHY[skill.permission] || 1
|
const requiredLevel = ROLE_HIERARCHY[skill.permission] || 1
|
||||||
|
const effectiveRole = userId
|
||||||
|
? await resolveEffectiveRole(skill.teamId, projectId, userId)
|
||||||
|
: null
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
const member = await prisma.teamMember.findUnique({
|
// Resolve the user's effective role for the project context (project
|
||||||
where: {
|
// override wins; project-scoped members without project access are denied).
|
||||||
teamIdUserId: {
|
const userLevel = effectiveRole ? ROLE_HIERARCHY[effectiveRole] || 0 : 0
|
||||||
teamId: skill.teamId,
|
|
||||||
userId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const userLevel = member ? ROLE_HIERARCHY[member.role] || 0 : 0
|
|
||||||
if (userLevel < requiredLevel) {
|
if (userLevel < requiredLevel) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Permission denied: Insufficient role to load skill "${skill.name}". Minimum required role is "${skill.permission}".`,
|
`Permission denied: Insufficient role to load skill "${skill.name}". Minimum required role is "${skill.permission}".`,
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import {
|
|||||||
formatSize,
|
formatSize,
|
||||||
type TruncationResult,
|
type TruncationResult,
|
||||||
} from '../utils/truncate'
|
} from '../utils/truncate'
|
||||||
|
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||||
|
import type { TeamMemberRole } from '@shumai/db'
|
||||||
|
|
||||||
const BashSource = Type.String({
|
const BashSource = Type.String({
|
||||||
enum: ['user', 'skill'],
|
enum: ['user', 'skill'],
|
||||||
@@ -33,6 +35,9 @@ export interface BashDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SandboxedBashOptions {
|
export interface SandboxedBashOptions {
|
||||||
|
teamId?: string
|
||||||
|
userId?: string
|
||||||
|
role?: TeamMemberRole | null
|
||||||
getBlockedHost?: () => string
|
getBlockedHost?: () => string
|
||||||
clearBlockedHost?: () => void
|
clearBlockedHost?: () => void
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +71,18 @@ export const createSandboxedBashTool = (
|
|||||||
'Only commands required by a loaded skill (source="skill") can be executed.',
|
'Only commands required by a loaded skill (source="skill") can be executed.',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (options?.teamId) {
|
||||||
|
await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: options.teamId,
|
||||||
|
userId: options.userId,
|
||||||
|
role: options.role,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
}
|
||||||
options?.clearBlockedHost?.()
|
options?.clearBlockedHost?.()
|
||||||
const wrappedCommand = await SandboxManager.wrapWithSandbox(command)
|
const wrappedCommand = await SandboxManager.wrapWithSandbox(command)
|
||||||
|
|
||||||
@@ -219,6 +236,23 @@ export const createSandboxedBashTool = (
|
|||||||
const snapshot = await finishOutput()
|
const snapshot = await finishOutput()
|
||||||
const { text: outputText, details: truncationDetails } = formatOutput(snapshot)
|
const { text: outputText, details: truncationDetails } = formatOutput(snapshot)
|
||||||
|
|
||||||
|
if (options?.teamId) {
|
||||||
|
try {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: options.teamId,
|
||||||
|
userId: options.userId,
|
||||||
|
role: options.role,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Failed to record quota usage for bash command')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (signal?.aborted) {
|
if (signal?.aborted) {
|
||||||
logger.error({ command, outputText }, 'Sandboxed bash command aborted')
|
logger.error({ command, outputText }, 'Sandboxed bash command aborted')
|
||||||
reject(new Error(appendStatus(outputText, 'Command aborted')))
|
reject(new Error(appendStatus(outputText, 'Command aborted')))
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||||
mockActivities.getAssetActivity.mockResolvedValue({
|
mockActivities.getAssetActivity.mockResolvedValue({
|
||||||
id: 'a1',
|
id: 'a1',
|
||||||
|
projectId: 'p1',
|
||||||
storageKey: { key: 'asset-key' },
|
storageKey: { key: 'asset-key' },
|
||||||
project: { id: 'p1', teamId: 't1' },
|
project: { id: 'p1', teamId: 't1' },
|
||||||
mediaType: 'image/png',
|
mediaType: 'image/png',
|
||||||
@@ -117,6 +118,9 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
status: 'processing',
|
status: 'processing',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Verify asset fetched
|
||||||
|
expect(mockActivities.getAssetActivity).toHaveBeenCalledWith('a1')
|
||||||
|
|
||||||
// Verify placeholder comment created
|
// Verify placeholder comment created
|
||||||
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
||||||
assetId: 'a1',
|
assetId: 'a1',
|
||||||
@@ -143,6 +147,8 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
// Verify AI autofill called with mapped fields
|
// Verify AI autofill called with mapped fields
|
||||||
expect(mockActivities.autofillAiActivity).toHaveBeenCalledWith({
|
expect(mockActivities.autofillAiActivity).toHaveBeenCalledWith({
|
||||||
teamId: 't1',
|
teamId: 't1',
|
||||||
|
assetId: 'a1',
|
||||||
|
projectId: 'p1',
|
||||||
images: ['/tmp/test-dir/1.webp'],
|
images: ['/tmp/test-dir/1.webp'],
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
|||||||
const aiResult = await executeActivity(agentWorkerQueue, autofillAiActivity, {
|
const aiResult = await executeActivity(agentWorkerQueue, autofillAiActivity, {
|
||||||
teamId,
|
teamId,
|
||||||
images: generatedFiles,
|
images: generatedFiles,
|
||||||
|
assetId: asset.id,
|
||||||
|
projectId: asset.projectId ?? undefined,
|
||||||
fields: fields.map(
|
fields: fields.map(
|
||||||
(f: { key: string; config: Record<string, unknown>; description?: string | null }) => ({
|
(f: { key: string; config: Record<string, unknown>; description?: string | null }) => ({
|
||||||
id: f.key,
|
id: f.key,
|
||||||
|
|||||||
@@ -118,6 +118,15 @@ describe('Agent Chat Workflow', () => {
|
|||||||
// Verify comment context fetched
|
// Verify comment context fetched
|
||||||
expect(mockActivities.getCommentActivity).toHaveBeenCalledWith('c1')
|
expect(mockActivities.getCommentActivity).toHaveBeenCalledWith('c1')
|
||||||
|
|
||||||
|
// Verify agent context fetched with the project context forwarded
|
||||||
|
// (required for project-aware role enforcement in the activity)
|
||||||
|
expect(mockActivities.getAgentChatContextActivity).toHaveBeenCalledWith({
|
||||||
|
teamId: 't1',
|
||||||
|
agentId: 'b1',
|
||||||
|
userId: undefined,
|
||||||
|
projectId: 'p1',
|
||||||
|
})
|
||||||
|
|
||||||
// Verify placeholder comment created
|
// Verify placeholder comment created
|
||||||
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
||||||
assetId: 'a1',
|
assetId: 'a1',
|
||||||
@@ -150,6 +159,7 @@ describe('Agent Chat Workflow', () => {
|
|||||||
agentsInstruction: expectedInstruction1,
|
agentsInstruction: expectedInstruction1,
|
||||||
sessionId: 'session-123',
|
sessionId: 'session-123',
|
||||||
folderId: 'parent-folder-id',
|
folderId: 'parent-folder-id',
|
||||||
|
assetId: 'a1',
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
|||||||
const context = await executeActivity(agentWorkerQueue, getAgentChatContextActivity, {
|
const context = await executeActivity(agentWorkerQueue, getAgentChatContextActivity, {
|
||||||
teamId,
|
teamId,
|
||||||
agentId: agentId,
|
agentId: agentId,
|
||||||
|
userId: payload.agent?.userId,
|
||||||
|
projectId: payload.projectId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const pathContext = await executeActivity(
|
const pathContext = await executeActivity(
|
||||||
@@ -202,6 +204,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
|||||||
imageUrls: attachmentImageUrls,
|
imageUrls: attachmentImageUrls,
|
||||||
projectId: payload.projectId,
|
projectId: payload.projectId,
|
||||||
folderId,
|
folderId,
|
||||||
|
assetId: asset.id,
|
||||||
agentsInstruction: instruction,
|
agentsInstruction: instruction,
|
||||||
sessionId,
|
sessionId,
|
||||||
userId: payload.agent?.userId,
|
userId: payload.agent?.userId,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/api",
|
"name": "@shumai/api",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||||
|
import { HTTPException } from 'hono/http-exception'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
import { authzService } from '@shumai/core/src/authz/authz'
|
import { authzService } from '@shumai/core/src/authz/authz'
|
||||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||||
|
import type { AgentInfo } from '@shumai/dtos'
|
||||||
import app from './agent'
|
import app from './agent'
|
||||||
|
|
||||||
vi.mock('@shumai/core/src/agent/agent')
|
vi.mock('@shumai/core/src/agent/agent')
|
||||||
@@ -12,6 +14,24 @@ vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shape of the agent rows returned by the (mocked) service methods. Mirrors
|
||||||
|
* the real AgentInfoSource consumed by AgentService.toAgentInfo.
|
||||||
|
*/
|
||||||
|
interface MockAgentRow {
|
||||||
|
id: string
|
||||||
|
user: { name: string; image?: string | null }
|
||||||
|
type: string
|
||||||
|
enabled?: boolean
|
||||||
|
permission?: string
|
||||||
|
providerId?: string | null
|
||||||
|
modelId?: string | null
|
||||||
|
soul?: string | null
|
||||||
|
config?: { thinkingLevel?: string; systemPrompt?: string; deniedTools?: string[] }
|
||||||
|
skills?: Array<{ id: string; skillId: string; skill?: { id: string; name: string } }>
|
||||||
|
mcpServers?: Array<{ mcpServerId: string }>
|
||||||
|
}
|
||||||
|
|
||||||
describe('Agent API', () => {
|
describe('Agent API', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks()
|
vi.clearAllMocks()
|
||||||
@@ -20,6 +40,32 @@ describe('Agent API', () => {
|
|||||||
id: 'agent1',
|
id: 'agent1',
|
||||||
teamId: 'team1',
|
teamId: 'team1',
|
||||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||||
|
|
||||||
|
// The route delegates AgentInfo mapping to the service; replicate the real
|
||||||
|
// mapping so response assertions keep working.
|
||||||
|
vi.mocked(agentService.toAgentInfo).mockImplementation(async (agent) => {
|
||||||
|
const config = agent.config as MockAgentRow['config']
|
||||||
|
return {
|
||||||
|
id: agent.id,
|
||||||
|
name: agent.user.name,
|
||||||
|
type: agent.type,
|
||||||
|
enabled: agent.enabled ?? true,
|
||||||
|
permission: agent.permission ?? 'reviewer',
|
||||||
|
avatar: agent.user.image || undefined,
|
||||||
|
providerId: agent.providerId || undefined,
|
||||||
|
modelId: agent.modelId || undefined,
|
||||||
|
thinkingLevel: config?.thinkingLevel || 'off',
|
||||||
|
systemPrompt: config?.systemPrompt,
|
||||||
|
soul: agent.soul || undefined,
|
||||||
|
skills: (agent.skills || []).map((s) => ({
|
||||||
|
id: s.id,
|
||||||
|
skillId: s.skillId,
|
||||||
|
skill: s.skill,
|
||||||
|
})),
|
||||||
|
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
||||||
|
deniedTools: config?.deniedTools || [],
|
||||||
|
} as unknown as AgentInfo
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('GET /teams/:teamId/agents', () => {
|
describe('GET /teams/:teamId/agents', () => {
|
||||||
@@ -183,6 +229,63 @@ describe('Agent API', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('PATCH /agents/:agentId/permission', () => {
|
||||||
|
it('updates agent permission when user is admin', async () => {
|
||||||
|
const mockAgent = {
|
||||||
|
id: 'agent1',
|
||||||
|
teamId: 'team1',
|
||||||
|
user: { name: 'Bot 1', image: 'avatar1' },
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
permission: 'owner',
|
||||||
|
config: {
|
||||||
|
provider: 'prov1',
|
||||||
|
model: 'model1',
|
||||||
|
},
|
||||||
|
skills: [],
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
vi.mocked(agentService.updateAgentPermission).mockResolvedValue(mockAgent as any)
|
||||||
|
|
||||||
|
const res = await app.request('/agents/agent1/permission', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ permission: 'owner' }),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const data = await res.json()
|
||||||
|
expect(data.permission).toBe('owner')
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: undefined,
|
||||||
|
permission: 'Admin',
|
||||||
|
type: 'agent',
|
||||||
|
id: 'agent1',
|
||||||
|
})
|
||||||
|
expect(agentService.updateAgentPermission).toHaveBeenCalledWith('agent1', 'owner')
|
||||||
|
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||||
|
action: 'agent_update',
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: undefined,
|
||||||
|
itemId: 'agent1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('denies access when user is not admin', async () => {
|
||||||
|
vi.mocked(authzService.hasPermission).mockRejectedValue(
|
||||||
|
new HTTPException(403, { message: 'Forbidden' }),
|
||||||
|
)
|
||||||
|
|
||||||
|
const res = await app.request('/agents/agent1/permission', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ permission: 'owner' }),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(403)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('GET /agent-sessions/:sessionId/entries', () => {
|
describe('GET /agent-sessions/:sessionId/entries', () => {
|
||||||
it('returns entries of agent session if user is admin', async () => {
|
it('returns entries of agent session if user is admin', async () => {
|
||||||
const mockEntries = [
|
const mockEntries = [
|
||||||
@@ -258,4 +361,53 @@ describe('Agent API', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('GET /projects/:projectId/chat-agents', () => {
|
||||||
|
it('returns project-scoped chat agents for the user', async () => {
|
||||||
|
const mockAgents = [
|
||||||
|
{
|
||||||
|
id: 'agent1',
|
||||||
|
name: 'Chat Bot',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
permission: 'reviewer',
|
||||||
|
skills: [],
|
||||||
|
mcpServerIds: [],
|
||||||
|
deniedTools: [],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
vi.mocked(agentService.listProjectChatAgents).mockResolvedValue(
|
||||||
|
mockAgents as unknown as Awaited<ReturnType<typeof agentService.listProjectChatAgents>>,
|
||||||
|
)
|
||||||
|
|
||||||
|
const res = await app.request('/projects/project1/chat-agents', {
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const data = await res.json()
|
||||||
|
expect(data).toHaveLength(1)
|
||||||
|
expect(data[0].name).toBe('Chat Bot')
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: undefined,
|
||||||
|
permission: 'Read',
|
||||||
|
type: 'project',
|
||||||
|
id: 'project1',
|
||||||
|
})
|
||||||
|
expect(agentService.listProjectChatAgents).toHaveBeenCalledWith('project1', undefined)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('denies access when the user has no project access', async () => {
|
||||||
|
vi.mocked(authzService.hasPermission).mockRejectedValue(
|
||||||
|
new HTTPException(403, { message: 'Forbidden' }),
|
||||||
|
)
|
||||||
|
|
||||||
|
const res = await app.request('/projects/project1/chat-agents', {
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(403)
|
||||||
|
expect(agentService.listProjectChatAgents).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
+48
-65
@@ -2,13 +2,12 @@ import { Hono } from 'hono'
|
|||||||
import { zValidator } from '@hono/zod-validator'
|
import { zValidator } from '@hono/zod-validator'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
|
||||||
import {
|
import {
|
||||||
createAgentRequestSchema,
|
createAgentRequestSchema,
|
||||||
updateAgentRequestSchema,
|
updateAgentRequestSchema,
|
||||||
|
updateAgentPermissionRequestSchema,
|
||||||
paginationParamsSchema,
|
paginationParamsSchema,
|
||||||
AgentInfo,
|
AgentInfo,
|
||||||
AgentType,
|
|
||||||
AuditAction,
|
AuditAction,
|
||||||
} from '@shumai/dtos'
|
} from '@shumai/dtos'
|
||||||
|
|
||||||
@@ -29,35 +28,28 @@ const route = new Hono<{ Variables: { user: User } }>()
|
|||||||
id: teamId,
|
id: teamId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const agents = await agentService.listAgents({ teamId })
|
const agents = await agentService.listAgents({ teamId, userId: userReq?.id })
|
||||||
|
|
||||||
const res: AgentInfo[] = await Promise.all(
|
const res: AgentInfo[] = await Promise.all(
|
||||||
agents.map(async (agent) => {
|
agents.map((agent) => agentService.toAgentInfo(agent)),
|
||||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
|
||||||
return {
|
|
||||||
id: agent.id,
|
|
||||||
name: agent.user.name,
|
|
||||||
type: agent.type as AgentType,
|
|
||||||
enabled: agent.enabled,
|
|
||||||
avatar: (await getAvatarUrl(agent.user.image)) || undefined,
|
|
||||||
providerId: agent.providerId || undefined,
|
|
||||||
modelId: agent.modelId || undefined,
|
|
||||||
thinkingLevel: config.thinkingLevel || 'off',
|
|
||||||
systemPrompt: config.systemPrompt,
|
|
||||||
soul: agent.soul || undefined,
|
|
||||||
skills: agent.skills.map((s) => ({
|
|
||||||
id: s.id,
|
|
||||||
skillId: s.skillId,
|
|
||||||
skill: s.skill,
|
|
||||||
})),
|
|
||||||
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
|
||||||
deniedTools: config.deniedTools || [],
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return c.json(res, 200)
|
return c.json(res, 200)
|
||||||
})
|
})
|
||||||
|
.get('/projects/:projectId/chat-agents', async (c) => {
|
||||||
|
const projectId = c.req.param('projectId')
|
||||||
|
const userReq = c.get('user')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user: userReq,
|
||||||
|
permission: Permission.Read,
|
||||||
|
type: ResourceType.Project,
|
||||||
|
id: projectId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const agents = await agentService.listProjectChatAgents(projectId, userReq?.id)
|
||||||
|
return c.json(agents, 200)
|
||||||
|
})
|
||||||
.post('/teams/:teamId/agents', zValidator('json', createAgentRequestSchema), async (c) => {
|
.post('/teams/:teamId/agents', zValidator('json', createAgentRequestSchema), async (c) => {
|
||||||
const teamId = c.req.param('teamId')
|
const teamId = c.req.param('teamId')
|
||||||
const userReq = c.get('user')
|
const userReq = c.get('user')
|
||||||
@@ -77,26 +69,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
|||||||
|
|
||||||
if (!agent) throw new Error('failed to create agent')
|
if (!agent) throw new Error('failed to create agent')
|
||||||
|
|
||||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
const info = await agentService.toAgentInfo(agent)
|
||||||
const info: AgentInfo = {
|
|
||||||
id: agent.id,
|
|
||||||
name: agent.user.name,
|
|
||||||
type: agent.type as AgentType,
|
|
||||||
enabled: agent.enabled,
|
|
||||||
avatar: (await getAvatarUrl(agent.user.image)) || undefined,
|
|
||||||
providerId: agent.providerId || undefined,
|
|
||||||
modelId: agent.modelId || undefined,
|
|
||||||
thinkingLevel: config.thinkingLevel || 'off',
|
|
||||||
systemPrompt: config.systemPrompt,
|
|
||||||
soul: agent.soul || undefined,
|
|
||||||
skills: agent.skills.map((s) => ({
|
|
||||||
id: s.id,
|
|
||||||
skillId: s.skillId,
|
|
||||||
skill: s.skill,
|
|
||||||
})),
|
|
||||||
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
|
||||||
deniedTools: config.deniedTools || [],
|
|
||||||
}
|
|
||||||
|
|
||||||
await auditLogService.logAction({
|
await auditLogService.logAction({
|
||||||
action: AuditAction.agent_create,
|
action: AuditAction.agent_create,
|
||||||
@@ -131,29 +104,39 @@ const route = new Hono<{ Variables: { user: User } }>()
|
|||||||
itemId: agent.id,
|
itemId: agent.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
const info = await agentService.toAgentInfo(agent)
|
||||||
const info: AgentInfo = {
|
|
||||||
id: agent.id,
|
|
||||||
name: agent.user.name,
|
|
||||||
type: agent.type as AgentType,
|
|
||||||
enabled: agent.enabled,
|
|
||||||
avatar: (await getAvatarUrl(agent.user.image)) || undefined,
|
|
||||||
providerId: agent.providerId || undefined,
|
|
||||||
modelId: agent.modelId || undefined,
|
|
||||||
thinkingLevel: config.thinkingLevel || 'off',
|
|
||||||
systemPrompt: config.systemPrompt,
|
|
||||||
soul: agent.soul || undefined,
|
|
||||||
skills: agent.skills.map((s) => ({
|
|
||||||
id: s.id,
|
|
||||||
skillId: s.skillId,
|
|
||||||
skill: s.skill,
|
|
||||||
})),
|
|
||||||
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
|
||||||
deniedTools: config.deniedTools || [],
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.json(info, 200)
|
return c.json(info, 200)
|
||||||
})
|
})
|
||||||
|
.patch(
|
||||||
|
'/agents/:agentId/permission',
|
||||||
|
zValidator('json', updateAgentPermissionRequestSchema),
|
||||||
|
async (c) => {
|
||||||
|
const agentId = c.req.param('agentId')
|
||||||
|
const userReq = c.get('user')
|
||||||
|
const req = c.req.valid('json')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user: userReq,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Agent,
|
||||||
|
id: agentId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const agent = await agentService.updateAgentPermission(agentId, req.permission)
|
||||||
|
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.agent_update,
|
||||||
|
teamId: agent.teamId,
|
||||||
|
userId: userReq?.id,
|
||||||
|
itemId: agent.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
const info = await agentService.toAgentInfo(agent)
|
||||||
|
|
||||||
|
return c.json(info, 200)
|
||||||
|
},
|
||||||
|
)
|
||||||
.delete('/agents/:agentId', async (c) => {
|
.delete('/agents/:agentId', async (c) => {
|
||||||
const agentId = c.req.param('agentId')
|
const agentId = c.req.param('agentId')
|
||||||
const userReq = c.get('user')
|
const userReq = c.get('user')
|
||||||
|
|||||||
@@ -310,4 +310,59 @@ describe('folder api', () => {
|
|||||||
beforeIndex: 'index-1',
|
beforeIndex: 'index-1',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('GET /folders/:folderId/agentsmd', async () => {
|
||||||
|
vi.spyOn(assetService, 'getAgentsMd').mockResolvedValue('# Folder Guidelines')
|
||||||
|
|
||||||
|
const app = new Hono().use('*', authMiddleware).route('/', folderRoute)
|
||||||
|
const res = await app.request('/folders/test-id/agentsmd')
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const json = await res.json()
|
||||||
|
expect(json.content).toBe('# Folder Guidelines')
|
||||||
|
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: { id: 'user1', name: 'Test User' },
|
||||||
|
permission: Permission.Read,
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: 'test-id',
|
||||||
|
})
|
||||||
|
expect(assetService.getAgentsMd).toHaveBeenCalledWith('test-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('PATCH /folders/:folderId/agentsmd', async () => {
|
||||||
|
vi.spyOn(assetService, 'updateAgentsMd').mockResolvedValue({ content: '# Updated Guidelines' })
|
||||||
|
|
||||||
|
const app = new Hono().use('*', authMiddleware).route('/', folderRoute)
|
||||||
|
const res = await app.request('/folders/test-id/agentsmd', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ content: '# Updated Guidelines' }),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const json = await res.json()
|
||||||
|
expect(json.content).toBe('# Updated Guidelines')
|
||||||
|
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: { id: 'user1', name: 'Test User' },
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: 'test-id',
|
||||||
|
})
|
||||||
|
expect(assetService.updateAgentsMd).toHaveBeenCalledWith('test-id', '# Updated Guidelines')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('PATCH /folders/:folderId/agentsmd rejects oversized content', async () => {
|
||||||
|
const mockUpdate = vi.spyOn(assetService, 'updateAgentsMd').mockResolvedValue({ content: '' })
|
||||||
|
const app = new Hono().use('*', authMiddleware).route('/', folderRoute)
|
||||||
|
const res = await app.request('/folders/test-id/agentsmd', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ content: 'x'.repeat(100_001) }),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(400)
|
||||||
|
expect(mockUpdate).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
updateFolderRequestSchema,
|
updateFolderRequestSchema,
|
||||||
deleteFoldersRequestSchema,
|
deleteFoldersRequestSchema,
|
||||||
restoreFoldersRequestSchema,
|
restoreFoldersRequestSchema,
|
||||||
|
updateAgentsMdRequestSchema,
|
||||||
} from '@shumai/dtos'
|
} from '@shumai/dtos'
|
||||||
import { listChildrenRequestSchema, updateAssetOrderRequestSchema, AuditAction } from '@shumai/dtos'
|
import { listChildrenRequestSchema, updateAssetOrderRequestSchema, AuditAction } from '@shumai/dtos'
|
||||||
import { searchRequestSchema } from '@shumai/dtos'
|
import { searchRequestSchema } from '@shumai/dtos'
|
||||||
@@ -189,5 +190,48 @@ const route = new Hono<{ Variables: { user: User } }>()
|
|||||||
const result = await searchService.search(folderId, req)
|
const result = await searchService.search(folderId, req)
|
||||||
return c.json(result)
|
return c.json(result)
|
||||||
})
|
})
|
||||||
|
.get('/folders/:folderId/agentsmd', async (c) => {
|
||||||
|
const folderId = c.req.param('folderId')
|
||||||
|
const user = c.get('user')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Read,
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: folderId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const content = await assetService.getAgentsMd(folderId)
|
||||||
|
return c.json({ content })
|
||||||
|
})
|
||||||
|
.patch(
|
||||||
|
'/folders/:folderId/agentsmd',
|
||||||
|
zValidator('json', updateAgentsMdRequestSchema),
|
||||||
|
async (c) => {
|
||||||
|
const folderId = c.req.param('folderId')
|
||||||
|
const user = c.get('user')
|
||||||
|
const req = c.req.valid('json')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: folderId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const res = await assetService.updateAgentsMd(folderId, req.content)
|
||||||
|
|
||||||
|
const ctx = await assetService.getAssetContext(folderId)
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.folder_update,
|
||||||
|
teamId: ctx.teamId,
|
||||||
|
userId: user.id,
|
||||||
|
projectId: ctx.projectId,
|
||||||
|
itemId: folderId,
|
||||||
|
})
|
||||||
|
|
||||||
|
return c.json(res)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
export default route
|
export default route
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import s3Route from './s3'
|
|||||||
import shareRoute from './share'
|
import shareRoute from './share'
|
||||||
import skillRoute from './skill'
|
import skillRoute from './skill'
|
||||||
import watermarkTemplateRoute from './watermark-template'
|
import watermarkTemplateRoute from './watermark-template'
|
||||||
|
import quotaRoute from './quota'
|
||||||
import teamRoute from './team'
|
import teamRoute from './team'
|
||||||
import uploadRoute, { localUploadRoute } from './upload'
|
import uploadRoute, { localUploadRoute } from './upload'
|
||||||
import versionStackRoute from './versionStack'
|
import versionStackRoute from './versionStack'
|
||||||
@@ -65,6 +66,7 @@ const apiRoute = new Hono<{ Variables: { user: User } }>()
|
|||||||
.route('/', skillRoute)
|
.route('/', skillRoute)
|
||||||
.route('/', mcpRoute)
|
.route('/', mcpRoute)
|
||||||
.route('/', watermarkTemplateRoute)
|
.route('/', watermarkTemplateRoute)
|
||||||
|
.route('/', quotaRoute)
|
||||||
|
|
||||||
app.route('/files', s3Route)
|
app.route('/files', s3Route)
|
||||||
|
|
||||||
|
|||||||
@@ -264,6 +264,75 @@ describe('project api', () => {
|
|||||||
expect(assetService.emptyTrash).toHaveBeenCalledWith('p1')
|
expect(assetService.emptyTrash).toHaveBeenCalledWith('p1')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('GET /projects/:projectId/members', async () => {
|
||||||
|
vi.mocked(projectService.listProjectMembers).mockResolvedValue([
|
||||||
|
{
|
||||||
|
id: 'user1',
|
||||||
|
name: 'Test User',
|
||||||
|
role: 'editor',
|
||||||
|
type: 'human',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const res = await app.request('/projects/p1/members')
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const json = await res.json()
|
||||||
|
expect(json).toEqual([
|
||||||
|
{
|
||||||
|
id: 'user1',
|
||||||
|
name: 'Test User',
|
||||||
|
role: 'editor',
|
||||||
|
type: 'human',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: expect.anything(),
|
||||||
|
permission: Permission.Read,
|
||||||
|
type: ResourceType.Project,
|
||||||
|
id: 'p1',
|
||||||
|
})
|
||||||
|
expect(projectService.listProjectMembers).toHaveBeenCalledWith({
|
||||||
|
projectId: 'p1',
|
||||||
|
includeAgents: false,
|
||||||
|
requesterUserId: 'user1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('GET /projects/:projectId/members?includeAgents=true', async () => {
|
||||||
|
vi.mocked(projectService.listProjectMembers).mockResolvedValue([
|
||||||
|
{
|
||||||
|
id: 'user1',
|
||||||
|
name: 'Test User',
|
||||||
|
role: 'editor',
|
||||||
|
type: 'human',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'agent1',
|
||||||
|
name: 'Agent Bot',
|
||||||
|
role: 'bot',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const res = await app.request('/projects/p1/members?includeAgents=true')
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
const json = await res.json()
|
||||||
|
expect(json).toHaveLength(2)
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
|
user: expect.anything(),
|
||||||
|
permission: Permission.Read,
|
||||||
|
type: ResourceType.Project,
|
||||||
|
id: 'p1',
|
||||||
|
})
|
||||||
|
expect(projectService.listProjectMembers).toHaveBeenCalledWith({
|
||||||
|
projectId: 'p1',
|
||||||
|
includeAgents: true,
|
||||||
|
requesterUserId: 'user1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('POST /projects/:projectId/members', async () => {
|
it('POST /projects/:projectId/members', async () => {
|
||||||
vi.mocked(projectService.addProjectMember).mockResolvedValue(undefined)
|
vi.mocked(projectService.addProjectMember).mockResolvedValue(undefined)
|
||||||
|
|
||||||
|
|||||||
@@ -241,24 +241,10 @@ const route = new Hono<{ Variables: { user: User } }>()
|
|||||||
const members = await projectService.listProjectMembers({
|
const members = await projectService.listProjectMembers({
|
||||||
projectId,
|
projectId,
|
||||||
includeAgents: includeAgents,
|
includeAgents: includeAgents,
|
||||||
|
requesterUserId: user.id,
|
||||||
})
|
})
|
||||||
return c.json(members)
|
return c.json(members)
|
||||||
})
|
})
|
||||||
.get('/projects/:projectId/bots', async (c) => {
|
|
||||||
const projectId = c.req.param('projectId')
|
|
||||||
const user = c.get('user')
|
|
||||||
|
|
||||||
await authzService.hasPermission({
|
|
||||||
user,
|
|
||||||
permission: Permission.Read,
|
|
||||||
type: ResourceType.Project,
|
|
||||||
id: projectId,
|
|
||||||
})
|
|
||||||
|
|
||||||
// STUB: AgentService is not migrated yet.
|
|
||||||
return c.json([])
|
|
||||||
})
|
|
||||||
|
|
||||||
.post(
|
.post(
|
||||||
'/projects/:projectId/reparent',
|
'/projects/:projectId/reparent',
|
||||||
zValidator('json', reparentAssetsRequestSchema),
|
zValidator('json', reparentAssetsRequestSchema),
|
||||||
|
|||||||
@@ -0,0 +1,311 @@
|
|||||||
|
import { describe, expect, test, vi, beforeEach } from 'vitest'
|
||||||
|
import { Hono } from 'hono'
|
||||||
|
import quotaRoute from './quota'
|
||||||
|
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||||
|
import { authMiddleware } from './middleware/auth'
|
||||||
|
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
|
||||||
|
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||||
|
import { AuditAction } from '@shumai/dtos'
|
||||||
|
|
||||||
|
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||||
|
auditLogService: {
|
||||||
|
logAction: vi.fn().mockResolvedValue({}),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('@shumai/core/src/quota/quota-service', () => ({
|
||||||
|
quotaService: {
|
||||||
|
listRules: vi.fn(),
|
||||||
|
createRule: vi.fn(),
|
||||||
|
getRule: vi.fn(),
|
||||||
|
listRuleRecords: vi.fn(),
|
||||||
|
resetRecord: vi.fn(),
|
||||||
|
updateRule: vi.fn(),
|
||||||
|
deleteRule: vi.fn(),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('./middleware/auth', () => ({
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
authMiddleware: async (c: any, next: any) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
c.set('user', { id: 'user1', name: 'Test User' } as any)
|
||||||
|
await next()
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||||
|
authzService: {
|
||||||
|
hasPermission: vi.fn().mockResolvedValue(undefined),
|
||||||
|
},
|
||||||
|
Permission: {
|
||||||
|
Read: 'Read',
|
||||||
|
Edit: 'Edit',
|
||||||
|
Admin: 'Admin',
|
||||||
|
},
|
||||||
|
ResourceType: {
|
||||||
|
Team: 'team',
|
||||||
|
QuotaRule: 'quotaRule',
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('Quota API', () => {
|
||||||
|
const app = new Hono().use('*', authMiddleware).route('/', quotaRoute)
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.restoreAllMocks()
|
||||||
|
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('GET /teams/:teamId/quotas', () => {
|
||||||
|
test('Success listing quota rules', async () => {
|
||||||
|
const mockResult = {
|
||||||
|
total: 1,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
id: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
scopeMode: 'all_members' as const,
|
||||||
|
resource: 'agent_total_tokens' as const,
|
||||||
|
limit: 50000,
|
||||||
|
period: '1hour' as const,
|
||||||
|
enabled: true,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'listRules').mockResolvedValue(mockResult)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { Authorization: 'Bearer test' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual(mockResult)
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: 'team1',
|
||||||
|
permission: Permission.Admin,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('POST /teams/:teamId/quotas', () => {
|
||||||
|
test('Success creating rule with audit log', async () => {
|
||||||
|
const mockRule = {
|
||||||
|
id: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
scopeMode: 'all_members' as const,
|
||||||
|
resource: 'agent_total_tokens' as const,
|
||||||
|
limit: 100000,
|
||||||
|
period: '1day' as const,
|
||||||
|
enabled: true,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'createRule').mockResolvedValue(mockRule)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer test',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 100000,
|
||||||
|
period: '1day',
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(201)
|
||||||
|
expect(await res.json()).toEqual(mockRule)
|
||||||
|
expect(quotaService.createRule).toHaveBeenCalledWith('team1', {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 100000,
|
||||||
|
period: '1day',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||||
|
action: AuditAction.quota_rule_create,
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: 'user1',
|
||||||
|
itemId: 'rule1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('GET /teams/:teamId/quotas/:id', () => {
|
||||||
|
test('Success fetching single rule', async () => {
|
||||||
|
const mockRule = {
|
||||||
|
id: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
scopeMode: 'all_members' as const,
|
||||||
|
resource: 'agent_cost' as const,
|
||||||
|
limit: 50,
|
||||||
|
period: '1day' as const,
|
||||||
|
enabled: true,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'getRule').mockResolvedValue(mockRule)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { Authorization: 'Bearer test' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual(mockRule)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('GET /teams/:teamId/quotas/:id/records', () => {
|
||||||
|
test('Success listing records for a rule', async () => {
|
||||||
|
const mockRecordsResult = {
|
||||||
|
total: 1,
|
||||||
|
records: [
|
||||||
|
{
|
||||||
|
id: 'rec1',
|
||||||
|
ruleId: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: null,
|
||||||
|
user: null,
|
||||||
|
periodStart: null,
|
||||||
|
periodEnd: null,
|
||||||
|
consumed: 0,
|
||||||
|
remaining: 50,
|
||||||
|
percent: 0,
|
||||||
|
isWindowActive: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'listRuleRecords').mockResolvedValue(mockRecordsResult)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1/records', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { Authorization: 'Bearer test' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual(mockRecordsResult)
|
||||||
|
expect(quotaService.listRuleRecords).toHaveBeenCalledWith('team1', 'rule1')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('POST /teams/:teamId/quotas/:id/records/reset', () => {
|
||||||
|
test('Rejects a reset request without a userId', async () => {
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1/records/reset', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer test',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({}),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(400)
|
||||||
|
expect(quotaService.resetRecord).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Success resetting a quota record with audit log', async () => {
|
||||||
|
const mockRecord = {
|
||||||
|
id: 'record1',
|
||||||
|
ruleId: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: 'user2',
|
||||||
|
user: null,
|
||||||
|
periodStart: new Date().toISOString(),
|
||||||
|
periodEnd: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
|
||||||
|
consumed: 0,
|
||||||
|
remaining: 100,
|
||||||
|
percent: 0,
|
||||||
|
isWindowActive: true,
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'resetRecord').mockResolvedValue(mockRecord)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1/records/reset', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer test',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ userId: 'user2' }),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual(mockRecord)
|
||||||
|
expect(quotaService.resetRecord).toHaveBeenCalledWith('team1', 'rule1', 'user2')
|
||||||
|
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||||
|
action: AuditAction.quota_record_reset,
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: 'user1',
|
||||||
|
itemId: 'record1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('PUT /teams/:teamId/quotas/:id', () => {
|
||||||
|
test('Success updating rule with audit log', async () => {
|
||||||
|
const updatedRule = {
|
||||||
|
id: 'rule1',
|
||||||
|
teamId: 'team1',
|
||||||
|
scopeMode: 'all_members' as const,
|
||||||
|
resource: 'agent_cost' as const,
|
||||||
|
limit: 100,
|
||||||
|
period: '1day' as const,
|
||||||
|
enabled: false,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
vi.spyOn(quotaService, 'updateRule').mockResolvedValue(updatedRule)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1', {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: 'Bearer test',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
limit: 100,
|
||||||
|
enabled: false,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual(updatedRule)
|
||||||
|
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||||
|
action: AuditAction.quota_rule_update,
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: 'user1',
|
||||||
|
itemId: 'rule1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('DELETE /teams/:teamId/quotas/:id', () => {
|
||||||
|
test('Success deleting rule with audit log', async () => {
|
||||||
|
vi.spyOn(quotaService, 'deleteRule').mockResolvedValue(undefined)
|
||||||
|
|
||||||
|
const res = await app.request('/teams/team1/quotas/rule1', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { Authorization: 'Bearer test' },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(204)
|
||||||
|
expect(quotaService.deleteRule).toHaveBeenCalledWith('team1', 'rule1')
|
||||||
|
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||||
|
action: AuditAction.quota_rule_delete,
|
||||||
|
teamId: 'team1',
|
||||||
|
userId: 'user1',
|
||||||
|
itemId: 'rule1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
import { Hono } from 'hono'
|
||||||
|
import { zValidator } from '@hono/zod-validator'
|
||||||
|
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||||
|
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||||
|
import {
|
||||||
|
createQuotaRuleRequestSchema,
|
||||||
|
resetQuotaRecordRequestSchema,
|
||||||
|
updateQuotaRuleRequestSchema,
|
||||||
|
AuditAction,
|
||||||
|
} from '@shumai/dtos'
|
||||||
|
import type { Prisma } from '@shumai/db'
|
||||||
|
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||||
|
|
||||||
|
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||||
|
|
||||||
|
const route = new Hono<{ Variables: { user: User } }>()
|
||||||
|
.get('/teams/:teamId/quotas', async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = await quotaService.listRules(teamId)
|
||||||
|
return c.json(data)
|
||||||
|
})
|
||||||
|
.post('/teams/:teamId/quotas', zValidator('json', createQuotaRuleRequestSchema), async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const req = c.req.valid('json')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(teamId, req)
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.quota_rule_create,
|
||||||
|
teamId,
|
||||||
|
userId: user?.id,
|
||||||
|
itemId: rule.id,
|
||||||
|
})
|
||||||
|
return c.json(rule, 201)
|
||||||
|
})
|
||||||
|
.get('/teams/:teamId/quotas/:id', async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const id = c.req.param('id')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.getRule(teamId, id)
|
||||||
|
return c.json(rule)
|
||||||
|
})
|
||||||
|
.get('/teams/:teamId/quotas/:id/records', async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const id = c.req.param('id')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = await quotaService.listRuleRecords(teamId, id)
|
||||||
|
return c.json(data)
|
||||||
|
})
|
||||||
|
.post(
|
||||||
|
'/teams/:teamId/quotas/:id/records/reset',
|
||||||
|
zValidator('json', resetQuotaRecordRequestSchema),
|
||||||
|
async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const id = c.req.param('id')
|
||||||
|
const req = c.req.valid('json')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const record = await quotaService.resetRecord(teamId, id, req.userId)
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.quota_record_reset,
|
||||||
|
teamId,
|
||||||
|
userId: user?.id,
|
||||||
|
itemId: record.id ?? id,
|
||||||
|
})
|
||||||
|
return c.json(record)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.put('/teams/:teamId/quotas/:id', zValidator('json', updateQuotaRuleRequestSchema), async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const id = c.req.param('id')
|
||||||
|
const req = c.req.valid('json')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.updateRule(teamId, id, req)
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.quota_rule_update,
|
||||||
|
teamId,
|
||||||
|
userId: user?.id,
|
||||||
|
itemId: id,
|
||||||
|
})
|
||||||
|
return c.json(rule)
|
||||||
|
})
|
||||||
|
.delete('/teams/:teamId/quotas/:id', async (c) => {
|
||||||
|
const user = c.get('user')
|
||||||
|
const teamId = c.req.param('teamId')
|
||||||
|
const id = c.req.param('id')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Admin,
|
||||||
|
type: ResourceType.Team,
|
||||||
|
id: teamId,
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.deleteRule(teamId, id)
|
||||||
|
await auditLogService.logAction({
|
||||||
|
action: AuditAction.quota_rule_delete,
|
||||||
|
teamId,
|
||||||
|
userId: user?.id,
|
||||||
|
itemId: id,
|
||||||
|
})
|
||||||
|
return new Response(null, { status: 204 })
|
||||||
|
})
|
||||||
|
|
||||||
|
export default route
|
||||||
@@ -32,12 +32,14 @@ vi.mock('./middleware/auth', () => ({
|
|||||||
describe('versionStack api', () => {
|
describe('versionStack api', () => {
|
||||||
let mockCreateVersionStack: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
let mockCreateVersionStack: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
let mockChangeStackFileVersion: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
let mockChangeStackFileVersion: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
|
let mockRemoveVersionFromStack: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
let mockGetAsset: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
let mockGetAsset: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
let mockGetStackVersions: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
let mockGetStackVersions: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockCreateVersionStack = vi.spyOn(versionStackService, 'createVersionStack')
|
mockCreateVersionStack = vi.spyOn(versionStackService, 'createVersionStack')
|
||||||
mockChangeStackFileVersion = vi.spyOn(versionStackService, 'changeStackFileVersion')
|
mockChangeStackFileVersion = vi.spyOn(versionStackService, 'changeStackFileVersion')
|
||||||
|
mockRemoveVersionFromStack = vi.spyOn(versionStackService, 'removeVersionFromStack')
|
||||||
mockGetAsset = vi.spyOn(assetService, 'getAsset')
|
mockGetAsset = vi.spyOn(assetService, 'getAsset')
|
||||||
mockGetStackVersions = vi.spyOn(assetService, 'getStackVersions')
|
mockGetStackVersions = vi.spyOn(assetService, 'getStackVersions')
|
||||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||||
@@ -146,4 +148,30 @@ describe('versionStack api', () => {
|
|||||||
expect(mockGetStackVersions).toHaveBeenCalledWith('stack1')
|
expect(mockGetStackVersions).toHaveBeenCalledWith('stack1')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('DELETE /version_stacks/:stackId/versions/:versionId', () => {
|
||||||
|
it('should remove version from stack and return 200', async () => {
|
||||||
|
mockRemoveVersionFromStack.mockResolvedValue()
|
||||||
|
|
||||||
|
const app = new Hono().use('*', authMiddleware).route('/', versionStackRoute)
|
||||||
|
|
||||||
|
const res = await app.request('/version_stacks/stack1/versions/v1', {
|
||||||
|
method: 'DELETE',
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
|
||||||
|
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: 'stack1',
|
||||||
|
permission: Permission.Edit,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
expect(mockRemoveVersionFromStack).toHaveBeenCalledWith({
|
||||||
|
stackId: 'stack1',
|
||||||
|
fileId: 'v1',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -75,5 +75,24 @@ const route = app
|
|||||||
const versions = await assetService.getStackVersions(stackId)
|
const versions = await assetService.getStackVersions(stackId)
|
||||||
return c.json(versions)
|
return c.json(versions)
|
||||||
})
|
})
|
||||||
|
.delete('/version_stacks/:stackId/versions/:versionId', async (c) => {
|
||||||
|
const stackId = c.req.param('stackId')
|
||||||
|
const versionId = c.req.param('versionId')
|
||||||
|
const user = c.get('user')
|
||||||
|
|
||||||
|
await authzService.hasPermission({
|
||||||
|
user,
|
||||||
|
permission: Permission.Edit,
|
||||||
|
type: ResourceType.Asset,
|
||||||
|
id: stackId,
|
||||||
|
})
|
||||||
|
|
||||||
|
await versionStackService.removeVersionFromStack({
|
||||||
|
stackId,
|
||||||
|
fileId: versionId,
|
||||||
|
})
|
||||||
|
|
||||||
|
return new Response(null, { status: 200 })
|
||||||
|
})
|
||||||
|
|
||||||
export default route
|
export default route
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/core",
|
"name": "@shumai/core",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -421,4 +421,268 @@ describe('AgentService', () => {
|
|||||||
expect(result).toBeNull()
|
expect(result).toBeNull()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('agent permissions', () => {
|
||||||
|
test('createAgent with custom permission and updateAgentPermission', async () => {
|
||||||
|
const db = prisma
|
||||||
|
const svc = new AgentService()
|
||||||
|
const { team, provider, model } = await setupTestData(db)
|
||||||
|
|
||||||
|
const agent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Owner Only Agent',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'owner',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(agent?.permission).toBe('owner')
|
||||||
|
|
||||||
|
const updated = await svc.updateAgentPermission(agent!.id, 'editor')
|
||||||
|
expect(updated.permission).toBe('editor')
|
||||||
|
|
||||||
|
const updatedViaUpdateAgent = await svc.updateAgent({
|
||||||
|
agentId: agent!.id,
|
||||||
|
name: 'Owner Only Agent Updated',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
expect(updatedViaUpdateAgent.permission).toBe('reviewer')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('listAgents filters chat agents by requester role when userId is provided', async () => {
|
||||||
|
const db = prisma
|
||||||
|
const svc = new AgentService()
|
||||||
|
const { team, provider, model } = await setupTestData(db)
|
||||||
|
|
||||||
|
// Create 3 chat agents with different permissions
|
||||||
|
const reviewerAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'All Users Agent',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
const editorAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Editor Agent',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'editor',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
const ownerAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Owner Agent',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'owner',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create 3 test users with different roles in the team
|
||||||
|
const reviewerUser = await db.user.create({
|
||||||
|
data: { name: 'Reviewer User', email: 'rev@shumai.ai' },
|
||||||
|
})
|
||||||
|
await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: reviewerUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const editorUser = await db.user.create({
|
||||||
|
data: { name: 'Editor User', email: 'ed@shumai.ai' },
|
||||||
|
})
|
||||||
|
await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: editorUser.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const ownerUser = await db.user.create({
|
||||||
|
data: { name: 'Owner User', email: 'own@shumai.ai' },
|
||||||
|
})
|
||||||
|
await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: ownerUser.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Reviewer should only see reviewerAgent
|
||||||
|
const reviewerList = await svc.listAgents({ teamId: team.id, userId: reviewerUser.id })
|
||||||
|
const reviewerAgentIds = reviewerList.map((a) => a.id)
|
||||||
|
expect(reviewerAgentIds).toContain(reviewerAgent!.id)
|
||||||
|
expect(reviewerAgentIds).not.toContain(editorAgent!.id)
|
||||||
|
expect(reviewerAgentIds).not.toContain(ownerAgent!.id)
|
||||||
|
|
||||||
|
// Editor should see reviewerAgent and editorAgent
|
||||||
|
const editorList = await svc.listAgents({ teamId: team.id, userId: editorUser.id })
|
||||||
|
const editorAgentIds = editorList.map((a) => a.id)
|
||||||
|
expect(editorAgentIds).toContain(reviewerAgent!.id)
|
||||||
|
expect(editorAgentIds).toContain(editorAgent!.id)
|
||||||
|
expect(editorAgentIds).not.toContain(ownerAgent!.id)
|
||||||
|
|
||||||
|
// Owner should see all agents
|
||||||
|
const ownerList = await svc.listAgents({ teamId: team.id, userId: ownerUser.id })
|
||||||
|
const ownerAgentIds = ownerList.map((a) => a.id)
|
||||||
|
expect(ownerAgentIds).toContain(reviewerAgent!.id)
|
||||||
|
expect(ownerAgentIds).toContain(editorAgent!.id)
|
||||||
|
expect(ownerAgentIds).toContain(ownerAgent!.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('listProjectChatAgents filters by effective project role and chat/enabled only', async () => {
|
||||||
|
const db = prisma
|
||||||
|
const svc = new AgentService()
|
||||||
|
const { team, provider, model } = await setupTestData(db)
|
||||||
|
|
||||||
|
const project = await db.project.create({
|
||||||
|
data: { name: 'Proj Agents', teamId: team.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Two chat agents + one disabled chat agent + one embedding agent
|
||||||
|
const reviewerAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Reviewer Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
const editorAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Editor Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'editor',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
const disabledAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Disabled Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: false,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team reviewer, promoted to project owner in this project
|
||||||
|
const projectOwner = await db.user.create({
|
||||||
|
data: { name: 'Proj Owner', email: 'projowner@shumai.ai' },
|
||||||
|
})
|
||||||
|
const projectOwnerTm = await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: projectOwner.id, role: 'reviewer', scope: 'team' },
|
||||||
|
})
|
||||||
|
await db.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: projectOwnerTm.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const list = await svc.listProjectChatAgents(project.id, projectOwner.id)
|
||||||
|
const ids = list.map((a) => a.id)
|
||||||
|
expect(ids).toContain(reviewerAgent!.id)
|
||||||
|
expect(ids).toContain(editorAgent!.id)
|
||||||
|
expect(ids).not.toContain(disabledAgent!.id)
|
||||||
|
expect(list.every((a) => a.type === 'chat')).toBe(true)
|
||||||
|
expect(list.every((a) => a.enabled)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('listProjectChatAgents restricts project-scoped members to their project role', async () => {
|
||||||
|
const db = prisma
|
||||||
|
const svc = new AgentService()
|
||||||
|
const { team, provider, model } = await setupTestData(db)
|
||||||
|
|
||||||
|
const project = await db.project.create({
|
||||||
|
data: { name: 'Proj Guest', teamId: team.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviewerAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Reviewer Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
const editorAgent = await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Editor Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'editor',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member invited as reviewer in this project
|
||||||
|
const guest = await db.user.create({
|
||||||
|
data: { name: 'Guest', email: 'guest@shumai.ai' },
|
||||||
|
})
|
||||||
|
const guestTm = await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: guest.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await db.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: guestTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const ids = (await svc.listProjectChatAgents(project.id, guest.id)).map((a) => a.id)
|
||||||
|
expect(ids).toContain(reviewerAgent!.id)
|
||||||
|
expect(ids).not.toContain(editorAgent!.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('listProjectChatAgents returns empty for users outside the project', async () => {
|
||||||
|
const db = prisma
|
||||||
|
const svc = new AgentService()
|
||||||
|
const { team, provider, model } = await setupTestData(db)
|
||||||
|
|
||||||
|
const project = await db.project.create({
|
||||||
|
data: { name: 'Proj Closed', teamId: team.id },
|
||||||
|
})
|
||||||
|
const projectB = await db.project.create({
|
||||||
|
data: { name: 'Proj Other', teamId: team.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
await svc.createAgent({
|
||||||
|
teamId: team.id,
|
||||||
|
name: 'Reviewer Chat',
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
thinkingLevel: 'off',
|
||||||
|
permission: 'reviewer',
|
||||||
|
providerId: provider.id,
|
||||||
|
modelId: model.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member of projectB only
|
||||||
|
const guest = await db.user.create({
|
||||||
|
data: { name: 'Guest B', email: 'guestb@shumai.ai' },
|
||||||
|
})
|
||||||
|
const guestTm = await db.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: guest.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await db.projectMember.create({
|
||||||
|
data: { projectId: projectB.id, teamMemberId: guestTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const ids = (await svc.listProjectChatAgents(project.id, guest.id)).map((a) => a.id)
|
||||||
|
expect(ids).toHaveLength(0)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { prisma, type Prisma } from '@shumai/db'
|
import { prisma, type Prisma, type TeamMemberRole } from '@shumai/db'
|
||||||
import {
|
import {
|
||||||
CreateAgentParams,
|
CreateAgentParams,
|
||||||
DeleteAgentParams,
|
DeleteAgentParams,
|
||||||
ListAgentsParams,
|
ListAgentsParams,
|
||||||
UpdateAgentParams,
|
UpdateAgentParams,
|
||||||
AgentSessionInfo,
|
AgentSessionInfo,
|
||||||
|
AgentInfo,
|
||||||
|
AgentType,
|
||||||
} from '@shumai/dtos'
|
} from '@shumai/dtos'
|
||||||
import {
|
import {
|
||||||
paginateQuery,
|
paginateQuery,
|
||||||
@@ -14,10 +16,35 @@ import {
|
|||||||
import '@shumai/db/src/prisma-json-types'
|
import '@shumai/db/src/prisma-json-types'
|
||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
import { getAllowedAgentRoles } from './permissions'
|
||||||
import AdmZip from 'adm-zip'
|
import AdmZip from 'adm-zip'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
|
const agentInclude = {
|
||||||
|
user: true,
|
||||||
|
provider: true,
|
||||||
|
modelRef: true,
|
||||||
|
skills: { include: { skill: true } },
|
||||||
|
mcpServers: true,
|
||||||
|
} satisfies Prisma.AgentInclude
|
||||||
|
|
||||||
|
/** Structural shape consumed by `toAgentInfo` (works with any standard include). */
|
||||||
|
interface AgentInfoSource {
|
||||||
|
id: string
|
||||||
|
type: AgentType
|
||||||
|
enabled: boolean
|
||||||
|
permission: TeamMemberRole
|
||||||
|
providerId: string | null
|
||||||
|
modelId: string | null
|
||||||
|
config: unknown
|
||||||
|
soul: string | null
|
||||||
|
user: { name: string; image: string | null }
|
||||||
|
skills: Array<{ id: string; skillId: string; skill: { id: string; name: string } }>
|
||||||
|
mcpServers: Array<{ mcpServerId: string }>
|
||||||
|
}
|
||||||
|
|
||||||
function extractS3Key(urlOrKey?: string | null): string | null | undefined {
|
function extractS3Key(urlOrKey?: string | null): string | null | undefined {
|
||||||
if (!urlOrKey) return urlOrKey
|
if (!urlOrKey) return urlOrKey
|
||||||
const match = urlOrKey.match(/files\/[A-Z0-9]{26}/)
|
const match = urlOrKey.match(/files\/[A-Z0-9]{26}/)
|
||||||
@@ -114,6 +141,7 @@ export class AgentService {
|
|||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
enabled,
|
enabled,
|
||||||
|
permission,
|
||||||
avatar,
|
avatar,
|
||||||
providerId,
|
providerId,
|
||||||
modelId,
|
modelId,
|
||||||
@@ -179,6 +207,7 @@ export class AgentService {
|
|||||||
teamId,
|
teamId,
|
||||||
type,
|
type,
|
||||||
enabled: enabled ?? true,
|
enabled: enabled ?? true,
|
||||||
|
permission: permission || 'reviewer',
|
||||||
providerId: providerId || null,
|
providerId: providerId || null,
|
||||||
modelId: modelId || null,
|
modelId: modelId || null,
|
||||||
soul,
|
soul,
|
||||||
@@ -224,6 +253,7 @@ export class AgentService {
|
|||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
enabled,
|
enabled,
|
||||||
|
permission,
|
||||||
avatar,
|
avatar,
|
||||||
providerId,
|
providerId,
|
||||||
modelId,
|
modelId,
|
||||||
@@ -300,6 +330,7 @@ export class AgentService {
|
|||||||
data: {
|
data: {
|
||||||
type,
|
type,
|
||||||
enabled: enabled ?? true,
|
enabled: enabled ?? true,
|
||||||
|
...(permission ? { permission } : {}),
|
||||||
providerId: providerId || null,
|
providerId: providerId || null,
|
||||||
modelId: modelId || null,
|
modelId: modelId || null,
|
||||||
soul,
|
soul,
|
||||||
@@ -327,6 +358,29 @@ export class AgentService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateAgentPermission(agentId: string, permission: 'owner' | 'editor' | 'reviewer') {
|
||||||
|
const existing = await this.prismaClient.agent.findUnique({
|
||||||
|
where: { id: agentId },
|
||||||
|
})
|
||||||
|
if (!existing) throw new Error('agent not found')
|
||||||
|
|
||||||
|
return this.prismaClient.agent.update({
|
||||||
|
where: { id: agentId },
|
||||||
|
data: { permission },
|
||||||
|
include: {
|
||||||
|
user: true,
|
||||||
|
provider: true,
|
||||||
|
modelRef: true,
|
||||||
|
skills: {
|
||||||
|
include: {
|
||||||
|
skill: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mcpServers: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async getAgent(params: { agentId: string }) {
|
async getAgent(params: { agentId: string }) {
|
||||||
return this.prismaClient.agent.findUnique({
|
return this.prismaClient.agent.findUnique({
|
||||||
where: { id: params.agentId },
|
where: { id: params.agentId },
|
||||||
@@ -348,10 +402,96 @@ export class AgentService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map an agent (with the standard relations include) to the AgentInfo DTO.
|
||||||
|
* Shared by the team-level agent list and the project-scoped chat-agent list.
|
||||||
|
*/
|
||||||
|
async toAgentInfo(agent: AgentInfoSource): Promise<AgentInfo> {
|
||||||
|
const config = agent.config as unknown as PrismaJson.AgentConfig
|
||||||
|
return {
|
||||||
|
id: agent.id,
|
||||||
|
name: agent.user.name,
|
||||||
|
type: agent.type as AgentType,
|
||||||
|
enabled: agent.enabled,
|
||||||
|
permission: agent.permission,
|
||||||
|
avatar: (await getAvatarUrl(agent.user.image)) || undefined,
|
||||||
|
providerId: agent.providerId || undefined,
|
||||||
|
modelId: agent.modelId || undefined,
|
||||||
|
thinkingLevel: config.thinkingLevel || 'off',
|
||||||
|
systemPrompt: config.systemPrompt,
|
||||||
|
soul: agent.soul || undefined,
|
||||||
|
skills: agent.skills.map((s) => ({
|
||||||
|
id: s.id,
|
||||||
|
skillId: s.skillId,
|
||||||
|
skill: s.skill,
|
||||||
|
})),
|
||||||
|
mcpServerIds: (agent.mcpServers || []).map((m) => m.mcpServerId),
|
||||||
|
deniedTools: config.deniedTools || [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List the chat agents available to a user inside a specific project,
|
||||||
|
* resolved against the user's effective project role (project override wins;
|
||||||
|
* restricted users get an empty list). Used by the one-to-one chat selector.
|
||||||
|
*/
|
||||||
|
async listProjectChatAgents(projectId: string, userId: string): Promise<AgentInfo[]> {
|
||||||
|
const project = await this.prismaClient.project.findUnique({
|
||||||
|
where: { id: projectId },
|
||||||
|
select: { teamId: true },
|
||||||
|
})
|
||||||
|
if (!project) return []
|
||||||
|
|
||||||
|
const effectiveRole = await resolveEffectiveRole(project.teamId, projectId, userId)
|
||||||
|
if (!effectiveRole) return []
|
||||||
|
|
||||||
|
const allowedRoles = getAllowedAgentRoles(effectiveRole)
|
||||||
|
|
||||||
|
const agents = await this.prismaClient.agent.findMany({
|
||||||
|
where: {
|
||||||
|
teamId: project.teamId,
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
permission: { in: allowedRoles },
|
||||||
|
},
|
||||||
|
orderBy: { id: 'desc' },
|
||||||
|
include: agentInclude,
|
||||||
|
})
|
||||||
|
|
||||||
|
return Promise.all(agents.map((agent) => this.toAgentInfo(agent)))
|
||||||
|
}
|
||||||
|
|
||||||
async listAgents(params: ListAgentsParams) {
|
async listAgents(params: ListAgentsParams) {
|
||||||
|
const allowedRoles = params.userId
|
||||||
|
? getAllowedAgentRoles(
|
||||||
|
(
|
||||||
|
await this.prismaClient.teamMember.findUnique({
|
||||||
|
where: {
|
||||||
|
teamIdUserId: {
|
||||||
|
teamId: params.teamId,
|
||||||
|
userId: params.userId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: { role: true },
|
||||||
|
})
|
||||||
|
)?.role,
|
||||||
|
)
|
||||||
|
: null
|
||||||
|
|
||||||
return this.prismaClient.agent.findMany({
|
return this.prismaClient.agent.findMany({
|
||||||
where: {
|
where: {
|
||||||
teamId: params.teamId,
|
teamId: params.teamId,
|
||||||
|
...(allowedRoles
|
||||||
|
? {
|
||||||
|
OR: [
|
||||||
|
{ type: { not: 'chat' } },
|
||||||
|
{
|
||||||
|
type: 'chat',
|
||||||
|
permission: { in: allowedRoles },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
id: 'desc',
|
id: 'desc',
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { getRoleLevel, getAgentRequiredLevel, getAllowedAgentRoles } from './permissions'
|
||||||
|
|
||||||
|
describe('agent permission helpers', () => {
|
||||||
|
describe('getRoleLevel', () => {
|
||||||
|
it('maps each role to its level', () => {
|
||||||
|
expect(getRoleLevel('reviewer')).toBe(1)
|
||||||
|
expect(getRoleLevel('editor')).toBe(2)
|
||||||
|
expect(getRoleLevel('owner')).toBe(3)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resolves missing roles to 0 (fail closed)', () => {
|
||||||
|
expect(getRoleLevel(null)).toBe(0)
|
||||||
|
expect(getRoleLevel(undefined)).toBe(0)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('getAgentRequiredLevel', () => {
|
||||||
|
it('maps each permission to its required level', () => {
|
||||||
|
expect(getAgentRequiredLevel('reviewer')).toBe(1)
|
||||||
|
expect(getAgentRequiredLevel('editor')).toBe(2)
|
||||||
|
expect(getAgentRequiredLevel('owner')).toBe(3)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('defaults missing permissions to reviewer level (1)', () => {
|
||||||
|
expect(getAgentRequiredLevel(null)).toBe(1)
|
||||||
|
expect(getAgentRequiredLevel(undefined)).toBe(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('getAllowedAgentRoles', () => {
|
||||||
|
it('returns inclusive role sets per hierarchy', () => {
|
||||||
|
expect(getAllowedAgentRoles('owner')).toEqual(['reviewer', 'editor', 'owner'])
|
||||||
|
expect(getAllowedAgentRoles('editor')).toEqual(['reviewer', 'editor'])
|
||||||
|
expect(getAllowedAgentRoles('reviewer')).toEqual(['reviewer'])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('defaults missing roles to reviewer only', () => {
|
||||||
|
expect(getAllowedAgentRoles(null)).toEqual(['reviewer'])
|
||||||
|
expect(getAllowedAgentRoles(undefined)).toEqual(['reviewer'])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import type { TeamMemberRole } from '@shumai/db'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Numeric levels for the team role hierarchy used by agent permissions.
|
||||||
|
* The record is typed exhaustively over `TeamMemberRole`, so adding a new
|
||||||
|
* role to the enum will fail compilation until it is handled here.
|
||||||
|
*/
|
||||||
|
const ROLE_LEVELS: Record<TeamMemberRole, number> = {
|
||||||
|
reviewer: 1,
|
||||||
|
editor: 2,
|
||||||
|
owner: 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Numeric level of a team role for agent-permission comparisons.
|
||||||
|
* Unknown or missing roles resolve to 0, which is below every agent
|
||||||
|
* permission, so lookups fail closed.
|
||||||
|
*/
|
||||||
|
export function getRoleLevel(role: TeamMemberRole | null | undefined): number {
|
||||||
|
if (!role) return 0
|
||||||
|
return ROLE_LEVELS[role] ?? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum role level required to use an agent with the given permission.
|
||||||
|
* Unknown or missing permissions resolve to 1 (reviewer), the most
|
||||||
|
* permissive default.
|
||||||
|
*/
|
||||||
|
export function getAgentRequiredLevel(permission: TeamMemberRole | null | undefined): number {
|
||||||
|
if (!permission) return 1
|
||||||
|
return ROLE_LEVELS[permission] ?? 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roles allowed to use agents, following the inclusive role hierarchy:
|
||||||
|
* owner sees owner+editor+reviewer agents, editor sees editor+reviewer,
|
||||||
|
* reviewer (or any unknown/missing role) sees reviewer agents only.
|
||||||
|
*/
|
||||||
|
export function getAllowedAgentRoles(role: TeamMemberRole | null | undefined): TeamMemberRole[] {
|
||||||
|
const level = getRoleLevel(role)
|
||||||
|
if (level >= 3) return ['reviewer', 'editor', 'owner']
|
||||||
|
if (level === 2) return ['reviewer', 'editor']
|
||||||
|
return ['reviewer']
|
||||||
|
}
|
||||||
@@ -41,6 +41,13 @@ describe('AssetService', () => {
|
|||||||
const team = await prisma.team.create({
|
const team = await prisma.team.create({
|
||||||
data: { name: 'TestTeam_Asset_' + Date.now() },
|
data: { name: 'TestTeam_Asset_' + Date.now() },
|
||||||
})
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
role: 'owner',
|
||||||
|
},
|
||||||
|
})
|
||||||
const project = await prisma.project.create({
|
const project = await prisma.project.create({
|
||||||
data: { name: 'TestProject_Asset', teamId: team.id },
|
data: { name: 'TestProject_Asset', teamId: team.id },
|
||||||
})
|
})
|
||||||
@@ -734,15 +741,6 @@ describe('AssetService', () => {
|
|||||||
attachmentIds: [],
|
attachmentIds: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
// 2. Add user as a team member with owner role (team owner)
|
|
||||||
await prisma.teamMember.create({
|
|
||||||
data: {
|
|
||||||
teamId: project.teamId,
|
|
||||||
userId: user.id,
|
|
||||||
role: 'owner',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create another user
|
// Create another user
|
||||||
const otherUser = await prisma.user.create({
|
const otherUser = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -813,16 +811,7 @@ describe('AssetService', () => {
|
|||||||
it('deleteComment cleans up S3 attachment files and database records', async () => {
|
it('deleteComment cleans up S3 attachment files and database records', async () => {
|
||||||
const { user, project, assets } = await setupBasicAssets()
|
const { user, project, assets } = await setupBasicAssets()
|
||||||
|
|
||||||
// 1. Add user as team owner
|
// 1. Create StorageKey and Asset for attachment
|
||||||
await prisma.teamMember.create({
|
|
||||||
data: {
|
|
||||||
teamId: project.teamId,
|
|
||||||
userId: user.id,
|
|
||||||
role: 'owner',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// 2. Create StorageKey and Asset for attachment
|
|
||||||
const storageKey = await prisma.storageKey.create({
|
const storageKey = await prisma.storageKey.create({
|
||||||
data: {
|
data: {
|
||||||
key: 'attachments/test-attachment-file.png',
|
key: 'attachments/test-attachment-file.png',
|
||||||
@@ -1245,6 +1234,152 @@ describe('AssetService', () => {
|
|||||||
expect(p3b?.agent?.userId).toBe(user.id)
|
expect(p3b?.agent?.userId).toBe(user.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('silently skips triggering agent workflow when comment creator lacks permission', async () => {
|
||||||
|
const { project } = await setupBasicAssets()
|
||||||
|
const file = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'perm-file',
|
||||||
|
type: AssetType.file,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create owner-only bot agent
|
||||||
|
const ownerBotUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Owner Bot Agent',
|
||||||
|
type: 'agent',
|
||||||
|
email: `owner-bot-${Date.now()}@shumai.ai`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const ownerAgent = await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: ownerBotUser.id,
|
||||||
|
teamId: project.teamId,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'owner',
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create a reviewer user
|
||||||
|
const reviewerUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Reviewer Member',
|
||||||
|
email: `rev-comment-${Date.now()}@shumai.ai`,
|
||||||
|
password: 'pw',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: project.teamId, userId: reviewerUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Reviewer mentions owner-only agent
|
||||||
|
const comment = await assetService.createComment({
|
||||||
|
assetId: file.id,
|
||||||
|
userId: reviewerUser.id,
|
||||||
|
message: `Hello <@${ownerAgent.id}>`,
|
||||||
|
attachmentIds: [],
|
||||||
|
})
|
||||||
|
|
||||||
|
// Comment was saved successfully
|
||||||
|
expect(comment.id).toBeDefined()
|
||||||
|
|
||||||
|
// But no workflow task was created for ownerAgent
|
||||||
|
const tasks = await prisma.workflowTask.findMany({
|
||||||
|
where: {
|
||||||
|
assetId: file.id,
|
||||||
|
payload: { path: ['agent', 'userCommentId'], equals: comment.id },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(tasks.length).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses the effective project role for bot mention permission checks', async () => {
|
||||||
|
const { project } = await setupBasicAssets()
|
||||||
|
const file = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'perm-file-2',
|
||||||
|
type: AssetType.file,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Editor-permission chat agent
|
||||||
|
const editorBotUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Editor Bot Agent',
|
||||||
|
type: 'agent',
|
||||||
|
email: `editor-bot-${Date.now()}@shumai.ai`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const editorAgent = await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: editorBotUser.id,
|
||||||
|
teamId: project.teamId,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'editor',
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team editor, demoted to project reviewer in this project
|
||||||
|
const demoted = await prisma.user.create({
|
||||||
|
data: { name: 'Demoted Member', email: `dem-${Date.now()}@shumai.ai`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const demotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: project.teamId, userId: demoted.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: demotedTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member invited as editor
|
||||||
|
const projEditor = await prisma.user.create({
|
||||||
|
data: { name: 'Proj Editor', email: `pe-${Date.now()}@shumai.ai`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const projEditorTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: project.teamId, userId: projEditor.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: projEditorTm.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Demoted team editor (project reviewer) mentioning the editor agent: no workflow
|
||||||
|
const demotedComment = await assetService.createComment({
|
||||||
|
assetId: file.id,
|
||||||
|
userId: demoted.id,
|
||||||
|
message: `Hello <@${editorAgent.id}>`,
|
||||||
|
attachmentIds: [],
|
||||||
|
})
|
||||||
|
const demotedTasks = await prisma.workflowTask.findMany({
|
||||||
|
where: {
|
||||||
|
assetId: file.id,
|
||||||
|
payload: { path: ['agent', 'userCommentId'], equals: demotedComment.id },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(demotedTasks.length).toBe(0)
|
||||||
|
|
||||||
|
// Project-scoped editor mentioning the editor agent: workflow created
|
||||||
|
const peComment = await assetService.createComment({
|
||||||
|
assetId: file.id,
|
||||||
|
userId: projEditor.id,
|
||||||
|
message: `Hello <@${editorAgent.id}>`,
|
||||||
|
attachmentIds: [],
|
||||||
|
})
|
||||||
|
const peTasks = await prisma.workflowTask.findMany({
|
||||||
|
where: {
|
||||||
|
assetId: file.id,
|
||||||
|
payload: { path: ['agent', 'userCommentId'], equals: peComment.id },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(peTasks.length).toBe(1)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
expect((peTasks[0].payload as any)?.agent?.userId).toBe(projEditor.id)
|
||||||
|
})
|
||||||
|
|
||||||
it('updates asset order correctly', async () => {
|
it('updates asset order correctly', async () => {
|
||||||
const { user, project } = await setupBasicAssets()
|
const { user, project } = await setupBasicAssets()
|
||||||
|
|
||||||
@@ -2830,4 +2965,615 @@ describe('AssetService — natural sort by name', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('AGENTS.md methods', () => {
|
||||||
|
it('getAgentsMd returns null when no agentmd is set', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Team_AgentsMd_' + Date.now() },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project_AgentsMd', teamId: team.id },
|
||||||
|
})
|
||||||
|
const folder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Folder_No_Md',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const content = await assetService.getAgentsMd(folder.id)
|
||||||
|
expect(content).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('updateAgentsMd updates and getAgentsMd retrieves agentmd, and empty deletes', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Team_AgentsMd2_' + Date.now() },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project_AgentsMd2', teamId: team.id },
|
||||||
|
})
|
||||||
|
const folder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Folder_With_Md',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateResult = await assetService.updateAgentsMd(folder.id, '# Custom Guidelines')
|
||||||
|
expect(updateResult).toEqual({ content: '# Custom Guidelines' })
|
||||||
|
|
||||||
|
const content = await assetService.getAgentsMd(folder.id)
|
||||||
|
expect(content).toBe('# Custom Guidelines')
|
||||||
|
|
||||||
|
let folderInfo = await assetService.getAsset({ assetId: folder.id })
|
||||||
|
expect(folderInfo?.hasAgentsMd).toBe(true)
|
||||||
|
|
||||||
|
// Empty string deletes the record
|
||||||
|
const clearResult = await assetService.updateAgentsMd(folder.id, ' ')
|
||||||
|
expect(clearResult).toEqual({ content: '' })
|
||||||
|
|
||||||
|
const emptyContent = await assetService.getAgentsMd(folder.id)
|
||||||
|
expect(emptyContent).toBeNull()
|
||||||
|
|
||||||
|
folderInfo = await assetService.getAsset({ assetId: folder.id })
|
||||||
|
expect(folderInfo?.hasAgentsMd).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('getNestedAgentsMd traverses hierarchy from root to leaf and formats virtual paths', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Team_NestedMd_' + Date.now() },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project_NestedMd', teamId: team.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
// 1. Root folder
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root Folder',
|
||||||
|
type: AssetType.root,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.assetAgentMd.create({
|
||||||
|
data: {
|
||||||
|
assetId: rootFolder.id,
|
||||||
|
content: '# Root Instructions\nFollow global rules.',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 2. Subfolder 1: marketing (has agentmd)
|
||||||
|
const marketingFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'marketing',
|
||||||
|
type: AssetType.folder,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.assetAgentMd.create({
|
||||||
|
data: {
|
||||||
|
assetId: marketingFolder.id,
|
||||||
|
content: '# Marketing Instructions\nTone must be upbeat.',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 3. Subfolder 2: campaigns (no agentmd)
|
||||||
|
const campaignsFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'campaigns',
|
||||||
|
type: AssetType.folder,
|
||||||
|
parentId: marketingFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 4. Subfolder 3: video-ads (has agentmd)
|
||||||
|
const videoAdsFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'video-ads',
|
||||||
|
type: AssetType.folder,
|
||||||
|
parentId: campaignsFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.assetAgentMd.create({
|
||||||
|
data: {
|
||||||
|
assetId: videoAdsFolder.id,
|
||||||
|
content: '# Video Ads Instructions\nInclude resolution tags.',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 5. File inside video-ads
|
||||||
|
const fileAsset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'ad_clip.mp4',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: videoAdsFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const nestedFromLeaf = await assetService.getNestedAgentsMd(fileAsset.id)
|
||||||
|
expect(nestedFromLeaf).toEqual([
|
||||||
|
{
|
||||||
|
path: '/AGENTS.md',
|
||||||
|
content: '# Root Instructions\nFollow global rules.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/marketing/AGENTS.md',
|
||||||
|
content: '# Marketing Instructions\nTone must be upbeat.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/marketing/campaigns/video-ads/AGENTS.md',
|
||||||
|
content: '# Video Ads Instructions\nInclude resolution tags.',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const nestedFromMarketing = await assetService.getNestedAgentsMd(marketingFolder.id)
|
||||||
|
expect(nestedFromMarketing).toEqual([
|
||||||
|
{
|
||||||
|
path: '/AGENTS.md',
|
||||||
|
content: '# Root Instructions\nFollow global rules.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/marketing/AGENTS.md',
|
||||||
|
content: '# Marketing Instructions\nTone must be upbeat.',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('rejects get/update agentsmd on non-folder assets', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Team_AgentsMd_Type_' + Date.now() },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project_AgentsMd_Type', teamId: team.id },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.root,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const fileAsset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'doc.pdf',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(assetService.getAgentsMd(fileAsset.id)).rejects.toThrow(
|
||||||
|
'AGENTS.md can only be stored on folders',
|
||||||
|
)
|
||||||
|
await expect(assetService.updateAgentsMd(fileAsset.id, '# Nope')).rejects.toThrow(
|
||||||
|
'AGENTS.md can only be stored on folders',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('reparentAssets into version_stack with sharelink symlinks', () => {
|
||||||
|
it('deduplicates symlinks when both Stack A and File B are in the sharelink and File B is moved into Stack A', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const shareRoot = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'ShareRoot',
|
||||||
|
type: AssetType.share_root,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 2,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileA1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'fileA1.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'a0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const fileA2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'fileA2.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'a1',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const fileB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'fileB.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 200,
|
||||||
|
sortIndex: 'a2',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create Stack A from fileA1 and fileA2
|
||||||
|
const stackA = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 2,
|
||||||
|
sizeByte: 200,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.asset.update({ where: { id: fileA1.id }, data: { parentId: stackA.id } })
|
||||||
|
await prisma.asset.update({ where: { id: fileA2.id }, data: { parentId: stackA.id } })
|
||||||
|
|
||||||
|
// Create symlinks in shareRoot for both Stack A and File B
|
||||||
|
const symlinkStackA = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: stackA.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const symlinkFileB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileB.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileB.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Move File B into Stack A
|
||||||
|
await assetService.reparentAssets({
|
||||||
|
newParentId: stackA.id,
|
||||||
|
assetIds: [fileB.id],
|
||||||
|
creatorId: user.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Verify: File B's symlink was deleted, only Stack A's symlink remains
|
||||||
|
expect(await prisma.asset.findUnique({ where: { id: symlinkFileB.id } })).toBeNull()
|
||||||
|
const remainingSymlinks = await prisma.asset.findMany({
|
||||||
|
where: { parentId: shareRoot.id, type: AssetType.symlink },
|
||||||
|
})
|
||||||
|
expect(remainingSymlinks).toHaveLength(1)
|
||||||
|
expect(remainingSymlinks[0].id).toBe(symlinkStackA.id)
|
||||||
|
expect(remainingSymlinks[0].targetId).toBe(stackA.id)
|
||||||
|
|
||||||
|
// ShareRoot fileCount was decremented from 2 to 1
|
||||||
|
const updatedShareRoot = await prisma.asset.findUnique({ where: { id: shareRoot.id } })
|
||||||
|
expect(updatedShareRoot?.fileCount).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('repoints symlink to Stack A when only File B is in sharelink and File B is moved into Stack A', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const shareRoot = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'ShareRoot',
|
||||||
|
type: AssetType.share_root,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileA1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'fileA1.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'a0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const stackA = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 1,
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.asset.update({ where: { id: fileA1.id }, data: { parentId: stackA.id } })
|
||||||
|
|
||||||
|
const fileB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'fileB.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 200,
|
||||||
|
sortIndex: 'a1',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create symlink for File B only
|
||||||
|
const symlinkFileB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileB.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileB.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Move File B into Stack A
|
||||||
|
await assetService.reparentAssets({
|
||||||
|
newParentId: stackA.id,
|
||||||
|
assetIds: [fileB.id],
|
||||||
|
creatorId: user.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Verify: symlinkFileB now points to stackA.id
|
||||||
|
const updatedSymlink = await prisma.asset.findUnique({ where: { id: symlinkFileB.id } })
|
||||||
|
expect(updatedSymlink?.targetId).toBe(stackA.id)
|
||||||
|
|
||||||
|
// Listing assets for shareRoot returns Stack A with latest version name
|
||||||
|
const result = await assetService.listChildren({
|
||||||
|
assetId: shareRoot.id,
|
||||||
|
assetType: AssetType.file,
|
||||||
|
})
|
||||||
|
expect(result.data).toHaveLength(1)
|
||||||
|
expect(result.data[0].name).toBe(fileB.name) // fileB is the latest version
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('updateAssetName', () => {
|
||||||
|
it('renames the latest version child file and returns updated AssetInfo when given a version stack ID', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 2,
|
||||||
|
sizeByte: 300,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileV1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'v1.mp4',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: stack.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'b0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileV2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'v2.mp4',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: stack.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 200,
|
||||||
|
sortIndex: 'a0', // latest version
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const updated = await assetService.updateAssetName({
|
||||||
|
id: stack.id,
|
||||||
|
name: 'v2-renamed.mp4',
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(updated.id).toBe(stack.id)
|
||||||
|
expect(updated.name).toBe('v2-renamed.mp4')
|
||||||
|
expect(updated.versionStack?.versions[0]?.name).toBe('v2-renamed.mp4')
|
||||||
|
|
||||||
|
const dbFileV2 = await prisma.asset.findUnique({ where: { id: fileV2.id } })
|
||||||
|
expect(dbFileV2?.name).toBe('v2-renamed.mp4')
|
||||||
|
|
||||||
|
const dbFileV1 = await prisma.asset.findUnique({ where: { id: fileV1.id } })
|
||||||
|
expect(dbFileV1?.name).toBe('v1.mp4')
|
||||||
|
|
||||||
|
const dbStack = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||||
|
expect(dbStack?.name).toBe('')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('preserves the renamed filename when a version stack dissolves', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: rootFolder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
fileCount: 2,
|
||||||
|
sizeByte: 300,
|
||||||
|
sortIndex: 's0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileV1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'v1.mp4',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: stack.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'b0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const fileV2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'v2.mp4',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: stack.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
sizeByte: 200,
|
||||||
|
sortIndex: 'a0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await assetService.updateAssetName({
|
||||||
|
id: stack.id,
|
||||||
|
name: 'v2-renamed.mp4',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remove v1 from stack -> stack dissolves and v2 becomes standalone file
|
||||||
|
const { versionStackService } = await import('../versionStack/versionStack')
|
||||||
|
await versionStackService.removeVersionFromStack({
|
||||||
|
stackId: stack.id,
|
||||||
|
fileId: fileV1.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
const remainingFile = await prisma.asset.findUnique({ where: { id: fileV2.id } })
|
||||||
|
expect(remainingFile?.parentId).toBe(rootFolder.id)
|
||||||
|
expect(remainingFile?.name).toBe('v2-renamed.mp4')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('throws an error if version stack has no active versions to rename', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const emptyStack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
assetService.updateAssetName({
|
||||||
|
id: emptyStack.id,
|
||||||
|
name: 'new-name.mp4',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('No active version found in stack to rename')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renames a regular file and folder correctly', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const folder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Original Folder',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const file = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'original.png',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: folder.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const updatedFolder = await assetService.updateAssetName({
|
||||||
|
id: folder.id,
|
||||||
|
name: 'Renamed Folder',
|
||||||
|
})
|
||||||
|
expect(updatedFolder.name).toBe('Renamed Folder')
|
||||||
|
|
||||||
|
const updatedFile = await assetService.updateAssetName({
|
||||||
|
id: file.id,
|
||||||
|
name: 'renamed.png',
|
||||||
|
})
|
||||||
|
expect(updatedFile.name).toBe('renamed.png')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ import { HTTPException } from 'hono/http-exception'
|
|||||||
import { logger } from '@shumai/core/src/logger'
|
import { logger } from '@shumai/core/src/logger'
|
||||||
import { PaginatedData, paginateQuery, PaginationParams } from '@shumai/core/src/pagination'
|
import { PaginatedData, paginateQuery, PaginationParams } from '@shumai/core/src/pagination'
|
||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
|
import { dedupeSymlinksToTarget } from './symlink'
|
||||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||||
|
import { getAgentRequiredLevel, getRoleLevel } from '@shumai/core/src/agent/permissions'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
|
||||||
type AssetWithIncludes = Prisma.AssetGetPayload<{
|
type AssetWithIncludes = Prisma.AssetGetPayload<{
|
||||||
include: {
|
include: {
|
||||||
@@ -160,6 +163,9 @@ export class AssetService {
|
|||||||
const count = await tx.asset.count({ where: { parentId: stack.id } })
|
const count = await tx.asset.count({ where: { parentId: stack.id } })
|
||||||
|
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
|
await tx.asset.deleteMany({
|
||||||
|
where: { targetId: stack.id, type: AssetType.symlink },
|
||||||
|
})
|
||||||
if (stack.parentId) {
|
if (stack.parentId) {
|
||||||
await tx.asset.update({
|
await tx.asset.update({
|
||||||
where: { id: stack.parentId },
|
where: { id: stack.parentId },
|
||||||
@@ -174,9 +180,14 @@ export class AssetService {
|
|||||||
if (!lastChild) return
|
if (!lastChild) return
|
||||||
if (!stack.parentId) throw new Error('Stack has no parent')
|
if (!stack.parentId) throw new Error('Stack has no parent')
|
||||||
|
|
||||||
|
await tx.asset.updateMany({
|
||||||
|
where: { targetId: stack.id, type: AssetType.symlink },
|
||||||
|
data: { targetId: lastChild.id, name: lastChild.name },
|
||||||
|
})
|
||||||
|
|
||||||
await tx.asset.update({
|
await tx.asset.update({
|
||||||
where: { id: lastChild.id },
|
where: { id: lastChild.id },
|
||||||
data: { parentId: stack.parentId, sortIndex: null },
|
data: { parentId: stack.parentId, sortIndex: stack.sortIndex },
|
||||||
})
|
})
|
||||||
await tx.asset.delete({ where: { id: stack.id } })
|
await tx.asset.delete({ where: { id: stack.id } })
|
||||||
}
|
}
|
||||||
@@ -273,6 +284,14 @@ export class AssetService {
|
|||||||
firstSortIndex = newSortIndex
|
firstSortIndex = newSortIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newParent.type === AssetType.version_stack) {
|
||||||
|
await dedupeSymlinksToTarget(tx, {
|
||||||
|
targetIds: req.assetIds,
|
||||||
|
newTargetId: newParent.id,
|
||||||
|
name: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const oldParent = await tx.asset.findUnique({
|
const oldParent = await tx.asset.findUnique({
|
||||||
where: { id: oldParentId },
|
where: { id: oldParentId },
|
||||||
})
|
})
|
||||||
@@ -579,6 +598,12 @@ export class AssetService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Update existing symlinks pointing to destFile or sourceAsset
|
||||||
|
await dedupeSymlinksToTarget(tx, {
|
||||||
|
targetIds: [destFile.id, sourceAsset.id],
|
||||||
|
newTargetId: stack.id,
|
||||||
|
})
|
||||||
|
|
||||||
const oldParent = await tx.asset.findUnique({ where: { id: oldParentId } })
|
const oldParent = await tx.asset.findUnique({ where: { id: oldParentId } })
|
||||||
if (oldParent) {
|
if (oldParent) {
|
||||||
await this.dissolveStackIfEmpty(tx, oldParent)
|
await this.dissolveStackIfEmpty(tx, oldParent)
|
||||||
@@ -932,9 +957,42 @@ export class AssetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateAssetName(req: UpdateAssetNameRequest): Promise<AssetInfo> {
|
async updateAssetName(req: UpdateAssetNameRequest): Promise<AssetInfo> {
|
||||||
const asset = await this.prismaClient.asset.update({
|
const existing = await this.prismaClient.asset.findUnique({
|
||||||
|
where: { id: req.id },
|
||||||
|
include: { target: true },
|
||||||
|
})
|
||||||
|
if (!existing) throw new Error('Asset not found')
|
||||||
|
|
||||||
|
let targetType = existing.type
|
||||||
|
let targetId = existing.id
|
||||||
|
|
||||||
|
if (existing.type === AssetType.symlink && existing.target) {
|
||||||
|
targetType = existing.target.type
|
||||||
|
targetId = existing.target.id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetType === AssetType.version_stack) {
|
||||||
|
const latestChild = await this.prismaClient.asset.findFirst({
|
||||||
|
where: { parentId: targetId, isDeleted: false },
|
||||||
|
orderBy: { sortIndex: 'asc' },
|
||||||
|
select: { id: true },
|
||||||
|
})
|
||||||
|
if (!latestChild) {
|
||||||
|
throw new Error('No active version found in stack to rename')
|
||||||
|
}
|
||||||
|
await this.prismaClient.asset.update({
|
||||||
|
where: { id: latestChild.id },
|
||||||
|
data: { name: req.name },
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await this.prismaClient.asset.update({
|
||||||
|
where: { id: req.id },
|
||||||
|
data: { name: req.name },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const asset = await this.prismaClient.asset.findUnique({
|
||||||
where: { id: req.id },
|
where: { id: req.id },
|
||||||
data: { name: req.name },
|
|
||||||
include: {
|
include: {
|
||||||
creator: true,
|
creator: true,
|
||||||
metadataValues: true,
|
metadataValues: true,
|
||||||
@@ -960,6 +1018,8 @@ export class AssetService {
|
|||||||
storageKey: true,
|
storageKey: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
if (!asset) throw new Error('Asset not found')
|
||||||
|
|
||||||
const infos = await this.toAssetInfos([asset as unknown as AssetWithIncludes])
|
const infos = await this.toAssetInfos([asset as unknown as AssetWithIncludes])
|
||||||
return infos[0]
|
return infos[0]
|
||||||
}
|
}
|
||||||
@@ -1319,30 +1379,43 @@ export class AssetService {
|
|||||||
const mentionedAgentIds = new Set(botMentionMatches.map((match) => match[1]))
|
const mentionedAgentIds = new Set(botMentionMatches.map((match) => match[1]))
|
||||||
const handledAgentIds = new Set<string>()
|
const handledAgentIds = new Set<string>()
|
||||||
|
|
||||||
|
// Effective role for the project context (project override wins; project-
|
||||||
|
// scoped members without project access resolve to null and are denied).
|
||||||
|
const effectiveRole = a.project?.team
|
||||||
|
? await resolveEffectiveRole(a.project.team.id, a.project.id, req.userId, tx)
|
||||||
|
: null
|
||||||
|
|
||||||
|
const userLevel = getRoleLevel(effectiveRole)
|
||||||
|
|
||||||
if (parentComment && a.project) {
|
if (parentComment && a.project) {
|
||||||
const rootSessionId = parentComment.sessionId
|
const rootSessionId = parentComment.sessionId
|
||||||
const isRootAgent = !!rootSessionId || parentComment.creator?.type === 'agent'
|
const isRootAgent = !!rootSessionId || parentComment.creator?.type === 'agent'
|
||||||
const rootAgentId = parentComment.creatorId
|
const rootAgentId = parentComment.creatorId
|
||||||
|
|
||||||
if (isRootAgent && rootAgentId && mentionedAgentIds.has(rootAgentId)) {
|
if (isRootAgent && rootAgentId && mentionedAgentIds.has(rootAgentId)) {
|
||||||
await tx.workflowTask.create({
|
const rootAgent = await tx.agent.findUnique({ where: { id: rootAgentId } })
|
||||||
data: {
|
const requiredLevel = getAgentRequiredLevel(rootAgent?.permission)
|
||||||
assetId: a.id,
|
|
||||||
type: 'chat',
|
if (userLevel >= requiredLevel) {
|
||||||
status: 'pending',
|
await tx.workflowTask.create({
|
||||||
teamId: a.project.team.id,
|
data: {
|
||||||
projectId: a.project.id,
|
assetId: a.id,
|
||||||
payload: {
|
type: 'chat',
|
||||||
|
status: 'pending',
|
||||||
|
teamId: a.project.team.id,
|
||||||
projectId: a.project.id,
|
projectId: a.project.id,
|
||||||
agent: {
|
payload: {
|
||||||
userCommentId: comment.id,
|
projectId: a.project.id,
|
||||||
agentId: rootAgentId,
|
agent: {
|
||||||
sessionId: rootSessionId || undefined,
|
userCommentId: comment.id,
|
||||||
userId: req.userId,
|
agentId: rootAgentId,
|
||||||
|
sessionId: rootSessionId || undefined,
|
||||||
|
userId: req.userId,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
})
|
}
|
||||||
handledAgentIds.add(rootAgentId)
|
handledAgentIds.add(rootAgentId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1356,7 +1429,12 @@ export class AssetService {
|
|||||||
foundAgent = true
|
foundAgent = true
|
||||||
} else {
|
} else {
|
||||||
const agent = await tx.agent.findUnique({ where: { id: agentId } })
|
const agent = await tx.agent.findUnique({ where: { id: agentId } })
|
||||||
if (agent) foundAgent = true
|
if (agent) {
|
||||||
|
const requiredLevel = getAgentRequiredLevel(agent.permission)
|
||||||
|
if (userLevel >= requiredLevel) {
|
||||||
|
foundAgent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundAgent && a.project) {
|
if (foundAgent && a.project) {
|
||||||
@@ -1592,6 +1670,15 @@ export class AssetService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const agentMdRecords =
|
||||||
|
assets.length > 0
|
||||||
|
? await this.prismaClient.assetAgentMd.findMany({
|
||||||
|
where: { assetId: { in: assets.map((a) => a.id) } },
|
||||||
|
select: { assetId: true },
|
||||||
|
})
|
||||||
|
: []
|
||||||
|
const hasAgentMdSet = new Set(agentMdRecords.map((r) => r.assetId))
|
||||||
|
|
||||||
const result: AssetInfo[] = []
|
const result: AssetInfo[] = []
|
||||||
for (const a of assets) {
|
for (const a of assets) {
|
||||||
let latestVersion:
|
let latestVersion:
|
||||||
@@ -1620,6 +1707,7 @@ export class AssetService {
|
|||||||
id: v.id,
|
id: v.id,
|
||||||
name: v.name,
|
name: v.name,
|
||||||
previewUrl: preview?.thumbnailUrl || null,
|
previewUrl: preview?.thumbnailUrl || null,
|
||||||
|
createdAt: v.createdAt.toISOString(),
|
||||||
creator: v.creator
|
creator: v.creator
|
||||||
? {
|
? {
|
||||||
id: v.creator.id,
|
id: v.creator.id,
|
||||||
@@ -1735,9 +1823,12 @@ export class AssetService {
|
|||||||
result.push({
|
result.push({
|
||||||
id: a.id,
|
id: a.id,
|
||||||
name:
|
name:
|
||||||
a.type === AssetType.version_stack && (a.name === '' || !a.name)
|
a.type === AssetType.version_stack ||
|
||||||
|
(a.type === AssetType.symlink && a.target?.type === AssetType.version_stack)
|
||||||
? latestVersion.name
|
? latestVersion.name
|
||||||
: a.name,
|
: a.type === AssetType.symlink
|
||||||
|
? a.name || latestVersion.name || a.target?.name || ''
|
||||||
|
: a.name,
|
||||||
sizeByte: Number(latestVersion.sizeByte),
|
sizeByte: Number(latestVersion.sizeByte),
|
||||||
fileCount: latestVersion.fileCount,
|
fileCount: latestVersion.fileCount,
|
||||||
type: a.type,
|
type: a.type,
|
||||||
@@ -1753,6 +1844,7 @@ export class AssetService {
|
|||||||
creator,
|
creator,
|
||||||
fieldValues,
|
fieldValues,
|
||||||
sortIndex: a.sortIndex,
|
sortIndex: a.sortIndex,
|
||||||
|
hasAgentsMd: hasAgentMdSet.has(a.id),
|
||||||
media: media as unknown as AssetInfo['media'],
|
media: media as unknown as AssetInfo['media'],
|
||||||
versionStack,
|
versionStack,
|
||||||
})
|
})
|
||||||
@@ -1766,7 +1858,8 @@ export class AssetService {
|
|||||||
version: number
|
version: number
|
||||||
name: string
|
name: string
|
||||||
previewUrl: string | null
|
previewUrl: string | null
|
||||||
creator: { id: string; name: string | null } | null
|
createdAt: string
|
||||||
|
creator: { id: string; name: string | null; image?: string | null } | null
|
||||||
}>
|
}>
|
||||||
> {
|
> {
|
||||||
const versions = await this.prismaClient.asset.findMany({
|
const versions = await this.prismaClient.asset.findMany({
|
||||||
@@ -1787,6 +1880,7 @@ export class AssetService {
|
|||||||
version: versions.length - i,
|
version: versions.length - i,
|
||||||
name: v.name,
|
name: v.name,
|
||||||
previewUrl: preview?.thumbnailUrl || null,
|
previewUrl: preview?.thumbnailUrl || null,
|
||||||
|
createdAt: v.createdAt.toISOString(),
|
||||||
creator: v.creator
|
creator: v.creator
|
||||||
? {
|
? {
|
||||||
id: v.creator.id,
|
id: v.creator.id,
|
||||||
@@ -2164,6 +2258,108 @@ export class AssetService {
|
|||||||
completionLastChangedBy,
|
completionLastChangedBy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getAgentsMd(assetId: string): Promise<string | null> {
|
||||||
|
const asset = await this.prismaClient.asset.findUnique({
|
||||||
|
where: { id: assetId },
|
||||||
|
select: { type: true },
|
||||||
|
})
|
||||||
|
if (!asset) throw new Error('Asset not found')
|
||||||
|
if (asset.type !== AssetType.folder && asset.type !== AssetType.root) {
|
||||||
|
throw new Error('AGENTS.md can only be stored on folders')
|
||||||
|
}
|
||||||
|
const record = await this.prismaClient.assetAgentMd.findUnique({
|
||||||
|
where: { assetId },
|
||||||
|
select: { content: true },
|
||||||
|
})
|
||||||
|
return record?.content ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateAgentsMd(assetId: string, content: string): Promise<{ content: string }> {
|
||||||
|
const asset = await this.prismaClient.asset.findUnique({
|
||||||
|
where: { id: assetId },
|
||||||
|
select: { id: true, type: true },
|
||||||
|
})
|
||||||
|
if (!asset) throw new Error('Asset not found')
|
||||||
|
if (asset.type !== AssetType.folder && asset.type !== AssetType.root) {
|
||||||
|
throw new Error('AGENTS.md can only be stored on folders')
|
||||||
|
}
|
||||||
|
const trimmed = content.trim()
|
||||||
|
if (trimmed.length === 0) {
|
||||||
|
await this.prismaClient.assetAgentMd.deleteMany({
|
||||||
|
where: { assetId },
|
||||||
|
})
|
||||||
|
return { content: '' }
|
||||||
|
}
|
||||||
|
const record = await this.prismaClient.assetAgentMd.upsert({
|
||||||
|
where: { assetId },
|
||||||
|
create: { assetId, content },
|
||||||
|
update: { content },
|
||||||
|
select: { content: true },
|
||||||
|
})
|
||||||
|
return { content: record.content }
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNestedAgentsMd(assetId: string): Promise<Array<{ path: string; content: string }>> {
|
||||||
|
let currentId: string | null = assetId
|
||||||
|
const nodes: Array<{
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
type: AssetType
|
||||||
|
parentId: string | null
|
||||||
|
}> = []
|
||||||
|
|
||||||
|
while (currentId) {
|
||||||
|
const node: {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
type: AssetType
|
||||||
|
parentId: string | null
|
||||||
|
} | null = await this.prismaClient.asset.findUnique({
|
||||||
|
where: { id: currentId },
|
||||||
|
select: { id: true, name: true, type: true, parentId: true },
|
||||||
|
})
|
||||||
|
if (!node) break
|
||||||
|
nodes.unshift(node)
|
||||||
|
currentId = node.parentId
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodes.length === 0) return []
|
||||||
|
|
||||||
|
const agentMds = await this.prismaClient.assetAgentMd.findMany({
|
||||||
|
where: { assetId: { in: nodes.map((n) => n.id) } },
|
||||||
|
select: { assetId: true, content: true },
|
||||||
|
})
|
||||||
|
const agentMdMap = new Map(agentMds.map((m) => [m.assetId, m.content]))
|
||||||
|
|
||||||
|
const results: Array<{ path: string; content: string }> = []
|
||||||
|
let currentFolderPath = ''
|
||||||
|
|
||||||
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
|
const node = nodes[i]
|
||||||
|
let virtualPath: string
|
||||||
|
|
||||||
|
if (node.type === AssetType.root || i === 0) {
|
||||||
|
currentFolderPath = ''
|
||||||
|
virtualPath = '/AGENTS.md'
|
||||||
|
} else {
|
||||||
|
currentFolderPath = currentFolderPath
|
||||||
|
? `${currentFolderPath}/${node.name}`
|
||||||
|
: `/${node.name}`
|
||||||
|
virtualPath = `${currentFolderPath}/AGENTS.md`
|
||||||
|
}
|
||||||
|
|
||||||
|
const content = agentMdMap.get(node.id)
|
||||||
|
if (content && content.trim().length > 0) {
|
||||||
|
results.push({
|
||||||
|
path: virtualPath,
|
||||||
|
content: content.trim(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const assetService = new AssetService()
|
export const assetService = new AssetService()
|
||||||
|
|||||||
@@ -0,0 +1,249 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { prisma } from '@shumai/db'
|
||||||
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
|
import { AssetType } from '@shumai/db'
|
||||||
|
import { dedupeSymlinksToTarget } from './symlink'
|
||||||
|
|
||||||
|
async function setupShareFolder(projectId: string, fileCount: number) {
|
||||||
|
const shareRoot = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'share-root',
|
||||||
|
type: AssetType.share_root,
|
||||||
|
projectId,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return shareRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('dedupeSymlinksToTarget', () => {
|
||||||
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
async function setupProject() {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Team ' + Date.now() } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Project ' + Date.now(), teamId: team.id },
|
||||||
|
})
|
||||||
|
const root = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const fileA = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'a.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const fileB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'b.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 20,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return { project, root, fileA, fileB }
|
||||||
|
}
|
||||||
|
|
||||||
|
it('repoints one symlink per parent and deletes duplicates, decrementing fileCount once', async () => {
|
||||||
|
const { project, root, fileA, fileB } = await setupProject()
|
||||||
|
const shareRoot = await setupShareFolder(project.id, 2)
|
||||||
|
|
||||||
|
const symA = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileA.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileA.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const symB = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileB.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileB.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 2,
|
||||||
|
sizeByte: 30,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.$transaction((tx) =>
|
||||||
|
dedupeSymlinksToTarget(tx, { targetIds: [fileA.id, fileB.id], newTargetId: stack.id }),
|
||||||
|
)
|
||||||
|
|
||||||
|
// First symlink repointed to the stack, second deleted
|
||||||
|
const repointed = await prisma.asset.findUnique({ where: { id: symA.id } })
|
||||||
|
expect(repointed?.targetId).toBe(stack.id)
|
||||||
|
expect(await prisma.asset.findUnique({ where: { id: symB.id } })).toBeNull()
|
||||||
|
|
||||||
|
// fileCount decremented exactly once (2 -> 1)
|
||||||
|
const updatedShareRoot = await prisma.asset.findUnique({ where: { id: shareRoot.id } })
|
||||||
|
expect(updatedShareRoot?.fileCount).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('deletes a file symlink when the parent already shows the stack', async () => {
|
||||||
|
const { project, root, fileA } = await setupProject()
|
||||||
|
const shareRoot = await setupShareFolder(project.id, 2)
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 1,
|
||||||
|
sizeByte: 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// Share already contains a symlink to the stack
|
||||||
|
const stackSymlink = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: stack.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// And a symlink to the file being moved into the stack
|
||||||
|
const fileSymlink = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileA.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileA.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.$transaction((tx) =>
|
||||||
|
dedupeSymlinksToTarget(tx, { targetIds: [fileA.id], newTargetId: stack.id }),
|
||||||
|
)
|
||||||
|
|
||||||
|
// File symlink deleted, stack symlink untouched
|
||||||
|
expect(await prisma.asset.findUnique({ where: { id: fileSymlink.id } })).toBeNull()
|
||||||
|
const updatedStackSymlink = await prisma.asset.findUnique({ where: { id: stackSymlink.id } })
|
||||||
|
expect(updatedStackSymlink?.targetId).toBe(stack.id)
|
||||||
|
|
||||||
|
// fileCount decremented once (2 -> 1)
|
||||||
|
const updatedShareRoot = await prisma.asset.findUnique({ where: { id: shareRoot.id } })
|
||||||
|
expect(updatedShareRoot?.fileCount).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('repoints symlinks in different share folders without changing fileCounts', async () => {
|
||||||
|
const { project, root, fileA, fileB } = await setupProject()
|
||||||
|
const share1 = await setupShareFolder(project.id, 1)
|
||||||
|
const share2 = await setupShareFolder(project.id, 1)
|
||||||
|
|
||||||
|
const sym1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileA.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: share1.id,
|
||||||
|
targetId: fileA.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const sym2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileB.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: share2.id,
|
||||||
|
targetId: fileB.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 2,
|
||||||
|
sizeByte: 30,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.$transaction((tx) =>
|
||||||
|
dedupeSymlinksToTarget(tx, { targetIds: [fileA.id, fileB.id], newTargetId: stack.id }),
|
||||||
|
)
|
||||||
|
|
||||||
|
expect((await prisma.asset.findUnique({ where: { id: sym1.id } }))?.targetId).toBe(stack.id)
|
||||||
|
expect((await prisma.asset.findUnique({ where: { id: sym2.id } }))?.targetId).toBe(stack.id)
|
||||||
|
expect((await prisma.asset.findUnique({ where: { id: share1.id } }))?.fileCount).toBe(1)
|
||||||
|
expect((await prisma.asset.findUnique({ where: { id: share2.id } }))?.fileCount).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('sets the provided name on repointed symlinks', async () => {
|
||||||
|
const { project, root, fileA } = await setupProject()
|
||||||
|
const shareRoot = await setupShareFolder(project.id, 1)
|
||||||
|
|
||||||
|
const sym = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: fileA.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareRoot.id,
|
||||||
|
targetId: fileA.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
type: AssetType.version_stack,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: project.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 1,
|
||||||
|
sizeByte: 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.$transaction((tx) =>
|
||||||
|
dedupeSymlinksToTarget(tx, {
|
||||||
|
targetIds: [fileA.id],
|
||||||
|
newTargetId: stack.id,
|
||||||
|
name: '',
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
const updatedSym = await prisma.asset.findUnique({ where: { id: sym.id } })
|
||||||
|
expect(updatedSym?.targetId).toBe(stack.id)
|
||||||
|
expect(updatedSym?.name).toBe('')
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import { Prisma } from '@shumai/db'
|
||||||
|
import { AssetType } from '@shumai/db'
|
||||||
|
|
||||||
|
interface DedupeSymlinksParams {
|
||||||
|
/** Files being merged into a version stack — symlinks pointing at them are the candidates. */
|
||||||
|
targetIds: string[]
|
||||||
|
/** The version stack the files are moving into. */
|
||||||
|
newTargetId: string
|
||||||
|
/** Optional name to set on repointed symlinks ('' for stacks — display name comes from the latest version). */
|
||||||
|
name?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When files are merged into a version stack, symlinks in share folders that
|
||||||
|
* pointed at those files must either be repointed to the stack (one per parent)
|
||||||
|
* or deleted as duplicates. Per parent folder: if the parent already shows the
|
||||||
|
* stack (either before this call or after the first repoint), delete the
|
||||||
|
* incoming symlink and decrement the parent's fileCount; otherwise repoint the
|
||||||
|
* first symlink to the stack.
|
||||||
|
*/
|
||||||
|
export async function dedupeSymlinksToTarget(
|
||||||
|
tx: Prisma.TransactionClient,
|
||||||
|
{ targetIds, newTargetId, name }: DedupeSymlinksParams,
|
||||||
|
): Promise<void> {
|
||||||
|
const existingSymlinks = await tx.asset.findMany({
|
||||||
|
where: { targetId: { in: targetIds }, type: AssetType.symlink },
|
||||||
|
orderBy: { id: 'asc' },
|
||||||
|
})
|
||||||
|
if (existingSymlinks.length === 0) return
|
||||||
|
|
||||||
|
// Parents that already display the stack (or will after the first repoint).
|
||||||
|
const stackSymlinkParents = new Set(
|
||||||
|
(
|
||||||
|
await tx.asset.findMany({
|
||||||
|
where: { targetId: newTargetId, type: AssetType.symlink },
|
||||||
|
select: { parentId: true },
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.map((s) => s.parentId)
|
||||||
|
.filter((id): id is string => !!id),
|
||||||
|
)
|
||||||
|
|
||||||
|
for (const symlink of existingSymlinks) {
|
||||||
|
if (!symlink.parentId) continue
|
||||||
|
if (stackSymlinkParents.has(symlink.parentId)) {
|
||||||
|
await tx.asset.delete({ where: { id: symlink.id } })
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: symlink.parentId },
|
||||||
|
data: { fileCount: { decrement: 1 } },
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
stackSymlinkParents.add(symlink.parentId)
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: symlink.id },
|
||||||
|
data: { targetId: newTargetId, ...(name !== undefined ? { name } : {}) },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma, type TeamMemberRole } from '@shumai/db'
|
||||||
import type { Prisma } from '@shumai/db'
|
import type { Prisma } from '@shumai/db'
|
||||||
import { HTTPException } from 'hono/http-exception'
|
import { HTTPException } from 'hono/http-exception'
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ export enum ResourceType {
|
|||||||
Invite = 'invite',
|
Invite = 'invite',
|
||||||
Comment = 'comment',
|
Comment = 'comment',
|
||||||
AgentSession = 'agentSession',
|
AgentSession = 'agentSession',
|
||||||
|
QuotaRule = 'quotaRule',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthzRequest {
|
export interface AuthzRequest {
|
||||||
@@ -33,13 +34,70 @@ export interface AuthzRequest {
|
|||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RoleDb = typeof prisma | Prisma.TransactionClient
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a user's effective role for a team/project context, mirroring the
|
||||||
|
* precedence rules enforced by `AuthzService.hasPermission`:
|
||||||
|
*
|
||||||
|
* 1. Project membership (`projectMember.role`) takes precedence inside a project.
|
||||||
|
* 2. Team-scoped members fall back to their team role when no project override exists.
|
||||||
|
* 3. Project-scoped members without a matching project record (or without a
|
||||||
|
* project context) are restricted (`null`).
|
||||||
|
*
|
||||||
|
* Returns `null` for non-members as well, so callers can fail closed.
|
||||||
|
*/
|
||||||
|
export async function resolveEffectiveRole(
|
||||||
|
teamId: string,
|
||||||
|
projectId: string | undefined,
|
||||||
|
userId: string,
|
||||||
|
db: RoleDb = prisma,
|
||||||
|
): Promise<TeamMemberRole | null> {
|
||||||
|
const member = await db.teamMember.findUnique({
|
||||||
|
where: {
|
||||||
|
teamIdUserId: {
|
||||||
|
teamId,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (!member) return null
|
||||||
|
|
||||||
|
// Project membership takes precedence when operating inside a project.
|
||||||
|
if (projectId) {
|
||||||
|
const pm = await db.projectMember.findUnique({
|
||||||
|
where: {
|
||||||
|
projectIdTeamMemberId: {
|
||||||
|
projectId,
|
||||||
|
teamMemberId: member.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (pm) return pm.role
|
||||||
|
}
|
||||||
|
|
||||||
|
// Team-scoped members fall back to their team role.
|
||||||
|
if (member.scope === 'team') return member.role
|
||||||
|
|
||||||
|
// Project-scoped members without a matching project record are restricted.
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
export class AuthzService {
|
export class AuthzService {
|
||||||
async hasPermission(req: AuthzRequest): Promise<void> {
|
async hasPermission(req: AuthzRequest): Promise<void> {
|
||||||
if (!req.user) throw new HTTPException(401, { message: 'User is required' })
|
if (!req.user) throw new HTTPException(401, { message: 'User is required' })
|
||||||
|
|
||||||
const { teamId, projectId } = await this.resolveContext(req.type, req.id)
|
const { teamId, projectId } = await this.resolveContext(req.type, req.id)
|
||||||
|
|
||||||
// 1. Check Team Membership
|
// Resolve the user's effective role using the shared precedence rules
|
||||||
|
// (project override -> team role for team-scoped members -> restricted).
|
||||||
|
const role = await resolveEffectiveRole(teamId, projectId, req.user.id)
|
||||||
|
if (role) {
|
||||||
|
return this.checkRole(role, req.permission)
|
||||||
|
}
|
||||||
|
|
||||||
|
// No effective role: either not a team member, or a project-scoped member
|
||||||
|
// without access to the resolved project context.
|
||||||
const member = await prisma.teamMember.findUnique({
|
const member = await prisma.teamMember.findUnique({
|
||||||
where: {
|
where: {
|
||||||
teamIdUserId: {
|
teamIdUserId: {
|
||||||
@@ -48,36 +106,12 @@ export class AuthzService {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!member) throw new HTTPException(403, { message: 'User is not a member of the team' })
|
if (!member) throw new HTTPException(403, { message: 'User is not a member of the team' })
|
||||||
|
|
||||||
// 2. Check Project Membership first if project context is available
|
// Project-scoped member on a team-level resource (no project context):
|
||||||
if (projectId) {
|
// allow Read (e.g. listing), deny Edit/Admin.
|
||||||
const pm = await prisma.projectMember.findUnique({
|
if (!projectId && req.permission === Permission.Read) {
|
||||||
where: {
|
return
|
||||||
projectIdTeamMemberId: {
|
|
||||||
projectId: projectId,
|
|
||||||
teamMemberId: member.id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if (pm) {
|
|
||||||
return this.checkRole(pm.role, req.permission)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Fall back to Team scope checks
|
|
||||||
if (member.scope === 'team') {
|
|
||||||
return this.checkRole(member.role, req.permission)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. Scope is Project, and no project-level record exists (or no project context was provided)
|
|
||||||
if (!projectId) {
|
|
||||||
// User has project scope but no project context provided (e.g. Team-level resource)
|
|
||||||
// If it's a team-level resource, project-scoped users can access Read (like ListProjects).
|
|
||||||
if (req.permission === Permission.Read) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw new HTTPException(403, { message: 'User has only project scope' })
|
throw new HTTPException(403, { message: 'User has only project scope' })
|
||||||
}
|
}
|
||||||
@@ -226,6 +260,15 @@ export class AuthzService {
|
|||||||
return { teamId: comment.asset.project.teamId, projectId: comment.asset.projectId! }
|
return { teamId: comment.asset.project.teamId, projectId: comment.asset.projectId! }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ResourceType.QuotaRule: {
|
||||||
|
const rule = await prisma.quotaRule.findUnique({
|
||||||
|
where: { id },
|
||||||
|
select: { teamId: true },
|
||||||
|
})
|
||||||
|
if (!rule) throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
return { teamId: rule.teamId }
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new HTTPException(403, { message: `Unsupported resource type: ${type}` })
|
throw new HTTPException(403, { message: `Unsupported resource type: ${type}` })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
import { prisma } from '@shumai/db'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
|
||||||
|
describe('resolveEffectiveRole', () => {
|
||||||
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
async function setupData() {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Role Team' } })
|
||||||
|
const projectA = await prisma.project.create({
|
||||||
|
data: { name: 'Project A', teamId: team.id },
|
||||||
|
})
|
||||||
|
const projectB = await prisma.project.create({
|
||||||
|
data: { name: 'Project B', teamId: team.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team-scoped owner
|
||||||
|
const owner = await prisma.user.create({ data: { name: 'Owner', email: 'o@x.com' } })
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: owner.id, role: 'owner', scope: 'team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team-scoped reviewer, promoted to project owner in Project A
|
||||||
|
const promoted = await prisma.user.create({ data: { name: 'Promoted', email: 'p@x.com' } })
|
||||||
|
const promotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: promoted.id, role: 'reviewer', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: projectA.id, teamMemberId: promotedTm.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team-scoped editor, demoted to project reviewer in Project A
|
||||||
|
const demoted = await prisma.user.create({ data: { name: 'Demoted', email: 'd@x.com' } })
|
||||||
|
const demotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: demoted.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: projectA.id, teamMemberId: demotedTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member (invited to Project A only, as editor)
|
||||||
|
const guest = await prisma.user.create({ data: { name: 'Guest', email: 'g@x.com' } })
|
||||||
|
const guestTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: guest.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: projectA.id, teamMemberId: guestTm.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Non-member
|
||||||
|
const outsider = await prisma.user.create({ data: { name: 'Outsider', email: 'x@x.com' } })
|
||||||
|
|
||||||
|
return { team, projectA, projectB, owner, promoted, demoted, guest, outsider }
|
||||||
|
}
|
||||||
|
|
||||||
|
it('returns the team role for team-scoped members without a project override', async () => {
|
||||||
|
const { team, projectA, owner } = await setupData()
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectA.id, owner.id)).resolves.toBe('owner')
|
||||||
|
await expect(resolveEffectiveRole(team.id, undefined, owner.id)).resolves.toBe('owner')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('prefers the project override over the team role', async () => {
|
||||||
|
const { team, projectA, projectB, promoted, demoted } = await setupData()
|
||||||
|
|
||||||
|
// Promoted: team reviewer -> project owner
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectA.id, promoted.id)).resolves.toBe('owner')
|
||||||
|
// Outside the overridden project, the team role applies
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectB.id, promoted.id)).resolves.toBe('reviewer')
|
||||||
|
|
||||||
|
// Demoted: team editor -> project reviewer
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectA.id, demoted.id)).resolves.toBe('reviewer')
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectB.id, demoted.id)).resolves.toBe('editor')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resolves the project role for project-scoped members inside their project', async () => {
|
||||||
|
const { team, projectA, guest } = await setupData()
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectA.id, guest.id)).resolves.toBe('editor')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('restricts project-scoped members without a matching project record', async () => {
|
||||||
|
const { team, projectB, guest } = await setupData()
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectB.id, guest.id)).resolves.toBeNull()
|
||||||
|
await expect(resolveEffectiveRole(team.id, undefined, guest.id)).resolves.toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('returns null for non-members', async () => {
|
||||||
|
const { team, projectA, outsider } = await setupData()
|
||||||
|
await expect(resolveEffectiveRole(team.id, projectA.id, outsider.id)).resolves.toBeNull()
|
||||||
|
await expect(resolveEffectiveRole(team.id, undefined, outsider.id)).resolves.toBeNull()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -255,6 +255,61 @@ describe('ChatService', () => {
|
|||||||
expect(taskPayload?.agent?.imageUrls).toContain('doc_s3_key')
|
expect(taskPayload?.agent?.imageUrls).toContain('doc_s3_key')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should enforce agent permissions in startOrContinueChat', async () => {
|
||||||
|
const { team, project } = await setupBasicData()
|
||||||
|
|
||||||
|
// Create an owner-only agent
|
||||||
|
const ownerAgentUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Owner Agent User',
|
||||||
|
email: `owner-agent-${Date.now()}@shumai.ai`,
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const ownerAgent = await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: ownerAgentUser.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'owner',
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create an editor user and a reviewer user
|
||||||
|
const editorUser = await prisma.user.create({
|
||||||
|
data: { name: 'Editor User', email: `ed-${Date.now()}@shumai.ai`, password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: editorUser.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviewerUser = await prisma.user.create({
|
||||||
|
data: { name: 'Reviewer User', email: `rev-${Date.now()}@shumai.ai`, password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: reviewerUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Editor trying to chat with owner-only agent should fail
|
||||||
|
await expect(
|
||||||
|
chatService.startOrContinueChat(editorUser, team.id, {
|
||||||
|
agentId: ownerAgent.id,
|
||||||
|
textPrompt: 'test',
|
||||||
|
projectId: project.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('Permission denied')
|
||||||
|
|
||||||
|
// Reviewer trying to chat with owner-only agent should fail
|
||||||
|
await expect(
|
||||||
|
chatService.startOrContinueChat(reviewerUser, team.id, {
|
||||||
|
agentId: ownerAgent.id,
|
||||||
|
textPrompt: 'test',
|
||||||
|
projectId: project.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('Permission denied')
|
||||||
|
})
|
||||||
|
|
||||||
it('should list sessions of a user and only return chat type sessions', async () => {
|
it('should list sessions of a user and only return chat type sessions', async () => {
|
||||||
const { user, team, project } = await setupBasicData()
|
const { user, team, project } = await setupBasicData()
|
||||||
|
|
||||||
@@ -688,6 +743,9 @@ describe('ChatService', () => {
|
|||||||
const otherUser = await prisma.user.create({
|
const otherUser = await prisma.user.create({
|
||||||
data: { name: 'Other User', email: `other-${Date.now()}@example.com`, password: 'pw' },
|
data: { name: 'Other User', email: `other-${Date.now()}@example.com`, password: 'pw' },
|
||||||
})
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: otherUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
const { sessionId } = await chatService.startOrContinueChat(otherUser, team.id, {
|
const { sessionId } = await chatService.startOrContinueChat(otherUser, team.id, {
|
||||||
agentId: 'test-agent-id',
|
agentId: 'test-agent-id',
|
||||||
textPrompt: 'hello',
|
textPrompt: 'hello',
|
||||||
@@ -718,4 +776,129 @@ describe('ChatService', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('project-aware agent permission checks', () => {
|
||||||
|
async function setupProjectRoles() {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: {
|
||||||
|
name: 'Team Roles',
|
||||||
|
settings: { transcode: { videoStrategy: 'best_match' }, chatbotAgentId: 'test-agent-id' },
|
||||||
|
sandbox: { create: {} },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Proj Roles', teamId: team.id },
|
||||||
|
})
|
||||||
|
const rootFolder = await prisma.asset.create({
|
||||||
|
data: { name: 'root', type: 'root', status: 'processed', projectId: project.id },
|
||||||
|
})
|
||||||
|
await prisma.project.update({
|
||||||
|
where: { id: project.id },
|
||||||
|
data: { rootFolderId: rootFolder.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
const createAgent = async (name: string, permission: 'owner' | 'editor' | 'reviewer') => {
|
||||||
|
const agentUser = await prisma.user.create({
|
||||||
|
data: { name, email: `${name}-${Date.now()}@shumai.ai`, type: 'agent' },
|
||||||
|
})
|
||||||
|
return prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: agentUser.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission,
|
||||||
|
config: { provider: 'openai', model: 'gpt-4' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const editorAgent = await createAgent('Editor Agent', 'editor')
|
||||||
|
const ownerAgent = await createAgent('Owner Agent', 'owner')
|
||||||
|
|
||||||
|
// Team editor demoted to project reviewer
|
||||||
|
const demoted = await prisma.user.create({
|
||||||
|
data: { name: 'Demoted', email: `dem-${Date.now()}@x.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const demotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: demoted.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: demotedTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member invited as editor
|
||||||
|
const projEditor = await prisma.user.create({
|
||||||
|
data: { name: 'Proj Editor', email: `pe-${Date.now()}@x.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const projEditorTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: projEditor.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: projEditorTm.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team reviewer promoted to project owner
|
||||||
|
const promoted = await prisma.user.create({
|
||||||
|
data: { name: 'Promoted', email: `pro-${Date.now()}@x.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const promotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: promoted.id, role: 'reviewer', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: promotedTm.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Plain team reviewer (no project override)
|
||||||
|
const reviewer = await prisma.user.create({
|
||||||
|
data: { name: 'Reviewer', email: `rev-${Date.now()}@x.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: reviewer.id, role: 'reviewer', scope: 'team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
return { team, project, editorAgent, ownerAgent, demoted, projEditor, promoted, reviewer }
|
||||||
|
}
|
||||||
|
|
||||||
|
it('denies an editor agent to a team editor demoted to project reviewer', async () => {
|
||||||
|
const { team, project, editorAgent, demoted } = await setupProjectRoles()
|
||||||
|
await expect(
|
||||||
|
chatService.startOrContinueChat(demoted, team.id, {
|
||||||
|
agentId: editorAgent.id,
|
||||||
|
textPrompt: 'hello',
|
||||||
|
projectId: project.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow(/Insufficient role/)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('allows an editor agent to a project-scoped member invited as editor', async () => {
|
||||||
|
const { team, project, editorAgent, projEditor } = await setupProjectRoles()
|
||||||
|
const { sessionId } = await chatService.startOrContinueChat(projEditor, team.id, {
|
||||||
|
agentId: editorAgent.id,
|
||||||
|
textPrompt: 'hello',
|
||||||
|
projectId: project.id,
|
||||||
|
})
|
||||||
|
expect(sessionId).toBeDefined()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('allows an owner agent to a team reviewer promoted to project owner', async () => {
|
||||||
|
const { team, project, ownerAgent, promoted } = await setupProjectRoles()
|
||||||
|
const { sessionId } = await chatService.startOrContinueChat(promoted, team.id, {
|
||||||
|
agentId: ownerAgent.id,
|
||||||
|
textPrompt: 'hello',
|
||||||
|
projectId: project.id,
|
||||||
|
})
|
||||||
|
expect(sessionId).toBeDefined()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('denies an editor agent to a plain team reviewer', async () => {
|
||||||
|
const { team, project, editorAgent, reviewer } = await setupProjectRoles()
|
||||||
|
await expect(
|
||||||
|
chatService.startOrContinueChat(reviewer, team.id, {
|
||||||
|
agentId: editorAgent.id,
|
||||||
|
textPrompt: 'hello',
|
||||||
|
projectId: project.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow(/Insufficient role/)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import type { Prisma } from '@shumai/db'
|
import type { Prisma } from '@shumai/db'
|
||||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
import {
|
||||||
|
authzService,
|
||||||
|
Permission,
|
||||||
|
ResourceType,
|
||||||
|
resolveEffectiveRole,
|
||||||
|
} from '@shumai/core/src/authz/authz'
|
||||||
import { paginateQuery, type PaginatedData } from '@shumai/core/src/pagination'
|
import { paginateQuery, type PaginatedData } from '@shumai/core/src/pagination'
|
||||||
import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos'
|
import type { ChatRequest, ChatSessionInfo, ChatMessage } from '@shumai/dtos'
|
||||||
import type { SessionTreeEntry } from '@earendil-works/pi-agent-core'
|
import type { SessionTreeEntry } from '@earendil-works/pi-agent-core'
|
||||||
import { workflowService } from '@shumai/workflow-core'
|
import { workflowService } from '@shumai/workflow-core'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
|
import { getAgentRequiredLevel, getRoleLevel } from '@shumai/core/src/agent/permissions'
|
||||||
|
|
||||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||||
|
|
||||||
@@ -281,7 +287,10 @@ export class ChatService {
|
|||||||
let activeSessionId = passedSessionId
|
let activeSessionId = passedSessionId
|
||||||
|
|
||||||
// Ensure AI agent configuration exists
|
// Ensure AI agent configuration exists
|
||||||
const agent = await tx.agent.findUnique({ where: { id: agentId } })
|
const agent = await tx.agent.findUnique({
|
||||||
|
where: { id: agentId },
|
||||||
|
include: { user: true },
|
||||||
|
})
|
||||||
if (!agent) {
|
if (!agent) {
|
||||||
throw new Error(`Agent with ID "${agentId}" not found`)
|
throw new Error(`Agent with ID "${agentId}" not found`)
|
||||||
}
|
}
|
||||||
@@ -289,6 +298,36 @@ export class ChatService {
|
|||||||
throw new Error(`Agent does not belong to the specified team`)
|
throw new Error(`Agent does not belong to the specified team`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check user's permission to use this agent, resolving the effective
|
||||||
|
// role for the project context (projectMember.role takes precedence over
|
||||||
|
// the team role; project-scoped members without project access are denied).
|
||||||
|
const member = await tx.teamMember.findUnique({
|
||||||
|
where: {
|
||||||
|
teamIdUserId: {
|
||||||
|
teamId,
|
||||||
|
userId: user.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (!member) {
|
||||||
|
throw new Error('User is not a member of the team')
|
||||||
|
}
|
||||||
|
|
||||||
|
const effectiveRole = await resolveEffectiveRole(teamId, projectId, user.id, tx)
|
||||||
|
if (!effectiveRole) {
|
||||||
|
throw new Error(
|
||||||
|
`Permission denied: Insufficient role to use agent "${agent.user.name}". Minimum required role is "${agent.permission}".`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const userLevel = getRoleLevel(effectiveRole)
|
||||||
|
const requiredLevel = getAgentRequiredLevel(agent.permission)
|
||||||
|
if (userLevel < requiredLevel) {
|
||||||
|
throw new Error(
|
||||||
|
`Permission denied: Insufficient role to use agent "${agent.user.name}". Minimum required role is "${agent.permission}".`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (activeSessionId) {
|
if (activeSessionId) {
|
||||||
const sessionExists = await tx.agentSession.findUnique({
|
const sessionExists = await tx.agentSession.findUnique({
|
||||||
where: { id: activeSessionId },
|
where: { id: activeSessionId },
|
||||||
|
|||||||
@@ -26,3 +26,4 @@ export * from './ai-usage/ai-usage'
|
|||||||
export * from './watermark/watermark'
|
export * from './watermark/watermark'
|
||||||
export * from './gotenberg/gotenberg'
|
export * from './gotenberg/gotenberg'
|
||||||
export * from './mcp/mcp-service'
|
export * from './mcp/mcp-service'
|
||||||
|
export * from './quota/quota-service'
|
||||||
|
|||||||
@@ -536,6 +536,109 @@ describe('McpService', () => {
|
|||||||
expect(allowed.ok).toBe(true)
|
expect(allowed.ok).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('uses the effective project role for MCP permission checks', async () => {
|
||||||
|
const server = await service.createServer(teamId, {
|
||||||
|
url: srv.url,
|
||||||
|
permission: 'editor',
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'MCP Proj', teamId },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Team editor demoted to project reviewer: denied inside the project
|
||||||
|
const demoted = await prisma.user.create({
|
||||||
|
data: { name: 'Demoted MCP', email: `dem-mcp-${Date.now()}@shumai.ai`, type: 'human' },
|
||||||
|
})
|
||||||
|
const demotedTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId, userId: demoted.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: demotedTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const denied = await service.callMcpTool(
|
||||||
|
server.id,
|
||||||
|
'echo',
|
||||||
|
{ text: 'x' },
|
||||||
|
{ teamId, userId: demoted.id, projectId: project.id },
|
||||||
|
)
|
||||||
|
expect(denied.ok).toBe(false)
|
||||||
|
expect((denied.content[0] as { text?: string }).text).toContain('Permission denied')
|
||||||
|
|
||||||
|
// Project-scoped member invited as editor: allowed
|
||||||
|
const projEditor = await prisma.user.create({
|
||||||
|
data: { name: 'PE MCP', email: `pe-mcp-${Date.now()}@shumai.ai`, type: 'human' },
|
||||||
|
})
|
||||||
|
const peTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId, userId: projEditor.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: peTm.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const allowed = await service.callMcpTool(
|
||||||
|
server.id,
|
||||||
|
'echo',
|
||||||
|
{ text: 'ok' },
|
||||||
|
{ teamId, userId: projEditor.id, projectId: project.id },
|
||||||
|
)
|
||||||
|
expect(allowed.ok).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('filters assigned MCP servers by the user effective role when building agent tools', async () => {
|
||||||
|
const agent = await seedAgentAndUser(teamId, 'Filtered MCP Agent')
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'MCP Filter Proj', teamId },
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviewerSrv = await startTestMcpServer({
|
||||||
|
tools: standardTestTools(),
|
||||||
|
serverInfo: { name: 'reviewer-only-mcp' },
|
||||||
|
})
|
||||||
|
const editorSrv = await startTestMcpServer({
|
||||||
|
tools: standardTestTools(),
|
||||||
|
serverInfo: { name: 'editor-only-mcp' },
|
||||||
|
})
|
||||||
|
const reviewerServer = await service.createServer(teamId, {
|
||||||
|
url: reviewerSrv.url,
|
||||||
|
permission: 'reviewer',
|
||||||
|
})
|
||||||
|
const editorServer = await service.createServer(teamId, {
|
||||||
|
url: editorSrv.url,
|
||||||
|
permission: 'editor',
|
||||||
|
})
|
||||||
|
await service.refreshServer(reviewerServer.id)
|
||||||
|
await service.refreshServer(editorServer.id)
|
||||||
|
await prisma.agentMcpServer.create({
|
||||||
|
data: { agentId: agent.id, mcpServerId: reviewerServer.id },
|
||||||
|
})
|
||||||
|
await prisma.agentMcpServer.create({
|
||||||
|
data: { agentId: agent.id, mcpServerId: editorServer.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Project-scoped member invited as reviewer: only the reviewer server's
|
||||||
|
// tools are attached; the editor server's tools are not even registered.
|
||||||
|
const reviewer = await prisma.user.create({
|
||||||
|
data: { name: 'Filter Reviewer', email: `fr-${Date.now()}@shumai.ai`, type: 'human' },
|
||||||
|
})
|
||||||
|
const reviewerTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId, userId: reviewer.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: reviewerTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const tools = await service.buildAgentTools(agent.id, teamId, reviewer.id, project.id)
|
||||||
|
const descriptions = tools
|
||||||
|
.map((t) => (t.description ?? '') + (t.name === 'mcp' ? JSON.stringify(t.parameters) : ''))
|
||||||
|
.join('\n')
|
||||||
|
expect(descriptions).toContain('reviewer-only-mcp')
|
||||||
|
expect(descriptions).not.toContain('editor-only-mcp')
|
||||||
|
|
||||||
|
await reviewerSrv.stop()
|
||||||
|
await editorSrv.stop()
|
||||||
|
})
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Per-agent assignment (D6)
|
// Per-agent assignment (D6)
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import { auth } from '@modelcontextprotocol/client'
|
import { auth } from '@modelcontextprotocol/client'
|
||||||
import type { AgentTool, AgentToolResult } from '@earendil-works/pi-agent-core'
|
import type { AgentTool, AgentToolResult } from '@earendil-works/pi-agent-core'
|
||||||
import { prisma } from '@shumai/db'
|
import { prisma, type TeamMemberRole } from '@shumai/db'
|
||||||
import '@shumai/db/src/prisma-json-types'
|
import '@shumai/db/src/prisma-json-types'
|
||||||
import type {
|
import type {
|
||||||
CreateMcpServerRequest,
|
CreateMcpServerRequest,
|
||||||
@@ -13,6 +13,8 @@ import type {
|
|||||||
UpdateMcpServerRequest,
|
UpdateMcpServerRequest,
|
||||||
} from '@shumai/dtos'
|
} from '@shumai/dtos'
|
||||||
import { logger } from '@shumai/core/src/logger'
|
import { logger } from '@shumai/core/src/logger'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
|
import { quotaService } from '@shumai/core/src/quota/quota-service'
|
||||||
import { mcpDbStore, type PendingAuth } from './mcp-db-store'
|
import { mcpDbStore, type PendingAuth } from './mcp-db-store'
|
||||||
import { buildDirectTools, isDirectTool } from './mcp-direct-tools'
|
import { buildDirectTools, isDirectTool } from './mcp-direct-tools'
|
||||||
import { McpOauthProvider, type McpOauthConfig } from './mcp-oauth-provider'
|
import { McpOauthProvider, type McpOauthConfig } from './mcp-oauth-provider'
|
||||||
@@ -34,6 +36,7 @@ const ROLE_HIERARCHY: Record<string, number> = {
|
|||||||
export interface McpToolCallContext {
|
export interface McpToolCallContext {
|
||||||
teamId: string
|
teamId: string
|
||||||
userId?: string
|
userId?: string
|
||||||
|
projectId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type McpToolCallContent = AgentToolResult<Record<string, unknown>>['content']
|
export type McpToolCallContent = AgentToolResult<Record<string, unknown>>['content']
|
||||||
@@ -468,16 +471,10 @@ export class McpService {
|
|||||||
const requiredLevel = ROLE_HIERARCHY[server.permission] || 1
|
const requiredLevel = ROLE_HIERARCHY[server.permission] || 1
|
||||||
|
|
||||||
if (ctx?.userId) {
|
if (ctx?.userId) {
|
||||||
const member = await prisma.teamMember.findUnique({
|
// Resolve the user's effective role for the project context (project
|
||||||
where: {
|
// override wins; project-scoped members without project access are denied).
|
||||||
teamIdUserId: {
|
const effectiveRole = await resolveEffectiveRole(server.teamId, ctx.projectId, ctx.userId)
|
||||||
teamId: server.teamId,
|
const userLevel = effectiveRole ? ROLE_HIERARCHY[effectiveRole] || 0 : 0
|
||||||
userId: ctx.userId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
select: { role: true },
|
|
||||||
})
|
|
||||||
const userLevel = member ? ROLE_HIERARCHY[member.role] || 0 : 0
|
|
||||||
if (userLevel < requiredLevel) {
|
if (userLevel < requiredLevel) {
|
||||||
return `Permission denied: Insufficient role to use MCP server "${server.name}". Minimum required role is "${server.permission}".`
|
return `Permission denied: Insufficient role to use MCP server "${server.name}". Minimum required role is "${server.permission}".`
|
||||||
}
|
}
|
||||||
@@ -533,6 +530,32 @@ export class McpService {
|
|||||||
return { ok: false, content: [{ type: 'text', text: denied }] }
|
return { ok: false, content: [{ type: 'text', text: denied }] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let role: TeamMemberRole | null | undefined = undefined
|
||||||
|
if (ctx?.teamId && ctx?.userId) {
|
||||||
|
role = await resolveEffectiveRole(ctx.teamId, ctx.projectId, ctx.userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx?.teamId) {
|
||||||
|
try {
|
||||||
|
await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: ctx.teamId,
|
||||||
|
userId: ctx.userId,
|
||||||
|
role,
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: serverId, mcpServerId: serverId },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
} catch (err: unknown) {
|
||||||
|
const message = err instanceof Error ? err.message : String(err)
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
content: [{ type: 'text', text: `Quota exceeded: ${message}` }],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const outcome = await this.ensureConnected(serverId)
|
const outcome = await this.ensureConnected(serverId)
|
||||||
if (outcome.status === 'needs-auth') {
|
if (outcome.status === 'needs-auth') {
|
||||||
return {
|
return {
|
||||||
@@ -559,6 +582,24 @@ export class McpService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.manager.callTool(serverId, toolName, args)
|
const result = await this.manager.callTool(serverId, toolName, args)
|
||||||
|
|
||||||
|
if (ctx?.teamId) {
|
||||||
|
try {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: ctx.teamId,
|
||||||
|
userId: ctx.userId,
|
||||||
|
role,
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: serverId, mcpServerId: serverId },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Failed to record quota usage for MCP tool call')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result.isError) {
|
if (result.isError) {
|
||||||
const text = result.content.map((c) => ('text' in c ? c.text : '[image]')).join('\n')
|
const text = result.content.map((c) => ('text' in c ? c.text : '[image]')).join('\n')
|
||||||
return {
|
return {
|
||||||
@@ -791,47 +832,65 @@ export class McpService {
|
|||||||
* Build the agent's MCP AgentTools: the single `mcp` proxy tool plus direct
|
* Build the agent's MCP AgentTools: the single `mcp` proxy tool plus direct
|
||||||
* tools for assigned servers in direct-tools mode. Returns [] when the agent
|
* tools for assigned servers in direct-tools mode. Returns [] when the agent
|
||||||
* has no assigned servers (no proxy tool — don't waste LLM context).
|
* has no assigned servers (no proxy tool — don't waste LLM context).
|
||||||
|
*
|
||||||
|
* When a user context is provided, servers whose `permission` exceeds the
|
||||||
|
* user's effective project role are filtered out up front, so the model never
|
||||||
|
* sees tools it is not allowed to call (call-time checks remain as a backstop).
|
||||||
*/
|
*/
|
||||||
async buildAgentTools(agentId: string, teamId: string, userId?: string): Promise<AgentTool[]> {
|
async buildAgentTools(
|
||||||
|
agentId: string,
|
||||||
|
teamId: string,
|
||||||
|
userId?: string,
|
||||||
|
projectId?: string,
|
||||||
|
): Promise<AgentTool[]> {
|
||||||
const assignments = await prisma.agentMcpServer.findMany({
|
const assignments = await prisma.agentMcpServer.findMany({
|
||||||
where: { agentId },
|
where: { agentId },
|
||||||
include: { mcpServer: true },
|
include: { mcpServer: true },
|
||||||
})
|
})
|
||||||
if (assignments.length === 0) return []
|
if (assignments.length === 0) return []
|
||||||
|
|
||||||
|
let assignedServers = assignments.map((a) => a.mcpServer)
|
||||||
|
if (userId) {
|
||||||
|
const effectiveRole = await resolveEffectiveRole(teamId, projectId, userId)
|
||||||
|
if (!effectiveRole) return []
|
||||||
|
const userLevel = ROLE_HIERARCHY[effectiveRole] || 0
|
||||||
|
assignedServers = assignedServers.filter(
|
||||||
|
(s) => (ROLE_HIERARCHY[s.permission] || 1) <= userLevel,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (assignedServers.length === 0) return []
|
||||||
|
|
||||||
// Per-agent tool registry: built fresh for this agent from the persisted
|
// Per-agent tool registry: built fresh for this agent from the persisted
|
||||||
// discovery cache (McpServer.tools). It only ever contains the agent's
|
// discovery cache (McpServer.tools). It only ever contains the agent's
|
||||||
// assigned servers, so unassigned/disabled servers can neither be searched
|
// assigned servers, so unassigned/disabled servers can neither be searched
|
||||||
// nor called — no global mutable state to leak through.
|
// nor called — no global mutable state to leak through.
|
||||||
const registry = new McpToolRegistry()
|
const registry = new McpToolRegistry()
|
||||||
|
|
||||||
const servers = assignments
|
const servers = assignedServers.map((s) => {
|
||||||
.map((a) => a.mcpServer)
|
const storedTools = (s.tools ?? []) as PrismaJson.McpToolInfo[]
|
||||||
.map((s) => {
|
if (storedTools.length > 0) {
|
||||||
const storedTools = (s.tools ?? []) as PrismaJson.McpToolInfo[]
|
registry.setTools(
|
||||||
if (storedTools.length > 0) {
|
s.id,
|
||||||
registry.setTools(
|
s.name,
|
||||||
s.id,
|
storedTools.map((t) => ({
|
||||||
s.name,
|
name: t.name,
|
||||||
storedTools.map((t) => ({
|
description: t.description ?? '',
|
||||||
name: t.name,
|
...(t.inputSchema !== undefined ? { inputSchema: t.inputSchema } : {}),
|
||||||
description: t.description ?? '',
|
})),
|
||||||
...(t.inputSchema !== undefined ? { inputSchema: t.inputSchema } : {}),
|
{ excludeTools: s.config?.excludeTools },
|
||||||
})),
|
)
|
||||||
{ excludeTools: s.config?.excludeTools },
|
}
|
||||||
)
|
return {
|
||||||
}
|
id: s.id,
|
||||||
return {
|
name: s.name,
|
||||||
id: s.id,
|
instructions: s.instructions ?? null,
|
||||||
name: s.name,
|
url: s.url,
|
||||||
instructions: s.instructions ?? null,
|
transport: s.transport,
|
||||||
url: s.url,
|
authConfig: (s.authConfig ?? {}) as PrismaJson.McpServerAuthConfig,
|
||||||
transport: s.transport,
|
config: (s.config ?? {}) as PrismaJson.McpServerConfig,
|
||||||
authConfig: (s.authConfig ?? {}) as PrismaJson.McpServerAuthConfig,
|
status: s.status,
|
||||||
config: (s.config ?? {}) as PrismaJson.McpServerConfig,
|
}
|
||||||
status: s.status,
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const serverNameById = new Map<string, string>()
|
const serverNameById = new Map<string, string>()
|
||||||
const serverIdByName = new Map<string, string>()
|
const serverIdByName = new Map<string, string>()
|
||||||
@@ -880,7 +939,7 @@ export class McpService {
|
|||||||
},
|
},
|
||||||
ensureConnected: (serverId) => this.ensureConnected(serverId, registry),
|
ensureConnected: (serverId) => this.ensureConnected(serverId, registry),
|
||||||
callTool: (serverId, toolName, args) =>
|
callTool: (serverId, toolName, args) =>
|
||||||
this.callMcpTool(serverId, toolName, args, { teamId, userId }),
|
this.callMcpTool(serverId, toolName, args, { teamId, userId, projectId }),
|
||||||
authStatus: (serverId) => this.getAuthStatus(serverId),
|
authStatus: (serverId) => this.getAuthStatus(serverId),
|
||||||
startAuth: (serverId) => this.startAuth(serverId),
|
startAuth: (serverId) => this.startAuth(serverId),
|
||||||
getInstructions: (serverId) => this.getServerInstructions(serverId),
|
getInstructions: (serverId) => this.getServerInstructions(serverId),
|
||||||
@@ -898,7 +957,7 @@ export class McpService {
|
|||||||
serverId: server.id,
|
serverId: server.id,
|
||||||
serverName: server.name,
|
serverName: server.name,
|
||||||
callTool: (serverId, toolName, args) =>
|
callTool: (serverId, toolName, args) =>
|
||||||
this.callMcpTool(serverId, toolName, args, { teamId, userId }),
|
this.callMcpTool(serverId, toolName, args, { teamId, userId, projectId }),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,6 +194,57 @@ describe('ProjectService', () => {
|
|||||||
includeAgents: true,
|
includeAgents: true,
|
||||||
})
|
})
|
||||||
expect(allMembers).toHaveLength(2)
|
expect(allMembers).toHaveLength(2)
|
||||||
|
const agentMember = allMembers.find((m) => m.id === bot.id)
|
||||||
|
const humanMember = allMembers.find((m) => m.id === human.id)
|
||||||
|
expect(agentMember?.type).toBe('agent')
|
||||||
|
expect(humanMember?.type).toBe('human')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('filters agent bots by the requester effective project role', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Team Bot Filter' } })
|
||||||
|
const project = await prisma.project.create({ data: { name: 'P2', teamId: team.id } })
|
||||||
|
|
||||||
|
const createChatAgent = async (name: string, permission: 'owner' | 'editor' | 'reviewer') => {
|
||||||
|
const bot = await prisma.user.create({
|
||||||
|
data: { name, email: `${name}-${Date.now()}@example.com`, password: 'pw', type: 'agent' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: bot.id, role: 'editor', scope: 'team' },
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: bot.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
enabled: true,
|
||||||
|
permission,
|
||||||
|
config: { provider: 'google', model: 'gemini' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await createChatAgent('Reviewer Bot', 'reviewer')
|
||||||
|
await createChatAgent('Editor Bot', 'editor')
|
||||||
|
|
||||||
|
// Project-scoped requester invited as reviewer: sees only reviewer bots
|
||||||
|
const requester = await prisma.user.create({
|
||||||
|
data: { name: 'Req', email: `req-${Date.now()}@example.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const requesterTm = await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: requester.id, role: 'reviewer', scope: 'project' },
|
||||||
|
})
|
||||||
|
await prisma.projectMember.create({
|
||||||
|
data: { projectId: project.id, teamMemberId: requesterTm.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const members = await projectService.listProjectMembers({
|
||||||
|
projectId: project.id,
|
||||||
|
includeAgents: true,
|
||||||
|
requesterUserId: requester.id,
|
||||||
|
})
|
||||||
|
const agentNames = members.filter((m) => m.id !== requester.id).map((m) => m.name)
|
||||||
|
expect(agentNames).toContain('Reviewer Bot')
|
||||||
|
expect(agentNames).not.toContain('Editor Bot')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should allow upserting custom role override for team-scoped members via updateMemberRole', async () => {
|
it('should allow upserting custom role override for team-scoped members via updateMemberRole', async () => {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { Prisma } from '@shumai/db'
|
|||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { paginateQuery, PaginatedData } from '@shumai/core/src/pagination'
|
import { paginateQuery, PaginatedData } from '@shumai/core/src/pagination'
|
||||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||||
|
import { getAllowedAgentRoles } from '@shumai/core/src/agent/permissions'
|
||||||
|
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||||
import {
|
import {
|
||||||
ServiceCreateProjectRequest,
|
ServiceCreateProjectRequest,
|
||||||
ServiceUpdateProjectRequest,
|
ServiceUpdateProjectRequest,
|
||||||
@@ -226,17 +228,35 @@ export class ProjectService {
|
|||||||
})
|
})
|
||||||
if (!project) throw new Error('Project not found')
|
if (!project) throw new Error('Project not found')
|
||||||
|
|
||||||
|
// When agents are requested, only include the chat agents the requester's
|
||||||
|
// effective project role permits (project override wins; restricted
|
||||||
|
// requesters see no agents at all). Without a requester context, fall back
|
||||||
|
// to including all enabled chat agents (legacy behavior).
|
||||||
|
let agentFilter: Prisma.AgentWhereInput | undefined
|
||||||
|
if (req.includeAgents) {
|
||||||
|
if (req.requesterUserId) {
|
||||||
|
const effectiveRole = await resolveEffectiveRole(
|
||||||
|
project.teamId,
|
||||||
|
req.projectId,
|
||||||
|
req.requesterUserId,
|
||||||
|
)
|
||||||
|
if (effectiveRole) {
|
||||||
|
agentFilter = {
|
||||||
|
type: 'chat' as const,
|
||||||
|
enabled: true,
|
||||||
|
permission: { in: getAllowedAgentRoles(effectiveRole) },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
agentFilter = { type: 'chat' as const, enabled: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const userTypeFilter = req.includeAgents
|
const userTypeFilter = req.includeAgents
|
||||||
? {
|
? {
|
||||||
OR: [
|
OR: [
|
||||||
{ type: 'human' as const },
|
{ type: 'human' as const },
|
||||||
{
|
...(agentFilter ? [{ type: 'agent' as const, agent: agentFilter }] : []),
|
||||||
type: 'agent' as const,
|
|
||||||
agent: {
|
|
||||||
type: 'chat' as const,
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
: { type: { not: 'agent' as const } }
|
: { type: { not: 'agent' as const } }
|
||||||
@@ -301,6 +321,7 @@ export class ProjectService {
|
|||||||
id: m.user.id,
|
id: m.user.id,
|
||||||
name: m.user.name,
|
name: m.user.name,
|
||||||
role: m.role as ProjectUserInfo['role'],
|
role: m.role as ProjectUserInfo['role'],
|
||||||
|
type: m.user.type || undefined,
|
||||||
image: await getAvatarUrl(m.user.image),
|
image: await getAvatarUrl(m.user.image),
|
||||||
scope: m.scope,
|
scope: m.scope,
|
||||||
hasCustomRole: m.hasCustomRole,
|
hasCustomRole: m.hasCustomRole,
|
||||||
|
|||||||
@@ -0,0 +1,972 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { prisma } from '@shumai/db'
|
||||||
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
|
import { quotaService, QuotaExceededError, wildcardToRegex } from './quota-service'
|
||||||
|
|
||||||
|
describe('QuotaRule Wildcard Matchers', () => {
|
||||||
|
it('correctly matches bash command wildcards', () => {
|
||||||
|
const starRegex = wildcardToRegex('*')
|
||||||
|
expect(starRegex.test('npm install')).toBe(true)
|
||||||
|
expect(starRegex.test('git commit -m "test"')).toBe(true)
|
||||||
|
|
||||||
|
const npmRegex = wildcardToRegex('npm *')
|
||||||
|
expect(npmRegex.test('npm install')).toBe(true)
|
||||||
|
expect(npmRegex.test('npm test')).toBe(true)
|
||||||
|
expect(npmRegex.test('git push')).toBe(false)
|
||||||
|
|
||||||
|
const exactRegex = wildcardToRegex('rm -rf .pi')
|
||||||
|
expect(exactRegex.test('rm -rf .pi')).toBe(true)
|
||||||
|
expect(exactRegex.test('rm -rf /')).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('correctly matches agent tool name wildcards', () => {
|
||||||
|
const starTool = wildcardToRegex('*')
|
||||||
|
expect(starTool.test('analyze_image')).toBe(true)
|
||||||
|
expect(starTool.test('screenshot')).toBe(true)
|
||||||
|
|
||||||
|
const exactTool = wildcardToRegex('analyze_image')
|
||||||
|
expect(exactTool.test('analyze_image')).toBe(true)
|
||||||
|
expect(exactTool.test('screenshot')).toBe(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('QuotaService', () => {
|
||||||
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
it('creates, reads, updates, and deletes quota rules', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create rule
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 100000,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(rule.id).toBeDefined()
|
||||||
|
expect(rule.teamId).toBe(team.id)
|
||||||
|
expect(rule.scopeMode).toBe('all_members')
|
||||||
|
expect(rule.limit).toBe(100000)
|
||||||
|
expect(rule.period).toBe('1hour')
|
||||||
|
|
||||||
|
// Get rule
|
||||||
|
const fetched = await quotaService.getRule(team.id, rule.id)
|
||||||
|
expect(fetched.id).toBe(rule.id)
|
||||||
|
expect(fetched.limit).toBe(100000)
|
||||||
|
|
||||||
|
// List rules
|
||||||
|
const list = await quotaService.listRules(team.id)
|
||||||
|
expect(list.total).toBe(1)
|
||||||
|
expect(list.rules[0].id).toBe(rule.id)
|
||||||
|
|
||||||
|
// Update rule
|
||||||
|
const updated = await quotaService.updateRule(team.id, rule.id, {
|
||||||
|
limit: 200000,
|
||||||
|
enabled: false,
|
||||||
|
})
|
||||||
|
expect(updated.limit).toBe(200000)
|
||||||
|
expect(updated.enabled).toBe(false)
|
||||||
|
|
||||||
|
// Delete rule
|
||||||
|
await quotaService.deleteRule(team.id, rule.id)
|
||||||
|
const afterDelete = await quotaService.listRules(team.id)
|
||||||
|
expect(afterDelete.total).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('validates selected members on rule creation', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Missing user should throw 400
|
||||||
|
await expect(
|
||||||
|
quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: ['non-existent-user-id'],
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 10,
|
||||||
|
period: '1day',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses the latest database rule state for every quota check', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Fresh Quota Rule Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 10,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
const event = {
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_cost' as const,
|
||||||
|
}
|
||||||
|
|
||||||
|
expect((await quotaService.checkQuota(event)).matchedRules).toHaveLength(1)
|
||||||
|
|
||||||
|
await prisma.quotaRule.update({
|
||||||
|
where: { id: rule.id },
|
||||||
|
data: { enabled: false },
|
||||||
|
})
|
||||||
|
|
||||||
|
expect((await quotaService.checkQuota(event)).matchedRules).toHaveLength(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('enforces check and consumes quota for all_members (shared pool)', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Shared Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Check with 0 before consumption
|
||||||
|
const checkResult = await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
expect(checkResult.allowed).toBe(true)
|
||||||
|
|
||||||
|
// Consume 600 tokens
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
600,
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check with 300 tokens (600 + 300 = 900 <= 1000) -> allowed
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
300,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
|
||||||
|
// Check with 500 tokens (600 + 500 = 1100 > 1000) -> throws QuotaExceededError
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
500,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// Consume another 400 tokens -> exactly 1000 consumed
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
400,
|
||||||
|
)
|
||||||
|
|
||||||
|
// Now even checkQuota with 1 token should fail
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('enforces each_member scope independently for each member', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Each Member Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const userAlice = await prisma.user.create({
|
||||||
|
data: { name: 'Alice', email: 'alice@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const userBob = await prisma.user.create({
|
||||||
|
data: { name: 'Bob', email: 'bob@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create rule: each member with role editor gets 5 MCP calls per 1hour
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: 'server_1' },
|
||||||
|
limit: 5,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Alice consumes 5 MCP calls
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userAlice.id,
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: 'server_1' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alice should be blocked on 6th call
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userAlice.id,
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: 'server_1' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// Bob (also an editor) should NOT be blocked (independent tracking)
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userBob.id,
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: 'server_1' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
|
||||||
|
// Reviewer should not match editor rule
|
||||||
|
const reviewerCheck = await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userBob.id,
|
||||||
|
role: 'reviewer',
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
resourceData: { id: 'server_1' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
expect(reviewerCheck.matchedRules).toHaveLength(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('enforces selected_members scope correctly', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Selected Members Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const userSelected = await prisma.user.create({
|
||||||
|
data: { name: 'Selected User', email: 'sel@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: userSelected.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const userOther = await prisma.user.create({
|
||||||
|
data: { name: 'Other User', email: 'other@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: userOther.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [userSelected.id],
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 5,
|
||||||
|
period: '1day',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Selected user consumes 5
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userSelected.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
5,
|
||||||
|
)
|
||||||
|
|
||||||
|
// Selected user is blocked
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userSelected.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// Other user does not match the rule -> allowed
|
||||||
|
const otherCheck = await quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userOther.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
10,
|
||||||
|
)
|
||||||
|
expect(otherCheck.matchedRules).toHaveLength(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('matches bash command wildcard rules', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Bash Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { match: 'npm *' },
|
||||||
|
limit: 2,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// npm test matches -> consume 1
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command: 'npm test' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
|
// npm install matches -> consume 1 (total = 2)
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command: 'npm install' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
|
// 3rd npm command should be blocked
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command: 'npm run build' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// git command does not match 'npm *' -> allowed
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_bash_call_count',
|
||||||
|
resourceData: { command: 'git status' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('matches agent tool call rules and wildcards', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Tool Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: 'analyze_image' },
|
||||||
|
limit: 1,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// First call to analyze_image
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: 'analyze_image' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
|
// 2nd call to analyze_image is blocked
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: 'analyze_image' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// Call to create_file does not match -> allowed
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_tool_call_count',
|
||||||
|
resourceData: { name: 'create_file' },
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('handles period window rollover and resets usage in-place with no history tables', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Window Rollover Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 10,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Simulate an expired period by creating a past QuotaRecord
|
||||||
|
const pastStart = new Date(Date.now() - 2 * 60 * 60 * 1000)
|
||||||
|
const pastEnd = new Date(Date.now() - 1 * 60 * 60 * 1000)
|
||||||
|
|
||||||
|
await prisma.quotaRecord.create({
|
||||||
|
data: {
|
||||||
|
ruleId: rule.id,
|
||||||
|
teamId: team.id,
|
||||||
|
userId: null,
|
||||||
|
periodStart: pastStart,
|
||||||
|
periodEnd: pastEnd,
|
||||||
|
consumed: 10, // fully consumed in past window
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Current check should be ALLOWED because the old window expired
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
5,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
|
||||||
|
// Consuming now resets the single record in-place
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
5,
|
||||||
|
)
|
||||||
|
|
||||||
|
const records = await prisma.quotaRecord.findMany({
|
||||||
|
where: { ruleId: rule.id },
|
||||||
|
})
|
||||||
|
|
||||||
|
// No extra history records (exactly 1 record row updated in place)
|
||||||
|
expect(records).toHaveLength(1)
|
||||||
|
expect(records[0].consumed).toBe(5)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('lists rule records accurately with lazy reset status', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Records List Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Alice Member', email: 'alice.member@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
role: 'editor',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 50000,
|
||||||
|
period: '1day',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Before any usage: listRuleRecords returns member with consumed: 0, isWindowActive: false
|
||||||
|
const initialRecords = await quotaService.listRuleRecords(team.id, rule.id)
|
||||||
|
expect(initialRecords.total).toBe(1)
|
||||||
|
expect(initialRecords.records[0].userId).toBe(user.id)
|
||||||
|
expect(initialRecords.records[0].consumed).toBe(0)
|
||||||
|
expect(initialRecords.records[0].remaining).toBe(50000)
|
||||||
|
expect(initialRecords.records[0].isWindowActive).toBe(false)
|
||||||
|
|
||||||
|
// Consume 10000 tokens
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
10000,
|
||||||
|
)
|
||||||
|
|
||||||
|
// After usage: active window with consumed = 10000
|
||||||
|
const activeRecords = await quotaService.listRuleRecords(team.id, rule.id)
|
||||||
|
expect(activeRecords.records[0].consumed).toBe(10000)
|
||||||
|
expect(activeRecords.records[0].remaining).toBe(40000)
|
||||||
|
expect(activeRecords.records[0].isWindowActive).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resets a shared quota record and starts a fresh window', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Reset Shared Quota Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
await quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 500)
|
||||||
|
const beforeReset = await prisma.quotaRecord.findFirst({ where: { ruleId: rule.id } })
|
||||||
|
expect(beforeReset?.consumed).toBe(500)
|
||||||
|
|
||||||
|
const reset = await quotaService.resetRecord(team.id, rule.id, null)
|
||||||
|
expect(reset.userId).toBeNull()
|
||||||
|
expect(reset.consumed).toBe(0)
|
||||||
|
expect(reset.remaining).toBe(1000)
|
||||||
|
expect(reset.percent).toBe(0)
|
||||||
|
expect(reset.isWindowActive).toBe(true)
|
||||||
|
expect(reset.periodStart).toBeDefined()
|
||||||
|
expect(reset.periodEnd).toBeDefined()
|
||||||
|
|
||||||
|
const afterReset = await prisma.quotaRecord.findFirst({ where: { ruleId: rule.id } })
|
||||||
|
expect(afterReset?.consumed).toBe(0)
|
||||||
|
expect(afterReset?.periodStart?.getTime()).toBeGreaterThanOrEqual(
|
||||||
|
beforeReset?.periodStart?.getTime() ?? 0,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('creates and resets a member quota record before any usage exists', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Reset Member Quota Team' },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Reset Member', email: 'reset-member@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: user.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1day',
|
||||||
|
})
|
||||||
|
|
||||||
|
const reset = await quotaService.resetRecord(team.id, rule.id, user.id)
|
||||||
|
expect(reset.userId).toBe(user.id)
|
||||||
|
expect(reset.consumed).toBe(0)
|
||||||
|
expect(reset.isWindowActive).toBe(true)
|
||||||
|
|
||||||
|
const records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
|
||||||
|
expect(records).toHaveLength(1)
|
||||||
|
expect(records[0]?.userId).toBe(user.id)
|
||||||
|
expect(records[0]?.consumed).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('rejects reset targets that do not match the quota rule', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Invalid Reset Target Team' },
|
||||||
|
})
|
||||||
|
const editor = await prisma.user.create({
|
||||||
|
data: { name: 'Editor', email: 'invalid-reset-editor@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
const reviewer = await prisma.user.create({
|
||||||
|
data: { name: 'Reviewer', email: 'invalid-reset-reviewer@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.createMany({
|
||||||
|
data: [
|
||||||
|
{ teamId: team.id, userId: editor.id, role: 'editor' },
|
||||||
|
{ teamId: team.id, userId: reviewer.id, role: 'reviewer' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
const roleRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
role: 'editor',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(quotaService.resetRecord(team.id, roleRule.id, reviewer.id)).rejects.toThrow(
|
||||||
|
'does not match the rule role',
|
||||||
|
)
|
||||||
|
await expect(quotaService.resetRecord(team.id, roleRule.id, null)).rejects.toThrow(
|
||||||
|
'require a userId',
|
||||||
|
)
|
||||||
|
|
||||||
|
const selectedRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [editor.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
await expect(quotaService.resetRecord(team.id, selectedRule.id, reviewer.id)).rejects.toThrow(
|
||||||
|
'not selected by this rule',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not allow resetting a quota rule from another team', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Reset Owner Team' } })
|
||||||
|
const otherTeam = await prisma.team.create({ data: { name: 'Reset Other Team' } })
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(quotaService.resetRecord(otherTeam.id, rule.id, null)).rejects.toThrow(
|
||||||
|
'Quota rule not found',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('enforces multiple matching rules simultaneously', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Multi Rule Team' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Charlie', email: 'charlie@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: user.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Rule 1: Team overall token limit 10,000 (all_members)
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 10000,
|
||||||
|
period: '1day',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Rule 2: User specific token limit 2,000 (selected_members)
|
||||||
|
await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [user.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 2000,
|
||||||
|
period: '1day',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Consuming 2000 tokens for Charlie
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
2000,
|
||||||
|
)
|
||||||
|
|
||||||
|
// Charlie is blocked by user rule (2000 limit reached)
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: user.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
100,
|
||||||
|
),
|
||||||
|
).rejects.toThrow(QuotaExceededError)
|
||||||
|
|
||||||
|
// Another user in the same team is NOT blocked by Charlie's limit, only by team limit
|
||||||
|
const userDave = await prisma.user.create({
|
||||||
|
data: { name: 'Dave', email: 'dave@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
quotaService.checkQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
userId: userDave.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
1000,
|
||||||
|
),
|
||||||
|
).resolves.toEqual(expect.objectContaining({ allowed: true }))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('rejects selected_members if user is not a member of the team on create', async () => {
|
||||||
|
const team1 = await prisma.team.create({ data: { name: 'Team 1' } })
|
||||||
|
const team2 = await prisma.team.create({ data: { name: 'Team 2' } })
|
||||||
|
|
||||||
|
const userInTeam1 = await prisma.user.create({
|
||||||
|
data: { name: 'Member 1', email: 'm1@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team1.id, userId: userInTeam1.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const userInTeam2 = await prisma.user.create({
|
||||||
|
data: { name: 'Member 2', email: 'm2@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team2.id, userId: userInTeam2.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Creating rule on Team 1 with user from Team 2 should throw 400
|
||||||
|
await expect(
|
||||||
|
quotaService.createRule(team1.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [userInTeam2.id],
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 10,
|
||||||
|
period: '1day',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('validates merged rule and rejects invalid partial updates', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Validation Team' } })
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'User 1', email: 'u1@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: user.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 10000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Updating resource to agent_mcp_call_count without resourceData.id should fail validation
|
||||||
|
await expect(
|
||||||
|
quotaService.updateRule(team.id, rule.id, {
|
||||||
|
resource: 'agent_mcp_call_count',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow()
|
||||||
|
|
||||||
|
// Updating scopeMode to selected_members without userIds should fail validation
|
||||||
|
await expect(
|
||||||
|
quotaService.updateRule(team.id, rule.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow()
|
||||||
|
|
||||||
|
// Updating userIds with a user from outside the team should fail validation
|
||||||
|
const otherUser = await prisma.user.create({
|
||||||
|
data: { name: 'Other User', email: 'other_team@example.com', password: 'pw' },
|
||||||
|
})
|
||||||
|
await expect(
|
||||||
|
quotaService.updateRule(team.id, rule.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [otherUser.id],
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resets existing quota records when accounting dimensions change', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Reset Records Team' } })
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 1000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Consume 500 tokens
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
},
|
||||||
|
500,
|
||||||
|
)
|
||||||
|
|
||||||
|
let records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
|
||||||
|
expect(records).toHaveLength(1)
|
||||||
|
expect(records[0].consumed).toBe(500)
|
||||||
|
|
||||||
|
// Update resource to agent_cost (limit 10)
|
||||||
|
await quotaService.updateRule(team.id, rule.id, {
|
||||||
|
resource: 'agent_cost',
|
||||||
|
limit: 10,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Records should be reset
|
||||||
|
records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
|
||||||
|
expect(records).toHaveLength(0)
|
||||||
|
|
||||||
|
// Consume $2 under the new resource
|
||||||
|
await quotaService.consumeQuota(
|
||||||
|
{
|
||||||
|
teamId: team.id,
|
||||||
|
resource: 'agent_cost',
|
||||||
|
},
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
|
||||||
|
records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
|
||||||
|
expect(records).toHaveLength(1)
|
||||||
|
expect(records[0].consumed).toBe(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('handles concurrent first consumption for all_members without creating duplicate records', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Concurrent Quota Team' } })
|
||||||
|
|
||||||
|
const rule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'all_members',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 10000,
|
||||||
|
period: '1hour',
|
||||||
|
})
|
||||||
|
|
||||||
|
// Concurrently trigger 5 quota consumption calls for the first time
|
||||||
|
await Promise.all([
|
||||||
|
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 10),
|
||||||
|
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 20),
|
||||||
|
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 30),
|
||||||
|
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 40),
|
||||||
|
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 50),
|
||||||
|
])
|
||||||
|
|
||||||
|
const records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
|
||||||
|
expect(records).toHaveLength(1)
|
||||||
|
expect(records[0].consumed).toBe(150)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('excludes agents from quota usage records and prevents creating quota rules for agents', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Exclude Agent Team' } })
|
||||||
|
|
||||||
|
// Create human user
|
||||||
|
const humanUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Human Member',
|
||||||
|
email: 'human.member@example.com',
|
||||||
|
type: 'human',
|
||||||
|
password: 'pw',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: humanUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create agent user and agent
|
||||||
|
const agentUser = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'AI Agent Member',
|
||||||
|
email: 'ai.agent@shumai.ai',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: agentUser.id,
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
config: { provider: 'google', model: 'gemini' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: agentUser.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// 1. Quota rule with each_member
|
||||||
|
const eachMemberRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'each_member',
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 10000,
|
||||||
|
period: '1hour',
|
||||||
|
enabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// listRuleRecords should ONLY return human members, NOT agents
|
||||||
|
const recordsResult = await quotaService.listRuleRecords(team.id, eachMemberRule.id)
|
||||||
|
expect(recordsResult.total).toBe(1)
|
||||||
|
expect(recordsResult.records).toHaveLength(1)
|
||||||
|
expect(recordsResult.records[0].userId).toBe(humanUser.id)
|
||||||
|
expect(recordsResult.records[0].user?.email).toBe('human.member@example.com')
|
||||||
|
|
||||||
|
// 2. Quota rule with selected_members targeting agentUser should be rejected
|
||||||
|
await expect(
|
||||||
|
quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [agentUser.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 5000,
|
||||||
|
period: '1day',
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
|
||||||
|
// 3. Updating quota rule with selected_members targeting agentUser should be rejected
|
||||||
|
const validSelectedRule = await quotaService.createRule(team.id, {
|
||||||
|
scopeMode: 'selected_members',
|
||||||
|
userIds: [humanUser.id],
|
||||||
|
resource: 'agent_total_tokens',
|
||||||
|
limit: 5000,
|
||||||
|
period: '1day',
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
quotaService.updateRule(team.id, validSelectedRule.id, {
|
||||||
|
userIds: [agentUser.id],
|
||||||
|
}),
|
||||||
|
).rejects.toThrow('One or more selected users are not members of the team')
|
||||||
|
|
||||||
|
const selectedRecords = await quotaService.listRuleRecords(team.id, validSelectedRule.id)
|
||||||
|
expect(selectedRecords.total).toBe(1)
|
||||||
|
expect(selectedRecords.records[0].userId).toBe(humanUser.id)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,859 @@
|
|||||||
|
import {
|
||||||
|
prisma,
|
||||||
|
Prisma,
|
||||||
|
type QuotaPeriod,
|
||||||
|
type QuotaRecord,
|
||||||
|
type QuotaResourceType,
|
||||||
|
type QuotaRule,
|
||||||
|
type TeamMemberRole,
|
||||||
|
} from '@shumai/db'
|
||||||
|
import {
|
||||||
|
type CreateQuotaRuleRequest,
|
||||||
|
type ListQuotaRulesResponse,
|
||||||
|
type QuotaRuleResponse,
|
||||||
|
type ListQuotaRecordsResponse,
|
||||||
|
type QuotaRecordResponse,
|
||||||
|
type UpdateQuotaRuleRequest,
|
||||||
|
normalizeQuotaPeriod,
|
||||||
|
formatQuotaPeriod,
|
||||||
|
mcpResourceDataSchema,
|
||||||
|
bashResourceDataSchema,
|
||||||
|
toolResourceDataSchema,
|
||||||
|
} from '@shumai/dtos'
|
||||||
|
import { HTTPException } from 'hono/http-exception'
|
||||||
|
|
||||||
|
export class QuotaExceededError extends Error {
|
||||||
|
public readonly policyId: string
|
||||||
|
public readonly resource: string
|
||||||
|
public readonly limit: number
|
||||||
|
public readonly consumed: number
|
||||||
|
public readonly periodEnd: Date
|
||||||
|
|
||||||
|
constructor(params: {
|
||||||
|
policyId: string
|
||||||
|
resource: string
|
||||||
|
limit: number
|
||||||
|
consumed: number
|
||||||
|
periodEnd: Date
|
||||||
|
message?: string
|
||||||
|
}) {
|
||||||
|
const msg =
|
||||||
|
params.message ||
|
||||||
|
`Quota exceeded for ${params.resource}: limit of ${params.limit} reached (currently consumed: ${params.consumed}). Resets at ${params.periodEnd.toISOString()}.`
|
||||||
|
super(msg)
|
||||||
|
this.name = 'QuotaExceededError'
|
||||||
|
this.policyId = params.policyId
|
||||||
|
this.resource = params.resource
|
||||||
|
this.limit = params.limit
|
||||||
|
this.consumed = params.consumed
|
||||||
|
this.periodEnd = params.periodEnd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuotaEventResourceData {
|
||||||
|
skillId?: string
|
||||||
|
mcpServerId?: string
|
||||||
|
command?: string
|
||||||
|
name?: string
|
||||||
|
toolName?: string
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuotaEvent {
|
||||||
|
teamId: string
|
||||||
|
userId?: string | null
|
||||||
|
role?: TeamMemberRole | null
|
||||||
|
resource: QuotaResourceType
|
||||||
|
resourceData?: QuotaEventResourceData
|
||||||
|
}
|
||||||
|
|
||||||
|
export function periodToDurationMs(period: QuotaPeriod | string): number {
|
||||||
|
switch (period) {
|
||||||
|
case 'one_hour':
|
||||||
|
case '1hour':
|
||||||
|
return 60 * 60 * 1000
|
||||||
|
case 'five_hours':
|
||||||
|
case '5hour':
|
||||||
|
return 5 * 60 * 60 * 1000
|
||||||
|
case 'one_day':
|
||||||
|
case '1day':
|
||||||
|
return 24 * 60 * 60 * 1000
|
||||||
|
case 'seven_days':
|
||||||
|
case '7day':
|
||||||
|
return 7 * 24 * 60 * 60 * 1000
|
||||||
|
default:
|
||||||
|
return 60 * 60 * 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a wildcard pattern (with * and ?) into a regular expression.
|
||||||
|
*/
|
||||||
|
export function wildcardToRegex(pattern: string): RegExp {
|
||||||
|
const trimmed = pattern.trim()
|
||||||
|
if (trimmed === '*' || trimmed === '') {
|
||||||
|
return /^.*$/s
|
||||||
|
}
|
||||||
|
// Escape regex special chars except * and ?
|
||||||
|
const escaped = trimmed.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
||||||
|
const regexStr = '^' + escaped.replace(/\*/g, '.*').replace(/\?/g, '.') + '$'
|
||||||
|
return new RegExp(regexStr, 's')
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesQuotaRule(rule: QuotaRule, event: QuotaEvent): boolean {
|
||||||
|
if (!rule.enabled) return false
|
||||||
|
if (event.teamId !== rule.teamId) return false
|
||||||
|
if (event.resource !== rule.resource) return false
|
||||||
|
|
||||||
|
// Scope check
|
||||||
|
if (rule.scopeMode === 'all_members') {
|
||||||
|
if (rule.role && event.role !== rule.role) return false
|
||||||
|
} else if (rule.scopeMode === 'each_member') {
|
||||||
|
if (!event.userId) return false
|
||||||
|
if (rule.role && event.role !== rule.role) return false
|
||||||
|
} else if (rule.scopeMode === 'selected_members') {
|
||||||
|
if (!event.userId) return false
|
||||||
|
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : null
|
||||||
|
if (!userIds || !userIds.includes(event.userId)) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const resourceData = (rule.resourceData as Record<string, unknown> | null) ?? null
|
||||||
|
|
||||||
|
// Resource data check
|
||||||
|
if (rule.resource === 'agent_mcp_call_count') {
|
||||||
|
const targetId = resourceData?.id ?? resourceData?.mcpServerId
|
||||||
|
const eventMcpId = event.resourceData?.mcpServerId ?? event.resourceData?.id
|
||||||
|
if (targetId && eventMcpId !== targetId) return false
|
||||||
|
} else if (rule.resource === 'agent_bash_call_count' && resourceData?.match) {
|
||||||
|
const bashMatcher = wildcardToRegex(String(resourceData.match))
|
||||||
|
const command = event.resourceData?.command ?? ''
|
||||||
|
if (!bashMatcher.test(command)) return false
|
||||||
|
} else if (
|
||||||
|
rule.resource === 'agent_tool_call_count' &&
|
||||||
|
(resourceData?.name || resourceData?.toolName)
|
||||||
|
) {
|
||||||
|
const toolMatcher = wildcardToRegex(String(resourceData.name ?? resourceData.toolName))
|
||||||
|
const toolName = String(event.resourceData?.name ?? event.resourceData?.toolName ?? '')
|
||||||
|
if (!toolMatcher.test(toolName)) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQuotaRuleTargetUserId(rule: QuotaRule, event: QuotaEvent): string | null {
|
||||||
|
if (rule.scopeMode === 'all_members') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return event.userId ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
interface RawQuotaRecord {
|
||||||
|
id: string
|
||||||
|
rule_id: string
|
||||||
|
team_id: string
|
||||||
|
user_id: string | null
|
||||||
|
period_start: Date | null
|
||||||
|
period_end: Date | null
|
||||||
|
consumed: number
|
||||||
|
}
|
||||||
|
/* eslint-enable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
|
export class QuotaService {
|
||||||
|
constructor(private readonly prismaClient: typeof prisma = prisma) {}
|
||||||
|
|
||||||
|
private mapRuleToResponse(rule: QuotaRule, recordsCount?: number): QuotaRuleResponse {
|
||||||
|
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : undefined
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: rule.id,
|
||||||
|
teamId: rule.teamId,
|
||||||
|
scopeMode: rule.scopeMode,
|
||||||
|
role: rule.role ?? undefined,
|
||||||
|
userIds,
|
||||||
|
resource: rule.resource,
|
||||||
|
resourceData: (rule.resourceData as Record<string, unknown> | null) ?? undefined,
|
||||||
|
limit: rule.limit,
|
||||||
|
period: formatQuotaPeriod(rule.period) as QuotaRuleResponse['period'],
|
||||||
|
enabled: rule.enabled,
|
||||||
|
recordsCount,
|
||||||
|
createdAt: rule.createdAt.toISOString(),
|
||||||
|
updatedAt: rule.updatedAt.toISOString(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async createRule(teamId: string, req: CreateQuotaRuleRequest): Promise<QuotaRuleResponse> {
|
||||||
|
if (req.scopeMode === 'selected_members') {
|
||||||
|
if (!req.userIds || req.userIds.length === 0) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const members = await this.prismaClient.teamMember.findMany({
|
||||||
|
where: {
|
||||||
|
teamId,
|
||||||
|
userId: { in: req.userIds },
|
||||||
|
user: { type: 'human' },
|
||||||
|
},
|
||||||
|
select: { userId: true },
|
||||||
|
})
|
||||||
|
if (members.length !== req.userIds.length) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'One or more selected users are not members of the team',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rule = await this.prismaClient.quotaRule.create({
|
||||||
|
data: {
|
||||||
|
teamId,
|
||||||
|
scopeMode: req.scopeMode,
|
||||||
|
role: req.scopeMode !== 'selected_members' ? (req.role ?? null) : null,
|
||||||
|
userIds:
|
||||||
|
req.scopeMode === 'selected_members' && req.userIds ? req.userIds : Prisma.JsonNull,
|
||||||
|
resource: req.resource,
|
||||||
|
resourceData: req.resourceData ?? Prisma.JsonNull,
|
||||||
|
limit: req.limit,
|
||||||
|
period: normalizeQuotaPeriod(req.period),
|
||||||
|
enabled: req.enabled ?? true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.mapRuleToResponse(rule, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateRule(
|
||||||
|
teamId: string,
|
||||||
|
ruleId: string,
|
||||||
|
req: UpdateQuotaRuleRequest,
|
||||||
|
): Promise<QuotaRuleResponse> {
|
||||||
|
const existing = await this.prismaClient.quotaRule.findUnique({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!existing || existing.teamId !== teamId) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const effectiveScopeMode = req.scopeMode ?? existing.scopeMode
|
||||||
|
const effectiveRole =
|
||||||
|
effectiveScopeMode === 'selected_members'
|
||||||
|
? null
|
||||||
|
: req.role !== undefined
|
||||||
|
? req.role
|
||||||
|
: existing.role
|
||||||
|
const effectiveUserIds =
|
||||||
|
effectiveScopeMode === 'selected_members'
|
||||||
|
? req.userIds !== undefined
|
||||||
|
? req.userIds
|
||||||
|
: Array.isArray(existing.userIds)
|
||||||
|
? (existing.userIds as string[])
|
||||||
|
: []
|
||||||
|
: null
|
||||||
|
const effectiveResource = req.resource ?? existing.resource
|
||||||
|
const effectiveResourceData =
|
||||||
|
req.resourceData !== undefined
|
||||||
|
? req.resourceData
|
||||||
|
: (existing.resourceData as Record<string, unknown> | null)
|
||||||
|
const effectiveLimit = req.limit ?? existing.limit
|
||||||
|
const effectivePeriod = req.period ? normalizeQuotaPeriod(req.period) : existing.period
|
||||||
|
const effectiveEnabled = req.enabled ?? existing.enabled
|
||||||
|
|
||||||
|
// Validate effective merged state
|
||||||
|
if (effectiveScopeMode === 'selected_members') {
|
||||||
|
if (!effectiveUserIds || effectiveUserIds.length === 0) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const members = await this.prismaClient.teamMember.findMany({
|
||||||
|
where: {
|
||||||
|
teamId,
|
||||||
|
userId: { in: effectiveUserIds },
|
||||||
|
user: { type: 'human' },
|
||||||
|
},
|
||||||
|
select: { userId: true },
|
||||||
|
})
|
||||||
|
if (members.length !== effectiveUserIds.length) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'One or more selected users are not members of the team',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effectiveResource === 'agent_mcp_call_count') {
|
||||||
|
const res = mcpResourceDataSchema.safeParse(effectiveResourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'resourceData.id is required for agent_mcp_call_count',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (effectiveResource === 'agent_bash_call_count') {
|
||||||
|
const res = bashResourceDataSchema.safeParse(effectiveResourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'resourceData.match is required for agent_bash_call_count',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (effectiveResource === 'agent_tool_call_count') {
|
||||||
|
const res = toolResourceDataSchema.safeParse(effectiveResourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'resourceData.name is required for agent_tool_call_count',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effectiveLimit <= 0) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'Limit must be greater than 0',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const isAccountingDimensionChanged =
|
||||||
|
(req.resource !== undefined && req.resource !== existing.resource) ||
|
||||||
|
(req.period !== undefined && normalizeQuotaPeriod(req.period) !== existing.period) ||
|
||||||
|
(req.scopeMode !== undefined && req.scopeMode !== existing.scopeMode) ||
|
||||||
|
(req.role !== undefined && req.role !== existing.role) ||
|
||||||
|
(req.resourceData !== undefined &&
|
||||||
|
JSON.stringify(req.resourceData) !== JSON.stringify(existing.resourceData))
|
||||||
|
|
||||||
|
const updated = await this.prismaClient.$transaction(async (tx) => {
|
||||||
|
if (isAccountingDimensionChanged) {
|
||||||
|
// Reset all records when accounting dimensions change
|
||||||
|
await tx.quotaRecord.deleteMany({
|
||||||
|
where: { ruleId },
|
||||||
|
})
|
||||||
|
} else if (effectiveScopeMode === 'selected_members' && req.userIds !== undefined) {
|
||||||
|
// Clean up records for removed users if updating userIds
|
||||||
|
if (req.userIds && req.userIds.length > 0) {
|
||||||
|
await tx.quotaRecord.deleteMany({
|
||||||
|
where: {
|
||||||
|
ruleId,
|
||||||
|
userId: { notIn: req.userIds },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const data: Prisma.QuotaRuleUpdateInput = {
|
||||||
|
scopeMode: effectiveScopeMode,
|
||||||
|
role: effectiveRole,
|
||||||
|
userIds:
|
||||||
|
effectiveScopeMode === 'selected_members' && effectiveUserIds
|
||||||
|
? effectiveUserIds
|
||||||
|
: Prisma.JsonNull,
|
||||||
|
resource: effectiveResource,
|
||||||
|
resourceData: effectiveResourceData ?? Prisma.JsonNull,
|
||||||
|
limit: effectiveLimit,
|
||||||
|
period: effectivePeriod,
|
||||||
|
enabled: effectiveEnabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
return tx.quotaRule.update({
|
||||||
|
where: { id: ruleId },
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const recordsCount = await this.prismaClient.quotaRecord.count({
|
||||||
|
where: { ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.mapRuleToResponse(updated, recordsCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteRule(teamId: string, ruleId: string): Promise<void> {
|
||||||
|
const existing = await this.prismaClient.quotaRule.findUnique({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!existing || existing.teamId !== teamId) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.prismaClient.quotaRule.delete({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async getRule(teamId: string, ruleId: string): Promise<QuotaRuleResponse> {
|
||||||
|
const rule = await this.prismaClient.quotaRule.findUnique({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!rule || rule.teamId !== teamId) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const recordsCount = await this.prismaClient.quotaRecord.count({
|
||||||
|
where: { ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
return this.mapRuleToResponse(rule, recordsCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
async listRules(teamId: string): Promise<ListQuotaRulesResponse> {
|
||||||
|
const rules = await this.prismaClient.quotaRule.findMany({
|
||||||
|
where: { teamId },
|
||||||
|
orderBy: { id: 'desc' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const ruleResponses = await Promise.all(
|
||||||
|
rules.map(async (rule) => {
|
||||||
|
const recordsCount = await this.prismaClient.quotaRecord.count({
|
||||||
|
where: { ruleId: rule.id },
|
||||||
|
})
|
||||||
|
return this.mapRuleToResponse(rule, recordsCount)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
rules: ruleResponses,
|
||||||
|
total: ruleResponses.length,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async listRuleRecords(teamId: string, ruleId: string): Promise<ListQuotaRecordsResponse> {
|
||||||
|
const rule = await this.prismaClient.quotaRule.findUnique({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!rule || rule.teamId !== teamId) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
|
if (rule.scopeMode === 'all_members') {
|
||||||
|
const record = await this.prismaClient.quotaRecord.findFirst({
|
||||||
|
where: { ruleId: rule.id, userId: null },
|
||||||
|
})
|
||||||
|
|
||||||
|
const isWindowActive = Boolean(
|
||||||
|
record?.periodStart &&
|
||||||
|
record?.periodEnd &&
|
||||||
|
now >= record.periodStart &&
|
||||||
|
now < record.periodEnd,
|
||||||
|
)
|
||||||
|
|
||||||
|
const consumed = isWindowActive ? (record?.consumed ?? 0) : 0
|
||||||
|
const remaining = Math.max(0, rule.limit - consumed)
|
||||||
|
const percent =
|
||||||
|
rule.limit > 0 ? Math.min(100, Number(((consumed / rule.limit) * 100).toFixed(2))) : 0
|
||||||
|
|
||||||
|
const res: QuotaRecordResponse = {
|
||||||
|
id: record?.id ?? null,
|
||||||
|
ruleId: rule.id,
|
||||||
|
teamId: rule.teamId,
|
||||||
|
userId: null,
|
||||||
|
user: null,
|
||||||
|
periodStart:
|
||||||
|
isWindowActive && record?.periodStart ? record.periodStart.toISOString() : null,
|
||||||
|
periodEnd: isWindowActive && record?.periodEnd ? record.periodEnd.toISOString() : null,
|
||||||
|
consumed,
|
||||||
|
remaining,
|
||||||
|
percent,
|
||||||
|
isWindowActive,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
records: [res],
|
||||||
|
total: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For each_member or selected_members
|
||||||
|
type MemberTarget = { id: string; name: string; email: string; image?: string | null }
|
||||||
|
let targetUsers: MemberTarget[] = []
|
||||||
|
|
||||||
|
if (rule.scopeMode === 'selected_members') {
|
||||||
|
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : []
|
||||||
|
if (userIds.length > 0) {
|
||||||
|
targetUsers = await this.prismaClient.user.findMany({
|
||||||
|
where: { id: { in: userIds }, type: 'human' },
|
||||||
|
select: { id: true, name: true, email: true, image: true },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// each_member
|
||||||
|
const memberWhere: Prisma.TeamMemberWhereInput = {
|
||||||
|
teamId,
|
||||||
|
user: { type: 'human' },
|
||||||
|
}
|
||||||
|
if (rule.role) {
|
||||||
|
memberWhere.role = rule.role
|
||||||
|
}
|
||||||
|
const members = await this.prismaClient.teamMember.findMany({
|
||||||
|
where: memberWhere,
|
||||||
|
include: {
|
||||||
|
user: {
|
||||||
|
select: { id: true, name: true, email: true, image: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
targetUsers = members.map((m) => m.user)
|
||||||
|
}
|
||||||
|
|
||||||
|
const existingRecords = await this.prismaClient.quotaRecord.findMany({
|
||||||
|
where: {
|
||||||
|
ruleId: rule.id,
|
||||||
|
userId: { in: targetUsers.map((u) => u.id) },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const recordByUserId = new Map<string, QuotaRecord>()
|
||||||
|
for (const r of existingRecords) {
|
||||||
|
if (r.userId) recordByUserId.set(r.userId, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
const records: QuotaRecordResponse[] = targetUsers.map((user) => {
|
||||||
|
const record = recordByUserId.get(user.id)
|
||||||
|
const isWindowActive = Boolean(
|
||||||
|
record?.periodStart &&
|
||||||
|
record?.periodEnd &&
|
||||||
|
now >= record.periodStart &&
|
||||||
|
now < record.periodEnd,
|
||||||
|
)
|
||||||
|
|
||||||
|
const consumed = isWindowActive ? (record?.consumed ?? 0) : 0
|
||||||
|
const remaining = Math.max(0, rule.limit - consumed)
|
||||||
|
const percent =
|
||||||
|
rule.limit > 0 ? Math.min(100, Number(((consumed / rule.limit) * 100).toFixed(2))) : 0
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: record?.id ?? null,
|
||||||
|
ruleId: rule.id,
|
||||||
|
teamId: rule.teamId,
|
||||||
|
userId: user.id,
|
||||||
|
user: {
|
||||||
|
id: user.id,
|
||||||
|
name: user.name,
|
||||||
|
email: user.email,
|
||||||
|
image: user.image ?? null,
|
||||||
|
},
|
||||||
|
periodStart:
|
||||||
|
isWindowActive && record?.periodStart ? record.periodStart.toISOString() : null,
|
||||||
|
periodEnd: isWindowActive && record?.periodEnd ? record.periodEnd.toISOString() : null,
|
||||||
|
consumed,
|
||||||
|
remaining,
|
||||||
|
percent,
|
||||||
|
isWindowActive,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
records,
|
||||||
|
total: records.length,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async resetRecord(
|
||||||
|
teamId: string,
|
||||||
|
ruleId: string,
|
||||||
|
userId: string | null,
|
||||||
|
): Promise<QuotaRecordResponse> {
|
||||||
|
const rule = await this.prismaClient.quotaRule.findUnique({
|
||||||
|
where: { id: ruleId },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!rule || rule.teamId !== teamId) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota rule not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rule.scopeMode === 'all_members' && userId !== null) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'All-members quota records must use a null userId',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rule.scopeMode !== 'all_members' && userId === null) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'Member quota records require a userId',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userId !== null) {
|
||||||
|
const member = await this.prismaClient.teamMember.findUnique({
|
||||||
|
where: {
|
||||||
|
teamIdUserId: {
|
||||||
|
teamId,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
role: true,
|
||||||
|
user: {
|
||||||
|
select: { type: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!member || member.user.type !== 'human') {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'Quota record user must be a human team member',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rule.scopeMode === 'each_member' && rule.role && member.role !== rule.role) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'Quota record user does not match the rule role',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rule.scopeMode === 'selected_members') {
|
||||||
|
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : []
|
||||||
|
if (!userIds.includes(userId)) {
|
||||||
|
throw new HTTPException(400, {
|
||||||
|
message: 'Quota record user is not selected by this rule',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.prismaClient.$transaction(async (tx) => {
|
||||||
|
// Lock the rule row so reset and first-use record creation are serialized.
|
||||||
|
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
|
||||||
|
|
||||||
|
const periodStart = new Date()
|
||||||
|
const periodEnd = new Date(periodStart.getTime() + periodToDurationMs(rule.period))
|
||||||
|
|
||||||
|
const existingRecord = userId
|
||||||
|
? (
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id = ${userId}
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0]
|
||||||
|
: (
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id IS NULL
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0]
|
||||||
|
|
||||||
|
if (existingRecord) {
|
||||||
|
await tx.quotaRecord.update({
|
||||||
|
where: { id: existingRecord.id },
|
||||||
|
data: {
|
||||||
|
periodStart,
|
||||||
|
periodEnd,
|
||||||
|
consumed: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await tx.quotaRecord.create({
|
||||||
|
data: {
|
||||||
|
ruleId: rule.id,
|
||||||
|
teamId: rule.teamId,
|
||||||
|
userId,
|
||||||
|
periodStart,
|
||||||
|
periodEnd,
|
||||||
|
consumed: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const records = await this.listRuleRecords(teamId, ruleId)
|
||||||
|
const mappedRecord = records.records.find((record) => record.userId === userId)
|
||||||
|
|
||||||
|
if (!mappedRecord) {
|
||||||
|
throw new HTTPException(404, { message: 'Quota record not found' })
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappedRecord
|
||||||
|
}
|
||||||
|
|
||||||
|
private async findMatchingRules(event: QuotaEvent): Promise<QuotaRule[]> {
|
||||||
|
const rules = await this.prismaClient.quotaRule.findMany({
|
||||||
|
where: {
|
||||||
|
teamId: event.teamId,
|
||||||
|
resource: event.resource,
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return rules.filter((rule) => matchesQuotaRule(rule, event))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates whether an action is permitted under all active matching quota rules.
|
||||||
|
* Performs an atomic pre-check with SELECT ... FOR UPDATE.
|
||||||
|
* Throws QuotaExceededError if any matching rule is exceeded.
|
||||||
|
*/
|
||||||
|
async checkQuota(
|
||||||
|
event: QuotaEvent,
|
||||||
|
amount: number = 0,
|
||||||
|
): Promise<{ allowed: boolean; matchedRules: QuotaRule[] }> {
|
||||||
|
const rules = await this.findMatchingRules(event)
|
||||||
|
if (rules.length === 0) {
|
||||||
|
return { allowed: true, matchedRules: [] }
|
||||||
|
}
|
||||||
|
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
|
for (const rule of rules) {
|
||||||
|
const targetUserId = getQuotaRuleTargetUserId(rule, event)
|
||||||
|
|
||||||
|
await this.prismaClient.$transaction(async (tx) => {
|
||||||
|
if (targetUserId === null) {
|
||||||
|
// Serialize all_members record checks/creations on the parent rule row
|
||||||
|
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
|
||||||
|
}
|
||||||
|
|
||||||
|
let rawRecord = targetUserId
|
||||||
|
? ((
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null)
|
||||||
|
: ((
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id IS NULL
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null)
|
||||||
|
|
||||||
|
if (!rawRecord && targetUserId !== null) {
|
||||||
|
// Lock parent rule on first user record check and re-query
|
||||||
|
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
|
||||||
|
rawRecord =
|
||||||
|
(
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
const isWindowActive = Boolean(
|
||||||
|
rawRecord?.period_start &&
|
||||||
|
rawRecord?.period_end &&
|
||||||
|
now >= rawRecord.period_start &&
|
||||||
|
now < rawRecord.period_end,
|
||||||
|
)
|
||||||
|
|
||||||
|
const consumed = isWindowActive ? (rawRecord?.consumed ?? 0) : 0
|
||||||
|
const periodEnd = isWindowActive
|
||||||
|
? rawRecord!.period_end!
|
||||||
|
: new Date(now.getTime() + periodToDurationMs(rule.period))
|
||||||
|
|
||||||
|
if (consumed + amount > rule.limit) {
|
||||||
|
throw new QuotaExceededError({
|
||||||
|
policyId: rule.id,
|
||||||
|
resource: rule.resource,
|
||||||
|
limit: rule.limit,
|
||||||
|
consumed,
|
||||||
|
periodEnd,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return { allowed: true, matchedRules: rules }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records consumed usage across all matching quota rules.
|
||||||
|
* Lazy resets the period window in-place when previous window has expired.
|
||||||
|
* Uses SELECT ... FOR UPDATE inside transactions for atomic concurrency protection.
|
||||||
|
*/
|
||||||
|
async consumeQuota(event: QuotaEvent, amount: number): Promise<void> {
|
||||||
|
if (amount <= 0) return
|
||||||
|
|
||||||
|
const rules = await this.findMatchingRules(event)
|
||||||
|
if (rules.length === 0) return
|
||||||
|
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
|
for (const rule of rules) {
|
||||||
|
const targetUserId = getQuotaRuleTargetUserId(rule, event)
|
||||||
|
|
||||||
|
await this.prismaClient.$transaction(async (tx) => {
|
||||||
|
if (targetUserId === null) {
|
||||||
|
// Serialize all_members (shared pool) creations and updates on the parent rule row
|
||||||
|
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
|
||||||
|
}
|
||||||
|
|
||||||
|
let rawRecord = targetUserId
|
||||||
|
? ((
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null)
|
||||||
|
: ((
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id IS NULL
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null)
|
||||||
|
|
||||||
|
if (!rawRecord && targetUserId !== null) {
|
||||||
|
// Lock parent rule on first user record creation and re-query
|
||||||
|
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
|
||||||
|
rawRecord =
|
||||||
|
(
|
||||||
|
await tx.$queryRaw<RawQuotaRecord[]>`
|
||||||
|
SELECT * FROM quota_records
|
||||||
|
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
|
||||||
|
FOR UPDATE
|
||||||
|
`
|
||||||
|
)[0] ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
const isWindowActive = Boolean(
|
||||||
|
rawRecord?.period_start &&
|
||||||
|
rawRecord?.period_end &&
|
||||||
|
now >= rawRecord.period_start &&
|
||||||
|
now < rawRecord.period_end,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isWindowActive && rawRecord) {
|
||||||
|
await tx.quotaRecord.update({
|
||||||
|
where: { id: rawRecord.id },
|
||||||
|
data: {
|
||||||
|
consumed: { increment: amount },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const periodStart = now
|
||||||
|
const periodEnd = new Date(now.getTime() + periodToDurationMs(rule.period))
|
||||||
|
|
||||||
|
if (rawRecord) {
|
||||||
|
await tx.quotaRecord.update({
|
||||||
|
where: { id: rawRecord.id },
|
||||||
|
data: {
|
||||||
|
periodStart,
|
||||||
|
periodEnd,
|
||||||
|
consumed: amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await tx.quotaRecord.create({
|
||||||
|
data: {
|
||||||
|
ruleId: rule.id,
|
||||||
|
teamId: rule.teamId,
|
||||||
|
userId: targetUserId,
|
||||||
|
periodStart,
|
||||||
|
periodEnd,
|
||||||
|
consumed: amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const quotaService = new QuotaService()
|
||||||
@@ -184,6 +184,115 @@ describe('TeamService', () => {
|
|||||||
expect(allMembers).toHaveLength(2)
|
expect(allMembers).toHaveLength(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should filter included agents by agent permission and requester role', async () => {
|
||||||
|
const owner = await prisma.user.create({
|
||||||
|
data: { name: 'Owner', email: `owner-${Date.now()}@example.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
const team = await teamService.createTeam(owner, { name: 'Permission Team' })
|
||||||
|
|
||||||
|
const editor = await prisma.user.create({
|
||||||
|
data: { name: 'Editor', email: `editor-${Date.now()}@example.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: editor.id, role: 'editor' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const reviewer = await prisma.user.create({
|
||||||
|
data: { name: 'Reviewer', email: `reviewer-${Date.now()}@example.com`, password: 'pw' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: reviewer.id, role: 'reviewer' },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create 3 agents with different permissions
|
||||||
|
const botReviewer = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Bot All Users',
|
||||||
|
email: `bot-rev-${Date.now()}@shumai.ai`,
|
||||||
|
type: 'agent',
|
||||||
|
agent: {
|
||||||
|
create: {
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'reviewer',
|
||||||
|
enabled: true,
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await teamService.joinTeam({ teamId: team.id, userId: botReviewer.id })
|
||||||
|
|
||||||
|
const botEditor = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Bot Editor Only',
|
||||||
|
email: `bot-ed-${Date.now()}@shumai.ai`,
|
||||||
|
type: 'agent',
|
||||||
|
agent: {
|
||||||
|
create: {
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'editor',
|
||||||
|
enabled: true,
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await teamService.joinTeam({ teamId: team.id, userId: botEditor.id })
|
||||||
|
|
||||||
|
const botOwner = await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
name: 'Bot Owner Only',
|
||||||
|
email: `bot-own-${Date.now()}@shumai.ai`,
|
||||||
|
type: 'agent',
|
||||||
|
agent: {
|
||||||
|
create: {
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
permission: 'owner',
|
||||||
|
enabled: true,
|
||||||
|
config: { provider: 'p', model: 'm' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await teamService.joinTeam({ teamId: team.id, userId: botOwner.id })
|
||||||
|
|
||||||
|
// Reviewer should only see botReviewer among agents
|
||||||
|
const reviewerMembers = await teamService.getTeamMembers({
|
||||||
|
teamId: team.id,
|
||||||
|
userId: reviewer.id,
|
||||||
|
includeAgents: true,
|
||||||
|
})
|
||||||
|
const reviewerAgentIds = reviewerMembers.filter((m) => m.type === 'agent').map((m) => m.id)
|
||||||
|
expect(reviewerAgentIds).toEqual([botReviewer.id])
|
||||||
|
|
||||||
|
// Editor should see botReviewer and botEditor
|
||||||
|
const editorMembers = await teamService.getTeamMembers({
|
||||||
|
teamId: team.id,
|
||||||
|
userId: editor.id,
|
||||||
|
includeAgents: true,
|
||||||
|
})
|
||||||
|
const editorAgentIds = editorMembers.filter((m) => m.type === 'agent').map((m) => m.id)
|
||||||
|
expect(editorAgentIds).toHaveLength(2)
|
||||||
|
expect(editorAgentIds).toContain(botReviewer.id)
|
||||||
|
expect(editorAgentIds).toContain(botEditor.id)
|
||||||
|
expect(editorAgentIds).not.toContain(botOwner.id)
|
||||||
|
|
||||||
|
// Owner should see all 3 agents
|
||||||
|
const ownerMembers = await teamService.getTeamMembers({
|
||||||
|
teamId: team.id,
|
||||||
|
userId: owner.id,
|
||||||
|
includeAgents: true,
|
||||||
|
})
|
||||||
|
const ownerAgentIds = ownerMembers.filter((m) => m.type === 'agent').map((m) => m.id)
|
||||||
|
expect(ownerAgentIds).toHaveLength(3)
|
||||||
|
expect(ownerAgentIds).toContain(botReviewer.id)
|
||||||
|
expect(ownerAgentIds).toContain(botEditor.id)
|
||||||
|
expect(ownerAgentIds).toContain(botOwner.id)
|
||||||
|
})
|
||||||
|
|
||||||
it('should filter members for project-scoped members', async () => {
|
it('should filter members for project-scoped members', async () => {
|
||||||
const owner = await prisma.user.create({
|
const owner = await prisma.user.create({
|
||||||
data: { name: 'Owner', email: `owner-${Date.now()}@example.com`, password: 'pw' },
|
data: { name: 'Owner', email: `owner-${Date.now()}@example.com`, password: 'pw' },
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ProviderService, providerService } from '@shumai/core/src/provider/prov
|
|||||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||||
import { HTTPException } from 'hono/http-exception'
|
import { HTTPException } from 'hono/http-exception'
|
||||||
|
import { getAllowedAgentRoles } from '@shumai/core/src/agent/permissions'
|
||||||
import {
|
import {
|
||||||
ServiceCreateTeamRequest,
|
ServiceCreateTeamRequest,
|
||||||
ServiceGetUserTeamsRequest,
|
ServiceGetUserTeamsRequest,
|
||||||
@@ -188,6 +189,8 @@ export class TeamService {
|
|||||||
throw new HTTPException(403, { message: 'Requester is not a team member' })
|
throw new HTTPException(403, { message: 'Requester is not a team member' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const allowedAgentRoles = getAllowedAgentRoles(requester.role)
|
||||||
|
|
||||||
const members = await prisma.teamMember.findMany({
|
const members = await prisma.teamMember.findMany({
|
||||||
where: {
|
where: {
|
||||||
teamId: req.teamId,
|
teamId: req.teamId,
|
||||||
@@ -201,6 +204,7 @@ export class TeamService {
|
|||||||
agent: {
|
agent: {
|
||||||
type: 'chat',
|
type: 'chat',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
permission: { in: allowedAgentRoles },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { describe, it, expect, beforeEach } from 'vitest'
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { setupTestDbHooks } from '@shumai/db/test'
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
import { VersionStackService } from './versionStack'
|
import { VersionStackService } from './versionStack'
|
||||||
|
import { assetService } from '../asset/asset'
|
||||||
import { AssetType } from '@shumai/db'
|
import { AssetType } from '@shumai/db'
|
||||||
|
|
||||||
describe('VersionStackService', () => {
|
describe('VersionStackService', () => {
|
||||||
@@ -207,4 +208,299 @@ describe('VersionStackService', () => {
|
|||||||
expect(children.map((c) => c.id).includes(file3.id)).toBe(true)
|
expect(children.map((c) => c.id).includes(file3.id)).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('removeVersionFromStack', () => {
|
||||||
|
it('removes a version from a 3-version stack and turns it into a standalone file adjacent to the stack', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team' } })
|
||||||
|
const proj = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const root = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
status: 'uploaded',
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const parent = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Parent Folder',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: proj.id,
|
||||||
|
parentId: root.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 3,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const file1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file1.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: parent.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'a0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const file2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file2.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: parent.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 200,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const file3 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file3.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: parent.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 300,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await service.createVersionStack({
|
||||||
|
fileIds: [file1.id, file2.id, file3.id],
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Stack should have 3 versions
|
||||||
|
expect(stack.fileCount).toBe(3)
|
||||||
|
expect(Number(stack.sizeByte)).toBe(600)
|
||||||
|
|
||||||
|
// Parent fileCount should be 1 (the stack)
|
||||||
|
const parentBefore = await prisma.asset.findUnique({ where: { id: parent.id } })
|
||||||
|
expect(parentBefore?.fileCount).toBe(1)
|
||||||
|
|
||||||
|
// Remove file2 from stack
|
||||||
|
await service.removeVersionFromStack({
|
||||||
|
stackId: stack.id,
|
||||||
|
fileId: file2.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// File2 should now be in parent folder
|
||||||
|
const updatedFile2 = await prisma.asset.findUnique({ where: { id: file2.id } })
|
||||||
|
expect(updatedFile2?.parentId).toBe(parent.id)
|
||||||
|
expect(updatedFile2?.sortIndex).toBeDefined()
|
||||||
|
expect(updatedFile2!.sortIndex! > stack.sortIndex!).toBe(true)
|
||||||
|
|
||||||
|
// Parent fileCount should be 2 (stack + file2)
|
||||||
|
const updatedParent = await prisma.asset.findUnique({ where: { id: parent.id } })
|
||||||
|
expect(updatedParent?.fileCount).toBe(2)
|
||||||
|
|
||||||
|
// Stack should still exist with 2 versions (file1 and file3)
|
||||||
|
const updatedStack = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||||
|
expect(updatedStack).toBeDefined()
|
||||||
|
expect(updatedStack?.fileCount).toBe(2)
|
||||||
|
expect(Number(updatedStack?.sizeByte)).toBe(400)
|
||||||
|
|
||||||
|
const remainingChildren = await prisma.asset.findMany({
|
||||||
|
where: { parentId: stack.id },
|
||||||
|
})
|
||||||
|
expect(remainingChildren).toHaveLength(2)
|
||||||
|
expect(remainingChildren.map((c) => c.id).sort()).toEqual([file1.id, file3.id].sort())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('dissolves the version stack when removing down to 1 remaining version', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team' } })
|
||||||
|
const proj = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const root = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
status: 'uploaded',
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const parent = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'Parent Folder',
|
||||||
|
type: AssetType.folder,
|
||||||
|
projectId: proj.id,
|
||||||
|
parentId: root.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
fileCount: 2,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const file1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file1.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: parent.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
sortIndex: 'a0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const file2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file2.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: parent.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 200,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const stack = await service.createVersionStack({
|
||||||
|
fileIds: [file1.id, file2.id],
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remove file2 from stack
|
||||||
|
await service.removeVersionFromStack({
|
||||||
|
stackId: stack.id,
|
||||||
|
fileId: file2.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Stack asset should be deleted
|
||||||
|
const deletedStack = await prisma.asset.findUnique({ where: { id: stack.id } })
|
||||||
|
expect(deletedStack).toBeNull()
|
||||||
|
|
||||||
|
// File1 should now be in parent folder and inherited stack's sortIndex
|
||||||
|
const updatedFile1 = await prisma.asset.findUnique({ where: { id: file1.id } })
|
||||||
|
expect(updatedFile1?.parentId).toBe(parent.id)
|
||||||
|
expect(updatedFile1?.sortIndex).toBe('a0')
|
||||||
|
|
||||||
|
// File2 should also be in parent folder
|
||||||
|
const updatedFile2 = await prisma.asset.findUnique({ where: { id: file2.id } })
|
||||||
|
expect(updatedFile2?.parentId).toBe(parent.id)
|
||||||
|
|
||||||
|
// Parent fileCount should be 2
|
||||||
|
const updatedParent = await prisma.asset.findUnique({ where: { id: parent.id } })
|
||||||
|
expect(updatedParent?.fileCount).toBe(2)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('updates share link symlinks when normal asset becomes version stack and when stack dissolves back to normal asset', async () => {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Test Team' } })
|
||||||
|
const proj = await prisma.project.create({
|
||||||
|
data: { name: 'Test Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Test User', email: `test-${Date.now()}@example.com` },
|
||||||
|
})
|
||||||
|
const root = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'root',
|
||||||
|
type: AssetType.folder,
|
||||||
|
status: 'uploaded',
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const shareRoot = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'share-root',
|
||||||
|
type: AssetType.share_root,
|
||||||
|
status: 'uploaded',
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
fileCount: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const shareLink = await prisma.shareLink.create({
|
||||||
|
data: {
|
||||||
|
name: 'My Share',
|
||||||
|
projectId: proj.id,
|
||||||
|
rootFolderId: shareRoot.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const file1 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file1.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const file2 = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'file2.txt',
|
||||||
|
type: AssetType.file,
|
||||||
|
parentId: root.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 200,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Add file1 to share link (create symlink)
|
||||||
|
const symlink = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: file1.name,
|
||||||
|
type: AssetType.symlink,
|
||||||
|
parentId: shareLink.rootFolderId,
|
||||||
|
targetId: file1.id,
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
status: 'uploaded',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 1. Group file1 and file2 into a version stack
|
||||||
|
const stack = await service.createVersionStack({
|
||||||
|
fileIds: [file1.id, file2.id],
|
||||||
|
projectId: proj.id,
|
||||||
|
creatorId: user.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Symlink in share link should now point to stack.id
|
||||||
|
const symlinkAfterStack = await prisma.asset.findUnique({ where: { id: symlink.id } })
|
||||||
|
expect(symlinkAfterStack?.targetId).toBe(stack.id)
|
||||||
|
|
||||||
|
// 2. Remove file2 from stack -> stack dissolves -> only file1 remains
|
||||||
|
await service.removeVersionFromStack({
|
||||||
|
stackId: stack.id,
|
||||||
|
fileId: file2.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Symlink in share link should now point directly to file1.id and have file1's name
|
||||||
|
const symlinkAfterDissolve = await prisma.asset.findUnique({ where: { id: symlink.id } })
|
||||||
|
expect(symlinkAfterDissolve?.targetId).toBe(file1.id)
|
||||||
|
expect(symlinkAfterDissolve?.name).toBe(file1.name)
|
||||||
|
|
||||||
|
// Listing share link files returns file1 with correct name
|
||||||
|
const shareFiles = await assetService.listChildren({
|
||||||
|
assetId: shareLink.rootFolderId,
|
||||||
|
assetType: AssetType.file,
|
||||||
|
})
|
||||||
|
expect(shareFiles.data).toHaveLength(1)
|
||||||
|
expect(shareFiles.data[0].name).toBe(file1.name)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { type Asset, AssetType } from '@shumai/db'
|
import { type Asset, AssetType } from '@shumai/db'
|
||||||
import { ChangeStackFileVersionParams, CreateVersionStackParams } from '@shumai/dtos'
|
import {
|
||||||
|
ChangeStackFileVersionParams,
|
||||||
|
CreateVersionStackParams,
|
||||||
|
RemoveStackVersionParams,
|
||||||
|
} from '@shumai/dtos'
|
||||||
|
import { dedupeSymlinksToTarget } from '../asset/symlink'
|
||||||
|
|
||||||
function generateSortIndex(previous?: string | null): string {
|
function generateSortIndex(previous?: string | null): string {
|
||||||
if (!previous) return generateKeyBetween(null, null)
|
if (!previous) return generateKeyBetween(null, null)
|
||||||
@@ -95,6 +100,9 @@ export class VersionStackService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Update existing symlinks pointing to any of the stacked files
|
||||||
|
await dedupeSymlinksToTarget(tx, { targetIds: fileIds, newTargetId: stack.id })
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -127,7 +135,7 @@ export class VersionStackService {
|
|||||||
|
|
||||||
if (beforeId === '-1') {
|
if (beforeId === '-1') {
|
||||||
const lastFile = await tx.asset.findFirst({
|
const lastFile = await tx.asset.findFirst({
|
||||||
where: { parentId: stackId },
|
where: { parentId: stackId, id: { not: fileId } },
|
||||||
orderBy: { sortIndex: 'desc' },
|
orderBy: { sortIndex: 'desc' },
|
||||||
})
|
})
|
||||||
newSortIndex = generateKeyBetween(lastFile?.sortIndex || null, null)
|
newSortIndex = generateKeyBetween(lastFile?.sortIndex || null, null)
|
||||||
@@ -145,6 +153,7 @@ export class VersionStackService {
|
|||||||
const prevFile = await tx.asset.findFirst({
|
const prevFile = await tx.asset.findFirst({
|
||||||
where: {
|
where: {
|
||||||
parentId: stackId,
|
parentId: stackId,
|
||||||
|
id: { not: fileId },
|
||||||
sortIndex: {
|
sortIndex: {
|
||||||
lt: beforeFile.sortIndex!,
|
lt: beforeFile.sortIndex!,
|
||||||
},
|
},
|
||||||
@@ -168,6 +177,123 @@ export class VersionStackService {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async removeVersionFromStack(params: RemoveStackVersionParams): Promise<void> {
|
||||||
|
const { stackId, fileId } = params
|
||||||
|
|
||||||
|
await this.prismaClient.$transaction(async (tx) => {
|
||||||
|
const stack = await tx.asset.findUnique({
|
||||||
|
where: { id: stackId },
|
||||||
|
})
|
||||||
|
if (!stack) {
|
||||||
|
throw new Error('stack not found')
|
||||||
|
}
|
||||||
|
if (stack.type !== AssetType.version_stack) {
|
||||||
|
throw new Error('asset is not a version stack')
|
||||||
|
}
|
||||||
|
if (!stack.parentId) {
|
||||||
|
throw new Error('stack has no parent')
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileToRemove = await tx.asset.findUnique({
|
||||||
|
where: { id: fileId },
|
||||||
|
})
|
||||||
|
if (!fileToRemove) {
|
||||||
|
throw new Error('file not found')
|
||||||
|
}
|
||||||
|
if (fileToRemove.parentId !== stackId) {
|
||||||
|
throw new Error('file is not in the stack')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find next sibling in parent folder after the stack to insert the removed file adjacent to the stack
|
||||||
|
const nextSibling = await tx.asset.findFirst({
|
||||||
|
where: {
|
||||||
|
parentId: stack.parentId,
|
||||||
|
id: { not: stack.id },
|
||||||
|
sortIndex: {
|
||||||
|
gt: stack.sortIndex || '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
orderBy: { sortIndex: 'asc' },
|
||||||
|
})
|
||||||
|
|
||||||
|
let newSortIndex: string
|
||||||
|
try {
|
||||||
|
newSortIndex = generateKeyBetween(stack.sortIndex || null, nextSibling?.sortIndex || null)
|
||||||
|
} catch {
|
||||||
|
newSortIndex = generateKeyBetween(null, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: fileId },
|
||||||
|
data: {
|
||||||
|
parentId: stack.parentId,
|
||||||
|
sortIndex: newSortIndex,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Increment parent folder fileCount for the newly standalone file
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: stack.parentId },
|
||||||
|
data: {
|
||||||
|
fileCount: { increment: 1 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remaining files in stack
|
||||||
|
const remainingFiles = await tx.asset.findMany({
|
||||||
|
where: { parentId: stackId, isDeleted: false, id: { not: fileId } },
|
||||||
|
orderBy: { sortIndex: 'asc' },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (remainingFiles.length > 1) {
|
||||||
|
let totalSize = 0
|
||||||
|
for (const f of remainingFiles) {
|
||||||
|
totalSize += Number(f.sizeByte)
|
||||||
|
}
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: stack.id },
|
||||||
|
data: {
|
||||||
|
fileCount: remainingFiles.length,
|
||||||
|
sizeByte: totalSize,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else if (remainingFiles.length === 1) {
|
||||||
|
const lastChild = remainingFiles[0]
|
||||||
|
|
||||||
|
// Update symlinks pointing to stack.id to point to the single remaining child
|
||||||
|
await tx.asset.updateMany({
|
||||||
|
where: { targetId: stack.id, type: AssetType.symlink },
|
||||||
|
data: { targetId: lastChild.id, name: lastChild.name },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Reparent the single remaining child to stack.parentId, keeping stack's sortIndex
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: lastChild.id },
|
||||||
|
data: {
|
||||||
|
parentId: stack.parentId,
|
||||||
|
sortIndex: stack.sortIndex,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Delete the stack asset (parent folder file count is unchanged: -1 stack, +1 remaining child)
|
||||||
|
await tx.asset.delete({
|
||||||
|
where: { id: stack.id },
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await tx.asset.deleteMany({
|
||||||
|
where: { targetId: stack.id, type: AssetType.symlink },
|
||||||
|
})
|
||||||
|
await tx.asset.delete({
|
||||||
|
where: { id: stack.id },
|
||||||
|
})
|
||||||
|
await tx.asset.update({
|
||||||
|
where: { id: stack.parentId },
|
||||||
|
data: { fileCount: { decrement: 1 } },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const versionStackService = new VersionStackService()
|
export const versionStackService = new VersionStackService()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/db",
|
"name": "@shumai/db",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "assets" ADD COLUMN "agentmd" TEXT;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `agentmd` on the `assets` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "assets" DROP COLUMN "agentmd";
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "asset_agentmd" (
|
||||||
|
"asset_id" TEXT NOT NULL,
|
||||||
|
"content" TEXT NOT NULL,
|
||||||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "asset_agentmd_pkey" PRIMARY KEY ("asset_id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "asset_agentmd" ADD CONSTRAINT "asset_agentmd_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "agents" ADD COLUMN "permission" "TeamMemberRole" NOT NULL DEFAULT 'reviewer';
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "QuotaScopeMode" AS ENUM ('all_members', 'each_member', 'selected_members');
|
||||||
|
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "QuotaPeriod" AS ENUM ('1hour', '5hour', '1day', '7day');
|
||||||
|
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "QuotaResourceType" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_skill_call_count', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "quota_rules" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"team_id" TEXT NOT NULL,
|
||||||
|
"scope_mode" "QuotaScopeMode" NOT NULL,
|
||||||
|
"role" "TeamMemberRole",
|
||||||
|
"user_ids" JSONB,
|
||||||
|
"resource" "QuotaResourceType" NOT NULL,
|
||||||
|
"resource_data" JSONB,
|
||||||
|
"limit" DOUBLE PRECISION NOT NULL,
|
||||||
|
"period" "QuotaPeriod" NOT NULL,
|
||||||
|
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "quota_rules_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "quota_records" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"rule_id" TEXT NOT NULL,
|
||||||
|
"team_id" TEXT NOT NULL,
|
||||||
|
"user_id" TEXT,
|
||||||
|
"period_start" TIMESTAMP(3),
|
||||||
|
"period_end" TIMESTAMP(3),
|
||||||
|
"consumed" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "quota_records_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "quota_rules_team_id_enabled_idx" ON "quota_rules"("team_id", "enabled");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "quota_rules_team_id_resource_idx" ON "quota_rules"("team_id", "resource");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "quota_records_team_id_user_id_idx" ON "quota_records"("team_id", "user_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "quota_records_rule_id_idx" ON "quota_records"("rule_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "quota_records_rule_id_user_id_key" ON "quota_records"("rule_id", "user_id");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "quota_rules" ADD CONSTRAINT "quota_rules_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_rule_id_fkey" FOREIGN KEY ("rule_id") REFERENCES "quota_rules"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- The values [agent_skill_call_count] on the enum `QuotaResourceType` will be removed. If these variants are still used in the database, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterEnum
|
||||||
|
BEGIN;
|
||||||
|
CREATE TYPE "QuotaResourceType_new" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
|
||||||
|
ALTER TABLE "quota_rules" ALTER COLUMN "resource" TYPE "QuotaResourceType_new" USING ("resource"::text::"QuotaResourceType_new");
|
||||||
|
ALTER TYPE "QuotaResourceType" RENAME TO "QuotaResourceType_old";
|
||||||
|
ALTER TYPE "QuotaResourceType_new" RENAME TO "QuotaResourceType";
|
||||||
|
DROP TYPE "public"."QuotaResourceType_old";
|
||||||
|
COMMIT;
|
||||||
@@ -135,6 +135,27 @@ enum WatermarkFileStatus {
|
|||||||
failed
|
failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum QuotaScopeMode {
|
||||||
|
all_members
|
||||||
|
each_member
|
||||||
|
selected_members
|
||||||
|
}
|
||||||
|
|
||||||
|
enum QuotaPeriod {
|
||||||
|
one_hour @map("1hour")
|
||||||
|
five_hours @map("5hour")
|
||||||
|
one_day @map("1day")
|
||||||
|
seven_days @map("7day")
|
||||||
|
}
|
||||||
|
|
||||||
|
enum QuotaResourceType {
|
||||||
|
agent_total_tokens
|
||||||
|
agent_cost
|
||||||
|
agent_mcp_call_count
|
||||||
|
agent_bash_call_count
|
||||||
|
agent_tool_call_count
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Models
|
// Models
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
@@ -172,6 +193,7 @@ model User {
|
|||||||
apiTokens ApiToken[] @relation("UserToApiToken")
|
apiTokens ApiToken[] @relation("UserToApiToken")
|
||||||
aiUsages AiUsage[] @relation("UserToAiUsage")
|
aiUsages AiUsage[] @relation("UserToAiUsage")
|
||||||
auditLogs AuditLog[] @relation("UserToAuditLog")
|
auditLogs AuditLog[] @relation("UserToAuditLog")
|
||||||
|
quotaRecords QuotaRecord[] @relation("UserToQuotaRecord")
|
||||||
|
|
||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
@@ -258,6 +280,8 @@ model Team {
|
|||||||
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
||||||
auditLogs AuditLog[] @relation("TeamToAuditLog")
|
auditLogs AuditLog[] @relation("TeamToAuditLog")
|
||||||
watermarkTemplates WatermarkTemplate[] @relation("TeamToWatermarkTemplate")
|
watermarkTemplates WatermarkTemplate[] @relation("TeamToWatermarkTemplate")
|
||||||
|
quotaRules QuotaRule[] @relation("TeamToQuotaRule")
|
||||||
|
quotaRecords QuotaRecord[] @relation("TeamToQuotaRecord")
|
||||||
|
|
||||||
@@map("teams")
|
@@map("teams")
|
||||||
}
|
}
|
||||||
@@ -490,6 +514,7 @@ model Asset {
|
|||||||
shareLinkRootFolder ShareLink? @relation("ShareLinkToRootFolder")
|
shareLinkRootFolder ShareLink? @relation("ShareLinkToRootFolder")
|
||||||
agentSessions AgentSession[] @relation("AssetToAgentSession")
|
agentSessions AgentSession[] @relation("AssetToAgentSession")
|
||||||
watermarkFiles WatermarkFile[] @relation("AssetToWatermarkFile")
|
watermarkFiles WatermarkFile[] @relation("AssetToWatermarkFile")
|
||||||
|
agentMd AssetAgentMd? @relation("AssetToAgentMd")
|
||||||
|
|
||||||
@@map("assets")
|
@@map("assets")
|
||||||
@@index([type])
|
@@index([type])
|
||||||
@@ -537,6 +562,17 @@ model AssetMetadataValue {
|
|||||||
@@map("asset_metadata_values")
|
@@map("asset_metadata_values")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model AssetAgentMd {
|
||||||
|
assetId String @id @map("asset_id")
|
||||||
|
content String @db.Text
|
||||||
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
|
updatedAt DateTime @updatedAt @map("updated_at")
|
||||||
|
|
||||||
|
asset Asset @relation("AssetToAgentMd", fields: [assetId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@map("asset_agentmd")
|
||||||
|
}
|
||||||
|
|
||||||
model AssetComment {
|
model AssetComment {
|
||||||
id String @id @default(ulid())
|
id String @id @default(ulid())
|
||||||
message String?
|
message String?
|
||||||
@@ -739,6 +775,7 @@ model Agent {
|
|||||||
user User @relation(fields: [id], references: [id], onDelete: Cascade)
|
user User @relation(fields: [id], references: [id], onDelete: Cascade)
|
||||||
type AgentType
|
type AgentType
|
||||||
enabled Boolean @default(true)
|
enabled Boolean @default(true)
|
||||||
|
permission TeamMemberRole @default(reviewer)
|
||||||
soul String? @db.Text
|
soul String? @db.Text
|
||||||
providerId String? @map("provider_id")
|
providerId String? @map("provider_id")
|
||||||
provider Provider? @relation("ProviderToAgent", fields: [providerId], references: [id], onDelete: SetNull)
|
provider Provider? @relation("ProviderToAgent", fields: [providerId], references: [id], onDelete: SetNull)
|
||||||
@@ -1005,4 +1042,49 @@ model AuditLog {
|
|||||||
@@map("audit_logs")
|
@@map("audit_logs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model QuotaRule {
|
||||||
|
id String @id @default(ulid())
|
||||||
|
teamId String @map("team_id")
|
||||||
|
scopeMode QuotaScopeMode @map("scope_mode")
|
||||||
|
role TeamMemberRole? @map("role")
|
||||||
|
/// [QuotaUserIds]
|
||||||
|
userIds Json? @map("user_ids")
|
||||||
|
resource QuotaResourceType @map("resource")
|
||||||
|
/// [QuotaResourceData]
|
||||||
|
resourceData Json? @map("resource_data")
|
||||||
|
limit Float @map("limit")
|
||||||
|
period QuotaPeriod @map("period")
|
||||||
|
enabled Boolean @default(true) @map("enabled")
|
||||||
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
|
updatedAt DateTime @updatedAt @map("updated_at")
|
||||||
|
|
||||||
|
team Team @relation("TeamToQuotaRule", fields: [teamId], references: [id], onDelete: Cascade)
|
||||||
|
records QuotaRecord[] @relation("QuotaRuleToRecord")
|
||||||
|
|
||||||
|
@@index([teamId, enabled])
|
||||||
|
@@index([teamId, resource])
|
||||||
|
@@map("quota_rules")
|
||||||
|
}
|
||||||
|
|
||||||
|
model QuotaRecord {
|
||||||
|
id String @id @default(ulid())
|
||||||
|
ruleId String @map("rule_id")
|
||||||
|
teamId String @map("team_id")
|
||||||
|
userId String? @map("user_id")
|
||||||
|
periodStart DateTime? @map("period_start")
|
||||||
|
periodEnd DateTime? @map("period_end")
|
||||||
|
consumed Float @default(0) @map("consumed")
|
||||||
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
|
updatedAt DateTime @updatedAt @map("updated_at")
|
||||||
|
|
||||||
|
rule QuotaRule @relation("QuotaRuleToRecord", fields: [ruleId], references: [id], onDelete: Cascade)
|
||||||
|
team Team @relation("TeamToQuotaRecord", fields: [teamId], references: [id], onDelete: Cascade)
|
||||||
|
user User? @relation("UserToQuotaRecord", fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@unique([ruleId, userId])
|
||||||
|
@@index([teamId, userId])
|
||||||
|
@@index([ruleId])
|
||||||
|
@@map("quota_records")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
@@ -107,6 +107,11 @@ export type StorageKey = Prisma.StorageKeyModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
||||||
|
/**
|
||||||
|
* Model AssetAgentMd
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type AssetAgentMd = Prisma.AssetAgentMdModel
|
||||||
/**
|
/**
|
||||||
* Model AssetComment
|
* Model AssetComment
|
||||||
*
|
*
|
||||||
@@ -222,3 +227,13 @@ export type AiUsage = Prisma.AiUsageModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type AuditLog = Prisma.AuditLogModel
|
export type AuditLog = Prisma.AuditLogModel
|
||||||
|
/**
|
||||||
|
* Model QuotaRule
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type QuotaRule = Prisma.QuotaRuleModel
|
||||||
|
/**
|
||||||
|
* Model QuotaRecord
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type QuotaRecord = Prisma.QuotaRecordModel
|
||||||
|
|||||||
+15
@@ -131,6 +131,11 @@ export type StorageKey = Prisma.StorageKeyModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
||||||
|
/**
|
||||||
|
* Model AssetAgentMd
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type AssetAgentMd = Prisma.AssetAgentMdModel
|
||||||
/**
|
/**
|
||||||
* Model AssetComment
|
* Model AssetComment
|
||||||
*
|
*
|
||||||
@@ -246,3 +251,13 @@ export type AiUsage = Prisma.AiUsageModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type AuditLog = Prisma.AuditLogModel
|
export type AuditLog = Prisma.AuditLogModel
|
||||||
|
/**
|
||||||
|
* Model QuotaRule
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type QuotaRule = Prisma.QuotaRuleModel
|
||||||
|
/**
|
||||||
|
* Model QuotaRecord
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export type QuotaRecord = Prisma.QuotaRecordModel
|
||||||
|
|||||||
+136
@@ -748,6 +748,74 @@ export type FloatWithAggregatesFilter<$PrismaModel = never> = {
|
|||||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaScopeModeFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel> | $Enums.QuotaScopeMode
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumTeamMemberRoleNullableFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
not?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel> | $Enums.TeamMemberRole | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaResourceTypeFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel> | $Enums.QuotaResourceType
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaPeriodFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel> | $Enums.QuotaPeriod
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaScopeModeWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaScopeMode
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
not?: Prisma.NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel> | $Enums.TeamMemberRole | null
|
||||||
|
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaResourceType
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnumQuotaPeriodWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel> | $Enums.QuotaPeriod
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
export type NestedStringFilter<$PrismaModel = never> = {
|
export type NestedStringFilter<$PrismaModel = never> = {
|
||||||
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
|
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
|
||||||
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
|
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
|
||||||
@@ -1417,4 +1485,72 @@ export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
|
|||||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaScopeModeFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel> | $Enums.QuotaScopeMode
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumTeamMemberRoleNullableFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
not?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel> | $Enums.TeamMemberRole | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaResourceTypeFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel> | $Enums.QuotaResourceType
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaPeriodFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel> | $Enums.QuotaPeriod
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaScopeMode
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
|
||||||
|
not?: Prisma.NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel> | $Enums.TeamMemberRole | null
|
||||||
|
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaResourceType
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel = never> = {
|
||||||
|
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
|
||||||
|
not?: Prisma.NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel> | $Enums.QuotaPeriod
|
||||||
|
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||||
|
_min?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
|
||||||
|
_max?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+30
@@ -173,6 +173,36 @@ export const WatermarkFileStatus = {
|
|||||||
export type WatermarkFileStatus = (typeof WatermarkFileStatus)[keyof typeof WatermarkFileStatus]
|
export type WatermarkFileStatus = (typeof WatermarkFileStatus)[keyof typeof WatermarkFileStatus]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaScopeMode = {
|
||||||
|
all_members: 'all_members',
|
||||||
|
each_member: 'each_member',
|
||||||
|
selected_members: 'selected_members'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaScopeMode = (typeof QuotaScopeMode)[keyof typeof QuotaScopeMode]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaPeriod = {
|
||||||
|
one_hour: 'one_hour',
|
||||||
|
five_hours: 'five_hours',
|
||||||
|
one_day: 'one_day',
|
||||||
|
seven_days: 'seven_days'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaPeriod = (typeof QuotaPeriod)[keyof typeof QuotaPeriod]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaResourceType = {
|
||||||
|
agent_total_tokens: 'agent_total_tokens',
|
||||||
|
agent_cost: 'agent_cost',
|
||||||
|
agent_mcp_call_count: 'agent_mcp_call_count',
|
||||||
|
agent_bash_call_count: 'agent_bash_call_count',
|
||||||
|
agent_tool_call_count: 'agent_tool_call_count'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaResourceType = (typeof QuotaResourceType)[keyof typeof QuotaResourceType]
|
||||||
|
|
||||||
|
|
||||||
export const AgentType = {
|
export const AgentType = {
|
||||||
chat: 'chat',
|
chat: 'chat',
|
||||||
autofill: 'autofill',
|
autofill: 'autofill',
|
||||||
|
|||||||
+34
-4
File diff suppressed because one or more lines are too long
+316
-2
@@ -402,6 +402,7 @@ export const ModelName = {
|
|||||||
Asset: 'Asset',
|
Asset: 'Asset',
|
||||||
StorageKey: 'StorageKey',
|
StorageKey: 'StorageKey',
|
||||||
AssetMetadataValue: 'AssetMetadataValue',
|
AssetMetadataValue: 'AssetMetadataValue',
|
||||||
|
AssetAgentMd: 'AssetAgentMd',
|
||||||
AssetComment: 'AssetComment',
|
AssetComment: 'AssetComment',
|
||||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||||
AssetEmbedding: 'AssetEmbedding',
|
AssetEmbedding: 'AssetEmbedding',
|
||||||
@@ -424,7 +425,9 @@ export const ModelName = {
|
|||||||
Collection: 'Collection',
|
Collection: 'Collection',
|
||||||
ApiToken: 'ApiToken',
|
ApiToken: 'ApiToken',
|
||||||
AiUsage: 'AiUsage',
|
AiUsage: 'AiUsage',
|
||||||
AuditLog: 'AuditLog'
|
AuditLog: 'AuditLog',
|
||||||
|
QuotaRule: 'QuotaRule',
|
||||||
|
QuotaRecord: 'QuotaRecord'
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||||
@@ -440,7 +443,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|||||||
omit: GlobalOmitOptions
|
omit: GlobalOmitOptions
|
||||||
}
|
}
|
||||||
meta: {
|
meta: {
|
||||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog"
|
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord"
|
||||||
txIsolationLevel: TransactionIsolationLevel
|
txIsolationLevel: TransactionIsolationLevel
|
||||||
}
|
}
|
||||||
model: {
|
model: {
|
||||||
@@ -1776,6 +1779,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AssetAgentMd: {
|
||||||
|
payload: Prisma.$AssetAgentMdPayload<ExtArgs>
|
||||||
|
fields: Prisma.AssetAgentMdFieldRefs
|
||||||
|
operations: {
|
||||||
|
findUnique: {
|
||||||
|
args: Prisma.AssetAgentMdFindUniqueArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload> | null
|
||||||
|
}
|
||||||
|
findUniqueOrThrow: {
|
||||||
|
args: Prisma.AssetAgentMdFindUniqueOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
findFirst: {
|
||||||
|
args: Prisma.AssetAgentMdFindFirstArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload> | null
|
||||||
|
}
|
||||||
|
findFirstOrThrow: {
|
||||||
|
args: Prisma.AssetAgentMdFindFirstOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
findMany: {
|
||||||
|
args: Prisma.AssetAgentMdFindManyArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>[]
|
||||||
|
}
|
||||||
|
create: {
|
||||||
|
args: Prisma.AssetAgentMdCreateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
createMany: {
|
||||||
|
args: Prisma.AssetAgentMdCreateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
createManyAndReturn: {
|
||||||
|
args: Prisma.AssetAgentMdCreateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>[]
|
||||||
|
}
|
||||||
|
delete: {
|
||||||
|
args: Prisma.AssetAgentMdDeleteArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
update: {
|
||||||
|
args: Prisma.AssetAgentMdUpdateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
deleteMany: {
|
||||||
|
args: Prisma.AssetAgentMdDeleteManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateMany: {
|
||||||
|
args: Prisma.AssetAgentMdUpdateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateManyAndReturn: {
|
||||||
|
args: Prisma.AssetAgentMdUpdateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>[]
|
||||||
|
}
|
||||||
|
upsert: {
|
||||||
|
args: Prisma.AssetAgentMdUpsertArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetAgentMdPayload>
|
||||||
|
}
|
||||||
|
aggregate: {
|
||||||
|
args: Prisma.AssetAgentMdAggregateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.AggregateAssetAgentMd>
|
||||||
|
}
|
||||||
|
groupBy: {
|
||||||
|
args: Prisma.AssetAgentMdGroupByArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.AssetAgentMdGroupByOutputType>[]
|
||||||
|
}
|
||||||
|
count: {
|
||||||
|
args: Prisma.AssetAgentMdCountArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.AssetAgentMdCountAggregateOutputType> | number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
AssetComment: {
|
AssetComment: {
|
||||||
payload: Prisma.$AssetCommentPayload<ExtArgs>
|
payload: Prisma.$AssetCommentPayload<ExtArgs>
|
||||||
fields: Prisma.AssetCommentFieldRefs
|
fields: Prisma.AssetCommentFieldRefs
|
||||||
@@ -3478,6 +3555,154 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QuotaRule: {
|
||||||
|
payload: Prisma.$QuotaRulePayload<ExtArgs>
|
||||||
|
fields: Prisma.QuotaRuleFieldRefs
|
||||||
|
operations: {
|
||||||
|
findUnique: {
|
||||||
|
args: Prisma.QuotaRuleFindUniqueArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload> | null
|
||||||
|
}
|
||||||
|
findUniqueOrThrow: {
|
||||||
|
args: Prisma.QuotaRuleFindUniqueOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
findFirst: {
|
||||||
|
args: Prisma.QuotaRuleFindFirstArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload> | null
|
||||||
|
}
|
||||||
|
findFirstOrThrow: {
|
||||||
|
args: Prisma.QuotaRuleFindFirstOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
findMany: {
|
||||||
|
args: Prisma.QuotaRuleFindManyArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
|
||||||
|
}
|
||||||
|
create: {
|
||||||
|
args: Prisma.QuotaRuleCreateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
createMany: {
|
||||||
|
args: Prisma.QuotaRuleCreateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
createManyAndReturn: {
|
||||||
|
args: Prisma.QuotaRuleCreateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
|
||||||
|
}
|
||||||
|
delete: {
|
||||||
|
args: Prisma.QuotaRuleDeleteArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
update: {
|
||||||
|
args: Prisma.QuotaRuleUpdateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
deleteMany: {
|
||||||
|
args: Prisma.QuotaRuleDeleteManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateMany: {
|
||||||
|
args: Prisma.QuotaRuleUpdateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateManyAndReturn: {
|
||||||
|
args: Prisma.QuotaRuleUpdateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
|
||||||
|
}
|
||||||
|
upsert: {
|
||||||
|
args: Prisma.QuotaRuleUpsertArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
|
||||||
|
}
|
||||||
|
aggregate: {
|
||||||
|
args: Prisma.QuotaRuleAggregateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.AggregateQuotaRule>
|
||||||
|
}
|
||||||
|
groupBy: {
|
||||||
|
args: Prisma.QuotaRuleGroupByArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.QuotaRuleGroupByOutputType>[]
|
||||||
|
}
|
||||||
|
count: {
|
||||||
|
args: Prisma.QuotaRuleCountArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.QuotaRuleCountAggregateOutputType> | number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QuotaRecord: {
|
||||||
|
payload: Prisma.$QuotaRecordPayload<ExtArgs>
|
||||||
|
fields: Prisma.QuotaRecordFieldRefs
|
||||||
|
operations: {
|
||||||
|
findUnique: {
|
||||||
|
args: Prisma.QuotaRecordFindUniqueArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload> | null
|
||||||
|
}
|
||||||
|
findUniqueOrThrow: {
|
||||||
|
args: Prisma.QuotaRecordFindUniqueOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
findFirst: {
|
||||||
|
args: Prisma.QuotaRecordFindFirstArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload> | null
|
||||||
|
}
|
||||||
|
findFirstOrThrow: {
|
||||||
|
args: Prisma.QuotaRecordFindFirstOrThrowArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
findMany: {
|
||||||
|
args: Prisma.QuotaRecordFindManyArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
|
||||||
|
}
|
||||||
|
create: {
|
||||||
|
args: Prisma.QuotaRecordCreateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
createMany: {
|
||||||
|
args: Prisma.QuotaRecordCreateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
createManyAndReturn: {
|
||||||
|
args: Prisma.QuotaRecordCreateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
|
||||||
|
}
|
||||||
|
delete: {
|
||||||
|
args: Prisma.QuotaRecordDeleteArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
update: {
|
||||||
|
args: Prisma.QuotaRecordUpdateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
deleteMany: {
|
||||||
|
args: Prisma.QuotaRecordDeleteManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateMany: {
|
||||||
|
args: Prisma.QuotaRecordUpdateManyArgs<ExtArgs>
|
||||||
|
result: BatchPayload
|
||||||
|
}
|
||||||
|
updateManyAndReturn: {
|
||||||
|
args: Prisma.QuotaRecordUpdateManyAndReturnArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
|
||||||
|
}
|
||||||
|
upsert: {
|
||||||
|
args: Prisma.QuotaRecordUpsertArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
|
||||||
|
}
|
||||||
|
aggregate: {
|
||||||
|
args: Prisma.QuotaRecordAggregateArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.AggregateQuotaRecord>
|
||||||
|
}
|
||||||
|
groupBy: {
|
||||||
|
args: Prisma.QuotaRecordGroupByArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.QuotaRecordGroupByOutputType>[]
|
||||||
|
}
|
||||||
|
count: {
|
||||||
|
args: Prisma.QuotaRecordCountArgs<ExtArgs>
|
||||||
|
result: runtime.Types.Utils.Optional<Prisma.QuotaRecordCountAggregateOutputType> | number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
other: {
|
other: {
|
||||||
@@ -3780,6 +4005,16 @@ export const AssetMetadataValueScalarFieldEnum = {
|
|||||||
export type AssetMetadataValueScalarFieldEnum = (typeof AssetMetadataValueScalarFieldEnum)[keyof typeof AssetMetadataValueScalarFieldEnum]
|
export type AssetMetadataValueScalarFieldEnum = (typeof AssetMetadataValueScalarFieldEnum)[keyof typeof AssetMetadataValueScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const AssetAgentMdScalarFieldEnum = {
|
||||||
|
assetId: 'assetId',
|
||||||
|
content: 'content',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type AssetAgentMdScalarFieldEnum = (typeof AssetAgentMdScalarFieldEnum)[keyof typeof AssetAgentMdScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const AssetCommentScalarFieldEnum = {
|
export const AssetCommentScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
message: 'message',
|
message: 'message',
|
||||||
@@ -3918,6 +4153,7 @@ export const AgentScalarFieldEnum = {
|
|||||||
id: 'id',
|
id: 'id',
|
||||||
type: 'type',
|
type: 'type',
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
|
permission: 'permission',
|
||||||
soul: 'soul',
|
soul: 'soul',
|
||||||
providerId: 'providerId',
|
providerId: 'providerId',
|
||||||
modelId: 'modelId',
|
modelId: 'modelId',
|
||||||
@@ -4114,6 +4350,39 @@ export const AuditLogScalarFieldEnum = {
|
|||||||
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaRuleScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
teamId: 'teamId',
|
||||||
|
scopeMode: 'scopeMode',
|
||||||
|
role: 'role',
|
||||||
|
userIds: 'userIds',
|
||||||
|
resource: 'resource',
|
||||||
|
resourceData: 'resourceData',
|
||||||
|
limit: 'limit',
|
||||||
|
period: 'period',
|
||||||
|
enabled: 'enabled',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaRuleScalarFieldEnum = (typeof QuotaRuleScalarFieldEnum)[keyof typeof QuotaRuleScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaRecordScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
ruleId: 'ruleId',
|
||||||
|
teamId: 'teamId',
|
||||||
|
userId: 'userId',
|
||||||
|
periodStart: 'periodStart',
|
||||||
|
periodEnd: 'periodEnd',
|
||||||
|
consumed: 'consumed',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaRecordScalarFieldEnum = (typeof QuotaRecordScalarFieldEnum)[keyof typeof QuotaRecordScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const SortOrder = {
|
export const SortOrder = {
|
||||||
asc: 'asc',
|
asc: 'asc',
|
||||||
desc: 'desc'
|
desc: 'desc'
|
||||||
@@ -4524,6 +4793,48 @@ export type EnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<
|
|||||||
export type ListEnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType[]'>
|
export type ListEnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType[]'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaScopeMode'
|
||||||
|
*/
|
||||||
|
export type EnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaScopeMode[]'
|
||||||
|
*/
|
||||||
|
export type ListEnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode[]'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaResourceType'
|
||||||
|
*/
|
||||||
|
export type EnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaResourceType[]'
|
||||||
|
*/
|
||||||
|
export type ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType[]'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaPeriod'
|
||||||
|
*/
|
||||||
|
export type EnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to a field of type 'QuotaPeriod[]'
|
||||||
|
*/
|
||||||
|
export type ListEnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod[]'>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch Payload for updateMany & deleteMany & createMany
|
* Batch Payload for updateMany & deleteMany & createMany
|
||||||
*/
|
*/
|
||||||
@@ -4652,6 +4963,7 @@ export type GlobalOmitConfig = {
|
|||||||
asset?: Prisma.AssetOmit
|
asset?: Prisma.AssetOmit
|
||||||
storageKey?: Prisma.StorageKeyOmit
|
storageKey?: Prisma.StorageKeyOmit
|
||||||
assetMetadataValue?: Prisma.AssetMetadataValueOmit
|
assetMetadataValue?: Prisma.AssetMetadataValueOmit
|
||||||
|
assetAgentMd?: Prisma.AssetAgentMdOmit
|
||||||
assetComment?: Prisma.AssetCommentOmit
|
assetComment?: Prisma.AssetCommentOmit
|
||||||
assetCommentAttachment?: Prisma.AssetCommentAttachmentOmit
|
assetCommentAttachment?: Prisma.AssetCommentAttachmentOmit
|
||||||
assetEmbedding?: Prisma.AssetEmbeddingOmit
|
assetEmbedding?: Prisma.AssetEmbeddingOmit
|
||||||
@@ -4675,6 +4987,8 @@ export type GlobalOmitConfig = {
|
|||||||
apiToken?: Prisma.ApiTokenOmit
|
apiToken?: Prisma.ApiTokenOmit
|
||||||
aiUsage?: Prisma.AiUsageOmit
|
aiUsage?: Prisma.AiUsageOmit
|
||||||
auditLog?: Prisma.AuditLogOmit
|
auditLog?: Prisma.AuditLogOmit
|
||||||
|
quotaRule?: Prisma.QuotaRuleOmit
|
||||||
|
quotaRecord?: Prisma.QuotaRecordOmit
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Types for Logging */
|
/* Types for Logging */
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const ModelName = {
|
|||||||
Asset: 'Asset',
|
Asset: 'Asset',
|
||||||
StorageKey: 'StorageKey',
|
StorageKey: 'StorageKey',
|
||||||
AssetMetadataValue: 'AssetMetadataValue',
|
AssetMetadataValue: 'AssetMetadataValue',
|
||||||
|
AssetAgentMd: 'AssetAgentMd',
|
||||||
AssetComment: 'AssetComment',
|
AssetComment: 'AssetComment',
|
||||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||||
AssetEmbedding: 'AssetEmbedding',
|
AssetEmbedding: 'AssetEmbedding',
|
||||||
@@ -91,7 +92,9 @@ export const ModelName = {
|
|||||||
Collection: 'Collection',
|
Collection: 'Collection',
|
||||||
ApiToken: 'ApiToken',
|
ApiToken: 'ApiToken',
|
||||||
AiUsage: 'AiUsage',
|
AiUsage: 'AiUsage',
|
||||||
AuditLog: 'AuditLog'
|
AuditLog: 'AuditLog',
|
||||||
|
QuotaRule: 'QuotaRule',
|
||||||
|
QuotaRecord: 'QuotaRecord'
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||||
@@ -373,6 +376,16 @@ export const AssetMetadataValueScalarFieldEnum = {
|
|||||||
export type AssetMetadataValueScalarFieldEnum = (typeof AssetMetadataValueScalarFieldEnum)[keyof typeof AssetMetadataValueScalarFieldEnum]
|
export type AssetMetadataValueScalarFieldEnum = (typeof AssetMetadataValueScalarFieldEnum)[keyof typeof AssetMetadataValueScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const AssetAgentMdScalarFieldEnum = {
|
||||||
|
assetId: 'assetId',
|
||||||
|
content: 'content',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type AssetAgentMdScalarFieldEnum = (typeof AssetAgentMdScalarFieldEnum)[keyof typeof AssetAgentMdScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const AssetCommentScalarFieldEnum = {
|
export const AssetCommentScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
message: 'message',
|
message: 'message',
|
||||||
@@ -511,6 +524,7 @@ export const AgentScalarFieldEnum = {
|
|||||||
id: 'id',
|
id: 'id',
|
||||||
type: 'type',
|
type: 'type',
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
|
permission: 'permission',
|
||||||
soul: 'soul',
|
soul: 'soul',
|
||||||
providerId: 'providerId',
|
providerId: 'providerId',
|
||||||
modelId: 'modelId',
|
modelId: 'modelId',
|
||||||
@@ -707,6 +721,39 @@ export const AuditLogScalarFieldEnum = {
|
|||||||
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaRuleScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
teamId: 'teamId',
|
||||||
|
scopeMode: 'scopeMode',
|
||||||
|
role: 'role',
|
||||||
|
userIds: 'userIds',
|
||||||
|
resource: 'resource',
|
||||||
|
resourceData: 'resourceData',
|
||||||
|
limit: 'limit',
|
||||||
|
period: 'period',
|
||||||
|
enabled: 'enabled',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaRuleScalarFieldEnum = (typeof QuotaRuleScalarFieldEnum)[keyof typeof QuotaRuleScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
|
export const QuotaRecordScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
ruleId: 'ruleId',
|
||||||
|
teamId: 'teamId',
|
||||||
|
userId: 'userId',
|
||||||
|
periodStart: 'periodStart',
|
||||||
|
periodEnd: 'periodEnd',
|
||||||
|
consumed: 'consumed',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type QuotaRecordScalarFieldEnum = (typeof QuotaRecordScalarFieldEnum)[keyof typeof QuotaRecordScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const SortOrder = {
|
export const SortOrder = {
|
||||||
asc: 'asc',
|
asc: 'asc',
|
||||||
desc: 'desc'
|
desc: 'desc'
|
||||||
|
|||||||
+3
@@ -26,6 +26,7 @@ export type * from './models/WatermarkFile.ts'
|
|||||||
export type * from './models/Asset.ts'
|
export type * from './models/Asset.ts'
|
||||||
export type * from './models/StorageKey.ts'
|
export type * from './models/StorageKey.ts'
|
||||||
export type * from './models/AssetMetadataValue.ts'
|
export type * from './models/AssetMetadataValue.ts'
|
||||||
|
export type * from './models/AssetAgentMd.ts'
|
||||||
export type * from './models/AssetComment.ts'
|
export type * from './models/AssetComment.ts'
|
||||||
export type * from './models/AssetCommentAttachment.ts'
|
export type * from './models/AssetCommentAttachment.ts'
|
||||||
export type * from './models/AssetEmbedding.ts'
|
export type * from './models/AssetEmbedding.ts'
|
||||||
@@ -49,4 +50,6 @@ export type * from './models/Collection.ts'
|
|||||||
export type * from './models/ApiToken.ts'
|
export type * from './models/ApiToken.ts'
|
||||||
export type * from './models/AiUsage.ts'
|
export type * from './models/AiUsage.ts'
|
||||||
export type * from './models/AuditLog.ts'
|
export type * from './models/AuditLog.ts'
|
||||||
|
export type * from './models/QuotaRule.ts'
|
||||||
|
export type * from './models/QuotaRecord.ts'
|
||||||
export type * from './commonInputTypes.ts'
|
export type * from './commonInputTypes.ts'
|
||||||
+64
-1
@@ -30,6 +30,7 @@ export type AgentMinAggregateOutputType = {
|
|||||||
id: string | null
|
id: string | null
|
||||||
type: $Enums.AgentType | null
|
type: $Enums.AgentType | null
|
||||||
enabled: boolean | null
|
enabled: boolean | null
|
||||||
|
permission: $Enums.TeamMemberRole | null
|
||||||
soul: string | null
|
soul: string | null
|
||||||
providerId: string | null
|
providerId: string | null
|
||||||
modelId: string | null
|
modelId: string | null
|
||||||
@@ -42,6 +43,7 @@ export type AgentMaxAggregateOutputType = {
|
|||||||
id: string | null
|
id: string | null
|
||||||
type: $Enums.AgentType | null
|
type: $Enums.AgentType | null
|
||||||
enabled: boolean | null
|
enabled: boolean | null
|
||||||
|
permission: $Enums.TeamMemberRole | null
|
||||||
soul: string | null
|
soul: string | null
|
||||||
providerId: string | null
|
providerId: string | null
|
||||||
modelId: string | null
|
modelId: string | null
|
||||||
@@ -54,6 +56,7 @@ export type AgentCountAggregateOutputType = {
|
|||||||
id: number
|
id: number
|
||||||
type: number
|
type: number
|
||||||
enabled: number
|
enabled: number
|
||||||
|
permission: number
|
||||||
soul: number
|
soul: number
|
||||||
providerId: number
|
providerId: number
|
||||||
modelId: number
|
modelId: number
|
||||||
@@ -69,6 +72,7 @@ export type AgentMinAggregateInputType = {
|
|||||||
id?: true
|
id?: true
|
||||||
type?: true
|
type?: true
|
||||||
enabled?: true
|
enabled?: true
|
||||||
|
permission?: true
|
||||||
soul?: true
|
soul?: true
|
||||||
providerId?: true
|
providerId?: true
|
||||||
modelId?: true
|
modelId?: true
|
||||||
@@ -81,6 +85,7 @@ export type AgentMaxAggregateInputType = {
|
|||||||
id?: true
|
id?: true
|
||||||
type?: true
|
type?: true
|
||||||
enabled?: true
|
enabled?: true
|
||||||
|
permission?: true
|
||||||
soul?: true
|
soul?: true
|
||||||
providerId?: true
|
providerId?: true
|
||||||
modelId?: true
|
modelId?: true
|
||||||
@@ -93,6 +98,7 @@ export type AgentCountAggregateInputType = {
|
|||||||
id?: true
|
id?: true
|
||||||
type?: true
|
type?: true
|
||||||
enabled?: true
|
enabled?: true
|
||||||
|
permission?: true
|
||||||
soul?: true
|
soul?: true
|
||||||
providerId?: true
|
providerId?: true
|
||||||
modelId?: true
|
modelId?: true
|
||||||
@@ -179,6 +185,7 @@ export type AgentGroupByOutputType = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
|
permission: $Enums.TeamMemberRole
|
||||||
soul: string | null
|
soul: string | null
|
||||||
providerId: string | null
|
providerId: string | null
|
||||||
modelId: string | null
|
modelId: string | null
|
||||||
@@ -213,6 +220,7 @@ export type AgentWhereInput = {
|
|||||||
id?: Prisma.StringFilter<"Agent"> | string
|
id?: Prisma.StringFilter<"Agent"> | string
|
||||||
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFilter<"Agent"> | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
@@ -233,6 +241,7 @@ export type AgentOrderByWithRelationInput = {
|
|||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
type?: Prisma.SortOrder
|
type?: Prisma.SortOrder
|
||||||
enabled?: Prisma.SortOrder
|
enabled?: Prisma.SortOrder
|
||||||
|
permission?: Prisma.SortOrder
|
||||||
soul?: Prisma.SortOrderInput | Prisma.SortOrder
|
soul?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
providerId?: Prisma.SortOrderInput | Prisma.SortOrder
|
providerId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
modelId?: Prisma.SortOrderInput | Prisma.SortOrder
|
modelId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -256,6 +265,7 @@ export type AgentWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
NOT?: Prisma.AgentWhereInput | Prisma.AgentWhereInput[]
|
NOT?: Prisma.AgentWhereInput | Prisma.AgentWhereInput[]
|
||||||
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFilter<"Agent"> | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
@@ -276,6 +286,7 @@ export type AgentOrderByWithAggregationInput = {
|
|||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
type?: Prisma.SortOrder
|
type?: Prisma.SortOrder
|
||||||
enabled?: Prisma.SortOrder
|
enabled?: Prisma.SortOrder
|
||||||
|
permission?: Prisma.SortOrder
|
||||||
soul?: Prisma.SortOrderInput | Prisma.SortOrder
|
soul?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
providerId?: Prisma.SortOrderInput | Prisma.SortOrder
|
providerId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
modelId?: Prisma.SortOrderInput | Prisma.SortOrder
|
modelId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -295,6 +306,7 @@ export type AgentScalarWhereWithAggregatesInput = {
|
|||||||
id?: Prisma.StringWithAggregatesFilter<"Agent"> | string
|
id?: Prisma.StringWithAggregatesFilter<"Agent"> | string
|
||||||
type?: Prisma.EnumAgentTypeWithAggregatesFilter<"Agent"> | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeWithAggregatesFilter<"Agent"> | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolWithAggregatesFilter<"Agent"> | boolean
|
enabled?: Prisma.BoolWithAggregatesFilter<"Agent"> | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleWithAggregatesFilter<"Agent"> | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
soul?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
||||||
providerId?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
providerId?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
||||||
modelId?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
modelId?: Prisma.StringNullableWithAggregatesFilter<"Agent"> | string | null
|
||||||
@@ -307,6 +319,7 @@ export type AgentScalarWhereWithAggregatesInput = {
|
|||||||
export type AgentCreateInput = {
|
export type AgentCreateInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -324,6 +337,7 @@ export type AgentUncheckedCreateInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -339,6 +353,7 @@ export type AgentUncheckedCreateInput = {
|
|||||||
export type AgentUpdateInput = {
|
export type AgentUpdateInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -356,6 +371,7 @@ export type AgentUncheckedUpdateInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -372,6 +388,7 @@ export type AgentCreateManyInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -384,6 +401,7 @@ export type AgentCreateManyInput = {
|
|||||||
export type AgentUpdateManyMutationInput = {
|
export type AgentUpdateManyMutationInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -394,6 +412,7 @@ export type AgentUncheckedUpdateManyInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -422,6 +441,7 @@ export type AgentCountOrderByAggregateInput = {
|
|||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
type?: Prisma.SortOrder
|
type?: Prisma.SortOrder
|
||||||
enabled?: Prisma.SortOrder
|
enabled?: Prisma.SortOrder
|
||||||
|
permission?: Prisma.SortOrder
|
||||||
soul?: Prisma.SortOrder
|
soul?: Prisma.SortOrder
|
||||||
providerId?: Prisma.SortOrder
|
providerId?: Prisma.SortOrder
|
||||||
modelId?: Prisma.SortOrder
|
modelId?: Prisma.SortOrder
|
||||||
@@ -435,6 +455,7 @@ export type AgentMaxOrderByAggregateInput = {
|
|||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
type?: Prisma.SortOrder
|
type?: Prisma.SortOrder
|
||||||
enabled?: Prisma.SortOrder
|
enabled?: Prisma.SortOrder
|
||||||
|
permission?: Prisma.SortOrder
|
||||||
soul?: Prisma.SortOrder
|
soul?: Prisma.SortOrder
|
||||||
providerId?: Prisma.SortOrder
|
providerId?: Prisma.SortOrder
|
||||||
modelId?: Prisma.SortOrder
|
modelId?: Prisma.SortOrder
|
||||||
@@ -447,6 +468,7 @@ export type AgentMinOrderByAggregateInput = {
|
|||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
type?: Prisma.SortOrder
|
type?: Prisma.SortOrder
|
||||||
enabled?: Prisma.SortOrder
|
enabled?: Prisma.SortOrder
|
||||||
|
permission?: Prisma.SortOrder
|
||||||
soul?: Prisma.SortOrder
|
soul?: Prisma.SortOrder
|
||||||
providerId?: Prisma.SortOrder
|
providerId?: Prisma.SortOrder
|
||||||
modelId?: Prisma.SortOrder
|
modelId?: Prisma.SortOrder
|
||||||
@@ -667,6 +689,7 @@ export type AgentUncheckedUpdateManyWithoutProviderNestedInput = {
|
|||||||
export type AgentCreateWithoutUserInput = {
|
export type AgentCreateWithoutUserInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -682,6 +705,7 @@ export type AgentCreateWithoutUserInput = {
|
|||||||
export type AgentUncheckedCreateWithoutUserInput = {
|
export type AgentUncheckedCreateWithoutUserInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -713,6 +737,7 @@ export type AgentUpdateToOneWithWhereWithoutUserInput = {
|
|||||||
export type AgentUpdateWithoutUserInput = {
|
export type AgentUpdateWithoutUserInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -728,6 +753,7 @@ export type AgentUpdateWithoutUserInput = {
|
|||||||
export type AgentUncheckedUpdateWithoutUserInput = {
|
export type AgentUncheckedUpdateWithoutUserInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -743,6 +769,7 @@ export type AgentUncheckedUpdateWithoutUserInput = {
|
|||||||
export type AgentCreateWithoutTeamInput = {
|
export type AgentCreateWithoutTeamInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -759,6 +786,7 @@ export type AgentUncheckedCreateWithoutTeamInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -803,6 +831,7 @@ export type AgentScalarWhereInput = {
|
|||||||
id?: Prisma.StringFilter<"Agent"> | string
|
id?: Prisma.StringFilter<"Agent"> | string
|
||||||
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFilter<"Agent"> | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
enabled?: Prisma.BoolFilter<"Agent"> | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFilter<"Agent"> | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
soul?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
providerId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
modelId?: Prisma.StringNullableFilter<"Agent"> | string | null
|
||||||
@@ -815,6 +844,7 @@ export type AgentScalarWhereInput = {
|
|||||||
export type AgentCreateWithoutSkillsInput = {
|
export type AgentCreateWithoutSkillsInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -831,6 +861,7 @@ export type AgentUncheckedCreateWithoutSkillsInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -861,6 +892,7 @@ export type AgentUpdateToOneWithWhereWithoutSkillsInput = {
|
|||||||
export type AgentUpdateWithoutSkillsInput = {
|
export type AgentUpdateWithoutSkillsInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -877,6 +909,7 @@ export type AgentUncheckedUpdateWithoutSkillsInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -891,6 +924,7 @@ export type AgentUncheckedUpdateWithoutSkillsInput = {
|
|||||||
export type AgentCreateWithoutMcpServersInput = {
|
export type AgentCreateWithoutMcpServersInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -907,6 +941,7 @@ export type AgentUncheckedCreateWithoutMcpServersInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -937,6 +972,7 @@ export type AgentUpdateToOneWithWhereWithoutMcpServersInput = {
|
|||||||
export type AgentUpdateWithoutMcpServersInput = {
|
export type AgentUpdateWithoutMcpServersInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -953,6 +989,7 @@ export type AgentUncheckedUpdateWithoutMcpServersInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -967,6 +1004,7 @@ export type AgentUncheckedUpdateWithoutMcpServersInput = {
|
|||||||
export type AgentCreateWithoutAgentSessionsInput = {
|
export type AgentCreateWithoutAgentSessionsInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -983,6 +1021,7 @@ export type AgentUncheckedCreateWithoutAgentSessionsInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -1013,6 +1052,7 @@ export type AgentUpdateToOneWithWhereWithoutAgentSessionsInput = {
|
|||||||
export type AgentUpdateWithoutAgentSessionsInput = {
|
export type AgentUpdateWithoutAgentSessionsInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -1029,6 +1069,7 @@ export type AgentUncheckedUpdateWithoutAgentSessionsInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1043,6 +1084,7 @@ export type AgentUncheckedUpdateWithoutAgentSessionsInput = {
|
|||||||
export type AgentCreateWithoutModelRefInput = {
|
export type AgentCreateWithoutModelRefInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -1059,6 +1101,7 @@ export type AgentUncheckedCreateWithoutModelRefInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
teamId: string
|
teamId: string
|
||||||
@@ -1099,6 +1142,7 @@ export type AgentUpdateManyWithWhereWithoutModelRefInput = {
|
|||||||
export type AgentCreateWithoutProviderInput = {
|
export type AgentCreateWithoutProviderInput = {
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
config:PrismaJson.AgentConfig
|
config:PrismaJson.AgentConfig
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -1115,6 +1159,7 @@ export type AgentUncheckedCreateWithoutProviderInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
teamId: string
|
teamId: string
|
||||||
@@ -1156,6 +1201,7 @@ export type AgentCreateManyTeamInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
@@ -1167,6 +1213,7 @@ export type AgentCreateManyTeamInput = {
|
|||||||
export type AgentUpdateWithoutTeamInput = {
|
export type AgentUpdateWithoutTeamInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -1183,6 +1230,7 @@ export type AgentUncheckedUpdateWithoutTeamInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1198,6 +1246,7 @@ export type AgentUncheckedUpdateManyWithoutTeamInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1210,6 +1259,7 @@ export type AgentCreateManyModelRefInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
providerId?: string | null
|
providerId?: string | null
|
||||||
teamId: string
|
teamId: string
|
||||||
@@ -1221,6 +1271,7 @@ export type AgentCreateManyModelRefInput = {
|
|||||||
export type AgentUpdateWithoutModelRefInput = {
|
export type AgentUpdateWithoutModelRefInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -1237,6 +1288,7 @@ export type AgentUncheckedUpdateWithoutModelRefInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
@@ -1252,6 +1304,7 @@ export type AgentUncheckedUpdateManyWithoutModelRefInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
providerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
@@ -1264,6 +1317,7 @@ export type AgentCreateManyProviderInput = {
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: $Enums.TeamMemberRole
|
||||||
soul?: string | null
|
soul?: string | null
|
||||||
modelId?: string | null
|
modelId?: string | null
|
||||||
teamId: string
|
teamId: string
|
||||||
@@ -1275,6 +1329,7 @@ export type AgentCreateManyProviderInput = {
|
|||||||
export type AgentUpdateWithoutProviderInput = {
|
export type AgentUpdateWithoutProviderInput = {
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
config?:PrismaJson.AgentConfig
|
config?:PrismaJson.AgentConfig
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -1291,6 +1346,7 @@ export type AgentUncheckedUpdateWithoutProviderInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
@@ -1306,6 +1362,7 @@ export type AgentUncheckedUpdateManyWithoutProviderInput = {
|
|||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
type?: Prisma.EnumAgentTypeFieldUpdateOperationsInput | $Enums.AgentType
|
||||||
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
enabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
permission?: Prisma.EnumTeamMemberRoleFieldUpdateOperationsInput | $Enums.TeamMemberRole
|
||||||
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
soul?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
modelId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
@@ -1367,6 +1424,7 @@ export type AgentSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
id?: boolean
|
id?: boolean
|
||||||
type?: boolean
|
type?: boolean
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: boolean
|
||||||
soul?: boolean
|
soul?: boolean
|
||||||
providerId?: boolean
|
providerId?: boolean
|
||||||
modelId?: boolean
|
modelId?: boolean
|
||||||
@@ -1388,6 +1446,7 @@ export type AgentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
|||||||
id?: boolean
|
id?: boolean
|
||||||
type?: boolean
|
type?: boolean
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: boolean
|
||||||
soul?: boolean
|
soul?: boolean
|
||||||
providerId?: boolean
|
providerId?: boolean
|
||||||
modelId?: boolean
|
modelId?: boolean
|
||||||
@@ -1405,6 +1464,7 @@ export type AgentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
|||||||
id?: boolean
|
id?: boolean
|
||||||
type?: boolean
|
type?: boolean
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: boolean
|
||||||
soul?: boolean
|
soul?: boolean
|
||||||
providerId?: boolean
|
providerId?: boolean
|
||||||
modelId?: boolean
|
modelId?: boolean
|
||||||
@@ -1422,6 +1482,7 @@ export type AgentSelectScalar = {
|
|||||||
id?: boolean
|
id?: boolean
|
||||||
type?: boolean
|
type?: boolean
|
||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
|
permission?: boolean
|
||||||
soul?: boolean
|
soul?: boolean
|
||||||
providerId?: boolean
|
providerId?: boolean
|
||||||
modelId?: boolean
|
modelId?: boolean
|
||||||
@@ -1431,7 +1492,7 @@ export type AgentSelectScalar = {
|
|||||||
updatedAt?: boolean
|
updatedAt?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AgentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "type" | "enabled" | "soul" | "providerId" | "modelId" | "teamId" | "config" | "createdAt" | "updatedAt", ExtArgs["result"]["agent"]>
|
export type AgentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "type" | "enabled" | "permission" | "soul" | "providerId" | "modelId" | "teamId" | "config" | "createdAt" | "updatedAt", ExtArgs["result"]["agent"]>
|
||||||
export type AgentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type AgentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
|
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
|
||||||
provider?: boolean | Prisma.Agent$providerArgs<ExtArgs>
|
provider?: boolean | Prisma.Agent$providerArgs<ExtArgs>
|
||||||
@@ -1470,6 +1531,7 @@ export type $AgentPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
|||||||
id: string
|
id: string
|
||||||
type: $Enums.AgentType
|
type: $Enums.AgentType
|
||||||
enabled: boolean
|
enabled: boolean
|
||||||
|
permission: $Enums.TeamMemberRole
|
||||||
soul: string | null
|
soul: string | null
|
||||||
providerId: string | null
|
providerId: string | null
|
||||||
modelId: string | null
|
modelId: string | null
|
||||||
@@ -1913,6 +1975,7 @@ export interface AgentFieldRefs {
|
|||||||
readonly id: Prisma.FieldRef<"Agent", 'String'>
|
readonly id: Prisma.FieldRef<"Agent", 'String'>
|
||||||
readonly type: Prisma.FieldRef<"Agent", 'AgentType'>
|
readonly type: Prisma.FieldRef<"Agent", 'AgentType'>
|
||||||
readonly enabled: Prisma.FieldRef<"Agent", 'Boolean'>
|
readonly enabled: Prisma.FieldRef<"Agent", 'Boolean'>
|
||||||
|
readonly permission: Prisma.FieldRef<"Agent", 'TeamMemberRole'>
|
||||||
readonly soul: Prisma.FieldRef<"Agent", 'String'>
|
readonly soul: Prisma.FieldRef<"Agent", 'String'>
|
||||||
readonly providerId: Prisma.FieldRef<"Agent", 'String'>
|
readonly providerId: Prisma.FieldRef<"Agent", 'String'>
|
||||||
readonly modelId: Prisma.FieldRef<"Agent", 'String'>
|
readonly modelId: Prisma.FieldRef<"Agent", 'String'>
|
||||||
|
|||||||
+284
@@ -361,6 +361,7 @@ export type AssetWhereInput = {
|
|||||||
shareLinkRootFolder?: Prisma.XOR<Prisma.ShareLinkNullableScalarRelationFilter, Prisma.ShareLinkWhereInput> | null
|
shareLinkRootFolder?: Prisma.XOR<Prisma.ShareLinkNullableScalarRelationFilter, Prisma.ShareLinkWhereInput> | null
|
||||||
agentSessions?: Prisma.AgentSessionListRelationFilter
|
agentSessions?: Prisma.AgentSessionListRelationFilter
|
||||||
watermarkFiles?: Prisma.WatermarkFileListRelationFilter
|
watermarkFiles?: Prisma.WatermarkFileListRelationFilter
|
||||||
|
agentMd?: Prisma.XOR<Prisma.AssetAgentMdNullableScalarRelationFilter, Prisma.AssetAgentMdWhereInput> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetOrderByWithRelationInput = {
|
export type AssetOrderByWithRelationInput = {
|
||||||
@@ -404,6 +405,7 @@ export type AssetOrderByWithRelationInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkOrderByWithRelationInput
|
shareLinkRootFolder?: Prisma.ShareLinkOrderByWithRelationInput
|
||||||
agentSessions?: Prisma.AgentSessionOrderByRelationAggregateInput
|
agentSessions?: Prisma.AgentSessionOrderByRelationAggregateInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileOrderByRelationAggregateInput
|
watermarkFiles?: Prisma.WatermarkFileOrderByRelationAggregateInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdOrderByWithRelationInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetWhereUniqueInput = Prisma.AtLeast<{
|
export type AssetWhereUniqueInput = Prisma.AtLeast<{
|
||||||
@@ -451,6 +453,7 @@ export type AssetWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
shareLinkRootFolder?: Prisma.XOR<Prisma.ShareLinkNullableScalarRelationFilter, Prisma.ShareLinkWhereInput> | null
|
shareLinkRootFolder?: Prisma.XOR<Prisma.ShareLinkNullableScalarRelationFilter, Prisma.ShareLinkWhereInput> | null
|
||||||
agentSessions?: Prisma.AgentSessionListRelationFilter
|
agentSessions?: Prisma.AgentSessionListRelationFilter
|
||||||
watermarkFiles?: Prisma.WatermarkFileListRelationFilter
|
watermarkFiles?: Prisma.WatermarkFileListRelationFilter
|
||||||
|
agentMd?: Prisma.XOR<Prisma.AssetAgentMdNullableScalarRelationFilter, Prisma.AssetAgentMdWhereInput> | null
|
||||||
}, "id" | "parentIdTargetId">
|
}, "id" | "parentIdTargetId">
|
||||||
|
|
||||||
export type AssetOrderByWithAggregationInput = {
|
export type AssetOrderByWithAggregationInput = {
|
||||||
@@ -544,6 +547,7 @@ export type AssetCreateInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateInput = {
|
export type AssetUncheckedCreateInput = {
|
||||||
@@ -581,6 +585,7 @@ export type AssetUncheckedCreateInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUpdateInput = {
|
export type AssetUpdateInput = {
|
||||||
@@ -618,6 +623,7 @@ export type AssetUpdateInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateInput = {
|
export type AssetUncheckedUpdateInput = {
|
||||||
@@ -655,6 +661,7 @@ export type AssetUncheckedUpdateInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateManyInput = {
|
export type AssetCreateManyInput = {
|
||||||
@@ -1191,6 +1198,20 @@ export type AssetUpdateOneRequiredWithoutMetadataValuesNestedInput = {
|
|||||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetUpdateToOneWithWhereWithoutMetadataValuesInput, Prisma.AssetUpdateWithoutMetadataValuesInput>, Prisma.AssetUncheckedUpdateWithoutMetadataValuesInput>
|
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetUpdateToOneWithWhereWithoutMetadataValuesInput, Prisma.AssetUpdateWithoutMetadataValuesInput>, Prisma.AssetUncheckedUpdateWithoutMetadataValuesInput>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AssetCreateNestedOneWithoutAgentMdInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.AssetCreateWithoutAgentMdInput, Prisma.AssetUncheckedCreateWithoutAgentMdInput>
|
||||||
|
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutAgentMdInput
|
||||||
|
connect?: Prisma.AssetWhereUniqueInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUpdateOneRequiredWithoutAgentMdNestedInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.AssetCreateWithoutAgentMdInput, Prisma.AssetUncheckedCreateWithoutAgentMdInput>
|
||||||
|
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutAgentMdInput
|
||||||
|
upsert?: Prisma.AssetUpsertWithoutAgentMdInput
|
||||||
|
connect?: Prisma.AssetWhereUniqueInput
|
||||||
|
update?: Prisma.XOR<Prisma.XOR<Prisma.AssetUpdateToOneWithWhereWithoutAgentMdInput, Prisma.AssetUpdateWithoutAgentMdInput>, Prisma.AssetUncheckedUpdateWithoutAgentMdInput>
|
||||||
|
}
|
||||||
|
|
||||||
export type AssetCreateNestedOneWithoutCommentsInput = {
|
export type AssetCreateNestedOneWithoutCommentsInput = {
|
||||||
create?: Prisma.XOR<Prisma.AssetCreateWithoutCommentsInput, Prisma.AssetUncheckedCreateWithoutCommentsInput>
|
create?: Prisma.XOR<Prisma.AssetCreateWithoutCommentsInput, Prisma.AssetUncheckedCreateWithoutCommentsInput>
|
||||||
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutCommentsInput
|
connectOrCreate?: Prisma.AssetCreateOrConnectWithoutCommentsInput
|
||||||
@@ -1341,6 +1362,7 @@ export type AssetCreateWithoutCreatorInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutCreatorInput = {
|
export type AssetUncheckedCreateWithoutCreatorInput = {
|
||||||
@@ -1377,6 +1399,7 @@ export type AssetUncheckedCreateWithoutCreatorInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutCreatorInput = {
|
export type AssetCreateOrConnectWithoutCreatorInput = {
|
||||||
@@ -1466,6 +1489,7 @@ export type AssetCreateWithoutTeamRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
||||||
@@ -1502,6 +1526,7 @@ export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutTeamRootFolderInput = {
|
export type AssetCreateOrConnectWithoutTeamRootFolderInput = {
|
||||||
@@ -1554,6 +1579,7 @@ export type AssetUpdateWithoutTeamRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
||||||
@@ -1590,6 +1616,7 @@ export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutProjectRootFolderInput = {
|
export type AssetCreateWithoutProjectRootFolderInput = {
|
||||||
@@ -1626,6 +1653,7 @@ export type AssetCreateWithoutProjectRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
||||||
@@ -1662,6 +1690,7 @@ export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutProjectRootFolderInput = {
|
export type AssetCreateOrConnectWithoutProjectRootFolderInput = {
|
||||||
@@ -1703,6 +1732,7 @@ export type AssetCreateWithoutProjectShareRootInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
||||||
@@ -1739,6 +1769,7 @@ export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutProjectShareRootInput = {
|
export type AssetCreateOrConnectWithoutProjectShareRootInput = {
|
||||||
@@ -1780,6 +1811,7 @@ export type AssetCreateWithoutProjectInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutProjectInput = {
|
export type AssetUncheckedCreateWithoutProjectInput = {
|
||||||
@@ -1816,6 +1848,7 @@ export type AssetUncheckedCreateWithoutProjectInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutProjectInput = {
|
export type AssetCreateOrConnectWithoutProjectInput = {
|
||||||
@@ -1873,6 +1906,7 @@ export type AssetUpdateWithoutProjectRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
||||||
@@ -1909,6 +1943,7 @@ export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUpsertWithoutProjectShareRootInput = {
|
export type AssetUpsertWithoutProjectShareRootInput = {
|
||||||
@@ -1956,6 +1991,7 @@ export type AssetUpdateWithoutProjectShareRootInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
||||||
@@ -1992,6 +2028,7 @@ export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUpsertWithWhereUniqueWithoutProjectInput = {
|
export type AssetUpsertWithWhereUniqueWithoutProjectInput = {
|
||||||
@@ -2044,6 +2081,7 @@ export type AssetCreateWithoutShareLinkRootFolderInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
||||||
@@ -2080,6 +2118,7 @@ export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutShareLinkRootFolderInput = {
|
export type AssetCreateOrConnectWithoutShareLinkRootFolderInput = {
|
||||||
@@ -2132,6 +2171,7 @@ export type AssetUpdateWithoutShareLinkRootFolderInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
||||||
@@ -2168,6 +2208,7 @@ export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutWatermarkFilesInput = {
|
export type AssetCreateWithoutWatermarkFilesInput = {
|
||||||
@@ -2204,6 +2245,7 @@ export type AssetCreateWithoutWatermarkFilesInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutWatermarkFilesInput = {
|
export type AssetUncheckedCreateWithoutWatermarkFilesInput = {
|
||||||
@@ -2240,6 +2282,7 @@ export type AssetUncheckedCreateWithoutWatermarkFilesInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutWatermarkFilesInput = {
|
export type AssetCreateOrConnectWithoutWatermarkFilesInput = {
|
||||||
@@ -2292,6 +2335,7 @@ export type AssetUpdateWithoutWatermarkFilesInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutWatermarkFilesInput = {
|
export type AssetUncheckedUpdateWithoutWatermarkFilesInput = {
|
||||||
@@ -2328,6 +2372,7 @@ export type AssetUncheckedUpdateWithoutWatermarkFilesInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutChildrenInput = {
|
export type AssetCreateWithoutChildrenInput = {
|
||||||
@@ -2364,6 +2409,7 @@ export type AssetCreateWithoutChildrenInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutChildrenInput = {
|
export type AssetUncheckedCreateWithoutChildrenInput = {
|
||||||
@@ -2400,6 +2446,7 @@ export type AssetUncheckedCreateWithoutChildrenInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutChildrenInput = {
|
export type AssetCreateOrConnectWithoutChildrenInput = {
|
||||||
@@ -2441,6 +2488,7 @@ export type AssetCreateWithoutParentInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutParentInput = {
|
export type AssetUncheckedCreateWithoutParentInput = {
|
||||||
@@ -2477,6 +2525,7 @@ export type AssetUncheckedCreateWithoutParentInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutParentInput = {
|
export type AssetCreateOrConnectWithoutParentInput = {
|
||||||
@@ -2523,6 +2572,7 @@ export type AssetCreateWithoutSymlinksInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutSymlinksInput = {
|
export type AssetUncheckedCreateWithoutSymlinksInput = {
|
||||||
@@ -2559,6 +2609,7 @@ export type AssetUncheckedCreateWithoutSymlinksInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutSymlinksInput = {
|
export type AssetCreateOrConnectWithoutSymlinksInput = {
|
||||||
@@ -2600,6 +2651,7 @@ export type AssetCreateWithoutTargetInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutTargetInput = {
|
export type AssetUncheckedCreateWithoutTargetInput = {
|
||||||
@@ -2636,6 +2688,7 @@ export type AssetUncheckedCreateWithoutTargetInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutTargetInput = {
|
export type AssetCreateOrConnectWithoutTargetInput = {
|
||||||
@@ -2693,6 +2746,7 @@ export type AssetUpdateWithoutChildrenInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutChildrenInput = {
|
export type AssetUncheckedUpdateWithoutChildrenInput = {
|
||||||
@@ -2729,6 +2783,7 @@ export type AssetUncheckedUpdateWithoutChildrenInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUpsertWithWhereUniqueWithoutParentInput = {
|
export type AssetUpsertWithWhereUniqueWithoutParentInput = {
|
||||||
@@ -2792,6 +2847,7 @@ export type AssetUpdateWithoutSymlinksInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
||||||
@@ -2828,6 +2884,7 @@ export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUpsertWithWhereUniqueWithoutTargetInput = {
|
export type AssetUpsertWithWhereUniqueWithoutTargetInput = {
|
||||||
@@ -2880,6 +2937,7 @@ export type AssetCreateWithoutStorageKeyInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
||||||
@@ -2916,6 +2974,7 @@ export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutStorageKeyInput = {
|
export type AssetCreateOrConnectWithoutStorageKeyInput = {
|
||||||
@@ -2978,6 +3037,7 @@ export type AssetCreateWithoutMetadataValuesInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
||||||
@@ -3014,6 +3074,7 @@ export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutMetadataValuesInput = {
|
export type AssetCreateOrConnectWithoutMetadataValuesInput = {
|
||||||
@@ -3066,6 +3127,7 @@ export type AssetUpdateWithoutMetadataValuesInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
||||||
@@ -3102,6 +3164,171 @@ export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetCreateWithoutAgentMdInput = {
|
||||||
|
id?: string
|
||||||
|
name?: string
|
||||||
|
nameNgram?: Prisma.AssetCreatenameNgramInput | string[]
|
||||||
|
type: $Enums.AssetType
|
||||||
|
mediaType?: string | null
|
||||||
|
fileCount?: number
|
||||||
|
sizeByte?: bigint | number
|
||||||
|
status: $Enums.AssetStatus
|
||||||
|
transcodeTaskId?: string | null
|
||||||
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
|
isDeleted?: boolean
|
||||||
|
deletedAt?: Date | string | null
|
||||||
|
sortIndex?: string | null
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
parent?: Prisma.AssetCreateNestedOneWithoutChildrenInput
|
||||||
|
children?: Prisma.AssetCreateNestedManyWithoutParentInput
|
||||||
|
target?: Prisma.AssetCreateNestedOneWithoutSymlinksInput
|
||||||
|
symlinks?: Prisma.AssetCreateNestedManyWithoutTargetInput
|
||||||
|
storageKey?: Prisma.StorageKeyCreateNestedOneWithoutAssetsInput
|
||||||
|
metadataValues?: Prisma.AssetMetadataValueCreateNestedManyWithoutAssetInput
|
||||||
|
creator?: Prisma.UserCreateNestedOneWithoutAssetsInput
|
||||||
|
task?: Prisma.TaskCreateNestedOneWithoutAssetsInput
|
||||||
|
project?: Prisma.ProjectCreateNestedOneWithoutAssetsInput
|
||||||
|
comments?: Prisma.AssetCommentCreateNestedManyWithoutAssetInput
|
||||||
|
commentAttachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutAssetInput
|
||||||
|
notifications?: Prisma.NotificationCreateNestedManyWithoutAssetInput
|
||||||
|
embeddings?: Prisma.AssetEmbeddingCreateNestedManyWithoutAssetInput
|
||||||
|
teamRootFolder?: Prisma.TeamCreateNestedOneWithoutRootFolderInput
|
||||||
|
projectRootFolder?: Prisma.ProjectCreateNestedOneWithoutRootFolderInput
|
||||||
|
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||||
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUncheckedCreateWithoutAgentMdInput = {
|
||||||
|
id?: string
|
||||||
|
name?: string
|
||||||
|
nameNgram?: Prisma.AssetCreatenameNgramInput | string[]
|
||||||
|
type: $Enums.AssetType
|
||||||
|
mediaType?: string | null
|
||||||
|
fileCount?: number
|
||||||
|
sizeByte?: bigint | number
|
||||||
|
status: $Enums.AssetStatus
|
||||||
|
transcodeTaskId?: string | null
|
||||||
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
|
isDeleted?: boolean
|
||||||
|
deletedAt?: Date | string | null
|
||||||
|
sortIndex?: string | null
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
parentId?: string | null
|
||||||
|
targetId?: string | null
|
||||||
|
storageKeyId?: string | null
|
||||||
|
creatorId?: string | null
|
||||||
|
taskId?: string | null
|
||||||
|
projectId?: string | null
|
||||||
|
children?: Prisma.AssetUncheckedCreateNestedManyWithoutParentInput
|
||||||
|
symlinks?: Prisma.AssetUncheckedCreateNestedManyWithoutTargetInput
|
||||||
|
metadataValues?: Prisma.AssetMetadataValueUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
commentAttachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
embeddings?: Prisma.AssetEmbeddingUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
teamRootFolder?: Prisma.TeamUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
|
projectRootFolder?: Prisma.ProjectUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
|
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||||
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetCreateOrConnectWithoutAgentMdInput = {
|
||||||
|
where: Prisma.AssetWhereUniqueInput
|
||||||
|
create: Prisma.XOR<Prisma.AssetCreateWithoutAgentMdInput, Prisma.AssetUncheckedCreateWithoutAgentMdInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUpsertWithoutAgentMdInput = {
|
||||||
|
update: Prisma.XOR<Prisma.AssetUpdateWithoutAgentMdInput, Prisma.AssetUncheckedUpdateWithoutAgentMdInput>
|
||||||
|
create: Prisma.XOR<Prisma.AssetCreateWithoutAgentMdInput, Prisma.AssetUncheckedCreateWithoutAgentMdInput>
|
||||||
|
where?: Prisma.AssetWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUpdateToOneWithWhereWithoutAgentMdInput = {
|
||||||
|
where?: Prisma.AssetWhereInput
|
||||||
|
data: Prisma.XOR<Prisma.AssetUpdateWithoutAgentMdInput, Prisma.AssetUncheckedUpdateWithoutAgentMdInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUpdateWithoutAgentMdInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
nameNgram?: Prisma.AssetUpdatenameNgramInput | string[]
|
||||||
|
type?: Prisma.EnumAssetTypeFieldUpdateOperationsInput | $Enums.AssetType
|
||||||
|
mediaType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
fileCount?: Prisma.IntFieldUpdateOperationsInput | number
|
||||||
|
sizeByte?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
|
||||||
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
parent?: Prisma.AssetUpdateOneWithoutChildrenNestedInput
|
||||||
|
children?: Prisma.AssetUpdateManyWithoutParentNestedInput
|
||||||
|
target?: Prisma.AssetUpdateOneWithoutSymlinksNestedInput
|
||||||
|
symlinks?: Prisma.AssetUpdateManyWithoutTargetNestedInput
|
||||||
|
storageKey?: Prisma.StorageKeyUpdateOneWithoutAssetsNestedInput
|
||||||
|
metadataValues?: Prisma.AssetMetadataValueUpdateManyWithoutAssetNestedInput
|
||||||
|
creator?: Prisma.UserUpdateOneWithoutAssetsNestedInput
|
||||||
|
task?: Prisma.TaskUpdateOneWithoutAssetsNestedInput
|
||||||
|
project?: Prisma.ProjectUpdateOneWithoutAssetsNestedInput
|
||||||
|
comments?: Prisma.AssetCommentUpdateManyWithoutAssetNestedInput
|
||||||
|
commentAttachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutAssetNestedInput
|
||||||
|
notifications?: Prisma.NotificationUpdateManyWithoutAssetNestedInput
|
||||||
|
embeddings?: Prisma.AssetEmbeddingUpdateManyWithoutAssetNestedInput
|
||||||
|
teamRootFolder?: Prisma.TeamUpdateOneWithoutRootFolderNestedInput
|
||||||
|
projectRootFolder?: Prisma.ProjectUpdateOneWithoutRootFolderNestedInput
|
||||||
|
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||||
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AssetUncheckedUpdateWithoutAgentMdInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
nameNgram?: Prisma.AssetUpdatenameNgramInput | string[]
|
||||||
|
type?: Prisma.EnumAssetTypeFieldUpdateOperationsInput | $Enums.AssetType
|
||||||
|
mediaType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
fileCount?: Prisma.IntFieldUpdateOperationsInput | number
|
||||||
|
sizeByte?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
|
||||||
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
parentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
targetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
storageKeyId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
taskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
children?: Prisma.AssetUncheckedUpdateManyWithoutParentNestedInput
|
||||||
|
symlinks?: Prisma.AssetUncheckedUpdateManyWithoutTargetNestedInput
|
||||||
|
metadataValues?: Prisma.AssetMetadataValueUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
commentAttachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
embeddings?: Prisma.AssetEmbeddingUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
teamRootFolder?: Prisma.TeamUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
|
projectRootFolder?: Prisma.ProjectUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
|
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||||
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutCommentsInput = {
|
export type AssetCreateWithoutCommentsInput = {
|
||||||
@@ -3138,6 +3365,7 @@ export type AssetCreateWithoutCommentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutCommentsInput = {
|
export type AssetUncheckedCreateWithoutCommentsInput = {
|
||||||
@@ -3174,6 +3402,7 @@ export type AssetUncheckedCreateWithoutCommentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutCommentsInput = {
|
export type AssetCreateOrConnectWithoutCommentsInput = {
|
||||||
@@ -3226,6 +3455,7 @@ export type AssetUpdateWithoutCommentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutCommentsInput = {
|
export type AssetUncheckedUpdateWithoutCommentsInput = {
|
||||||
@@ -3262,6 +3492,7 @@ export type AssetUncheckedUpdateWithoutCommentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutCommentAttachmentsInput = {
|
export type AssetCreateWithoutCommentAttachmentsInput = {
|
||||||
@@ -3298,6 +3529,7 @@ export type AssetCreateWithoutCommentAttachmentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
||||||
@@ -3334,6 +3566,7 @@ export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutCommentAttachmentsInput = {
|
export type AssetCreateOrConnectWithoutCommentAttachmentsInput = {
|
||||||
@@ -3386,6 +3619,7 @@ export type AssetUpdateWithoutCommentAttachmentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
||||||
@@ -3422,6 +3656,7 @@ export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutEmbeddingsInput = {
|
export type AssetCreateWithoutEmbeddingsInput = {
|
||||||
@@ -3458,6 +3693,7 @@ export type AssetCreateWithoutEmbeddingsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
||||||
@@ -3494,6 +3730,7 @@ export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutEmbeddingsInput = {
|
export type AssetCreateOrConnectWithoutEmbeddingsInput = {
|
||||||
@@ -3546,6 +3783,7 @@ export type AssetUpdateWithoutEmbeddingsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
||||||
@@ -3582,6 +3820,7 @@ export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutNotificationsInput = {
|
export type AssetCreateWithoutNotificationsInput = {
|
||||||
@@ -3618,6 +3857,7 @@ export type AssetCreateWithoutNotificationsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutNotificationsInput = {
|
export type AssetUncheckedCreateWithoutNotificationsInput = {
|
||||||
@@ -3654,6 +3894,7 @@ export type AssetUncheckedCreateWithoutNotificationsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutNotificationsInput = {
|
export type AssetCreateOrConnectWithoutNotificationsInput = {
|
||||||
@@ -3706,6 +3947,7 @@ export type AssetUpdateWithoutNotificationsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
||||||
@@ -3742,6 +3984,7 @@ export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateWithoutTaskInput = {
|
export type AssetCreateWithoutTaskInput = {
|
||||||
@@ -3778,6 +4021,7 @@ export type AssetCreateWithoutTaskInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutTaskInput = {
|
export type AssetUncheckedCreateWithoutTaskInput = {
|
||||||
@@ -3814,6 +4058,7 @@ export type AssetUncheckedCreateWithoutTaskInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutAssetInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutTaskInput = {
|
export type AssetCreateOrConnectWithoutTaskInput = {
|
||||||
@@ -3876,6 +4121,7 @@ export type AssetCreateWithoutAgentSessionsInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectCreateNestedOneWithoutShareRootInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkCreateNestedOneWithoutRootFolderInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedCreateWithoutAgentSessionsInput = {
|
export type AssetUncheckedCreateWithoutAgentSessionsInput = {
|
||||||
@@ -3912,6 +4158,7 @@ export type AssetUncheckedCreateWithoutAgentSessionsInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
projectShareRoot?: Prisma.ProjectUncheckedCreateNestedOneWithoutShareRootInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedCreateNestedOneWithoutRootFolderInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedCreateNestedManyWithoutAssetInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedCreateNestedOneWithoutAssetInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateOrConnectWithoutAgentSessionsInput = {
|
export type AssetCreateOrConnectWithoutAgentSessionsInput = {
|
||||||
@@ -3964,6 +4211,7 @@ export type AssetUpdateWithoutAgentSessionsInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUpdateOneWithoutShareRootNestedInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutAgentSessionsInput = {
|
export type AssetUncheckedUpdateWithoutAgentSessionsInput = {
|
||||||
@@ -4000,6 +4248,7 @@ export type AssetUncheckedUpdateWithoutAgentSessionsInput = {
|
|||||||
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
projectShareRoot?: Prisma.ProjectUncheckedUpdateOneWithoutShareRootNestedInput
|
||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetCreateManyCreatorInput = {
|
export type AssetCreateManyCreatorInput = {
|
||||||
@@ -4059,6 +4308,7 @@ export type AssetUpdateWithoutCreatorInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutCreatorInput = {
|
export type AssetUncheckedUpdateWithoutCreatorInput = {
|
||||||
@@ -4095,6 +4345,7 @@ export type AssetUncheckedUpdateWithoutCreatorInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutCreatorInput = {
|
export type AssetUncheckedUpdateManyWithoutCreatorInput = {
|
||||||
@@ -4177,6 +4428,7 @@ export type AssetUpdateWithoutProjectInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutProjectInput = {
|
export type AssetUncheckedUpdateWithoutProjectInput = {
|
||||||
@@ -4213,6 +4465,7 @@ export type AssetUncheckedUpdateWithoutProjectInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutProjectInput = {
|
export type AssetUncheckedUpdateManyWithoutProjectInput = {
|
||||||
@@ -4318,6 +4571,7 @@ export type AssetUpdateWithoutParentInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutParentInput = {
|
export type AssetUncheckedUpdateWithoutParentInput = {
|
||||||
@@ -4354,6 +4608,7 @@ export type AssetUncheckedUpdateWithoutParentInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutParentInput = {
|
export type AssetUncheckedUpdateManyWithoutParentInput = {
|
||||||
@@ -4413,6 +4668,7 @@ export type AssetUpdateWithoutTargetInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutTargetInput = {
|
export type AssetUncheckedUpdateWithoutTargetInput = {
|
||||||
@@ -4449,6 +4705,7 @@ export type AssetUncheckedUpdateWithoutTargetInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutTargetInput = {
|
export type AssetUncheckedUpdateManyWithoutTargetInput = {
|
||||||
@@ -4531,6 +4788,7 @@ export type AssetUpdateWithoutStorageKeyInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
||||||
@@ -4567,6 +4825,7 @@ export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutStorageKeyInput = {
|
export type AssetUncheckedUpdateManyWithoutStorageKeyInput = {
|
||||||
@@ -4649,6 +4908,7 @@ export type AssetUpdateWithoutTaskInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateWithoutTaskInput = {
|
export type AssetUncheckedUpdateWithoutTaskInput = {
|
||||||
@@ -4685,6 +4945,7 @@ export type AssetUncheckedUpdateWithoutTaskInput = {
|
|||||||
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
shareLinkRootFolder?: Prisma.ShareLinkUncheckedUpdateOneWithoutRootFolderNestedInput
|
||||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
watermarkFiles?: Prisma.WatermarkFileUncheckedUpdateManyWithoutAssetNestedInput
|
||||||
|
agentMd?: Prisma.AssetAgentMdUncheckedUpdateOneWithoutAssetNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetUncheckedUpdateManyWithoutTaskInput = {
|
export type AssetUncheckedUpdateManyWithoutTaskInput = {
|
||||||
@@ -4854,6 +5115,7 @@ export type AssetSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
||||||
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
||||||
watermarkFiles?: boolean | Prisma.Asset$watermarkFilesArgs<ExtArgs>
|
watermarkFiles?: boolean | Prisma.Asset$watermarkFilesArgs<ExtArgs>
|
||||||
|
agentMd?: boolean | Prisma.Asset$agentMdArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}, ExtArgs["result"]["asset"]>
|
}, ExtArgs["result"]["asset"]>
|
||||||
|
|
||||||
@@ -4962,6 +5224,7 @@ export type AssetInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
shareLinkRootFolder?: boolean | Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>
|
||||||
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
agentSessions?: boolean | Prisma.Asset$agentSessionsArgs<ExtArgs>
|
||||||
watermarkFiles?: boolean | Prisma.Asset$watermarkFilesArgs<ExtArgs>
|
watermarkFiles?: boolean | Prisma.Asset$watermarkFilesArgs<ExtArgs>
|
||||||
|
agentMd?: boolean | Prisma.Asset$agentMdArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.AssetCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}
|
}
|
||||||
export type AssetIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type AssetIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
@@ -5003,6 +5266,7 @@ export type $AssetPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
|||||||
shareLinkRootFolder: Prisma.$ShareLinkPayload<ExtArgs> | null
|
shareLinkRootFolder: Prisma.$ShareLinkPayload<ExtArgs> | null
|
||||||
agentSessions: Prisma.$AgentSessionPayload<ExtArgs>[]
|
agentSessions: Prisma.$AgentSessionPayload<ExtArgs>[]
|
||||||
watermarkFiles: Prisma.$WatermarkFilePayload<ExtArgs>[]
|
watermarkFiles: Prisma.$WatermarkFilePayload<ExtArgs>[]
|
||||||
|
agentMd: Prisma.$AssetAgentMdPayload<ExtArgs> | null
|
||||||
}
|
}
|
||||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||||
id: string
|
id: string
|
||||||
@@ -5442,6 +5706,7 @@ export interface Prisma__AssetClient<T, Null = never, ExtArgs extends runtime.Ty
|
|||||||
shareLinkRootFolder<T extends Prisma.Asset$shareLinkRootFolderArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>>): Prisma.Prisma__ShareLinkClient<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
shareLinkRootFolder<T extends Prisma.Asset$shareLinkRootFolderArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$shareLinkRootFolderArgs<ExtArgs>>): Prisma.Prisma__ShareLinkClient<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||||
agentSessions<T extends Prisma.Asset$agentSessionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$agentSessionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
agentSessions<T extends Prisma.Asset$agentSessionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$agentSessionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
watermarkFiles<T extends Prisma.Asset$watermarkFilesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$watermarkFilesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$WatermarkFilePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
watermarkFiles<T extends Prisma.Asset$watermarkFilesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$watermarkFilesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$WatermarkFilePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
|
agentMd<T extends Prisma.Asset$agentMdArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Asset$agentMdArgs<ExtArgs>>): Prisma.Prisma__AssetAgentMdClient<runtime.Types.Result.GetResult<Prisma.$AssetAgentMdPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||||
/**
|
/**
|
||||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||||
@@ -6298,6 +6563,25 @@ export type Asset$watermarkFilesArgs<ExtArgs extends runtime.Types.Extensions.In
|
|||||||
distinct?: Prisma.WatermarkFileScalarFieldEnum | Prisma.WatermarkFileScalarFieldEnum[]
|
distinct?: Prisma.WatermarkFileScalarFieldEnum | Prisma.WatermarkFileScalarFieldEnum[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asset.agentMd
|
||||||
|
*/
|
||||||
|
export type Asset$agentMdArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
/**
|
||||||
|
* Select specific fields to fetch from the AssetAgentMd
|
||||||
|
*/
|
||||||
|
select?: Prisma.AssetAgentMdSelect<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Omit specific fields from the AssetAgentMd
|
||||||
|
*/
|
||||||
|
omit?: Prisma.AssetAgentMdOmit<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Choose, which related nodes to fetch as well
|
||||||
|
*/
|
||||||
|
include?: Prisma.AssetAgentMdInclude<ExtArgs> | null
|
||||||
|
where?: Prisma.AssetAgentMdWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset without action
|
* Asset without action
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1265
File diff suppressed because it is too large
Load Diff
+1844
File diff suppressed because it is too large
Load Diff
+1811
File diff suppressed because it is too large
Load Diff
+460
@@ -203,6 +203,8 @@ export type TeamWhereInput = {
|
|||||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
|
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
|
||||||
|
quotaRules?: Prisma.QuotaRuleListRelationFilter
|
||||||
|
quotaRecords?: Prisma.QuotaRecordListRelationFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamOrderByWithRelationInput = {
|
export type TeamOrderByWithRelationInput = {
|
||||||
@@ -227,6 +229,8 @@ export type TeamOrderByWithRelationInput = {
|
|||||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||||
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateOrderByRelationAggregateInput
|
watermarkTemplates?: Prisma.WatermarkTemplateOrderByRelationAggregateInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleOrderByRelationAggregateInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordOrderByRelationAggregateInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
||||||
@@ -254,6 +258,8 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
|
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
|
||||||
|
quotaRules?: Prisma.QuotaRuleListRelationFilter
|
||||||
|
quotaRecords?: Prisma.QuotaRecordListRelationFilter
|
||||||
}, "id" | "rootFolderId">
|
}, "id" | "rootFolderId">
|
||||||
|
|
||||||
export type TeamOrderByWithAggregationInput = {
|
export type TeamOrderByWithAggregationInput = {
|
||||||
@@ -301,6 +307,8 @@ export type TeamCreateInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateInput = {
|
export type TeamUncheckedCreateInput = {
|
||||||
@@ -324,6 +332,8 @@ export type TeamUncheckedCreateInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUpdateInput = {
|
export type TeamUpdateInput = {
|
||||||
@@ -347,6 +357,8 @@ export type TeamUpdateInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateInput = {
|
export type TeamUncheckedUpdateInput = {
|
||||||
@@ -370,6 +382,8 @@ export type TeamUncheckedUpdateInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateManyInput = {
|
export type TeamCreateManyInput = {
|
||||||
@@ -665,6 +679,34 @@ export type TeamUpdateOneRequiredWithoutAuditLogsNestedInput = {
|
|||||||
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.TeamUpdateWithoutAuditLogsInput>, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
|
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.TeamUpdateWithoutAuditLogsInput>, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TeamCreateNestedOneWithoutQuotaRulesInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
|
||||||
|
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRulesInput
|
||||||
|
connect?: Prisma.TeamWhereUniqueInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateOneRequiredWithoutQuotaRulesNestedInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
|
||||||
|
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRulesInput
|
||||||
|
upsert?: Prisma.TeamUpsertWithoutQuotaRulesInput
|
||||||
|
connect?: Prisma.TeamWhereUniqueInput
|
||||||
|
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutQuotaRulesInput, Prisma.TeamUpdateWithoutQuotaRulesInput>, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamCreateNestedOneWithoutQuotaRecordsInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRecordsInput
|
||||||
|
connect?: Prisma.TeamWhereUniqueInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateOneRequiredWithoutQuotaRecordsNestedInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRecordsInput
|
||||||
|
upsert?: Prisma.TeamUpsertWithoutQuotaRecordsInput
|
||||||
|
connect?: Prisma.TeamWhereUniqueInput
|
||||||
|
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutQuotaRecordsInput, Prisma.TeamUpdateWithoutQuotaRecordsInput>, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutSandboxInput = {
|
export type TeamCreateWithoutSandboxInput = {
|
||||||
id?: string
|
id?: string
|
||||||
name: string
|
name: string
|
||||||
@@ -685,6 +727,8 @@ export type TeamCreateWithoutSandboxInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutSandboxInput = {
|
export type TeamUncheckedCreateWithoutSandboxInput = {
|
||||||
@@ -707,6 +751,8 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutSandboxInput = {
|
export type TeamCreateOrConnectWithoutSandboxInput = {
|
||||||
@@ -745,6 +791,8 @@ export type TeamUpdateWithoutSandboxInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutSandboxInput = {
|
export type TeamUncheckedUpdateWithoutSandboxInput = {
|
||||||
@@ -767,6 +815,8 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutSkillsInput = {
|
export type TeamCreateWithoutSkillsInput = {
|
||||||
@@ -789,6 +839,8 @@ export type TeamCreateWithoutSkillsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutSkillsInput = {
|
export type TeamUncheckedCreateWithoutSkillsInput = {
|
||||||
@@ -811,6 +863,8 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutSkillsInput = {
|
export type TeamCreateOrConnectWithoutSkillsInput = {
|
||||||
@@ -849,6 +903,8 @@ export type TeamUpdateWithoutSkillsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutSkillsInput = {
|
export type TeamUncheckedUpdateWithoutSkillsInput = {
|
||||||
@@ -871,6 +927,8 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutMembersInput = {
|
export type TeamCreateWithoutMembersInput = {
|
||||||
@@ -893,6 +951,8 @@ export type TeamCreateWithoutMembersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutMembersInput = {
|
export type TeamUncheckedCreateWithoutMembersInput = {
|
||||||
@@ -915,6 +975,8 @@ export type TeamUncheckedCreateWithoutMembersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutMembersInput = {
|
export type TeamCreateOrConnectWithoutMembersInput = {
|
||||||
@@ -953,6 +1015,8 @@ export type TeamUpdateWithoutMembersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutMembersInput = {
|
export type TeamUncheckedUpdateWithoutMembersInput = {
|
||||||
@@ -975,6 +1039,8 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutProjectsInput = {
|
export type TeamCreateWithoutProjectsInput = {
|
||||||
@@ -997,6 +1063,8 @@ export type TeamCreateWithoutProjectsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutProjectsInput = {
|
export type TeamUncheckedCreateWithoutProjectsInput = {
|
||||||
@@ -1019,6 +1087,8 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutProjectsInput = {
|
export type TeamCreateOrConnectWithoutProjectsInput = {
|
||||||
@@ -1057,6 +1127,8 @@ export type TeamUpdateWithoutProjectsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutProjectsInput = {
|
export type TeamUncheckedUpdateWithoutProjectsInput = {
|
||||||
@@ -1079,6 +1151,8 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutWatermarkTemplatesInput = {
|
export type TeamCreateWithoutWatermarkTemplatesInput = {
|
||||||
@@ -1101,6 +1175,8 @@ export type TeamCreateWithoutWatermarkTemplatesInput = {
|
|||||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutWatermarkTemplatesInput = {
|
export type TeamUncheckedCreateWithoutWatermarkTemplatesInput = {
|
||||||
@@ -1123,6 +1199,8 @@ export type TeamUncheckedCreateWithoutWatermarkTemplatesInput = {
|
|||||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutWatermarkTemplatesInput = {
|
export type TeamCreateOrConnectWithoutWatermarkTemplatesInput = {
|
||||||
@@ -1161,6 +1239,8 @@ export type TeamUpdateWithoutWatermarkTemplatesInput = {
|
|||||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutWatermarkTemplatesInput = {
|
export type TeamUncheckedUpdateWithoutWatermarkTemplatesInput = {
|
||||||
@@ -1183,6 +1263,8 @@ export type TeamUncheckedUpdateWithoutWatermarkTemplatesInput = {
|
|||||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutRootFolderInput = {
|
export type TeamCreateWithoutRootFolderInput = {
|
||||||
@@ -1205,6 +1287,8 @@ export type TeamCreateWithoutRootFolderInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutRootFolderInput = {
|
export type TeamUncheckedCreateWithoutRootFolderInput = {
|
||||||
@@ -1227,6 +1311,8 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutRootFolderInput = {
|
export type TeamCreateOrConnectWithoutRootFolderInput = {
|
||||||
@@ -1265,6 +1351,8 @@ export type TeamUpdateWithoutRootFolderInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
||||||
@@ -1287,6 +1375,8 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutInvitesInput = {
|
export type TeamCreateWithoutInvitesInput = {
|
||||||
@@ -1309,6 +1399,8 @@ export type TeamCreateWithoutInvitesInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutInvitesInput = {
|
export type TeamUncheckedCreateWithoutInvitesInput = {
|
||||||
@@ -1331,6 +1423,8 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutInvitesInput = {
|
export type TeamCreateOrConnectWithoutInvitesInput = {
|
||||||
@@ -1369,6 +1463,8 @@ export type TeamUpdateWithoutInvitesInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutInvitesInput = {
|
export type TeamUncheckedUpdateWithoutInvitesInput = {
|
||||||
@@ -1391,6 +1487,8 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutMetadataFieldsInput = {
|
export type TeamCreateWithoutMetadataFieldsInput = {
|
||||||
@@ -1413,6 +1511,8 @@ export type TeamCreateWithoutMetadataFieldsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
||||||
@@ -1435,6 +1535,8 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
|
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
|
||||||
@@ -1473,6 +1575,8 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||||
@@ -1495,6 +1599,8 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutNotificationsInput = {
|
export type TeamCreateWithoutNotificationsInput = {
|
||||||
@@ -1517,6 +1623,8 @@ export type TeamCreateWithoutNotificationsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutNotificationsInput = {
|
export type TeamUncheckedCreateWithoutNotificationsInput = {
|
||||||
@@ -1539,6 +1647,8 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutNotificationsInput = {
|
export type TeamCreateOrConnectWithoutNotificationsInput = {
|
||||||
@@ -1577,6 +1687,8 @@ export type TeamUpdateWithoutNotificationsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
||||||
@@ -1599,6 +1711,8 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutAgentsInput = {
|
export type TeamCreateWithoutAgentsInput = {
|
||||||
@@ -1621,6 +1735,8 @@ export type TeamCreateWithoutAgentsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutAgentsInput = {
|
export type TeamUncheckedCreateWithoutAgentsInput = {
|
||||||
@@ -1643,6 +1759,8 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutAgentsInput = {
|
export type TeamCreateOrConnectWithoutAgentsInput = {
|
||||||
@@ -1681,6 +1799,8 @@ export type TeamUpdateWithoutAgentsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutAgentsInput = {
|
export type TeamUncheckedUpdateWithoutAgentsInput = {
|
||||||
@@ -1703,6 +1823,8 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutMcpServersInput = {
|
export type TeamCreateWithoutMcpServersInput = {
|
||||||
@@ -1725,6 +1847,8 @@ export type TeamCreateWithoutMcpServersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutMcpServersInput = {
|
export type TeamUncheckedCreateWithoutMcpServersInput = {
|
||||||
@@ -1747,6 +1871,8 @@ export type TeamUncheckedCreateWithoutMcpServersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutMcpServersInput = {
|
export type TeamCreateOrConnectWithoutMcpServersInput = {
|
||||||
@@ -1785,6 +1911,8 @@ export type TeamUpdateWithoutMcpServersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutMcpServersInput = {
|
export type TeamUncheckedUpdateWithoutMcpServersInput = {
|
||||||
@@ -1807,6 +1935,8 @@ export type TeamUncheckedUpdateWithoutMcpServersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutUserMetadataInput = {
|
export type TeamCreateWithoutUserMetadataInput = {
|
||||||
@@ -1829,6 +1959,8 @@ export type TeamCreateWithoutUserMetadataInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
||||||
@@ -1851,6 +1983,8 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutUserMetadataInput = {
|
export type TeamCreateOrConnectWithoutUserMetadataInput = {
|
||||||
@@ -1889,6 +2023,8 @@ export type TeamUpdateWithoutUserMetadataInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
||||||
@@ -1911,6 +2047,8 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutProvidersInput = {
|
export type TeamCreateWithoutProvidersInput = {
|
||||||
@@ -1933,6 +2071,8 @@ export type TeamCreateWithoutProvidersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutProvidersInput = {
|
export type TeamUncheckedCreateWithoutProvidersInput = {
|
||||||
@@ -1955,6 +2095,8 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutProvidersInput = {
|
export type TeamCreateOrConnectWithoutProvidersInput = {
|
||||||
@@ -1993,6 +2135,8 @@ export type TeamUpdateWithoutProvidersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutProvidersInput = {
|
export type TeamUncheckedUpdateWithoutProvidersInput = {
|
||||||
@@ -2015,6 +2159,8 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
|
|||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutAiUsagesInput = {
|
export type TeamCreateWithoutAiUsagesInput = {
|
||||||
@@ -2037,6 +2183,8 @@ export type TeamCreateWithoutAiUsagesInput = {
|
|||||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
||||||
@@ -2059,6 +2207,8 @@ export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
|||||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutAiUsagesInput = {
|
export type TeamCreateOrConnectWithoutAiUsagesInput = {
|
||||||
@@ -2097,6 +2247,8 @@ export type TeamUpdateWithoutAiUsagesInput = {
|
|||||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
||||||
@@ -2119,6 +2271,8 @@ export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
|||||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateWithoutAuditLogsInput = {
|
export type TeamCreateWithoutAuditLogsInput = {
|
||||||
@@ -2141,6 +2295,8 @@ export type TeamCreateWithoutAuditLogsInput = {
|
|||||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedCreateWithoutAuditLogsInput = {
|
export type TeamUncheckedCreateWithoutAuditLogsInput = {
|
||||||
@@ -2163,6 +2319,8 @@ export type TeamUncheckedCreateWithoutAuditLogsInput = {
|
|||||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCreateOrConnectWithoutAuditLogsInput = {
|
export type TeamCreateOrConnectWithoutAuditLogsInput = {
|
||||||
@@ -2201,6 +2359,8 @@ export type TeamUpdateWithoutAuditLogsInput = {
|
|||||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamUncheckedUpdateWithoutAuditLogsInput = {
|
export type TeamUncheckedUpdateWithoutAuditLogsInput = {
|
||||||
@@ -2223,6 +2383,232 @@ export type TeamUncheckedUpdateWithoutAuditLogsInput = {
|
|||||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamCreateWithoutQuotaRulesInput = {
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
|
||||||
|
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
|
||||||
|
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
|
||||||
|
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
|
||||||
|
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
|
||||||
|
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
|
||||||
|
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||||
|
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||||
|
mcpServers?: Prisma.McpServerCreateNestedManyWithoutTeamInput
|
||||||
|
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||||
|
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||||
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUncheckedCreateWithoutQuotaRulesInput = {
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
rootFolderId?: string | null
|
||||||
|
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
mcpServers?: Prisma.McpServerUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||||
|
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamCreateOrConnectWithoutQuotaRulesInput = {
|
||||||
|
where: Prisma.TeamWhereUniqueInput
|
||||||
|
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpsertWithoutQuotaRulesInput = {
|
||||||
|
update: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRulesInput, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
|
||||||
|
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
|
||||||
|
where?: Prisma.TeamWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateToOneWithWhereWithoutQuotaRulesInput = {
|
||||||
|
where?: Prisma.TeamWhereInput
|
||||||
|
data: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRulesInput, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateWithoutQuotaRulesInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
|
||||||
|
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
|
||||||
|
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
|
||||||
|
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
|
||||||
|
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
|
||||||
|
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||||
|
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||||
|
mcpServers?: Prisma.McpServerUpdateManyWithoutTeamNestedInput
|
||||||
|
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||||
|
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUncheckedUpdateWithoutQuotaRulesInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
mcpServers?: Prisma.McpServerUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||||
|
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamCreateWithoutQuotaRecordsInput = {
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
|
||||||
|
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
|
||||||
|
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
|
||||||
|
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
|
||||||
|
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
|
||||||
|
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
|
||||||
|
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||||
|
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||||
|
mcpServers?: Prisma.McpServerCreateNestedManyWithoutTeamInput
|
||||||
|
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||||
|
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||||
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||||
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUncheckedCreateWithoutQuotaRecordsInput = {
|
||||||
|
id?: string
|
||||||
|
name: string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
rootFolderId?: string | null
|
||||||
|
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
mcpServers?: Prisma.McpServerUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||||
|
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamCreateOrConnectWithoutQuotaRecordsInput = {
|
||||||
|
where: Prisma.TeamWhereUniqueInput
|
||||||
|
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpsertWithoutQuotaRecordsInput = {
|
||||||
|
update: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRecordsInput, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
where?: Prisma.TeamWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateToOneWithWhereWithoutQuotaRecordsInput = {
|
||||||
|
where?: Prisma.TeamWhereInput
|
||||||
|
data: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRecordsInput, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUpdateWithoutQuotaRecordsInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
|
||||||
|
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
|
||||||
|
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
|
||||||
|
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
|
||||||
|
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
|
||||||
|
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||||
|
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||||
|
mcpServers?: Prisma.McpServerUpdateManyWithoutTeamNestedInput
|
||||||
|
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||||
|
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TeamUncheckedUpdateWithoutQuotaRecordsInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
mcpServers?: Prisma.McpServerUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||||
|
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
|
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2244,6 +2630,8 @@ export type TeamCountOutputType = {
|
|||||||
aiUsages: number
|
aiUsages: number
|
||||||
auditLogs: number
|
auditLogs: number
|
||||||
watermarkTemplates: number
|
watermarkTemplates: number
|
||||||
|
quotaRules: number
|
||||||
|
quotaRecords: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
@@ -2260,6 +2648,8 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
|||||||
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
|
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
|
||||||
auditLogs?: boolean | TeamCountOutputTypeCountAuditLogsArgs
|
auditLogs?: boolean | TeamCountOutputTypeCountAuditLogsArgs
|
||||||
watermarkTemplates?: boolean | TeamCountOutputTypeCountWatermarkTemplatesArgs
|
watermarkTemplates?: boolean | TeamCountOutputTypeCountWatermarkTemplatesArgs
|
||||||
|
quotaRules?: boolean | TeamCountOutputTypeCountQuotaRulesArgs
|
||||||
|
quotaRecords?: boolean | TeamCountOutputTypeCountQuotaRecordsArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2363,6 +2753,20 @@ export type TeamCountOutputTypeCountWatermarkTemplatesArgs<ExtArgs extends runti
|
|||||||
where?: Prisma.WatermarkTemplateWhereInput
|
where?: Prisma.WatermarkTemplateWhereInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TeamCountOutputType without action
|
||||||
|
*/
|
||||||
|
export type TeamCountOutputTypeCountQuotaRulesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
where?: Prisma.QuotaRuleWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TeamCountOutputType without action
|
||||||
|
*/
|
||||||
|
export type TeamCountOutputTypeCountQuotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
where?: Prisma.QuotaRecordWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
@@ -2386,6 +2790,8 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
|||||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||||
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
||||||
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
|
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
|
||||||
|
quotaRules?: boolean | Prisma.Team$quotaRulesArgs<ExtArgs>
|
||||||
|
quotaRecords?: boolean | Prisma.Team$quotaRecordsArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}, ExtArgs["result"]["team"]>
|
}, ExtArgs["result"]["team"]>
|
||||||
|
|
||||||
@@ -2435,6 +2841,8 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||||
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
||||||
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
|
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
|
||||||
|
quotaRules?: boolean | Prisma.Team$quotaRulesArgs<ExtArgs>
|
||||||
|
quotaRecords?: boolean | Prisma.Team$quotaRecordsArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}
|
}
|
||||||
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
@@ -2462,6 +2870,8 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||||
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
||||||
watermarkTemplates: Prisma.$WatermarkTemplatePayload<ExtArgs>[]
|
watermarkTemplates: Prisma.$WatermarkTemplatePayload<ExtArgs>[]
|
||||||
|
quotaRules: Prisma.$QuotaRulePayload<ExtArgs>[]
|
||||||
|
quotaRecords: Prisma.$QuotaRecordPayload<ExtArgs>[]
|
||||||
}
|
}
|
||||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||||
id: string
|
id: string
|
||||||
@@ -2882,6 +3292,8 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
|
|||||||
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
auditLogs<T extends Prisma.Team$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
auditLogs<T extends Prisma.Team$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
watermarkTemplates<T extends Prisma.Team$watermarkTemplatesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$watermarkTemplatesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$WatermarkTemplatePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
watermarkTemplates<T extends Prisma.Team$watermarkTemplatesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$watermarkTemplatesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$WatermarkTemplatePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
|
quotaRules<T extends Prisma.Team$quotaRulesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$quotaRulesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRulePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
|
quotaRecords<T extends Prisma.Team$quotaRecordsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$quotaRecordsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRecordPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
/**
|
/**
|
||||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||||
@@ -3667,6 +4079,54 @@ export type Team$watermarkTemplatesArgs<ExtArgs extends runtime.Types.Extensions
|
|||||||
distinct?: Prisma.WatermarkTemplateScalarFieldEnum | Prisma.WatermarkTemplateScalarFieldEnum[]
|
distinct?: Prisma.WatermarkTemplateScalarFieldEnum | Prisma.WatermarkTemplateScalarFieldEnum[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Team.quotaRules
|
||||||
|
*/
|
||||||
|
export type Team$quotaRulesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
/**
|
||||||
|
* Select specific fields to fetch from the QuotaRule
|
||||||
|
*/
|
||||||
|
select?: Prisma.QuotaRuleSelect<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Omit specific fields from the QuotaRule
|
||||||
|
*/
|
||||||
|
omit?: Prisma.QuotaRuleOmit<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Choose, which related nodes to fetch as well
|
||||||
|
*/
|
||||||
|
include?: Prisma.QuotaRuleInclude<ExtArgs> | null
|
||||||
|
where?: Prisma.QuotaRuleWhereInput
|
||||||
|
orderBy?: Prisma.QuotaRuleOrderByWithRelationInput | Prisma.QuotaRuleOrderByWithRelationInput[]
|
||||||
|
cursor?: Prisma.QuotaRuleWhereUniqueInput
|
||||||
|
take?: number
|
||||||
|
skip?: number
|
||||||
|
distinct?: Prisma.QuotaRuleScalarFieldEnum | Prisma.QuotaRuleScalarFieldEnum[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Team.quotaRecords
|
||||||
|
*/
|
||||||
|
export type Team$quotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
/**
|
||||||
|
* Select specific fields to fetch from the QuotaRecord
|
||||||
|
*/
|
||||||
|
select?: Prisma.QuotaRecordSelect<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Omit specific fields from the QuotaRecord
|
||||||
|
*/
|
||||||
|
omit?: Prisma.QuotaRecordOmit<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Choose, which related nodes to fetch as well
|
||||||
|
*/
|
||||||
|
include?: Prisma.QuotaRecordInclude<ExtArgs> | null
|
||||||
|
where?: Prisma.QuotaRecordWhereInput
|
||||||
|
orderBy?: Prisma.QuotaRecordOrderByWithRelationInput | Prisma.QuotaRecordOrderByWithRelationInput[]
|
||||||
|
cursor?: Prisma.QuotaRecordWhereUniqueInput
|
||||||
|
take?: number
|
||||||
|
skip?: number
|
||||||
|
distinct?: Prisma.QuotaRecordScalarFieldEnum | Prisma.QuotaRecordScalarFieldEnum[]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Team without action
|
* Team without action
|
||||||
*/
|
*/
|
||||||
|
|||||||
+284
@@ -247,6 +247,7 @@ export type UserWhereInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||||
|
quotaRecords?: Prisma.QuotaRecordListRelationFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserOrderByWithRelationInput = {
|
export type UserOrderByWithRelationInput = {
|
||||||
@@ -280,6 +281,7 @@ export type UserOrderByWithRelationInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
|
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
|
||||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||||
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordOrderByRelationAggregateInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserWhereUniqueInput = Prisma.AtLeast<{
|
export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||||
@@ -316,6 +318,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||||
|
quotaRecords?: Prisma.QuotaRecordListRelationFilter
|
||||||
}, "id" | "email">
|
}, "id" | "email">
|
||||||
|
|
||||||
export type UserOrderByWithAggregationInput = {
|
export type UserOrderByWithAggregationInput = {
|
||||||
@@ -383,6 +386,7 @@ export type UserCreateInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateInput = {
|
export type UserUncheckedCreateInput = {
|
||||||
@@ -416,6 +420,7 @@ export type UserUncheckedCreateInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUpdateInput = {
|
export type UserUpdateInput = {
|
||||||
@@ -449,6 +454,7 @@ export type UserUpdateInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateInput = {
|
export type UserUncheckedUpdateInput = {
|
||||||
@@ -482,6 +488,7 @@ export type UserUncheckedUpdateInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateManyInput = {
|
export type UserCreateManyInput = {
|
||||||
@@ -884,6 +891,22 @@ export type UserUpdateOneWithoutAuditLogsNestedInput = {
|
|||||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.UserUpdateWithoutAuditLogsInput>, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
|
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.UserUpdateWithoutAuditLogsInput>, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type UserCreateNestedOneWithoutQuotaRecordsInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
connectOrCreate?: Prisma.UserCreateOrConnectWithoutQuotaRecordsInput
|
||||||
|
connect?: Prisma.UserWhereUniqueInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUpdateOneWithoutQuotaRecordsNestedInput = {
|
||||||
|
create?: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
connectOrCreate?: Prisma.UserCreateOrConnectWithoutQuotaRecordsInput
|
||||||
|
upsert?: Prisma.UserUpsertWithoutQuotaRecordsInput
|
||||||
|
disconnect?: Prisma.UserWhereInput | boolean
|
||||||
|
delete?: Prisma.UserWhereInput | boolean
|
||||||
|
connect?: Prisma.UserWhereUniqueInput
|
||||||
|
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutQuotaRecordsInput, Prisma.UserUpdateWithoutQuotaRecordsInput>, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutSessionsInput = {
|
export type UserCreateWithoutSessionsInput = {
|
||||||
id?: string
|
id?: string
|
||||||
type?: $Enums.UserType
|
type?: $Enums.UserType
|
||||||
@@ -914,6 +937,7 @@ export type UserCreateWithoutSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutSessionsInput = {
|
export type UserUncheckedCreateWithoutSessionsInput = {
|
||||||
@@ -946,6 +970,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutSessionsInput = {
|
export type UserCreateOrConnectWithoutSessionsInput = {
|
||||||
@@ -994,6 +1019,7 @@ export type UserUpdateWithoutSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutSessionsInput = {
|
export type UserUncheckedUpdateWithoutSessionsInput = {
|
||||||
@@ -1026,6 +1052,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAccountsInput = {
|
export type UserCreateWithoutAccountsInput = {
|
||||||
@@ -1058,6 +1085,7 @@ export type UserCreateWithoutAccountsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAccountsInput = {
|
export type UserUncheckedCreateWithoutAccountsInput = {
|
||||||
@@ -1090,6 +1118,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAccountsInput = {
|
export type UserCreateOrConnectWithoutAccountsInput = {
|
||||||
@@ -1138,6 +1167,7 @@ export type UserUpdateWithoutAccountsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAccountsInput = {
|
export type UserUncheckedUpdateWithoutAccountsInput = {
|
||||||
@@ -1170,6 +1200,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAuthTokensInput = {
|
export type UserCreateWithoutAuthTokensInput = {
|
||||||
@@ -1202,6 +1233,7 @@ export type UserCreateWithoutAuthTokensInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAuthTokensInput = {
|
export type UserUncheckedCreateWithoutAuthTokensInput = {
|
||||||
@@ -1234,6 +1266,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAuthTokensInput = {
|
export type UserCreateOrConnectWithoutAuthTokensInput = {
|
||||||
@@ -1282,6 +1315,7 @@ export type UserUpdateWithoutAuthTokensInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
||||||
@@ -1314,6 +1348,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutTeamMembersInput = {
|
export type UserCreateWithoutTeamMembersInput = {
|
||||||
@@ -1346,6 +1381,7 @@ export type UserCreateWithoutTeamMembersInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutTeamMembersInput = {
|
export type UserUncheckedCreateWithoutTeamMembersInput = {
|
||||||
@@ -1378,6 +1414,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutTeamMembersInput = {
|
export type UserCreateOrConnectWithoutTeamMembersInput = {
|
||||||
@@ -1426,6 +1463,7 @@ export type UserUpdateWithoutTeamMembersInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
||||||
@@ -1458,6 +1496,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutShareLinksInput = {
|
export type UserCreateWithoutShareLinksInput = {
|
||||||
@@ -1490,6 +1529,7 @@ export type UserCreateWithoutShareLinksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutShareLinksInput = {
|
export type UserUncheckedCreateWithoutShareLinksInput = {
|
||||||
@@ -1522,6 +1562,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutShareLinksInput = {
|
export type UserCreateOrConnectWithoutShareLinksInput = {
|
||||||
@@ -1570,6 +1611,7 @@ export type UserUpdateWithoutShareLinksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutShareLinksInput = {
|
export type UserUncheckedUpdateWithoutShareLinksInput = {
|
||||||
@@ -1602,6 +1644,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAssetsInput = {
|
export type UserCreateWithoutAssetsInput = {
|
||||||
@@ -1634,6 +1677,7 @@ export type UserCreateWithoutAssetsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAssetsInput = {
|
export type UserUncheckedCreateWithoutAssetsInput = {
|
||||||
@@ -1666,6 +1710,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAssetsInput = {
|
export type UserCreateOrConnectWithoutAssetsInput = {
|
||||||
@@ -1714,6 +1759,7 @@ export type UserUpdateWithoutAssetsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAssetsInput = {
|
export type UserUncheckedUpdateWithoutAssetsInput = {
|
||||||
@@ -1746,6 +1792,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutCommentsInput = {
|
export type UserCreateWithoutCommentsInput = {
|
||||||
@@ -1778,6 +1825,7 @@ export type UserCreateWithoutCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutCommentsInput = {
|
export type UserUncheckedCreateWithoutCommentsInput = {
|
||||||
@@ -1810,6 +1858,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutCommentsInput = {
|
export type UserCreateOrConnectWithoutCommentsInput = {
|
||||||
@@ -1847,6 +1896,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
||||||
@@ -1879,6 +1929,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
|
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
|
||||||
@@ -1927,6 +1978,7 @@ export type UserUpdateWithoutCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutCommentsInput = {
|
export type UserUncheckedUpdateWithoutCommentsInput = {
|
||||||
@@ -1959,6 +2011,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUpsertWithoutCompletionChangedCommentsInput = {
|
export type UserUpsertWithoutCompletionChangedCommentsInput = {
|
||||||
@@ -2002,6 +2055,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
||||||
@@ -2034,6 +2088,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutCreatedInvitesInput = {
|
export type UserCreateWithoutCreatedInvitesInput = {
|
||||||
@@ -2066,6 +2121,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
||||||
@@ -2098,6 +2154,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
|
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
|
||||||
@@ -2146,6 +2203,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
||||||
@@ -2178,6 +2236,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutCreatedNotificationsInput = {
|
export type UserCreateWithoutCreatedNotificationsInput = {
|
||||||
@@ -2210,6 +2269,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
||||||
@@ -2242,6 +2302,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
|
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
|
||||||
@@ -2279,6 +2340,7 @@ export type UserCreateWithoutNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutNotificationsInput = {
|
export type UserUncheckedCreateWithoutNotificationsInput = {
|
||||||
@@ -2311,6 +2373,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutNotificationsInput = {
|
export type UserCreateOrConnectWithoutNotificationsInput = {
|
||||||
@@ -2359,6 +2422,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
||||||
@@ -2391,6 +2455,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUpsertWithoutNotificationsInput = {
|
export type UserUpsertWithoutNotificationsInput = {
|
||||||
@@ -2434,6 +2499,7 @@ export type UserUpdateWithoutNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutNotificationsInput = {
|
export type UserUncheckedUpdateWithoutNotificationsInput = {
|
||||||
@@ -2466,6 +2532,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutTasksInput = {
|
export type UserCreateWithoutTasksInput = {
|
||||||
@@ -2498,6 +2565,7 @@ export type UserCreateWithoutTasksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutTasksInput = {
|
export type UserUncheckedCreateWithoutTasksInput = {
|
||||||
@@ -2530,6 +2598,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutTasksInput = {
|
export type UserCreateOrConnectWithoutTasksInput = {
|
||||||
@@ -2578,6 +2647,7 @@ export type UserUpdateWithoutTasksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutTasksInput = {
|
export type UserUncheckedUpdateWithoutTasksInput = {
|
||||||
@@ -2610,6 +2680,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAgentInput = {
|
export type UserCreateWithoutAgentInput = {
|
||||||
@@ -2642,6 +2713,7 @@ export type UserCreateWithoutAgentInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAgentInput = {
|
export type UserUncheckedCreateWithoutAgentInput = {
|
||||||
@@ -2674,6 +2746,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAgentInput = {
|
export type UserCreateOrConnectWithoutAgentInput = {
|
||||||
@@ -2722,6 +2795,7 @@ export type UserUpdateWithoutAgentInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAgentInput = {
|
export type UserUncheckedUpdateWithoutAgentInput = {
|
||||||
@@ -2754,6 +2828,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAgentSessionsInput = {
|
export type UserCreateWithoutAgentSessionsInput = {
|
||||||
@@ -2786,6 +2861,7 @@ export type UserCreateWithoutAgentSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
||||||
@@ -2818,6 +2894,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAgentSessionsInput = {
|
export type UserCreateOrConnectWithoutAgentSessionsInput = {
|
||||||
@@ -2866,6 +2943,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
||||||
@@ -2898,6 +2976,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutUserMetadataInput = {
|
export type UserCreateWithoutUserMetadataInput = {
|
||||||
@@ -2930,6 +3009,7 @@ export type UserCreateWithoutUserMetadataInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutUserMetadataInput = {
|
export type UserUncheckedCreateWithoutUserMetadataInput = {
|
||||||
@@ -2962,6 +3042,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutUserMetadataInput = {
|
export type UserCreateOrConnectWithoutUserMetadataInput = {
|
||||||
@@ -3010,6 +3091,7 @@ export type UserUpdateWithoutUserMetadataInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
||||||
@@ -3042,6 +3124,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutCollectionsInput = {
|
export type UserCreateWithoutCollectionsInput = {
|
||||||
@@ -3074,6 +3157,7 @@ export type UserCreateWithoutCollectionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutCollectionsInput = {
|
export type UserUncheckedCreateWithoutCollectionsInput = {
|
||||||
@@ -3106,6 +3190,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutCollectionsInput = {
|
export type UserCreateOrConnectWithoutCollectionsInput = {
|
||||||
@@ -3154,6 +3239,7 @@ export type UserUpdateWithoutCollectionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutCollectionsInput = {
|
export type UserUncheckedUpdateWithoutCollectionsInput = {
|
||||||
@@ -3186,6 +3272,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
|
|||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutApiTokensInput = {
|
export type UserCreateWithoutApiTokensInput = {
|
||||||
@@ -3218,6 +3305,7 @@ export type UserCreateWithoutApiTokensInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutApiTokensInput = {
|
export type UserUncheckedCreateWithoutApiTokensInput = {
|
||||||
@@ -3250,6 +3338,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutApiTokensInput = {
|
export type UserCreateOrConnectWithoutApiTokensInput = {
|
||||||
@@ -3298,6 +3387,7 @@ export type UserUpdateWithoutApiTokensInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutApiTokensInput = {
|
export type UserUncheckedUpdateWithoutApiTokensInput = {
|
||||||
@@ -3330,6 +3420,7 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAiUsagesInput = {
|
export type UserCreateWithoutAiUsagesInput = {
|
||||||
@@ -3362,6 +3453,7 @@ export type UserCreateWithoutAiUsagesInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAiUsagesInput = {
|
export type UserUncheckedCreateWithoutAiUsagesInput = {
|
||||||
@@ -3394,6 +3486,7 @@ export type UserUncheckedCreateWithoutAiUsagesInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAiUsagesInput = {
|
export type UserCreateOrConnectWithoutAiUsagesInput = {
|
||||||
@@ -3442,6 +3535,7 @@ export type UserUpdateWithoutAiUsagesInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
||||||
@@ -3474,6 +3568,7 @@ export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateWithoutAuditLogsInput = {
|
export type UserCreateWithoutAuditLogsInput = {
|
||||||
@@ -3506,6 +3601,7 @@ export type UserCreateWithoutAuditLogsInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedCreateWithoutAuditLogsInput = {
|
export type UserUncheckedCreateWithoutAuditLogsInput = {
|
||||||
@@ -3538,6 +3634,7 @@ export type UserUncheckedCreateWithoutAuditLogsInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCreateOrConnectWithoutAuditLogsInput = {
|
export type UserCreateOrConnectWithoutAuditLogsInput = {
|
||||||
@@ -3586,6 +3683,7 @@ export type UserUpdateWithoutAuditLogsInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserUncheckedUpdateWithoutAuditLogsInput = {
|
export type UserUncheckedUpdateWithoutAuditLogsInput = {
|
||||||
@@ -3618,6 +3716,155 @@ export type UserUncheckedUpdateWithoutAuditLogsInput = {
|
|||||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserCreateWithoutQuotaRecordsInput = {
|
||||||
|
id?: string
|
||||||
|
type?: $Enums.UserType
|
||||||
|
name: string
|
||||||
|
email: string
|
||||||
|
emailVerified?: boolean
|
||||||
|
image?: string | null
|
||||||
|
password?: string | null
|
||||||
|
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||||
|
guestEmail?: string | null
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
assets?: Prisma.AssetCreateNestedManyWithoutCreatorInput
|
||||||
|
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
|
||||||
|
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
|
||||||
|
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
|
||||||
|
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
|
||||||
|
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
|
||||||
|
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
|
||||||
|
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
|
||||||
|
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
|
||||||
|
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||||
|
accounts?: Prisma.AccountCreateNestedManyWithoutUserInput
|
||||||
|
agent?: Prisma.AgentCreateNestedOneWithoutUserInput
|
||||||
|
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutUserInput
|
||||||
|
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
|
||||||
|
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||||
|
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||||
|
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||||
|
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||||
|
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUncheckedCreateWithoutQuotaRecordsInput = {
|
||||||
|
id?: string
|
||||||
|
type?: $Enums.UserType
|
||||||
|
name: string
|
||||||
|
email: string
|
||||||
|
emailVerified?: boolean
|
||||||
|
image?: string | null
|
||||||
|
password?: string | null
|
||||||
|
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||||
|
guestEmail?: string | null
|
||||||
|
createdAt?: Date | string
|
||||||
|
updatedAt?: Date | string
|
||||||
|
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
|
||||||
|
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
|
||||||
|
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
agent?: Prisma.AgentUncheckedCreateNestedOneWithoutUserInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||||
|
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserCreateOrConnectWithoutQuotaRecordsInput = {
|
||||||
|
where: Prisma.UserWhereUniqueInput
|
||||||
|
create: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUpsertWithoutQuotaRecordsInput = {
|
||||||
|
update: Prisma.XOR<Prisma.UserUpdateWithoutQuotaRecordsInput, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
create: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
|
||||||
|
where?: Prisma.UserWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUpdateToOneWithWhereWithoutQuotaRecordsInput = {
|
||||||
|
where?: Prisma.UserWhereInput
|
||||||
|
data: Prisma.XOR<Prisma.UserUpdateWithoutQuotaRecordsInput, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUpdateWithoutQuotaRecordsInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
email?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||||
|
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
assets?: Prisma.AssetUpdateManyWithoutCreatorNestedInput
|
||||||
|
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
|
||||||
|
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
|
||||||
|
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
|
||||||
|
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
|
||||||
|
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
|
||||||
|
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
|
||||||
|
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
|
||||||
|
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
|
||||||
|
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||||
|
accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput
|
||||||
|
agent?: Prisma.AgentUpdateOneWithoutUserNestedInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUpdateManyWithoutUserNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
|
||||||
|
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||||
|
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||||
|
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UserUncheckedUpdateWithoutQuotaRecordsInput = {
|
||||||
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
|
||||||
|
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
email?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
|
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||||
|
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
|
assets?: Prisma.AssetUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
|
||||||
|
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
|
||||||
|
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
agent?: Prisma.AgentUncheckedUpdateOneWithoutUserNestedInput
|
||||||
|
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||||
|
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||||
|
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3644,6 +3891,7 @@ export type UserCountOutputType = {
|
|||||||
apiTokens: number
|
apiTokens: number
|
||||||
aiUsages: number
|
aiUsages: number
|
||||||
auditLogs: number
|
auditLogs: number
|
||||||
|
quotaRecords: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
@@ -3665,6 +3913,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
|||||||
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
|
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
|
||||||
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
|
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
|
||||||
auditLogs?: boolean | UserCountOutputTypeCountAuditLogsArgs
|
auditLogs?: boolean | UserCountOutputTypeCountAuditLogsArgs
|
||||||
|
quotaRecords?: boolean | UserCountOutputTypeCountQuotaRecordsArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3803,6 +4052,13 @@ export type UserCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.
|
|||||||
where?: Prisma.AuditLogWhereInput
|
where?: Prisma.AuditLogWhereInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserCountOutputType without action
|
||||||
|
*/
|
||||||
|
export type UserCountOutputTypeCountQuotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
where?: Prisma.QuotaRecordWhereInput
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
@@ -3835,6 +4091,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
|||||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||||
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
||||||
|
quotaRecords?: boolean | Prisma.User$quotaRecordsArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}, ExtArgs["result"]["user"]>
|
}, ExtArgs["result"]["user"]>
|
||||||
|
|
||||||
@@ -3901,6 +4158,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||||
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
||||||
|
quotaRecords?: boolean | Prisma.User$quotaRecordsArgs<ExtArgs>
|
||||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}
|
}
|
||||||
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||||
@@ -3928,6 +4186,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
|
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
|
||||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||||
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
||||||
|
quotaRecords: Prisma.$QuotaRecordPayload<ExtArgs>[]
|
||||||
}
|
}
|
||||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||||
id: string
|
id: string
|
||||||
@@ -4357,6 +4616,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
|
|||||||
apiTokens<T extends Prisma.User$apiTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$apiTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApiTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
apiTokens<T extends Prisma.User$apiTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$apiTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApiTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
aiUsages<T extends Prisma.User$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
aiUsages<T extends Prisma.User$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
auditLogs<T extends Prisma.User$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
auditLogs<T extends Prisma.User$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
|
quotaRecords<T extends Prisma.User$quotaRecordsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$quotaRecordsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRecordPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
/**
|
/**
|
||||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||||
@@ -5240,6 +5500,30 @@ export type User$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
|||||||
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
|
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User.quotaRecords
|
||||||
|
*/
|
||||||
|
export type User$quotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
|
/**
|
||||||
|
* Select specific fields to fetch from the QuotaRecord
|
||||||
|
*/
|
||||||
|
select?: Prisma.QuotaRecordSelect<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Omit specific fields from the QuotaRecord
|
||||||
|
*/
|
||||||
|
omit?: Prisma.QuotaRecordOmit<ExtArgs> | null
|
||||||
|
/**
|
||||||
|
* Choose, which related nodes to fetch as well
|
||||||
|
*/
|
||||||
|
include?: Prisma.QuotaRecordInclude<ExtArgs> | null
|
||||||
|
where?: Prisma.QuotaRecordWhereInput
|
||||||
|
orderBy?: Prisma.QuotaRecordOrderByWithRelationInput | Prisma.QuotaRecordOrderByWithRelationInput[]
|
||||||
|
cursor?: Prisma.QuotaRecordWhereUniqueInput
|
||||||
|
take?: number
|
||||||
|
skip?: number
|
||||||
|
distinct?: Prisma.QuotaRecordScalarFieldEnum | Prisma.QuotaRecordScalarFieldEnum[]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User without action
|
* User without action
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -425,5 +425,11 @@ declare global {
|
|||||||
grantType?: 'authorization_code' | 'client_credentials'
|
grantType?: 'authorization_code' | 'client_credentials'
|
||||||
redirectUri?: string
|
redirectUri?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Quota Types
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
export type QuotaResourceData = Record<string, unknown>
|
||||||
|
export type QuotaUserIds = string[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/dtos",
|
"name": "@shumai/dtos",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ export const agentTypeSchema = z.nativeEnum(AgentType)
|
|||||||
export const thinkingLevelSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
export const thinkingLevelSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
||||||
export type ThinkingLevel = z.infer<typeof thinkingLevelSchema>
|
export type ThinkingLevel = z.infer<typeof thinkingLevelSchema>
|
||||||
|
|
||||||
|
export const agentPermissionSchema = z.enum(['owner', 'editor', 'reviewer'])
|
||||||
|
export type AgentPermission = z.infer<typeof agentPermissionSchema>
|
||||||
|
|
||||||
export const agentSkillSchema = z.object({
|
export const agentSkillSchema = z.object({
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
skillId: z.string(),
|
skillId: z.string(),
|
||||||
@@ -24,6 +27,7 @@ export const agentInfoSchema = z.object({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
type: agentTypeSchema,
|
type: agentTypeSchema,
|
||||||
enabled: z.boolean(),
|
enabled: z.boolean(),
|
||||||
|
permission: agentPermissionSchema.optional().default('reviewer'),
|
||||||
avatar: z.string().optional(),
|
avatar: z.string().optional(),
|
||||||
providerId: z.string().optional(),
|
providerId: z.string().optional(),
|
||||||
modelId: z.string().optional(),
|
modelId: z.string().optional(),
|
||||||
@@ -40,6 +44,7 @@ const baseAgentRequest = z.object({
|
|||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
type: agentTypeSchema,
|
type: agentTypeSchema,
|
||||||
enabled: z.boolean().optional().default(true),
|
enabled: z.boolean().optional().default(true),
|
||||||
|
permission: agentPermissionSchema.optional(),
|
||||||
avatar: z.string().optional(),
|
avatar: z.string().optional(),
|
||||||
providerId: z.string().optional(),
|
providerId: z.string().optional(),
|
||||||
modelId: z.string().optional(),
|
modelId: z.string().optional(),
|
||||||
@@ -91,6 +96,11 @@ export const updateAgentRequestSchema = baseAgentRequest.superRefine((data, ctx)
|
|||||||
})
|
})
|
||||||
export type UpdateAgentRequest = z.infer<typeof updateAgentRequestSchema>
|
export type UpdateAgentRequest = z.infer<typeof updateAgentRequestSchema>
|
||||||
|
|
||||||
|
export const updateAgentPermissionRequestSchema = z.object({
|
||||||
|
permission: agentPermissionSchema,
|
||||||
|
})
|
||||||
|
export type UpdateAgentPermissionRequest = z.infer<typeof updateAgentPermissionRequestSchema>
|
||||||
|
|
||||||
export interface CreateAgentParams extends CreateAgentRequest {
|
export interface CreateAgentParams extends CreateAgentRequest {
|
||||||
teamId: string
|
teamId: string
|
||||||
}
|
}
|
||||||
@@ -105,6 +115,7 @@ export interface DeleteAgentParams {
|
|||||||
|
|
||||||
export interface ListAgentsParams {
|
export interface ListAgentsParams {
|
||||||
teamId: string
|
teamId: string
|
||||||
|
userId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const agentSessionEntrySchema = z.object({
|
export const agentSessionEntrySchema = z.object({
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export const assetInfoSchema = z.object({
|
|||||||
sortIndex: z.string().optional().nullable(),
|
sortIndex: z.string().optional().nullable(),
|
||||||
startTime: z.number().optional().nullable(),
|
startTime: z.number().optional().nullable(),
|
||||||
endTime: z.number().optional().nullable(),
|
endTime: z.number().optional().nullable(),
|
||||||
|
hasAgentsMd: z.boolean().optional(),
|
||||||
|
|
||||||
media: z
|
media: z
|
||||||
.object({
|
.object({
|
||||||
@@ -119,10 +120,12 @@ export const assetInfoSchema = z.object({
|
|||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string().optional().nullable(),
|
name: z.string().optional().nullable(),
|
||||||
previewUrl: z.string().optional().nullable(),
|
previewUrl: z.string().optional().nullable(),
|
||||||
|
createdAt: z.string().optional().nullable(),
|
||||||
creator: z
|
creator: z
|
||||||
.object({
|
.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string().nullable(),
|
name: z.string().nullable(),
|
||||||
|
image: z.string().optional().nullable(),
|
||||||
})
|
})
|
||||||
.nullable()
|
.nullable()
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ export enum AuditAction {
|
|||||||
comment_update = 'comment_update',
|
comment_update = 'comment_update',
|
||||||
comment_delete = 'comment_delete',
|
comment_delete = 'comment_delete',
|
||||||
comment_complete = 'comment_complete',
|
comment_complete = 'comment_complete',
|
||||||
|
quota_rule_create = 'quota_rule_create',
|
||||||
|
quota_rule_update = 'quota_rule_update',
|
||||||
|
quota_rule_delete = 'quota_rule_delete',
|
||||||
|
quota_record_reset = 'quota_record_reset',
|
||||||
|
quota_policy_create = 'quota_policy_create',
|
||||||
|
quota_policy_update = 'quota_policy_update',
|
||||||
|
quota_policy_delete = 'quota_policy_delete',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const auditLogSchema = z.object({
|
export const auditLogSchema = z.object({
|
||||||
|
|||||||
@@ -20,3 +20,8 @@ export const restoreFoldersRequestSchema = z.object({
|
|||||||
ids: z.array(z.string()),
|
ids: z.array(z.string()),
|
||||||
})
|
})
|
||||||
export type RestoreFoldersRequest = z.infer<typeof restoreFoldersRequestSchema>
|
export type RestoreFoldersRequest = z.infer<typeof restoreFoldersRequestSchema>
|
||||||
|
|
||||||
|
export const updateAgentsMdRequestSchema = z.object({
|
||||||
|
content: z.string().max(100_000),
|
||||||
|
})
|
||||||
|
export type UpdateAgentsMdRequest = z.infer<typeof updateAgentsMdRequestSchema>
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ export * from './versionStack'
|
|||||||
export * from './chat'
|
export * from './chat'
|
||||||
export * from './auditLog'
|
export * from './auditLog'
|
||||||
export * from './watermark'
|
export * from './watermark'
|
||||||
|
export * from './quota'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { UserType } from '@shumai/db/enums'
|
||||||
import { paginationPageInfoSchema, paginationParamsSchema } from './pagination'
|
import { paginationPageInfoSchema, paginationParamsSchema } from './pagination'
|
||||||
|
|
||||||
export const createProjectRequestSchema = z.object({
|
export const createProjectRequestSchema = z.object({
|
||||||
@@ -48,18 +49,13 @@ export const projectUserInfoSchema = z.object({
|
|||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
role: z.enum(['owner', 'editor', 'reviewer', 'bot', 'unknown']),
|
role: z.enum(['owner', 'editor', 'reviewer', 'bot', 'unknown']),
|
||||||
|
type: z.nativeEnum(UserType).optional(),
|
||||||
image: z.string().optional(),
|
image: z.string().optional(),
|
||||||
scope: z.enum(['team', 'project']).optional(),
|
scope: z.enum(['team', 'project']).optional(),
|
||||||
hasCustomRole: z.boolean().optional(),
|
hasCustomRole: z.boolean().optional(),
|
||||||
})
|
})
|
||||||
export type ProjectUserInfo = z.infer<typeof projectUserInfoSchema>
|
export type ProjectUserInfo = z.infer<typeof projectUserInfoSchema>
|
||||||
|
|
||||||
export const botInfoSchema = z.object({
|
|
||||||
id: z.string(),
|
|
||||||
name: z.string(),
|
|
||||||
})
|
|
||||||
export type BotInfo = z.infer<typeof botInfoSchema>
|
|
||||||
|
|
||||||
export const recentlyDeletedRequestSchema = z
|
export const recentlyDeletedRequestSchema = z
|
||||||
.object({
|
.object({
|
||||||
assetType: z.string(),
|
assetType: z.string(),
|
||||||
@@ -105,6 +101,7 @@ export interface ServiceAddProjectMemberRequest {
|
|||||||
export interface ServiceListProjectMembersRequest {
|
export interface ServiceListProjectMembersRequest {
|
||||||
projectId: string
|
projectId: string
|
||||||
includeAgents?: boolean
|
includeAgents?: boolean
|
||||||
|
requesterUserId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServiceUpdateProjectMemberRoleRequest {
|
export interface ServiceUpdateProjectMemberRoleRequest {
|
||||||
|
|||||||
@@ -0,0 +1,240 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import { QuotaScopeMode, QuotaPeriod, QuotaResourceType } from '@shumai/db/enums'
|
||||||
|
|
||||||
|
export { QuotaScopeMode, QuotaPeriod, QuotaResourceType }
|
||||||
|
|
||||||
|
export const quotaScopeModeSchema = z.nativeEnum(QuotaScopeMode)
|
||||||
|
export type QuotaScopeModeEnum = z.infer<typeof quotaScopeModeSchema>
|
||||||
|
|
||||||
|
export const quotaPeriodSchema = z.enum([
|
||||||
|
'1hour',
|
||||||
|
'5hour',
|
||||||
|
'1day',
|
||||||
|
'7day',
|
||||||
|
'one_hour',
|
||||||
|
'five_hours',
|
||||||
|
'one_day',
|
||||||
|
'seven_days',
|
||||||
|
])
|
||||||
|
export type QuotaPeriodEnum = z.infer<typeof quotaPeriodSchema>
|
||||||
|
|
||||||
|
export function normalizeQuotaPeriod(period: QuotaPeriodEnum | string): QuotaPeriod {
|
||||||
|
switch (period) {
|
||||||
|
case '1hour':
|
||||||
|
case 'one_hour':
|
||||||
|
return 'one_hour'
|
||||||
|
case '5hour':
|
||||||
|
case 'five_hours':
|
||||||
|
return 'five_hours'
|
||||||
|
case '1day':
|
||||||
|
case 'one_day':
|
||||||
|
return 'one_day'
|
||||||
|
case '7day':
|
||||||
|
case 'seven_days':
|
||||||
|
return 'seven_days'
|
||||||
|
default:
|
||||||
|
return 'one_hour'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatQuotaPeriod(period: QuotaPeriod | string): string {
|
||||||
|
switch (period) {
|
||||||
|
case 'one_hour':
|
||||||
|
case '1hour':
|
||||||
|
return '1hour'
|
||||||
|
case 'five_hours':
|
||||||
|
case '5hour':
|
||||||
|
return '5hour'
|
||||||
|
case 'one_day':
|
||||||
|
case '1day':
|
||||||
|
return '1day'
|
||||||
|
case 'seven_days':
|
||||||
|
case '7day':
|
||||||
|
return '7day'
|
||||||
|
default:
|
||||||
|
return period
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const quotaResourceTypeSchema = z.nativeEnum(QuotaResourceType)
|
||||||
|
export type QuotaResourceTypeEnum = z.infer<typeof quotaResourceTypeSchema>
|
||||||
|
|
||||||
|
export const quotaRoleSchema = z.enum(['owner', 'editor', 'reviewer'])
|
||||||
|
export type QuotaRole = z.infer<typeof quotaRoleSchema>
|
||||||
|
|
||||||
|
export const mcpResourceDataSchema = z.object({
|
||||||
|
id: z.string().min(1, 'MCP server ID is required'),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const bashResourceDataSchema = z.object({
|
||||||
|
match: z.string().min(1, 'Bash match wildcard is required'),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const toolResourceDataSchema = z.object({
|
||||||
|
name: z.string().min(1, 'Tool name is required'),
|
||||||
|
})
|
||||||
|
export type ToolResourceData = z.infer<typeof toolResourceDataSchema>
|
||||||
|
|
||||||
|
export const quotaResourceDataSchema = z.record(z.string(), z.unknown())
|
||||||
|
export type QuotaResourceData = z.infer<typeof quotaResourceDataSchema>
|
||||||
|
|
||||||
|
export const quotaRecordResponseSchema = z.object({
|
||||||
|
id: z.string().nullable(),
|
||||||
|
ruleId: z.string(),
|
||||||
|
teamId: z.string(),
|
||||||
|
userId: z.string().nullable().optional(),
|
||||||
|
user: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string(),
|
||||||
|
email: z.string(),
|
||||||
|
image: z.string().nullable().optional(),
|
||||||
|
})
|
||||||
|
.nullable()
|
||||||
|
.optional(),
|
||||||
|
periodStart: z.string().nullable().optional(),
|
||||||
|
periodEnd: z.string().nullable().optional(),
|
||||||
|
consumed: z.number(),
|
||||||
|
remaining: z.number(),
|
||||||
|
percent: z.number(),
|
||||||
|
isWindowActive: z.boolean(),
|
||||||
|
})
|
||||||
|
export type QuotaRecordResponse = z.infer<typeof quotaRecordResponseSchema>
|
||||||
|
|
||||||
|
export const listQuotaRecordsResponseSchema = z.object({
|
||||||
|
records: z.array(quotaRecordResponseSchema),
|
||||||
|
total: z.number(),
|
||||||
|
})
|
||||||
|
export type ListQuotaRecordsResponse = z.infer<typeof listQuotaRecordsResponseSchema>
|
||||||
|
|
||||||
|
export const quotaRuleResponseSchema = z.object({
|
||||||
|
id: z.string(),
|
||||||
|
teamId: z.string(),
|
||||||
|
scopeMode: quotaScopeModeSchema,
|
||||||
|
role: quotaRoleSchema.nullable().optional(),
|
||||||
|
userIds: z.array(z.string()).nullable().optional(),
|
||||||
|
resource: quotaResourceTypeSchema,
|
||||||
|
resourceData: quotaResourceDataSchema.nullable().optional(),
|
||||||
|
limit: z.number(),
|
||||||
|
period: quotaPeriodSchema,
|
||||||
|
enabled: z.boolean(),
|
||||||
|
recordsCount: z.number().optional(),
|
||||||
|
createdAt: z.string(),
|
||||||
|
updatedAt: z.string(),
|
||||||
|
})
|
||||||
|
export type QuotaRuleResponse = z.infer<typeof quotaRuleResponseSchema>
|
||||||
|
|
||||||
|
export const listQuotaRulesResponseSchema = z.object({
|
||||||
|
rules: z.array(quotaRuleResponseSchema),
|
||||||
|
total: z.number(),
|
||||||
|
})
|
||||||
|
export type ListQuotaRulesResponse = z.infer<typeof listQuotaRulesResponseSchema>
|
||||||
|
|
||||||
|
export const createQuotaRuleRequestSchema = z
|
||||||
|
.object({
|
||||||
|
scopeMode: quotaScopeModeSchema,
|
||||||
|
role: quotaRoleSchema.optional().nullable(),
|
||||||
|
userIds: z.array(z.string()).optional().nullable(),
|
||||||
|
resource: quotaResourceTypeSchema,
|
||||||
|
resourceData: quotaResourceDataSchema.optional().nullable(),
|
||||||
|
limit: z.number().positive('Limit must be greater than 0'),
|
||||||
|
period: quotaPeriodSchema,
|
||||||
|
enabled: z.boolean().optional().default(true),
|
||||||
|
})
|
||||||
|
.superRefine((data, ctx) => {
|
||||||
|
if (data.scopeMode === 'selected_members') {
|
||||||
|
if (!data.userIds || data.userIds.length === 0) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
|
||||||
|
path: ['userIds'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data.resource === 'agent_mcp_call_count') {
|
||||||
|
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.id is required for agent_mcp_call_count',
|
||||||
|
path: ['resourceData', 'id'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (data.resource === 'agent_bash_call_count') {
|
||||||
|
const res = bashResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.match is required for agent_bash_call_count',
|
||||||
|
path: ['resourceData', 'match'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (data.resource === 'agent_tool_call_count') {
|
||||||
|
const res = toolResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.name is required for agent_tool_call_count',
|
||||||
|
path: ['resourceData', 'name'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export type CreateQuotaRuleRequest = z.input<typeof createQuotaRuleRequestSchema>
|
||||||
|
|
||||||
|
export const resetQuotaRecordRequestSchema = z.object({
|
||||||
|
userId: z.string().nullable(),
|
||||||
|
})
|
||||||
|
export type ResetQuotaRecordRequest = z.infer<typeof resetQuotaRecordRequestSchema>
|
||||||
|
|
||||||
|
export const updateQuotaRuleRequestSchema = z
|
||||||
|
.object({
|
||||||
|
scopeMode: quotaScopeModeSchema.optional(),
|
||||||
|
role: quotaRoleSchema.optional().nullable(),
|
||||||
|
userIds: z.array(z.string()).optional().nullable(),
|
||||||
|
resource: quotaResourceTypeSchema.optional(),
|
||||||
|
resourceData: quotaResourceDataSchema.optional().nullable(),
|
||||||
|
limit: z.number().positive('Limit must be greater than 0').optional(),
|
||||||
|
period: quotaPeriodSchema.optional(),
|
||||||
|
enabled: z.boolean().optional(),
|
||||||
|
})
|
||||||
|
.superRefine((data, ctx) => {
|
||||||
|
if (data.scopeMode === 'selected_members' && data.userIds !== undefined) {
|
||||||
|
if (!data.userIds || data.userIds.length === 0) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
|
||||||
|
path: ['userIds'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data.resource === 'agent_mcp_call_count' && data.resourceData !== undefined) {
|
||||||
|
const res = mcpResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.id is required for agent_mcp_call_count',
|
||||||
|
path: ['resourceData', 'id'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (data.resource === 'agent_bash_call_count' && data.resourceData !== undefined) {
|
||||||
|
const res = bashResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.match is required for agent_bash_call_count',
|
||||||
|
path: ['resourceData', 'match'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (data.resource === 'agent_tool_call_count' && data.resourceData !== undefined) {
|
||||||
|
const res = toolResourceDataSchema.safeParse(data.resourceData)
|
||||||
|
if (!res.success) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: 'resourceData.name is required for agent_tool_call_count',
|
||||||
|
path: ['resourceData', 'name'],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export type UpdateQuotaRuleRequest = z.input<typeof updateQuotaRuleRequestSchema>
|
||||||
@@ -22,3 +22,25 @@ export interface ChangeStackFileVersionParams {
|
|||||||
fileId: string
|
fileId: string
|
||||||
beforeId: string
|
beforeId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RemoveStackVersionParams {
|
||||||
|
stackId: string
|
||||||
|
fileId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const stackVersionInfoSchema = z.object({
|
||||||
|
id: z.string(),
|
||||||
|
version: z.number(),
|
||||||
|
name: z.string().optional().nullable(),
|
||||||
|
previewUrl: z.string().optional().nullable(),
|
||||||
|
createdAt: z.string().optional().nullable(),
|
||||||
|
creator: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string().nullable(),
|
||||||
|
image: z.string().optional().nullable(),
|
||||||
|
})
|
||||||
|
.nullable()
|
||||||
|
.optional(),
|
||||||
|
})
|
||||||
|
export type StackVersionInfo = z.infer<typeof stackVersionInfoSchema>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/e2e",
|
"name": "@shumai/e2e",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -140,6 +140,14 @@ describe.each(['local', 'temporal'] as const)('Workflow E2E - agentChat (executo
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
userId: regularUser.id,
|
||||||
|
role: 'owner',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Create AgentSession first
|
// Create AgentSession first
|
||||||
await prisma.agentSession.create({
|
await prisma.agentSession.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -284,6 +292,14 @@ describe.each(['local', 'temporal'] as const)('Workflow E2E - agentChat (executo
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
userId: regularUser.id,
|
||||||
|
role: 'owner',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Create AgentSession first
|
// Create AgentSession first
|
||||||
await prisma.agentSession.create({
|
await prisma.agentSession.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -418,6 +434,14 @@ describe.each(['local', 'temporal'] as const)('Workflow E2E - agentChat (executo
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
userId: regularUser.id,
|
||||||
|
role: 'owner',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
await prisma.agentSession.create({
|
await prisma.agentSession.create({
|
||||||
data: {
|
data: {
|
||||||
id: 'vs-session-789',
|
id: 'vs-session-789',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/tableprinter",
|
"name": "@shumai/tableprinter",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/transcode",
|
"name": "@shumai/transcode",
|
||||||
"version": "0.3.7",
|
"version": "0.3.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user