Compare commits

..
20 Commits
Author SHA1 Message Date
yiling dc8c898dae Release v0.2.2 2026-07-23 20:35:22 +08:00
Yiling-J ecc382af61 Merge pull request #218 from shumaiOne/fix/upload-task-completion-status
fix(webui): invalidate upload tasks query when upload task starts and completes
2026-07-23 20:25:44 +08:00
yiling 78dec7626b fix(webui): invalidate upload tasks query when upload task starts and completes 2026-07-23 20:18:37 +08:00
Yiling-J f87033bd3d Merge pull request #217 from shumaiOne/feat/psd-imagemagick-support
feat(transcode): add PSD support via ImageMagick and enforce sRGB conversion
2026-07-23 17:02:11 +08:00
yiling d1b0f3b64f docs: update Windows system requirements in README to include ImageMagick 2026-07-23 16:48:34 +08:00
yiling 8cdbc403db test(e2e): add PSD transcode workflow E2E test 2026-07-23 16:44:56 +08:00
yiling 90adc496dd fix(transcode): update APT package name from imagemagick-7.q16 to imagemagick 2026-07-23 16:34:01 +08:00
yiling 8d1c51abca feat(transcode): add PSD support via ImageMagick and enforce sRGB conversion 2026-07-23 16:19:25 +08:00
Yiling-J 21de21902e Merge pull request #215 from shumaiOne/feat/ai-token-usage-tracking
feat(ai-usage): add team and member token usage tracking and APIs
2026-07-23 15:26:32 +08:00
Yiling-J 330a0b99a9 Merge pull request #216 from shumaiOne/feat/webui-ai-token-usage
feat(webui): integrate AI usage API into dashboard page
2026-07-23 15:10:58 +08:00
yiling df013aa4bb feat(webui): add AI usage dashboard for team and member token tracking 2026-07-23 15:03:09 +08:00
yiling 2c04c97a02 refactor(ai-usage): use Prisma.PrismaClientKnownRequestError for P2002 handling 2026-07-23 11:35:18 +08:00
yiling f6c0a41151 fix(ai-usage): resolve code review feedback for concurrency upsert and timeframe window 2026-07-23 11:29:11 +08:00
yiling f93c8ea524 refactor(agent): invoke harness.subscribe directly without typeof check 2026-07-23 11:11:48 +08:00
yiling 783daa6d3f fix(ai-usage): align since date with top-of-hour bucket boundaries 2026-07-23 11:08:35 +08:00
yiling 1c44e5aff7 feat(ai-usage): add team and member token usage tracking and APIs 2026-07-23 11:02:54 +08:00
Yiling-J 2552d68b98 Merge pull request #214 from shumaiOne/fix/search-result-row-overflow
fix(webui): prevent horizontal overflow in search dialog result rows
2026-07-22 21:18:06 +08:00
yiling 1f714af366 fix(webui): prevent horizontal overflow in search dialog result rows 2026-07-22 21:12:45 +08:00
Yiling-J f0ca7c180b Merge pull request #213 from shumaiOne/fix/sql-query-builder-bugs
fix(search): fix buildSqlCondition date range, numeric metadata, and string parsing bugs
2026-07-22 20:43:26 +08:00
yiling 8aadaa70bf fix(search): fix buildSqlCondition date range, numeric metadata, and string parsing bugs 2026-07-22 20:33:33 +08:00
91 changed files with 4944 additions and 108 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick
- name: Lint
run: bun run lint
@@ -157,7 +157,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick
- name: Run Workflow E2E Tests
run: bun run test:e2e:workflow
+1 -1
View File
@@ -48,7 +48,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find
sudo apt-get install -y ripgrep bubblewrap socat ffmpeg poppler-utils imagemagick libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find
- name: Install dependencies
run: bun install
+1
View File
@@ -50,6 +50,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
bubblewrap \
gosu \
poppler-utils \
imagemagick \
fonts-noto-cjk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
+10 -7
View File
@@ -126,23 +126,24 @@ Shumai requires the following system packages on Linux:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`poppler`** (`poppler-utils`) – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
- **`bubblewrap`**, **`socat`**, and **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`) for process isolation, networking, and workspace search.
Install all required packages with one command:
> Ubuntu/Debian
```bash
sudo apt install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
```
> Fedora
```bash
sudo dnf install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
```
> Arch Linux
```bash
sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
```
> [!NOTE]
@@ -164,12 +165,13 @@ Shumai requires:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`poppler`** – Used for PDF page image extraction and PDF sprite preview generation (`pdftoppm`).
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
- **`ripgrep`** – Required by the AI agent sandbox (`anthropic-experimental/sandbox-runtime`).
Install the required packages with Homebrew:
```bash
brew install ffmpeg poppler ripgrep
brew install ffmpeg poppler imagemagick ripgrep
```
---
@@ -190,17 +192,18 @@ brew install ffmpeg poppler ripgrep
Shumai requires:
- **`ffmpeg`** – Used for media transcoding and metadata extraction.
- **`imagemagick`** – Used for PSD format transcoding and color profile conversion to sRGB.
Install `ffmpeg` using your preferred package manager:
Install required packages using your preferred package manager:
**winget**
```powershell
winget install Gyan.FFmpeg
winget install Gyan.FFmpeg ImageMagick.ImageMagick
```
**Chocolatey**
```powershell
choco install ffmpeg
choco install ffmpeg imagemagick
```
#### Step 4: Install Shumai globally
+10 -7
View File
@@ -140,23 +140,24 @@ mkdir shumai && cd shumai
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`poppler`** (`poppler-utils`) —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
- **`bubblewrap`**、**`socat`** 和 **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需,用于进程隔离、网络通信和工作区搜索。
可以使用以下命令一次性安装所有依赖:
> Ubuntu/Debian
```bash
sudo apt install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo apt install -y ffmpeg poppler-utils imagemagick bubblewrap socat ripgrep
```
> Fedora
```bash
sudo dnf install -y ffmpeg poppler-utils bubblewrap socat ripgrep
sudo dnf install -y ffmpeg poppler-utils ImageMagick bubblewrap socat ripgrep
```
> Arch Linux
```bash
sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
sudo pacman -S --noconfirm ffmpeg poppler imagemagick bubblewrap socat ripgrep
```
> [!NOTE]
@@ -178,12 +179,13 @@ sudo pacman -S --noconfirm ffmpeg poppler bubblewrap socat ripgrep
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`poppler`** —— 用于 PDF 页面图像提取和 PDF 雪碧图预览生成 (`pdftoppm`)。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
- **`ripgrep`** —— AI Agent 沙箱(`anthropic-experimental/sandbox-runtime`)所需。
使用 Homebrew 安装所需依赖:
```bash
brew install ffmpeg poppler ripgrep
brew install ffmpeg poppler imagemagick ripgrep
```
---
@@ -204,17 +206,18 @@ brew install ffmpeg poppler ripgrep
在 Windows 上运行 Shumai 需要:
- **`ffmpeg`** —— 用于媒体转码和元数据提取。
- **`imagemagick`** —— 用于 PSD 格式图像转码和 sRGB 色彩空间转换。
使用你偏好的包管理器安装 `ffmpeg`:
使用你偏好的包管理器安装所需依赖:
**winget**
```powershell
winget install Gyan.FFmpeg
winget install Gyan.FFmpeg ImageMagick.ImageMagick
```
**Chocolatey**
```powershell
choco install ffmpeg
choco install ffmpeg imagemagick
```
#### 第四步:全局安装 Shumai
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent-app",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/cli",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode-app",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/web-app",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "shumai",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -56,6 +56,7 @@ describe('Agent Activities', () => {
it('should call agentChatActivity and prompt the harness', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'AI response' }],
usage: { input: 10, output: 20 },
@@ -95,6 +96,84 @@ describe('Agent Activities', () => {
expect(piAgent.createAgentSession).toHaveBeenCalled()
})
it('should subscribe to harness events and record usage for assistant message_end events', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
const spyRecordUsage = vi.spyOn(aiUsageService, 'recordUsage').mockResolvedValue()
let subscribeListener!: (event: unknown) => Promise<void>
const mockHarness = {
subscribe: vi.fn().mockImplementation((listener) => {
subscribeListener = listener
}),
prompt: vi.fn().mockImplementation(async () => {
// Trigger assistant message end event during turn
if (subscribeListener) {
await subscribeListener({
type: 'message_end',
message: {
role: 'assistant',
usage: {
input: 150,
output: 75,
cacheRead: 25,
totalTokens: 225,
cost: { total: 0.0015 },
},
},
})
}
return {
content: [{ type: 'text', text: 'Subscribed response' }],
usage: { input: 150, output: 75 },
}
}),
}
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>,
harness: mockHarness as unknown as AgentHarness,
})
const context = {
agent: { id: 'b1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
dbProviders: [],
teamSkills: [],
allowedDomains: [],
} as unknown as AgentExecutionContext
const res = await agentChatActivity({
teamId: 'team123',
agentId: 'b1',
message: 'Hi',
imageUrls: [],
projectId: 'p1',
folderId: 'f1',
sessionId: 'mock-session-id',
userId: 'user123',
context,
})
expect(res.text).toBe('Subscribed response')
expect(res.usage.inputTokens).toBe(150)
expect(res.usage.outputTokens).toBe(75)
expect(res.usage.cacheReadTokens).toBe(25)
expect(res.usage.cost).toBe(0.0015)
expect(spyRecordUsage).toHaveBeenCalledWith({
teamId: 'team123',
userId: 'user123',
inputTokens: 150,
outputTokens: 75,
cacheReadTokens: 25,
totalTokens: 225,
cost: 0.0015,
})
})
it('should register local cancellation handler and call harness.abort when cancelled in local mode', async () => {
let resolvePrompt!: (value: {
content: Array<{ type: string; text: string } | { type: string }>
@@ -107,6 +186,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -174,6 +254,7 @@ describe('Agent Activities', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockReturnValue(promptPromise),
abort: vi.fn(),
}
@@ -234,6 +315,7 @@ describe('Agent Activities', () => {
it('should include error message in text when stopReason is error', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -274,6 +356,7 @@ describe('Agent Activities', () => {
it('should pass thinkingLevel from agent config to createAgentSession', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [],
usage: { input: 0, output: 0 },
@@ -322,6 +405,7 @@ describe('Agent Activities', () => {
it('should call autofillAiActivity and run autofill tool', async () => {
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: 'Captured' }],
usage: { input: 5, output: 5 },
@@ -962,6 +1046,7 @@ describe('Agent Database Activities Integration', () => {
})
const mockHarness = {
subscribe: vi.fn(),
prompt: vi.fn().mockResolvedValue({
content: [{ type: 'text', text: ' "Summarized Chat Title" ' }],
}),
+57 -2
View File
@@ -25,11 +25,15 @@ import {
type DbProviderInfo,
} from '../index'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
export interface Usage {
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
model: string
}
@@ -209,8 +213,56 @@ If you need to create files in the local filesystem (for example, a temporary fi
} as unknown as SessionTreeEntry)
}
let totalInputTokens = 0
let totalOutputTokens = 0
let totalCacheReadTokens = 0
let grandTotalTokens = 0
let totalCost = 0
harness.subscribe(async (event) => {
if (event.type === 'message_end' && event.message.role === 'assistant') {
const assistantMsg = event.message
const u = assistantMsg.usage
if (u) {
const inputTokens = u.input || 0
const outputTokens = u.output || 0
const cacheReadTokens = u.cacheRead || 0
const totalTokens = u.totalTokens || inputTokens + outputTokens
const cost = u.cost?.total || 0
totalInputTokens += inputTokens
totalOutputTokens += outputTokens
totalCacheReadTokens += cacheReadTokens
grandTotalTokens += totalTokens
totalCost += cost
try {
await aiUsageService.recordUsage({
teamId: params.teamId,
userId: params.userId,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost,
})
} catch (err) {
logger.error({ err }, 'Failed to record AI usage')
}
}
}
})
const assistantMessage = await harness.prompt(params.prompt, { images: imagesToPass })
if (totalInputTokens === 0 && totalOutputTokens === 0 && assistantMessage.usage) {
totalInputTokens = assistantMessage.usage.input || 0
totalOutputTokens = assistantMessage.usage.output || 0
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
totalCost = assistantMessage.usage.cost?.total || 0
}
const sessionEntries = await session.getEntries()
sessionEntries.forEach((entry) => {
if (entry.type === 'message') {
@@ -243,8 +295,11 @@ If you need to create files in the local filesystem (for example, a temporary fi
const usage: Usage = {
model: modelId,
inputTokens: assistantMessage.usage?.input || 0,
outputTokens: assistantMessage.usage?.output || 0,
inputTokens: totalInputTokens,
outputTokens: totalOutputTokens,
cacheReadTokens: totalCacheReadTokens,
totalTokens: grandTotalTokens,
cost: totalCost,
}
const storage = session.getStorage()
+17 -17
View File
@@ -7,21 +7,21 @@ import {
} from '@earendil-works/pi-agent-core'
import { NodeExecutionEnv } from '@earendil-works/pi-agent-core/node'
import { getModel } from '@earendil-works/pi-ai/compat'
import { agentService } from '@shumai/core/src/agent/agent'
import { prisma } from '@shumai/db'
import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs'
import * as path from 'path'
import { prisma } from '@shumai/db'
import { agentService } from '@shumai/core/src/agent/agent'
import { DatabaseSessionStorage } from './database-session-storage'
import { createAnalyzeImageTool } from './tools/analyze-image'
import { createScreenshotTool } from './tools/screenshot'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createCreateFileTool } from './tools/create-file'
import { createCreateFolderTool } from './tools/create-folder'
import { createCreateVersionTool } from './tools/create-version'
import { createListAssetsTool } from './tools/list-assets'
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
import { createReadSkillTool } from './tools/read-skill'
import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { createScreenshotTool } from './tools/screenshot'
export interface DbModelInfo {
modelId: string
@@ -380,15 +380,15 @@ export function formatSkillsForPrompt(
return lines.join('\n')
}
import { registerWorkflow, registerActivities } from '@shumai/workflow-core'
import { WorkflowTaskType } from '@shumai/db'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentToolCall } from './workflows/agent-tool-call'
import { registerActivities, registerWorkflow } from '@shumai/workflow-core'
import * as agentActivities from './activities/agent'
import * as aiActivities from './activities/ai'
import { agentAutofillMedia } from './workflows/agent-autofill'
import { agentChat } from './workflows/agent-chat'
import { agentEmbeddingMedia } from './workflows/agent-embedding'
import { agentToolCall } from './workflows/agent-tool-call'
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
export function initAgentWorkflows() {
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
@@ -401,19 +401,19 @@ export function initAgentWorkflows() {
registerActivities(aiActivities)
}
export * from './database-session-storage'
export * from './activities/agent'
export {
extractAiMetadataActivity,
generateEmbeddingActivity,
generateImageEmbeddingActivity,
generateTextEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
type ExtractAiMetadataParams,
type GeneratedEmbedding,
type GenerateEmbeddingParams,
generateEmbeddingActivity,
type GenerateTextEmbeddingParams,
generateTextEmbeddingActivity,
type ExtractAiMetadataParams,
extractAiMetadataActivity,
generateImageEmbeddingActivity,
generateVideoChunkEmbeddingActivity,
} from './activities/ai'
export * from './database-session-storage'
export * from './workflows/agent-autofill'
export * from './workflows/agent-chat'
export * from './workflows/agent-embedding'
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/api",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
+68
View File
@@ -37,6 +37,13 @@ vi.mock('@shumai/core/src/user/api-token', () => ({
},
}))
vi.mock('@shumai/core/src/ai-usage/ai-usage', () => ({
aiUsageService: {
recordUsage: vi.fn(),
getTeamUsageStats: vi.fn(),
},
}))
describe('team api', () => {
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -403,5 +410,66 @@ describe('team api', () => {
expect(data).toEqual({ success: true })
expect(apiTokenService.deleteToken).toHaveBeenCalledWith('user1', 'token1')
})
it('GET /teams/:teamId/ai-usage returns team usage stats for owner', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '30d',
team: {
inputTokens: 1000,
outputTokens: 500,
cacheReadTokens: 200,
totalTokens: 1500,
cost: 0.005,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=30d')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.team.totalTokens).toBe(1500)
expect(authzService.hasPermission).toHaveBeenCalledWith(
expect.objectContaining({
permission: Permission.Admin,
type: ResourceType.Team,
id: 't1',
}),
)
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '30d',
userId: undefined,
})
})
it('GET /teams/:teamId/ai-usage?userId=user1 returns specific member usage stats', async () => {
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
timeframe: '7d',
member: {
userId: 'user1',
userName: 'Test User',
userEmail: 'user1@example.com',
role: 'owner',
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 50,
totalTokens: 600,
cost: 0.002,
},
})
const res = await app.request('/teams/t1/ai-usage?timeframe=7d&userId=user1')
expect(res.status).toBe(200)
const data = await res.json()
expect(data.member.userId).toBe('user1')
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
teamId: 't1',
timeframe: '7d',
userId: 'user1',
})
})
})
})
+22 -1
View File
@@ -15,8 +15,9 @@ import {
updateTeamMemberRoleRequestSchema,
createApiTokenRequestSchema,
} from '@shumai/dtos'
import { updateUserMetadataRequestSchema } from '@shumai/dtos'
import { updateUserMetadataRequestSchema, getTeamAiUsageQuerySchema } from '@shumai/dtos'
import { apiTokenService } from '@shumai/core/src/user/api-token'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import type { Prisma } from '@shumai/db'
type User = Prisma.UserGetPayload<Record<string, never>>
@@ -313,5 +314,25 @@ const route = new Hono<{ Variables: { user: User } }>()
await apiTokenService.deleteToken(user.id, tokenId)
return c.json({ success: true })
})
.get('/teams/:teamId/ai-usage', zValidator('query', getTeamAiUsageQuerySchema), async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const { timeframe, userId } = c.req.valid('query')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const stats = await aiUsageService.getTeamUsageStats({
teamId,
timeframe,
userId,
})
return c.json(stats)
})
export default route
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/core",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
+313
View File
@@ -0,0 +1,313 @@
import { describe, expect, it, vi } from 'vitest'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { aiUsageService } from './ai-usage'
import { HTTPException } from 'hono/http-exception'
describe('AiUsageService', () => {
setupTestDbHooks()
async function createTestTeamAndUser() {
const user = await prisma.user.create({
data: {
name: 'Usage Test User',
email: `usage-test-${Date.now()}-${Math.random()}@example.com`,
},
})
const team = await prisma.team.create({
data: {
name: 'Usage Test Team',
},
})
const teamMember = await prisma.teamMember.create({
data: {
teamId: team.id,
userId: user.id,
role: 'owner',
},
})
return { user, team, teamMember }
}
it('records usage for both team total and specific member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 20,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
// Verify database rows
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(2)
const teamRecord = records.find((r) => r.userId === null)
expect(teamRecord).toBeDefined()
expect(teamRecord?.inputTokens).toBe(100)
expect(teamRecord?.outputTokens).toBe(50)
expect(teamRecord?.cacheReadTokens).toBe(20)
expect(teamRecord?.totalTokens).toBe(150)
expect(teamRecord?.cost).toBeCloseTo(0.001)
const memberRecord = records.find((r) => r.userId === user.id)
expect(memberRecord).toBeDefined()
expect(memberRecord?.inputTokens).toBe(100)
expect(memberRecord?.outputTokens).toBe(50)
expect(memberRecord?.cacheReadTokens).toBe(20)
expect(memberRecord?.totalTokens).toBe(150)
expect(memberRecord?.cost).toBeCloseTo(0.001)
})
it('increments existing hourly buckets for team and member', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 30,
totalTokens: 300,
cost: 0.002,
timestamp: now,
})
const teamStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(teamStats.team).toBeDefined()
expect(teamStats.team?.inputTokens).toBe(300)
expect(teamStats.team?.outputTokens).toBe(150)
expect(teamStats.team?.cacheReadTokens).toBe(40)
expect(teamStats.team?.totalTokens).toBe(450)
expect(teamStats.team?.cost).toBeCloseTo(0.003)
const memberStats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
userId: user.id,
})
expect(memberStats.member).toBeDefined()
expect(memberStats.member?.userId).toBe(user.id)
expect(memberStats.member?.inputTokens).toBe(300)
expect(memberStats.member?.outputTokens).toBe(150)
expect(memberStats.member?.cacheReadTokens).toBe(40)
expect(memberStats.member?.totalTokens).toBe(450)
expect(memberStats.member?.cost).toBeCloseTo(0.003)
})
it('handles background system tasks with no userId', async () => {
const { team } = await createTestTeamAndUser()
await aiUsageService.recordUsage({
teamId: team.id,
userId: null,
inputTokens: 50,
outputTokens: 25,
cacheReadTokens: 5,
totalTokens: 75,
cost: 0.0005,
})
const records = await prisma.aiUsage.findMany({
where: { teamId: team.id },
})
expect(records).toHaveLength(1)
expect(records[0].userId).toBeNull()
expect(records[0].inputTokens).toBe(50)
})
it('filters statistics correctly by timeframe', async () => {
vi.useFakeTimers()
const now = new Date('2026-07-23T15:30:00Z')
vi.setSystemTime(now)
try {
const { team, user } = await createTestTeamAndUser()
// 5 minutes ago (within current 1h bucket)
const recent = new Date(now.getTime() - 5 * 60 * 1000)
// 2 hours ago (within 24h, outside 1h)
const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000)
// 3 days ago (within 7d, outside 24h)
const threeDaysAgo = new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000)
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: recent,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: twoHoursAgo,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 400,
outputTokens: 200,
cacheReadTokens: 40,
totalTokens: 600,
cost: 0.004,
timestamp: threeDaysAgo,
})
// 1h timeframe should only include recent
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(100)
// 24h timeframe should include recent + 2 hours ago
const stats24h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '24h',
})
expect(stats24h.team?.inputTokens).toBe(300)
// 7d timeframe should include all 3
const stats7d = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '7d',
})
expect(stats7d.team?.inputTokens).toBe(700)
} finally {
vi.useRealTimers()
}
})
it('throws 404 when querying non-existent team member', async () => {
const { team } = await createTestTeamAndUser()
await expect(
aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '30d',
userId: 'non-existent-user-id',
}),
).rejects.toThrow(HTTPException)
})
it('targets only current hour bucket for 1h timeframe instead of including previous hour bucket', async () => {
const { team, user } = await createTestTeamAndUser()
// 10:15 AM (previous hour)
const prevHour = new Date('2026-07-23T10:15:00Z')
// 11:10 AM (current hour)
const currHour = new Date('2026-07-23T11:10:00Z')
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 100,
cost: 0.001,
timestamp: prevHour,
})
await aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 50,
outputTokens: 0,
cacheReadTokens: 0,
totalTokens: 50,
cost: 0.0005,
timestamp: currHour,
})
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-07-23T11:15:00Z'))
try {
const stats1h = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats1h.team?.inputTokens).toBe(50)
} finally {
vi.useRealTimers()
}
})
it('handles concurrent recordUsage calls for the same team and user without duplication or race errors', async () => {
const { team, user } = await createTestTeamAndUser()
const now = new Date()
await Promise.all([
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 100,
outputTokens: 50,
cacheReadTokens: 10,
totalTokens: 150,
cost: 0.001,
timestamp: now,
}),
aiUsageService.recordUsage({
teamId: team.id,
userId: user.id,
inputTokens: 200,
outputTokens: 100,
cacheReadTokens: 20,
totalTokens: 300,
cost: 0.002,
timestamp: now,
}),
])
const stats = await aiUsageService.getTeamUsageStats({
teamId: team.id,
timeframe: '1h',
})
expect(stats.team?.inputTokens).toBe(300)
expect(stats.team?.outputTokens).toBe(150)
})
})
+263
View File
@@ -0,0 +1,263 @@
import { prisma, Prisma } from '@shumai/db'
import type { TeamUsageStatsResponse, Timeframe } from '@shumai/dtos'
import { HTTPException } from 'hono/http-exception'
export interface RecordUsageParams {
teamId: string
userId?: string | null
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
timestamp?: Date
}
export interface GetTeamUsageStatsParams {
teamId: string
timeframe: Timeframe
userId?: string
}
export class AiUsageService {
private async incrementBucket(params: {
teamId: string
userId: string | null
periodStart: Date
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
}): Promise<void> {
if (params.userId !== null) {
await prisma.aiUsage.upsert({
where: {
// eslint-disable-next-line @typescript-eslint/naming-convention
teamId_userId_periodStart: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
},
},
update: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
create: {
teamId: params.teamId,
userId: params.userId,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} else {
const existing = await prisma.aiUsage.findFirst({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
})
if (existing) {
await prisma.aiUsage.update({
where: { id: existing.id },
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
try {
await prisma.aiUsage.create({
data: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
},
})
} catch (err) {
if (err instanceof Prisma.PrismaClientKnownRequestError && err.code === 'P2002') {
await prisma.aiUsage.updateMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: params.periodStart,
},
data: {
inputTokens: { increment: params.inputTokens },
outputTokens: { increment: params.outputTokens },
cacheReadTokens: { increment: params.cacheReadTokens },
totalTokens: { increment: params.totalTokens },
cost: { increment: params.cost },
},
})
} else {
throw err
}
}
}
}
}
async recordUsage(params: RecordUsageParams): Promise<void> {
const timestamp = params.timestamp ?? new Date()
const periodStart = new Date(timestamp)
periodStart.setMinutes(0, 0, 0)
// 1. Update/create Team Total record (userId = null)
await this.incrementBucket({
teamId: params.teamId,
userId: null,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
// 2. If triggered by a team member, update/create Member Usage record (userId = params.userId)
if (params.userId) {
await this.incrementBucket({
teamId: params.teamId,
userId: params.userId,
periodStart,
inputTokens: params.inputTokens,
outputTokens: params.outputTokens,
cacheReadTokens: params.cacheReadTokens,
totalTokens: params.totalTokens,
cost: params.cost,
})
}
}
async getTeamUsageStats(params: GetTeamUsageStatsParams): Promise<TeamUsageStatsResponse> {
const now = new Date()
const since = new Date(now)
switch (params.timeframe) {
case '1h':
// For 1h, target the current 1h bucket floored to start of current hour
since.setMinutes(0, 0, 0)
break
case '24h':
since.setDate(since.getDate() - 1)
since.setMinutes(0, 0, 0)
break
case '7d':
since.setDate(since.getDate() - 7)
since.setMinutes(0, 0, 0)
break
case '30d':
since.setDate(since.getDate() - 30)
since.setMinutes(0, 0, 0)
break
}
if (!params.userId) {
// Return Team-Level Usage (userId = null)
const teamRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: null,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of teamRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
team: {
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
} else {
// Return Specific Member Usage
const teamMember = await prisma.teamMember.findFirst({
where: {
teamId: params.teamId,
userId: params.userId,
},
include: { user: true },
})
if (!teamMember) {
throw new HTTPException(404, { message: 'Team member not found' })
}
const memberRecords = await prisma.aiUsage.findMany({
where: {
teamId: params.teamId,
userId: params.userId,
periodStart: { gte: since },
},
})
let inputTokens = 0
let outputTokens = 0
let cacheReadTokens = 0
let totalTokens = 0
let cost = 0
for (const r of memberRecords) {
inputTokens += r.inputTokens
outputTokens += r.outputTokens
cacheReadTokens += r.cacheReadTokens
totalTokens += r.totalTokens
cost += r.cost
}
return {
timeframe: params.timeframe,
member: {
userId: teamMember.user.id,
userName: teamMember.user.name,
userEmail: teamMember.user.email,
userImage: teamMember.user.image,
role: teamMember.role,
inputTokens,
outputTokens,
cacheReadTokens,
totalTokens,
cost: Math.round((cost + Number.EPSILON) * 1000000) / 1000000,
},
}
}
}
}
export const aiUsageService = new AiUsageService()
+1
View File
@@ -21,3 +21,4 @@ export * from './versionStack/versionStack'
export * from './hyrumtoken'
export * from './pagination'
export * from './chat/chat'
export * from './ai-usage/ai-usage'
+54
View File
@@ -127,6 +127,7 @@ describe('SearchService', () => {
// String fields
await createWithMeta('str-apple', { text: 'apple' })
await createWithMeta('str-banana', { text: 'banana' })
await createWithMeta('sku-1-2', { sku: '1-2' })
// Number fields
await createWithMeta('num-10', { num: 10 })
@@ -181,6 +182,7 @@ describe('SearchService', () => {
val: 'str-apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -200,6 +202,7 @@ describe('SearchService', () => {
val: 'apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -220,6 +223,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -235,12 +239,14 @@ describe('SearchService', () => {
// String Metadata
{ field: 'text', op: 'eq', val: 'apple', expected: ['str-apple'] },
{ field: 'sku', op: 'eq', val: '1-2', expected: ['sku-1-2'] },
{
field: 'text',
op: 'neq',
val: 'apple',
expected: [
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -258,6 +264,7 @@ describe('SearchService', () => {
op: 'isEmpty',
val: null,
expected: [
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -281,6 +288,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-20',
'bool-true',
'bool-false',
@@ -293,6 +301,7 @@ describe('SearchService', () => {
],
},
{ field: 'num', op: 'gt', val: 15, expected: ['num-20'] },
{ field: 'num', op: 'gt', val: 100, expected: [] },
{ field: 'num', op: 'lt', val: 15, expected: ['num-10'] },
{ field: 'num', op: 'gte', val: 20, expected: ['num-20'] },
{ field: 'num', op: 'lte', val: 10, expected: ['num-10'] },
@@ -314,6 +323,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -332,6 +342,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -346,6 +357,7 @@ describe('SearchService', () => {
// Date Metadata
{ field: 'date', op: 'eq', val: 'today', expected: ['date-today'] },
{ field: 'date', op: 'lte', val: 'today', expected: ['date-today', 'date-yesterday'] },
{ field: 'date', op: 'isWithin', val: 'today', expected: ['date-today'] },
{ field: 'date', op: 'lt', val: 'today', expected: ['date-yesterday'] },
{ field: 'date', op: 'gt', val: 'yesterday', expected: ['date-today'] },
@@ -358,6 +370,7 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -378,6 +391,47 @@ describe('SearchService', () => {
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
'bool-false',
'multi-a-b',
'multi-b-c',
'date-today',
'date-yesterday',
'name-contains-test',
'nothing',
],
},
{
field: 'createdAt',
op: 'eq',
val: 'today',
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
'bool-false',
'multi-a-b',
'multi-b-c',
'date-today',
'date-yesterday',
'name-contains-test',
'nothing',
],
},
{
field: 'createdAt',
op: 'lte',
val: 'today',
expected: [
'str-apple',
'str-banana',
'sku-1-2',
'num-10',
'num-20',
'bool-true',
@@ -35,4 +35,76 @@ describe('SqlQueryBuilder', () => {
const builder = new SqlQueryBuilder().select(Prisma.sql`id`)
expect(() => builder.build()).toThrow('FROM clause is required')
})
describe('Bug Reproduction Tests for buildSqlCondition', () => {
it('Bug 1: createdAt eq date should match full day range (>= startOfDay AND <= endOfDay)', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'createdAt', operator: 'eq', value: '2026-07-22' }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a."created_at" >= $1 AND a."created_at" <= $2)',
)
const startVal = query.values[0] as Date
const endVal = query.values[1] as Date
expect(startVal.getHours()).toBe(0)
expect(startVal.getMinutes()).toBe(0)
expect(startVal.getSeconds()).toBe(0)
expect(endVal.getHours()).toBe(23)
expect(endVal.getMinutes()).toBe(59)
expect(endVal.getSeconds()).toBe(59)
})
it('Bug 2: createdAt lte date should use end-of-day timestamp (23:59:59.999)', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'createdAt', operator: 'lte', value: '2026-07-22' }])
const query = builder.build()
expect(query.text).toBe('SELECT * FROM assets a WHERE (a."created_at" <= $1)')
const endVal = query.values[0] as Date
expect(endVal.getHours()).toBe(23)
expect(endVal.getMinutes()).toBe(59)
expect(endVal.getSeconds()).toBe(59)
})
it('Bug 3: custom metadata numeric query should ONLY query number_value', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'rating', operator: 'gt', value: 100 }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND number_value > $2))',
)
expect(query.values).toEqual(['rating', 100])
})
it('Bug 4: isDate should not misclassify dash-separated non-date string values like "1-2"', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [{ field: 'sku', operator: 'eq', value: '1-2' }])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND string_value = $2))',
)
expect(query.values).toEqual(['sku', '1-2'])
})
it('Bug 5: custom field names with special characters are safely parameterized', () => {
const builder = new SqlQueryBuilder()
.from(Prisma.sql`assets a`)
.addSearchConditions('AND', [
{ field: 'custom_field"test', operator: 'eq', value: 'hello' },
])
const query = builder.build()
expect(query.text).toBe(
'SELECT * FROM assets a WHERE (a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = $1 AND string_value = $2))',
)
expect(query.values).toEqual(['custom_field"test', 'hello'])
})
})
})
+61 -33
View File
@@ -101,7 +101,7 @@ export class SqlQueryBuilder {
private isDate(value: unknown): boolean {
if (value instanceof Date) return true
if (typeof value !== 'string') return false
const valStr = value.toLowerCase()
const valStr = value.trim().toLowerCase()
const relativeKeywords = [
'today',
'yesterday',
@@ -111,11 +111,14 @@ export class SqlQueryBuilder {
'one month ago',
'one month from now',
]
if (relativeKeywords.includes(valStr) || valStr.match(/\d+\s+days?\s+(ago|from\s+now)/)) {
if (relativeKeywords.includes(valStr) || valStr.match(/^\d+\s+days?\s+(ago|from\s+now)$/)) {
return true
}
if (!valStr.match(/^\d{4}-\d{2}-\d{2}/)) {
return false
}
const d = new Date(value)
return !isNaN(d.getTime()) && value.includes('-')
return !isNaN(d.getTime())
}
private toDate(value: unknown): Date {
@@ -123,12 +126,8 @@ export class SqlQueryBuilder {
}
private toDateBound(value: unknown, bound: 'start' | 'end'): Date {
const d = this.parseRelativeDate(value)
if (d instanceof Date) return d
if (d && 'gte' in d && 'lte' in d) {
return bound === 'start' ? d.gte! : d.lte!
}
return new Date(value as string)
const range = this.parseDateRange(value)
return bound === 'start' ? range.start : range.end
}
private parseDateRange(value: unknown): { start: Date; end: Date } {
@@ -137,6 +136,11 @@ export class SqlQueryBuilder {
return { start: d.gte!, end: d.lte! }
}
const date = d instanceof Date ? d : new Date(value as string)
const valStr = typeof value === 'string' ? value : ''
const hasTime = valStr.includes('T') || valStr.includes(':')
if (hasTime) {
return { start: date, end: date }
}
const start = new Date(date)
start.setHours(0, 0, 0, 0)
const end = new Date(date)
@@ -239,18 +243,8 @@ export class SqlQueryBuilder {
}
private buildSqlCondition(field: string, operator: string, value: unknown): Prisma.Sql | null {
const colName =
field === 'sizeByte' || field === 'size_byte'
? 'size_byte'
: field === 'createdAt' || field === 'created_at'
? 'created_at'
: field === 'updatedAt' || field === 'updated_at'
? 'updated_at'
: field
const dbCol = Prisma.raw(`a."${colName}"`)
if (field === 'name') {
const dbCol = Prisma.raw(`a."name"`)
const valStr = String(value)
switch (operator) {
case 'eq':
@@ -271,6 +265,7 @@ export class SqlQueryBuilder {
}
if (field === 'sizeByte' || field === 'size_byte') {
const dbCol = Prisma.raw(`a."size_byte"`)
const valNum = Number(value)
switch (operator) {
case 'eq':
@@ -296,12 +291,17 @@ export class SqlQueryBuilder {
field === 'created_at' ||
field === 'updated_at'
) {
const valDate = this.toDate(value)
const colName = field === 'createdAt' || field === 'created_at' ? 'created_at' : 'updated_at'
const dbCol = Prisma.raw(`a."${colName}"`)
switch (operator) {
case 'eq':
return Prisma.sql`${dbCol} = ${valDate}`
case 'neq':
return Prisma.sql`${dbCol} != ${valDate}`
case 'eq': {
const range = this.parseDateRange(value)
return Prisma.sql`${dbCol} >= ${range.start} AND ${dbCol} <= ${range.end}`
}
case 'neq': {
const range = this.parseDateRange(value)
return Prisma.sql`(${dbCol} < ${range.start} OR ${dbCol} > ${range.end})`
}
case 'gt':
return Prisma.sql`${dbCol} > ${this.toDateBound(value, 'end')}`
case 'gte':
@@ -333,14 +333,42 @@ export class SqlQueryBuilder {
const matchSql = this.buildEavValueMatch(value)
return Prisma.sql`a.id NOT IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field}) OR a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND NOT (${matchSql}))`
}
case 'gt':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value > ${Number(value)} OR date_value > ${this.toDateBound(value, 'end')}))`
case 'gte':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value >= ${Number(value)} OR date_value >= ${this.toDateBound(value, 'start')}))`
case 'lt':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value < ${Number(value)} OR date_value < ${this.toDateBound(value, 'start')}))`
case 'lte':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND (number_value <= ${Number(value)} OR date_value <= ${this.toDateBound(value, 'end')}))`
case 'gt': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value > ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value > ${this.toDateBound(value, 'end')})`
}
case 'gte': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value >= ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value >= ${this.toDateBound(value, 'start')})`
}
case 'lt': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value < ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value < ${this.toDateBound(value, 'start')})`
}
case 'lte': {
if (
typeof value === 'number' ||
(typeof value === 'string' && !isNaN(Number(value)) && !this.isDate(value))
) {
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND number_value <= ${Number(value)})`
}
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND date_value <= ${this.toDateBound(value, 'end')})`
}
case 'contains':
return Prisma.sql`a.id IN (SELECT asset_id FROM asset_metadata_values WHERE field_key = ${field} AND string_value ILIKE ${'%' + String(value) + '%'})`
case 'notContains':
+49 -1
View File
@@ -3,6 +3,7 @@ import { transcodeService } from './transcode'
import { s3Service } from '@shumai/core/src/s3/s3'
import * as path from 'path'
import * as child_process from 'child_process'
import { execFile } from 'child_process'
import * as fs from 'fs'
import { WorkflowTask } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
@@ -24,6 +25,7 @@ vi.mock('child_process', () => ({
vi.mock('sharp', () => {
const mockSharp = {
resize: vi.fn().mockReturnThis(),
toColorspace: vi.fn().mockReturnThis(),
webp: vi.fn().mockReturnThis(),
composite: vi.fn().mockReturnThis(),
toBuffer: vi.fn().mockResolvedValue(Buffer.from('fake-webp-buffer')),
@@ -182,17 +184,62 @@ describe('TranscodeService', () => {
)
})
it('should use sharp for image transcoding', async () => {
it('should use sharp for image transcoding with sRGB conversion', async () => {
const outputFile = path.join(tempDir, 'output.webp')
await transcodeService.transcodeImage('input.png', outputFile, 480, 80)
expect(sharp).toHaveBeenCalledWith('input.png', { limitInputPixels: false })
const mockSharp = vi.mocked(sharp).mock.results[0].value
expect(mockSharp.toColorspace).toHaveBeenCalledWith('srgb')
expect(mockSharp.resize).toHaveBeenCalledWith(480, 7680, expect.any(Object))
expect(mockSharp.webp).toHaveBeenCalledWith({ quality: 80 })
expect(mockSharp.toFile).toHaveBeenCalledWith(outputFile)
})
it('should use ImageMagick for PSD image transcoding', async () => {
const outputFile = path.join(tempDir, 'output_psd.webp')
const psdBuffer = Buffer.from('8BPS-fake-psd-content')
await transcodeService.transcodeImage(psdBuffer, outputFile, 480, 80)
expect(execFile).toHaveBeenCalledWith(
'magick',
expect.arrayContaining([
'-colorspace',
'sRGB',
expect.stringContaining('[0]'),
'-quality',
'80',
]),
expect.any(Function),
)
})
it('should get PSD image info using ImageMagick identify', async () => {
const mockExecFile = vi.mocked(execFile)
mockExecFile.mockImplementation((cmd: unknown, args: unknown, callback: unknown) => {
const cb = callback as (
err: Error | null,
result: { stdout: string; stderr: string },
extra: string,
) => void
const argsArr = args as string[] | undefined
if (cmd === 'magick' && argsArr && argsArr[0] === 'identify') {
cb(null, { stdout: '1920 1080\n', stderr: '' }, '')
} else if (typeof cb === 'function') {
cb(null, { stdout: '', stderr: '' }, '')
}
return {} as ReturnType<typeof execFile>
})
const psdPath = path.join(tempDir, 'sample.psd')
fs.writeFileSync(psdPath, '8BPS-sample')
const info = await transcodeService.getImageInfo(psdPath)
expect(info.originalWidth).toBe(1920)
expect(info.originalHeight).toBe(1080)
expect(info.mimeType).toBe('psd')
})
it('should fetch image if input is a URL', async () => {
const mockBuffer = Buffer.from('fake-image-data')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -215,6 +262,7 @@ describe('TranscodeService', () => {
expect(sharp).toHaveBeenCalledWith(inputBuffer, { limitInputPixels: false })
const mockSharp = vi.mocked(sharp).mock.results[vi.mocked(sharp).mock.results.length - 1].value
expect(mockSharp.toColorspace).toHaveBeenCalledWith('srgb')
expect(mockSharp.resize).toHaveBeenCalledWith(480, 7680, expect.any(Object))
expect(mockSharp.webp).toHaveBeenCalledWith({ quality: 80 })
expect(mockSharp.toFile).toHaveBeenCalledWith(outputFile)
+135 -3
View File
@@ -120,9 +120,69 @@ export interface ExtractVideoFramesParams {
isImage: boolean
}
export function isPsdInput(input: string | Buffer): boolean {
if (typeof input === 'string') {
if (input.toLowerCase().endsWith('.psd')) return true
if (fs.existsSync(input)) {
try {
const fd = fs.openSync(input, 'r')
const buf = Buffer.alloc(4)
fs.readSync(fd, buf, 0, 4, 0)
fs.closeSync(fd)
return buf.toString('ascii') === '8BPS'
} catch {
return false
}
}
return false
}
return (
input.length >= 4 &&
input[0] === 0x38 &&
input[1] === 0x42 &&
input[2] === 0x50 &&
input[3] === 0x53
)
}
export class TranscodeService {
constructor(private readonly prismaClient: typeof prisma = prisma) {}
private async execImageMagick(args: string[]): Promise<{ stdout: string; stderr: string }> {
try {
return await execFileAsync('magick', args)
} catch (err: unknown) {
const code = (err as Record<string, unknown>)?.code
if (code === 'ENOENT') {
return await execFileAsync('convert', args)
}
throw err
}
}
private async execImageMagickIdentify(
filePath: string,
): Promise<{ width: number; height: number }> {
const fileArg = `${filePath}[0]`
let stdout: string
try {
const res = await execFileAsync('magick', ['identify', '-format', '%w %h', fileArg])
stdout = res.stdout
} catch (err: unknown) {
const code = (err as Record<string, unknown>)?.code
if (code === 'ENOENT') {
const res = await execFileAsync('identify', ['-format', '%w %h', fileArg])
stdout = res.stdout
} else {
throw err
}
}
const parts = stdout.trim().split(/\s+/)
const width = parseInt(parts[0], 10) || 0
const height = parseInt(parts[1], 10) || 0
return { width, height }
}
private resolveCodecName(stream: {
/* eslint-disable @typescript-eslint/naming-convention */
codec_name?: string
@@ -222,6 +282,8 @@ export class TranscodeService {
async getImageInfo(inputFile: string): Promise<MediaMetadata> {
let input: string | Buffer = inputFile
let tempDirToCleanup: string | null = null
if (inputFile.startsWith('http')) {
const resp = await fetch(inputFile)
if (!resp.ok) {
@@ -230,6 +292,38 @@ export class TranscodeService {
input = Buffer.from(await resp.arrayBuffer())
}
if (isPsdInput(input)) {
let psdPath: string
if (typeof input === 'string') {
psdPath = input
} else {
tempDirToCleanup = this.createTempDir('psd-info-')
psdPath = path.join(tempDirToCleanup, 'input.psd')
fs.writeFileSync(psdPath, input)
}
try {
const { width, height } = await this.execImageMagickIdentify(psdPath)
return {
originalWidth: width,
originalHeight: height,
duration: 0,
bitRate: 0,
frameRate: 0,
totalFrames: 0,
startTimecode: undefined,
hasAudio: false,
mimeType: 'psd',
}
} catch (err) {
console.warn('ImageMagick identify failed for PSD, falling back to sharp:', err)
} finally {
if (tempDirToCleanup) {
this.removeDir(tempDirToCleanup)
}
}
}
const metadata = await sharp(input, { limitInputPixels: false }).metadata()
return {
originalWidth: metadata.width || 0,
@@ -309,13 +403,48 @@ export class TranscodeService {
input = Buffer.from(await resp.arrayBuffer())
}
const sharpInstance = sharp(input, { limitInputPixels: false })
const WEBP_MAX_DIMENSION = 7680
const targetW = width > 0 ? Math.min(width, WEBP_MAX_DIMENSION) : WEBP_MAX_DIMENSION
const targetH = height && height > 0 ? Math.min(height, WEBP_MAX_DIMENSION) : WEBP_MAX_DIMENSION
sharpInstance.resize(targetW, targetH, {
if (isPsdInput(input)) {
let psdPath: string
let tempDirToCleanup: string | null = null
if (typeof input === 'string') {
psdPath = input
} else {
tempDirToCleanup = this.createTempDir('psd-transcode-')
psdPath = path.join(tempDirToCleanup, 'input.psd')
fs.writeFileSync(psdPath, input)
}
try {
const resizeGeometry =
targetH < WEBP_MAX_DIMENSION
? `${targetW}x${targetH}>`
: `${targetW}x${WEBP_MAX_DIMENSION}>`
await this.execImageMagick([
`${psdPath}[0]`,
'-colorspace',
'sRGB',
'-resize',
resizeGeometry,
'-quality',
quality.toString(),
outputFile,
])
return
} finally {
if (tempDirToCleanup) {
this.removeDir(tempDirToCleanup)
}
}
}
const sharpInstance = sharp(input, { limitInputPixels: false })
sharpInstance.toColorspace('srgb').resize(targetW, targetH, {
withoutEnlargement: true,
fit: 'inside',
})
@@ -430,6 +559,7 @@ export class TranscodeService {
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...spriteArgs])
await sharp(firstPagePath, { limitInputPixels: false })
.toColorspace('srgb')
.resize(480, null, { withoutEnlargement: true, fit: 'inside' })
.webp({ quality: 75 })
.toFile(outputPoster)
@@ -926,6 +1056,7 @@ export class TranscodeService {
const webpName = `${stem}-page-${pageNum}-${ulid()}.webp`
let webpBuffer = await sharp(localPngPath, { limitInputPixels: false })
.toColorspace('srgb')
.resize(1920, 1080, { fit: 'inside', withoutEnlargement: false })
.webp({ quality: 85 })
.toBuffer()
@@ -973,6 +1104,7 @@ export class TranscodeService {
const svgStr = renderAnnotationsToSvg(width, height, annotations)
return await sharp(imageBuffer, { limitInputPixels: false })
.composite([{ input: Buffer.from(svgStr), top: 0, left: 0 }])
.toColorspace('srgb')
.resize(16383, 16383, { fit: 'inside', withoutEnlargement: true })
.webp({ quality: 85 })
.toBuffer()
+7
View File
@@ -27,6 +27,11 @@ describe('detectSupportedMimeType', () => {
expect(detectSupportedMimeType(buffer)).toBe('image/webp')
})
it('should detect PSD', () => {
const buffer = new Uint8Array([0x38, 0x42, 0x50, 0x53, 0x00, 0x01])
expect(detectSupportedMimeType(buffer)).toBe('image/vnd.adobe.photoshop')
})
it('should detect MP4', () => {
const buffer = new Uint8Array([
0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6f, 0x6d,
@@ -44,6 +49,8 @@ describe('getProxyType', () => {
it('should detect image proxyType', () => {
expect(getProxyType('image/png', 'test.png')).toBe('image')
expect(getProxyType('image/jpeg', 'photo.jpg')).toBe('image')
expect(getProxyType('image/vnd.adobe.photoshop', 'design.psd')).toBe('image')
expect(getProxyType(null, 'design.psd')).toBe('image')
})
it('should detect video proxyType', () => {
+4 -1
View File
@@ -7,7 +7,7 @@ export function getProxyType(
const lowerMediaType = mediaType?.toLowerCase() || ''
const lowerFilename = filename?.toLowerCase() || ''
if (lowerMediaType.startsWith('image/')) return 'image'
if (lowerMediaType.startsWith('image/') || lowerFilename.endsWith('.psd')) return 'image'
if (lowerMediaType.startsWith('video/')) return 'video'
if (lowerMediaType.startsWith('audio/')) return 'audio'
@@ -32,6 +32,9 @@ export function getProxyType(
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]
export function detectSupportedMimeType(buffer: Uint8Array): string | null {
if (startsWithAscii(buffer, 0, '8BPS')) {
return 'image/vnd.adobe.photoshop'
}
if (startsWith(buffer, [0xff, 0xd8, 0xff])) {
return buffer[3] === 0xf7 ? null : 'image/jpeg'
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/db",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -0,0 +1,28 @@
-- CreateTable
CREATE TABLE "ai_usages" (
"id" TEXT NOT NULL,
"team_id" TEXT NOT NULL,
"user_id" TEXT,
"period_start" TIMESTAMP(3) NOT NULL,
"input_tokens" INTEGER NOT NULL DEFAULT 0,
"output_tokens" INTEGER NOT NULL DEFAULT 0,
"cache_read_tokens" INTEGER NOT NULL DEFAULT 0,
"total_tokens" INTEGER NOT NULL DEFAULT 0,
"cost" DOUBLE PRECISION NOT NULL DEFAULT 0,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ai_usages_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ai_usages_team_id_period_start_idx" ON "ai_usages"("team_id", "period_start");
-- CreateIndex
CREATE INDEX "ai_usages_team_id_user_id_period_start_idx" ON "ai_usages"("team_id", "user_id", "period_start");
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[team_id,user_id,period_start]` on the table `ai_usages` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "ai_usages_team_id_user_id_period_start_key" ON "ai_usages"("team_id", "user_id", "period_start");
+25
View File
@@ -155,6 +155,7 @@ model User {
collections Collection[] @relation("UserToCollection")
shareLinks ShareLink[] @relation("UserToShareLink")
apiTokens ApiToken[] @relation("UserToApiToken")
aiUsages AiUsage[] @relation("UserToAiUsage")
@@map("users")
}
@@ -237,6 +238,7 @@ model Team {
skills Skill[] @relation("TeamToSkill")
sandbox Sandbox? @relation("TeamToSandbox")
agents Agent[] @relation("TeamToAgent")
aiUsages AiUsage[] @relation("TeamToAiUsage")
@@map("teams")
}
@@ -814,3 +816,26 @@ model ApiToken {
@@map("api_tokens")
}
model AiUsage {
id String @id @default(ulid())
teamId String @map("team_id")
userId String? @map("user_id")
periodStart DateTime @map("period_start")
inputTokens Int @default(0) @map("input_tokens")
outputTokens Int @default(0) @map("output_tokens")
cacheReadTokens Int @default(0) @map("cache_read_tokens")
totalTokens Int @default(0) @map("total_tokens")
cost Float @default(0) @map("cost")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
team Team @relation("TeamToAiUsage", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToAiUsage", fields: [userId], references: [id], onDelete: SetNull)
@@map("ai_usages")
@@unique([teamId, userId, periodStart])
@@index([teamId, periodStart])
@@index([teamId, userId, periodStart])
}
+5
View File
@@ -182,3 +182,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+5
View File
@@ -206,3 +206,8 @@ export type Collection = Prisma.CollectionModel
*
*/
export type ApiToken = Prisma.ApiTokenModel
/**
* Model AiUsage
*
*/
export type AiUsage = Prisma.AiUsageModel
+43
View File
@@ -643,6 +643,33 @@ export type EnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type FloatFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
}
export type FloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
@@ -1218,4 +1245,20 @@ export type NestedEnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never>
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
}
export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
_count?: Prisma.NestedIntFilter<$PrismaModel>
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
_min?: Prisma.NestedFloatFilter<$PrismaModel>
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
File diff suppressed because one or more lines are too long
+95 -2
View File
@@ -416,7 +416,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -432,7 +433,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken"
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage"
txIsolationLevel: TransactionIsolationLevel
}
model: {
@@ -2878,6 +2879,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
AiUsage: {
payload: Prisma.$AiUsagePayload<ExtArgs>
fields: Prisma.AiUsageFieldRefs
operations: {
findUnique: {
args: Prisma.AiUsageFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findUniqueOrThrow: {
args: Prisma.AiUsageFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findFirst: {
args: Prisma.AiUsageFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
}
findFirstOrThrow: {
args: Prisma.AiUsageFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
findMany: {
args: Prisma.AiUsageFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
create: {
args: Prisma.AiUsageCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
createMany: {
args: Prisma.AiUsageCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.AiUsageCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
delete: {
args: Prisma.AiUsageDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
update: {
args: Prisma.AiUsageUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
deleteMany: {
args: Prisma.AiUsageDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.AiUsageUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.AiUsageUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
}
upsert: {
args: Prisma.AiUsageUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
}
aggregate: {
args: Prisma.AiUsageAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateAiUsage>
}
groupBy: {
args: Prisma.AiUsageGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageGroupByOutputType>[]
}
count: {
args: Prisma.AiUsageCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AiUsageCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
@@ -3392,6 +3467,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
@@ -3889,6 +3981,7 @@ export type GlobalOmitConfig = {
provider?: Prisma.ProviderOmit
collection?: Prisma.CollectionOmit
apiToken?: Prisma.ApiTokenOmit
aiUsage?: Prisma.AiUsageOmit
}
/* Types for Logging */
@@ -83,7 +83,8 @@ export const ModelName = {
Model: 'Model',
Provider: 'Provider',
Collection: 'Collection',
ApiToken: 'ApiToken'
ApiToken: 'ApiToken',
AiUsage: 'AiUsage'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -577,6 +578,23 @@ export const ApiTokenScalarFieldEnum = {
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
export const AiUsageScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
inputTokens: 'inputTokens',
outputTokens: 'outputTokens',
cacheReadTokens: 'cacheReadTokens',
totalTokens: 'totalTokens',
cost: 'cost',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
+1
View File
@@ -41,4 +41,5 @@ export type * from './models/Model.ts'
export type * from './models/Provider.ts'
export type * from './models/Collection.ts'
export type * from './models/ApiToken.ts'
export type * from './models/AiUsage.ts'
export type * from './commonInputTypes.ts'
File diff suppressed because it is too large Load Diff
+194
View File
@@ -199,6 +199,7 @@ export type TeamWhereInput = {
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}
export type TeamOrderByWithRelationInput = {
@@ -219,6 +220,7 @@ export type TeamOrderByWithRelationInput = {
skills?: Prisma.SkillOrderByRelationAggregateInput
sandbox?: Prisma.SandboxOrderByWithRelationInput
agents?: Prisma.AgentOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
}
export type TeamWhereUniqueInput = Prisma.AtLeast<{
@@ -242,6 +244,7 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
skills?: Prisma.SkillListRelationFilter
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
agents?: Prisma.AgentListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}, "id" | "rootFolderId">
export type TeamOrderByWithAggregationInput = {
@@ -285,6 +288,7 @@ export type TeamCreateInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateInput = {
@@ -304,6 +308,7 @@ export type TeamUncheckedCreateInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamUpdateInput = {
@@ -323,6 +328,7 @@ export type TeamUpdateInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateInput = {
@@ -342,6 +348,7 @@ export type TeamUncheckedUpdateInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateManyInput = {
@@ -579,6 +586,20 @@ export type TeamUpdateOneRequiredWithoutProvidersNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutProvidersInput, Prisma.TeamUpdateWithoutProvidersInput>, Prisma.TeamUncheckedUpdateWithoutProvidersInput>
}
export type TeamCreateNestedOneWithoutAiUsagesInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
}
export type TeamUpdateOneRequiredWithoutAiUsagesNestedInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
upsert?: Prisma.TeamUpsertWithoutAiUsagesInput
connect?: Prisma.TeamWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.TeamUpdateWithoutAiUsagesInput>, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamCreateWithoutSandboxInput = {
id?: string
name: string
@@ -595,6 +616,7 @@ export type TeamCreateWithoutSandboxInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSandboxInput = {
@@ -613,6 +635,7 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSandboxInput = {
@@ -647,6 +670,7 @@ export type TeamUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSandboxInput = {
@@ -665,6 +689,7 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutSkillsInput = {
@@ -683,6 +708,7 @@ export type TeamCreateWithoutSkillsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSkillsInput = {
@@ -701,6 +727,7 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSkillsInput = {
@@ -735,6 +762,7 @@ export type TeamUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSkillsInput = {
@@ -753,6 +781,7 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMembersInput = {
@@ -771,6 +800,7 @@ export type TeamCreateWithoutMembersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMembersInput = {
@@ -789,6 +819,7 @@ export type TeamUncheckedCreateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMembersInput = {
@@ -823,6 +854,7 @@ export type TeamUpdateWithoutMembersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMembersInput = {
@@ -841,6 +873,7 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProjectsInput = {
@@ -859,6 +892,7 @@ export type TeamCreateWithoutProjectsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProjectsInput = {
@@ -877,6 +911,7 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProjectsInput = {
@@ -911,6 +946,7 @@ export type TeamUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProjectsInput = {
@@ -929,6 +965,7 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutRootFolderInput = {
@@ -947,6 +984,7 @@ export type TeamCreateWithoutRootFolderInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutRootFolderInput = {
@@ -965,6 +1003,7 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutRootFolderInput = {
@@ -999,6 +1038,7 @@ export type TeamUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutRootFolderInput = {
@@ -1017,6 +1057,7 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutInvitesInput = {
@@ -1035,6 +1076,7 @@ export type TeamCreateWithoutInvitesInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutInvitesInput = {
@@ -1053,6 +1095,7 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutInvitesInput = {
@@ -1087,6 +1130,7 @@ export type TeamUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutInvitesInput = {
@@ -1105,6 +1149,7 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMetadataFieldsInput = {
@@ -1123,6 +1168,7 @@ export type TeamCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
@@ -1141,6 +1187,7 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
@@ -1175,6 +1222,7 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
@@ -1193,6 +1241,7 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutNotificationsInput = {
@@ -1211,6 +1260,7 @@ export type TeamCreateWithoutNotificationsInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutNotificationsInput = {
@@ -1229,6 +1279,7 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutNotificationsInput = {
@@ -1263,6 +1314,7 @@ export type TeamUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutNotificationsInput = {
@@ -1281,6 +1333,7 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAgentsInput = {
@@ -1299,6 +1352,7 @@ export type TeamCreateWithoutAgentsInput = {
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAgentsInput = {
@@ -1317,6 +1371,7 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAgentsInput = {
@@ -1351,6 +1406,7 @@ export type TeamUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAgentsInput = {
@@ -1369,6 +1425,7 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutUserMetadataInput = {
@@ -1387,6 +1444,7 @@ export type TeamCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutUserMetadataInput = {
@@ -1405,6 +1463,7 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutUserMetadataInput = {
@@ -1439,6 +1498,7 @@ export type TeamUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
@@ -1457,6 +1517,7 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProvidersInput = {
@@ -1475,6 +1536,7 @@ export type TeamCreateWithoutProvidersInput = {
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProvidersInput = {
@@ -1493,6 +1555,7 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProvidersInput = {
@@ -1527,6 +1590,7 @@ export type TeamUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProvidersInput = {
@@ -1545,6 +1609,99 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAiUsagesInput = {
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
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAiUsagesInput = {
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
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAiUsagesInput = {
where: Prisma.TeamWhereUniqueInput
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
}
export type TeamUpsertWithoutAiUsagesInput = {
update: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
where?: Prisma.TeamWhereInput
}
export type TeamUpdateToOneWithWhereWithoutAiUsagesInput = {
where?: Prisma.TeamWhereInput
data: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
}
export type TeamUpdateWithoutAiUsagesInput = {
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
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
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
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
}
@@ -1562,6 +1719,7 @@ export type TeamCountOutputType = {
providers: number
skills: number
agents: number
aiUsages: number
}
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1574,6 +1732,7 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
providers?: boolean | TeamCountOutputTypeCountProvidersArgs
skills?: boolean | TeamCountOutputTypeCountSkillsArgs
agents?: boolean | TeamCountOutputTypeCountAgentsArgs
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
}
/**
@@ -1649,6 +1808,13 @@ export type TeamCountOutputTypeCountAgentsArgs<ExtArgs extends runtime.Types.Ext
where?: Prisma.AgentWhereInput
}
/**
* TeamCountOutputType without action
*/
export type TeamCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AiUsageWhereInput
}
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -1668,6 +1834,7 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["team"]>
@@ -1713,6 +1880,7 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -1736,6 +1904,7 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
skills: Prisma.$SkillPayload<ExtArgs>[]
sandbox: Prisma.$SandboxPayload<ExtArgs> | null
agents: Prisma.$AgentPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -2152,6 +2321,7 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
skills<T extends Prisma.Team$skillsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$skillsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SkillPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
sandbox<T extends Prisma.Team$sandboxArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$sandboxArgs<ExtArgs>>): Prisma.Prisma__SandboxClient<runtime.Types.Result.GetResult<Prisma.$SandboxPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
agents<T extends Prisma.Team$agentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$agentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentPayload<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>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -2841,6 +3011,30 @@ export type Team$agentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArg
distinct?: Prisma.AgentScalarFieldEnum | Prisma.AgentScalarFieldEnum[]
}
/**
* Team.aiUsages
*/
export type Team$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AiUsage
*/
select?: Prisma.AiUsageSelect<ExtArgs> | null
/**
* Omit specific fields from the AiUsage
*/
omit?: Prisma.AiUsageOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AiUsageInclude<ExtArgs> | null
where?: Prisma.AiUsageWhereInput
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
cursor?: Prisma.AiUsageWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
}
/**
* Team without action
*/
+268
View File
@@ -245,6 +245,7 @@ export type UserWhereInput = {
collections?: Prisma.CollectionListRelationFilter
shareLinks?: Prisma.ShareLinkListRelationFilter
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}
export type UserOrderByWithRelationInput = {
@@ -276,6 +277,7 @@ export type UserOrderByWithRelationInput = {
collections?: Prisma.CollectionOrderByRelationAggregateInput
shareLinks?: Prisma.ShareLinkOrderByRelationAggregateInput
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
}
export type UserWhereUniqueInput = Prisma.AtLeast<{
@@ -310,6 +312,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
collections?: Prisma.CollectionListRelationFilter
shareLinks?: Prisma.ShareLinkListRelationFilter
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
}, "id" | "email">
export type UserOrderByWithAggregationInput = {
@@ -375,6 +378,7 @@ export type UserCreateInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateInput = {
@@ -406,6 +410,7 @@ export type UserUncheckedCreateInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserUpdateInput = {
@@ -437,6 +442,7 @@ export type UserUpdateInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateInput = {
@@ -468,6 +474,7 @@ export type UserUncheckedUpdateInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateManyInput = {
@@ -838,6 +845,22 @@ export type UserUpdateOneRequiredWithoutApiTokensNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutApiTokensInput, Prisma.UserUpdateWithoutApiTokensInput>, Prisma.UserUncheckedUpdateWithoutApiTokensInput>
}
export type UserCreateNestedOneWithoutAiUsagesInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
connect?: Prisma.UserWhereUniqueInput
}
export type UserUpdateOneWithoutAiUsagesNestedInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
upsert?: Prisma.UserUpsertWithoutAiUsagesInput
disconnect?: Prisma.UserWhereInput | boolean
delete?: Prisma.UserWhereInput | boolean
connect?: Prisma.UserWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.UserUpdateWithoutAiUsagesInput>, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
}
export type UserCreateWithoutSessionsInput = {
id?: string
type?: $Enums.UserType
@@ -866,6 +889,7 @@ export type UserCreateWithoutSessionsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutSessionsInput = {
@@ -896,6 +920,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutSessionsInput = {
@@ -942,6 +967,7 @@ export type UserUpdateWithoutSessionsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutSessionsInput = {
@@ -972,6 +998,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAccountsInput = {
@@ -1002,6 +1029,7 @@ export type UserCreateWithoutAccountsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAccountsInput = {
@@ -1032,6 +1060,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAccountsInput = {
@@ -1078,6 +1107,7 @@ export type UserUpdateWithoutAccountsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAccountsInput = {
@@ -1108,6 +1138,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAuthTokensInput = {
@@ -1138,6 +1169,7 @@ export type UserCreateWithoutAuthTokensInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAuthTokensInput = {
@@ -1168,6 +1200,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAuthTokensInput = {
@@ -1214,6 +1247,7 @@ export type UserUpdateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAuthTokensInput = {
@@ -1244,6 +1278,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTeamMembersInput = {
@@ -1274,6 +1309,7 @@ export type UserCreateWithoutTeamMembersInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTeamMembersInput = {
@@ -1304,6 +1340,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTeamMembersInput = {
@@ -1350,6 +1387,7 @@ export type UserUpdateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTeamMembersInput = {
@@ -1380,6 +1418,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutShareLinksInput = {
@@ -1410,6 +1449,7 @@ export type UserCreateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutShareLinksInput = {
@@ -1440,6 +1480,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutShareLinksInput = {
@@ -1486,6 +1527,7 @@ export type UserUpdateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutShareLinksInput = {
@@ -1516,6 +1558,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAssetsInput = {
@@ -1546,6 +1589,7 @@ export type UserCreateWithoutAssetsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAssetsInput = {
@@ -1576,6 +1620,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAssetsInput = {
@@ -1622,6 +1667,7 @@ export type UserUpdateWithoutAssetsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAssetsInput = {
@@ -1652,6 +1698,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCommentsInput = {
@@ -1682,6 +1729,7 @@ export type UserCreateWithoutCommentsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCommentsInput = {
@@ -1712,6 +1760,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCommentsInput = {
@@ -1747,6 +1796,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
@@ -1777,6 +1827,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
@@ -1823,6 +1874,7 @@ export type UserUpdateWithoutCommentsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCommentsInput = {
@@ -1853,6 +1905,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutCompletionChangedCommentsInput = {
@@ -1894,6 +1947,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
@@ -1924,6 +1978,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedInvitesInput = {
@@ -1954,6 +2009,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
@@ -1984,6 +2040,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
@@ -2030,6 +2087,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
@@ -2060,6 +2118,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedNotificationsInput = {
@@ -2090,6 +2149,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
@@ -2120,6 +2180,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
@@ -2155,6 +2216,7 @@ export type UserCreateWithoutNotificationsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutNotificationsInput = {
@@ -2185,6 +2247,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutNotificationsInput = {
@@ -2231,6 +2294,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
@@ -2261,6 +2325,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutNotificationsInput = {
@@ -2302,6 +2367,7 @@ export type UserUpdateWithoutNotificationsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutNotificationsInput = {
@@ -2332,6 +2398,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTasksInput = {
@@ -2362,6 +2429,7 @@ export type UserCreateWithoutTasksInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTasksInput = {
@@ -2392,6 +2460,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTasksInput = {
@@ -2438,6 +2507,7 @@ export type UserUpdateWithoutTasksInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTasksInput = {
@@ -2468,6 +2538,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentInput = {
@@ -2498,6 +2569,7 @@ export type UserCreateWithoutAgentInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentInput = {
@@ -2528,6 +2600,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentInput = {
@@ -2574,6 +2647,7 @@ export type UserUpdateWithoutAgentInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentInput = {
@@ -2604,6 +2678,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentSessionsInput = {
@@ -2634,6 +2709,7 @@ export type UserCreateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentSessionsInput = {
@@ -2664,6 +2740,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentSessionsInput = {
@@ -2710,6 +2787,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
@@ -2740,6 +2818,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutUserMetadataInput = {
@@ -2770,6 +2849,7 @@ export type UserCreateWithoutUserMetadataInput = {
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutUserMetadataInput = {
@@ -2800,6 +2880,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutUserMetadataInput = {
@@ -2846,6 +2927,7 @@ export type UserUpdateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutUserMetadataInput = {
@@ -2876,6 +2958,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCollectionsInput = {
@@ -2906,6 +2989,7 @@ export type UserCreateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCollectionsInput = {
@@ -2936,6 +3020,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCollectionsInput = {
@@ -2982,6 +3067,7 @@ export type UserUpdateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCollectionsInput = {
@@ -3012,6 +3098,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutApiTokensInput = {
@@ -3042,6 +3129,7 @@ export type UserCreateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutApiTokensInput = {
@@ -3072,6 +3160,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutApiTokensInput = {
@@ -3118,6 +3207,7 @@ export type UserUpdateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutApiTokensInput = {
@@ -3148,6 +3238,147 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAiUsagesInput = {
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
}
export type UserUncheckedCreateWithoutAiUsagesInput = {
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
}
export type UserCreateOrConnectWithoutAiUsagesInput = {
where: Prisma.UserWhereUniqueInput
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
}
export type UserUpsertWithoutAiUsagesInput = {
update: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
where?: Prisma.UserWhereInput
}
export type UserUpdateToOneWithWhereWithoutAiUsagesInput = {
where?: Prisma.UserWhereInput
data: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
}
export type UserUpdateWithoutAiUsagesInput = {
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
}
export type UserUncheckedUpdateWithoutAiUsagesInput = {
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
}
@@ -3172,6 +3403,7 @@ export type UserCountOutputType = {
collections: number
shareLinks: number
apiTokens: number
aiUsages: number
}
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -3191,6 +3423,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
collections?: boolean | UserCountOutputTypeCountCollectionsArgs
shareLinks?: boolean | UserCountOutputTypeCountShareLinksArgs
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
}
/**
@@ -3315,6 +3548,13 @@ export type UserCountOutputTypeCountApiTokensArgs<ExtArgs extends runtime.Types.
where?: Prisma.ApiTokenWhereInput
}
/**
* UserCountOutputType without action
*/
export type UserCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AiUsageWhereInput
}
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -3345,6 +3585,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["user"]>
@@ -3409,6 +3650,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
@@ -3434,6 +3676,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
collections: Prisma.$CollectionPayload<ExtArgs>[]
shareLinks: Prisma.$ShareLinkPayload<ExtArgs>[]
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -3861,6 +4104,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
collections<T extends Prisma.User$collectionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$collectionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$CollectionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
shareLinks<T extends Prisma.User$shareLinksArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$shareLinksArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<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>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -4696,6 +4940,30 @@ export type User$apiTokensArgs<ExtArgs extends runtime.Types.Extensions.Internal
distinct?: Prisma.ApiTokenScalarFieldEnum | Prisma.ApiTokenScalarFieldEnum[]
}
/**
* User.aiUsages
*/
export type User$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AiUsage
*/
select?: Prisma.AiUsageSelect<ExtArgs> | null
/**
* Omit specific fields from the AiUsage
*/
omit?: Prisma.AiUsageOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AiUsageInclude<ExtArgs> | null
where?: Prisma.AiUsageWhereInput
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
cursor?: Prisma.AiUsageWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
}
/**
* User without action
*/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/dtos",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
+31
View File
@@ -14,3 +14,34 @@ export const aiProviderSettingsSchema = z.object({
})
export type AiProviderSettings = z.infer<typeof aiProviderSettingsSchema>
export const timeframeSchema = z.enum(['1h', '24h', '7d', '30d'])
export type Timeframe = z.infer<typeof timeframeSchema>
export const getTeamAiUsageQuerySchema = z.object({
timeframe: timeframeSchema.default('30d'),
userId: z.string().optional(),
})
export type GetTeamAiUsageQuery = z.infer<typeof getTeamAiUsageQuerySchema>
export interface AiUsageMetrics {
inputTokens: number
outputTokens: number
cacheReadTokens: number
totalTokens: number
cost: number
}
export interface MemberAiUsageMetrics extends AiUsageMetrics {
userId: string
userName: string
userEmail: string
userImage?: string | null
role: string
}
export interface TeamUsageStatsResponse {
timeframe: Timeframe
team?: AiUsageMetrics
member?: MemberAiUsageMetrics
}
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/e2e",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"dependencies": {
+81
View File
@@ -224,6 +224,87 @@ describe.each(['local', 'temporal'] as const)(
expect(mediaInfo.thumbnail).toBeDefined()
}, 50000)
it('should run transcodeMedia workflow for a PSD image asset successfully', async () => {
// 1. Seed Database
const team = await prisma.team.create({
data: { name: 'E2E PSD Transcode Team' },
})
const project = await prisma.project.create({
data: { name: 'E2E PSD Transcode Project', teamId: team.id },
})
const storageKey = await prisma.storageKey.create({
data: {
key: 'projects/e2e/test.psd',
},
})
const asset = await prisma.asset.create({
data: {
name: 'test.psd',
type: 'file',
status: 'uploaded',
mediaType: 'image/vnd.adobe.photoshop',
projectId: project.id,
storageKeyId: storageKey.id,
},
})
// 2. Seed S3 Storage from fixture test.psd
const psdPath = path.join(fixturesDir, 'test.psd')
const psdBuffer = fs.readFileSync(psdPath)
await s3Service.putObject(
'shumai-e2e-test-bucket-transcode',
'projects/e2e/test.psd',
psdBuffer,
psdBuffer.length,
'image/vnd.adobe.photoshop',
)
// 3. Create Workflow Task
const task = await prisma.workflowTask.create({
data: {
type: 'transcode_image',
status: 'pending',
assetId: asset.id,
projectId: project.id,
teamId: team.id,
payload: {
projectId: project.id,
transcode: {
thumbnail: true,
},
},
},
})
// 4. Wait for workflow to complete
console.log(
`Submitted E2E PSD Image Transcode Workflow Task. ID: ${task.id}. Awaiting completion...`,
)
const completedTask = await workflowService.executeWait(task, 45000)
// 5. Verification
expect(completedTask.status).toBe('completed')
const updatedAsset = await prisma.asset.findUnique({
where: { id: asset.id },
})
expect(updatedAsset?.status).toBe(AssetStatus.processed)
const mediaInfo = updatedAsset?.media as unknown as {
proxyType: string
imageTranscodes: unknown[]
thumbnail: unknown
}
expect(mediaInfo).toBeDefined()
expect(mediaInfo.proxyType).toBe('image')
expect(mediaInfo.imageTranscodes).toBeDefined()
expect(mediaInfo.imageTranscodes.length).toBeGreaterThan(0)
expect(mediaInfo.thumbnail).toBeDefined()
}, 50000)
it('should run transcodeMedia workflow for an audio asset successfully', async () => {
// 1. Seed Database
const team = await prisma.team.create({
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/tableprinter",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -469,6 +469,21 @@ describe('Transcode Activities', () => {
).rejects.toThrowError(/Image transcoding failed/)
})
it('should throw non-retryable ApplicationFailure when transcodeImageActivity fails with ImageMagick error', async () => {
vi.mocked(s3Service.headObject).mockRejectedValue(new Error('Not found'))
vi.mocked(transcodeService.transcodeImage).mockRejectedValue(
new Error('imagemagick convert failed'),
)
await expect(
transcodeImageActivity({
assetKey: 'i.psd',
filePath: '/tmp/i.psd',
imageSpec: { width: 800, height: 600, quality: 90, format: 'webp' },
}),
).rejects.toThrowError(/Image transcoding failed/)
})
it('should throw non-retryable ApplicationFailure when generateSpriteActivity fails with error', async () => {
vi.mocked(s3Service.headObject).mockRejectedValue(new Error('Not found'))
vi.mocked(transcodeService.generateSprite).mockRejectedValue(new Error('FFmpeg failed'))
@@ -389,6 +389,9 @@ export async function transcodeImageActivity(
code === 'ENOENT' ||
lowerMsg.includes('enoent') ||
lowerMsg.includes('sharp') ||
lowerMsg.includes('imagemagick') ||
lowerMsg.includes('magick') ||
lowerMsg.includes('convert') ||
lowerMsg.includes('spawn') ||
lowerMsg.includes('format')
) {
@@ -0,0 +1,265 @@
import { useState } from 'react'
import { useQuery, useQueries } from '@tanstack/react-query'
import type { Timeframe } from '@shumai/dtos'
import { client } from '@/ui/api/client'
import { m } from '@/ui/paraglide/messages.js'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
import { ToggleGroup, ToggleGroupItem } from '@/ui/components/ui/toggle-group'
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/ui/components/ui/table'
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
import { Loader2 } from 'lucide-react'
interface AiUsageDashboardProps {
teamId: string
}
export function AiUsageDashboard({ teamId }: AiUsageDashboardProps) {
const [viewMode, setViewMode] = useState<'team' | 'members'>('team')
const [timeframe, setTimeframe] = useState<Timeframe>('1h')
// Query team-level usage
const { data: teamUsageData, isLoading: isTeamLoading } = useQuery({
queryKey: ['teams', teamId, 'ai-usage', timeframe, 'team'],
queryFn: async () => {
const res = await client.api.teams[':teamId']['ai-usage'].$get({
param: { teamId },
query: { timeframe },
})
if (!res.ok) throw new Error('Failed to fetch team AI usage')
return await res.json()
},
enabled: !!teamId && viewMode === 'team',
})
// Query member list for members view
const { data: members, isLoading: isMembersListLoading } = useQuery({
queryKey: ['teams', teamId, 'members'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].members.$get({
param: { teamId },
query: {},
})
if (!res.ok) throw new Error('Failed to fetch team members')
return await res.json()
},
enabled: !!teamId && viewMode === 'members',
})
// Query each member's AI usage in parallel
const memberUsageQueries = useQueries({
queries: (members || []).map((member) => ({
queryKey: ['teams', teamId, 'ai-usage', timeframe, member.id],
queryFn: async () => {
const res = await client.api.teams[':teamId']['ai-usage'].$get({
param: { teamId },
query: { timeframe, userId: member.id },
})
if (!res.ok) throw new Error(`Failed to fetch AI usage for member ${member.id}`)
return await res.json()
},
enabled: !!teamId && viewMode === 'members',
})),
})
const isMembersLoading = isMembersListLoading || memberUsageQueries.some((q) => q.isLoading)
const getInitials = (name?: string) => {
if (!name) return 'U'
const names = name.split(' ')
if (names.length > 1) {
return `${names[0][0]}${names[names.length - 1][0]}`.toUpperCase()
}
return name.substring(0, 2).toUpperCase()
}
const localizeRole = (role?: string) => {
if (!role) return ''
switch (role.toLowerCase()) {
case 'owner':
return m.owner()
case 'editor':
return m.editor()
case 'reviewer':
return m.reviewer()
default:
return role
}
}
const formatTokens = (val?: number) => (val ?? 0).toLocaleString()
const formatCost = (val?: number) => `$${(val ?? 0).toFixed(6)}`
return (
<Card className="border-border/60 shadow-sm">
<CardHeader className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6">
<div>
<CardTitle className="text-xl font-semibold tracking-tight">{m.ai_usage()}</CardTitle>
<CardDescription className="text-sm text-muted-foreground mt-1">
{m.ai_usage_description()}
</CardDescription>
</div>
<div className="flex flex-wrap items-center gap-3">
<ToggleGroup
type="single"
value={viewMode}
onValueChange={(val) => {
if (val) setViewMode(val as 'team' | 'members')
}}
className="border rounded-lg p-1 bg-muted/30"
>
<ToggleGroupItem value="team" className="px-3 py-1.5 text-xs font-medium">
{m.team_view()}
</ToggleGroupItem>
<ToggleGroupItem value="members" className="px-3 py-1.5 text-xs font-medium">
{m.members_view()}
</ToggleGroupItem>
</ToggleGroup>
<ToggleGroup
type="single"
value={timeframe}
onValueChange={(val) => {
if (val) setTimeframe(val as Timeframe)
}}
className="border rounded-lg p-1 bg-muted/30"
>
<ToggleGroupItem value="1h" className="px-2.5 py-1.5 text-xs font-medium">
1h
</ToggleGroupItem>
<ToggleGroupItem value="24h" className="px-2.5 py-1.5 text-xs font-medium">
24h
</ToggleGroupItem>
<ToggleGroupItem value="7d" className="px-2.5 py-1.5 text-xs font-medium">
7d
</ToggleGroupItem>
<ToggleGroupItem value="30d" className="px-2.5 py-1.5 text-xs font-medium">
30d
</ToggleGroupItem>
</ToggleGroup>
</div>
</CardHeader>
<CardContent>
{viewMode === 'team' ? (
isTeamLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : (
<div className="rounded-md border">
<Table>
<TableHeader>
<TableRow>
<TableHead>{m.team()}</TableHead>
<TableHead className="text-right">{m.input_tokens()}</TableHead>
<TableHead className="text-right">{m.output_tokens()}</TableHead>
<TableHead className="text-right">{m.cache_read_tokens()}</TableHead>
<TableHead className="text-right">{m.total_tokens()}</TableHead>
<TableHead className="text-right">{m.cost()}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell className="font-medium">{m.team()}</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.inputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.outputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(teamUsageData?.team?.cacheReadTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatTokens(teamUsageData?.team?.totalTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatCost(teamUsageData?.team?.cost)}
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
)
) : isMembersLoading ? (
<div className="flex h-48 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : (
<div className="rounded-md border">
<Table>
<TableHeader>
<TableRow>
<TableHead>{m.members()}</TableHead>
<TableHead>{m.role()}</TableHead>
<TableHead className="text-right">{m.input_tokens()}</TableHead>
<TableHead className="text-right">{m.output_tokens()}</TableHead>
<TableHead className="text-right">{m.cache_read_tokens()}</TableHead>
<TableHead className="text-right">{m.total_tokens()}</TableHead>
<TableHead className="text-right">{m.cost()}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{(members || []).map((member, idx) => {
const usageResult = memberUsageQueries[idx]?.data?.member
return (
<TableRow key={member.id}>
<TableCell>
<div className="flex items-center gap-3">
<Avatar className="h-8 w-8 rounded-full">
{member.image && (
<AvatarImage
src={member.image}
alt={member.name}
className="object-cover"
/>
)}
<AvatarFallback className="bg-primary/20 text-xs">
{getInitials(member.name)}
</AvatarFallback>
</Avatar>
<div className="flex flex-col">
<span className="text-sm font-medium leading-none">{member.name}</span>
<span className="text-xs text-muted-foreground mt-0.5">
{member.email}
</span>
</div>
</div>
</TableCell>
<TableCell className="text-xs text-muted-foreground">
{localizeRole(member.role)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.inputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.outputTokens)}
</TableCell>
<TableCell className="text-right">
{formatTokens(usageResult?.cacheReadTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatTokens(usageResult?.totalTokens)}
</TableCell>
<TableCell className="text-right font-medium">
{formatCost(usageResult?.cost)}
</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
</div>
)}
</CardContent>
</Card>
)
}
@@ -540,6 +540,9 @@ export function FileBrowser({
queryClient.invalidateQueries({
queryKey: ['search', teamId, assetId],
})
queryClient.invalidateQueries({
queryKey: ['teams', teamId, 'upload', 'tasks'],
})
// The RPC client returns an object that we cast to the expected type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -547,6 +550,9 @@ export function FileBrowser({
queryClient.invalidateQueries({
queryKey: ['search', teamId, assetId],
})
queryClient.invalidateQueries({
queryKey: ['teams', teamId, 'upload', 'tasks'],
})
},
})
@@ -380,8 +380,8 @@ export function SearchFilterDialog({
</div>
{/* Results Body ported from Demo */}
<ScrollArea className="flex-1 min-h-0 bg-background">
<div className="p-4 md:p-5">
<ScrollArea className="flex-1 min-h-0 bg-background [&>div>div]:block!">
<div className="p-4 md:p-5 min-w-0">
<div className="flex items-center justify-between mb-3 px-1">
<span className="text-[11px] font-bold uppercase tracking-wider text-muted-foreground/60 font-mono">
{m.search_results()}
@@ -394,7 +394,7 @@ export function SearchFilterDialog({
)}
</div>
<div className="flex flex-col border border-border rounded-xl divide-y divide-border overflow-hidden">
<div className="flex flex-col border border-border rounded-xl divide-y divide-border overflow-hidden min-w-0">
{!hasActiveCriteria ? (
<div className="py-20 text-center flex flex-col items-center justify-center bg-muted/20 px-4">
<Search className="w-10 h-10 text-muted-foreground/30 mb-2" />
@@ -449,7 +449,7 @@ export function SearchFilterDialog({
<div
key={record.id}
onClick={() => handleResultClick(record)}
className="p-3.5 flex items-center gap-3 hover:bg-muted/40 transition-colors group/record cursor-pointer"
className="p-3.5 flex items-center gap-3 hover:bg-muted/40 transition-colors group/record cursor-pointer min-w-0"
>
<div
className={cn(
@@ -471,8 +471,8 @@ export function SearchFilterDialog({
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center justify-between gap-3">
<div className="truncate">
<div className="flex items-center justify-between gap-3 min-w-0">
<div className="flex-1 min-w-0">
<span className="font-medium text-sm text-foreground group-hover/record:text-primary transition-colors block truncate">
{record.name}
</span>
@@ -485,7 +485,7 @@ export function SearchFilterDialog({
record.startTime !== null &&
record.endTime !== undefined &&
record.endTime !== null && (
<span className="text-[10px] font-semibold text-primary bg-primary/10 border border-primary/20 px-1.5 py-0.5 rounded mt-1 inline-block">
<span className="text-[10px] font-semibold text-primary bg-primary/10 border border-primary/20 px-1.5 py-0.5 rounded mt-1 inline-block max-w-full truncate">
{m.match_found_at()} {formatTimestamp(record.startTime)} -{' '}
{formatTimestamp(record.endTime)}
</span>
+13
View File
@@ -146,6 +146,19 @@ export function UserMenu() {
</DropdownMenuPortal>
</DropdownMenuSub>
<DropdownMenuSeparator />
{me?.role?.toLowerCase() === 'owner' && (
<DropdownMenuItem
onClick={() =>
navigate({
to: '/teams/$teamId/dashboard',
params: { teamId: teamId! },
})
}
disabled={!teamId}
>
{m.dashboard()}
</DropdownMenuItem>
)}
<DropdownMenuItem
onClick={() =>
navigate({
+14 -1
View File
@@ -870,5 +870,18 @@
"no_chat_agents_warning": "No chat agents found. Please create a Chat Agent below first.",
"select_agent": "Select Agent",
"delete_comment_confirm": "Delete Comment?",
"delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone."
"delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone.",
"ai_usage": "AI Token Usage",
"ai_usage_description": "Monitor AI token consumption and estimated costs for your team and members.",
"usage": "Usage",
"input_tokens": "Input Tokens",
"output_tokens": "Output Tokens",
"cache_read_tokens": "Cache Read Tokens",
"total_tokens": "Total Tokens",
"cost": "Cost",
"team_view": "Team",
"members_view": "Members",
"access_denied": "Access Denied",
"only_owner_dashboard": "Only team owners can access the dashboard.",
"role": "Role"
}
+14 -1
View File
@@ -870,5 +870,18 @@
"no_chat_agents_warning": "未找到聊天智能体。请先在下方创建聊天智能体。",
"select_agent": "选择智能体",
"delete_comment_confirm": "删除评论?",
"delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。"
"delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。",
"ai_usage": "AI Token 用量",
"ai_usage_description": "查看并监控团队及成员的 AI Token 消耗与预估费用。",
"usage": "用量",
"input_tokens": "输入 Token",
"output_tokens": "输出 Token",
"cache_read_tokens": "缓存读取 Token",
"total_tokens": "总 Token",
"cost": "费用",
"team_view": "团队",
"members_view": "成员",
"access_denied": "访问被拒绝",
"only_owner_dashboard": "只有团队所有者才能访问仪表盘。",
"role": "角色"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/webui",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./index.html",
+13
View File
@@ -817,4 +817,17 @@ export * from "./no_chat_agents_warning.js";
export * from "./select_agent.js";
export * from "./delete_comment_confirm.js";
export * from "./delete_comment_description.js";
export * from "./ai_usage.js";
export * from "./ai_usage_description.js";
export * from "./usage.js";
export * from "./input_tokens.js";
export * from "./output_tokens.js";
export * from "./cache_read_tokens.js";
export * from "./total_tokens.js";
export * from "./cost.js";
export * from "./team_view.js";
export * from "./members_view.js";
export * from "./access_denied.js";
export * from "./only_owner_dashboard.js";
export * from "./role.js";
export type LocalizedString = import("../runtime.js").LocalizedString;
+14 -1
View File
@@ -818,4 +818,17 @@ export * from './select_chatbot_agent.js'
export * from './no_chat_agents_warning.js'
export * from './select_agent.js'
export * from './delete_comment_confirm.js'
export * from './delete_comment_description.js'
export * from './delete_comment_description.js'
export * from './ai_usage.js'
export * from './ai_usage_description.js'
export * from './usage.js'
export * from './input_tokens.js'
export * from './output_tokens.js'
export * from './cache_read_tokens.js'
export * from './total_tokens.js'
export * from './cost.js'
export * from './team_view.js'
export * from './members_view.js'
export * from './access_denied.js'
export * from './only_owner_dashboard.js'
export * from './role.js'
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Access Denied" |
*
* @param {Access_DeniedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const access_denied: ((inputs?: Access_DeniedInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Access_DeniedInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Access_DeniedInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Access_DeniedInputs */
const en_access_denied = /** @type {(inputs: Access_DeniedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Access Denied`)
};
const zh_access_denied = /** @type {(inputs: Access_DeniedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`访问被拒绝`)
};
/**
* | output |
* | --- |
* | "Access Denied" |
*
* @param {Access_DeniedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const access_denied = /** @type {((inputs?: Access_DeniedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Access_DeniedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_access_denied(inputs)
return zh_access_denied(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "AI Token Usage" |
*
* @param {Ai_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage: ((inputs?: Ai_UsageInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Ai_UsageInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Ai_UsageInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Ai_UsageInputs */
const en_ai_usage = /** @type {(inputs: Ai_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`AI Token Usage`)
};
const zh_ai_usage = /** @type {(inputs: Ai_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`AI Token 用量`)
};
/**
* | output |
* | --- |
* | "AI Token Usage" |
*
* @param {Ai_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage = /** @type {((inputs?: Ai_UsageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Ai_UsageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_ai_usage(inputs)
return zh_ai_usage(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Monitor AI token consumption and estimated costs for your team and members." |
*
* @param {Ai_Usage_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage_description: ((inputs?: Ai_Usage_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Ai_Usage_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Ai_Usage_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Ai_Usage_DescriptionInputs */
const en_ai_usage_description = /** @type {(inputs: Ai_Usage_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Monitor AI token consumption and estimated costs for your team and members.`)
};
const zh_ai_usage_description = /** @type {(inputs: Ai_Usage_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`查看并监控团队及成员的 AI Token 消耗与预估费用。`)
};
/**
* | output |
* | --- |
* | "Monitor AI token consumption and estimated costs for your team and members." |
*
* @param {Ai_Usage_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const ai_usage_description = /** @type {((inputs?: Ai_Usage_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Ai_Usage_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_ai_usage_description(inputs)
return zh_ai_usage_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Cache Read Tokens" |
*
* @param {Cache_Read_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cache_read_tokens: ((inputs?: Cache_Read_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cache_Read_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Cache_Read_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Cache_Read_TokensInputs */
const en_cache_read_tokens = /** @type {(inputs: Cache_Read_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Cache Read Tokens`)
};
const zh_cache_read_tokens = /** @type {(inputs: Cache_Read_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`缓存读取 Token`)
};
/**
* | output |
* | --- |
* | "Cache Read Tokens" |
*
* @param {Cache_Read_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cache_read_tokens = /** @type {((inputs?: Cache_Read_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cache_Read_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_cache_read_tokens(inputs)
return zh_cache_read_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Cost" |
*
* @param {CostInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cost: ((inputs?: CostInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<CostInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type CostInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} CostInputs */
const en_cost = /** @type {(inputs: CostInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Cost`)
};
const zh_cost = /** @type {(inputs: CostInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`费用`)
};
/**
* | output |
* | --- |
* | "Cost" |
*
* @param {CostInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const cost = /** @type {((inputs?: CostInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<CostInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_cost(inputs)
return zh_cost(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Input Tokens" |
*
* @param {Input_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const input_tokens: ((inputs?: Input_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Input_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Input_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Input_TokensInputs */
const en_input_tokens = /** @type {(inputs: Input_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Input Tokens`)
};
const zh_input_tokens = /** @type {(inputs: Input_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输入 Token`)
};
/**
* | output |
* | --- |
* | "Input Tokens" |
*
* @param {Input_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const input_tokens = /** @type {((inputs?: Input_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Input_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_input_tokens(inputs)
return zh_input_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Members" |
*
* @param {Members_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const members_view: ((inputs?: Members_ViewInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Members_ViewInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Members_ViewInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Members_ViewInputs */
const en_members_view = /** @type {(inputs: Members_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Members`)
};
const zh_members_view = /** @type {(inputs: Members_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`成员`)
};
/**
* | output |
* | --- |
* | "Members" |
*
* @param {Members_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const members_view = /** @type {((inputs?: Members_ViewInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Members_ViewInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_members_view(inputs)
return zh_members_view(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Only team owners can access the dashboard." |
*
* @param {Only_Owner_DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const only_owner_dashboard: ((inputs?: Only_Owner_DashboardInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Only_Owner_DashboardInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Only_Owner_DashboardInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Only_Owner_DashboardInputs */
const en_only_owner_dashboard = /** @type {(inputs: Only_Owner_DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Only team owners can access the dashboard.`)
};
const zh_only_owner_dashboard = /** @type {(inputs: Only_Owner_DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`只有团队所有者才能访问仪表盘。`)
};
/**
* | output |
* | --- |
* | "Only team owners can access the dashboard." |
*
* @param {Only_Owner_DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const only_owner_dashboard = /** @type {((inputs?: Only_Owner_DashboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Only_Owner_DashboardInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_only_owner_dashboard(inputs)
return zh_only_owner_dashboard(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Output Tokens" |
*
* @param {Output_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const output_tokens: ((inputs?: Output_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Output_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Output_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Output_TokensInputs */
const en_output_tokens = /** @type {(inputs: Output_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Output Tokens`)
};
const zh_output_tokens = /** @type {(inputs: Output_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输出 Token`)
};
/**
* | output |
* | --- |
* | "Output Tokens" |
*
* @param {Output_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const output_tokens = /** @type {((inputs?: Output_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Output_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_output_tokens(inputs)
return zh_output_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Role" |
*
* @param {RoleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const role: ((inputs?: RoleInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<RoleInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type RoleInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} RoleInputs */
const en_role = /** @type {(inputs: RoleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Role`)
};
const zh_role = /** @type {(inputs: RoleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`角色`)
};
/**
* | output |
* | --- |
* | "Role" |
*
* @param {RoleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const role = /** @type {((inputs?: RoleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<RoleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_role(inputs)
return zh_role(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Team" |
*
* @param {Team_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const team_view: ((inputs?: Team_ViewInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Team_ViewInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Team_ViewInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Team_ViewInputs */
const en_team_view = /** @type {(inputs: Team_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Team`)
};
const zh_team_view = /** @type {(inputs: Team_ViewInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`团队`)
};
/**
* | output |
* | --- |
* | "Team" |
*
* @param {Team_ViewInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const team_view = /** @type {((inputs?: Team_ViewInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Team_ViewInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_team_view(inputs)
return zh_team_view(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Total Tokens" |
*
* @param {Total_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const total_tokens: ((inputs?: Total_TokensInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Total_TokensInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Total_TokensInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Total_TokensInputs */
const en_total_tokens = /** @type {(inputs: Total_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Total Tokens`)
};
const zh_total_tokens = /** @type {(inputs: Total_TokensInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`总 Token`)
};
/**
* | output |
* | --- |
* | "Total Tokens" |
*
* @param {Total_TokensInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const total_tokens = /** @type {((inputs?: Total_TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Total_TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_total_tokens(inputs)
return zh_total_tokens(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Usage" |
*
* @param {UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const usage: ((inputs?: UsageInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<UsageInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type UsageInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} UsageInputs */
const en_usage = /** @type {(inputs: UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Usage`)
};
const zh_usage = /** @type {(inputs: UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`用量`)
};
/**
* | output |
* | --- |
* | "Usage" |
*
* @param {UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const usage = /** @type {((inputs?: UsageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<UsageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_usage(inputs)
return zh_usage(inputs)
});
+21
View File
@@ -17,6 +17,7 @@ import { Route as TeamsTeamIdIndexRouteImport } from './routes/teams/$teamId/ind
import { Route as ShareShareIdIndexRouteImport } from './routes/share/$shareId/index'
import { Route as ProjectsProjectIdIndexRouteImport } from './routes/projects/$projectId/index'
import { Route as TeamsTeamIdSettingsRouteImport } from './routes/teams/$teamId/settings'
import { Route as TeamsTeamIdDashboardRouteImport } from './routes/teams/$teamId/dashboard'
import { Route as ProjectsProjectIdRecentlyDeletedRouteImport } from './routes/projects/$projectId/recently-deleted'
import { Route as ProjectsProjectIdSharesIndexRouteImport } from './routes/projects/$projectId/shares/index'
import { Route as ProjectsProjectIdCollectionsIndexRouteImport } from './routes/projects/$projectId/collections/index'
@@ -67,6 +68,11 @@ const TeamsTeamIdSettingsRoute = TeamsTeamIdSettingsRouteImport.update({
path: '/teams/$teamId/settings',
getParentRoute: () => rootRouteImport,
} as any).lazy(() => import('./routes/teams/$teamId/settings.lazy').then((d) => d.Route))
const TeamsTeamIdDashboardRoute = TeamsTeamIdDashboardRouteImport.update({
id: '/teams/$teamId/dashboard',
path: '/teams/$teamId/dashboard',
getParentRoute: () => rootRouteImport,
} as any).lazy(() => import('./routes/teams/$teamId/dashboard.lazy').then((d) => d.Route))
const ProjectsProjectIdRecentlyDeletedRoute = ProjectsProjectIdRecentlyDeletedRouteImport.update({
id: '/projects/$projectId/recently-deleted',
path: '/projects/$projectId/recently-deleted',
@@ -130,6 +136,7 @@ export interface FileRoutesByFullPath {
'/signup': typeof SignupRoute
'/share/$shareId': typeof ShareShareIdRouteWithChildren
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId/': typeof ProjectsProjectIdIndexRoute
'/share/$shareId/': typeof ShareShareIdIndexRoute
@@ -148,6 +155,7 @@ export interface FileRoutesByTo {
'/login': typeof LoginRoute
'/signup': typeof SignupRoute
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId': typeof ProjectsProjectIdIndexRoute
'/share/$shareId': typeof ShareShareIdIndexRoute
@@ -168,6 +176,7 @@ export interface FileRoutesById {
'/signup': typeof SignupRoute
'/share/$shareId': typeof ShareShareIdRouteWithChildren
'/projects/$projectId/recently-deleted': typeof ProjectsProjectIdRecentlyDeletedRoute
'/teams/$teamId/dashboard': typeof TeamsTeamIdDashboardRoute
'/teams/$teamId/settings': typeof TeamsTeamIdSettingsRoute
'/projects/$projectId/': typeof ProjectsProjectIdIndexRoute
'/share/$shareId/': typeof ShareShareIdIndexRoute
@@ -189,6 +198,7 @@ export interface FileRouteTypes {
| '/signup'
| '/share/$shareId'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId/'
| '/share/$shareId/'
@@ -207,6 +217,7 @@ export interface FileRouteTypes {
| '/login'
| '/signup'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId'
| '/share/$shareId'
@@ -226,6 +237,7 @@ export interface FileRouteTypes {
| '/signup'
| '/share/$shareId'
| '/projects/$projectId/recently-deleted'
| '/teams/$teamId/dashboard'
| '/teams/$teamId/settings'
| '/projects/$projectId/'
| '/share/$shareId/'
@@ -246,6 +258,7 @@ export interface RootRouteChildren {
SignupRoute: typeof SignupRoute
ShareShareIdRoute: typeof ShareShareIdRouteWithChildren
ProjectsProjectIdRecentlyDeletedRoute: typeof ProjectsProjectIdRecentlyDeletedRoute
TeamsTeamIdDashboardRoute: typeof TeamsTeamIdDashboardRoute
TeamsTeamIdSettingsRoute: typeof TeamsTeamIdSettingsRoute
ProjectsProjectIdIndexRoute: typeof ProjectsProjectIdIndexRoute
TeamsTeamIdIndexRoute: typeof TeamsTeamIdIndexRoute
@@ -315,6 +328,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof TeamsTeamIdSettingsRouteImport
parentRoute: typeof rootRouteImport
}
'/teams/$teamId/dashboard': {
id: '/teams/$teamId/dashboard'
path: '/teams/$teamId/dashboard'
fullPath: '/teams/$teamId/dashboard'
preLoaderRoute: typeof TeamsTeamIdDashboardRouteImport
parentRoute: typeof rootRouteImport
}
'/projects/$projectId/recently-deleted': {
id: '/projects/$projectId/recently-deleted'
path: '/projects/$projectId/recently-deleted'
@@ -401,6 +421,7 @@ const rootRouteChildren: RootRouteChildren = {
SignupRoute: SignupRoute,
ShareShareIdRoute: ShareShareIdRouteWithChildren,
ProjectsProjectIdRecentlyDeletedRoute: ProjectsProjectIdRecentlyDeletedRoute,
TeamsTeamIdDashboardRoute: TeamsTeamIdDashboardRoute,
TeamsTeamIdSettingsRoute: TeamsTeamIdSettingsRoute,
ProjectsProjectIdIndexRoute: ProjectsProjectIdIndexRoute,
TeamsTeamIdIndexRoute: TeamsTeamIdIndexRoute,
@@ -0,0 +1,91 @@
import { createLazyFileRoute } from '@tanstack/react-router'
import { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import { client } from '@/ui/api/client'
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import { AiUsageDashboard } from '@/ui/components/dashboard/AiUsageDashboard'
import { BarChart2, Loader2, ShieldAlert } from 'lucide-react'
type DashboardTab = 'ai-usage'
function TeamDashboardPage() {
const { teamId } = Route.useParams()
const [activeTab, setActiveTab] = useState<DashboardTab>('ai-usage')
const { data: me, isLoading: isMeLoading } = useQuery({
queryKey: ['teams', teamId, 'me'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].me.$get({
param: { teamId: teamId },
})
if (!res.ok) throw new Error('Failed to fetch me')
return await res.json()
},
enabled: !!teamId,
})
if (isMeLoading) {
return (
<div className="flex h-screen items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
)
}
if (me?.role?.toLowerCase() !== 'owner') {
return (
<div className="flex h-full flex-col items-center justify-center p-8 text-center">
<ShieldAlert className="h-12 w-12 text-destructive mb-4" />
<h2 className="text-xl font-bold tracking-tight mb-2">{m.access_denied()}</h2>
<p className="text-sm text-muted-foreground max-w-md">{m.only_owner_dashboard()}</p>
</div>
)
}
return (
<div className="h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300">
<div className="flex flex-col md:flex-row h-full">
{/* Sidebar */}
<div className="w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300">
<nav className="p-4 space-y-1 mt-4">
<div className="mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider">
{m.dashboard()}
</div>
<div className="mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border">
{m.ai()}
</div>
<button
onClick={() => setActiveTab('ai-usage')}
className={cn(
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
activeTab === 'ai-usage'
? 'bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border'
: 'text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
)}
>
<BarChart2 className="w-5 h-5" />
{m.usage()}
{activeTab === 'ai-usage' && (
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
)}
</button>
</nav>
</div>
{/* Main Content Area */}
<div className="flex-1 overflow-y-auto p-4 md:p-8">
<div className="max-w-6xl mx-auto space-y-8">
{activeTab === 'ai-usage' && <AiUsageDashboard teamId={teamId} />}
</div>
</div>
</div>
</div>
)
}
export const Route = createLazyFileRoute('/teams/$teamId/dashboard')({
component: TeamDashboardPage,
})
@@ -0,0 +1,3 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/teams/$teamId/dashboard')({})
+1 -1
View File
@@ -1 +1 @@
export const APP_VERSION = '0.2.1'
export const APP_VERSION = '0.2.2'
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/workflow-core",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"type": "module",
"main": "./src/index.ts",