feat(quota): add 2-level database-backed resource quota system (#318)

* feat(quota): add database-backed resource quota system

* feat(webui): add resource quota management in team settings (#319)

* feat(webui): add resource quota settings in team management

* refactor(webui): update quotas list to full row layout and restrict skill/mcp to select list

* feat(quota): refactor quota system to 2-level rules and records

* fix(webui): fix overflow and scroll area in quota usage records dialog

* fix(webui): ensure quota records scroll area has explicit max height

* feat(webui): improve quota cards interaction and restrict editable fields in edit mode

* fix(quota): serialize initial records, validate merged updates, and reset on dimension changes (#320)

* feat(quota): replace network quota with agent tools quota (#321)

* feat(webui): show remaining time until next refresh in quota usage records

* fix(webui): rename bash quota resource to Agent Bash Calls

* refactor(quota): remove unused reserved field from quota records

* refactor(quota): remove quota rule cache (#322)
This commit is contained in:
Yiling-J
2026-08-17 20:24:05 +08:00
committed by GitHub
parent dd82daf65c
commit eed0264b9c
200 changed files with 13118 additions and 50 deletions
+1
View File
@@ -63,6 +63,7 @@ apps/web/e2e/
| Owner invites a member via invite link and the invitee joins | `tests/team/invite-member.spec.ts` |
| Owner removes a member via the members dialog; the membership is deleted from the DB | `tests/team/remove-member.spec.ts` |
| Owner changes a team member role in the members dialog and permissions update | `tests/team/change-member-role.spec.ts` |
| Owner manages resource quotas in settings | `tests/team/quotas-settings.spec.ts` |
### project
| Test | File |
@@ -0,0 +1,90 @@
import { expect, test } from '../../fixtures'
test('owner manages resource quotas in settings', async ({ owner, prisma }) => {
const { page, teamId } = owner
// 1. Navigate to team settings
await page.goto(`/teams/${teamId}/settings`)
// 2. Click the Quotas sidebar tab
await page.getByRole('button', { name: /Quotas|配额/i }).click()
// 3. Verify Quotas settings card is displayed with empty state
await expect(page.getByRole('heading', { name: /^(Resource Quotas|资源配额)$/i })).toBeVisible()
await expect(page.getByText(/No resource quotas configured|暂未配置资源配额/i)).toBeVisible()
// 4. Open Create Quota Dialog
await page
.getByRole('button', { name: /Add Quota|添加配额/i })
.first()
.click()
await expect(page.getByText(/Create Quota Rule|创建配额规则/i)).toBeVisible()
// 5. Fill and submit new quota rule
await page.fill('#quota-limit', '50000')
await page.getByRole('button', { name: /^(Create|创建)$/i }).click()
// 6. Verify quota rule card appears in the list
await expect(page.getByText(/50,000 tokens|50000 tokens/i)).toBeVisible()
await expect(page.getByText(/Each Member|每个成员/i)).toBeVisible()
// Verify in database
const createdRule = await prisma.quotaRule.findFirst({
where: { teamId, limit: 50000 },
})
expect(createdRule).not.toBeNull()
expect(createdRule?.enabled).toBe(true)
// 7. Click View Usage button to open usage records dialog
await page.getByRole('button', { name: /View Usage|查看使用量/i }).click()
await expect(page.getByRole('heading', { name: /Usage Records|使用记录/i })).toBeVisible()
await expect(page.getByText(/Quota available|配额可用/i)).toBeVisible()
// Close dialog via Close button
await page.getByRole('button', { name: /Close|关闭/i }).click()
await expect(page.getByRole('heading', { name: /Usage Records|使用记录/i })).not.toBeVisible()
// 8. Toggle quota rule switch
await page.getByRole('switch').click()
await expect(page.getByRole('switch')).not.toBeChecked()
const disabledRule = await prisma.quotaRule.findFirst({
where: { id: createdRule?.id },
})
expect(disabledRule?.enabled).toBe(false)
// Toggle back on
await page.getByRole('switch').click()
await expect(page.getByRole('switch')).toBeChecked()
// 9. Open Edit Dialog by clicking the quota card
await page.getByText(/50,000 tokens|50000 tokens/i).click()
await expect(page.getByText(/Edit Quota Rule|编辑配额规则/i)).toBeVisible()
await expect(page.getByRole('button', { name: /Each Member|每个成员/i })).toBeDisabled()
await expect(page.locator('#quota-resource')).toBeDisabled()
// 10. Update limit
await page.fill('#quota-limit', '75000')
await page.getByRole('button', { name: /^(Save|保存)$/i }).click()
// Verify updated limit in UI and DB
await expect(page.getByText(/75,000 tokens|75000 tokens/i)).toBeVisible()
const updatedRule = await prisma.quotaRule.findFirst({
where: { id: createdRule?.id },
})
expect(updatedRule?.limit).toBe(75000)
// 11. Delete quota rule
await page.getByRole('button', { name: 'Quota actions' }).first().click()
await page.getByRole('menuitem', { name: /Delete|删除/i }).click()
await page
.getByRole('button', { name: /Delete|删除/i })
.last()
.click()
// Verify empty state returns
await expect(page.getByText(/No resource quotas configured|暂未配置资源配额/i)).toBeVisible()
const deletedRule = await prisma.quotaRule.findFirst({
where: { id: createdRule?.id },
})
expect(deletedRule).toBeNull()
})
+80
View File
@@ -33,6 +33,7 @@ import {
} from '../index'
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
import { quotaService, QuotaExceededError } from '@shumai/core/src/quota/quota-service'
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
export interface Usage {
@@ -297,6 +298,39 @@ When creating a file or version, you may attach metadata (for example, the AI mo
let grandTotalTokens = 0
let totalCost = 0
const effectiveRole = params.userId
? await resolveEffectiveRole(params.teamId, params.projectId, params.userId)
: undefined
try {
await quotaService.checkQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_total_tokens',
},
0,
)
await quotaService.checkQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_cost',
},
0,
)
} catch (err) {
if (err instanceof QuotaExceededError) {
throw ApplicationFailure.create({
message: err.message,
nonRetryable: true,
})
}
throw err
}
harness.subscribe(async (event) => {
if (event.type === 'message_end' && event.message.role === 'assistant') {
const assistantMsg = event.message
@@ -327,6 +361,29 @@ When creating a file or version, you may attach metadata (for example, the AI mo
} catch (err) {
logger.error({ err }, 'Failed to record AI usage')
}
try {
await quotaService.consumeQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_total_tokens',
},
totalTokens,
)
await quotaService.consumeQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_cost',
},
cost,
)
} catch (err) {
logger.error({ err }, 'Failed to record quota usage for AI call')
}
}
}
})
@@ -339,6 +396,29 @@ When creating a file or version, you may attach metadata (for example, the AI mo
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
totalCost = assistantMessage.usage.cost?.total || 0
try {
await quotaService.consumeQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_total_tokens',
},
grandTotalTokens,
)
await quotaService.consumeQuota(
{
teamId: params.teamId,
userId: params.userId,
role: effectiveRole,
resource: 'agent_cost',
},
totalCost,
)
} catch (err) {
logger.error({ err }, 'Failed to record fallback quota usage for AI call')
}
}
const sessionEntries = await session.getEntries()
+83
View File
@@ -8,6 +8,7 @@ import {
} from './index'
import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
import { quotaService } from '@shumai/core/src/quota/quota-service'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { type TSchema } from 'typebox'
@@ -1173,4 +1174,86 @@ describe('createAgentSession enabled skill filtering', () => {
initializeSpy.mockRestore()
}
})
it('enforces agent tool call count quota on tool execution', async () => {
const team = await prisma.team.create({ data: { name: 'Tool Quota Enforcement Team' } })
const user = await prisma.user.create({
data: { name: 'Member User', email: 'member-tool-quota@shumai.ai', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: user.id, role: 'editor' },
})
await prisma.user.create({
data: {
id: 'tool-quota-agent',
name: 'Tool Quota Agent',
email: 'tool-quota-agent@shumai.ai',
type: 'agent',
},
})
await prisma.agent.create({
data: {
id: 'tool-quota-agent',
teamId: team.id,
type: 'chat',
config: { provider: 'google', model: 'gemini' },
},
})
await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_tool_call_count',
resourceData: { name: 'read_thread' },
limit: 1,
period: '1hour',
enabled: true,
})
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
try {
const { harness } = await createAgentSession({
teamId: team.id,
userId: user.id,
agentId: 'tool-quota-agent',
providerName: 'google',
modelId: 'gemini',
systemPrompt: 'prompt',
teamSkills: [],
enabledSkillIds: [],
allowedDomains: [],
providers: mockProviders,
})
const readThreadTool = harness.getTools().find((t) => t.name === 'read_thread')
expect(readThreadTool).toBeDefined()
// First call executes and consumes quota
const res1 = await readThreadTool!.execute(
'call-1',
{ threadId: 'non-existent' },
undefined,
undefined,
undefined,
)
expect(res1).toBeDefined()
// Second call exceeds quota and returns error
const res2 = await readThreadTool!.execute(
'call-2',
{ threadId: 'non-existent' },
undefined,
undefined,
undefined,
)
expect(res2).toBeDefined()
const textContent = res2.content[0]
if (textContent && textContent.type === 'text') {
expect(textContent.text).toContain('Quota exceeded')
} else {
expect.unreachable('Expected text content')
}
} finally {
initializeSpy.mockRestore()
}
})
})
+61 -22
View File
@@ -9,7 +9,10 @@ import type { Api, Model } from '@earendil-works/pi-ai'
import { createModels, InMemoryCredentialStore } from '@earendil-works/pi-ai'
import { builtinProviders } from '@earendil-works/pi-ai/providers/all'
import { agentService } from '@shumai/core/src/agent/agent'
import { prisma, type TeamMemberRole } from '@shumai/db'
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
import { quotaService, QuotaExceededError } from '@shumai/core/src/quota/quota-service'
import { logger } from '@shumai/core/src/logger'
import { prisma } from '@shumai/db'
import { Type, type TSchema } from 'typebox'
import * as fs from 'fs'
import * as os from 'os'
@@ -112,18 +115,6 @@ export interface CreateAgentSessionParams {
baseDelayMs?: number
}
async function resolveTeamMemberRole(
teamId: string,
userId?: string,
): Promise<TeamMemberRole | undefined> {
if (!userId) return undefined
const member = await prisma.teamMember.findUnique({
where: { teamIdUserId: { teamId, userId } },
select: { role: true },
})
return member?.role
}
/**
* Security instructions appended to the system prompt when the requesting user is not a team
* owner (i.e. editor/reviewer). These complement the hard enforcement in the bash tool itself
@@ -185,6 +176,9 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
blockedHost: '',
}
const role = userId ? await resolveEffectiveRole(teamId, projectId, userId) : undefined
const isOwner = !userId || role === 'owner'
const restricted = !isOwner
const sandboxAskCallback = async ({ host }: { host: string; port?: number }) => {
try {
const sandbox = await prisma.sandbox.findUnique({
@@ -217,6 +211,54 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
return false
}
const wrapToolWithQuota = (tool: AgentTool): AgentTool => {
const originalExecute = tool.execute
return {
...tool,
execute: async (toolCallId, args, signal, onUpdate) => {
try {
await quotaService.checkQuota(
{
teamId,
userId,
role,
resource: 'agent_tool_call_count',
resourceData: { name: tool.name, toolName: tool.name },
},
1,
)
} catch (err) {
if (err instanceof QuotaExceededError) {
return {
content: [{ type: 'text', text: `Quota exceeded: ${err.message}` }],
details: { error: err.message },
}
}
throw err
}
const result = await originalExecute(toolCallId, args, signal, onUpdate)
try {
await quotaService.consumeQuota(
{
teamId,
userId,
role,
resource: 'agent_tool_call_count',
resourceData: { name: tool.name, toolName: tool.name },
},
1,
)
} catch (err) {
logger.error({ err }, 'Failed to record quota usage for agent tool call')
}
return result
},
}
}
// SandboxManager.initialize is a global operation that applies to the entire process.
// We reset it first to ensure any previous process-global SOCKS/HTTP proxy servers
// and callbacks are cleaned up, allowing the new callback and allowedDomains to take effect.
@@ -242,13 +284,6 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
Object.assign(skillEnvs, envs)
}
// Resolve the requesting user's team role to enforce owner-only bash privileges.
// A user who is not a member of the team is treated as restricted (fail-closed),
// while flows without a user context (e.g. autofill) remain unrestricted.
const role = await resolveTeamMemberRole(teamId, userId)
const isOwner = !userId || role === 'owner'
const restricted = !isOwner
// Restore env variables from previously loaded skills in this session
let skillLoadedInSession = false
if (sessionId) {
@@ -294,6 +329,9 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
const deniedTools = agentConfig?.deniedTools || []
const sandboxedBash = createSandboxedBashTool(process.cwd(), skillEnvs, {
teamId,
userId,
role,
getBlockedHost: () => sandboxState.blockedHost,
clearBlockedHost: () => {
sandboxState.blockedHost = ''
@@ -314,7 +352,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
bashInjected = true
// Pass the full post-update tool list as activeToolNames: setTools only updates the
// registry otherwise, and the model would never see the bash tool on the next turn.
const next = [...harness.getTools(), sandboxedBash]
const next = [...harness.getTools(), wrapToolWithQuota(sandboxedBash)]
await harness.setTools(
next,
next.map((t) => t.name),
@@ -341,7 +379,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
}
const readThread = createReadThreadTool()
const allTools = [
const rawTools = [
...mediaTools,
readSkill,
readThread,
@@ -349,6 +387,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
...systemTools,
...customTools,
]
const allTools = rawTools.map((tool) => wrapToolWithQuota(tool))
const enabledTools = disableTools
? []
: allTools.filter((tool) => !deniedTools.includes(tool.name))
+28 -1
View File
@@ -3,6 +3,7 @@ import { Type } from 'typebox'
import { type AgentTool } from '@earendil-works/pi-agent-core'
import { agentService } from '@shumai/core/src/agent/agent'
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
import { quotaService } from '@shumai/core/src/quota/quota-service'
const readSkillSchema = Type.Object({
skillId: Type.String({ description: 'The ID of the skill to read' }),
@@ -41,11 +42,13 @@ export const createReadSkillTool = (
}
const requiredLevel = ROLE_HIERARCHY[skill.permission] || 1
const effectiveRole = userId
? await resolveEffectiveRole(skill.teamId, projectId, userId)
: null
if (userId) {
// Resolve the user's effective role for the project context (project
// override wins; project-scoped members without project access are denied).
const effectiveRole = await resolveEffectiveRole(skill.teamId, projectId, userId)
const userLevel = effectiveRole ? ROLE_HIERARCHY[effectiveRole] || 0 : 0
if (userLevel < requiredLevel) {
throw new Error(
@@ -58,6 +61,18 @@ export const createReadSkillTool = (
)
}
// Quota pre-check
await quotaService.checkQuota(
{
teamId: skill.teamId,
userId,
role: effectiveRole,
resource: 'agent_skill_call_count',
resourceData: { id: params.skillId, skillId: params.skillId },
},
1,
)
// Capture environment variables using agentService
const envs = await agentService.getSkillEnvs(params.skillId)
onEnvsAdded(envs)
@@ -68,6 +83,18 @@ export const createReadSkillTool = (
// Notify that a skill was successfully loaded (e.g. to enable restricted tools)
await onSkillLoaded?.()
// Consume quota
await quotaService.consumeQuota(
{
teamId: skill.teamId,
userId,
role: effectiveRole,
resource: 'agent_skill_call_count',
resourceData: { id: params.skillId, skillId: params.skillId },
},
1,
)
return {
content: [{ type: 'text', text: skillMdContent }],
details: { skillId: params.skillId },
@@ -10,6 +10,8 @@ import {
formatSize,
type TruncationResult,
} from '../utils/truncate'
import { quotaService } from '@shumai/core/src/quota/quota-service'
import type { TeamMemberRole } from '@shumai/db'
const BashSource = Type.String({
enum: ['user', 'skill'],
@@ -33,6 +35,9 @@ export interface BashDetails {
}
export interface SandboxedBashOptions {
teamId?: string
userId?: string
role?: TeamMemberRole | null
getBlockedHost?: () => string
clearBlockedHost?: () => void
/**
@@ -66,6 +71,18 @@ export const createSandboxedBashTool = (
'Only commands required by a loaded skill (source="skill") can be executed.',
)
}
if (options?.teamId) {
await quotaService.checkQuota(
{
teamId: options.teamId,
userId: options.userId,
role: options.role,
resource: 'agent_bash_call_count',
resourceData: { command },
},
1,
)
}
options?.clearBlockedHost?.()
const wrappedCommand = await SandboxManager.wrapWithSandbox(command)
@@ -219,6 +236,23 @@ export const createSandboxedBashTool = (
const snapshot = await finishOutput()
const { text: outputText, details: truncationDetails } = formatOutput(snapshot)
if (options?.teamId) {
try {
await quotaService.consumeQuota(
{
teamId: options.teamId,
userId: options.userId,
role: options.role,
resource: 'agent_bash_call_count',
resourceData: { command },
},
1,
)
} catch (err) {
logger.error({ err }, 'Failed to record quota usage for bash command')
}
}
if (signal?.aborted) {
logger.error({ command, outputText }, 'Sandboxed bash command aborted')
reject(new Error(appendStatus(outputText, 'Command aborted')))
+2
View File
@@ -21,6 +21,7 @@ import s3Route from './s3'
import shareRoute from './share'
import skillRoute from './skill'
import watermarkTemplateRoute from './watermark-template'
import quotaRoute from './quota'
import teamRoute from './team'
import uploadRoute, { localUploadRoute } from './upload'
import versionStackRoute from './versionStack'
@@ -65,6 +66,7 @@ const apiRoute = new Hono<{ Variables: { user: User } }>()
.route('/', skillRoute)
.route('/', mcpRoute)
.route('/', watermarkTemplateRoute)
.route('/', quotaRoute)
app.route('/files', s3Route)
+258
View File
@@ -0,0 +1,258 @@
import { describe, expect, test, vi, beforeEach } from 'vitest'
import { Hono } from 'hono'
import quotaRoute from './quota'
import { quotaService } from '@shumai/core/src/quota/quota-service'
import { authMiddleware } from './middleware/auth'
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { AuditAction } from '@shumai/dtos'
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
auditLogService: {
logAction: vi.fn().mockResolvedValue({}),
},
}))
vi.mock('@shumai/core/src/quota/quota-service', () => ({
quotaService: {
listRules: vi.fn(),
createRule: vi.fn(),
getRule: vi.fn(),
listRuleRecords: vi.fn(),
updateRule: vi.fn(),
deleteRule: vi.fn(),
},
}))
vi.mock('./middleware/auth', () => ({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
authMiddleware: async (c: any, next: any) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
c.set('user', { id: 'user1', name: 'Test User' } as any)
await next()
},
}))
vi.mock('@shumai/core/src/authz/authz', () => ({
authzService: {
hasPermission: vi.fn().mockResolvedValue(undefined),
},
Permission: {
Read: 'Read',
Edit: 'Edit',
Admin: 'Admin',
},
ResourceType: {
Team: 'team',
QuotaRule: 'quotaRule',
},
}))
describe('Quota API', () => {
const app = new Hono().use('*', authMiddleware).route('/', quotaRoute)
beforeEach(() => {
vi.restoreAllMocks()
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
})
describe('GET /teams/:teamId/quotas', () => {
test('Success listing quota rules', async () => {
const mockResult = {
total: 1,
rules: [
{
id: 'rule1',
teamId: 'team1',
scopeMode: 'all_members' as const,
resource: 'agent_total_tokens' as const,
limit: 50000,
period: '1hour' as const,
enabled: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
],
}
vi.spyOn(quotaService, 'listRules').mockResolvedValue(mockResult)
const res = await app.request('/teams/team1/quotas', {
method: 'GET',
headers: { Authorization: 'Bearer test' },
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual(mockResult)
expect(authzService.hasPermission).toHaveBeenCalledWith(
expect.objectContaining({
type: ResourceType.Team,
id: 'team1',
permission: Permission.Admin,
}),
)
})
})
describe('POST /teams/:teamId/quotas', () => {
test('Success creating rule with audit log', async () => {
const mockRule = {
id: 'rule1',
teamId: 'team1',
scopeMode: 'all_members' as const,
resource: 'agent_total_tokens' as const,
limit: 100000,
period: '1day' as const,
enabled: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
vi.spyOn(quotaService, 'createRule').mockResolvedValue(mockRule)
const res = await app.request('/teams/team1/quotas', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer test',
},
body: JSON.stringify({
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 100000,
period: '1day',
}),
})
expect(res.status).toBe(201)
expect(await res.json()).toEqual(mockRule)
expect(quotaService.createRule).toHaveBeenCalledWith('team1', {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 100000,
period: '1day',
enabled: true,
})
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.quota_rule_create,
teamId: 'team1',
userId: 'user1',
itemId: 'rule1',
})
})
})
describe('GET /teams/:teamId/quotas/:id', () => {
test('Success fetching single rule', async () => {
const mockRule = {
id: 'rule1',
teamId: 'team1',
scopeMode: 'all_members' as const,
resource: 'agent_cost' as const,
limit: 50,
period: '1day' as const,
enabled: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
vi.spyOn(quotaService, 'getRule').mockResolvedValue(mockRule)
const res = await app.request('/teams/team1/quotas/rule1', {
method: 'GET',
headers: { Authorization: 'Bearer test' },
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual(mockRule)
})
})
describe('GET /teams/:teamId/quotas/:id/records', () => {
test('Success listing records for a rule', async () => {
const mockRecordsResult = {
total: 1,
records: [
{
id: 'rec1',
ruleId: 'rule1',
teamId: 'team1',
userId: null,
user: null,
periodStart: null,
periodEnd: null,
consumed: 0,
remaining: 50,
percent: 0,
isWindowActive: false,
},
],
}
vi.spyOn(quotaService, 'listRuleRecords').mockResolvedValue(mockRecordsResult)
const res = await app.request('/teams/team1/quotas/rule1/records', {
method: 'GET',
headers: { Authorization: 'Bearer test' },
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual(mockRecordsResult)
expect(quotaService.listRuleRecords).toHaveBeenCalledWith('team1', 'rule1')
})
})
describe('PUT /teams/:teamId/quotas/:id', () => {
test('Success updating rule with audit log', async () => {
const updatedRule = {
id: 'rule1',
teamId: 'team1',
scopeMode: 'all_members' as const,
resource: 'agent_cost' as const,
limit: 100,
period: '1day' as const,
enabled: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
vi.spyOn(quotaService, 'updateRule').mockResolvedValue(updatedRule)
const res = await app.request('/teams/team1/quotas/rule1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer test',
},
body: JSON.stringify({
limit: 100,
enabled: false,
}),
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual(updatedRule)
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.quota_rule_update,
teamId: 'team1',
userId: 'user1',
itemId: 'rule1',
})
})
})
describe('DELETE /teams/:teamId/quotas/:id', () => {
test('Success deleting rule with audit log', async () => {
vi.spyOn(quotaService, 'deleteRule').mockResolvedValue(undefined)
const res = await app.request('/teams/team1/quotas/rule1', {
method: 'DELETE',
headers: { Authorization: 'Bearer test' },
})
expect(res.status).toBe(204)
expect(quotaService.deleteRule).toHaveBeenCalledWith('team1', 'rule1')
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: AuditAction.quota_rule_delete,
teamId: 'team1',
userId: 'user1',
itemId: 'rule1',
})
})
})
})
+125
View File
@@ -0,0 +1,125 @@
import { Hono } from 'hono'
import { zValidator } from '@hono/zod-validator'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { quotaService } from '@shumai/core/src/quota/quota-service'
import {
createQuotaRuleRequestSchema,
updateQuotaRuleRequestSchema,
AuditAction,
} from '@shumai/dtos'
import type { Prisma } from '@shumai/db'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
type User = Prisma.UserGetPayload<Record<string, never>>
const route = new Hono<{ Variables: { user: User } }>()
.get('/teams/:teamId/quotas', async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const data = await quotaService.listRules(teamId)
return c.json(data)
})
.post('/teams/:teamId/quotas', zValidator('json', createQuotaRuleRequestSchema), async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const rule = await quotaService.createRule(teamId, req)
await auditLogService.logAction({
action: AuditAction.quota_rule_create,
teamId,
userId: user?.id,
itemId: rule.id,
})
return c.json(rule, 201)
})
.get('/teams/:teamId/quotas/:id', async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const id = c.req.param('id')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const rule = await quotaService.getRule(teamId, id)
return c.json(rule)
})
.get('/teams/:teamId/quotas/:id/records', async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const id = c.req.param('id')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const data = await quotaService.listRuleRecords(teamId, id)
return c.json(data)
})
.put('/teams/:teamId/quotas/:id', zValidator('json', updateQuotaRuleRequestSchema), async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const id = c.req.param('id')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
const rule = await quotaService.updateRule(teamId, id, req)
await auditLogService.logAction({
action: AuditAction.quota_rule_update,
teamId,
userId: user?.id,
itemId: id,
})
return c.json(rule)
})
.delete('/teams/:teamId/quotas/:id', async (c) => {
const user = c.get('user')
const teamId = c.req.param('teamId')
const id = c.req.param('id')
await authzService.hasPermission({
user,
permission: Permission.Admin,
type: ResourceType.Team,
id: teamId,
})
await quotaService.deleteRule(teamId, id)
await auditLogService.logAction({
action: AuditAction.quota_rule_delete,
teamId,
userId: user?.id,
itemId: id,
})
return new Response(null, { status: 204 })
})
export default route
+1
View File
@@ -24,6 +24,7 @@ export async function dedupeSymlinksToTarget(
): Promise<void> {
const existingSymlinks = await tx.asset.findMany({
where: { targetId: { in: targetIds }, type: AssetType.symlink },
orderBy: { id: 'asc' },
})
if (existingSymlinks.length === 0) return
+10
View File
@@ -24,6 +24,7 @@ export enum ResourceType {
Invite = 'invite',
Comment = 'comment',
AgentSession = 'agentSession',
QuotaRule = 'quotaRule',
}
export interface AuthzRequest {
@@ -259,6 +260,15 @@ export class AuthzService {
return { teamId: comment.asset.project.teamId, projectId: comment.asset.projectId! }
}
case ResourceType.QuotaRule: {
const rule = await prisma.quotaRule.findUnique({
where: { id },
select: { teamId: true },
})
if (!rule) throw new HTTPException(404, { message: 'Quota rule not found' })
return { teamId: rule.teamId }
}
default:
throw new HTTPException(403, { message: `Unsupported resource type: ${type}` })
}
+1
View File
@@ -26,3 +26,4 @@ export * from './ai-usage/ai-usage'
export * from './watermark/watermark'
export * from './gotenberg/gotenberg'
export * from './mcp/mcp-service'
export * from './quota/quota-service'
+46 -1
View File
@@ -4,7 +4,7 @@
import { auth } from '@modelcontextprotocol/client'
import type { AgentTool, AgentToolResult } from '@earendil-works/pi-agent-core'
import { prisma } from '@shumai/db'
import { prisma, type TeamMemberRole } from '@shumai/db'
import '@shumai/db/src/prisma-json-types'
import type {
CreateMcpServerRequest,
@@ -14,6 +14,7 @@ import type {
} from '@shumai/dtos'
import { logger } from '@shumai/core/src/logger'
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
import { quotaService } from '@shumai/core/src/quota/quota-service'
import { mcpDbStore, type PendingAuth } from './mcp-db-store'
import { buildDirectTools, isDirectTool } from './mcp-direct-tools'
import { McpOauthProvider, type McpOauthConfig } from './mcp-oauth-provider'
@@ -529,6 +530,32 @@ export class McpService {
return { ok: false, content: [{ type: 'text', text: denied }] }
}
let role: TeamMemberRole | null | undefined = undefined
if (ctx?.teamId && ctx?.userId) {
role = await resolveEffectiveRole(ctx.teamId, ctx.projectId, ctx.userId)
}
if (ctx?.teamId) {
try {
await quotaService.checkQuota(
{
teamId: ctx.teamId,
userId: ctx.userId,
role,
resource: 'agent_mcp_call_count',
resourceData: { id: serverId, mcpServerId: serverId },
},
1,
)
} catch (err: unknown) {
const message = err instanceof Error ? err.message : String(err)
return {
ok: false,
content: [{ type: 'text', text: `Quota exceeded: ${message}` }],
}
}
}
const outcome = await this.ensureConnected(serverId)
if (outcome.status === 'needs-auth') {
return {
@@ -555,6 +582,24 @@ export class McpService {
try {
const result = await this.manager.callTool(serverId, toolName, args)
if (ctx?.teamId) {
try {
await quotaService.consumeQuota(
{
teamId: ctx.teamId,
userId: ctx.userId,
role,
resource: 'agent_mcp_call_count',
resourceData: { id: serverId, mcpServerId: serverId },
},
1,
)
} catch (err) {
logger.error({ err }, 'Failed to record quota usage for MCP tool call')
}
}
if (result.isError) {
const text = result.content.map((c) => ('text' in c ? c.text : '[image]')).join('\n')
return {
@@ -0,0 +1,769 @@
import { describe, it, expect } from 'vitest'
import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { quotaService, QuotaExceededError, wildcardToRegex } from './quota-service'
describe('QuotaRule Wildcard Matchers', () => {
it('correctly matches bash command wildcards', () => {
const starRegex = wildcardToRegex('*')
expect(starRegex.test('npm install')).toBe(true)
expect(starRegex.test('git commit -m "test"')).toBe(true)
const npmRegex = wildcardToRegex('npm *')
expect(npmRegex.test('npm install')).toBe(true)
expect(npmRegex.test('npm test')).toBe(true)
expect(npmRegex.test('git push')).toBe(false)
const exactRegex = wildcardToRegex('rm -rf .pi')
expect(exactRegex.test('rm -rf .pi')).toBe(true)
expect(exactRegex.test('rm -rf /')).toBe(false)
})
it('correctly matches agent tool name wildcards', () => {
const starTool = wildcardToRegex('*')
expect(starTool.test('analyze_image')).toBe(true)
expect(starTool.test('screenshot')).toBe(true)
const exactTool = wildcardToRegex('analyze_image')
expect(exactTool.test('analyze_image')).toBe(true)
expect(exactTool.test('screenshot')).toBe(false)
})
})
describe('QuotaService', () => {
setupTestDbHooks()
it('creates, reads, updates, and deletes quota rules', async () => {
const team = await prisma.team.create({
data: { name: 'Quota Team' },
})
// Create rule
const rule = await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 100000,
period: '1hour',
enabled: true,
})
expect(rule.id).toBeDefined()
expect(rule.teamId).toBe(team.id)
expect(rule.scopeMode).toBe('all_members')
expect(rule.limit).toBe(100000)
expect(rule.period).toBe('1hour')
// Get rule
const fetched = await quotaService.getRule(team.id, rule.id)
expect(fetched.id).toBe(rule.id)
expect(fetched.limit).toBe(100000)
// List rules
const list = await quotaService.listRules(team.id)
expect(list.total).toBe(1)
expect(list.rules[0].id).toBe(rule.id)
// Update rule
const updated = await quotaService.updateRule(team.id, rule.id, {
limit: 200000,
enabled: false,
})
expect(updated.limit).toBe(200000)
expect(updated.enabled).toBe(false)
// Delete rule
await quotaService.deleteRule(team.id, rule.id)
const afterDelete = await quotaService.listRules(team.id)
expect(afterDelete.total).toBe(0)
})
it('validates selected members on rule creation', async () => {
const team = await prisma.team.create({
data: { name: 'Quota Team' },
})
// Missing user should throw 400
await expect(
quotaService.createRule(team.id, {
scopeMode: 'selected_members',
userIds: ['non-existent-user-id'],
resource: 'agent_cost',
limit: 10,
period: '1day',
}),
).rejects.toThrow()
})
it('uses the latest database rule state for every quota check', async () => {
const team = await prisma.team.create({
data: { name: 'Fresh Quota Rule Team' },
})
const rule = await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_cost',
limit: 10,
period: '1hour',
})
const event = {
teamId: team.id,
resource: 'agent_cost' as const,
}
expect((await quotaService.checkQuota(event)).matchedRules).toHaveLength(1)
await prisma.quotaRule.update({
where: { id: rule.id },
data: { enabled: false },
})
expect((await quotaService.checkQuota(event)).matchedRules).toHaveLength(0)
})
it('enforces check and consumes quota for all_members (shared pool)', async () => {
const team = await prisma.team.create({
data: { name: 'Shared Quota Team' },
})
await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 1000,
period: '1hour',
enabled: true,
})
// Check with 0 before consumption
const checkResult = await quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
0,
)
expect(checkResult.allowed).toBe(true)
// Consume 600 tokens
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
600,
)
// Check with 300 tokens (600 + 300 = 900 <= 1000) -> allowed
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
300,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
// Check with 500 tokens (600 + 500 = 1100 > 1000) -> throws QuotaExceededError
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
500,
),
).rejects.toThrow(QuotaExceededError)
// Consume another 400 tokens -> exactly 1000 consumed
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
400,
)
// Now even checkQuota with 1 token should fail
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
1,
),
).rejects.toThrow(QuotaExceededError)
})
it('enforces each_member scope independently for each member', async () => {
const team = await prisma.team.create({
data: { name: 'Each Member Team' },
})
const userAlice = await prisma.user.create({
data: { name: 'Alice', email: 'alice@example.com', password: 'pw' },
})
const userBob = await prisma.user.create({
data: { name: 'Bob', email: 'bob@example.com', password: 'pw' },
})
// Create rule: each member with role editor gets 5 skill calls per 1hour
await quotaService.createRule(team.id, {
scopeMode: 'each_member',
role: 'editor',
resource: 'agent_skill_call_count',
resourceData: { id: 'skill_1' },
limit: 5,
period: '1hour',
enabled: true,
})
// Alice consumes 5 skill calls
for (let i = 0; i < 5; i++) {
await quotaService.consumeQuota(
{
teamId: team.id,
userId: userAlice.id,
role: 'editor',
resource: 'agent_skill_call_count',
resourceData: { id: 'skill_1' },
},
1,
)
}
// Alice should be blocked on 6th call
await expect(
quotaService.checkQuota(
{
teamId: team.id,
userId: userAlice.id,
role: 'editor',
resource: 'agent_skill_call_count',
resourceData: { id: 'skill_1' },
},
1,
),
).rejects.toThrow(QuotaExceededError)
// Bob (also an editor) should NOT be blocked (independent tracking)
await expect(
quotaService.checkQuota(
{
teamId: team.id,
userId: userBob.id,
role: 'editor',
resource: 'agent_skill_call_count',
resourceData: { id: 'skill_1' },
},
1,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
// Reviewer should not match editor rule
const reviewerCheck = await quotaService.checkQuota(
{
teamId: team.id,
userId: userBob.id,
role: 'reviewer',
resource: 'agent_skill_call_count',
resourceData: { id: 'skill_1' },
},
1,
)
expect(reviewerCheck.matchedRules).toHaveLength(0)
})
it('enforces selected_members scope correctly', async () => {
const team = await prisma.team.create({
data: { name: 'Selected Members Team' },
})
const userSelected = await prisma.user.create({
data: { name: 'Selected User', email: 'sel@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: userSelected.id, role: 'editor' },
})
const userOther = await prisma.user.create({
data: { name: 'Other User', email: 'other@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: userOther.id, role: 'editor' },
})
await quotaService.createRule(team.id, {
scopeMode: 'selected_members',
userIds: [userSelected.id],
resource: 'agent_cost',
limit: 5,
period: '1day',
enabled: true,
})
// Selected user consumes 5
await quotaService.consumeQuota(
{
teamId: team.id,
userId: userSelected.id,
resource: 'agent_cost',
},
5,
)
// Selected user is blocked
await expect(
quotaService.checkQuota(
{
teamId: team.id,
userId: userSelected.id,
resource: 'agent_cost',
},
1,
),
).rejects.toThrow(QuotaExceededError)
// Other user does not match the rule -> allowed
const otherCheck = await quotaService.checkQuota(
{
teamId: team.id,
userId: userOther.id,
resource: 'agent_cost',
},
10,
)
expect(otherCheck.matchedRules).toHaveLength(0)
})
it('matches bash command wildcard rules', async () => {
const team = await prisma.team.create({
data: { name: 'Bash Quota Team' },
})
await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_bash_call_count',
resourceData: { match: 'npm *' },
limit: 2,
period: '1hour',
enabled: true,
})
// npm test matches -> consume 1
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_bash_call_count',
resourceData: { command: 'npm test' },
},
1,
)
// npm install matches -> consume 1 (total = 2)
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_bash_call_count',
resourceData: { command: 'npm install' },
},
1,
)
// 3rd npm command should be blocked
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_bash_call_count',
resourceData: { command: 'npm run build' },
},
1,
),
).rejects.toThrow(QuotaExceededError)
// git command does not match 'npm *' -> allowed
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_bash_call_count',
resourceData: { command: 'git status' },
},
1,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
})
it('matches agent tool call rules and wildcards', async () => {
const team = await prisma.team.create({
data: { name: 'Tool Quota Team' },
})
await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_tool_call_count',
resourceData: { name: 'analyze_image' },
limit: 1,
period: '1hour',
enabled: true,
})
// First call to analyze_image
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_tool_call_count',
resourceData: { name: 'analyze_image' },
},
1,
)
// 2nd call to analyze_image is blocked
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_tool_call_count',
resourceData: { name: 'analyze_image' },
},
1,
),
).rejects.toThrow(QuotaExceededError)
// Call to create_file does not match -> allowed
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_tool_call_count',
resourceData: { name: 'create_file' },
},
1,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
})
it('handles period window rollover and resets usage in-place with no history tables', async () => {
const team = await prisma.team.create({
data: { name: 'Window Rollover Team' },
})
const rule = await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_cost',
limit: 10,
period: '1hour',
enabled: true,
})
// Simulate an expired period by creating a past QuotaRecord
const pastStart = new Date(Date.now() - 2 * 60 * 60 * 1000)
const pastEnd = new Date(Date.now() - 1 * 60 * 60 * 1000)
await prisma.quotaRecord.create({
data: {
ruleId: rule.id,
teamId: team.id,
userId: null,
periodStart: pastStart,
periodEnd: pastEnd,
consumed: 10, // fully consumed in past window
},
})
// Current check should be ALLOWED because the old window expired
await expect(
quotaService.checkQuota(
{
teamId: team.id,
resource: 'agent_cost',
},
5,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
// Consuming now resets the single record in-place
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_cost',
},
5,
)
const records = await prisma.quotaRecord.findMany({
where: { ruleId: rule.id },
})
// No extra history records (exactly 1 record row updated in place)
expect(records).toHaveLength(1)
expect(records[0].consumed).toBe(5)
})
it('lists rule records accurately with lazy reset status', async () => {
const team = await prisma.team.create({
data: { name: 'Records List Team' },
})
const user = await prisma.user.create({
data: { name: 'Alice Member', email: 'alice.member@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: {
teamId: team.id,
userId: user.id,
role: 'editor',
},
})
const rule = await quotaService.createRule(team.id, {
scopeMode: 'each_member',
resource: 'agent_total_tokens',
limit: 50000,
period: '1day',
enabled: true,
})
// Before any usage: listRuleRecords returns member with consumed: 0, isWindowActive: false
const initialRecords = await quotaService.listRuleRecords(team.id, rule.id)
expect(initialRecords.total).toBe(1)
expect(initialRecords.records[0].userId).toBe(user.id)
expect(initialRecords.records[0].consumed).toBe(0)
expect(initialRecords.records[0].remaining).toBe(50000)
expect(initialRecords.records[0].isWindowActive).toBe(false)
// Consume 10000 tokens
await quotaService.consumeQuota(
{
teamId: team.id,
userId: user.id,
role: 'editor',
resource: 'agent_total_tokens',
},
10000,
)
// After usage: active window with consumed = 10000
const activeRecords = await quotaService.listRuleRecords(team.id, rule.id)
expect(activeRecords.records[0].consumed).toBe(10000)
expect(activeRecords.records[0].remaining).toBe(40000)
expect(activeRecords.records[0].isWindowActive).toBe(true)
})
it('enforces multiple matching rules simultaneously', async () => {
const team = await prisma.team.create({
data: { name: 'Multi Rule Team' },
})
const user = await prisma.user.create({
data: { name: 'Charlie', email: 'charlie@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: user.id, role: 'editor' },
})
// Rule 1: Team overall token limit 10,000 (all_members)
await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 10000,
period: '1day',
enabled: true,
})
// Rule 2: User specific token limit 2,000 (selected_members)
await quotaService.createRule(team.id, {
scopeMode: 'selected_members',
userIds: [user.id],
resource: 'agent_total_tokens',
limit: 2000,
period: '1day',
enabled: true,
})
// Consuming 2000 tokens for Charlie
await quotaService.consumeQuota(
{
teamId: team.id,
userId: user.id,
resource: 'agent_total_tokens',
},
2000,
)
// Charlie is blocked by user rule (2000 limit reached)
await expect(
quotaService.checkQuota(
{
teamId: team.id,
userId: user.id,
resource: 'agent_total_tokens',
},
100,
),
).rejects.toThrow(QuotaExceededError)
// Another user in the same team is NOT blocked by Charlie's limit, only by team limit
const userDave = await prisma.user.create({
data: { name: 'Dave', email: 'dave@example.com', password: 'pw' },
})
await expect(
quotaService.checkQuota(
{
teamId: team.id,
userId: userDave.id,
resource: 'agent_total_tokens',
},
1000,
),
).resolves.toEqual(expect.objectContaining({ allowed: true }))
})
it('rejects selected_members if user is not a member of the team on create', async () => {
const team1 = await prisma.team.create({ data: { name: 'Team 1' } })
const team2 = await prisma.team.create({ data: { name: 'Team 2' } })
const userInTeam1 = await prisma.user.create({
data: { name: 'Member 1', email: 'm1@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team1.id, userId: userInTeam1.id, role: 'editor' },
})
const userInTeam2 = await prisma.user.create({
data: { name: 'Member 2', email: 'm2@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team2.id, userId: userInTeam2.id, role: 'editor' },
})
// Creating rule on Team 1 with user from Team 2 should throw 400
await expect(
quotaService.createRule(team1.id, {
scopeMode: 'selected_members',
userIds: [userInTeam2.id],
resource: 'agent_cost',
limit: 10,
period: '1day',
}),
).rejects.toThrow('One or more selected users are not members of the team')
})
it('validates merged rule and rejects invalid partial updates', async () => {
const team = await prisma.team.create({ data: { name: 'Validation Team' } })
const user = await prisma.user.create({
data: { name: 'User 1', email: 'u1@example.com', password: 'pw' },
})
await prisma.teamMember.create({
data: { teamId: team.id, userId: user.id, role: 'editor' },
})
const rule = await quotaService.createRule(team.id, {
scopeMode: 'each_member',
resource: 'agent_total_tokens',
limit: 10000,
period: '1hour',
})
// Updating resource to agent_skill_call_count without resourceData.id should fail validation
await expect(
quotaService.updateRule(team.id, rule.id, {
resource: 'agent_skill_call_count',
}),
).rejects.toThrow()
// Updating scopeMode to selected_members without userIds should fail validation
await expect(
quotaService.updateRule(team.id, rule.id, {
scopeMode: 'selected_members',
}),
).rejects.toThrow()
// Updating userIds with a user from outside the team should fail validation
const otherUser = await prisma.user.create({
data: { name: 'Other User', email: 'other_team@example.com', password: 'pw' },
})
await expect(
quotaService.updateRule(team.id, rule.id, {
scopeMode: 'selected_members',
userIds: [otherUser.id],
}),
).rejects.toThrow('One or more selected users are not members of the team')
})
it('resets existing quota records when accounting dimensions change', async () => {
const team = await prisma.team.create({ data: { name: 'Reset Records Team' } })
const rule = await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 1000,
period: '1hour',
})
// Consume 500 tokens
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_total_tokens',
},
500,
)
let records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
expect(records).toHaveLength(1)
expect(records[0].consumed).toBe(500)
// Update resource to agent_cost (limit 10)
await quotaService.updateRule(team.id, rule.id, {
resource: 'agent_cost',
limit: 10,
})
// Records should be reset
records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
expect(records).toHaveLength(0)
// Consume $2 under the new resource
await quotaService.consumeQuota(
{
teamId: team.id,
resource: 'agent_cost',
},
2,
)
records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
expect(records).toHaveLength(1)
expect(records[0].consumed).toBe(2)
})
it('handles concurrent first consumption for all_members without creating duplicate records', async () => {
const team = await prisma.team.create({ data: { name: 'Concurrent Quota Team' } })
const rule = await quotaService.createRule(team.id, {
scopeMode: 'all_members',
resource: 'agent_total_tokens',
limit: 10000,
period: '1hour',
})
// Concurrently trigger 5 quota consumption calls for the first time
await Promise.all([
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 10),
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 20),
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 30),
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 40),
quotaService.consumeQuota({ teamId: team.id, resource: 'agent_total_tokens' }, 50),
])
const records = await prisma.quotaRecord.findMany({ where: { ruleId: rule.id } })
expect(records).toHaveLength(1)
expect(records[0].consumed).toBe(150)
})
})
+747
View File
@@ -0,0 +1,747 @@
import {
prisma,
Prisma,
type QuotaPeriod,
type QuotaRecord,
type QuotaResourceType,
type QuotaRule,
type TeamMemberRole,
} from '@shumai/db'
import {
type CreateQuotaRuleRequest,
type ListQuotaRulesResponse,
type QuotaRuleResponse,
type ListQuotaRecordsResponse,
type QuotaRecordResponse,
type UpdateQuotaRuleRequest,
normalizeQuotaPeriod,
formatQuotaPeriod,
skillResourceDataSchema,
mcpResourceDataSchema,
bashResourceDataSchema,
toolResourceDataSchema,
} from '@shumai/dtos'
import { HTTPException } from 'hono/http-exception'
export class QuotaExceededError extends Error {
public readonly policyId: string
public readonly resource: string
public readonly limit: number
public readonly consumed: number
public readonly periodEnd: Date
constructor(params: {
policyId: string
resource: string
limit: number
consumed: number
periodEnd: Date
message?: string
}) {
const msg =
params.message ||
`Quota exceeded for ${params.resource}: limit of ${params.limit} reached (currently consumed: ${params.consumed}). Resets at ${params.periodEnd.toISOString()}.`
super(msg)
this.name = 'QuotaExceededError'
this.policyId = params.policyId
this.resource = params.resource
this.limit = params.limit
this.consumed = params.consumed
this.periodEnd = params.periodEnd
}
}
export interface QuotaEventResourceData {
skillId?: string
mcpServerId?: string
command?: string
name?: string
toolName?: string
[key: string]: unknown
}
export interface QuotaEvent {
teamId: string
userId?: string | null
role?: TeamMemberRole | null
resource: QuotaResourceType
resourceData?: QuotaEventResourceData
}
export function periodToDurationMs(period: QuotaPeriod | string): number {
switch (period) {
case 'one_hour':
case '1hour':
return 60 * 60 * 1000
case 'five_hours':
case '5hour':
return 5 * 60 * 60 * 1000
case 'one_day':
case '1day':
return 24 * 60 * 60 * 1000
case 'seven_days':
case '7day':
return 7 * 24 * 60 * 60 * 1000
default:
return 60 * 60 * 1000
}
}
/**
* Converts a wildcard pattern (with * and ?) into a regular expression.
*/
export function wildcardToRegex(pattern: string): RegExp {
const trimmed = pattern.trim()
if (trimmed === '*' || trimmed === '') {
return /^.*$/s
}
// Escape regex special chars except * and ?
const escaped = trimmed.replace(/[.+^${}()|[\]\\]/g, '\\$&')
const regexStr = '^' + escaped.replace(/\*/g, '.*').replace(/\?/g, '.') + '$'
return new RegExp(regexStr, 's')
}
function matchesQuotaRule(rule: QuotaRule, event: QuotaEvent): boolean {
if (!rule.enabled) return false
if (event.teamId !== rule.teamId) return false
if (event.resource !== rule.resource) return false
// Scope check
if (rule.scopeMode === 'all_members') {
if (rule.role && event.role !== rule.role) return false
} else if (rule.scopeMode === 'each_member') {
if (!event.userId) return false
if (rule.role && event.role !== rule.role) return false
} else if (rule.scopeMode === 'selected_members') {
if (!event.userId) return false
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : null
if (!userIds || !userIds.includes(event.userId)) return false
}
const resourceData = (rule.resourceData as Record<string, unknown> | null) ?? null
// Resource data check
if (rule.resource === 'agent_skill_call_count') {
const targetId = resourceData?.id ?? resourceData?.skillId
const eventSkillId = event.resourceData?.skillId ?? event.resourceData?.id
if (targetId && eventSkillId !== targetId) return false
} else if (rule.resource === 'agent_mcp_call_count') {
const targetId = resourceData?.id ?? resourceData?.mcpServerId
const eventMcpId = event.resourceData?.mcpServerId ?? event.resourceData?.id
if (targetId && eventMcpId !== targetId) return false
} else if (rule.resource === 'agent_bash_call_count' && resourceData?.match) {
const bashMatcher = wildcardToRegex(String(resourceData.match))
const command = event.resourceData?.command ?? ''
if (!bashMatcher.test(command)) return false
} else if (
rule.resource === 'agent_tool_call_count' &&
(resourceData?.name || resourceData?.toolName)
) {
const toolMatcher = wildcardToRegex(String(resourceData.name ?? resourceData.toolName))
const toolName = String(event.resourceData?.name ?? event.resourceData?.toolName ?? '')
if (!toolMatcher.test(toolName)) return false
}
return true
}
function getQuotaRuleTargetUserId(rule: QuotaRule, event: QuotaEvent): string | null {
if (rule.scopeMode === 'all_members') {
return null
}
return event.userId ?? null
}
/* eslint-disable @typescript-eslint/naming-convention */
interface RawQuotaRecord {
id: string
rule_id: string
team_id: string
user_id: string | null
period_start: Date | null
period_end: Date | null
consumed: number
}
/* eslint-enable @typescript-eslint/naming-convention */
export class QuotaService {
constructor(private readonly prismaClient: typeof prisma = prisma) {}
private mapRuleToResponse(rule: QuotaRule, recordsCount?: number): QuotaRuleResponse {
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : undefined
return {
id: rule.id,
teamId: rule.teamId,
scopeMode: rule.scopeMode,
role: rule.role ?? undefined,
userIds,
resource: rule.resource,
resourceData: (rule.resourceData as Record<string, unknown> | null) ?? undefined,
limit: rule.limit,
period: formatQuotaPeriod(rule.period) as QuotaRuleResponse['period'],
enabled: rule.enabled,
recordsCount,
createdAt: rule.createdAt.toISOString(),
updatedAt: rule.updatedAt.toISOString(),
}
}
async createRule(teamId: string, req: CreateQuotaRuleRequest): Promise<QuotaRuleResponse> {
if (req.scopeMode === 'selected_members') {
if (!req.userIds || req.userIds.length === 0) {
throw new HTTPException(400, {
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
})
}
const members = await this.prismaClient.teamMember.findMany({
where: {
teamId,
userId: { in: req.userIds },
},
select: { userId: true },
})
if (members.length !== req.userIds.length) {
throw new HTTPException(400, {
message: 'One or more selected users are not members of the team',
})
}
}
const rule = await this.prismaClient.quotaRule.create({
data: {
teamId,
scopeMode: req.scopeMode,
role: req.scopeMode !== 'selected_members' ? (req.role ?? null) : null,
userIds:
req.scopeMode === 'selected_members' && req.userIds ? req.userIds : Prisma.JsonNull,
resource: req.resource,
resourceData: req.resourceData ?? Prisma.JsonNull,
limit: req.limit,
period: normalizeQuotaPeriod(req.period),
enabled: req.enabled ?? true,
},
})
return this.mapRuleToResponse(rule, 0)
}
async updateRule(
teamId: string,
ruleId: string,
req: UpdateQuotaRuleRequest,
): Promise<QuotaRuleResponse> {
const existing = await this.prismaClient.quotaRule.findUnique({
where: { id: ruleId },
})
if (!existing || existing.teamId !== teamId) {
throw new HTTPException(404, { message: 'Quota rule not found' })
}
const effectiveScopeMode = req.scopeMode ?? existing.scopeMode
const effectiveRole =
effectiveScopeMode === 'selected_members'
? null
: req.role !== undefined
? req.role
: existing.role
const effectiveUserIds =
effectiveScopeMode === 'selected_members'
? req.userIds !== undefined
? req.userIds
: Array.isArray(existing.userIds)
? (existing.userIds as string[])
: []
: null
const effectiveResource = req.resource ?? existing.resource
const effectiveResourceData =
req.resourceData !== undefined
? req.resourceData
: (existing.resourceData as Record<string, unknown> | null)
const effectiveLimit = req.limit ?? existing.limit
const effectivePeriod = req.period ? normalizeQuotaPeriod(req.period) : existing.period
const effectiveEnabled = req.enabled ?? existing.enabled
// Validate effective merged state
if (effectiveScopeMode === 'selected_members') {
if (!effectiveUserIds || effectiveUserIds.length === 0) {
throw new HTTPException(400, {
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
})
}
const members = await this.prismaClient.teamMember.findMany({
where: {
teamId,
userId: { in: effectiveUserIds },
},
select: { userId: true },
})
if (members.length !== effectiveUserIds.length) {
throw new HTTPException(400, {
message: 'One or more selected users are not members of the team',
})
}
}
if (effectiveResource === 'agent_skill_call_count') {
const res = skillResourceDataSchema.safeParse(effectiveResourceData)
if (!res.success) {
throw new HTTPException(400, {
message: 'resourceData.id is required for agent_skill_call_count',
})
}
} else if (effectiveResource === 'agent_mcp_call_count') {
const res = mcpResourceDataSchema.safeParse(effectiveResourceData)
if (!res.success) {
throw new HTTPException(400, {
message: 'resourceData.id is required for agent_mcp_call_count',
})
}
} else if (effectiveResource === 'agent_bash_call_count') {
const res = bashResourceDataSchema.safeParse(effectiveResourceData)
if (!res.success) {
throw new HTTPException(400, {
message: 'resourceData.match is required for agent_bash_call_count',
})
}
} else if (effectiveResource === 'agent_tool_call_count') {
const res = toolResourceDataSchema.safeParse(effectiveResourceData)
if (!res.success) {
throw new HTTPException(400, {
message: 'resourceData.name is required for agent_tool_call_count',
})
}
}
if (effectiveLimit <= 0) {
throw new HTTPException(400, {
message: 'Limit must be greater than 0',
})
}
const isAccountingDimensionChanged =
(req.resource !== undefined && req.resource !== existing.resource) ||
(req.period !== undefined && normalizeQuotaPeriod(req.period) !== existing.period) ||
(req.scopeMode !== undefined && req.scopeMode !== existing.scopeMode) ||
(req.role !== undefined && req.role !== existing.role) ||
(req.resourceData !== undefined &&
JSON.stringify(req.resourceData) !== JSON.stringify(existing.resourceData))
const updated = await this.prismaClient.$transaction(async (tx) => {
if (isAccountingDimensionChanged) {
// Reset all records when accounting dimensions change
await tx.quotaRecord.deleteMany({
where: { ruleId },
})
} else if (effectiveScopeMode === 'selected_members' && req.userIds !== undefined) {
// Clean up records for removed users if updating userIds
if (req.userIds && req.userIds.length > 0) {
await tx.quotaRecord.deleteMany({
where: {
ruleId,
userId: { notIn: req.userIds },
},
})
}
}
const data: Prisma.QuotaRuleUpdateInput = {
scopeMode: effectiveScopeMode,
role: effectiveRole,
userIds:
effectiveScopeMode === 'selected_members' && effectiveUserIds
? effectiveUserIds
: Prisma.JsonNull,
resource: effectiveResource,
resourceData: effectiveResourceData ?? Prisma.JsonNull,
limit: effectiveLimit,
period: effectivePeriod,
enabled: effectiveEnabled,
}
return tx.quotaRule.update({
where: { id: ruleId },
data,
})
})
const recordsCount = await this.prismaClient.quotaRecord.count({
where: { ruleId },
})
return this.mapRuleToResponse(updated, recordsCount)
}
async deleteRule(teamId: string, ruleId: string): Promise<void> {
const existing = await this.prismaClient.quotaRule.findUnique({
where: { id: ruleId },
})
if (!existing || existing.teamId !== teamId) {
throw new HTTPException(404, { message: 'Quota rule not found' })
}
await this.prismaClient.quotaRule.delete({
where: { id: ruleId },
})
}
async getRule(teamId: string, ruleId: string): Promise<QuotaRuleResponse> {
const rule = await this.prismaClient.quotaRule.findUnique({
where: { id: ruleId },
})
if (!rule || rule.teamId !== teamId) {
throw new HTTPException(404, { message: 'Quota rule not found' })
}
const recordsCount = await this.prismaClient.quotaRecord.count({
where: { ruleId },
})
return this.mapRuleToResponse(rule, recordsCount)
}
async listRules(teamId: string): Promise<ListQuotaRulesResponse> {
const rules = await this.prismaClient.quotaRule.findMany({
where: { teamId },
orderBy: { id: 'desc' },
})
const ruleResponses = await Promise.all(
rules.map(async (rule) => {
const recordsCount = await this.prismaClient.quotaRecord.count({
where: { ruleId: rule.id },
})
return this.mapRuleToResponse(rule, recordsCount)
}),
)
return {
rules: ruleResponses,
total: ruleResponses.length,
}
}
async listRuleRecords(teamId: string, ruleId: string): Promise<ListQuotaRecordsResponse> {
const rule = await this.prismaClient.quotaRule.findUnique({
where: { id: ruleId },
})
if (!rule || rule.teamId !== teamId) {
throw new HTTPException(404, { message: 'Quota rule not found' })
}
const now = new Date()
if (rule.scopeMode === 'all_members') {
const record = await this.prismaClient.quotaRecord.findFirst({
where: { ruleId: rule.id, userId: null },
})
const isWindowActive = Boolean(
record?.periodStart &&
record?.periodEnd &&
now >= record.periodStart &&
now < record.periodEnd,
)
const consumed = isWindowActive ? (record?.consumed ?? 0) : 0
const remaining = Math.max(0, rule.limit - consumed)
const percent =
rule.limit > 0 ? Math.min(100, Number(((consumed / rule.limit) * 100).toFixed(2))) : 0
const res: QuotaRecordResponse = {
id: record?.id ?? null,
ruleId: rule.id,
teamId: rule.teamId,
userId: null,
user: null,
periodStart:
isWindowActive && record?.periodStart ? record.periodStart.toISOString() : null,
periodEnd: isWindowActive && record?.periodEnd ? record.periodEnd.toISOString() : null,
consumed,
remaining,
percent,
isWindowActive,
}
return {
records: [res],
total: 1,
}
}
// For each_member or selected_members
type MemberTarget = { id: string; name: string; email: string; image?: string | null }
let targetUsers: MemberTarget[] = []
if (rule.scopeMode === 'selected_members') {
const userIds = Array.isArray(rule.userIds) ? (rule.userIds as string[]) : []
if (userIds.length > 0) {
targetUsers = await this.prismaClient.user.findMany({
where: { id: { in: userIds } },
select: { id: true, name: true, email: true, image: true },
})
}
} else {
// each_member
const memberWhere: Prisma.TeamMemberWhereInput = { teamId }
if (rule.role) {
memberWhere.role = rule.role
}
const members = await this.prismaClient.teamMember.findMany({
where: memberWhere,
include: {
user: {
select: { id: true, name: true, email: true, image: true },
},
},
})
targetUsers = members.map((m) => m.user)
}
const existingRecords = await this.prismaClient.quotaRecord.findMany({
where: {
ruleId: rule.id,
userId: { in: targetUsers.map((u) => u.id) },
},
})
const recordByUserId = new Map<string, QuotaRecord>()
for (const r of existingRecords) {
if (r.userId) recordByUserId.set(r.userId, r)
}
const records: QuotaRecordResponse[] = targetUsers.map((user) => {
const record = recordByUserId.get(user.id)
const isWindowActive = Boolean(
record?.periodStart &&
record?.periodEnd &&
now >= record.periodStart &&
now < record.periodEnd,
)
const consumed = isWindowActive ? (record?.consumed ?? 0) : 0
const remaining = Math.max(0, rule.limit - consumed)
const percent =
rule.limit > 0 ? Math.min(100, Number(((consumed / rule.limit) * 100).toFixed(2))) : 0
return {
id: record?.id ?? null,
ruleId: rule.id,
teamId: rule.teamId,
userId: user.id,
user: {
id: user.id,
name: user.name,
email: user.email,
image: user.image ?? null,
},
periodStart:
isWindowActive && record?.periodStart ? record.periodStart.toISOString() : null,
periodEnd: isWindowActive && record?.periodEnd ? record.periodEnd.toISOString() : null,
consumed,
remaining,
percent,
isWindowActive,
}
})
return {
records,
total: records.length,
}
}
private async findMatchingRules(event: QuotaEvent): Promise<QuotaRule[]> {
const rules = await this.prismaClient.quotaRule.findMany({
where: {
teamId: event.teamId,
resource: event.resource,
enabled: true,
},
})
return rules.filter((rule) => matchesQuotaRule(rule, event))
}
/**
* Evaluates whether an action is permitted under all active matching quota rules.
* Performs an atomic pre-check with SELECT ... FOR UPDATE.
* Throws QuotaExceededError if any matching rule is exceeded.
*/
async checkQuota(
event: QuotaEvent,
amount: number = 0,
): Promise<{ allowed: boolean; matchedRules: QuotaRule[] }> {
const rules = await this.findMatchingRules(event)
if (rules.length === 0) {
return { allowed: true, matchedRules: [] }
}
const now = new Date()
for (const rule of rules) {
const targetUserId = getQuotaRuleTargetUserId(rule, event)
await this.prismaClient.$transaction(async (tx) => {
if (targetUserId === null) {
// Serialize all_members record checks/creations on the parent rule row
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
}
let rawRecord = targetUserId
? ((
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
FOR UPDATE
`
)[0] ?? null)
: ((
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id IS NULL
FOR UPDATE
`
)[0] ?? null)
if (!rawRecord && targetUserId !== null) {
// Lock parent rule on first user record check and re-query
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
rawRecord =
(
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
FOR UPDATE
`
)[0] ?? null
}
const isWindowActive = Boolean(
rawRecord?.period_start &&
rawRecord?.period_end &&
now >= rawRecord.period_start &&
now < rawRecord.period_end,
)
const consumed = isWindowActive ? (rawRecord?.consumed ?? 0) : 0
const periodEnd = isWindowActive
? rawRecord!.period_end!
: new Date(now.getTime() + periodToDurationMs(rule.period))
if (consumed + amount > rule.limit) {
throw new QuotaExceededError({
policyId: rule.id,
resource: rule.resource,
limit: rule.limit,
consumed,
periodEnd,
})
}
})
}
return { allowed: true, matchedRules: rules }
}
/**
* Records consumed usage across all matching quota rules.
* Lazy resets the period window in-place when previous window has expired.
* Uses SELECT ... FOR UPDATE inside transactions for atomic concurrency protection.
*/
async consumeQuota(event: QuotaEvent, amount: number): Promise<void> {
if (amount <= 0) return
const rules = await this.findMatchingRules(event)
if (rules.length === 0) return
const now = new Date()
for (const rule of rules) {
const targetUserId = getQuotaRuleTargetUserId(rule, event)
await this.prismaClient.$transaction(async (tx) => {
if (targetUserId === null) {
// Serialize all_members (shared pool) creations and updates on the parent rule row
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
}
let rawRecord = targetUserId
? ((
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
FOR UPDATE
`
)[0] ?? null)
: ((
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id IS NULL
FOR UPDATE
`
)[0] ?? null)
if (!rawRecord && targetUserId !== null) {
// Lock parent rule on first user record creation and re-query
await tx.$queryRaw`SELECT id FROM quota_rules WHERE id = ${rule.id} FOR UPDATE`
rawRecord =
(
await tx.$queryRaw<RawQuotaRecord[]>`
SELECT * FROM quota_records
WHERE rule_id = ${rule.id} AND user_id = ${targetUserId}
FOR UPDATE
`
)[0] ?? null
}
const isWindowActive = Boolean(
rawRecord?.period_start &&
rawRecord?.period_end &&
now >= rawRecord.period_start &&
now < rawRecord.period_end,
)
if (isWindowActive && rawRecord) {
await tx.quotaRecord.update({
where: { id: rawRecord.id },
data: {
consumed: { increment: amount },
},
})
} else {
const periodStart = now
const periodEnd = new Date(now.getTime() + periodToDurationMs(rule.period))
if (rawRecord) {
await tx.quotaRecord.update({
where: { id: rawRecord.id },
data: {
periodStart,
periodEnd,
consumed: amount,
},
})
} else {
await tx.quotaRecord.create({
data: {
ruleId: rule.id,
teamId: rule.teamId,
userId: targetUserId,
periodStart,
periodEnd,
consumed: amount,
},
})
}
}
})
}
}
}
export const quotaService = new QuotaService()
@@ -0,0 +1,68 @@
-- CreateEnum
CREATE TYPE "QuotaScopeMode" AS ENUM ('all_members', 'each_member', 'selected_members');
-- CreateEnum
CREATE TYPE "QuotaPeriod" AS ENUM ('1hour', '5hour', '1day', '7day');
-- CreateEnum
CREATE TYPE "QuotaResourceType" AS ENUM ('agent_total_tokens', 'agent_cost', 'agent_skill_call_count', 'agent_mcp_call_count', 'agent_bash_call_count', 'agent_tool_call_count');
-- CreateTable
CREATE TABLE "quota_rules" (
"id" TEXT NOT NULL,
"team_id" TEXT NOT NULL,
"scope_mode" "QuotaScopeMode" NOT NULL,
"role" "TeamMemberRole",
"user_ids" JSONB,
"resource" "QuotaResourceType" NOT NULL,
"resource_data" JSONB,
"limit" DOUBLE PRECISION NOT NULL,
"period" "QuotaPeriod" NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "quota_rules_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "quota_records" (
"id" TEXT NOT NULL,
"rule_id" TEXT NOT NULL,
"team_id" TEXT NOT NULL,
"user_id" TEXT,
"period_start" TIMESTAMP(3),
"period_end" TIMESTAMP(3),
"consumed" DOUBLE PRECISION NOT NULL DEFAULT 0,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "quota_records_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "quota_rules_team_id_enabled_idx" ON "quota_rules"("team_id", "enabled");
-- CreateIndex
CREATE INDEX "quota_rules_team_id_resource_idx" ON "quota_rules"("team_id", "resource");
-- CreateIndex
CREATE INDEX "quota_records_team_id_user_id_idx" ON "quota_records"("team_id", "user_id");
-- CreateIndex
CREATE INDEX "quota_records_rule_id_idx" ON "quota_records"("rule_id");
-- CreateIndex
CREATE UNIQUE INDEX "quota_records_rule_id_user_id_key" ON "quota_records"("rule_id", "user_id");
-- AddForeignKey
ALTER TABLE "quota_rules" ADD CONSTRAINT "quota_rules_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_rule_id_fkey" FOREIGN KEY ("rule_id") REFERENCES "quota_rules"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "quota_records" ADD CONSTRAINT "quota_records_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+70
View File
@@ -135,6 +135,28 @@ enum WatermarkFileStatus {
failed
}
enum QuotaScopeMode {
all_members
each_member
selected_members
}
enum QuotaPeriod {
one_hour @map("1hour")
five_hours @map("5hour")
one_day @map("1day")
seven_days @map("7day")
}
enum QuotaResourceType {
agent_total_tokens
agent_cost
agent_skill_call_count
agent_mcp_call_count
agent_bash_call_count
agent_tool_call_count
}
// ----------------------------------------------------------------------
// Models
// ----------------------------------------------------------------------
@@ -172,6 +194,7 @@ model User {
apiTokens ApiToken[] @relation("UserToApiToken")
aiUsages AiUsage[] @relation("UserToAiUsage")
auditLogs AuditLog[] @relation("UserToAuditLog")
quotaRecords QuotaRecord[] @relation("UserToQuotaRecord")
@@map("users")
}
@@ -258,6 +281,8 @@ model Team {
aiUsages AiUsage[] @relation("TeamToAiUsage")
auditLogs AuditLog[] @relation("TeamToAuditLog")
watermarkTemplates WatermarkTemplate[] @relation("TeamToWatermarkTemplate")
quotaRules QuotaRule[] @relation("TeamToQuotaRule")
quotaRecords QuotaRecord[] @relation("TeamToQuotaRecord")
@@map("teams")
}
@@ -1018,4 +1043,49 @@ model AuditLog {
@@map("audit_logs")
}
model QuotaRule {
id String @id @default(ulid())
teamId String @map("team_id")
scopeMode QuotaScopeMode @map("scope_mode")
role TeamMemberRole? @map("role")
/// [QuotaUserIds]
userIds Json? @map("user_ids")
resource QuotaResourceType @map("resource")
/// [QuotaResourceData]
resourceData Json? @map("resource_data")
limit Float @map("limit")
period QuotaPeriod @map("period")
enabled Boolean @default(true) @map("enabled")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
team Team @relation("TeamToQuotaRule", fields: [teamId], references: [id], onDelete: Cascade)
records QuotaRecord[] @relation("QuotaRuleToRecord")
@@index([teamId, enabled])
@@index([teamId, resource])
@@map("quota_rules")
}
model QuotaRecord {
id String @id @default(ulid())
ruleId String @map("rule_id")
teamId String @map("team_id")
userId String? @map("user_id")
periodStart DateTime? @map("period_start")
periodEnd DateTime? @map("period_end")
consumed Float @default(0) @map("consumed")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
rule QuotaRule @relation("QuotaRuleToRecord", fields: [ruleId], references: [id], onDelete: Cascade)
team Team @relation("TeamToQuotaRecord", fields: [teamId], references: [id], onDelete: Cascade)
user User? @relation("UserToQuotaRecord", fields: [userId], references: [id], onDelete: Cascade)
@@unique([ruleId, userId])
@@index([teamId, userId])
@@index([ruleId])
@@map("quota_records")
}
+10
View File
@@ -227,3 +227,13 @@ export type AiUsage = Prisma.AiUsageModel
*
*/
export type AuditLog = Prisma.AuditLogModel
/**
* Model QuotaRule
*
*/
export type QuotaRule = Prisma.QuotaRuleModel
/**
* Model QuotaRecord
*
*/
export type QuotaRecord = Prisma.QuotaRecordModel
+10
View File
@@ -251,3 +251,13 @@ export type AiUsage = Prisma.AiUsageModel
*
*/
export type AuditLog = Prisma.AuditLogModel
/**
* Model QuotaRule
*
*/
export type QuotaRule = Prisma.QuotaRuleModel
/**
* Model QuotaRecord
*
*/
export type QuotaRecord = Prisma.QuotaRecordModel
+136
View File
@@ -748,6 +748,74 @@ export type FloatWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
export type EnumQuotaScopeModeFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel> | $Enums.QuotaScopeMode
}
export type EnumTeamMemberRoleNullableFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
not?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel> | $Enums.TeamMemberRole | null
}
export type EnumQuotaResourceTypeFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel> | $Enums.QuotaResourceType
}
export type EnumQuotaPeriodFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel> | $Enums.QuotaPeriod
}
export type EnumQuotaScopeModeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaScopeMode
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
}
export type EnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
not?: Prisma.NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel> | $Enums.TeamMemberRole | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
_max?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
}
export type EnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaResourceType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
}
export type EnumQuotaPeriodWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel> | $Enums.QuotaPeriod
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
}
export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
@@ -1417,4 +1485,72 @@ export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedFloatFilter<$PrismaModel>
}
export type NestedEnumQuotaScopeModeFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel> | $Enums.QuotaScopeMode
}
export type NestedEnumTeamMemberRoleNullableFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
not?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel> | $Enums.TeamMemberRole | null
}
export type NestedEnumQuotaResourceTypeFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel> | $Enums.QuotaResourceType
}
export type NestedEnumQuotaPeriodFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel> | $Enums.QuotaPeriod
}
export type NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaScopeMode | Prisma.EnumQuotaScopeModeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaScopeMode[] | Prisma.ListEnumQuotaScopeModeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaScopeModeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaScopeMode
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaScopeModeFilter<$PrismaModel>
}
export type NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.TeamMemberRole | Prisma.EnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
in?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
notIn?: $Enums.TeamMemberRole[] | Prisma.ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> | null
not?: Prisma.NestedEnumTeamMemberRoleNullableWithAggregatesFilter<$PrismaModel> | $Enums.TeamMemberRole | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_min?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
_max?: Prisma.NestedEnumTeamMemberRoleNullableFilter<$PrismaModel>
}
export type NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaResourceType | Prisma.EnumQuotaResourceTypeFieldRefInput<$PrismaModel>
in?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaResourceType[] | Prisma.ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaResourceTypeWithAggregatesFilter<$PrismaModel> | $Enums.QuotaResourceType
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaResourceTypeFilter<$PrismaModel>
}
export type NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel = never> = {
equals?: $Enums.QuotaPeriod | Prisma.EnumQuotaPeriodFieldRefInput<$PrismaModel>
in?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
notIn?: $Enums.QuotaPeriod[] | Prisma.ListEnumQuotaPeriodFieldRefInput<$PrismaModel>
not?: Prisma.NestedEnumQuotaPeriodWithAggregatesFilter<$PrismaModel> | $Enums.QuotaPeriod
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
_max?: Prisma.NestedEnumQuotaPeriodFilter<$PrismaModel>
}
+31
View File
@@ -173,6 +173,37 @@ export const WatermarkFileStatus = {
export type WatermarkFileStatus = (typeof WatermarkFileStatus)[keyof typeof WatermarkFileStatus]
export const QuotaScopeMode = {
all_members: 'all_members',
each_member: 'each_member',
selected_members: 'selected_members'
} as const
export type QuotaScopeMode = (typeof QuotaScopeMode)[keyof typeof QuotaScopeMode]
export const QuotaPeriod = {
one_hour: 'one_hour',
five_hours: 'five_hours',
one_day: 'one_day',
seven_days: 'seven_days'
} as const
export type QuotaPeriod = (typeof QuotaPeriod)[keyof typeof QuotaPeriod]
export const QuotaResourceType = {
agent_total_tokens: 'agent_total_tokens',
agent_cost: 'agent_cost',
agent_skill_call_count: 'agent_skill_call_count',
agent_mcp_call_count: 'agent_mcp_call_count',
agent_bash_call_count: 'agent_bash_call_count',
agent_tool_call_count: 'agent_tool_call_count'
} as const
export type QuotaResourceType = (typeof QuotaResourceType)[keyof typeof QuotaResourceType]
export const AgentType = {
chat: 'chat',
autofill: 'autofill',
File diff suppressed because one or more lines are too long
+229 -2
View File
@@ -425,7 +425,9 @@ export const ModelName = {
Collection: 'Collection',
ApiToken: 'ApiToken',
AiUsage: 'AiUsage',
AuditLog: 'AuditLog'
AuditLog: 'AuditLog',
QuotaRule: 'QuotaRule',
QuotaRecord: 'QuotaRecord'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -441,7 +443,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog"
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord"
txIsolationLevel: TransactionIsolationLevel
}
model: {
@@ -3553,6 +3555,154 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
QuotaRule: {
payload: Prisma.$QuotaRulePayload<ExtArgs>
fields: Prisma.QuotaRuleFieldRefs
operations: {
findUnique: {
args: Prisma.QuotaRuleFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload> | null
}
findUniqueOrThrow: {
args: Prisma.QuotaRuleFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
findFirst: {
args: Prisma.QuotaRuleFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload> | null
}
findFirstOrThrow: {
args: Prisma.QuotaRuleFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
findMany: {
args: Prisma.QuotaRuleFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
}
create: {
args: Prisma.QuotaRuleCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
createMany: {
args: Prisma.QuotaRuleCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.QuotaRuleCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
}
delete: {
args: Prisma.QuotaRuleDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
update: {
args: Prisma.QuotaRuleUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
deleteMany: {
args: Prisma.QuotaRuleDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.QuotaRuleUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.QuotaRuleUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>[]
}
upsert: {
args: Prisma.QuotaRuleUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRulePayload>
}
aggregate: {
args: Prisma.QuotaRuleAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateQuotaRule>
}
groupBy: {
args: Prisma.QuotaRuleGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.QuotaRuleGroupByOutputType>[]
}
count: {
args: Prisma.QuotaRuleCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.QuotaRuleCountAggregateOutputType> | number
}
}
}
QuotaRecord: {
payload: Prisma.$QuotaRecordPayload<ExtArgs>
fields: Prisma.QuotaRecordFieldRefs
operations: {
findUnique: {
args: Prisma.QuotaRecordFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload> | null
}
findUniqueOrThrow: {
args: Prisma.QuotaRecordFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
findFirst: {
args: Prisma.QuotaRecordFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload> | null
}
findFirstOrThrow: {
args: Prisma.QuotaRecordFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
findMany: {
args: Prisma.QuotaRecordFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
}
create: {
args: Prisma.QuotaRecordCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
createMany: {
args: Prisma.QuotaRecordCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.QuotaRecordCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
}
delete: {
args: Prisma.QuotaRecordDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
update: {
args: Prisma.QuotaRecordUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
deleteMany: {
args: Prisma.QuotaRecordDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.QuotaRecordUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.QuotaRecordUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>[]
}
upsert: {
args: Prisma.QuotaRecordUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$QuotaRecordPayload>
}
aggregate: {
args: Prisma.QuotaRecordAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateQuotaRecord>
}
groupBy: {
args: Prisma.QuotaRecordGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.QuotaRecordGroupByOutputType>[]
}
count: {
args: Prisma.QuotaRecordCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.QuotaRecordCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
@@ -4200,6 +4350,39 @@ export const AuditLogScalarFieldEnum = {
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
export const QuotaRuleScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
scopeMode: 'scopeMode',
role: 'role',
userIds: 'userIds',
resource: 'resource',
resourceData: 'resourceData',
limit: 'limit',
period: 'period',
enabled: 'enabled',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type QuotaRuleScalarFieldEnum = (typeof QuotaRuleScalarFieldEnum)[keyof typeof QuotaRuleScalarFieldEnum]
export const QuotaRecordScalarFieldEnum = {
id: 'id',
ruleId: 'ruleId',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
periodEnd: 'periodEnd',
consumed: 'consumed',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type QuotaRecordScalarFieldEnum = (typeof QuotaRecordScalarFieldEnum)[keyof typeof QuotaRecordScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
@@ -4610,6 +4793,48 @@ export type EnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<
export type ListEnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType[]'>
/**
* Reference to a field of type 'QuotaScopeMode'
*/
export type EnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode'>
/**
* Reference to a field of type 'QuotaScopeMode[]'
*/
export type ListEnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode[]'>
/**
* Reference to a field of type 'QuotaResourceType'
*/
export type EnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType'>
/**
* Reference to a field of type 'QuotaResourceType[]'
*/
export type ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType[]'>
/**
* Reference to a field of type 'QuotaPeriod'
*/
export type EnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod'>
/**
* Reference to a field of type 'QuotaPeriod[]'
*/
export type ListEnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod[]'>
/**
* Batch Payload for updateMany & deleteMany & createMany
*/
@@ -4762,6 +4987,8 @@ export type GlobalOmitConfig = {
apiToken?: Prisma.ApiTokenOmit
aiUsage?: Prisma.AiUsageOmit
auditLog?: Prisma.AuditLogOmit
quotaRule?: Prisma.QuotaRuleOmit
quotaRecord?: Prisma.QuotaRecordOmit
}
/* Types for Logging */
@@ -92,7 +92,9 @@ export const ModelName = {
Collection: 'Collection',
ApiToken: 'ApiToken',
AiUsage: 'AiUsage',
AuditLog: 'AuditLog'
AuditLog: 'AuditLog',
QuotaRule: 'QuotaRule',
QuotaRecord: 'QuotaRecord'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -719,6 +721,39 @@ export const AuditLogScalarFieldEnum = {
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
export const QuotaRuleScalarFieldEnum = {
id: 'id',
teamId: 'teamId',
scopeMode: 'scopeMode',
role: 'role',
userIds: 'userIds',
resource: 'resource',
resourceData: 'resourceData',
limit: 'limit',
period: 'period',
enabled: 'enabled',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type QuotaRuleScalarFieldEnum = (typeof QuotaRuleScalarFieldEnum)[keyof typeof QuotaRuleScalarFieldEnum]
export const QuotaRecordScalarFieldEnum = {
id: 'id',
ruleId: 'ruleId',
teamId: 'teamId',
userId: 'userId',
periodStart: 'periodStart',
periodEnd: 'periodEnd',
consumed: 'consumed',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type QuotaRecordScalarFieldEnum = (typeof QuotaRecordScalarFieldEnum)[keyof typeof QuotaRecordScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
+2
View File
@@ -50,4 +50,6 @@ export type * from './models/Collection.ts'
export type * from './models/ApiToken.ts'
export type * from './models/AiUsage.ts'
export type * from './models/AuditLog.ts'
export type * from './models/QuotaRule.ts'
export type * from './models/QuotaRecord.ts'
export type * from './commonInputTypes.ts'
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+460
View File
@@ -203,6 +203,8 @@ export type TeamWhereInput = {
aiUsages?: Prisma.AiUsageListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
quotaRules?: Prisma.QuotaRuleListRelationFilter
quotaRecords?: Prisma.QuotaRecordListRelationFilter
}
export type TeamOrderByWithRelationInput = {
@@ -227,6 +229,8 @@ export type TeamOrderByWithRelationInput = {
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
watermarkTemplates?: Prisma.WatermarkTemplateOrderByRelationAggregateInput
quotaRules?: Prisma.QuotaRuleOrderByRelationAggregateInput
quotaRecords?: Prisma.QuotaRecordOrderByRelationAggregateInput
}
export type TeamWhereUniqueInput = Prisma.AtLeast<{
@@ -254,6 +258,8 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
aiUsages?: Prisma.AiUsageListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
watermarkTemplates?: Prisma.WatermarkTemplateListRelationFilter
quotaRules?: Prisma.QuotaRuleListRelationFilter
quotaRecords?: Prisma.QuotaRecordListRelationFilter
}, "id" | "rootFolderId">
export type TeamOrderByWithAggregationInput = {
@@ -301,6 +307,8 @@ export type TeamCreateInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateInput = {
@@ -324,6 +332,8 @@ export type TeamUncheckedCreateInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamUpdateInput = {
@@ -347,6 +357,8 @@ export type TeamUpdateInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateInput = {
@@ -370,6 +382,8 @@ export type TeamUncheckedUpdateInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateManyInput = {
@@ -665,6 +679,34 @@ export type TeamUpdateOneRequiredWithoutAuditLogsNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.TeamUpdateWithoutAuditLogsInput>, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
}
export type TeamCreateNestedOneWithoutQuotaRulesInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRulesInput
connect?: Prisma.TeamWhereUniqueInput
}
export type TeamUpdateOneRequiredWithoutQuotaRulesNestedInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRulesInput
upsert?: Prisma.TeamUpsertWithoutQuotaRulesInput
connect?: Prisma.TeamWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutQuotaRulesInput, Prisma.TeamUpdateWithoutQuotaRulesInput>, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
}
export type TeamCreateNestedOneWithoutQuotaRecordsInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRecordsInput
connect?: Prisma.TeamWhereUniqueInput
}
export type TeamUpdateOneRequiredWithoutQuotaRecordsNestedInput = {
create?: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutQuotaRecordsInput
upsert?: Prisma.TeamUpsertWithoutQuotaRecordsInput
connect?: Prisma.TeamWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutQuotaRecordsInput, Prisma.TeamUpdateWithoutQuotaRecordsInput>, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
}
export type TeamCreateWithoutSandboxInput = {
id?: string
name: string
@@ -685,6 +727,8 @@ export type TeamCreateWithoutSandboxInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSandboxInput = {
@@ -707,6 +751,8 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSandboxInput = {
@@ -745,6 +791,8 @@ export type TeamUpdateWithoutSandboxInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSandboxInput = {
@@ -767,6 +815,8 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutSkillsInput = {
@@ -789,6 +839,8 @@ export type TeamCreateWithoutSkillsInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutSkillsInput = {
@@ -811,6 +863,8 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutSkillsInput = {
@@ -849,6 +903,8 @@ export type TeamUpdateWithoutSkillsInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutSkillsInput = {
@@ -871,6 +927,8 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMembersInput = {
@@ -893,6 +951,8 @@ export type TeamCreateWithoutMembersInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMembersInput = {
@@ -915,6 +975,8 @@ export type TeamUncheckedCreateWithoutMembersInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMembersInput = {
@@ -953,6 +1015,8 @@ export type TeamUpdateWithoutMembersInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMembersInput = {
@@ -975,6 +1039,8 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProjectsInput = {
@@ -997,6 +1063,8 @@ export type TeamCreateWithoutProjectsInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProjectsInput = {
@@ -1019,6 +1087,8 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProjectsInput = {
@@ -1057,6 +1127,8 @@ export type TeamUpdateWithoutProjectsInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProjectsInput = {
@@ -1079,6 +1151,8 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutWatermarkTemplatesInput = {
@@ -1101,6 +1175,8 @@ export type TeamCreateWithoutWatermarkTemplatesInput = {
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutWatermarkTemplatesInput = {
@@ -1123,6 +1199,8 @@ export type TeamUncheckedCreateWithoutWatermarkTemplatesInput = {
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutWatermarkTemplatesInput = {
@@ -1161,6 +1239,8 @@ export type TeamUpdateWithoutWatermarkTemplatesInput = {
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutWatermarkTemplatesInput = {
@@ -1183,6 +1263,8 @@ export type TeamUncheckedUpdateWithoutWatermarkTemplatesInput = {
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutRootFolderInput = {
@@ -1205,6 +1287,8 @@ export type TeamCreateWithoutRootFolderInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutRootFolderInput = {
@@ -1227,6 +1311,8 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutRootFolderInput = {
@@ -1265,6 +1351,8 @@ export type TeamUpdateWithoutRootFolderInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutRootFolderInput = {
@@ -1287,6 +1375,8 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutInvitesInput = {
@@ -1309,6 +1399,8 @@ export type TeamCreateWithoutInvitesInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutInvitesInput = {
@@ -1331,6 +1423,8 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutInvitesInput = {
@@ -1369,6 +1463,8 @@ export type TeamUpdateWithoutInvitesInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutInvitesInput = {
@@ -1391,6 +1487,8 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMetadataFieldsInput = {
@@ -1413,6 +1511,8 @@ export type TeamCreateWithoutMetadataFieldsInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
@@ -1435,6 +1535,8 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
@@ -1473,6 +1575,8 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
@@ -1495,6 +1599,8 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutNotificationsInput = {
@@ -1517,6 +1623,8 @@ export type TeamCreateWithoutNotificationsInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutNotificationsInput = {
@@ -1539,6 +1647,8 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutNotificationsInput = {
@@ -1577,6 +1687,8 @@ export type TeamUpdateWithoutNotificationsInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutNotificationsInput = {
@@ -1599,6 +1711,8 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAgentsInput = {
@@ -1621,6 +1735,8 @@ export type TeamCreateWithoutAgentsInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAgentsInput = {
@@ -1643,6 +1759,8 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAgentsInput = {
@@ -1681,6 +1799,8 @@ export type TeamUpdateWithoutAgentsInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAgentsInput = {
@@ -1703,6 +1823,8 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutMcpServersInput = {
@@ -1725,6 +1847,8 @@ export type TeamCreateWithoutMcpServersInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutMcpServersInput = {
@@ -1747,6 +1871,8 @@ export type TeamUncheckedCreateWithoutMcpServersInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutMcpServersInput = {
@@ -1785,6 +1911,8 @@ export type TeamUpdateWithoutMcpServersInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutMcpServersInput = {
@@ -1807,6 +1935,8 @@ export type TeamUncheckedUpdateWithoutMcpServersInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutUserMetadataInput = {
@@ -1829,6 +1959,8 @@ export type TeamCreateWithoutUserMetadataInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutUserMetadataInput = {
@@ -1851,6 +1983,8 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutUserMetadataInput = {
@@ -1889,6 +2023,8 @@ export type TeamUpdateWithoutUserMetadataInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
@@ -1911,6 +2047,8 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutProvidersInput = {
@@ -1933,6 +2071,8 @@ export type TeamCreateWithoutProvidersInput = {
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutProvidersInput = {
@@ -1955,6 +2095,8 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutProvidersInput = {
@@ -1993,6 +2135,8 @@ export type TeamUpdateWithoutProvidersInput = {
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutProvidersInput = {
@@ -2015,6 +2159,8 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAiUsagesInput = {
@@ -2037,6 +2183,8 @@ export type TeamCreateWithoutAiUsagesInput = {
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAiUsagesInput = {
@@ -2059,6 +2207,8 @@ export type TeamUncheckedCreateWithoutAiUsagesInput = {
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAiUsagesInput = {
@@ -2097,6 +2247,8 @@ export type TeamUpdateWithoutAiUsagesInput = {
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
@@ -2119,6 +2271,8 @@ export type TeamUncheckedUpdateWithoutAiUsagesInput = {
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutAuditLogsInput = {
@@ -2141,6 +2295,8 @@ export type TeamCreateWithoutAuditLogsInput = {
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutAuditLogsInput = {
@@ -2163,6 +2319,8 @@ export type TeamUncheckedCreateWithoutAuditLogsInput = {
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutAuditLogsInput = {
@@ -2201,6 +2359,8 @@ export type TeamUpdateWithoutAuditLogsInput = {
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutAuditLogsInput = {
@@ -2223,6 +2383,232 @@ export type TeamUncheckedUpdateWithoutAuditLogsInput = {
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutQuotaRulesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
mcpServers?: Prisma.McpServerCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutQuotaRulesInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolderId?: string | null
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
mcpServers?: Prisma.McpServerUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutQuotaRulesInput = {
where: Prisma.TeamWhereUniqueInput
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
}
export type TeamUpsertWithoutQuotaRulesInput = {
update: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRulesInput, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRulesInput, Prisma.TeamUncheckedCreateWithoutQuotaRulesInput>
where?: Prisma.TeamWhereInput
}
export type TeamUpdateToOneWithWhereWithoutQuotaRulesInput = {
where?: Prisma.TeamWhereInput
data: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRulesInput, Prisma.TeamUncheckedUpdateWithoutQuotaRulesInput>
}
export type TeamUpdateWithoutQuotaRulesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
mcpServers?: Prisma.McpServerUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutQuotaRulesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
mcpServers?: Prisma.McpServerUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutTeamNestedInput
}
export type TeamCreateWithoutQuotaRecordsInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
mcpServers?: Prisma.McpServerCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleCreateNestedManyWithoutTeamInput
}
export type TeamUncheckedCreateWithoutQuotaRecordsInput = {
id?: string
name: string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Date | string
updatedAt?: Date | string
rootFolderId?: string | null
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
mcpServers?: Prisma.McpServerUncheckedCreateNestedManyWithoutTeamInput
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedCreateNestedManyWithoutTeamInput
quotaRules?: Prisma.QuotaRuleUncheckedCreateNestedManyWithoutTeamInput
}
export type TeamCreateOrConnectWithoutQuotaRecordsInput = {
where: Prisma.TeamWhereUniqueInput
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
}
export type TeamUpsertWithoutQuotaRecordsInput = {
update: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRecordsInput, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
create: Prisma.XOR<Prisma.TeamCreateWithoutQuotaRecordsInput, Prisma.TeamUncheckedCreateWithoutQuotaRecordsInput>
where?: Prisma.TeamWhereInput
}
export type TeamUpdateToOneWithWhereWithoutQuotaRecordsInput = {
where?: Prisma.TeamWhereInput
data: Prisma.XOR<Prisma.TeamUpdateWithoutQuotaRecordsInput, Prisma.TeamUncheckedUpdateWithoutQuotaRecordsInput>
}
export type TeamUpdateWithoutQuotaRecordsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
mcpServers?: Prisma.McpServerUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUpdateManyWithoutTeamNestedInput
}
export type TeamUncheckedUpdateWithoutQuotaRecordsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
name?: Prisma.StringFieldUpdateOperationsInput | string
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
mcpServers?: Prisma.McpServerUncheckedUpdateManyWithoutTeamNestedInput
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
watermarkTemplates?: Prisma.WatermarkTemplateUncheckedUpdateManyWithoutTeamNestedInput
quotaRules?: Prisma.QuotaRuleUncheckedUpdateManyWithoutTeamNestedInput
}
@@ -2244,6 +2630,8 @@ export type TeamCountOutputType = {
aiUsages: number
auditLogs: number
watermarkTemplates: number
quotaRules: number
quotaRecords: number
}
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -2260,6 +2648,8 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
auditLogs?: boolean | TeamCountOutputTypeCountAuditLogsArgs
watermarkTemplates?: boolean | TeamCountOutputTypeCountWatermarkTemplatesArgs
quotaRules?: boolean | TeamCountOutputTypeCountQuotaRulesArgs
quotaRecords?: boolean | TeamCountOutputTypeCountQuotaRecordsArgs
}
/**
@@ -2363,6 +2753,20 @@ export type TeamCountOutputTypeCountWatermarkTemplatesArgs<ExtArgs extends runti
where?: Prisma.WatermarkTemplateWhereInput
}
/**
* TeamCountOutputType without action
*/
export type TeamCountOutputTypeCountQuotaRulesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.QuotaRuleWhereInput
}
/**
* TeamCountOutputType without action
*/
export type TeamCountOutputTypeCountQuotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.QuotaRecordWhereInput
}
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -2386,6 +2790,8 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
quotaRules?: boolean | Prisma.Team$quotaRulesArgs<ExtArgs>
quotaRecords?: boolean | Prisma.Team$quotaRecordsArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["team"]>
@@ -2435,6 +2841,8 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
watermarkTemplates?: boolean | Prisma.Team$watermarkTemplatesArgs<ExtArgs>
quotaRules?: boolean | Prisma.Team$quotaRulesArgs<ExtArgs>
quotaRecords?: boolean | Prisma.Team$quotaRecordsArgs<ExtArgs>
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
}
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -2462,6 +2870,8 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
watermarkTemplates: Prisma.$WatermarkTemplatePayload<ExtArgs>[]
quotaRules: Prisma.$QuotaRulePayload<ExtArgs>[]
quotaRecords: Prisma.$QuotaRecordPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -2882,6 +3292,8 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
auditLogs<T extends Prisma.Team$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
watermarkTemplates<T extends Prisma.Team$watermarkTemplatesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$watermarkTemplatesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$WatermarkTemplatePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
quotaRules<T extends Prisma.Team$quotaRulesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$quotaRulesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRulePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
quotaRecords<T extends Prisma.Team$quotaRecordsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$quotaRecordsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRecordPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -3667,6 +4079,54 @@ export type Team$watermarkTemplatesArgs<ExtArgs extends runtime.Types.Extensions
distinct?: Prisma.WatermarkTemplateScalarFieldEnum | Prisma.WatermarkTemplateScalarFieldEnum[]
}
/**
* Team.quotaRules
*/
export type Team$quotaRulesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the QuotaRule
*/
select?: Prisma.QuotaRuleSelect<ExtArgs> | null
/**
* Omit specific fields from the QuotaRule
*/
omit?: Prisma.QuotaRuleOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.QuotaRuleInclude<ExtArgs> | null
where?: Prisma.QuotaRuleWhereInput
orderBy?: Prisma.QuotaRuleOrderByWithRelationInput | Prisma.QuotaRuleOrderByWithRelationInput[]
cursor?: Prisma.QuotaRuleWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.QuotaRuleScalarFieldEnum | Prisma.QuotaRuleScalarFieldEnum[]
}
/**
* Team.quotaRecords
*/
export type Team$quotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the QuotaRecord
*/
select?: Prisma.QuotaRecordSelect<ExtArgs> | null
/**
* Omit specific fields from the QuotaRecord
*/
omit?: Prisma.QuotaRecordOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.QuotaRecordInclude<ExtArgs> | null
where?: Prisma.QuotaRecordWhereInput
orderBy?: Prisma.QuotaRecordOrderByWithRelationInput | Prisma.QuotaRecordOrderByWithRelationInput[]
cursor?: Prisma.QuotaRecordWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.QuotaRecordScalarFieldEnum | Prisma.QuotaRecordScalarFieldEnum[]
}
/**
* Team without action
*/
+284
View File
@@ -247,6 +247,7 @@ export type UserWhereInput = {
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
quotaRecords?: Prisma.QuotaRecordListRelationFilter
}
export type UserOrderByWithRelationInput = {
@@ -280,6 +281,7 @@ export type UserOrderByWithRelationInput = {
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
quotaRecords?: Prisma.QuotaRecordOrderByRelationAggregateInput
}
export type UserWhereUniqueInput = Prisma.AtLeast<{
@@ -316,6 +318,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
apiTokens?: Prisma.ApiTokenListRelationFilter
aiUsages?: Prisma.AiUsageListRelationFilter
auditLogs?: Prisma.AuditLogListRelationFilter
quotaRecords?: Prisma.QuotaRecordListRelationFilter
}, "id" | "email">
export type UserOrderByWithAggregationInput = {
@@ -383,6 +386,7 @@ export type UserCreateInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateInput = {
@@ -416,6 +420,7 @@ export type UserUncheckedCreateInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserUpdateInput = {
@@ -449,6 +454,7 @@ export type UserUpdateInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateInput = {
@@ -482,6 +488,7 @@ export type UserUncheckedUpdateInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateManyInput = {
@@ -884,6 +891,22 @@ export type UserUpdateOneWithoutAuditLogsNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.UserUpdateWithoutAuditLogsInput>, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
}
export type UserCreateNestedOneWithoutQuotaRecordsInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutQuotaRecordsInput
connect?: Prisma.UserWhereUniqueInput
}
export type UserUpdateOneWithoutQuotaRecordsNestedInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutQuotaRecordsInput
upsert?: Prisma.UserUpsertWithoutQuotaRecordsInput
disconnect?: Prisma.UserWhereInput | boolean
delete?: Prisma.UserWhereInput | boolean
connect?: Prisma.UserWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutQuotaRecordsInput, Prisma.UserUpdateWithoutQuotaRecordsInput>, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
}
export type UserCreateWithoutSessionsInput = {
id?: string
type?: $Enums.UserType
@@ -914,6 +937,7 @@ export type UserCreateWithoutSessionsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutSessionsInput = {
@@ -946,6 +970,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutSessionsInput = {
@@ -994,6 +1019,7 @@ export type UserUpdateWithoutSessionsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutSessionsInput = {
@@ -1026,6 +1052,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAccountsInput = {
@@ -1058,6 +1085,7 @@ export type UserCreateWithoutAccountsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAccountsInput = {
@@ -1090,6 +1118,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAccountsInput = {
@@ -1138,6 +1167,7 @@ export type UserUpdateWithoutAccountsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAccountsInput = {
@@ -1170,6 +1200,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAuthTokensInput = {
@@ -1202,6 +1233,7 @@ export type UserCreateWithoutAuthTokensInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAuthTokensInput = {
@@ -1234,6 +1266,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAuthTokensInput = {
@@ -1282,6 +1315,7 @@ export type UserUpdateWithoutAuthTokensInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAuthTokensInput = {
@@ -1314,6 +1348,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTeamMembersInput = {
@@ -1346,6 +1381,7 @@ export type UserCreateWithoutTeamMembersInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTeamMembersInput = {
@@ -1378,6 +1414,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTeamMembersInput = {
@@ -1426,6 +1463,7 @@ export type UserUpdateWithoutTeamMembersInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTeamMembersInput = {
@@ -1458,6 +1496,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutShareLinksInput = {
@@ -1490,6 +1529,7 @@ export type UserCreateWithoutShareLinksInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutShareLinksInput = {
@@ -1522,6 +1562,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutShareLinksInput = {
@@ -1570,6 +1611,7 @@ export type UserUpdateWithoutShareLinksInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutShareLinksInput = {
@@ -1602,6 +1644,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAssetsInput = {
@@ -1634,6 +1677,7 @@ export type UserCreateWithoutAssetsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAssetsInput = {
@@ -1666,6 +1710,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAssetsInput = {
@@ -1714,6 +1759,7 @@ export type UserUpdateWithoutAssetsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAssetsInput = {
@@ -1746,6 +1792,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCommentsInput = {
@@ -1778,6 +1825,7 @@ export type UserCreateWithoutCommentsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCommentsInput = {
@@ -1810,6 +1858,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCommentsInput = {
@@ -1847,6 +1896,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
@@ -1879,6 +1929,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
@@ -1927,6 +1978,7 @@ export type UserUpdateWithoutCommentsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCommentsInput = {
@@ -1959,6 +2011,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutCompletionChangedCommentsInput = {
@@ -2002,6 +2055,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
@@ -2034,6 +2088,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedInvitesInput = {
@@ -2066,6 +2121,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
@@ -2098,6 +2154,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
@@ -2146,6 +2203,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
@@ -2178,6 +2236,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCreatedNotificationsInput = {
@@ -2210,6 +2269,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
@@ -2242,6 +2302,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
@@ -2279,6 +2340,7 @@ export type UserCreateWithoutNotificationsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutNotificationsInput = {
@@ -2311,6 +2373,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutNotificationsInput = {
@@ -2359,6 +2422,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
@@ -2391,6 +2455,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutNotificationsInput = {
@@ -2434,6 +2499,7 @@ export type UserUpdateWithoutNotificationsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutNotificationsInput = {
@@ -2466,6 +2532,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutTasksInput = {
@@ -2498,6 +2565,7 @@ export type UserCreateWithoutTasksInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutTasksInput = {
@@ -2530,6 +2598,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutTasksInput = {
@@ -2578,6 +2647,7 @@ export type UserUpdateWithoutTasksInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutTasksInput = {
@@ -2610,6 +2680,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentInput = {
@@ -2642,6 +2713,7 @@ export type UserCreateWithoutAgentInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentInput = {
@@ -2674,6 +2746,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentInput = {
@@ -2722,6 +2795,7 @@ export type UserUpdateWithoutAgentInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentInput = {
@@ -2754,6 +2828,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAgentSessionsInput = {
@@ -2786,6 +2861,7 @@ export type UserCreateWithoutAgentSessionsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAgentSessionsInput = {
@@ -2818,6 +2894,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAgentSessionsInput = {
@@ -2866,6 +2943,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
@@ -2898,6 +2976,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutUserMetadataInput = {
@@ -2930,6 +3009,7 @@ export type UserCreateWithoutUserMetadataInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutUserMetadataInput = {
@@ -2962,6 +3042,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutUserMetadataInput = {
@@ -3010,6 +3091,7 @@ export type UserUpdateWithoutUserMetadataInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutUserMetadataInput = {
@@ -3042,6 +3124,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutCollectionsInput = {
@@ -3074,6 +3157,7 @@ export type UserCreateWithoutCollectionsInput = {
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCollectionsInput = {
@@ -3106,6 +3190,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCollectionsInput = {
@@ -3154,6 +3239,7 @@ export type UserUpdateWithoutCollectionsInput = {
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCollectionsInput = {
@@ -3186,6 +3272,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutApiTokensInput = {
@@ -3218,6 +3305,7 @@ export type UserCreateWithoutApiTokensInput = {
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutApiTokensInput = {
@@ -3250,6 +3338,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutApiTokensInput = {
@@ -3298,6 +3387,7 @@ export type UserUpdateWithoutApiTokensInput = {
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutApiTokensInput = {
@@ -3330,6 +3420,7 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAiUsagesInput = {
@@ -3362,6 +3453,7 @@ export type UserCreateWithoutAiUsagesInput = {
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAiUsagesInput = {
@@ -3394,6 +3486,7 @@ export type UserUncheckedCreateWithoutAiUsagesInput = {
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAiUsagesInput = {
@@ -3442,6 +3535,7 @@ export type UserUpdateWithoutAiUsagesInput = {
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAiUsagesInput = {
@@ -3474,6 +3568,7 @@ export type UserUncheckedUpdateWithoutAiUsagesInput = {
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutAuditLogsInput = {
@@ -3506,6 +3601,7 @@ export type UserCreateWithoutAuditLogsInput = {
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutAuditLogsInput = {
@@ -3538,6 +3634,7 @@ export type UserUncheckedCreateWithoutAuditLogsInput = {
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
quotaRecords?: Prisma.QuotaRecordUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutAuditLogsInput = {
@@ -3586,6 +3683,7 @@ export type UserUpdateWithoutAuditLogsInput = {
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutAuditLogsInput = {
@@ -3618,6 +3716,155 @@ export type UserUncheckedUpdateWithoutAuditLogsInput = {
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
quotaRecords?: Prisma.QuotaRecordUncheckedUpdateManyWithoutUserNestedInput
}
export type UserCreateWithoutQuotaRecordsInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountCreateNestedManyWithoutUserInput
agent?: Prisma.AgentCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutQuotaRecordsInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput
agent?: Prisma.AgentUncheckedCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutQuotaRecordsInput = {
where: Prisma.UserWhereUniqueInput
create: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
}
export type UserUpsertWithoutQuotaRecordsInput = {
update: Prisma.XOR<Prisma.UserUpdateWithoutQuotaRecordsInput, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
create: Prisma.XOR<Prisma.UserCreateWithoutQuotaRecordsInput, Prisma.UserUncheckedCreateWithoutQuotaRecordsInput>
where?: Prisma.UserWhereInput
}
export type UserUpdateToOneWithWhereWithoutQuotaRecordsInput = {
where?: Prisma.UserWhereInput
data: Prisma.XOR<Prisma.UserUpdateWithoutQuotaRecordsInput, Prisma.UserUncheckedUpdateWithoutQuotaRecordsInput>
}
export type UserUpdateWithoutQuotaRecordsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutQuotaRecordsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUncheckedUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUncheckedUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
}
@@ -3644,6 +3891,7 @@ export type UserCountOutputType = {
apiTokens: number
aiUsages: number
auditLogs: number
quotaRecords: number
}
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -3665,6 +3913,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
auditLogs?: boolean | UserCountOutputTypeCountAuditLogsArgs
quotaRecords?: boolean | UserCountOutputTypeCountQuotaRecordsArgs
}
/**
@@ -3803,6 +4052,13 @@ export type UserCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.
where?: Prisma.AuditLogWhereInput
}
/**
* UserCountOutputType without action
*/
export type UserCountOutputTypeCountQuotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.QuotaRecordWhereInput
}
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -3835,6 +4091,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
quotaRecords?: boolean | Prisma.User$quotaRecordsArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["user"]>
@@ -3901,6 +4158,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
quotaRecords?: boolean | Prisma.User$quotaRecordsArgs<ExtArgs>
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
}
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
@@ -3928,6 +4186,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
quotaRecords: Prisma.$QuotaRecordPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -4357,6 +4616,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
apiTokens<T extends Prisma.User$apiTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$apiTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApiTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
aiUsages<T extends Prisma.User$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
auditLogs<T extends Prisma.User$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
quotaRecords<T extends Prisma.User$quotaRecordsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$quotaRecordsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$QuotaRecordPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -5240,6 +5500,30 @@ export type User$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.Internal
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
}
/**
* User.quotaRecords
*/
export type User$quotaRecordsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the QuotaRecord
*/
select?: Prisma.QuotaRecordSelect<ExtArgs> | null
/**
* Omit specific fields from the QuotaRecord
*/
omit?: Prisma.QuotaRecordOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.QuotaRecordInclude<ExtArgs> | null
where?: Prisma.QuotaRecordWhereInput
orderBy?: Prisma.QuotaRecordOrderByWithRelationInput | Prisma.QuotaRecordOrderByWithRelationInput[]
cursor?: Prisma.QuotaRecordWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.QuotaRecordScalarFieldEnum | Prisma.QuotaRecordScalarFieldEnum[]
}
/**
* User without action
*/
+6
View File
@@ -425,5 +425,11 @@ declare global {
grantType?: 'authorization_code' | 'client_credentials'
redirectUri?: string
}
// ----------------------------------------------------------------------
// Quota Types
// ----------------------------------------------------------------------
export type QuotaResourceData = Record<string, unknown>
export type QuotaUserIds = string[]
}
}
+6
View File
@@ -46,6 +46,12 @@ export enum AuditAction {
comment_update = 'comment_update',
comment_delete = 'comment_delete',
comment_complete = 'comment_complete',
quota_rule_create = 'quota_rule_create',
quota_rule_update = 'quota_rule_update',
quota_rule_delete = 'quota_rule_delete',
quota_policy_create = 'quota_policy_create',
quota_policy_update = 'quota_policy_update',
quota_policy_delete = 'quota_policy_delete',
}
export const auditLogSchema = z.object({
+1
View File
@@ -22,3 +22,4 @@ export * from './versionStack'
export * from './chat'
export * from './auditLog'
export * from './watermark'
export * from './quota'
+257
View File
@@ -0,0 +1,257 @@
import { z } from 'zod'
import { QuotaScopeMode, QuotaPeriod, QuotaResourceType } from '@shumai/db/enums'
export { QuotaScopeMode, QuotaPeriod, QuotaResourceType }
export const quotaScopeModeSchema = z.nativeEnum(QuotaScopeMode)
export type QuotaScopeModeEnum = z.infer<typeof quotaScopeModeSchema>
export const quotaPeriodSchema = z.enum([
'1hour',
'5hour',
'1day',
'7day',
'one_hour',
'five_hours',
'one_day',
'seven_days',
])
export type QuotaPeriodEnum = z.infer<typeof quotaPeriodSchema>
export function normalizeQuotaPeriod(period: QuotaPeriodEnum | string): QuotaPeriod {
switch (period) {
case '1hour':
case 'one_hour':
return 'one_hour'
case '5hour':
case 'five_hours':
return 'five_hours'
case '1day':
case 'one_day':
return 'one_day'
case '7day':
case 'seven_days':
return 'seven_days'
default:
return 'one_hour'
}
}
export function formatQuotaPeriod(period: QuotaPeriod | string): string {
switch (period) {
case 'one_hour':
case '1hour':
return '1hour'
case 'five_hours':
case '5hour':
return '5hour'
case 'one_day':
case '1day':
return '1day'
case 'seven_days':
case '7day':
return '7day'
default:
return period
}
}
export const quotaResourceTypeSchema = z.nativeEnum(QuotaResourceType)
export type QuotaResourceTypeEnum = z.infer<typeof quotaResourceTypeSchema>
export const quotaRoleSchema = z.enum(['owner', 'editor', 'reviewer'])
export type QuotaRole = z.infer<typeof quotaRoleSchema>
export const skillResourceDataSchema = z.object({
id: z.string().min(1, 'Skill ID is required'),
})
export const mcpResourceDataSchema = z.object({
id: z.string().min(1, 'MCP server ID is required'),
})
export const bashResourceDataSchema = z.object({
match: z.string().min(1, 'Bash match wildcard is required'),
})
export const toolResourceDataSchema = z.object({
name: z.string().min(1, 'Tool name is required'),
})
export type ToolResourceData = z.infer<typeof toolResourceDataSchema>
export const quotaResourceDataSchema = z.record(z.string(), z.unknown())
export type QuotaResourceData = z.infer<typeof quotaResourceDataSchema>
export const quotaRecordResponseSchema = z.object({
id: z.string().nullable(),
ruleId: z.string(),
teamId: z.string(),
userId: z.string().nullable().optional(),
user: z
.object({
id: z.string(),
name: z.string(),
email: z.string(),
image: z.string().nullable().optional(),
})
.nullable()
.optional(),
periodStart: z.string().nullable().optional(),
periodEnd: z.string().nullable().optional(),
consumed: z.number(),
remaining: z.number(),
percent: z.number(),
isWindowActive: z.boolean(),
})
export type QuotaRecordResponse = z.infer<typeof quotaRecordResponseSchema>
export const listQuotaRecordsResponseSchema = z.object({
records: z.array(quotaRecordResponseSchema),
total: z.number(),
})
export type ListQuotaRecordsResponse = z.infer<typeof listQuotaRecordsResponseSchema>
export const quotaRuleResponseSchema = z.object({
id: z.string(),
teamId: z.string(),
scopeMode: quotaScopeModeSchema,
role: quotaRoleSchema.nullable().optional(),
userIds: z.array(z.string()).nullable().optional(),
resource: quotaResourceTypeSchema,
resourceData: quotaResourceDataSchema.nullable().optional(),
limit: z.number(),
period: quotaPeriodSchema,
enabled: z.boolean(),
recordsCount: z.number().optional(),
createdAt: z.string(),
updatedAt: z.string(),
})
export type QuotaRuleResponse = z.infer<typeof quotaRuleResponseSchema>
export const listQuotaRulesResponseSchema = z.object({
rules: z.array(quotaRuleResponseSchema),
total: z.number(),
})
export type ListQuotaRulesResponse = z.infer<typeof listQuotaRulesResponseSchema>
export const createQuotaRuleRequestSchema = z
.object({
scopeMode: quotaScopeModeSchema,
role: quotaRoleSchema.optional().nullable(),
userIds: z.array(z.string()).optional().nullable(),
resource: quotaResourceTypeSchema,
resourceData: quotaResourceDataSchema.optional().nullable(),
limit: z.number().positive('Limit must be greater than 0'),
period: quotaPeriodSchema,
enabled: z.boolean().optional().default(true),
})
.superRefine((data, ctx) => {
if (data.scopeMode === 'selected_members') {
if (!data.userIds || data.userIds.length === 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
path: ['userIds'],
})
}
}
if (data.resource === 'agent_skill_call_count') {
const res = skillResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.id is required for agent_skill_call_count',
path: ['resourceData', 'id'],
})
}
} else if (data.resource === 'agent_mcp_call_count') {
const res = mcpResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.id is required for agent_mcp_call_count',
path: ['resourceData', 'id'],
})
}
} else if (data.resource === 'agent_bash_call_count') {
const res = bashResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.match is required for agent_bash_call_count',
path: ['resourceData', 'match'],
})
}
} else if (data.resource === 'agent_tool_call_count') {
const res = toolResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.name is required for agent_tool_call_count',
path: ['resourceData', 'name'],
})
}
}
})
export type CreateQuotaRuleRequest = z.input<typeof createQuotaRuleRequestSchema>
export const updateQuotaRuleRequestSchema = z
.object({
scopeMode: quotaScopeModeSchema.optional(),
role: quotaRoleSchema.optional().nullable(),
userIds: z.array(z.string()).optional().nullable(),
resource: quotaResourceTypeSchema.optional(),
resourceData: quotaResourceDataSchema.optional().nullable(),
limit: z.number().positive('Limit must be greater than 0').optional(),
period: quotaPeriodSchema.optional(),
enabled: z.boolean().optional(),
})
.superRefine((data, ctx) => {
if (data.scopeMode === 'selected_members' && data.userIds !== undefined) {
if (!data.userIds || data.userIds.length === 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'userIds must contain at least one user when scopeMode is "selected_members"',
path: ['userIds'],
})
}
}
if (data.resource === 'agent_skill_call_count' && data.resourceData !== undefined) {
const res = skillResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.id is required for agent_skill_call_count',
path: ['resourceData', 'id'],
})
}
} else if (data.resource === 'agent_mcp_call_count' && data.resourceData !== undefined) {
const res = mcpResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.id is required for agent_mcp_call_count',
path: ['resourceData', 'id'],
})
}
} else if (data.resource === 'agent_bash_call_count' && data.resourceData !== undefined) {
const res = bashResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.match is required for agent_bash_call_count',
path: ['resourceData', 'match'],
})
}
} else if (data.resource === 'agent_tool_call_count' && data.resourceData !== undefined) {
const res = toolResourceDataSchema.safeParse(data.resourceData)
if (!res.success) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'resourceData.name is required for agent_tool_call_count',
path: ['resourceData', 'name'],
})
}
}
})
export type UpdateQuotaRuleRequest = z.input<typeof updateQuotaRuleRequestSchema>
@@ -0,0 +1,852 @@
import React, { useState, useEffect } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { client } from '@/ui/api/client'
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/ui/components/ui/dialog'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/ui/components/ui/alert-dialog'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/ui/components/ui/select'
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
import { Input } from '@/ui/components/ui/input'
import { Label } from '@/ui/components/ui/label'
import { Button } from '@/ui/components/ui/button'
import { Switch } from '@/ui/components/ui/switch'
import { Checkbox } from '@/ui/components/ui/checkbox'
import { ScrollArea } from '@/ui/components/ui/scroll-area'
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
import {
Cpu,
DollarSign,
Puzzle,
Server,
Terminal,
Wrench,
Loader2,
Trash2,
Users,
UserCheck,
User,
Clock,
Search,
ChevronDown,
} from 'lucide-react'
import { toast } from 'sonner'
import { m } from '@/ui/paraglide/messages.js'
import type {
QuotaRuleResponse,
QuotaScopeModeEnum,
QuotaResourceTypeEnum,
QuotaPeriodEnum,
QuotaRole,
} from '@shumai/dtos'
import { formatQuotaPeriod } from '@shumai/dtos'
interface QuotaRuleDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
teamId: string
rule?: QuotaRuleResponse | null
onSuccess?: () => void
}
const STANDARD_TOOLS = [
{ value: 'analyze_image', label: () => m.agent_tool_analyze_image_name() },
{ value: 'screenshot', label: () => m.agent_tool_screenshot_name() },
{ value: 'read_pdf_pages', label: () => m.agent_tool_read_pdf_pages_name() },
{ value: 'list_assets', label: () => m.agent_tool_list_assets_name() },
{ value: 'create_folder', label: () => m.agent_tool_create_folder_name() },
{ value: 'create_file', label: () => m.agent_tool_create_file_name() },
{ value: 'create_version', label: () => m.agent_tool_create_version_name() },
]
/* eslint-disable @typescript-eslint/naming-convention */
const RESOURCE_CONFIG = {
agent_total_tokens: {
label: () => m.quota_resource_agent_total_tokens(),
icon: Cpu,
unit: 'tokens',
defaultLimit: 100000,
},
agent_cost: {
label: () => m.quota_resource_agent_cost(),
icon: DollarSign,
unit: '$',
defaultLimit: 10,
},
agent_skill_call_count: {
label: () => m.quota_resource_agent_skill_call_count(),
icon: Puzzle,
unit: 'calls',
defaultLimit: 100,
},
agent_mcp_call_count: {
label: () => m.quota_resource_agent_mcp_call_count(),
icon: Server,
unit: 'calls',
defaultLimit: 100,
},
agent_bash_call_count: {
label: () => m.quota_resource_agent_bash_call_count(),
icon: Terminal,
unit: 'calls',
defaultLimit: 50,
},
agent_tool_call_count: {
label: () => m.quota_resource_agent_tool_call_count(),
icon: Wrench,
unit: 'calls',
defaultLimit: 100,
},
} as const
/* eslint-enable @typescript-eslint/naming-convention */
export const QuotaRuleDialog: React.FC<QuotaRuleDialogProps> = ({
open,
onOpenChange,
teamId,
rule,
onSuccess,
}) => {
const queryClient = useQueryClient()
const isEditing = !!rule
const [scopeMode, setScopeMode] = useState<QuotaScopeModeEnum>('each_member')
const [roleScope, setRoleScope] = useState<string>('team') // 'team' | 'owner' | 'editor' | 'reviewer'
const [selectedUserIds, setSelectedUserIds] = useState<string[]>([])
const [resource, setResource] = useState<QuotaResourceTypeEnum>('agent_total_tokens')
const [skillId, setSkillId] = useState<string>('')
const [mcpServerId, setMcpServerId] = useState<string>('')
const [bashMatch, setBashMatch] = useState<string>('*')
const [toolName, setToolName] = useState<string>('analyze_image')
const [limit, setLimit] = useState<number>(100000)
const [period, setPeriod] = useState<QuotaPeriodEnum>('1day')
const [enabled, setEnabled] = useState<boolean>(true)
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState<boolean>(false)
const [memberSearch, setMemberSearch] = useState<string>('')
// Fetch team members
const { data: members = [] } = useQuery({
queryKey: ['teams', teamId, 'members'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].members.$get({
param: { teamId },
query: {},
})
if (!res.ok) return []
return await res.json()
},
enabled: open,
})
// Fetch team skills when needed
const { data: skillsData } = useQuery({
queryKey: ['teams', teamId, 'skills'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].skills.$get({ param: { teamId } })
if (!res.ok) return { skills: [] }
return await res.json()
},
enabled: open && resource === 'agent_skill_call_count',
})
const skills = skillsData?.skills || []
// Fetch team MCP servers when needed
const { data: mcpData } = useQuery({
queryKey: ['teams', teamId, 'mcp', 'servers'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].mcp.servers.$get({ param: { teamId } })
if (!res.ok) return { servers: [] }
return await res.json()
},
enabled: open && resource === 'agent_mcp_call_count',
})
const mcpServers = mcpData?.servers || []
// Reset or populate form values on open/rule change
useEffect(() => {
if (rule) {
setScopeMode(rule.scopeMode)
setRoleScope(rule.role || 'team')
setSelectedUserIds(rule.userIds || [])
setResource(rule.resource)
const resData = (rule.resourceData as Record<string, unknown> | null) || {}
setSkillId(typeof resData.id === 'string' ? resData.id : '')
setMcpServerId(typeof resData.id === 'string' ? resData.id : '')
setBashMatch(typeof resData.match === 'string' ? resData.match : '*')
setToolName(
typeof resData.name === 'string'
? resData.name
: typeof resData.toolName === 'string'
? resData.toolName
: 'analyze_image',
)
setLimit(rule.limit)
setPeriod(formatQuotaPeriod(rule.period) as QuotaPeriodEnum)
setEnabled(rule.enabled)
} else {
setScopeMode('each_member')
setRoleScope('team')
setSelectedUserIds([])
setResource('agent_total_tokens')
setSkillId('')
setMcpServerId('')
setBashMatch('*')
setToolName('analyze_image')
setLimit(RESOURCE_CONFIG.agent_total_tokens.defaultLimit)
setPeriod('1day')
setEnabled(true)
}
}, [rule, open])
// Handle resource change limit defaults
const handleResourceChange = (newRes: QuotaResourceTypeEnum) => {
setResource(newRes)
if (!isEditing) {
setLimit(RESOURCE_CONFIG[newRes]?.defaultLimit || 100)
}
}
// Create mutation
const createMutation = useMutation({
mutationFn: async () => {
const resourceData: Record<string, unknown> = {}
if (resource === 'agent_skill_call_count') {
resourceData.id = skillId
} else if (resource === 'agent_mcp_call_count') {
resourceData.id = mcpServerId
} else if (resource === 'agent_bash_call_count') {
resourceData.match = bashMatch.trim() || '*'
} else if (resource === 'agent_tool_call_count') {
resourceData.name = toolName || 'analyze_image'
}
const res = await client.api.teams[':teamId'].quotas.$post({
param: { teamId },
json: {
scopeMode,
role:
scopeMode !== 'selected_members' && roleScope !== 'team'
? (roleScope as QuotaRole)
: null,
userIds: scopeMode === 'selected_members' ? selectedUserIds : null,
resource,
resourceData: Object.keys(resourceData).length > 0 ? resourceData : null,
limit: Number(limit),
period,
enabled,
},
})
if (!res.ok) {
const err = await res.json().catch(() => ({}))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
throw new Error((err as any)?.message || m.failed_to_create_quota())
}
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'quotas'] })
toast.success(m.quota_created_successfully())
onOpenChange(false)
onSuccess?.()
},
onError: (err) => {
console.error('CREATE MUTATION ERROR:', err)
toast.error(err instanceof Error ? err.message : m.failed_to_create_quota())
},
})
// Update mutation
const updateMutation = useMutation({
mutationFn: async () => {
if (!rule) return
const resourceData: Record<string, unknown> = {}
if (resource === 'agent_skill_call_count') {
resourceData.id = skillId
} else if (resource === 'agent_mcp_call_count') {
resourceData.id = mcpServerId
} else if (resource === 'agent_bash_call_count') {
resourceData.match = bashMatch.trim() || '*'
} else if (resource === 'agent_tool_call_count') {
resourceData.name = toolName || 'analyze_image'
}
const res = await client.api.teams[':teamId'].quotas[':id'].$put({
param: { teamId, id: rule.id },
json: {
scopeMode,
role:
scopeMode !== 'selected_members' && roleScope !== 'team'
? (roleScope as QuotaRole)
: null,
userIds: scopeMode === 'selected_members' ? selectedUserIds : null,
resource,
resourceData: Object.keys(resourceData).length > 0 ? resourceData : null,
limit: Number(limit),
period,
enabled,
},
})
if (!res.ok) {
const err = await res.json().catch(() => ({}))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
throw new Error((err as any)?.message || m.failed_to_update_quota())
}
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'quotas'] })
toast.success(m.quota_updated_successfully())
onOpenChange(false)
onSuccess?.()
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : m.failed_to_update_quota())
},
})
// Delete mutation
const deleteMutation = useMutation({
mutationFn: async () => {
if (!rule) return
const res = await client.api.teams[':teamId'].quotas[':id'].$delete({
param: { teamId, id: rule.id },
})
if (!res.ok) throw new Error(m.failed_to_delete_quota())
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'quotas'] })
toast.success(m.quota_deleted_successfully())
setIsDeleteDialogOpen(false)
onOpenChange(false)
onSuccess?.()
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : m.failed_to_delete_quota())
},
})
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
if (scopeMode === 'selected_members' && selectedUserIds.length === 0) {
toast.error(m.select_user())
return
}
if (resource === 'agent_skill_call_count' && !skillId.trim()) {
toast.error(m.enter_skill_id())
return
}
if (resource === 'agent_mcp_call_count' && !mcpServerId.trim()) {
toast.error(m.enter_mcp_id())
return
}
if (limit <= 0) {
toast.error('Limit must be greater than 0')
return
}
if (isEditing) {
updateMutation.mutate()
} else {
createMutation.mutate()
}
}
const isPending = createMutation.isPending || updateMutation.isPending || deleteMutation.isPending
const filteredMembers = members.filter((member) => {
if (!memberSearch.trim()) return true
const q = memberSearch.toLowerCase()
return (
member.name.toLowerCase().includes(q) ||
(member.email && member.email.toLowerCase().includes(q))
)
})
const toggleUserSelection = (userId: string) => {
setSelectedUserIds((prev) =>
prev.includes(userId) ? prev.filter((id) => id !== userId) : [...prev, userId],
)
}
return (
<>
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-[540px] max-h-[90vh] flex flex-col p-0 overflow-hidden">
<DialogHeader className="p-6 pb-4 border-b border-border/60 shrink-0">
<DialogTitle className="text-xl font-bold">
{isEditing ? m.edit_quota_rule() : m.create_quota_rule()}
</DialogTitle>
<DialogDescription className="text-sm text-muted-foreground">
{isEditing ? m.edit_quota_rule_description() : m.create_quota_rule_description()}
</DialogDescription>
</DialogHeader>
<form
onSubmit={handleSubmit}
noValidate
className="flex-1 overflow-y-auto min-h-0 p-6 space-y-5"
>
{/* Step 1: Scope Mode Selector */}
<div className="space-y-2">
<Label className="text-sm font-semibold">{m.quota_scope_mode()}</Label>
<div className="grid grid-cols-3 gap-2">
<Button
type="button"
variant={scopeMode === 'each_member' ? 'default' : 'outline'}
size="sm"
disabled={isEditing || isPending}
onClick={() => setScopeMode('each_member')}
className="flex flex-col h-auto py-2.5 px-2 gap-1 items-center justify-center text-xs"
>
<User className="w-4 h-4" />
<span className="font-semibold">{m.quota_scope_mode_each_member()}</span>
</Button>
<Button
type="button"
variant={scopeMode === 'all_members' ? 'default' : 'outline'}
size="sm"
disabled={isEditing || isPending}
onClick={() => setScopeMode('all_members')}
className="flex flex-col h-auto py-2.5 px-2 gap-1 items-center justify-center text-xs"
>
<Users className="w-4 h-4" />
<span className="font-semibold">{m.quota_scope_mode_all_members()}</span>
</Button>
<Button
type="button"
variant={scopeMode === 'selected_members' ? 'default' : 'outline'}
size="sm"
disabled={isEditing || isPending}
onClick={() => setScopeMode('selected_members')}
className="flex flex-col h-auto py-2.5 px-2 gap-1 items-center justify-center text-xs"
>
<UserCheck className="w-4 h-4" />
<span className="font-semibold">{m.quota_scope_mode_selected_members()}</span>
</Button>
</div>
<p className="text-xs text-muted-foreground pt-0.5">
{scopeMode === 'each_member' && m.quota_scope_mode_each_member_desc()}
{scopeMode === 'all_members' && m.quota_scope_mode_all_members_desc()}
{scopeMode === 'selected_members' && m.quota_scope_mode_selected_members_desc()}
</p>
</div>
{/* Step 2: Target Scope or Multi-Select Users */}
{scopeMode !== 'selected_members' ? (
<div className="space-y-2">
<Label htmlFor="quota-role-scope" className="text-sm font-semibold">
{m.quota_scope()}
</Label>
<Select
value={roleScope}
onValueChange={setRoleScope}
disabled={isEditing || isPending}
>
<SelectTrigger id="quota-role-scope" className="w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="team">{m.quota_scope_team()}</SelectItem>
<SelectItem value="owner">{m.quota_scope_role()}: Owner</SelectItem>
<SelectItem value="editor">{m.quota_scope_role()}: Editor</SelectItem>
<SelectItem value="reviewer">{m.quota_scope_role()}: Reviewer</SelectItem>
</SelectContent>
</Select>
</div>
) : (
<div className="space-y-2">
<Label className="text-sm font-semibold">{m.select_members()}</Label>
<Popover>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
disabled={isPending}
className="w-full justify-between text-left font-normal h-10"
>
<span className="truncate">
{selectedUserIds.length === 0
? m.select_members()
: m.quota_selected_users_count({ count: selectedUserIds.length })}
</span>
<ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[320px] p-2" align="start">
<div className="space-y-2">
<div className="relative">
<Search className="w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground" />
<Input
placeholder={m.quota_search_members()}
value={memberSearch}
onChange={(e) => setMemberSearch(e.target.value)}
className="h-8 pl-8 text-xs"
/>
</div>
<ScrollArea className="h-48">
<div className="space-y-1 pr-2">
{filteredMembers.map((member) => {
const isChecked = selectedUserIds.includes(member.id)
return (
<div
key={member.id}
onClick={() => toggleUserSelection(member.id)}
className="flex items-center gap-2 p-1.5 rounded-lg hover:bg-muted/60 cursor-pointer text-xs"
>
<Checkbox
checked={isChecked}
onCheckedChange={() => toggleUserSelection(member.id)}
/>
<Avatar className="w-5 h-5">
<AvatarImage src={member.image || undefined} />
<AvatarFallback className="text-[10px]">
{member.name?.[0]?.toUpperCase() || 'U'}
</AvatarFallback>
</Avatar>
<div className="truncate flex-1">
<span className="font-medium text-foreground block truncate">
{member.name}
</span>
{member.email && (
<span className="text-[10px] text-muted-foreground block truncate">
{member.email}
</span>
)}
</div>
</div>
)
})}
</div>
</ScrollArea>
</div>
</PopoverContent>
</Popover>
</div>
)}
{/* Resource Type */}
<div className="space-y-2">
<Label htmlFor="quota-resource" className="text-sm font-semibold">
{m.quota_resource()}
</Label>
<Select
value={resource}
onValueChange={(val) => handleResourceChange(val as QuotaResourceTypeEnum)}
disabled={isEditing || isPending}
>
<SelectTrigger id="quota-resource" className="w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="agent_total_tokens">
<div className="flex items-center gap-2">
<Cpu className="w-4 h-4 text-primary" />
<span>{m.quota_resource_agent_total_tokens()}</span>
</div>
</SelectItem>
<SelectItem value="agent_cost">
<div className="flex items-center gap-2">
<DollarSign className="w-4 h-4 text-emerald-500" />
<span>{m.quota_resource_agent_cost()}</span>
</div>
</SelectItem>
<SelectItem value="agent_skill_call_count">
<div className="flex items-center gap-2">
<Puzzle className="w-4 h-4 text-amber-500" />
<span>{m.quota_resource_agent_skill_call_count()}</span>
</div>
</SelectItem>
<SelectItem value="agent_mcp_call_count">
<div className="flex items-center gap-2">
<Server className="w-4 h-4 text-blue-500" />
<span>{m.quota_resource_agent_mcp_call_count()}</span>
</div>
</SelectItem>
<SelectItem value="agent_bash_call_count">
<div className="flex items-center gap-2">
<Terminal className="w-4 h-4 text-purple-500" />
<span>{m.quota_resource_agent_bash_call_count()}</span>
</div>
</SelectItem>
<SelectItem value="agent_tool_call_count">
<div className="flex items-center gap-2">
<Wrench className="w-4 h-4 text-cyan-500" />
<span>{m.quota_resource_agent_tool_call_count()}</span>
</div>
</SelectItem>
</SelectContent>
</Select>
</div>
{/* Resource Specific Fields */}
{resource === 'agent_skill_call_count' && (
<div className="space-y-2">
<Label htmlFor="quota-skill" className="text-sm font-semibold">
{m.select_skill()}
</Label>
{skills.length > 0 ? (
<Select
value={skillId}
onValueChange={setSkillId}
disabled={isEditing || isPending}
>
<SelectTrigger id="quota-skill" className="w-full">
<SelectValue placeholder={m.select_skill()} />
</SelectTrigger>
<SelectContent>
{skills.map((s: { id: string; name: string }) => (
<SelectItem key={s.id} value={s.id}>
{s.name} ({s.id})
</SelectItem>
))}
</SelectContent>
</Select>
) : (
<Input
id="quota-skill"
value={skillId}
onChange={(e) => setSkillId(e.target.value)}
placeholder={m.enter_skill_id()}
disabled={isEditing || isPending}
/>
)}
</div>
)}
{resource === 'agent_mcp_call_count' && (
<div className="space-y-2">
<Label htmlFor="quota-mcp" className="text-sm font-semibold">
{m.select_mcp_server()}
</Label>
{mcpServers.length > 0 ? (
<Select
value={mcpServerId}
onValueChange={setMcpServerId}
disabled={isEditing || isPending}
>
<SelectTrigger id="quota-mcp" className="w-full">
<SelectValue placeholder={m.select_mcp_server()} />
</SelectTrigger>
<SelectContent>
{mcpServers.map((s: { id: string; name: string }) => (
<SelectItem key={s.id} value={s.id}>
{s.name} ({s.id})
</SelectItem>
))}
</SelectContent>
</Select>
) : (
<Input
id="quota-mcp"
value={mcpServerId}
onChange={(e) => setMcpServerId(e.target.value)}
placeholder={m.enter_mcp_id()}
disabled={isEditing || isPending}
/>
)}
</div>
)}
{resource === 'agent_bash_call_count' && (
<div className="space-y-1.5">
<Label htmlFor="quota-bash" className="text-sm font-semibold">
{m.bash_command_pattern()}
</Label>
<Input
id="quota-bash"
value={bashMatch}
onChange={(e) => setBashMatch(e.target.value)}
placeholder={m.bash_command_pattern_placeholder()}
disabled={isPending}
/>
<p className="text-xs text-muted-foreground">{m.quota_bash_hint()}</p>
</div>
)}
{resource === 'agent_tool_call_count' && (
<div className="space-y-2">
<Label htmlFor="quota-tool" className="text-sm font-semibold">
{m.select_tool()}
</Label>
<Select
value={toolName}
onValueChange={setToolName}
disabled={isEditing || isPending}
>
<SelectTrigger id="quota-tool" className="w-full">
<SelectValue placeholder={m.select_tool()} />
</SelectTrigger>
<SelectContent>
{STANDARD_TOOLS.map((t) => (
<SelectItem key={t.value} value={t.value}>
{t.label()}
</SelectItem>
))}
</SelectContent>
</Select>
<p className="text-xs text-muted-foreground">{m.quota_tool_hint()}</p>
</div>
)}
{/* Limit and Period Row */}
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<Label htmlFor="quota-limit" className="text-sm font-semibold">
{m.quota_limit()} ({RESOURCE_CONFIG[resource]?.unit || ''})
</Label>
<Input
id="quota-limit"
type="number"
min="0.01"
step={resource === 'agent_cost' ? '0.01' : '1'}
value={limit}
onChange={(e) => setLimit(Number(e.target.value))}
placeholder={m.quota_limit_placeholder()}
disabled={isPending}
required
/>
</div>
<div className="space-y-2">
<Label htmlFor="quota-period" className="text-sm font-semibold">
{m.quota_period()}
</Label>
<Select
value={period}
onValueChange={(val) => setPeriod(val as QuotaPeriodEnum)}
disabled={isPending}
>
<SelectTrigger id="quota-period" className="w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="1hour">
<div className="flex items-center gap-2">
<Clock className="w-3.5 h-3.5 text-muted-foreground" />
<span>{m.quota_period_1hour()}</span>
</div>
</SelectItem>
<SelectItem value="5hour">
<div className="flex items-center gap-2">
<Clock className="w-3.5 h-3.5 text-muted-foreground" />
<span>{m.quota_period_5hour()}</span>
</div>
</SelectItem>
<SelectItem value="1day">
<div className="flex items-center gap-2">
<Clock className="w-3.5 h-3.5 text-muted-foreground" />
<span>{m.quota_period_1day()}</span>
</div>
</SelectItem>
<SelectItem value="7day">
<div className="flex items-center gap-2">
<Clock className="w-3.5 h-3.5 text-muted-foreground" />
<span>{m.quota_period_7day()}</span>
</div>
</SelectItem>
</SelectContent>
</Select>
</div>
</div>
{/* Enabled Switch */}
<div className="flex items-center justify-between p-3 rounded-lg border bg-muted/20">
<div className="space-y-0.5">
<Label htmlFor="quota-enabled" className="text-sm font-medium cursor-pointer">
{enabled ? m.quota_enabled() : m.quota_disabled()}
</Label>
<p className="text-xs text-muted-foreground">
{enabled
? 'Active and enforcing limits'
: 'Inactive, requests will bypass this quota'}
</p>
</div>
<Switch
id="quota-enabled"
checked={enabled}
onCheckedChange={setEnabled}
disabled={isPending}
/>
</div>
<DialogFooter className="pt-4 flex items-center justify-between gap-2 sm:justify-between border-t border-border/60">
{isEditing ? (
<Button
type="button"
variant="destructive"
size="sm"
onClick={() => setIsDeleteDialogOpen(true)}
disabled={isPending}
className="gap-1.5"
>
<Trash2 className="w-4 h-4" />
<span>{m.delete_quota()}</span>
</Button>
) : (
<div />
)}
<div className="flex items-center gap-2">
<Button
type="button"
variant="outline"
onClick={() => onOpenChange(false)}
disabled={isPending}
>
{m.cancel()}
</Button>
<Button type="submit" disabled={isPending} className="gap-2">
{isPending && <Loader2 className="w-4 h-4 animate-spin" />}
{isEditing ? m.save() : m.create()}
</Button>
</div>
</DialogFooter>
</form>
</DialogContent>
</Dialog>
{/* Delete Confirmation Alert Dialog */}
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{m.delete_quota()}</AlertDialogTitle>
<AlertDialogDescription>{m.delete_quota_confirm()}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={isPending}>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
onClick={(e) => {
e.preventDefault()
deleteMutation.mutate()
}}
disabled={isPending}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{isPending && <Loader2 className="w-4 h-4 animate-spin mr-2" />}
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</>
)
}
@@ -0,0 +1,280 @@
import React, { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import { client } from '@/ui/api/client'
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from '@/ui/components/ui/dialog'
import { Input } from '@/ui/components/ui/input'
import { Badge } from '@/ui/components/ui/badge'
import { Progress } from '@/ui/components/ui/progress'
import { ScrollArea } from '@/ui/components/ui/scroll-area'
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
import {
Cpu,
DollarSign,
Puzzle,
Server,
Terminal,
Wrench,
Loader2,
Users,
Search,
CheckCircle2,
Clock,
Activity,
} from 'lucide-react'
import { m } from '@/ui/paraglide/messages.js'
import { formatRemainingTime } from '@/ui/lib/time'
import type { QuotaRuleResponse, QuotaResourceTypeEnum, QuotaRecordResponse } from '@shumai/dtos'
import { formatQuotaPeriod } from '@shumai/dtos'
interface QuotaUsageRecordsDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
teamId: string
rule: QuotaRuleResponse
}
/* eslint-disable @typescript-eslint/naming-convention */
const RESOURCE_META: Record<
QuotaResourceTypeEnum,
{ label: () => string; icon: React.ElementType; unit: string }
> = {
agent_total_tokens: {
label: () => m.quota_resource_agent_total_tokens(),
icon: Cpu,
unit: 'tokens',
},
agent_cost: {
label: () => m.quota_resource_agent_cost(),
icon: DollarSign,
unit: '$',
},
agent_skill_call_count: {
label: () => m.quota_resource_agent_skill_call_count(),
icon: Puzzle,
unit: 'calls',
},
agent_mcp_call_count: {
label: () => m.quota_resource_agent_mcp_call_count(),
icon: Server,
unit: 'calls',
},
agent_bash_call_count: {
label: () => m.quota_resource_agent_bash_call_count(),
icon: Terminal,
unit: 'calls',
},
agent_tool_call_count: {
label: () => m.quota_resource_agent_tool_call_count(),
icon: Wrench,
unit: 'calls',
},
}
/* eslint-enable @typescript-eslint/naming-convention */
function formatResourceValue(resource: QuotaResourceTypeEnum, val: number): string {
if (resource === 'agent_cost') {
return `$${val.toFixed(2)}`
}
return val.toLocaleString()
}
function getPeriodLabel(period: string): string {
const norm = formatQuotaPeriod(period)
switch (norm) {
case '1hour':
return m.quota_period_1hour()
case '5hour':
return m.quota_period_5hour()
case '1day':
return m.quota_period_1day()
case '7day':
return m.quota_period_7day()
default:
return norm
}
}
export const QuotaUsageRecordsDialog: React.FC<QuotaUsageRecordsDialogProps> = ({
open,
onOpenChange,
teamId,
rule,
}) => {
const [search, setSearch] = useState('')
const { data, isLoading } = useQuery({
queryKey: ['teams', teamId, 'quotas', rule.id, 'records'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].quotas[':id'].records.$get({
param: { teamId, id: rule.id },
})
if (!res.ok) return { records: [], total: 0 }
return await res.json()
},
enabled: open,
refetchInterval: 10000,
})
const records: QuotaRecordResponse[] = data?.records || []
const meta = RESOURCE_META[rule.resource]
const Icon = meta?.icon || Activity
const filteredRecords = records.filter((r) => {
if (!search.trim()) return true
const q = search.toLowerCase()
if (r.user?.name.toLowerCase().includes(q)) return true
if (r.user?.email.toLowerCase().includes(q)) return true
return false
})
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-[620px] p-0 gap-0 overflow-hidden">
<DialogHeader className="p-6 pb-4 border-b border-border/60">
<div className="flex items-center gap-3">
<div className="p-2 rounded-lg bg-primary/10 text-primary shrink-0">
<Icon className="w-5 h-5" />
</div>
<div>
<DialogTitle className="text-lg font-bold flex items-center gap-2">
<span>{m.quota_usage_records()}</span>
<Badge variant="outline" className="text-xs font-normal">
{meta?.label ? meta.label() : rule.resource} -{' '}
{formatResourceValue(rule.resource, rule.limit)} {meta?.unit} /{' '}
{getPeriodLabel(rule.period)}
</Badge>
</DialogTitle>
<DialogDescription className="text-xs text-muted-foreground mt-0.5">
{m.quota_usage_records_description()}
</DialogDescription>
</div>
</div>
</DialogHeader>
{rule.scopeMode !== 'all_members' && records.length > 3 && (
<div className="px-6 pt-4 pb-2">
<div className="relative">
<Search className="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
<Input
value={search}
onChange={(e) => setSearch(e.target.value)}
placeholder={m.quota_search_members()}
className="pl-9 h-9 text-sm"
/>
</div>
</div>
)}
<ScrollArea className="max-h-[60vh] p-6 pt-3">
{isLoading ? (
<div className="flex justify-center py-12">
<Loader2 className="w-8 h-8 animate-spin text-primary" />
</div>
) : filteredRecords.length === 0 ? (
<div className="text-center py-10 text-sm text-muted-foreground">
{records.length === 0 ? m.no_quotas_title() : 'No matching records found'}
</div>
) : (
<div className="space-y-3">
{filteredRecords.map((record, index) => {
const percent = record.percent
const isOverLimit = percent >= 100
const isSharedPool = rule.scopeMode === 'all_members'
return (
<div
key={record.id || record.userId || `record-${index}`}
className="p-4 rounded-xl border border-border/70 bg-card text-card-foreground shadow-2xs space-y-3"
>
{/* Top Row: User / Pool Info & Status Badge */}
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-3 min-w-0">
{isSharedPool ? (
<div className="w-9 h-9 rounded-full bg-primary/10 text-primary flex items-center justify-center shrink-0">
<Users className="w-5 h-5" />
</div>
) : (
<Avatar className="w-9 h-9 border border-border/50 shrink-0">
<AvatarImage src={record.user?.image || undefined} />
<AvatarFallback className="text-xs font-semibold">
{record.user?.name?.[0]?.toUpperCase() || 'U'}
</AvatarFallback>
</Avatar>
)}
<div className="min-w-0">
<div className="font-semibold text-sm text-foreground truncate">
{isSharedPool
? rule.role
? `${m.quota_role_shared_pool()}: ${rule.role}`
: m.quota_team_shared_pool()
: record.user?.name || record.userId}
</div>
{!isSharedPool && record.user?.email && (
<div className="text-xs text-muted-foreground truncate">
{record.user.email}
</div>
)}
</div>
</div>
{/* Status Badge */}
<div className="shrink-0">
{record.isWindowActive && record.periodEnd ? (
<Badge
variant="outline"
className="gap-1 text-xs text-primary border-primary/30 bg-primary/5"
>
<Clock className="w-3 h-3" />
<span>
{m.quota_refreshes_in({
time: formatRemainingTime(record.periodEnd),
})}
</span>
</Badge>
) : (
<Badge
variant="secondary"
className="gap-1 text-xs text-muted-foreground bg-muted"
>
<CheckCircle2 className="w-3 h-3 text-emerald-500" />
<span>{m.quota_available()}</span>
</Badge>
)}
</div>
</div>
{/* Progress Bar & Details */}
<div className="space-y-1.5 pt-1">
<Progress value={Math.min(100, Math.max(0, percent))} className="h-2" />
<div className="flex items-center justify-between text-xs font-medium">
<span
className={isOverLimit ? 'text-destructive font-bold' : 'text-foreground'}
>
{formatResourceValue(rule.resource, record.consumed)} /{' '}
{formatResourceValue(rule.resource, rule.limit)} {meta?.unit}
</span>
<span
className={
isOverLimit ? 'text-destructive font-bold' : 'text-muted-foreground'
}
>
{percent}%
</span>
</div>
</div>
</div>
)
})}
</div>
)}
</ScrollArea>
</DialogContent>
</Dialog>
)
}
@@ -0,0 +1,409 @@
import React, { useState } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { client } from '@/ui/api/client'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
import { Button } from '@/ui/components/ui/button'
import { Badge } from '@/ui/components/ui/badge'
import { Switch } from '@/ui/components/ui/switch'
import { ScrollArea } from '@/ui/components/ui/scroll-area'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/ui/components/ui/dropdown-menu'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/ui/components/ui/alert-dialog'
import {
Gauge,
Plus,
Loader2,
MoreVertical,
Trash2,
Cpu,
DollarSign,
Puzzle,
Server,
Terminal,
Wrench,
Users,
UserCheck,
User,
Clock,
Eye,
} from 'lucide-react'
import { toast } from 'sonner'
import { m } from '@/ui/paraglide/messages.js'
import type { QuotaRuleResponse, QuotaResourceTypeEnum } from '@shumai/dtos'
import { formatQuotaPeriod } from '@shumai/dtos'
import { QuotaRuleDialog } from './QuotaRuleDialog'
import { QuotaUsageRecordsDialog } from './QuotaUsageRecordsDialog'
interface QuotasSettingsProps {
teamId: string
}
/* eslint-disable @typescript-eslint/naming-convention */
const RESOURCE_META: Record<
QuotaResourceTypeEnum,
{ label: () => string; icon: React.ElementType; unit: string }
> = {
agent_total_tokens: {
label: () => m.quota_resource_agent_total_tokens(),
icon: Cpu,
unit: 'tokens',
},
agent_cost: {
label: () => m.quota_resource_agent_cost(),
icon: DollarSign,
unit: '$',
},
agent_skill_call_count: {
label: () => m.quota_resource_agent_skill_call_count(),
icon: Puzzle,
unit: 'calls',
},
agent_mcp_call_count: {
label: () => m.quota_resource_agent_mcp_call_count(),
icon: Server,
unit: 'calls',
},
agent_bash_call_count: {
label: () => m.quota_resource_agent_bash_call_count(),
icon: Terminal,
unit: 'calls',
},
agent_tool_call_count: {
label: () => m.quota_resource_agent_tool_call_count(),
icon: Wrench,
unit: 'calls',
},
}
/* eslint-enable @typescript-eslint/naming-convention */
function getPeriodLabel(period: string): string {
const norm = formatQuotaPeriod(period)
switch (norm) {
case '1hour':
return m.quota_period_1hour()
case '5hour':
return m.quota_period_5hour()
case '1day':
return m.quota_period_1day()
case '7day':
return m.quota_period_7day()
default:
return norm
}
}
function formatResourceValue(resource: QuotaResourceTypeEnum, val: number): string {
if (resource === 'agent_cost') {
return `$${val.toFixed(2)}`
}
return val.toLocaleString()
}
export const QuotasSettings: React.FC<QuotasSettingsProps> = ({ teamId }) => {
const queryClient = useQueryClient()
const [isCreateOpen, setIsCreateOpen] = useState(false)
const [selectedRule, setSelectedRule] = useState<QuotaRuleResponse | null>(null)
const [viewingUsageRule, setViewingUsageRule] = useState<QuotaRuleResponse | null>(null)
const [deletingRule, setDeletingRule] = useState<QuotaRuleResponse | null>(null)
// Fetch quota rules
const { data, isLoading } = useQuery({
queryKey: ['teams', teamId, 'quotas'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].quotas.$get({ param: { teamId } })
if (!res.ok) throw new Error(m.failed_load_settings())
return await res.json()
},
})
// Quick toggle enabled mutation
const toggleMutation = useMutation({
mutationFn: async ({ id, enabled }: { id: string; enabled: boolean }) => {
const res = await client.api.teams[':teamId'].quotas[':id'].$put({
param: { teamId, id },
json: { enabled },
})
if (!res.ok) throw new Error(m.failed_to_update_quota())
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'quotas'] })
toast.success(m.quota_status_updated())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : m.failed_to_update_quota())
},
})
// Delete rule mutation
const deleteMutation = useMutation({
mutationFn: async (id: string) => {
const res = await client.api.teams[':teamId'].quotas[':id'].$delete({
param: { teamId, id },
})
if (!res.ok) throw new Error(m.failed_to_delete_quota())
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'quotas'] })
toast.success(m.quota_deleted_successfully())
setDeletingRule(null)
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : m.failed_to_delete_quota())
},
})
const rules: QuotaRuleResponse[] = data?.rules || []
return (
<ScrollArea className="h-full">
<div className="space-y-6 pr-4 pb-10">
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-6">
<div className="flex items-center gap-3">
<div className="p-2 bg-primary/10 text-primary rounded-lg">
<Gauge className="w-6 h-6" />
</div>
<div>
<CardTitle className="text-xl font-bold">{m.resource_quotas()}</CardTitle>
<CardDescription>{m.resource_quotas_description()}</CardDescription>
</div>
</div>
<Button onClick={() => setIsCreateOpen(true)} className="gap-2">
<Plus className="w-4 h-4" /> {m.add_quota()}
</Button>
</CardHeader>
<CardContent>
{isLoading ? (
<div className="flex justify-center py-12">
<Loader2 className="w-8 h-8 animate-spin text-primary" />
</div>
) : rules.length === 0 ? (
<div className="text-center py-12 border-2 border-dashed border-border rounded-xl">
<div className="mx-auto w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4 text-muted-foreground">
<Gauge className="w-6 h-6" />
</div>
<h3 className="text-base font-semibold text-foreground mb-1">
{m.no_quotas_title()}
</h3>
<p className="text-sm text-muted-foreground max-w-md mx-auto mb-6">
{m.no_quotas_description()}
</p>
<Button onClick={() => setIsCreateOpen(true)} className="gap-2">
<Plus className="w-4 h-4" /> {m.add_quota()}
</Button>
</div>
) : (
<div className="flex flex-col gap-4">
{rules.map((rule) => {
const meta = RESOURCE_META[rule.resource]
const resData = (rule.resourceData as Record<string, unknown> | null) || {}
return (
<div
key={rule.id}
onClick={() => setSelectedRule(rule)}
className={`group relative flex flex-col justify-between p-5 rounded-xl border bg-card text-card-foreground shadow-2xs transition-all hover:border-primary/40 hover:shadow-xs cursor-pointer ${
!rule.enabled ? 'opacity-60 bg-muted/20' : ''
}`}
>
{/* Top Row: Resource, Details, Switch, Actions */}
<div className="space-y-3">
<div className="flex items-start justify-between gap-2">
<div>
<div className="font-semibold text-base text-foreground group-hover:text-primary transition-colors flex items-center gap-2">
<span>{meta?.label ? meta.label() : rule.resource}</span>
</div>
{/* Subtitle / target details */}
<div className="text-xs text-muted-foreground line-clamp-1">
{rule.resource === 'agent_skill_call_count' && (
<span>Skill: {String(resData.id || '')}</span>
)}
{rule.resource === 'agent_mcp_call_count' && (
<span>Server: {String(resData.id || '')}</span>
)}
{rule.resource === 'agent_bash_call_count' && (
<span>Match: {String(resData.match || '*')}</span>
)}
{rule.resource === 'agent_tool_call_count' && (
<span>Tool: {String(resData.name || resData.toolName || '*')}</span>
)}
</div>
</div>
{/* Quick Switch & Card Menu */}
<div
className="flex items-center gap-2"
onClick={(e) => e.stopPropagation()}
>
<Switch
checked={rule.enabled}
onCheckedChange={(checked) =>
toggleMutation.mutate({ id: rule.id, enabled: checked })
}
disabled={toggleMutation.isPending}
/>
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
size="icon"
aria-label="Quota actions"
className="h-8 w-8 text-muted-foreground hover:text-foreground"
>
<MoreVertical className="w-4 h-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
onClick={() => setDeletingRule(rule)}
className="text-destructive focus:text-destructive"
>
<Trash2 className="w-4 h-4 mr-2" />
{m.delete()}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
{/* Badges Row & View Usage Action */}
<div className="flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-border/50">
<div className="flex flex-wrap items-center gap-1.5">
{/* Scope Mode & Role badge */}
{rule.scopeMode === 'all_members' && (
<Badge variant="secondary" className="gap-1 text-xs">
<Users className="w-3 h-3" />
<span>
{m.quota_scope_mode_all_members()}
{rule.role ? ` (${rule.role})` : ` (${m.quota_scope_team()})`}
</span>
</Badge>
)}
{rule.scopeMode === 'each_member' && (
<Badge variant="secondary" className="gap-1 text-xs">
<User className="w-3 h-3" />
<span>
{m.quota_scope_mode_each_member()}
{rule.role ? ` (${rule.role})` : ` (${m.quota_scope_team()})`}
</span>
</Badge>
)}
{rule.scopeMode === 'selected_members' && (
<Badge variant="secondary" className="gap-1 text-xs">
<UserCheck className="w-3 h-3" />
<span>
{m.quota_scope_mode_selected_members()} (
{rule.userIds?.length || 0})
</span>
</Badge>
)}
{/* Limit & Period badge */}
<Badge variant="outline" className="gap-1 text-xs">
<Clock className="w-3 h-3" />
<span>
{formatResourceValue(rule.resource, rule.limit)} {meta?.unit} /{' '}
{getPeriodLabel(rule.period)}
</span>
</Badge>
</div>
{/* View Usage Button */}
<Button
variant="outline"
size="sm"
onClick={(e) => {
e.stopPropagation()
setViewingUsageRule(rule)
}}
className="gap-1.5 text-xs h-7 px-2.5"
>
<Eye className="w-3.5 h-3.5 text-primary" />
<span>{m.quota_view_usage()}</span>
</Button>
</div>
</div>
</div>
)
})}
</div>
)}
</CardContent>
</Card>
</div>
{/* Create / Edit Rule Dialog */}
{(isCreateOpen || !!selectedRule) && (
<QuotaRuleDialog
open={isCreateOpen || !!selectedRule}
onOpenChange={(open) => {
if (!open) {
setIsCreateOpen(false)
setSelectedRule(null)
}
}}
teamId={teamId}
rule={selectedRule}
/>
)}
{/* View Usage Records Dialog */}
{!!viewingUsageRule && (
<QuotaUsageRecordsDialog
open={!!viewingUsageRule}
onOpenChange={(open) => {
if (!open) setViewingUsageRule(null)
}}
teamId={teamId}
rule={viewingUsageRule}
/>
)}
{/* Delete Confirmation Alert Dialog */}
<AlertDialog
open={!!deletingRule}
onOpenChange={(open) => {
if (!open) setDeletingRule(null)
}}
>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{m.delete_quota()}</AlertDialogTitle>
<AlertDialogDescription>{m.delete_quota_confirm()}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={deleteMutation.isPending}>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
onClick={(e) => {
e.preventDefault()
if (deletingRule) {
deleteMutation.mutate(deletingRule.id)
}
}}
disabled={deleteMutation.isPending}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{deleteMutation.isPending && <Loader2 className="w-4 h-4 animate-spin mr-2" />}
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</ScrollArea>
)
}
+46
View File
@@ -0,0 +1,46 @@
import { describe, it, expect } from 'vitest'
import { formatRemainingTime } from './time'
describe('formatRemainingTime', () => {
const baseNow = new Date('2026-08-17T12:00:00Z')
it('formats hours and minutes', () => {
const target = new Date('2026-08-17T15:18:00Z')
expect(formatRemainingTime(target, baseNow)).toBe('3h 18m')
})
it('formats exact hours', () => {
const target = new Date('2026-08-17T15:00:00Z')
expect(formatRemainingTime(target, baseNow)).toBe('3h')
})
it('formats minutes only', () => {
const target = new Date('2026-08-17T12:45:00Z')
expect(formatRemainingTime(target, baseNow)).toBe('45m')
})
it('formats days and hours', () => {
const target = new Date('2026-08-19T16:00:00Z')
expect(formatRemainingTime(target, baseNow)).toBe('2d 4h')
})
it('formats days only', () => {
const target = new Date('2026-08-19T12:00:00Z')
expect(formatRemainingTime(target, baseNow)).toBe('2d')
})
it('handles less than 1 minute', () => {
const target = new Date('2026-08-17T12:00:30Z')
expect(formatRemainingTime(target, baseNow)).toBe('< 1m')
})
it('handles past or equal dates', () => {
const past = new Date('2026-08-17T11:00:00Z')
expect(formatRemainingTime(past, baseNow)).toBe('< 1m')
expect(formatRemainingTime(baseNow, baseNow)).toBe('< 1m')
})
it('accepts ISO strings', () => {
expect(formatRemainingTime('2026-08-17T15:18:00Z', baseNow)).toBe('3h 18m')
})
})
+29
View File
@@ -42,3 +42,32 @@ export const formatDateAgo = (dateString: string) => {
const count = daysAgo >= 0 ? daysAgo : 0
return count === 1 ? m.n_days_ago_singular({ count }) : m.n_days_ago_plural({ count })
}
export const formatRemainingTime = (targetDate: string | Date, now: Date = new Date()): string => {
const targetMs =
typeof targetDate === 'string'
? parseISO(targetDate).getTime()
: targetDate instanceof Date
? targetDate.getTime()
: NaN
if (isNaN(targetMs)) {
return '< 1m'
}
const diffMs = targetMs - now.getTime()
if (diffMs <= 0) {
return '< 1m'
}
const totalSeconds = Math.floor(diffMs / 1000)
const days = Math.floor(totalSeconds / 86400)
const hours = Math.floor((totalSeconds % 86400) / 3600)
const minutes = Math.floor((totalSeconds % 3600) / 60)
if (days > 0) {
return hours > 0 ? `${days}d ${hours}h` : `${days}d`
}
if (hours > 0) {
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`
}
return minutes > 0 ? `${minutes}m` : '< 1m'
}
+79 -1
View File
@@ -1049,5 +1049,83 @@
"agents_md_placeholder": "Give AI agents instructions and context for this project or folder.\n\nShumai automatically loads this file, along with AGENTS.md files from parent folders up to the project level, whenever an agent works here.\n\nUse it to define things like:\n- What this project or folder contains\n- Rules the agent should follow\n- Terminology, style, or workflow\n- How metadata and autofill should be generated",
"agents_md_readonly_hint": "Only team owners can edit this file.",
"agents_md_save_failed": "Failed to save",
"agents_md_loading": "Loading AGENTS.md..."
"agents_md_loading": "Loading AGENTS.md...",
"quotas": "Quotas",
"resource_quotas": "Resource Quotas",
"resource_quotas_description": "Manage and limit resource usage across team members, roles, and AI operations.",
"add_quota": "Add Quota",
"create_quota_rule": "Create Quota Rule",
"edit_quota_rule": "Edit Quota Rule",
"edit_quota_rule_description": "Configure resource limits, target scopes, and evaluation periods.",
"create_quota_rule_description": "Set up a new resource quota to prevent unexpected usage.",
"quota_scope": "Scope",
"quota_scope_team": "Entire Team",
"quota_scope_role": "Role-based",
"quota_scope_user": "Specific User",
"quota_scope_team_description": "Applies collectively to the entire team",
"quota_scope_role_description": "Applies to members with the specified role",
"quota_scope_user_description": "Applies exclusively to the selected user",
"quota_resource": "Resource",
"quota_resource_agent_total_tokens": "AI Tokens",
"quota_resource_agent_cost": "AI Cost ($)",
"quota_resource_agent_skill_call_count": "Skill Calls",
"quota_resource_agent_mcp_call_count": "MCP Server Calls",
"quota_resource_agent_bash_call_count": "Agent Bash Calls",
"quota_resource_agent_tool_call_count": "Agent Tool Calls",
"quota_period": "Period Window",
"quota_period_1hour": "1 Hour",
"quota_period_5hour": "5 Hours",
"quota_period_1day": "1 Day",
"quota_period_7day": "7 Days",
"quota_limit": "Limit",
"quota_limit_placeholder": "e.g. 100000",
"quota_enabled": "Enabled",
"quota_disabled": "Disabled",
"quota_current_usage": "Current Usage",
"quota_consumed": "Consumed",
"quota_remaining": "Remaining",
"quota_period_resets": "Resets in",
"quota_active_window": "Active Window",
"no_quotas_title": "No resource quotas configured",
"no_quotas_description": "Set limits on AI tokens, costs, skill executions, and agent tool calls to manage team usage.",
"delete_quota": "Delete Quota",
"delete_quota_confirm": "Are you sure you want to delete this quota rule? This action cannot be undone.",
"quota_created_successfully": "Quota rule created successfully",
"quota_updated_successfully": "Quota rule updated successfully",
"quota_deleted_successfully": "Quota rule deleted successfully",
"failed_to_create_quota": "Failed to create quota rule",
"failed_to_update_quota": "Failed to update quota rule",
"failed_to_delete_quota": "Failed to delete quota rule",
"quota_status_updated": "Quota status updated",
"quota_scope_mode": "Target Mode",
"quota_scope_mode_each_member": "Each Member",
"quota_scope_mode_each_member_desc": "Individual limit for each matching member",
"quota_scope_mode_all_members": "All Members",
"quota_scope_mode_all_members_desc": "Shared pooled limit across all matching members",
"quota_scope_mode_selected_members": "Selected Members",
"quota_scope_mode_selected_members_desc": "Individual limit for selected users",
"quota_view_usage": "View Usage",
"quota_usage_records": "Usage Records",
"quota_usage_records_description": "Real-time usage breakdown for this quota rule.",
"quota_team_shared_pool": "Team Shared Pool",
"quota_role_shared_pool": "Role Shared Pool",
"quota_available": "Quota available",
"quota_active": "Active",
"quota_refreshes_in": "Refreshes in {time}",
"quota_search_members": "Search members...",
"quota_selected_users_count": "{count} members selected",
"select_members": "Select Members",
"select_role": "Select Role",
"select_user": "Select User",
"select_skill": "Select Skill",
"select_mcp_server": "Select MCP Server",
"select_tool": "Select Tool",
"custom_id": "Custom ID",
"enter_custom_id": "Enter custom ID",
"bash_command_pattern": "Bash Match Wildcard",
"bash_command_pattern_placeholder": "e.g. * or npm*",
"enter_skill_id": "Enter Skill ID",
"enter_mcp_id": "Enter MCP Server ID",
"quota_bash_hint": "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)",
"quota_tool_hint": "Select a specific agent tool to configure its quota limit"
}
+79 -1
View File
@@ -1049,5 +1049,83 @@
"agents_md_placeholder": "为在此项目或文件夹中工作的 AI Agent 提供指引和上下文。\n\n当 Agent 在此处工作时,Shumai 会自动加载此文件以及向上追溯至项目根目录各级父文件夹中的 AGENTS.md 文件。\n\n您可以用它来定义:\n- 此项目或文件夹包含的内容\n- Agent 应当遵守的规则\n- 术语、风格或工作流规范\n- 元数据和自动填充的生成方式",
"agents_md_readonly_hint": "只有团队所有者可以修改此文件。",
"agents_md_save_failed": "保存失败",
"agents_md_loading": "正在加载 AGENTS.md..."
"agents_md_loading": "正在加载 AGENTS.md...",
"quotas": "配额",
"resource_quotas": "资源配额",
"resource_quotas_description": "管理并限制团队成员、角色以及 AI 操作的资源使用。",
"add_quota": "添加配额",
"create_quota_rule": "创建配额规则",
"edit_quota_rule": "编辑配额规则",
"edit_quota_rule_description": "配置资源上限、目标范围以及评估周期。",
"create_quota_rule_description": "设置新的资源配额以防止意外的超量使用。",
"quota_scope": "范围",
"quota_scope_team": "整个团队",
"quota_scope_role": "按角色",
"quota_scope_user": "指定用户",
"quota_scope_team_description": "对整个团队累计生效",
"quota_scope_role_description": "对具有指定角色的成员生效",
"quota_scope_user_description": "仅对选定的用户生效",
"quota_resource": "资源类型",
"quota_resource_agent_total_tokens": "AI Token 总量",
"quota_resource_agent_cost": "AI 费用 ($)",
"quota_resource_agent_skill_call_count": "Skill 调用次数",
"quota_resource_agent_mcp_call_count": "MCP 服务调用次数",
"quota_resource_agent_bash_call_count": "智能体 Bash 执行次数",
"quota_resource_agent_tool_call_count": "智能体工具调用次数",
"quota_period": "周期窗口",
"quota_period_1hour": "1 小时",
"quota_period_5hour": "5 小时",
"quota_period_1day": "1 天",
"quota_period_7day": "7 天",
"quota_limit": "上限",
"quota_limit_placeholder": "例如 100000",
"quota_enabled": "已启用",
"quota_disabled": "已禁用",
"quota_current_usage": "当前使用量",
"quota_consumed": "已消耗",
"quota_remaining": "剩余额度",
"quota_period_resets": "重置于",
"quota_active_window": "生效周期",
"no_quotas_title": "暂未配置资源配额",
"no_quotas_description": "为 AI Token、费用、Skill 执行和智能体工具调用设置限制,以便管理团队的使用情况。",
"delete_quota": "删除配额",
"delete_quota_confirm": "确定要删除此配额规则吗?此操作无法撤销。",
"quota_created_successfully": "配额规则创建成功",
"quota_updated_successfully": "配额规则更新成功",
"quota_deleted_successfully": "配额规则删除成功",
"failed_to_create_quota": "创建配额规则失败",
"failed_to_update_quota": "更新配额规则失败",
"failed_to_delete_quota": "删除配额规则失败",
"quota_status_updated": "配额状态已更新",
"quota_scope_mode": "目标模式",
"quota_scope_mode_each_member": "每个成员",
"quota_scope_mode_each_member_desc": "为每个符合条件的成员分别设定独立的配额上限",
"quota_scope_mode_all_members": "所有成员",
"quota_scope_mode_all_members_desc": "所有符合条件的成员共同享有总配额上限",
"quota_scope_mode_selected_members": "指定成员",
"quota_scope_mode_selected_members_desc": "为选定的成员分别设定独立的配额上限",
"quota_view_usage": "查看使用量",
"quota_usage_records": "使用记录",
"quota_usage_records_description": "该配额规则的实时使用明细与生效状态。",
"quota_team_shared_pool": "团队共享配额池",
"quota_role_shared_pool": "角色共享配额池",
"quota_available": "配额可用",
"quota_active": "使用中",
"quota_refreshes_in": "{time} 后重置",
"quota_search_members": "搜索成员...",
"quota_selected_users_count": "已选择 {count} 位成员",
"select_members": "选择成员",
"select_role": "选择角色",
"select_user": "选择用户",
"select_skill": "选择 Skill",
"select_mcp_server": "选择 MCP 服务",
"select_tool": "选择工具",
"custom_id": "自定义 ID",
"enter_custom_id": "输入自定义 ID",
"bash_command_pattern": "Bash 命令通配符",
"bash_command_pattern_placeholder": "例如 * 或 npm*",
"enter_skill_id": "输入技能 ID",
"enter_mcp_id": "输入 MCP 服务 ID",
"quota_bash_hint": "支持通配符 (*)。示例:git *、npm test、curl *、python script.py(使用 * 匹配所有命令)",
"quota_tool_hint": "选择特定的智能体工具以配置其配额限制"
}
+78
View File
@@ -994,4 +994,82 @@ export * from "./agents_md_placeholder.js";
export * from "./agents_md_readonly_hint.js";
export * from "./agents_md_save_failed.js";
export * from "./agents_md_loading.js";
export * from "./quotas.js";
export * from "./resource_quotas.js";
export * from "./resource_quotas_description.js";
export * from "./add_quota.js";
export * from "./create_quota_rule.js";
export * from "./edit_quota_rule.js";
export * from "./edit_quota_rule_description.js";
export * from "./create_quota_rule_description.js";
export * from "./quota_scope.js";
export * from "./quota_scope_team.js";
export * from "./quota_scope_role.js";
export * from "./quota_scope_user.js";
export * from "./quota_scope_team_description.js";
export * from "./quota_scope_role_description.js";
export * from "./quota_scope_user_description.js";
export * from "./quota_resource.js";
export * from "./quota_resource_agent_total_tokens.js";
export * from "./quota_resource_agent_cost.js";
export * from "./quota_resource_agent_skill_call_count.js";
export * from "./quota_resource_agent_mcp_call_count.js";
export * from "./quota_resource_agent_bash_call_count.js";
export * from "./quota_resource_agent_tool_call_count.js";
export * from "./quota_period.js";
export * from "./quota_period_1hour.js";
export * from "./quota_period_5hour.js";
export * from "./quota_period_1day.js";
export * from "./quota_period_7day.js";
export * from "./quota_limit.js";
export * from "./quota_limit_placeholder.js";
export * from "./quota_enabled.js";
export * from "./quota_disabled.js";
export * from "./quota_current_usage.js";
export * from "./quota_consumed.js";
export * from "./quota_remaining.js";
export * from "./quota_period_resets.js";
export * from "./quota_active_window.js";
export * from "./no_quotas_title.js";
export * from "./no_quotas_description.js";
export * from "./delete_quota.js";
export * from "./delete_quota_confirm.js";
export * from "./quota_created_successfully.js";
export * from "./quota_updated_successfully.js";
export * from "./quota_deleted_successfully.js";
export * from "./failed_to_create_quota.js";
export * from "./failed_to_update_quota.js";
export * from "./failed_to_delete_quota.js";
export * from "./quota_status_updated.js";
export * from "./quota_scope_mode.js";
export * from "./quota_scope_mode_each_member.js";
export * from "./quota_scope_mode_each_member_desc.js";
export * from "./quota_scope_mode_all_members.js";
export * from "./quota_scope_mode_all_members_desc.js";
export * from "./quota_scope_mode_selected_members.js";
export * from "./quota_scope_mode_selected_members_desc.js";
export * from "./quota_view_usage.js";
export * from "./quota_usage_records.js";
export * from "./quota_usage_records_description.js";
export * from "./quota_team_shared_pool.js";
export * from "./quota_role_shared_pool.js";
export * from "./quota_available.js";
export * from "./quota_active.js";
export * from "./quota_refreshes_in.js";
export * from "./quota_search_members.js";
export * from "./quota_selected_users_count.js";
export * from "./select_members.js";
export * from "./select_role.js";
export * from "./select_user.js";
export * from "./select_skill.js";
export * from "./select_mcp_server.js";
export * from "./select_tool.js";
export * from "./custom_id.js";
export * from "./enter_custom_id.js";
export * from "./bash_command_pattern.js";
export * from "./bash_command_pattern_placeholder.js";
export * from "./enter_skill_id.js";
export * from "./enter_mcp_id.js";
export * from "./quota_bash_hint.js";
export * from "./quota_tool_hint.js";
export type LocalizedString = import("../runtime.js").LocalizedString;
+79 -1
View File
@@ -995,4 +995,82 @@ export * from './agents_md.js'
export * from './agents_md_placeholder.js'
export * from './agents_md_readonly_hint.js'
export * from './agents_md_save_failed.js'
export * from './agents_md_loading.js'
export * from './agents_md_loading.js'
export * from './quotas.js'
export * from './resource_quotas.js'
export * from './resource_quotas_description.js'
export * from './add_quota.js'
export * from './create_quota_rule.js'
export * from './edit_quota_rule.js'
export * from './edit_quota_rule_description.js'
export * from './create_quota_rule_description.js'
export * from './quota_scope.js'
export * from './quota_scope_team.js'
export * from './quota_scope_role.js'
export * from './quota_scope_user.js'
export * from './quota_scope_team_description.js'
export * from './quota_scope_role_description.js'
export * from './quota_scope_user_description.js'
export * from './quota_resource.js'
export * from './quota_resource_agent_total_tokens.js'
export * from './quota_resource_agent_cost.js'
export * from './quota_resource_agent_skill_call_count.js'
export * from './quota_resource_agent_mcp_call_count.js'
export * from './quota_resource_agent_bash_call_count.js'
export * from './quota_resource_agent_tool_call_count.js'
export * from './quota_period.js'
export * from './quota_period_1hour.js'
export * from './quota_period_5hour.js'
export * from './quota_period_1day.js'
export * from './quota_period_7day.js'
export * from './quota_limit.js'
export * from './quota_limit_placeholder.js'
export * from './quota_enabled.js'
export * from './quota_disabled.js'
export * from './quota_current_usage.js'
export * from './quota_consumed.js'
export * from './quota_remaining.js'
export * from './quota_period_resets.js'
export * from './quota_active_window.js'
export * from './no_quotas_title.js'
export * from './no_quotas_description.js'
export * from './delete_quota.js'
export * from './delete_quota_confirm.js'
export * from './quota_created_successfully.js'
export * from './quota_updated_successfully.js'
export * from './quota_deleted_successfully.js'
export * from './failed_to_create_quota.js'
export * from './failed_to_update_quota.js'
export * from './failed_to_delete_quota.js'
export * from './quota_status_updated.js'
export * from './quota_scope_mode.js'
export * from './quota_scope_mode_each_member.js'
export * from './quota_scope_mode_each_member_desc.js'
export * from './quota_scope_mode_all_members.js'
export * from './quota_scope_mode_all_members_desc.js'
export * from './quota_scope_mode_selected_members.js'
export * from './quota_scope_mode_selected_members_desc.js'
export * from './quota_view_usage.js'
export * from './quota_usage_records.js'
export * from './quota_usage_records_description.js'
export * from './quota_team_shared_pool.js'
export * from './quota_role_shared_pool.js'
export * from './quota_available.js'
export * from './quota_active.js'
export * from './quota_refreshes_in.js'
export * from './quota_search_members.js'
export * from './quota_selected_users_count.js'
export * from './select_members.js'
export * from './select_role.js'
export * from './select_user.js'
export * from './select_skill.js'
export * from './select_mcp_server.js'
export * from './select_tool.js'
export * from './custom_id.js'
export * from './enter_custom_id.js'
export * from './bash_command_pattern.js'
export * from './bash_command_pattern_placeholder.js'
export * from './enter_skill_id.js'
export * from './enter_mcp_id.js'
export * from './quota_bash_hint.js'
export * from './quota_tool_hint.js'
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Add Quota" |
*
* @param {Add_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const add_quota: ((inputs?: Add_QuotaInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Add_QuotaInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Add_QuotaInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Add_QuotaInputs */
const en_add_quota = /** @type {(inputs: Add_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Add Quota`)
};
const zh_add_quota = /** @type {(inputs: Add_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`添加配额`)
};
/**
* | output |
* | --- |
* | "Add Quota" |
*
* @param {Add_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const add_quota = /** @type {((inputs?: Add_QuotaInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Add_QuotaInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_add_quota(inputs)
return zh_add_quota(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Bash Match Wildcard" |
*
* @param {Bash_Command_PatternInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const bash_command_pattern: ((inputs?: Bash_Command_PatternInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Bash_Command_PatternInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Bash_Command_PatternInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Bash_Command_PatternInputs */
const en_bash_command_pattern = /** @type {(inputs: Bash_Command_PatternInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Bash Match Wildcard`)
};
const zh_bash_command_pattern = /** @type {(inputs: Bash_Command_PatternInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Bash 命令通配符`)
};
/**
* | output |
* | --- |
* | "Bash Match Wildcard" |
*
* @param {Bash_Command_PatternInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const bash_command_pattern = /** @type {((inputs?: Bash_Command_PatternInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Bash_Command_PatternInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_bash_command_pattern(inputs)
return zh_bash_command_pattern(inputs)
});
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "e.g. * or npm*" |
*
* @param {Bash_Command_Pattern_PlaceholderInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const bash_command_pattern_placeholder: ((inputs?: Bash_Command_Pattern_PlaceholderInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Bash_Command_Pattern_PlaceholderInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Bash_Command_Pattern_PlaceholderInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Bash_Command_Pattern_PlaceholderInputs */
const en_bash_command_pattern_placeholder = /** @type {(inputs: Bash_Command_Pattern_PlaceholderInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`e.g. * or npm*`)
};
const zh_bash_command_pattern_placeholder = /** @type {(inputs: Bash_Command_Pattern_PlaceholderInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`例如 * 或 npm*`)
};
/**
* | output |
* | --- |
* | "e.g. * or npm*" |
*
* @param {Bash_Command_Pattern_PlaceholderInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const bash_command_pattern_placeholder = /** @type {((inputs?: Bash_Command_Pattern_PlaceholderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Bash_Command_Pattern_PlaceholderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_bash_command_pattern_placeholder(inputs)
return zh_bash_command_pattern_placeholder(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Create Quota Rule" |
*
* @param {Create_Quota_RuleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const create_quota_rule: ((inputs?: Create_Quota_RuleInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Create_Quota_RuleInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Create_Quota_RuleInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Create_Quota_RuleInputs */
const en_create_quota_rule = /** @type {(inputs: Create_Quota_RuleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Create Quota Rule`)
};
const zh_create_quota_rule = /** @type {(inputs: Create_Quota_RuleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`创建配额规则`)
};
/**
* | output |
* | --- |
* | "Create Quota Rule" |
*
* @param {Create_Quota_RuleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const create_quota_rule = /** @type {((inputs?: Create_Quota_RuleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Create_Quota_RuleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_create_quota_rule(inputs)
return zh_create_quota_rule(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Set up a new resource quota to prevent unexpected usage." |
*
* @param {Create_Quota_Rule_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const create_quota_rule_description: ((inputs?: Create_Quota_Rule_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Create_Quota_Rule_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Create_Quota_Rule_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Create_Quota_Rule_DescriptionInputs */
const en_create_quota_rule_description = /** @type {(inputs: Create_Quota_Rule_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Set up a new resource quota to prevent unexpected usage.`)
};
const zh_create_quota_rule_description = /** @type {(inputs: Create_Quota_Rule_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`设置新的资源配额以防止意外的超量使用。`)
};
/**
* | output |
* | --- |
* | "Set up a new resource quota to prevent unexpected usage." |
*
* @param {Create_Quota_Rule_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const create_quota_rule_description = /** @type {((inputs?: Create_Quota_Rule_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Create_Quota_Rule_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_create_quota_rule_description(inputs)
return zh_create_quota_rule_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Custom ID" |
*
* @param {Custom_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const custom_id: ((inputs?: Custom_IdInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Custom_IdInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Custom_IdInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Custom_IdInputs */
const en_custom_id = /** @type {(inputs: Custom_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Custom ID`)
};
const zh_custom_id = /** @type {(inputs: Custom_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`自定义 ID`)
};
/**
* | output |
* | --- |
* | "Custom ID" |
*
* @param {Custom_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const custom_id = /** @type {((inputs?: Custom_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Custom_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_custom_id(inputs)
return zh_custom_id(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Delete Quota" |
*
* @param {Delete_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const delete_quota: ((inputs?: Delete_QuotaInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_QuotaInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Delete_QuotaInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Delete_QuotaInputs */
const en_delete_quota = /** @type {(inputs: Delete_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Delete Quota`)
};
const zh_delete_quota = /** @type {(inputs: Delete_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`删除配额`)
};
/**
* | output |
* | --- |
* | "Delete Quota" |
*
* @param {Delete_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const delete_quota = /** @type {((inputs?: Delete_QuotaInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_QuotaInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_delete_quota(inputs)
return zh_delete_quota(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Are you sure you want to delete this quota rule? This action cannot be undone." |
*
* @param {Delete_Quota_ConfirmInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const delete_quota_confirm: ((inputs?: Delete_Quota_ConfirmInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_Quota_ConfirmInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Delete_Quota_ConfirmInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Delete_Quota_ConfirmInputs */
const en_delete_quota_confirm = /** @type {(inputs: Delete_Quota_ConfirmInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Are you sure you want to delete this quota rule? This action cannot be undone.`)
};
const zh_delete_quota_confirm = /** @type {(inputs: Delete_Quota_ConfirmInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`确定要删除此配额规则吗?此操作无法撤销。`)
};
/**
* | output |
* | --- |
* | "Are you sure you want to delete this quota rule? This action cannot be undone." |
*
* @param {Delete_Quota_ConfirmInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const delete_quota_confirm = /** @type {((inputs?: Delete_Quota_ConfirmInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_Quota_ConfirmInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_delete_quota_confirm(inputs)
return zh_delete_quota_confirm(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Edit Quota Rule" |
*
* @param {Edit_Quota_RuleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const edit_quota_rule: ((inputs?: Edit_Quota_RuleInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Edit_Quota_RuleInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Edit_Quota_RuleInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Edit_Quota_RuleInputs */
const en_edit_quota_rule = /** @type {(inputs: Edit_Quota_RuleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Edit Quota Rule`)
};
const zh_edit_quota_rule = /** @type {(inputs: Edit_Quota_RuleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`编辑配额规则`)
};
/**
* | output |
* | --- |
* | "Edit Quota Rule" |
*
* @param {Edit_Quota_RuleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const edit_quota_rule = /** @type {((inputs?: Edit_Quota_RuleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Edit_Quota_RuleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_edit_quota_rule(inputs)
return zh_edit_quota_rule(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Configure resource limits, target scopes, and evaluation periods." |
*
* @param {Edit_Quota_Rule_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const edit_quota_rule_description: ((inputs?: Edit_Quota_Rule_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Edit_Quota_Rule_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Edit_Quota_Rule_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Edit_Quota_Rule_DescriptionInputs */
const en_edit_quota_rule_description = /** @type {(inputs: Edit_Quota_Rule_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Configure resource limits, target scopes, and evaluation periods.`)
};
const zh_edit_quota_rule_description = /** @type {(inputs: Edit_Quota_Rule_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`配置资源上限、目标范围以及评估周期。`)
};
/**
* | output |
* | --- |
* | "Configure resource limits, target scopes, and evaluation periods." |
*
* @param {Edit_Quota_Rule_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const edit_quota_rule_description = /** @type {((inputs?: Edit_Quota_Rule_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Edit_Quota_Rule_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_edit_quota_rule_description(inputs)
return zh_edit_quota_rule_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Enter custom ID" |
*
* @param {Enter_Custom_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_custom_id: ((inputs?: Enter_Custom_IdInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Enter_Custom_IdInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Enter_Custom_IdInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Enter_Custom_IdInputs */
const en_enter_custom_id = /** @type {(inputs: Enter_Custom_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Enter custom ID`)
};
const zh_enter_custom_id = /** @type {(inputs: Enter_Custom_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输入自定义 ID`)
};
/**
* | output |
* | --- |
* | "Enter custom ID" |
*
* @param {Enter_Custom_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_custom_id = /** @type {((inputs?: Enter_Custom_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Enter_Custom_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_enter_custom_id(inputs)
return zh_enter_custom_id(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Enter MCP Server ID" |
*
* @param {Enter_Mcp_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_mcp_id: ((inputs?: Enter_Mcp_IdInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Enter_Mcp_IdInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Enter_Mcp_IdInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Enter_Mcp_IdInputs */
const en_enter_mcp_id = /** @type {(inputs: Enter_Mcp_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Enter MCP Server ID`)
};
const zh_enter_mcp_id = /** @type {(inputs: Enter_Mcp_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输入 MCP 服务 ID`)
};
/**
* | output |
* | --- |
* | "Enter MCP Server ID" |
*
* @param {Enter_Mcp_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_mcp_id = /** @type {((inputs?: Enter_Mcp_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Enter_Mcp_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_enter_mcp_id(inputs)
return zh_enter_mcp_id(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Enter Skill ID" |
*
* @param {Enter_Skill_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_skill_id: ((inputs?: Enter_Skill_IdInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Enter_Skill_IdInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Enter_Skill_IdInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Enter_Skill_IdInputs */
const en_enter_skill_id = /** @type {(inputs: Enter_Skill_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Enter Skill ID`)
};
const zh_enter_skill_id = /** @type {(inputs: Enter_Skill_IdInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`输入技能 ID`)
};
/**
* | output |
* | --- |
* | "Enter Skill ID" |
*
* @param {Enter_Skill_IdInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const enter_skill_id = /** @type {((inputs?: Enter_Skill_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Enter_Skill_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_enter_skill_id(inputs)
return zh_enter_skill_id(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Failed to create quota rule" |
*
* @param {Failed_To_Create_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_create_quota: ((inputs?: Failed_To_Create_QuotaInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Failed_To_Create_QuotaInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Failed_To_Create_QuotaInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Failed_To_Create_QuotaInputs */
const en_failed_to_create_quota = /** @type {(inputs: Failed_To_Create_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Failed to create quota rule`)
};
const zh_failed_to_create_quota = /** @type {(inputs: Failed_To_Create_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`创建配额规则失败`)
};
/**
* | output |
* | --- |
* | "Failed to create quota rule" |
*
* @param {Failed_To_Create_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_create_quota = /** @type {((inputs?: Failed_To_Create_QuotaInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Failed_To_Create_QuotaInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_failed_to_create_quota(inputs)
return zh_failed_to_create_quota(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Failed to delete quota rule" |
*
* @param {Failed_To_Delete_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_delete_quota: ((inputs?: Failed_To_Delete_QuotaInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Failed_To_Delete_QuotaInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Failed_To_Delete_QuotaInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Failed_To_Delete_QuotaInputs */
const en_failed_to_delete_quota = /** @type {(inputs: Failed_To_Delete_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Failed to delete quota rule`)
};
const zh_failed_to_delete_quota = /** @type {(inputs: Failed_To_Delete_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`删除配额规则失败`)
};
/**
* | output |
* | --- |
* | "Failed to delete quota rule" |
*
* @param {Failed_To_Delete_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_delete_quota = /** @type {((inputs?: Failed_To_Delete_QuotaInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Failed_To_Delete_QuotaInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_failed_to_delete_quota(inputs)
return zh_failed_to_delete_quota(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Failed to update quota rule" |
*
* @param {Failed_To_Update_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_update_quota: ((inputs?: Failed_To_Update_QuotaInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Failed_To_Update_QuotaInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Failed_To_Update_QuotaInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Failed_To_Update_QuotaInputs */
const en_failed_to_update_quota = /** @type {(inputs: Failed_To_Update_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Failed to update quota rule`)
};
const zh_failed_to_update_quota = /** @type {(inputs: Failed_To_Update_QuotaInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`更新配额规则失败`)
};
/**
* | output |
* | --- |
* | "Failed to update quota rule" |
*
* @param {Failed_To_Update_QuotaInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const failed_to_update_quota = /** @type {((inputs?: Failed_To_Update_QuotaInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Failed_To_Update_QuotaInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_failed_to_update_quota(inputs)
return zh_failed_to_update_quota(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Set limits on AI tokens, costs, skill executions, and agent tool calls to manage team usage." |
*
* @param {No_Quotas_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_quotas_description: ((inputs?: No_Quotas_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Quotas_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type No_Quotas_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} No_Quotas_DescriptionInputs */
const en_no_quotas_description = /** @type {(inputs: No_Quotas_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Set limits on AI tokens, costs, skill executions, and agent tool calls to manage team usage.`)
};
const zh_no_quotas_description = /** @type {(inputs: No_Quotas_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`为 AI Token、费用、Skill 执行和智能体工具调用设置限制,以便管理团队的使用情况。`)
};
/**
* | output |
* | --- |
* | "Set limits on AI tokens, costs, skill executions, and agent tool calls to manage team usage." |
*
* @param {No_Quotas_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_quotas_description = /** @type {((inputs?: No_Quotas_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Quotas_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_no_quotas_description(inputs)
return zh_no_quotas_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "No resource quotas configured" |
*
* @param {No_Quotas_TitleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_quotas_title: ((inputs?: No_Quotas_TitleInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Quotas_TitleInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type No_Quotas_TitleInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} No_Quotas_TitleInputs */
const en_no_quotas_title = /** @type {(inputs: No_Quotas_TitleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`No resource quotas configured`)
};
const zh_no_quotas_title = /** @type {(inputs: No_Quotas_TitleInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`暂未配置资源配额`)
};
/**
* | output |
* | --- |
* | "No resource quotas configured" |
*
* @param {No_Quotas_TitleInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_quotas_title = /** @type {((inputs?: No_Quotas_TitleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Quotas_TitleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_no_quotas_title(inputs)
return zh_no_quotas_title(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Active" |
*
* @param {Quota_ActiveInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_active: ((inputs?: Quota_ActiveInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_ActiveInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_ActiveInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_ActiveInputs */
const en_quota_active = /** @type {(inputs: Quota_ActiveInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Active`)
};
const zh_quota_active = /** @type {(inputs: Quota_ActiveInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`使用中`)
};
/**
* | output |
* | --- |
* | "Active" |
*
* @param {Quota_ActiveInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_active = /** @type {((inputs?: Quota_ActiveInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_ActiveInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_active(inputs)
return zh_quota_active(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Active Window" |
*
* @param {Quota_Active_WindowInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_active_window: ((inputs?: Quota_Active_WindowInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Active_WindowInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_Active_WindowInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_Active_WindowInputs */
const en_quota_active_window = /** @type {(inputs: Quota_Active_WindowInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Active Window`)
};
const zh_quota_active_window = /** @type {(inputs: Quota_Active_WindowInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`生效周期`)
};
/**
* | output |
* | --- |
* | "Active Window" |
*
* @param {Quota_Active_WindowInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_active_window = /** @type {((inputs?: Quota_Active_WindowInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Active_WindowInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_active_window(inputs)
return zh_quota_active_window(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Quota available" |
*
* @param {Quota_AvailableInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_available: ((inputs?: Quota_AvailableInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_AvailableInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_AvailableInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_AvailableInputs */
const en_quota_available = /** @type {(inputs: Quota_AvailableInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Quota available`)
};
const zh_quota_available = /** @type {(inputs: Quota_AvailableInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`配额可用`)
};
/**
* | output |
* | --- |
* | "Quota available" |
*
* @param {Quota_AvailableInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_available = /** @type {((inputs?: Quota_AvailableInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_AvailableInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_available(inputs)
return zh_quota_available(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)" |
*
* @param {Quota_Bash_HintInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_bash_hint: ((inputs?: Quota_Bash_HintInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Bash_HintInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_Bash_HintInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_Bash_HintInputs */
const en_quota_bash_hint = /** @type {(inputs: Quota_Bash_HintInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)`)
};
const zh_quota_bash_hint = /** @type {(inputs: Quota_Bash_HintInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`支持通配符 (*)。示例:git *、npm test、curl *、python script.py(使用 * 匹配所有命令)`)
};
/**
* | output |
* | --- |
* | "Supports wildcards (*). Examples: git *, npm test, curl *, python script.py (use * for all commands)" |
*
* @param {Quota_Bash_HintInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_bash_hint = /** @type {((inputs?: Quota_Bash_HintInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Bash_HintInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_bash_hint(inputs)
return zh_quota_bash_hint(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Consumed" |
*
* @param {Quota_ConsumedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_consumed: ((inputs?: Quota_ConsumedInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_ConsumedInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_ConsumedInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_ConsumedInputs */
const en_quota_consumed = /** @type {(inputs: Quota_ConsumedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Consumed`)
};
const zh_quota_consumed = /** @type {(inputs: Quota_ConsumedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`已消耗`)
};
/**
* | output |
* | --- |
* | "Consumed" |
*
* @param {Quota_ConsumedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_consumed = /** @type {((inputs?: Quota_ConsumedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_ConsumedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_consumed(inputs)
return zh_quota_consumed(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Quota rule created successfully" |
*
* @param {Quota_Created_SuccessfullyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_created_successfully: ((inputs?: Quota_Created_SuccessfullyInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Created_SuccessfullyInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_Created_SuccessfullyInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_Created_SuccessfullyInputs */
const en_quota_created_successfully = /** @type {(inputs: Quota_Created_SuccessfullyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Quota rule created successfully`)
};
const zh_quota_created_successfully = /** @type {(inputs: Quota_Created_SuccessfullyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`配额规则创建成功`)
};
/**
* | output |
* | --- |
* | "Quota rule created successfully" |
*
* @param {Quota_Created_SuccessfullyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_created_successfully = /** @type {((inputs?: Quota_Created_SuccessfullyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Created_SuccessfullyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_created_successfully(inputs)
return zh_quota_created_successfully(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Current Usage" |
*
* @param {Quota_Current_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_current_usage: ((inputs?: Quota_Current_UsageInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Current_UsageInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_Current_UsageInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_Current_UsageInputs */
const en_quota_current_usage = /** @type {(inputs: Quota_Current_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Current Usage`)
};
const zh_quota_current_usage = /** @type {(inputs: Quota_Current_UsageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`当前使用量`)
};
/**
* | output |
* | --- |
* | "Current Usage" |
*
* @param {Quota_Current_UsageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_current_usage = /** @type {((inputs?: Quota_Current_UsageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Current_UsageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_current_usage(inputs)
return zh_quota_current_usage(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Quota rule deleted successfully" |
*
* @param {Quota_Deleted_SuccessfullyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_deleted_successfully: ((inputs?: Quota_Deleted_SuccessfullyInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_Deleted_SuccessfullyInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_Deleted_SuccessfullyInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_Deleted_SuccessfullyInputs */
const en_quota_deleted_successfully = /** @type {(inputs: Quota_Deleted_SuccessfullyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Quota rule deleted successfully`)
};
const zh_quota_deleted_successfully = /** @type {(inputs: Quota_Deleted_SuccessfullyInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`配额规则删除成功`)
};
/**
* | output |
* | --- |
* | "Quota rule deleted successfully" |
*
* @param {Quota_Deleted_SuccessfullyInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_deleted_successfully = /** @type {((inputs?: Quota_Deleted_SuccessfullyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_Deleted_SuccessfullyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_deleted_successfully(inputs)
return zh_quota_deleted_successfully(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Disabled" |
*
* @param {Quota_DisabledInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_disabled: ((inputs?: Quota_DisabledInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_DisabledInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_DisabledInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_DisabledInputs */
const en_quota_disabled = /** @type {(inputs: Quota_DisabledInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Disabled`)
};
const zh_quota_disabled = /** @type {(inputs: Quota_DisabledInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`已禁用`)
};
/**
* | output |
* | --- |
* | "Disabled" |
*
* @param {Quota_DisabledInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_disabled = /** @type {((inputs?: Quota_DisabledInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_DisabledInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_disabled(inputs)
return zh_quota_disabled(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Enabled" |
*
* @param {Quota_EnabledInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_enabled: ((inputs?: Quota_EnabledInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_EnabledInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_EnabledInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Quota_EnabledInputs */
const en_quota_enabled = /** @type {(inputs: Quota_EnabledInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Enabled`)
};
const zh_quota_enabled = /** @type {(inputs: Quota_EnabledInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`已启用`)
};
/**
* | output |
* | --- |
* | "Enabled" |
*
* @param {Quota_EnabledInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_enabled = /** @type {((inputs?: Quota_EnabledInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Quota_EnabledInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_quota_enabled(inputs)
return zh_quota_enabled(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Limit" |
*
* @param {Quota_LimitInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const quota_limit: ((inputs?: Quota_LimitInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Quota_LimitInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Quota_LimitInputs = {};

Some files were not shown because too many files have changed in this diff Show More