mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 06:49:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b84402c83 | ||
|
|
61a61abc7c | ||
|
|
fc878775c2 | ||
|
|
7acf736300 | ||
|
|
9d50301a43 | ||
|
|
7f185ca23c | ||
|
|
94582c9001 | ||
|
|
41b73feeab |
@@ -54,5 +54,6 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
provenance: false
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ WORKDIR /app
|
|||||||
COPY package.json bun.lock ./
|
COPY package.json bun.lock ./
|
||||||
COPY --parents packages/*/package.json ./
|
COPY --parents packages/*/package.json ./
|
||||||
COPY --parents apps/*/package.json ./
|
COPY --parents apps/*/package.json ./
|
||||||
|
COPY patches/ ./patches/
|
||||||
|
|
||||||
# Install dependencies (including devDependencies for build tools)
|
# Install dependencies (including devDependencies for build tools)
|
||||||
RUN bun install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/agent-app",
|
"name": "@shumai/agent-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/cli",
|
"name": "@shumai/cli",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/transcode-app",
|
"name": "@shumai/transcode-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/web-app",
|
"name": "@shumai/web-app",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
"apps/agent": {
|
"apps/agent": {
|
||||||
"name": "@shumai/agent-app",
|
"name": "@shumai/agent-app",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-agent": "./src/index.ts",
|
"shumai-agent": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"apps/cli": {
|
"apps/cli": {
|
||||||
"name": "@shumai/cli",
|
"name": "@shumai/cli",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-cli": "./src/index.ts",
|
"shumai-cli": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
},
|
},
|
||||||
"apps/transcode": {
|
"apps/transcode": {
|
||||||
"name": "@shumai/transcode-app",
|
"name": "@shumai/transcode-app",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"bin": {
|
"bin": {
|
||||||
"shumai-transcode": "./src/index.ts",
|
"shumai-transcode": "./src/index.ts",
|
||||||
},
|
},
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
"apps/web": {
|
"apps/web": {
|
||||||
"name": "@shumai/web-app",
|
"name": "@shumai/web-app",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/agent": "workspace:*",
|
"@shumai/agent": "workspace:*",
|
||||||
"@shumai/api": "workspace:*",
|
"@shumai/api": "workspace:*",
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
},
|
},
|
||||||
"packages/agent": {
|
"packages/agent": {
|
||||||
"name": "@shumai/agent",
|
"name": "@shumai/agent",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
"@anthropic-ai/sandbox-runtime": "0.0.66",
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
@@ -102,12 +102,12 @@
|
|||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
"@shumai/dtos": "workspace:*",
|
"@shumai/dtos": "workspace:*",
|
||||||
"@shumai/workflow-core": "workspace:*",
|
"@shumai/workflow-core": "workspace:*",
|
||||||
"@sinclair/typebox": "0.34.49",
|
|
||||||
"@temporalio/activity": "1.17.2",
|
"@temporalio/activity": "1.17.2",
|
||||||
"@temporalio/worker": "1.17.2",
|
"@temporalio/worker": "1.17.2",
|
||||||
"@temporalio/workflow": "1.17.2",
|
"@temporalio/workflow": "1.17.2",
|
||||||
"adm-zip": "0.5.17",
|
"adm-zip": "0.5.17",
|
||||||
"jittered-fractional-indexing": "1.0.1",
|
"jittered-fractional-indexing": "1.0.1",
|
||||||
|
"typebox": "1.1.38",
|
||||||
"ulid": "3.0.2",
|
"ulid": "3.0.2",
|
||||||
"zod": "4.4.3",
|
"zod": "4.4.3",
|
||||||
},
|
},
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
},
|
},
|
||||||
"packages/api": {
|
"packages/api": {
|
||||||
"name": "@shumai/api",
|
"name": "@shumai/api",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hono/zod-validator": "0.7.6",
|
"@hono/zod-validator": "0.7.6",
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
},
|
},
|
||||||
"packages/core": {
|
"packages/core": {
|
||||||
"name": "@shumai/core",
|
"name": "@shumai/core",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@earendil-works/pi-ai": "0.82.1",
|
"@earendil-works/pi-ai": "0.82.1",
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
},
|
},
|
||||||
"packages/db": {
|
"packages/db": {
|
||||||
"name": "@shumai/db",
|
"name": "@shumai/db",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@prisma/adapter-pg": "7.8.0",
|
"@prisma/adapter-pg": "7.8.0",
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
},
|
},
|
||||||
"packages/dtos": {
|
"packages/dtos": {
|
||||||
"name": "@shumai/dtos",
|
"name": "@shumai/dtos",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"zod": "4.4.3",
|
"zod": "4.4.3",
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
},
|
},
|
||||||
"packages/e2e": {
|
"packages/e2e": {
|
||||||
"name": "@shumai/e2e",
|
"name": "@shumai/e2e",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@earendil-works/pi-agent-core": "0.82.1",
|
"@earendil-works/pi-agent-core": "0.82.1",
|
||||||
"@google/genai": "1.52.0",
|
"@google/genai": "1.52.0",
|
||||||
@@ -205,11 +205,11 @@
|
|||||||
},
|
},
|
||||||
"packages/tableprinter": {
|
"packages/tableprinter": {
|
||||||
"name": "@shumai/tableprinter",
|
"name": "@shumai/tableprinter",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
},
|
},
|
||||||
"packages/transcode": {
|
"packages/transcode": {
|
||||||
"name": "@shumai/transcode",
|
"name": "@shumai/transcode",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
},
|
},
|
||||||
"packages/webui": {
|
"packages/webui": {
|
||||||
"name": "@shumai/webui",
|
"name": "@shumai/webui",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@base-ui/react": "1.5.0",
|
"@base-ui/react": "1.5.0",
|
||||||
"@dnd-kit/abstract": "0.4.0",
|
"@dnd-kit/abstract": "0.4.0",
|
||||||
@@ -321,7 +321,7 @@
|
|||||||
},
|
},
|
||||||
"packages/workflow-core": {
|
"packages/workflow-core": {
|
||||||
"name": "@shumai/workflow-core",
|
"name": "@shumai/workflow-core",
|
||||||
"version": "0.3.5",
|
"version": "0.3.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shumai/core": "workspace:*",
|
"@shumai/core": "workspace:*",
|
||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
@@ -333,6 +333,9 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"patchedDependencies": {
|
||||||
|
"@earendil-works/pi-ai@0.82.1": "patches/@earendil-works%2Fpi-ai@0.82.1.patch",
|
||||||
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
|
"@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ To protect your workspace environments and sensitive data, the sandbox enforces
|
|||||||
|
|
||||||
## Domain Whitelisting
|
## Domain Whitelisting
|
||||||
|
|
||||||
By default, sandboxed scripts cannot make network requests to the internet. Team Owners must explicitly authorize external APIs by managing domain access:
|
By default, Network Sandbox is **disabled** (allowing all outbound network requests). Team Owners can toggle Network Sandbox **ON** in Sandbox Settings to enforce strict domain whitelisting:
|
||||||
|
|
||||||
### Allowed Domains
|
### Allowed Domains
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "shumai",
|
"name": "shumai",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -65,5 +65,8 @@
|
|||||||
"typescript-eslint": "8.60.1",
|
"typescript-eslint": "8.60.1",
|
||||||
"vite-tsconfig-paths": "6.1.1",
|
"vite-tsconfig-paths": "6.1.1",
|
||||||
"vitest": "4.1.8"
|
"vitest": "4.1.8"
|
||||||
|
},
|
||||||
|
"patchedDependencies": {
|
||||||
|
"@earendil-works/pi-ai@0.82.1": "patches/@earendil-works%2Fpi-ai@0.82.1.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/agent",
|
"name": "@shumai/agent",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
@@ -14,12 +14,12 @@
|
|||||||
"@shumai/db": "workspace:*",
|
"@shumai/db": "workspace:*",
|
||||||
"@shumai/dtos": "workspace:*",
|
"@shumai/dtos": "workspace:*",
|
||||||
"@shumai/workflow-core": "workspace:*",
|
"@shumai/workflow-core": "workspace:*",
|
||||||
"@sinclair/typebox": "0.34.49",
|
|
||||||
"@temporalio/activity": "1.17.2",
|
"@temporalio/activity": "1.17.2",
|
||||||
"@temporalio/worker": "1.17.2",
|
"@temporalio/worker": "1.17.2",
|
||||||
"@temporalio/workflow": "1.17.2",
|
"@temporalio/workflow": "1.17.2",
|
||||||
"adm-zip": "0.5.17",
|
"adm-zip": "0.5.17",
|
||||||
"jittered-fractional-indexing": "1.0.1",
|
"jittered-fractional-indexing": "1.0.1",
|
||||||
|
"typebox": "1.1.38",
|
||||||
"ulid": "3.0.2",
|
"ulid": "3.0.2",
|
||||||
"zod": "4.4.3"
|
"zod": "4.4.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
updateCommentActivity,
|
updateCommentActivity,
|
||||||
getAgentChatContextActivity,
|
getAgentChatContextActivity,
|
||||||
getAgentAutofillContextActivity,
|
getAgentAutofillContextActivity,
|
||||||
getAssetAutofillContextActivity,
|
|
||||||
getAssetActivity,
|
getAssetActivity,
|
||||||
getCommentActivity,
|
getCommentActivity,
|
||||||
getProjectAutofillFieldsActivity,
|
getProjectAutofillFieldsActivity,
|
||||||
@@ -460,58 +459,7 @@ describe('Agent Activities', () => {
|
|||||||
expect(res.usage.inputTokens).toBe(5)
|
expect(res.usage.inputTokens).toBe(5)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should include agentContext in the autofill prompt when provided', async () => {
|
it('should use the base autofill prompt without any creation-context injection', async () => {
|
||||||
const mockHarness = {
|
|
||||||
subscribe: vi.fn(),
|
|
||||||
prompt: vi.fn().mockResolvedValue({
|
|
||||||
content: [{ type: 'text', text: 'Captured' }],
|
|
||||||
usage: { input: 5, output: 5 },
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
const mockSession = {
|
|
||||||
getEntries: vi.fn().mockResolvedValue([]),
|
|
||||||
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
|
|
||||||
}
|
|
||||||
|
|
||||||
vi.mocked(piAgent.createAgentSession).mockImplementation(async (config: unknown) => {
|
|
||||||
const params = config as {
|
|
||||||
customTools: Array<{
|
|
||||||
name: string
|
|
||||||
execute: (id: string, args: Record<string, unknown>) => Promise<unknown>
|
|
||||||
}>
|
|
||||||
}
|
|
||||||
const tool = params.customTools.find((t) => t.name === 'autofill_metadata')
|
|
||||||
if (tool) {
|
|
||||||
await tool.execute('1', { f1: 'val' })
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock AgentHarness instance for activity test
|
|
||||||
harness: mockHarness as unknown as AgentHarness<any, any, any, any>,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const context = {
|
|
||||||
agent: { id: 'b1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
|
|
||||||
dbProviders: [],
|
|
||||||
teamSkills: [],
|
|
||||||
allowedDomains: [],
|
|
||||||
} as unknown as AgentExecutionContext
|
|
||||||
|
|
||||||
await autofillAiActivity({
|
|
||||||
teamId: 't1',
|
|
||||||
images: [],
|
|
||||||
fields: [{ id: 'f1', config: { name: 'F1', type: 'text' } }],
|
|
||||||
context,
|
|
||||||
agentContext: 'Generated using gemini',
|
|
||||||
})
|
|
||||||
|
|
||||||
const capturedPrompt = mockHarness.prompt.mock.calls[0]?.[0] ?? ''
|
|
||||||
expect(capturedPrompt).toContain('Generated using gemini')
|
|
||||||
expect(capturedPrompt).toContain('<context>')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should not include agentContext in the autofill prompt when absent', async () => {
|
|
||||||
const mockHarness = {
|
const mockHarness = {
|
||||||
subscribe: vi.fn(),
|
subscribe: vi.fn(),
|
||||||
prompt: vi.fn().mockResolvedValue({
|
prompt: vi.fn().mockResolvedValue({
|
||||||
@@ -557,6 +505,7 @@ describe('Agent Activities', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const capturedPrompt = mockHarness.prompt.mock.calls[0]?.[0] ?? ''
|
const capturedPrompt = mockHarness.prompt.mock.calls[0]?.[0] ?? ''
|
||||||
|
expect(capturedPrompt).toContain('Analyze the provided images and extract metadata.')
|
||||||
expect(capturedPrompt).not.toContain('<context>')
|
expect(capturedPrompt).not.toContain('<context>')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1342,8 +1291,7 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
key: 'field_key_1',
|
key: 'field_key_1',
|
||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
aiAutofill: true,
|
config: { name: 'Title Extractor', type: 'text', autofillSource: 'CONTENT' },
|
||||||
config: { name: 'Title Extractor', type: 'text' },
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1363,37 +1311,6 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getAssetAutofillContextActivity', () => {
|
|
||||||
it('should return the stored autofill context for an asset', async () => {
|
|
||||||
const withContext = await prisma.asset.create({
|
|
||||||
data: {
|
|
||||||
name: 'ctx.png',
|
|
||||||
type: AssetType.file,
|
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
projectId: project.id,
|
|
||||||
autofillContext: 'Generated using gemini',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const ctx = await getAssetAutofillContextActivity(withContext.id)
|
|
||||||
expect(ctx).toBe('Generated using gemini')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should return null when the asset has no autofill context', async () => {
|
|
||||||
const noContext = await prisma.asset.create({
|
|
||||||
data: {
|
|
||||||
name: 'plain.png',
|
|
||||||
type: AssetType.file,
|
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
projectId: project.id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const ctx = await getAssetAutofillContextActivity(noContext.id)
|
|
||||||
expect(ctx).toBeNull()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('executeAgentToolActivity', () => {
|
describe('executeAgentToolActivity', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.spyOn(authzService, 'hasPermission').mockResolvedValue()
|
vi.spyOn(authzService, 'hasPermission').mockResolvedValue()
|
||||||
@@ -1553,7 +1470,17 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
expect(uploadService.triggerPostUploadWorkflows).toHaveBeenCalled()
|
expect(uploadService.triggerPostUploadWorkflows).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should persist autofillContext on the created file when context is provided', async () => {
|
it('should persist metadata on the created file when metadata map is provided', async () => {
|
||||||
|
await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'prompt',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
projectId: project.id,
|
||||||
|
teamId: team.id,
|
||||||
|
config: { name: 'Prompt', type: 'text', autofillSource: 'CREATION_CONTEXT' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const folder = await prisma.asset.create({
|
const folder = await prisma.asset.create({
|
||||||
data: {
|
data: {
|
||||||
name: 'WorkspaceFolder',
|
name: 'WorkspaceFolder',
|
||||||
@@ -1574,16 +1501,46 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
name: 'ctx.txt',
|
name: 'ctx.txt',
|
||||||
size: 100,
|
size: 100,
|
||||||
contentType: 'text/plain',
|
contentType: 'text/plain',
|
||||||
context: 'Generated using gemini',
|
metadata: { prompt: 'Generated using gemini' },
|
||||||
},
|
},
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
const created = await prisma.asset.findUnique({ where: { id: res.id } })
|
const val = await prisma.assetMetadataValue.findFirst({
|
||||||
expect(created?.autofillContext).toBe('Generated using gemini')
|
where: { assetId: res.id, fieldKey: 'prompt' },
|
||||||
|
})
|
||||||
|
expect(val?.stringValue).toBe('Generated using gemini')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not set autofillContext when context is not provided', async () => {
|
it('should persist select and selectMulti metadata with dynamic newOption', async () => {
|
||||||
|
const selectField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'provider',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Provider',
|
||||||
|
type: 'select',
|
||||||
|
autofillSource: 'CREATION_CONTEXT',
|
||||||
|
select: { options: [{ id: 'openai', displayName: 'OpenAI', color: '#f43f5e' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const multiField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'tags',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
autofillSource: 'CREATION_CONTEXT',
|
||||||
|
selectMulti: { options: [{ id: 'tag1', displayName: 'Tag 1', color: '#3b82f6' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const folder = await prisma.asset.create({
|
const folder = await prisma.asset.create({
|
||||||
data: {
|
data: {
|
||||||
name: 'WorkspaceFolder',
|
name: 'WorkspaceFolder',
|
||||||
@@ -1600,16 +1557,80 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
toolName: 'create_file',
|
toolName: 'create_file',
|
||||||
args: {
|
args: {
|
||||||
parent: folder.id,
|
parent: folder.id,
|
||||||
s3Key: 'uploads/plain.txt',
|
s3Key: 'uploads/new_opt.txt',
|
||||||
name: 'plain.txt',
|
name: 'new_opt.txt',
|
||||||
size: 100,
|
size: 100,
|
||||||
contentType: 'text/plain',
|
contentType: 'text/plain',
|
||||||
|
metadata: {
|
||||||
|
provider: { newOption: { value: 'Kling' } },
|
||||||
|
tags: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
const created = await prisma.asset.findUnique({ where: { id: res.id } })
|
// Verify select field
|
||||||
expect(created?.autofillContext).toBeNull()
|
const providerVal = await prisma.assetMetadataValue.findFirst({
|
||||||
|
where: { assetId: res.id, fieldKey: selectField.key },
|
||||||
|
})
|
||||||
|
expect(providerVal?.stringValue).toBe('kling')
|
||||||
|
|
||||||
|
// Verify select field config was updated with new option
|
||||||
|
const updatedSelectField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: selectField.key },
|
||||||
|
})
|
||||||
|
const selectOpts =
|
||||||
|
(updatedSelectField?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
|
expect(selectOpts.some((o) => o.displayName === 'Kling' && o.id === 'kling')).toBe(true)
|
||||||
|
|
||||||
|
// Verify selectMulti field
|
||||||
|
const tagsVal = await prisma.assetMetadataValue.findFirst({
|
||||||
|
where: { assetId: res.id, fieldKey: multiField.key },
|
||||||
|
})
|
||||||
|
expect(tagsVal?.jsonValue).toEqual(['tag1', 'tag-2'])
|
||||||
|
|
||||||
|
// Verify selectMulti field config was updated with new option
|
||||||
|
const updatedMultiField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: multiField.key },
|
||||||
|
})
|
||||||
|
const multiOpts =
|
||||||
|
(updatedMultiField?.config as PrismaJson.FieldConfig)?.selectMulti?.options || []
|
||||||
|
expect(multiOpts.some((o) => o.displayName === 'Tag 2' && o.id === 'tag-2')).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should reject metadata with keys that are not valid in this project', async () => {
|
||||||
|
const folder = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'WorkspaceFolder',
|
||||||
|
type: AssetType.folder,
|
||||||
|
status: AssetStatus.uploaded,
|
||||||
|
projectId: project.id,
|
||||||
|
fileCount: 0,
|
||||||
|
sizeByte: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
executeAgentToolActivity({
|
||||||
|
taskId: 'task-1',
|
||||||
|
toolName: 'create_file',
|
||||||
|
args: {
|
||||||
|
parent: folder.id,
|
||||||
|
s3Key: 'uploads/ctx.txt',
|
||||||
|
name: 'ctx.txt',
|
||||||
|
size: 100,
|
||||||
|
contentType: 'text/plain',
|
||||||
|
metadata: { prompt: 'ok', unknownKey: 'not allowed' },
|
||||||
|
},
|
||||||
|
userId: user.id,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow(/not valid in this project/)
|
||||||
|
|
||||||
|
// No metadata value should have been written for the unknown key
|
||||||
|
const val = await prisma.assetMetadataValue.findFirst({
|
||||||
|
where: { fieldKey: 'unknownKey' },
|
||||||
|
})
|
||||||
|
expect(val).toBeNull()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1720,7 +1741,17 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
expect(Number(updatedStack?.sizeByte)).toBe(350)
|
expect(Number(updatedStack?.sizeByte)).toBe(350)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should persist autofillContext when creating a new version stack', async () => {
|
it('should persist metadata on the created version when metadata map is provided', async () => {
|
||||||
|
await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'prompt',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
projectId: project.id,
|
||||||
|
teamId: team.id,
|
||||||
|
config: { name: 'Prompt', type: 'text', autofillSource: 'CREATION_CONTEXT' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const folder = await prisma.asset.create({
|
const folder = await prisma.asset.create({
|
||||||
data: {
|
data: {
|
||||||
name: 'WorkspaceFolder',
|
name: 'WorkspaceFolder',
|
||||||
@@ -1752,45 +1783,51 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
name: 'v2.txt',
|
name: 'v2.txt',
|
||||||
size: 300,
|
size: 300,
|
||||||
contentType: 'text/plain',
|
contentType: 'text/plain',
|
||||||
context: 'Generated using seedance',
|
metadata: { prompt: 'Generated using seedance' },
|
||||||
},
|
},
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
const created = await prisma.asset.findUnique({ where: { id: res.id } })
|
const val = await prisma.assetMetadataValue.findFirst({
|
||||||
expect(created?.autofillContext).toBe('Generated using seedance')
|
where: { assetId: res.id, fieldKey: 'prompt' },
|
||||||
|
})
|
||||||
|
expect(val?.stringValue).toBe('Generated using seedance')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should persist autofillContext when adding to an existing version stack', async () => {
|
it('should persist select and selectMulti newOption metadata in create_version', async () => {
|
||||||
|
const selectField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'versionProvider',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Version Provider',
|
||||||
|
type: 'select',
|
||||||
|
autofillSource: 'CREATION_CONTEXT',
|
||||||
|
select: { options: [{ id: 'openai', displayName: 'OpenAI', color: '#f43f5e' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const folder = await prisma.asset.create({
|
const folder = await prisma.asset.create({
|
||||||
data: {
|
data: {
|
||||||
name: 'WorkspaceFolder',
|
name: 'WorkspaceFolder',
|
||||||
type: AssetType.folder,
|
type: AssetType.folder,
|
||||||
status: AssetStatus.uploaded,
|
status: AssetStatus.uploaded,
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const stack = await prisma.asset.create({
|
|
||||||
data: {
|
|
||||||
name: 'VersionStack',
|
|
||||||
type: AssetType.version_stack,
|
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
projectId: project.id,
|
|
||||||
parentId: folder.id,
|
|
||||||
fileCount: 1,
|
fileCount: 1,
|
||||||
sizeByte: 100,
|
sizeByte: 200,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const existingFileVersion = await prisma.asset.create({
|
const fileAsset = await prisma.asset.create({
|
||||||
data: {
|
data: {
|
||||||
name: 'v1.txt',
|
name: 'v1.txt',
|
||||||
type: AssetType.file,
|
type: AssetType.file,
|
||||||
status: AssetStatus.uploaded,
|
status: AssetStatus.uploaded,
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
parentId: stack.id,
|
parentId: folder.id,
|
||||||
sizeByte: 100,
|
sizeByte: 200,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1798,137 +1835,28 @@ describe('Agent Database Activities Integration', () => {
|
|||||||
taskId: 'task-1',
|
taskId: 'task-1',
|
||||||
toolName: 'create_version',
|
toolName: 'create_version',
|
||||||
args: {
|
args: {
|
||||||
parent: existingFileVersion.id,
|
parent: fileAsset.id,
|
||||||
s3Key: 'uploads/v2.txt',
|
s3Key: 'uploads/v2.txt',
|
||||||
name: 'v2.txt',
|
name: 'v2.txt',
|
||||||
size: 250,
|
size: 300,
|
||||||
contentType: 'text/plain',
|
contentType: 'text/plain',
|
||||||
context: 'Generated using sora2',
|
metadata: {
|
||||||
},
|
versionProvider: { newOption: { value: 'Midjourney' } },
|
||||||
userId: user.id,
|
|
||||||
})
|
|
||||||
|
|
||||||
const created = await prisma.asset.findUnique({ where: { id: res.id } })
|
|
||||||
expect(created?.autofillContext).toBe('Generated using sora2')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('list_autofill_fields', () => {
|
|
||||||
it('should return only aiAutofill fields with their options', async () => {
|
|
||||||
const folder = await prisma.asset.create({
|
|
||||||
data: {
|
|
||||||
name: 'WorkspaceFolder',
|
|
||||||
type: AssetType.folder,
|
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
projectId: project.id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
await prisma.metadataField.create({
|
|
||||||
data: {
|
|
||||||
key: 'source',
|
|
||||||
scope: 'PROJECT',
|
|
||||||
projectId: project.id,
|
|
||||||
teamId: team.id,
|
|
||||||
aiAutofill: true,
|
|
||||||
config: {
|
|
||||||
name: 'Source',
|
|
||||||
type: 'select',
|
|
||||||
select: {
|
|
||||||
options: [
|
|
||||||
{ id: 'gemini', displayName: 'Gemini', color: '#ffffff' },
|
|
||||||
{ id: 'seedance', displayName: 'Seedance', color: '#ffffff' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
description: 'Generation source',
|
|
||||||
},
|
},
|
||||||
})
|
|
||||||
await prisma.metadataField.create({
|
|
||||||
data: {
|
|
||||||
key: 'title',
|
|
||||||
scope: 'PROJECT',
|
|
||||||
projectId: project.id,
|
|
||||||
teamId: team.id,
|
|
||||||
aiAutofill: true,
|
|
||||||
config: { name: 'Title', type: 'text' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
await prisma.metadataField.create({
|
|
||||||
data: {
|
|
||||||
key: 'manual_notes',
|
|
||||||
scope: 'PROJECT',
|
|
||||||
projectId: project.id,
|
|
||||||
teamId: team.id,
|
|
||||||
aiAutofill: false,
|
|
||||||
config: { name: 'Manual Notes', type: 'text' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const res = await executeAgentToolActivity({
|
|
||||||
taskId: 'task-1',
|
|
||||||
toolName: 'list_autofill_fields',
|
|
||||||
args: { parent: folder.id },
|
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(res.fields).toHaveLength(2)
|
const val = await prisma.assetMetadataValue.findFirst({
|
||||||
const source = res.fields.find((f: { name: string }) => f.name === 'Source')
|
where: { assetId: res.id, fieldKey: selectField.key },
|
||||||
expect(source?.name).toBe('Source')
|
|
||||||
expect(source?.type).toBe('select')
|
|
||||||
expect(source?.description).toBe('Generation source')
|
|
||||||
expect(source?.options).toEqual([{ displayName: 'Gemini' }, { displayName: 'Seedance' }])
|
|
||||||
expect(res.fields.find((f: { name: string }) => f.name === 'Manual Notes')).toBeUndefined()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should resolve the project through the ancestor chain', async () => {
|
|
||||||
const rootFolder = await prisma.asset.create({
|
|
||||||
data: {
|
|
||||||
name: 'Root',
|
|
||||||
type: AssetType.folder,
|
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
projectId: project.id,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const subFolder = await prisma.asset.create({
|
expect(val?.stringValue).toBe('midjourney')
|
||||||
data: {
|
|
||||||
name: 'Sub',
|
const updatedField = await prisma.metadataField.findUnique({
|
||||||
type: AssetType.folder,
|
where: { key: selectField.key },
|
||||||
status: AssetStatus.uploaded,
|
|
||||||
parentId: rootFolder.id,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
const opts = (updatedField?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
await prisma.metadataField.create({
|
expect(opts.some((o) => o.displayName === 'Midjourney' && o.id === 'midjourney')).toBe(true)
|
||||||
data: {
|
|
||||||
key: 'title_2',
|
|
||||||
scope: 'PROJECT',
|
|
||||||
projectId: project.id,
|
|
||||||
teamId: team.id,
|
|
||||||
aiAutofill: true,
|
|
||||||
config: { name: 'Title 2', type: 'text' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const res = await executeAgentToolActivity({
|
|
||||||
taskId: 'task-1',
|
|
||||||
toolName: 'list_autofill_fields',
|
|
||||||
args: { parent: subFolder.id },
|
|
||||||
userId: user.id,
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(res.fields.length).toBeGreaterThan(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should fail when parent is missing', async () => {
|
|
||||||
await expect(
|
|
||||||
executeAgentToolActivity({
|
|
||||||
taskId: 'task-1',
|
|
||||||
toolName: 'list_autofill_fields',
|
|
||||||
args: {},
|
|
||||||
userId: user.id,
|
|
||||||
}),
|
|
||||||
).rejects.toThrow('parent parameter is required')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ async function executeAgentPrompt(params: {
|
|||||||
agentsInstruction: string
|
agentsInstruction: string
|
||||||
sessionId?: string
|
sessionId?: string
|
||||||
userId?: string
|
userId?: string
|
||||||
|
projectId?: string
|
||||||
userCommentId?: string | null
|
userCommentId?: string | null
|
||||||
tools?: AgentTool[]
|
tools?: AgentTool[]
|
||||||
context: AgentExecutionContext
|
context: AgentExecutionContext
|
||||||
@@ -104,7 +105,7 @@ shumai has its own cloud file system. If a user asks you to perform file system
|
|||||||
|
|
||||||
If you need to create files in the local filesystem (for example, a temporary file for uploading), only the '.pi' folder in the current directory has write permissions. Do NOT attempt to create files in any other directories.
|
If you need to create files in the local filesystem (for example, a temporary file for uploading), only the '.pi' folder in the current directory has write permissions. Do NOT attempt to create files in any other directories.
|
||||||
|
|
||||||
When creating a file or version, first use 'list_autofill_fields' to inspect the project's AI-autofillable metadata fields. If relevant metadata depends on information unavailable from the file content (for example, the AI model or prompt used to generate the asset), include a context in the 'context' field of 'create_file' or 'create_version'. Keep the context short and only include information relevant to those fields.`
|
When creating a file or version, you may attach metadata (for example, the AI model or prompt used to generate the asset). The allowed field keys and value types are declared directly in the 'metadata' parameter of the 'create_file' and 'create_version' tools.`
|
||||||
|
|
||||||
if (agent.soul) {
|
if (agent.soul) {
|
||||||
systemPrompt = `${systemPrompt}\n\nAgent Personality and Core Instructions:\n${agent.soul}`
|
systemPrompt = `${systemPrompt}\n\nAgent Personality and Core Instructions:\n${agent.soul}`
|
||||||
@@ -144,6 +145,7 @@ When creating a file or version, first use 'list_autofill_fields' to inspect the
|
|||||||
allowedDomains,
|
allowedDomains,
|
||||||
sessionId: params.sessionId,
|
sessionId: params.sessionId,
|
||||||
userId: params.userId,
|
userId: params.userId,
|
||||||
|
projectId: params.projectId,
|
||||||
userCommentId: params.userCommentId,
|
userCommentId: params.userCommentId,
|
||||||
customTools: [...(params.tools || []), ...mcpTools],
|
customTools: [...(params.tools || []), ...mcpTools],
|
||||||
providers: dbProviders.map((p) => ({
|
providers: dbProviders.map((p) => ({
|
||||||
@@ -411,6 +413,7 @@ export async function agentChatActivity(params: AgentChatParams) {
|
|||||||
agentsInstruction: params.agentsInstruction || '',
|
agentsInstruction: params.agentsInstruction || '',
|
||||||
sessionId,
|
sessionId,
|
||||||
userId: params.userId,
|
userId: params.userId,
|
||||||
|
projectId: params.projectId,
|
||||||
userCommentId: params.userCommentId,
|
userCommentId: params.userCommentId,
|
||||||
context: params.context,
|
context: params.context,
|
||||||
attachedAssets: params.attachedAssets,
|
attachedAssets: params.attachedAssets,
|
||||||
@@ -422,17 +425,10 @@ export interface AutofillAiParams {
|
|||||||
images: string[]
|
images: string[]
|
||||||
fields: AutofillField[]
|
fields: AutofillField[]
|
||||||
context: AgentExecutionContext
|
context: AgentExecutionContext
|
||||||
agentContext?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function autofillAiActivity(params: AutofillAiParams) {
|
export async function autofillAiActivity(params: AutofillAiParams) {
|
||||||
let prompt = 'Analyze the provided images and extract metadata.'
|
const prompt = 'Analyze the provided images and extract metadata.'
|
||||||
if (params.agentContext && params.agentContext.trim()) {
|
|
||||||
prompt +=
|
|
||||||
'\n\nAdditional context about this file, provided during creation:\n' +
|
|
||||||
`<context>\n${params.agentContext.trim()}\n</context>\n` +
|
|
||||||
'Use this context to inform your answers, especially for fields that cannot be determined from the images alone (e.g. generation model/source).'
|
|
||||||
}
|
|
||||||
const toolSchema = fieldsToTypeBoxSchema(params.fields)
|
const toolSchema = fieldsToTypeBoxSchema(params.fields)
|
||||||
let capturedData: Record<string, unknown> | null = null
|
let capturedData: Record<string, unknown> | null = null
|
||||||
|
|
||||||
@@ -900,7 +896,7 @@ export async function getAgentChatContextActivity(params: {
|
|||||||
const sandbox = await prisma.sandbox.findUnique({
|
const sandbox = await prisma.sandbox.findUnique({
|
||||||
where: { teamId: params.teamId },
|
where: { teamId: params.teamId },
|
||||||
})
|
})
|
||||||
const allowedDomains = sandbox?.allowedDomains || []
|
const allowedDomains = sandbox?.networkSandboxEnabled ? sandbox.allowedDomains : ['*']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
agent,
|
agent,
|
||||||
@@ -984,7 +980,7 @@ export async function getAgentAutofillContextActivity(params: {
|
|||||||
const sandbox = await prisma.sandbox.findUnique({
|
const sandbox = await prisma.sandbox.findUnique({
|
||||||
where: { teamId: params.teamId },
|
where: { teamId: params.teamId },
|
||||||
})
|
})
|
||||||
const allowedDomains = sandbox?.allowedDomains || []
|
const allowedDomains = sandbox?.networkSandboxEnabled ? sandbox.allowedDomains : ['*']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
agent: agentWithDetails,
|
agent: agentWithDetails,
|
||||||
@@ -1043,15 +1039,7 @@ export async function getCommentActivity(commentId: string) {
|
|||||||
|
|
||||||
export async function getProjectAutofillFieldsActivity(projectId: string) {
|
export async function getProjectAutofillFieldsActivity(projectId: string) {
|
||||||
const fields = await metadataService.listProjectFields('', projectId)
|
const fields = await metadataService.listProjectFields('', projectId)
|
||||||
return fields.filter((f) => f.field.aiAutofill).map((f) => f.field)
|
return fields.filter((f) => f.field.config?.autofillSource === 'CONTENT').map((f) => f.field)
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAssetAutofillContextActivity(assetId: string): Promise<string | null> {
|
|
||||||
const asset = await prisma.asset.findUnique({
|
|
||||||
where: { id: assetId },
|
|
||||||
select: { autofillContext: true },
|
|
||||||
})
|
|
||||||
return asset?.autofillContext ?? null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateAssetMetadataActivity(params: {
|
export async function updateAssetMetadataActivity(params: {
|
||||||
@@ -1100,7 +1088,37 @@ export interface ExecuteAgentToolParams {
|
|||||||
userId?: string
|
userId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
/**
|
||||||
|
* Validates that every metadata key provided by the agent is a defined
|
||||||
|
* CREATION_CONTEXT field of the project. Unknown keys are rejected with a
|
||||||
|
* non-retryable failure so Temporal does not retry expected validation errors.
|
||||||
|
*/
|
||||||
|
async function validateCreationContextMetadata(
|
||||||
|
userId: string,
|
||||||
|
projectId: string,
|
||||||
|
metadata: Record<string, unknown> | undefined,
|
||||||
|
): Promise<void> {
|
||||||
|
if (!metadata || Object.keys(metadata).length === 0) return
|
||||||
|
|
||||||
|
const fields = await metadataService.listProjectFields(userId, projectId)
|
||||||
|
const allowedKeys = new Set(
|
||||||
|
fields
|
||||||
|
.filter((f) => f.field.config?.autofillSource === 'CREATION_CONTEXT')
|
||||||
|
.map((f) => f.field.key),
|
||||||
|
)
|
||||||
|
const invalidKeys = Object.keys(metadata).filter((key) => !allowedKeys.has(key))
|
||||||
|
if (invalidKeys.length > 0) {
|
||||||
|
throw ApplicationFailure.create({
|
||||||
|
message:
|
||||||
|
`metadata contains keys that are not valid in this project: ${invalidKeys.join(', ')}. ` +
|
||||||
|
"The valid metadata fields are fixed to the current conversation's project. " +
|
||||||
|
'If the target folder or file belongs to a different project, call the tool WITHOUT the metadata parameter.',
|
||||||
|
nonRetryable: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Activity return type is a union of tool result shapes
|
||||||
export async function executeAgentToolActivity(params: ExecuteAgentToolParams): Promise<any> {
|
export async function executeAgentToolActivity(params: ExecuteAgentToolParams): Promise<any> {
|
||||||
const { toolName, args, userId } = params
|
const { toolName, args, userId } = params
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
@@ -1254,7 +1272,10 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
const name = args.name as string
|
const name = args.name as string
|
||||||
const fileSize = args.size as number
|
const fileSize = args.size as number
|
||||||
const mimeType = args.contentType as string
|
const mimeType = args.contentType as string
|
||||||
const context = typeof args.context === 'string' ? args.context : undefined
|
const metadata =
|
||||||
|
typeof args.metadata === 'object' && args.metadata !== null
|
||||||
|
? (args.metadata as Record<string, unknown>)
|
||||||
|
: undefined
|
||||||
if (!parent || !s3Key || !name || fileSize === undefined || !mimeType) {
|
if (!parent || !s3Key || !name || fileSize === undefined || !mimeType) {
|
||||||
throw ApplicationFailure.create({
|
throw ApplicationFailure.create({
|
||||||
message: 'parent, s3Key, name, size, and contentType parameters are required',
|
message: 'parent, s3Key, name, size, and contentType parameters are required',
|
||||||
@@ -1288,6 +1309,9 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate that any provided metadata keys are defined CREATION_CONTEXT fields
|
||||||
|
await validateCreationContextMetadata(userId, parentAsset.projectId, metadata)
|
||||||
|
|
||||||
// Create asset via assetService
|
// Create asset via assetService
|
||||||
const newFile = await assetService.createAsset({
|
const newFile = await assetService.createAsset({
|
||||||
name,
|
name,
|
||||||
@@ -1304,12 +1328,14 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
await assetService.updateAncestorsSize(tx as any, parent, fileSize)
|
await assetService.updateAncestorsSize(tx as any, parent, fileSize)
|
||||||
|
|
||||||
// Persist autofill context provided by the agent (used by the autofill workflow)
|
// Persist creation context metadata provided by the agent
|
||||||
if (context) {
|
if (metadata) {
|
||||||
await tx.asset.update({
|
const metadataUpdates = Object.entries(metadata)
|
||||||
where: { id: newFile.id },
|
.filter(([, value]) => value !== null)
|
||||||
data: { autofillContext: context },
|
.map(([key, value]) => ({ key, value }))
|
||||||
})
|
if (metadataUpdates.length > 0) {
|
||||||
|
await metadataService.updateAssetMetadataInTx(tx, newFile.id, metadataUpdates)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger post-upload transcode and AI workflows
|
// Trigger post-upload transcode and AI workflows
|
||||||
@@ -1335,7 +1361,10 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
const name = args.name as string
|
const name = args.name as string
|
||||||
const fileSize = args.size as number
|
const fileSize = args.size as number
|
||||||
const mimeType = args.contentType as string
|
const mimeType = args.contentType as string
|
||||||
const context = typeof args.context === 'string' ? args.context : undefined
|
const metadata =
|
||||||
|
typeof args.metadata === 'object' && args.metadata !== null
|
||||||
|
? (args.metadata as Record<string, unknown>)
|
||||||
|
: undefined
|
||||||
if (!parent || !s3Key || !name || fileSize === undefined || !mimeType) {
|
if (!parent || !s3Key || !name || fileSize === undefined || !mimeType) {
|
||||||
throw ApplicationFailure.create({
|
throw ApplicationFailure.create({
|
||||||
message: 'parent, s3Key, name, size, and contentType parameters are required',
|
message: 'parent, s3Key, name, size, and contentType parameters are required',
|
||||||
@@ -1361,6 +1390,9 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate that any provided metadata keys are defined CREATION_CONTEXT fields
|
||||||
|
await validateCreationContextMetadata(userId, parentFile.projectId, metadata)
|
||||||
|
|
||||||
// Authz check: verify Edit permission on the parent file (resource ID is parent file id)
|
// Authz check: verify Edit permission on the parent file (resource ID is parent file id)
|
||||||
await authzService.hasPermission({
|
await authzService.hasPermission({
|
||||||
user,
|
user,
|
||||||
@@ -1400,12 +1432,14 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
where: { id: newFile.id },
|
where: { id: newFile.id },
|
||||||
data: { sortIndex: newSortIndex },
|
data: { sortIndex: newSortIndex },
|
||||||
})
|
})
|
||||||
// Persist autofill context provided by the agent (used by the autofill workflow)
|
// Persist creation context metadata provided by the agent
|
||||||
if (context) {
|
if (metadata) {
|
||||||
await tx.asset.update({
|
const metadataUpdates = Object.entries(metadata)
|
||||||
where: { id: newFile.id },
|
.filter(([, value]) => value !== null)
|
||||||
data: { autofillContext: context },
|
.map(([key, value]) => ({ key, value }))
|
||||||
})
|
if (metadataUpdates.length > 0) {
|
||||||
|
await metadataService.updateAssetMetadataInTx(tx, newFile.id, metadataUpdates)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Increment stack's size (fileCount is incremented by createAsset already)
|
// Increment stack's size (fileCount is incremented by createAsset already)
|
||||||
const updatedStack = await tx.asset.update({
|
const updatedStack = await tx.asset.update({
|
||||||
@@ -1465,12 +1499,14 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
projectId: parentFile.projectId!,
|
projectId: parentFile.projectId!,
|
||||||
creatorId: userId,
|
creatorId: userId,
|
||||||
})
|
})
|
||||||
// Persist autofill context provided by the agent (used by the autofill workflow)
|
// Persist creation context metadata provided by the agent
|
||||||
if (context) {
|
if (metadata) {
|
||||||
await tx.asset.update({
|
const metadataUpdates = Object.entries(metadata)
|
||||||
where: { id: newFile.id },
|
.filter(([, value]) => value !== null)
|
||||||
data: { autofillContext: context },
|
.map(([key, value]) => ({ key, value }))
|
||||||
})
|
if (metadataUpdates.length > 0) {
|
||||||
|
await metadataService.updateAssetMetadataInTx(tx, newFile.id, metadataUpdates)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update ancestors' size (add size of the new file version)
|
// Update ancestors' size (add size of the new file version)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@@ -1494,49 +1530,6 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'list_autofill_fields': {
|
|
||||||
const parent = args.parent
|
|
||||||
if (!parent) {
|
|
||||||
throw ApplicationFailure.create({
|
|
||||||
message: 'parent parameter is required',
|
|
||||||
nonRetryable: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Authz check
|
|
||||||
await authzService.hasPermission({
|
|
||||||
user,
|
|
||||||
permission: Permission.Read,
|
|
||||||
type: ResourceType.Asset,
|
|
||||||
id: parent,
|
|
||||||
})
|
|
||||||
|
|
||||||
// Resolve projectId from the parent asset (climb ancestor chain if needed)
|
|
||||||
const projectId = await resolveAssetProjectId(parent)
|
|
||||||
if (!projectId) {
|
|
||||||
throw ApplicationFailure.create({
|
|
||||||
message: `Could not resolve project for parent: ${parent}`,
|
|
||||||
nonRetryable: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const fields = await metadataService.listProjectFields(userId, projectId)
|
|
||||||
const autofillFields = fields
|
|
||||||
.filter((f) => f.field.aiAutofill)
|
|
||||||
.map((f) => ({
|
|
||||||
name: f.field.config?.name,
|
|
||||||
type: f.field.config?.type,
|
|
||||||
description: f.field.description,
|
|
||||||
options: (
|
|
||||||
f.field.config?.select?.options ??
|
|
||||||
f.field.config?.selectMulti?.options ??
|
|
||||||
[]
|
|
||||||
).map((o) => ({ displayName: o.displayName })),
|
|
||||||
}))
|
|
||||||
|
|
||||||
return { fields: autofillFields }
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ApplicationFailure.create({
|
throw ApplicationFailure.create({
|
||||||
message: `Unsupported tool name: ${toolName}`,
|
message: `Unsupported tool name: ${toolName}`,
|
||||||
@@ -1545,21 +1538,6 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveAssetProjectId(assetId: string): Promise<string | null> {
|
|
||||||
let currentId: string | null = assetId
|
|
||||||
while (currentId) {
|
|
||||||
/* prettier-ignore */
|
|
||||||
const assetNode = (await prisma.asset.findUnique({
|
|
||||||
where: { id: currentId },
|
|
||||||
select: { id: true, projectId: true, parentId: true },
|
|
||||||
})) as { id: string; projectId: string | null; parentId: string | null } | null
|
|
||||||
if (!assetNode) break
|
|
||||||
if (assetNode.projectId) return assetNode.projectId
|
|
||||||
currentId = assetNode.parentId
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GenerateSessionNameParams {
|
export interface GenerateSessionNameParams {
|
||||||
teamId: string
|
teamId: string
|
||||||
agentId: string
|
agentId: string
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
|||||||
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
|
import { SandboxManager, type SandboxAskCallback } from '@anthropic-ai/sandbox-runtime'
|
||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { setupTestDbHooks } from '@shumai/db/test'
|
import { setupTestDbHooks } from '@shumai/db/test'
|
||||||
|
import { type TSchema } from 'typebox'
|
||||||
|
import { Value } from 'typebox/value'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as childProcess from 'node:child_process'
|
import * as childProcess from 'node:child_process'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
@@ -89,10 +91,16 @@ describe('Sandbox Network isolation integration', () => {
|
|||||||
setupTestDbHooks()
|
setupTestDbHooks()
|
||||||
|
|
||||||
it('should register callback that pushes blocked hosts to database and propagates to bash tool', async () => {
|
it('should register callback that pushes blocked hosts to database and propagates to bash tool', async () => {
|
||||||
// 1. Create a team
|
// 1. Create a team and enabled sandbox
|
||||||
const team = await prisma.team.create({
|
const team = await prisma.team.create({
|
||||||
data: { name: 'Test Sandbox Team' },
|
data: { name: 'Test Sandbox Team' },
|
||||||
})
|
})
|
||||||
|
await prisma.sandbox.create({
|
||||||
|
data: {
|
||||||
|
teamId: team.id,
|
||||||
|
networkSandboxEnabled: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Ensure agent user and agent exist in database to avoid foreign key violation
|
// Ensure agent user and agent exist in database to avoid foreign key violation
|
||||||
await prisma.user.create({
|
await prisma.user.create({
|
||||||
@@ -198,6 +206,12 @@ describe('Sandbox Network isolation integration', () => {
|
|||||||
const team2 = await prisma.team.create({
|
const team2 = await prisma.team.create({
|
||||||
data: { name: 'Team 2' },
|
data: { name: 'Team 2' },
|
||||||
})
|
})
|
||||||
|
await prisma.sandbox.create({
|
||||||
|
data: { teamId: team1.id, networkSandboxEnabled: true },
|
||||||
|
})
|
||||||
|
await prisma.sandbox.create({
|
||||||
|
data: { teamId: team2.id, networkSandboxEnabled: true },
|
||||||
|
})
|
||||||
|
|
||||||
// Ensure agent user and agents exist in database
|
// Ensure agent user and agents exist in database
|
||||||
await prisma.user.create({
|
await prisma.user.create({
|
||||||
@@ -290,6 +304,64 @@ describe('Sandbox Network isolation integration', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should bypass domain blocking and pending domain recording when networkSandboxEnabled is false', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'Disabled Sandbox Team' },
|
||||||
|
})
|
||||||
|
await prisma.sandbox.create({
|
||||||
|
data: { teamId: team.id, networkSandboxEnabled: false },
|
||||||
|
})
|
||||||
|
|
||||||
|
await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
id: 'agent-disabled',
|
||||||
|
name: 'Ai Agent Disabled',
|
||||||
|
email: 'disabled@shumai.ai',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: 'agent-disabled',
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
config: { provider: 'openai', model: 'gpt-4' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
|
||||||
|
vi.spyOn(SandboxManager, 'wrapWithSandbox').mockImplementation(async (cmd) => cmd)
|
||||||
|
|
||||||
|
await createAgentSession({
|
||||||
|
teamId: team.id,
|
||||||
|
agentId: 'agent-disabled',
|
||||||
|
providerName: 'google',
|
||||||
|
modelId: 'gemini',
|
||||||
|
systemPrompt: 'prompt',
|
||||||
|
teamSkills: [],
|
||||||
|
allowedDomains: ['*'],
|
||||||
|
providers: mockProviders,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(initializeSpy).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
network: expect.objectContaining({
|
||||||
|
allowedDomains: ['*'],
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
expect.any(Function),
|
||||||
|
)
|
||||||
|
|
||||||
|
const callback = initializeSpy.mock.calls[0][1]
|
||||||
|
const res = await callback!({ host: 'any-external-domain.com', port: 443 })
|
||||||
|
expect(res).toBe(true)
|
||||||
|
|
||||||
|
const sandbox = await prisma.sandbox.findUnique({
|
||||||
|
where: { teamId: team.id },
|
||||||
|
})
|
||||||
|
expect(sandbox?.pendingDomains).toEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
it('should pass thinkingLevel to AgentHarness and default to off', async () => {
|
it('should pass thinkingLevel to AgentHarness and default to off', async () => {
|
||||||
const team = await prisma.team.create({
|
const team = await prisma.team.create({
|
||||||
data: { name: 'Test Team' },
|
data: { name: 'Test Team' },
|
||||||
@@ -814,6 +886,149 @@ describe('createAgentSession bash restriction for non-owner users', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('createAgentSession typed metadata schema', () => {
|
||||||
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.restoreAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
async function setupSessionWithProject(opts: { withCreationFields: boolean }) {
|
||||||
|
const team = await prisma.team.create({ data: { name: 'Typed Metadata Team' } })
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'Typed Metadata Project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const user = await prisma.user.create({
|
||||||
|
data: { name: 'Typed Metadata User', email: 'typed-metadata@shumai.ai' },
|
||||||
|
})
|
||||||
|
await prisma.teamMember.create({
|
||||||
|
data: { teamId: team.id, userId: user.id, role: 'owner' },
|
||||||
|
})
|
||||||
|
await prisma.user.create({
|
||||||
|
data: {
|
||||||
|
id: 'typed-metadata-agent',
|
||||||
|
name: 'Ai Agent Typed Metadata',
|
||||||
|
email: 'typed-metadata-agent@shumai.ai',
|
||||||
|
type: 'agent',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.agent.create({
|
||||||
|
data: {
|
||||||
|
id: 'typed-metadata-agent',
|
||||||
|
teamId: team.id,
|
||||||
|
type: 'chat',
|
||||||
|
config: { provider: 'google', model: 'gemini' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (opts.withCreationFields) {
|
||||||
|
await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'prompt',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
projectId: project.id,
|
||||||
|
teamId: team.id,
|
||||||
|
config: { name: 'Prompt', type: 'text', autofillSource: 'CREATION_CONTEXT' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'source',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
projectId: project.id,
|
||||||
|
teamId: team.id,
|
||||||
|
config: {
|
||||||
|
name: 'Source',
|
||||||
|
type: 'select',
|
||||||
|
autofillSource: 'CREATION_CONTEXT',
|
||||||
|
select: {
|
||||||
|
options: [{ id: 'gemini', displayName: 'Gemini', color: '#ffffff' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'manualNotes',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
projectId: project.id,
|
||||||
|
teamId: team.id,
|
||||||
|
config: { name: 'Manual Notes', type: 'text', autofillSource: 'NONE' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const initializeSpy = vi.spyOn(SandboxManager, 'initialize').mockResolvedValue()
|
||||||
|
try {
|
||||||
|
const { harness } = await createAgentSession({
|
||||||
|
teamId: team.id,
|
||||||
|
agentId: 'typed-metadata-agent',
|
||||||
|
providerName: 'google',
|
||||||
|
modelId: 'gemini',
|
||||||
|
systemPrompt: 'prompt',
|
||||||
|
teamSkills: [],
|
||||||
|
allowedDomains: [],
|
||||||
|
providers: mockProviders,
|
||||||
|
userId: user.id,
|
||||||
|
projectId: project.id,
|
||||||
|
})
|
||||||
|
return { harness }
|
||||||
|
} finally {
|
||||||
|
initializeSpy.mockRestore()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should build create_file/create_version with the project CREATION_CONTEXT fields', async () => {
|
||||||
|
const { harness } = await setupSessionWithProject({ withCreationFields: true })
|
||||||
|
const tools = harness.getTools()
|
||||||
|
|
||||||
|
expect(tools.some((t) => t.name === 'list_autofill_fields')).toBe(false)
|
||||||
|
|
||||||
|
const createFile = tools.find((t) => t.name === 'create_file')
|
||||||
|
const createVersion = tools.find((t) => t.name === 'create_version')
|
||||||
|
expect(createFile).toBeDefined()
|
||||||
|
expect(createVersion).toBeDefined()
|
||||||
|
|
||||||
|
const checkFile = (args: Record<string, unknown>) =>
|
||||||
|
Value.Check(createFile!.parameters as unknown as TSchema, {
|
||||||
|
parent: 'f1',
|
||||||
|
path: '/tmp/x.md',
|
||||||
|
data: null,
|
||||||
|
...args,
|
||||||
|
})
|
||||||
|
const checkVersion = (args: Record<string, unknown>) =>
|
||||||
|
Value.Check(createVersion!.parameters as unknown as TSchema, {
|
||||||
|
parent: 'f1',
|
||||||
|
path: '/tmp/x.md',
|
||||||
|
...args,
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const check of [checkFile, checkVersion]) {
|
||||||
|
// Declared CREATION_CONTEXT fields (all-required, nullable) validate; other keys do not
|
||||||
|
expect(check({ metadata: { prompt: 'hello', source: null } })).toBe(true)
|
||||||
|
expect(check({ metadata: { prompt: null, source: 'gemini' } })).toBe(true)
|
||||||
|
expect(check({ metadata: null })).toBe(true)
|
||||||
|
expect(check({ metadata: { prompt: null, source: null, manualNotes: 'no' } })).toBe(false)
|
||||||
|
expect(check({ metadata: { prompt: null, source: null, bogus: 1 } })).toBe(false)
|
||||||
|
expect(check({ metadata: { prompt: 'hello' } })).toBe(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should omit the metadata parameter when the project has no CREATION_CONTEXT fields', async () => {
|
||||||
|
const { harness } = await setupSessionWithProject({ withCreationFields: false })
|
||||||
|
const createFile = harness.getTools().find((t) => t.name === 'create_file')
|
||||||
|
const createVersion = harness.getTools().find((t) => t.name === 'create_version')
|
||||||
|
expect(createFile).toBeDefined()
|
||||||
|
expect(createVersion).toBeDefined()
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
const fileProps = (createFile!.parameters as any).properties
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
const versionProps = (createVersion!.parameters as any).properties
|
||||||
|
expect('metadata' in fileProps).toBe(false)
|
||||||
|
expect('metadata' in versionProps).toBe(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('createAgentSession enabled skill filtering', () => {
|
describe('createAgentSession enabled skill filtering', () => {
|
||||||
setupTestDbHooks()
|
setupTestDbHooks()
|
||||||
|
|
||||||
|
|||||||
+92
-29
@@ -10,14 +10,14 @@ import { createModels, InMemoryCredentialStore } from '@earendil-works/pi-ai'
|
|||||||
import { builtinProviders } from '@earendil-works/pi-ai/providers/all'
|
import { builtinProviders } from '@earendil-works/pi-ai/providers/all'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
import { prisma, type TeamMemberRole } from '@shumai/db'
|
import { prisma, type TeamMemberRole } from '@shumai/db'
|
||||||
import { Type, type TSchema } from '@sinclair/typebox'
|
import { Type, type TSchema } from 'typebox'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { DatabaseSessionStorage } from './database-session-storage'
|
import { DatabaseSessionStorage } from './database-session-storage'
|
||||||
|
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||||
import { createAnalyzeImageTool } from './tools/analyze-image'
|
import { createAnalyzeImageTool } from './tools/analyze-image'
|
||||||
import { createCreateFileTool } from './tools/create-file'
|
import { createCreateFileTool } from './tools/create-file'
|
||||||
import { createListAutofillFieldsTool } from './tools/list-autofill-fields'
|
|
||||||
import { createCreateFolderTool } from './tools/create-folder'
|
import { createCreateFolderTool } from './tools/create-folder'
|
||||||
import { createCreateVersionTool } from './tools/create-version'
|
import { createCreateVersionTool } from './tools/create-version'
|
||||||
import { createDownloadAssetTool } from './tools/download-asset'
|
import { createDownloadAssetTool } from './tools/download-asset'
|
||||||
@@ -102,6 +102,7 @@ export interface CreateAgentSessionParams {
|
|||||||
allowedDomains: string[]
|
allowedDomains: string[]
|
||||||
sessionId?: string
|
sessionId?: string
|
||||||
userId?: string
|
userId?: string
|
||||||
|
projectId?: string
|
||||||
userCommentId?: string | null
|
userCommentId?: string | null
|
||||||
customTools?: AgentTool[]
|
customTools?: AgentTool[]
|
||||||
thinkingLevel?: string
|
thinkingLevel?: string
|
||||||
@@ -150,6 +151,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
allowedDomains,
|
allowedDomains,
|
||||||
sessionId,
|
sessionId,
|
||||||
userId,
|
userId,
|
||||||
|
projectId,
|
||||||
userCommentId: passedUserCommentId,
|
userCommentId: passedUserCommentId,
|
||||||
customTools = [],
|
customTools = [],
|
||||||
thinkingLevel,
|
thinkingLevel,
|
||||||
@@ -188,6 +190,9 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
const sandbox = await prisma.sandbox.findUnique({
|
const sandbox = await prisma.sandbox.findUnique({
|
||||||
where: { teamId },
|
where: { teamId },
|
||||||
})
|
})
|
||||||
|
if (sandbox && !sandbox.networkSandboxEnabled) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
const pendingDomains = sandbox?.pendingDomains || []
|
const pendingDomains = sandbox?.pendingDomains || []
|
||||||
if (!pendingDomains.includes(host)) {
|
if (!pendingDomains.includes(host)) {
|
||||||
await prisma.sandbox.upsert({
|
await prisma.sandbox.upsert({
|
||||||
@@ -324,13 +329,13 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
|||||||
|
|
||||||
const systemTools: AgentTool[] = []
|
const systemTools: AgentTool[] = []
|
||||||
if (userId) {
|
if (userId) {
|
||||||
|
const metadataSchema = await buildProjectMetadataSchema(projectId)
|
||||||
systemTools.push(
|
systemTools.push(
|
||||||
createListAssetsTool(userId),
|
createListAssetsTool(userId),
|
||||||
createCreateFolderTool(userId),
|
createCreateFolderTool(userId),
|
||||||
createCreateFileTool(userId),
|
createCreateFileTool(userId, metadataSchema),
|
||||||
createCreateVersionTool(userId),
|
createCreateVersionTool(userId, metadataSchema),
|
||||||
createDownloadAssetTool(userId),
|
createDownloadAssetTool(userId),
|
||||||
createListAutofillFieldsTool(userId),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,58 +415,116 @@ export interface AutofillField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function fieldsToTypeBoxSchema(fields: AutofillField[]) {
|
export function fieldsToTypeBoxSchema(fields: AutofillField[]) {
|
||||||
|
const newOptionSchema = Type.Object(
|
||||||
|
{
|
||||||
|
newOption: Type.Object(
|
||||||
|
{
|
||||||
|
value: Type.String({
|
||||||
|
minLength: 1,
|
||||||
|
description:
|
||||||
|
'The new option display name/value to create and select if none of the existing options match.',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ additionalProperties: false },
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ additionalProperties: false },
|
||||||
|
)
|
||||||
|
|
||||||
const properties: Record<string, TSchema> = {}
|
const properties: Record<string, TSchema> = {}
|
||||||
for (const f of fields) {
|
for (const f of fields) {
|
||||||
let schema: TSchema
|
let schema: TSchema
|
||||||
const fieldName = f.config.name
|
const fieldName = f.config.name
|
||||||
const fieldDesc = f.description || fieldName
|
const fieldDesc = f.description || fieldName
|
||||||
|
const baseDescription = `The field '${fieldName}' represents ${fieldDesc}.`
|
||||||
switch (f.config.type) {
|
switch (f.config.type) {
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'longText':
|
case 'longText':
|
||||||
schema = Type.String()
|
schema = Type.String({ description: baseDescription })
|
||||||
break
|
break
|
||||||
case 'number':
|
case 'number':
|
||||||
case 'rating':
|
case 'rating':
|
||||||
schema = Type.Number()
|
schema = Type.Number({ description: baseDescription })
|
||||||
break
|
break
|
||||||
case 'toggle':
|
case 'toggle':
|
||||||
schema = Type.Boolean()
|
schema = Type.Boolean({ description: baseDescription })
|
||||||
break
|
break
|
||||||
case 'select': {
|
case 'select': {
|
||||||
const options = f.config.select?.options || []
|
const options = f.config.select?.options || []
|
||||||
schema = Type.String({
|
const description =
|
||||||
enum: options.map((o) => o.id),
|
options.length > 0
|
||||||
})
|
? `${baseDescription}\nSelect one existing option ID or provide {"newOption": {"value": "..."}} to create a new option.\n\nAvailable options:\n${options.map((o) => `- ${o.displayName} => ${o.id}`).join('\n')}`
|
||||||
|
: `${baseDescription}\nProvide {"newOption": {"value": "..."}} with the desired option name.`
|
||||||
if (options.length > 0) {
|
if (options.length > 0) {
|
||||||
const optionLines = options.map((o) => `- ${o.displayName} => ${o.id}`).join('\n')
|
schema = Type.Union(
|
||||||
schema.description = `The field '${fieldName}' represents ${fieldDesc}.\nSelect one option and return the option ID as the value.\n\nAvailable options:\n${optionLines}`
|
[
|
||||||
|
Type.String({
|
||||||
|
enum: options.map((o) => o.id),
|
||||||
|
}),
|
||||||
|
newOptionSchema,
|
||||||
|
],
|
||||||
|
{ description },
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
schema = Type.Object(newOptionSchema.properties, {
|
||||||
|
additionalProperties: false,
|
||||||
|
description,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'selectMulti': {
|
case 'selectMulti': {
|
||||||
const options = f.config.selectMulti?.options || []
|
const options = f.config.selectMulti?.options || []
|
||||||
schema = Type.Array(
|
const description =
|
||||||
Type.String({
|
options.length > 0
|
||||||
enum: options.map((o) => o.id),
|
? `${baseDescription}\nSelect applicable option IDs or provide {"newOption": {"value": "..."}} objects for new options (e.g. ["opt1", {"newOption": {"value": "new_name"}}]).\n\nAvailable options:\n${options.map((o) => `- ${o.displayName} => ${o.id}`).join('\n')}`
|
||||||
}),
|
: `${baseDescription}\nProvide an array of {"newOption": {"value": "..."}} objects for new options.`
|
||||||
)
|
const itemSchema =
|
||||||
if (options.length > 0) {
|
options.length > 0
|
||||||
const optionLines = options.map((o) => `- ${o.displayName} => ${o.id}`).join('\n')
|
? Type.Union([
|
||||||
schema.description = `The field '${fieldName}' represents ${fieldDesc}.\nSelect applicable options and return the option IDs as the value.\n\nAvailable options:\n${optionLines}`
|
Type.String({
|
||||||
}
|
enum: options.map((o) => o.id),
|
||||||
|
}),
|
||||||
|
newOptionSchema,
|
||||||
|
])
|
||||||
|
: newOptionSchema
|
||||||
|
schema = Type.Array(itemSchema, { description })
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
schema = Type.String()
|
schema = Type.String({ description: baseDescription })
|
||||||
}
|
}
|
||||||
|
// Every field is required but nullable: the agent must return each field key,
|
||||||
if (!schema.description) {
|
// using `null` for values it does not know. Nulls are skipped when persisting.
|
||||||
schema.description = `The field '${fieldName}' represents ${fieldDesc}.`
|
// This matches the OpenAI structured-outputs strict-mode convention (all
|
||||||
}
|
// properties required, optionality expressed via `null`).
|
||||||
properties[f.id] = schema
|
properties[f.id] = Type.Union([schema, Type.Null()])
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type.Object(properties)
|
return Type.Object(properties, { additionalProperties: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the strict, all-optional metadata schema for the project's CREATION_CONTEXT
|
||||||
|
* fields (the same field set the agent may attach when creating files/versions).
|
||||||
|
* Returns undefined when no project is known or the project defines no fields, in
|
||||||
|
* which case the `metadata` parameter is omitted from the tools entirely.
|
||||||
|
*/
|
||||||
|
async function buildProjectMetadataSchema(projectId?: string): Promise<TSchema | undefined> {
|
||||||
|
if (!projectId) return undefined
|
||||||
|
const fields = await metadataService.listProjectFields('', projectId)
|
||||||
|
const creationFields: AutofillField[] = []
|
||||||
|
for (const f of fields) {
|
||||||
|
const config = f.field.config
|
||||||
|
if (!config || config.autofillSource !== 'CREATION_CONTEXT') continue
|
||||||
|
creationFields.push({
|
||||||
|
id: f.field.key,
|
||||||
|
config,
|
||||||
|
description: f.field.description,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (creationFields.length === 0) return undefined
|
||||||
|
return fieldsToTypeBoxSchema(creationFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeXml(str: string): string {
|
function escapeXml(str: string): string {
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||||
|
import { validateToolArguments } from '@earendil-works/pi-ai'
|
||||||
|
import { createCreateFileTool } from './tools/create-file'
|
||||||
|
import { fieldsToTypeBoxSchema } from './index'
|
||||||
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
|
import { executeAgentToolWorkflow } from './tools/utils'
|
||||||
|
|
||||||
|
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||||
|
s3Service: {
|
||||||
|
uploadFileToKey: vi.fn(),
|
||||||
|
putObject: vi.fn(),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('./tools/utils', () => ({
|
||||||
|
executeAgentToolWorkflow: vi.fn().mockResolvedValue({ id: 'file-1', name: 'test', type: 'file' }),
|
||||||
|
}))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reproduce: pi-ai <= 0.82.1 runs its lenient coercion on typebox v1 schemas and
|
||||||
|
* converts `null` in a `[string, null]` union into `""` (see
|
||||||
|
* coerceWithUnionSchema in @earendil-works/pi-ai/dist/utils/validation.js).
|
||||||
|
*
|
||||||
|
* When the agent calls create_file with `path: null, data: {...}`, the harness
|
||||||
|
* validates first: the `null` path becomes `""`, so the tool's
|
||||||
|
* assertExactlyOneSource believes BOTH path and data were provided and throws
|
||||||
|
* "Provide exactly one of ..." even though the call is valid.
|
||||||
|
*
|
||||||
|
* Fixed upstream in pi-ai 0.84.0 (#7328): values that already match a union arm
|
||||||
|
* are preserved before coercion. This test should pass once @earendil-works/pi-ai
|
||||||
|
* is upgraded to >= 0.84.0.
|
||||||
|
*/
|
||||||
|
describe('reproduce null coercion in harness tool validation', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.clearAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps path: null when data is provided (no false "exactly one" error)', async () => {
|
||||||
|
const tool = createCreateFileTool('user-1')
|
||||||
|
|
||||||
|
const validated = validateToolArguments(
|
||||||
|
{
|
||||||
|
name: 'create_file',
|
||||||
|
description: '',
|
||||||
|
parameters: tool.parameters,
|
||||||
|
} as Parameters<typeof validateToolArguments>[0],
|
||||||
|
{
|
||||||
|
type: 'toolCall',
|
||||||
|
id: 'call-1',
|
||||||
|
name: 'create_file',
|
||||||
|
arguments: {
|
||||||
|
parent: '01KYKNP52YERGJ6Q4GTPF5FRQF',
|
||||||
|
path: null,
|
||||||
|
data: { name: 'random_text.txt', content: 'hello' },
|
||||||
|
},
|
||||||
|
} as Parameters<typeof validateToolArguments>[1],
|
||||||
|
) as { path?: unknown; data?: unknown }
|
||||||
|
|
||||||
|
// The `null` path must survive validation untouched; coercion to "" makes
|
||||||
|
// the tool think both path and data were provided.
|
||||||
|
expect(validated.path).toBeNull()
|
||||||
|
expect(validated.data).toEqual({ name: 'random_text.txt', content: 'hello' })
|
||||||
|
|
||||||
|
// execute must accept the valid call (data-only) without throwing
|
||||||
|
const result = await tool.execute('call-1', validated as never)
|
||||||
|
expect(result.details).toEqual({ id: 'file-1', name: 'test', type: 'file' })
|
||||||
|
expect(s3Service.putObject).toHaveBeenCalledTimes(1)
|
||||||
|
expect(executeAgentToolWorkflow).toHaveBeenCalledTimes(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps null metadata values (the "unknown" sentinel) through validation', () => {
|
||||||
|
const tool = createCreateFileTool(
|
||||||
|
'user-1',
|
||||||
|
fieldsToTypeBoxSchema([{ id: 'prompt', config: { name: 'Prompt', type: 'text' } }]),
|
||||||
|
)
|
||||||
|
const validated = validateToolArguments(
|
||||||
|
{
|
||||||
|
name: 'create_file',
|
||||||
|
description: '',
|
||||||
|
parameters: tool.parameters,
|
||||||
|
} as Parameters<typeof validateToolArguments>[0],
|
||||||
|
{
|
||||||
|
type: 'toolCall',
|
||||||
|
id: 'call-1',
|
||||||
|
name: 'create_file',
|
||||||
|
arguments: {
|
||||||
|
parent: 'folder-1',
|
||||||
|
path: null,
|
||||||
|
data: { name: 'a.md', content: 'x' },
|
||||||
|
metadata: { prompt: null },
|
||||||
|
},
|
||||||
|
} as Parameters<typeof validateToolArguments>[1],
|
||||||
|
) as { metadata?: Record<string, unknown> }
|
||||||
|
|
||||||
|
expect(validated.metadata).toEqual({ prompt: null })
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,6 +1,22 @@
|
|||||||
import { describe, it, expect } from 'vitest'
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { type TSchema } from 'typebox'
|
||||||
|
import { Value } from 'typebox/value'
|
||||||
import { fieldsToTypeBoxSchema, type AutofillField } from './index'
|
import { fieldsToTypeBoxSchema, type AutofillField } from './index'
|
||||||
|
|
||||||
|
interface AnyOfFieldSchema {
|
||||||
|
type?: string
|
||||||
|
enum?: string[]
|
||||||
|
const?: string
|
||||||
|
description?: string
|
||||||
|
items?: { enum?: string[]; type?: string }
|
||||||
|
anyOf?: AnyOfFieldSchema[]
|
||||||
|
}
|
||||||
|
|
||||||
|
function propsOf(schema: TSchema): Record<string, { anyOf?: AnyOfFieldSchema[] }> {
|
||||||
|
return (schema as unknown as { properties: Record<string, { anyOf?: AnyOfFieldSchema[] }> })
|
||||||
|
.properties
|
||||||
|
}
|
||||||
|
|
||||||
describe('fieldsToTypeBoxSchema', () => {
|
describe('fieldsToTypeBoxSchema', () => {
|
||||||
it('converts text fields', () => {
|
it('converts text fields', () => {
|
||||||
const fields: AutofillField[] = [
|
const fields: AutofillField[] = [
|
||||||
@@ -8,10 +24,12 @@ describe('fieldsToTypeBoxSchema', () => {
|
|||||||
{ id: 'f2', config: { name: 'Desc', type: 'longText' } },
|
{ id: 'f2', config: { name: 'Desc', type: 'longText' } },
|
||||||
]
|
]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('string')
|
const props = propsOf(schema)
|
||||||
expect(schema.properties.f1.description).toBe("The field 'Title' represents The title.")
|
expect(props.f1.anyOf![0].type).toBe('string')
|
||||||
expect(schema.properties.f2.type).toBe('string')
|
expect(props.f1.anyOf![1].type).toBe('null')
|
||||||
expect(schema.properties.f2.description).toBe("The field 'Desc' represents Desc.")
|
expect(props.f1.anyOf![0].description).toBe("The field 'Title' represents The title.")
|
||||||
|
expect(props.f2.anyOf![0].type).toBe('string')
|
||||||
|
expect(props.f2.anyOf![0].description).toBe("The field 'Desc' represents Desc.")
|
||||||
})
|
})
|
||||||
|
|
||||||
it('converts numeric fields', () => {
|
it('converts numeric fields', () => {
|
||||||
@@ -20,17 +38,18 @@ describe('fieldsToTypeBoxSchema', () => {
|
|||||||
{ id: 'f2', config: { name: 'Rating', type: 'rating' } },
|
{ id: 'f2', config: { name: 'Rating', type: 'rating' } },
|
||||||
]
|
]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('number')
|
const props = propsOf(schema)
|
||||||
expect(schema.properties.f2.type).toBe('number')
|
expect(props.f1.anyOf![0].type).toBe('number')
|
||||||
|
expect(props.f2.anyOf![0].type).toBe('number')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('converts toggle fields', () => {
|
it('converts toggle fields', () => {
|
||||||
const fields: AutofillField[] = [{ id: 'f1', config: { name: 'Active', type: 'toggle' } }]
|
const fields: AutofillField[] = [{ id: 'f1', config: { name: 'Active', type: 'toggle' } }]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('boolean')
|
expect(propsOf(schema).f1.anyOf![0].type).toBe('boolean')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('converts select fields with enums and option descriptions', () => {
|
it('converts select fields with enums, newOption support and option descriptions', () => {
|
||||||
const fields: AutofillField[] = [
|
const fields: AutofillField[] = [
|
||||||
{
|
{
|
||||||
id: 'f1',
|
id: 'f1',
|
||||||
@@ -48,14 +67,41 @@ describe('fieldsToTypeBoxSchema', () => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('string')
|
const selectSchema = propsOf(schema).f1.anyOf![0]
|
||||||
expect(schema.properties.f1.enum).toEqual(['opt1', 'opt2'])
|
expect(selectSchema.anyOf![0].type).toBe('string')
|
||||||
expect(schema.properties.f1.description).toBe(
|
expect(selectSchema.anyOf![0].enum).toEqual(['opt1', 'opt2'])
|
||||||
"The field 'Species' represents Species of animal.\nSelect one option and return the option ID as the value.\n\nAvailable options:\n- Option 1 => opt1\n- Option 2 => opt2",
|
expect(selectSchema.anyOf![1].type).toBe('object')
|
||||||
|
expect(selectSchema.description).toBe(
|
||||||
|
'The field \'Species\' represents Species of animal.\nSelect one existing option ID or provide {"newOption": {"value": "..."}} to create a new option.\n\nAvailable options:\n- Option 1 => opt1\n- Option 2 => opt2',
|
||||||
)
|
)
|
||||||
|
// Declared option IDs, newOption objects, and null are valid
|
||||||
|
expect(Value.Check(schema, { f1: 'opt1' })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: 'opt2' })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: { newOption: { value: 'kling' } } })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: null })).toBe(true)
|
||||||
|
// Arbitrary strings or invalid objects are rejected
|
||||||
|
expect(Value.Check(schema, { f1: 'not-an-option' })).toBe(false)
|
||||||
|
expect(Value.Check(schema, { f1: { newOption: { foo: 'bar' } } })).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('converts selectMulti fields with array enums and option descriptions', () => {
|
it('converts select fields with empty options to newOption schema only', () => {
|
||||||
|
const fields: AutofillField[] = [
|
||||||
|
{
|
||||||
|
id: 'f1',
|
||||||
|
config: {
|
||||||
|
name: 'Provider',
|
||||||
|
type: 'select',
|
||||||
|
select: { options: [] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
|
expect(Value.Check(schema, { f1: { newOption: { value: 'kling' } } })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: null })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: 'any-string' })).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('converts selectMulti fields with array enums, newOption support and option descriptions', () => {
|
||||||
const fields: AutofillField[] = [
|
const fields: AutofillField[] = [
|
||||||
{
|
{
|
||||||
id: 'f1',
|
id: 'f1',
|
||||||
@@ -72,11 +118,35 @@ describe('fieldsToTypeBoxSchema', () => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('array')
|
const selectMultiSchema = propsOf(schema).f1.anyOf![0]
|
||||||
expect(schema.properties.f1.items.enum).toEqual(['opt1', 'opt2'])
|
expect(selectMultiSchema.type).toBe('array')
|
||||||
expect(schema.properties.f1.description).toBe(
|
expect(selectMultiSchema.description).toBe(
|
||||||
"The field 'Tags' represents Tags.\nSelect applicable options and return the option IDs as the value.\n\nAvailable options:\n- Tag 1 => opt1\n- Tag 2 => opt2",
|
'The field \'Tags\' represents Tags.\nSelect applicable option IDs or provide {"newOption": {"value": "..."}} objects for new options (e.g. ["opt1", {"newOption": {"value": "new_name"}}]).\n\nAvailable options:\n- Tag 1 => opt1\n- Tag 2 => opt2',
|
||||||
)
|
)
|
||||||
|
expect(Value.Check(schema, { f1: ['opt1', 'opt2'] })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: [{ newOption: { value: 'Tag 3' } }] })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: ['opt1', { newOption: { value: 'Tag 3' } }] })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: null })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: ['opt1', 'bad'] })).toBe(false)
|
||||||
|
expect(Value.Check(schema, { f1: ['opt1', { newOption: { bad: 'value' } }] })).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('converts selectMulti fields with empty options to array of newOption schema', () => {
|
||||||
|
const fields: AutofillField[] = [
|
||||||
|
{
|
||||||
|
id: 'f1',
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
selectMulti: { options: [] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
|
expect(Value.Check(schema, { f1: [{ newOption: { value: 'Tag 1' } }] })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: [] })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: null })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: ['tag1'] })).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('defaults to string for unknown types', () => {
|
it('defaults to string for unknown types', () => {
|
||||||
@@ -85,6 +155,22 @@ describe('fieldsToTypeBoxSchema', () => {
|
|||||||
{ id: 'f1', config: { name: 'Unknown', type: 'invalid' } },
|
{ id: 'f1', config: { name: 'Unknown', type: 'invalid' } },
|
||||||
]
|
]
|
||||||
const schema = fieldsToTypeBoxSchema(fields)
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
expect(schema.properties.f1.type).toBe('string')
|
expect(propsOf(schema).f1.anyOf![0].type).toBe('string')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('marks every property required (nullable) and rejects unknown keys', () => {
|
||||||
|
const fields: AutofillField[] = [
|
||||||
|
{ id: 'f1', config: { name: 'Title', type: 'text' } },
|
||||||
|
{ id: 'f2', config: { name: 'Rating', type: 'rating' } },
|
||||||
|
]
|
||||||
|
const schema = fieldsToTypeBoxSchema(fields)
|
||||||
|
const props = propsOf(schema)
|
||||||
|
// typebox v1 objects are strict by default: unknown keys are rejected
|
||||||
|
expect(props.f1.anyOf![0].type).toBe('string')
|
||||||
|
expect(props.f1.anyOf![1].type).toBe('null')
|
||||||
|
expect(Value.Check(schema, { f1: 'x', f2: null })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: null, f2: 3 })).toBe(true)
|
||||||
|
expect(Value.Check(schema, { f1: 'x' })).toBe(false)
|
||||||
|
expect(Value.Check(schema, { f1: 'x', f2: null, extra: 1 })).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||||
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||||
import { createCreateFileTool } from './create-file'
|
import { createCreateFileTool } from './create-file'
|
||||||
|
import { fieldsToTypeBoxSchema } from '../index'
|
||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
|
import { Value } from 'typebox/value'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
@@ -44,7 +46,7 @@ describe('createCreateFileTool', () => {
|
|||||||
const filePath = createTempFile('# Hello from disk', 'create-file-test.md')
|
const filePath = createTempFile('# Hello from disk', 'create-file-test.md')
|
||||||
|
|
||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
const result = await tool.execute('call-1', { parent: 'folder-1', path: filePath })
|
const result = await tool.execute('call-1', { parent: 'folder-1', path: filePath, data: null })
|
||||||
|
|
||||||
expect(s3Service.uploadFileToKey).toHaveBeenCalledTimes(1)
|
expect(s3Service.uploadFileToKey).toHaveBeenCalledTimes(1)
|
||||||
expect(s3Service.putObject).not.toHaveBeenCalled()
|
expect(s3Service.putObject).not.toHaveBeenCalled()
|
||||||
@@ -70,37 +72,93 @@ describe('createCreateFileTool', () => {
|
|||||||
expect(result.details).toEqual({ id: 'file-1', name: 'test', type: 'file' })
|
expect(result.details).toEqual({ id: 'file-1', name: 'test', type: 'file' })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should forward the optional context to the agent tool workflow when provided', async () => {
|
it('should forward the metadata to the agent tool workflow when provided', async () => {
|
||||||
const filePath = createTempFile('# Hello from disk', 'create-file-context.md')
|
const filePath = createTempFile('# Hello from disk', 'create-file-metadata.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
])
|
||||||
|
|
||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1', metadataSchema)
|
||||||
await tool.execute('call-1', {
|
await tool.execute('call-1', {
|
||||||
parent: 'folder-1',
|
parent: 'folder-1',
|
||||||
path: filePath,
|
path: filePath,
|
||||||
context: 'Generated using gemini',
|
data: null,
|
||||||
|
metadata: { prompt: 'Generated using gemini' },
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
args: expect.objectContaining({ context: 'Generated using gemini' }),
|
args: expect.objectContaining({ metadata: { prompt: 'Generated using gemini' } }),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not include context in args when not provided', async () => {
|
it('should forward select and selectMulti newOption metadata', async () => {
|
||||||
const filePath = createTempFile('# Hello from disk', 'create-file-no-context.md')
|
const filePath = createTempFile('# Hello from disk', 'create-file-new-option.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{
|
||||||
|
id: 'provider',
|
||||||
|
config: {
|
||||||
|
name: 'Provider',
|
||||||
|
type: 'select',
|
||||||
|
select: { options: [{ id: 'openai', displayName: 'OpenAI', color: '#f43f5e' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'tags',
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
selectMulti: { options: [{ id: 'tag1', displayName: 'Tag 1', color: '#3b82f6' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1', metadataSchema)
|
||||||
await tool.execute('call-1', { parent: 'folder-1', path: filePath })
|
await tool.execute('call-1', {
|
||||||
|
parent: 'folder-1',
|
||||||
|
path: filePath,
|
||||||
|
data: null,
|
||||||
|
metadata: {
|
||||||
|
provider: { newOption: { value: 'Kling' } },
|
||||||
|
tags: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
args: expect.objectContaining({
|
||||||
|
metadata: {
|
||||||
|
provider: { newOption: { value: 'Kling' } },
|
||||||
|
tags: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not include metadata in args when metadata is null', async () => {
|
||||||
|
const filePath = createTempFile('# Hello from disk', 'create-file-no-metadata.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const tool = createCreateFileTool('user-1', metadataSchema)
|
||||||
|
await tool.execute('call-1', {
|
||||||
|
parent: 'folder-1',
|
||||||
|
path: filePath,
|
||||||
|
data: null,
|
||||||
|
metadata: null,
|
||||||
|
})
|
||||||
|
|
||||||
const callArgs = vi.mocked(executeAgentToolWorkflow).mock.calls[0][0].args
|
const callArgs = vi.mocked(executeAgentToolWorkflow).mock.calls[0][0].args
|
||||||
expect(callArgs).not.toHaveProperty('context')
|
expect(callArgs).not.toHaveProperty('metadata')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw when the local file does not exist', async () => {
|
it('should throw when the local file does not exist', async () => {
|
||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
await expect(
|
await expect(
|
||||||
tool.execute('call-1', { parent: 'folder-1', path: '/nonexistent/file.md' }),
|
tool.execute('call-1', { parent: 'folder-1', path: '/nonexistent/file.md', data: null }),
|
||||||
).rejects.toThrow('Local file not found at path: /nonexistent/file.md')
|
).rejects.toThrow('Local file not found at path: /nonexistent/file.md')
|
||||||
expect(s3Service.uploadFileToKey).not.toHaveBeenCalled()
|
expect(s3Service.uploadFileToKey).not.toHaveBeenCalled()
|
||||||
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
||||||
@@ -110,6 +168,7 @@ describe('createCreateFileTool', () => {
|
|||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
const result = await tool.execute('call-1', {
|
const result = await tool.execute('call-1', {
|
||||||
parent: 'folder-1',
|
parent: 'folder-1',
|
||||||
|
path: null,
|
||||||
data: { name: 'notes.md', content: '# Notes\n\nHello' },
|
data: { name: 'notes.md', content: '# Notes\n\nHello' },
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -145,6 +204,7 @@ describe('createCreateFileTool', () => {
|
|||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
await tool.execute('call-1', {
|
await tool.execute('call-1', {
|
||||||
parent: 'folder-1',
|
parent: 'folder-1',
|
||||||
|
path: null,
|
||||||
data: { name: 'script.ts', content: 'const x = 1' },
|
data: { name: 'script.ts', content: 'const x = 1' },
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -162,6 +222,7 @@ describe('createCreateFileTool', () => {
|
|||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
await tool.execute('call-1', {
|
await tool.execute('call-1', {
|
||||||
parent: 'folder-1',
|
parent: 'folder-1',
|
||||||
|
path: null,
|
||||||
data: { name: 'my/notes.md', content: 'hello' },
|
data: { name: 'my/notes.md', content: 'hello' },
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -183,9 +244,9 @@ describe('createCreateFileTool', () => {
|
|||||||
|
|
||||||
it('should throw when neither "path" nor "data" is provided', async () => {
|
it('should throw when neither "path" nor "data" is provided', async () => {
|
||||||
const tool = createCreateFileTool('user-1')
|
const tool = createCreateFileTool('user-1')
|
||||||
await expect(tool.execute('call-1', { parent: 'folder-1' })).rejects.toThrow(
|
await expect(
|
||||||
'Provide exactly one of "path" (a local file) or "data" (name and content).',
|
tool.execute('call-1', { parent: 'folder-1', path: null, data: null }),
|
||||||
)
|
).rejects.toThrow('Provide exactly one of "path" (a local file) or "data" (name and content).')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw when both "path" and "data" are provided', async () => {
|
it('should throw when both "path" and "data" are provided', async () => {
|
||||||
@@ -201,4 +262,58 @@ describe('createCreateFileTool', () => {
|
|||||||
expect(s3Service.putObject).not.toHaveBeenCalled()
|
expect(s3Service.putObject).not.toHaveBeenCalled()
|
||||||
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should expose a strict, all-required (nullable) metadata schema when fields are provided', () => {
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
{
|
||||||
|
id: 'source',
|
||||||
|
config: {
|
||||||
|
name: 'Source',
|
||||||
|
type: 'select',
|
||||||
|
select: { options: [{ id: 'gemini', displayName: 'Gemini', color: '#ffffff' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ id: 'rating', config: { name: 'Rating', type: 'rating' } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const tool = createCreateFileTool('user-1', metadataSchema)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
const meta = (tool.parameters as any).properties.metadata
|
||||||
|
// `metadata` is a nullable union: [strict object, null]
|
||||||
|
const metaObject = meta.anyOf[0]
|
||||||
|
|
||||||
|
expect(meta).toBeDefined()
|
||||||
|
expect(metaObject.required).toEqual(['prompt', 'source', 'rating'])
|
||||||
|
expect(metaObject.additionalProperties).toBe(false)
|
||||||
|
expect(metaObject.properties.prompt.anyOf[0].type).toBe('string')
|
||||||
|
expect(metaObject.properties.prompt.anyOf[1].type).toBe('null')
|
||||||
|
expect(metaObject.properties.source.anyOf[0].anyOf[0].enum).toEqual(['gemini'])
|
||||||
|
expect(metaObject.properties.rating.anyOf[0].type).toBe('number')
|
||||||
|
|
||||||
|
// Every field must be present (use null when unknown); unknown keys and bad enums are rejected
|
||||||
|
expect(Value.Check(meta, { prompt: 'hello', source: 'gemini', rating: 5 })).toBe(true)
|
||||||
|
expect(
|
||||||
|
Value.Check(meta, {
|
||||||
|
prompt: 'hello',
|
||||||
|
source: { newOption: { value: 'kling' } },
|
||||||
|
rating: 5,
|
||||||
|
}),
|
||||||
|
).toBe(true)
|
||||||
|
expect(Value.Check(meta, { prompt: null, source: null, rating: null })).toBe(true)
|
||||||
|
expect(Value.Check(meta, { prompt: 'hello', source: null, rating: null })).toBe(true)
|
||||||
|
expect(Value.Check(meta, { prompt: 'hello' })).toBe(false)
|
||||||
|
expect(
|
||||||
|
Value.Check(meta, { prompt: 'hello', source: 'gemini', rating: 5, unknownKey: 'x' }),
|
||||||
|
).toBe(false)
|
||||||
|
expect(Value.Check(meta, { prompt: 'hello', source: 'not-an-option', rating: null })).toBe(
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should omit the metadata parameter when no schema is provided', () => {
|
||||||
|
const tool = createCreateFileTool('user-1')
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
expect((tool.parameters as any).properties.metadata).toBeUndefined()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,69 +2,78 @@ import { type AgentTool } from '@earendil-works/pi-agent-core'
|
|||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { getFileMimeType, readFileMimeType } from '@shumai/core/src/utils/file-mime'
|
import { getFileMimeType, readFileMimeType } from '@shumai/core/src/utils/file-mime'
|
||||||
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
||||||
import { Type } from '@sinclair/typebox'
|
import { Type, type TSchema } from 'typebox'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { ulid } from 'ulid'
|
import { ulid } from 'ulid'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
|
|
||||||
const createFileSchema = Type.Object({
|
interface CreateFileToolParams {
|
||||||
parent: Type.String({
|
parent: string
|
||||||
description: 'The parent folder ID under which to create the file. This parameter is required.',
|
path: string | null
|
||||||
}),
|
data: { name: string; content: string } | null
|
||||||
path: Type.Optional(
|
metadata?: Record<string, unknown> | null
|
||||||
Type.String({
|
}
|
||||||
description:
|
|
||||||
'The absolute or relative local path to an existing file on disk. Provide either this or "data", but not both.',
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
data: Type.Optional(
|
|
||||||
Type.Object({
|
|
||||||
name: Type.String({
|
|
||||||
minLength: 1,
|
|
||||||
description:
|
|
||||||
'The desired name for the new file, including its extension (e.g. "notes.md").',
|
|
||||||
}),
|
|
||||||
content: Type.String({
|
|
||||||
description: 'The full content of the file as a plain string.',
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
context: Type.Optional(
|
|
||||||
Type.String({
|
|
||||||
description:
|
|
||||||
'Optional context passed to the AI metadata autofill workflow for fields that cannot be inferred from file content alone ' +
|
|
||||||
'(e.g. the model or prompt used to generate the asset). ' +
|
|
||||||
'Use list_autofill_fields first to check which fields can be autofilled. ' +
|
|
||||||
'Keep the context short and only include information relevant to those fields.',
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
|
|
||||||
function assertExactlyOneSource(params: {
|
function assertExactlyOneSource(params: CreateFileToolParams) {
|
||||||
path?: string
|
const hasPath = params.path !== null
|
||||||
data?: { name: string; content: string }
|
const hasData = params.data !== null
|
||||||
}) {
|
|
||||||
const hasPath = params.path !== undefined
|
|
||||||
const hasData = params.data !== undefined
|
|
||||||
if (hasPath === hasData) {
|
if (hasPath === hasData) {
|
||||||
throw new Error('Provide exactly one of "path" (a local file) or "data" (name and content).')
|
throw new Error('Provide exactly one of "path" (a local file) or "data" (name and content).')
|
||||||
}
|
}
|
||||||
return hasPath ? params.path! : params.data!
|
return hasPath ? params.path! : params.data!
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createCreateFileTool(userId: string): AgentTool<typeof createFileSchema> {
|
export function createCreateFileTool(userId: string, metadataSchema?: TSchema): AgentTool {
|
||||||
return {
|
const createFileSchema = Type.Object(
|
||||||
|
{
|
||||||
|
parent: Type.String({
|
||||||
|
description:
|
||||||
|
'The parent folder ID under which to create the file. This parameter is required.',
|
||||||
|
}),
|
||||||
|
path: Type.Union([
|
||||||
|
Type.String({
|
||||||
|
description:
|
||||||
|
'The absolute or relative local path to an existing file on disk. Provide a value here OR in "data", but not both. Use null if you are providing "data".',
|
||||||
|
}),
|
||||||
|
Type.Null(),
|
||||||
|
]),
|
||||||
|
data: Type.Union([
|
||||||
|
Type.Object(
|
||||||
|
{
|
||||||
|
name: Type.String({
|
||||||
|
minLength: 1,
|
||||||
|
description:
|
||||||
|
'The desired name for the new file, including its extension (e.g. "notes.md").',
|
||||||
|
}),
|
||||||
|
content: Type.String({
|
||||||
|
description: 'The full content of the file as a plain string.',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ additionalProperties: false },
|
||||||
|
),
|
||||||
|
Type.Null(),
|
||||||
|
]),
|
||||||
|
...(metadataSchema ? { metadata: Type.Union([metadataSchema, Type.Null()]) } : {}),
|
||||||
|
},
|
||||||
|
{ additionalProperties: false },
|
||||||
|
)
|
||||||
|
|
||||||
|
const tool: AgentTool = {
|
||||||
name: 'create_file',
|
name: 'create_file',
|
||||||
label: 'Create File',
|
label: 'Create File',
|
||||||
description:
|
description:
|
||||||
'Create a new file under a folder. You MUST choose exactly ONE creation method: ' +
|
'Create a new file under a folder. You MUST choose exactly ONE creation method: ' +
|
||||||
'(1) provide "path" to upload an existing local file, OR ' +
|
'(1) provide "path" to upload an existing local file, OR ' +
|
||||||
'(2) provide "data" with name and content to create a new text file. ' +
|
'(2) provide "data" with name and content to create a new text file. ' +
|
||||||
'Never provide both "path" and "data" together. Never omit both.',
|
'Set the unused parameter to null. ' +
|
||||||
|
'The optional "metadata" parameter accepts only the CREATION_CONTEXT fields declared in its schema; never invent field keys, and use null for fields you do not know.',
|
||||||
parameters: createFileSchema,
|
parameters: createFileSchema,
|
||||||
execute: async (_toolCallId, params) => {
|
execute: async (_toolCallId, params) => {
|
||||||
const source = assertExactlyOneSource(params)
|
// The harness validates tool args against `createFileSchema` before calling
|
||||||
|
// execute, so `params` is guaranteed to match this shape.
|
||||||
|
const p = params as CreateFileToolParams
|
||||||
|
const source = assertExactlyOneSource(p)
|
||||||
|
|
||||||
let name: string
|
let name: string
|
||||||
let size: number
|
let size: number
|
||||||
@@ -99,15 +108,15 @@ export function createCreateFileTool(userId: string): AgentTool<typeof createFil
|
|||||||
const result = await executeAgentToolWorkflow({
|
const result = await executeAgentToolWorkflow({
|
||||||
toolName: 'create_file',
|
toolName: 'create_file',
|
||||||
args: {
|
args: {
|
||||||
parent: params.parent,
|
parent: p.parent,
|
||||||
s3Key,
|
s3Key,
|
||||||
name,
|
name,
|
||||||
size,
|
size,
|
||||||
contentType: mimeType,
|
contentType: mimeType,
|
||||||
...(params.context ? { context: params.context } : {}),
|
...(p.metadata ? { metadata: p.metadata } : {}),
|
||||||
},
|
},
|
||||||
userId,
|
userId,
|
||||||
assetId: params.parent,
|
assetId: p.parent,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
||||||
@@ -115,4 +124,5 @@ export function createCreateFileTool(userId: string): AgentTool<typeof createFil
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
return tool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||||
import { createCreateVersionTool } from './create-version'
|
import { createCreateVersionTool } from './create-version'
|
||||||
|
import { fieldsToTypeBoxSchema } from '../index'
|
||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
|
import { Value } from 'typebox/value'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
@@ -67,31 +69,80 @@ describe('createCreateVersionTool', () => {
|
|||||||
expect(result.details).toEqual({ id: 'file-1', name: 'v2', type: 'file' })
|
expect(result.details).toEqual({ id: 'file-1', name: 'v2', type: 'file' })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should forward the optional context to the agent tool workflow when provided', async () => {
|
it('should forward the metadata to the agent tool workflow when provided', async () => {
|
||||||
const filePath = createTempFile('# Hello from disk', 'create-version-context.md')
|
const filePath = createTempFile('# Hello from disk', 'create-version-metadata.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
])
|
||||||
|
|
||||||
const tool = createCreateVersionTool('user-1')
|
const tool = createCreateVersionTool('user-1', metadataSchema)
|
||||||
await tool.execute('call-1', {
|
await tool.execute('call-1', {
|
||||||
parent: 'file-1',
|
parent: 'file-1',
|
||||||
path: filePath,
|
path: filePath,
|
||||||
context: 'Generated using gemini',
|
metadata: { prompt: 'Generated using gemini' },
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
args: expect.objectContaining({ context: 'Generated using gemini' }),
|
args: expect.objectContaining({ metadata: { prompt: 'Generated using gemini' } }),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not include context in args when not provided', async () => {
|
it('should forward select and selectMulti newOption metadata', async () => {
|
||||||
const filePath = createTempFile('# Hello from disk', 'create-version-no-context.md')
|
const filePath = createTempFile('# Hello from disk', 'create-version-new-option.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{
|
||||||
|
id: 'provider',
|
||||||
|
config: {
|
||||||
|
name: 'Provider',
|
||||||
|
type: 'select',
|
||||||
|
select: { options: [{ id: 'openai', displayName: 'OpenAI', color: '#f43f5e' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'tags',
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
selectMulti: { options: [{ id: 'tag1', displayName: 'Tag 1', color: '#3b82f6' }] },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
const tool = createCreateVersionTool('user-1')
|
const tool = createCreateVersionTool('user-1', metadataSchema)
|
||||||
await tool.execute('call-1', { parent: 'file-1', path: filePath })
|
await tool.execute('call-1', {
|
||||||
|
parent: 'file-1',
|
||||||
|
path: filePath,
|
||||||
|
metadata: {
|
||||||
|
provider: { newOption: { value: 'Kling' } },
|
||||||
|
tags: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(executeAgentToolWorkflow).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
args: expect.objectContaining({
|
||||||
|
metadata: {
|
||||||
|
provider: { newOption: { value: 'Kling' } },
|
||||||
|
tags: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not include metadata in args when metadata is null', async () => {
|
||||||
|
const filePath = createTempFile('# Hello from disk', 'create-version-no-metadata.md')
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const tool = createCreateVersionTool('user-1', metadataSchema)
|
||||||
|
await tool.execute('call-1', { parent: 'file-1', path: filePath, metadata: null })
|
||||||
|
|
||||||
const callArgs = vi.mocked(executeAgentToolWorkflow).mock.calls[0][0].args
|
const callArgs = vi.mocked(executeAgentToolWorkflow).mock.calls[0][0].args
|
||||||
expect(callArgs).not.toHaveProperty('context')
|
expect(callArgs).not.toHaveProperty('metadata')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw when the local file does not exist', async () => {
|
it('should throw when the local file does not exist', async () => {
|
||||||
@@ -102,4 +153,34 @@ describe('createCreateVersionTool', () => {
|
|||||||
expect(s3Service.uploadFileToKey).not.toHaveBeenCalled()
|
expect(s3Service.uploadFileToKey).not.toHaveBeenCalled()
|
||||||
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
expect(executeAgentToolWorkflow).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should expose a strict, all-required (nullable) metadata schema when fields are provided', () => {
|
||||||
|
const metadataSchema = fieldsToTypeBoxSchema([
|
||||||
|
{ id: 'prompt', config: { name: 'Prompt', type: 'text' } },
|
||||||
|
{ id: 'toggle', config: { name: 'Active', type: 'toggle' } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const tool = createCreateVersionTool('user-1', metadataSchema)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
const meta = (tool.parameters as any).properties.metadata
|
||||||
|
// `metadata` is a nullable union: [strict object, null]
|
||||||
|
const metaObject = meta.anyOf[0]
|
||||||
|
|
||||||
|
expect(meta).toBeDefined()
|
||||||
|
expect(metaObject.required).toEqual(['prompt', 'toggle'])
|
||||||
|
expect(metaObject.additionalProperties).toBe(false)
|
||||||
|
expect(metaObject.properties.prompt.anyOf[0].type).toBe('string')
|
||||||
|
expect(metaObject.properties.prompt.anyOf[1].type).toBe('null')
|
||||||
|
expect(metaObject.properties.toggle.anyOf[0].type).toBe('boolean')
|
||||||
|
|
||||||
|
expect(Value.Check(meta, { prompt: 'p', toggle: true })).toBe(true)
|
||||||
|
expect(Value.Check(meta, { prompt: null, toggle: null })).toBe(true)
|
||||||
|
expect(Value.Check(meta, { prompt: 'p', toggle: null, unknownKey: 'x' })).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should omit the metadata parameter when no schema is provided', () => {
|
||||||
|
const tool = createCreateVersionTool('user-1')
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- inspecting the runtime schema shape of the dynamically-built tool
|
||||||
|
expect((tool.parameters as any).properties.metadata).toBeUndefined()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type, type TSchema } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
@@ -8,36 +8,42 @@ import { readFileMimeType } from '@shumai/core/src/utils/file-mime'
|
|||||||
import { ulid } from 'ulid'
|
import { ulid } from 'ulid'
|
||||||
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
||||||
|
|
||||||
const createVersionSchema = Type.Object({
|
interface CreateVersionToolParams {
|
||||||
parent: Type.String({
|
parent: string
|
||||||
description:
|
path: string
|
||||||
'The parent file ID for which to create a new version. This parameter is required.',
|
metadata?: Record<string, unknown> | null
|
||||||
}),
|
}
|
||||||
path: Type.String({
|
|
||||||
description:
|
|
||||||
'The absolute or relative local path to the file on disk. This parameter is required.',
|
|
||||||
}),
|
|
||||||
context: Type.Optional(
|
|
||||||
Type.String({
|
|
||||||
description:
|
|
||||||
'Optional context passed to the AI metadata autofill workflow for fields that cannot be inferred from file content alone ' +
|
|
||||||
'(e.g. the model or prompt used to generate the asset). ' +
|
|
||||||
'Use list_autofill_fields first to check which fields can be autofilled. ' +
|
|
||||||
'Keep the context short and only include information relevant to those fields.',
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
|
|
||||||
export function createCreateVersionTool(userId: string): AgentTool<typeof createVersionSchema> {
|
export function createCreateVersionTool(userId: string, metadataSchema?: TSchema): AgentTool {
|
||||||
return {
|
const createVersionSchema = Type.Object(
|
||||||
|
{
|
||||||
|
parent: Type.String({
|
||||||
|
description:
|
||||||
|
'The parent file ID for which to create a new version. This parameter is required.',
|
||||||
|
}),
|
||||||
|
path: Type.String({
|
||||||
|
description:
|
||||||
|
'The absolute or relative local path to the file on disk. This parameter is required.',
|
||||||
|
}),
|
||||||
|
...(metadataSchema ? { metadata: Type.Union([metadataSchema, Type.Null()]) } : {}),
|
||||||
|
},
|
||||||
|
{ additionalProperties: false },
|
||||||
|
)
|
||||||
|
|
||||||
|
const tool: AgentTool = {
|
||||||
name: 'create_version',
|
name: 'create_version',
|
||||||
label: 'Create Version',
|
label: 'Create Version',
|
||||||
description: 'Create a new version of an existing file from a local file path.',
|
description:
|
||||||
|
'Create a new version of an existing file from a local file path. ' +
|
||||||
|
'The optional "metadata" parameter accepts only the CREATION_CONTEXT fields declared in its schema; never invent field keys, and use null for fields you do not know.',
|
||||||
parameters: createVersionSchema,
|
parameters: createVersionSchema,
|
||||||
execute: async (_toolCallId, params) => {
|
execute: async (_toolCallId, params) => {
|
||||||
const absolutePath = path.resolve(process.cwd(), params.path)
|
// The harness validates tool args against `createVersionSchema` before calling
|
||||||
|
// execute, so `params` is guaranteed to match this shape.
|
||||||
|
const p = params as CreateVersionToolParams
|
||||||
|
const absolutePath = path.resolve(process.cwd(), p.path)
|
||||||
if (!fs.existsSync(absolutePath)) {
|
if (!fs.existsSync(absolutePath)) {
|
||||||
throw new Error(`Local file not found at path: ${params.path}`)
|
throw new Error(`Local file not found at path: ${p.path}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileSize = fs.statSync(absolutePath).size
|
const fileSize = fs.statSync(absolutePath).size
|
||||||
@@ -50,15 +56,15 @@ export function createCreateVersionTool(userId: string): AgentTool<typeof create
|
|||||||
const result = await executeAgentToolWorkflow({
|
const result = await executeAgentToolWorkflow({
|
||||||
toolName: 'create_version',
|
toolName: 'create_version',
|
||||||
args: {
|
args: {
|
||||||
parent: params.parent,
|
parent: p.parent,
|
||||||
s3Key,
|
s3Key,
|
||||||
name: path.basename(absolutePath),
|
name: path.basename(absolutePath),
|
||||||
size: fileSize,
|
size: fileSize,
|
||||||
contentType: mimeType,
|
contentType: mimeType,
|
||||||
...(params.context ? { context: params.context } : {}),
|
...(p.metadata ? { metadata: p.metadata } : {}),
|
||||||
},
|
},
|
||||||
userId,
|
userId,
|
||||||
assetId: params.parent,
|
assetId: p.parent,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
||||||
@@ -66,4 +72,5 @@ export function createCreateVersionTool(userId: string): AgentTool<typeof create
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
return tool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { prisma, type User } from '@shumai/db'
|
import { prisma, type User } from '@shumai/db'
|
||||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
import { executeAgentToolWorkflow } from './utils'
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
||||||
import { createListAutofillFieldsTool } from './list-autofill-fields'
|
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
|
||||||
|
|
||||||
vi.mock('./utils', () => ({
|
|
||||||
executeAgentToolWorkflow: vi.fn().mockResolvedValue({
|
|
||||||
fields: [{ name: 'Source', type: 'select', options: [{ displayName: 'Gemini' }] }],
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
describe('createListAutofillFieldsTool', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
vi.clearAllMocks()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should list autofill fields for the parent folder via the agent tool workflow', async () => {
|
|
||||||
const tool = createListAutofillFieldsTool('user-1')
|
|
||||||
const result = await tool.execute('call-1', { parent: 'folder-1' })
|
|
||||||
|
|
||||||
expect(executeAgentToolWorkflow).toHaveBeenCalledWith({
|
|
||||||
toolName: 'list_autofill_fields',
|
|
||||||
args: { parent: 'folder-1' },
|
|
||||||
userId: 'user-1',
|
|
||||||
assetId: 'folder-1',
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.details).toEqual({
|
|
||||||
fields: [{ name: 'Source', type: 'select', options: [{ displayName: 'Gemini' }] }],
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
|
||||||
import { executeAgentToolWorkflow } from './utils'
|
|
||||||
|
|
||||||
const listAutofillFieldsSchema = Type.Object({
|
|
||||||
parent: Type.String({
|
|
||||||
description:
|
|
||||||
'The parent folder ID whose project autofillable metadata fields to list. This parameter is required.',
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
export function createListAutofillFieldsTool(
|
|
||||||
userId: string,
|
|
||||||
): AgentTool<typeof listAutofillFieldsSchema> {
|
|
||||||
return {
|
|
||||||
name: 'list_autofill_fields',
|
|
||||||
label: 'List Autofill Fields',
|
|
||||||
description:
|
|
||||||
'List the AI-autofillable metadata fields defined for the project of a parent folder, including their types and available options. ' +
|
|
||||||
'Use this before creating a file or version so you can pass relevant context (e.g. the model or prompt used to generate the asset) to create_file/create_version.',
|
|
||||||
parameters: listAutofillFieldsSchema,
|
|
||||||
execute: async (_toolCallId, params) => {
|
|
||||||
const result = await executeAgentToolWorkflow({
|
|
||||||
toolName: 'list_autofill_fields',
|
|
||||||
args: params,
|
|
||||||
userId,
|
|
||||||
assetId: params.parent,
|
|
||||||
})
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
||||||
details: result,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||||
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { agentService } from '@shumai/core/src/agent/agent'
|
import { agentService } from '@shumai/core/src/agent/agent'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { prisma } from '@shumai/db'
|
import { prisma } from '@shumai/db'
|
||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
|
|
||||||
const readThreadSchema = Type.Object({
|
const readThreadSchema = Type.Object({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { logger } from '@shumai/core/src/logger'
|
import { logger } from '@shumai/core/src/logger'
|
||||||
import { SandboxManager } from '@anthropic-ai/sandbox-runtime'
|
import { SandboxManager } from '@anthropic-ai/sandbox-runtime'
|
||||||
import { type AgentTool, type AgentToolResult } from '@earendil-works/pi-agent-core'
|
import { type AgentTool, type AgentToolResult } from '@earendil-works/pi-agent-core'
|
||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { spawn } from 'node:child_process'
|
import { spawn } from 'node:child_process'
|
||||||
import { OutputAccumulator } from '../utils/output-accumulator'
|
import { OutputAccumulator } from '../utils/output-accumulator'
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Type } from '@sinclair/typebox'
|
import { Type } from 'typebox'
|
||||||
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
import { type AgentTool } from '@earendil-works/pi-agent-core'
|
||||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||||
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
import { prisma, WorkflowTaskType, WorkflowTaskStatus, type User } from '@shumai/db'
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
{ key: 'title', config: { name: 'Title', type: 'text' }, description: 'The title' },
|
{ key: 'title', config: { name: 'Title', type: 'text' }, description: 'The title' },
|
||||||
])
|
])
|
||||||
mockActivities.getAgentAutofillContextActivity.mockResolvedValue({ agent: { id: 'b1' } })
|
mockActivities.getAgentAutofillContextActivity.mockResolvedValue({ agent: { id: 'b1' } })
|
||||||
mockActivities.getAssetAutofillContextActivity.mockResolvedValue('Generated using gemini')
|
|
||||||
mockActivities.autofillAiActivity.mockResolvedValue({
|
mockActivities.autofillAiActivity.mockResolvedValue({
|
||||||
text: '{"title":"Extracted Title"}',
|
text: '{"title":"Extracted Title"}',
|
||||||
sessionId: 'session-123',
|
sessionId: 'session-123',
|
||||||
@@ -140,7 +139,6 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
expect(mockActivities.getAgentAutofillContextActivity).toHaveBeenCalledWith({
|
expect(mockActivities.getAgentAutofillContextActivity).toHaveBeenCalledWith({
|
||||||
teamId: 't1',
|
teamId: 't1',
|
||||||
})
|
})
|
||||||
expect(mockActivities.getAssetAutofillContextActivity).toHaveBeenCalledWith('a1')
|
|
||||||
|
|
||||||
// Verify AI autofill called with mapped fields
|
// Verify AI autofill called with mapped fields
|
||||||
expect(mockActivities.autofillAiActivity).toHaveBeenCalledWith({
|
expect(mockActivities.autofillAiActivity).toHaveBeenCalledWith({
|
||||||
@@ -154,7 +152,6 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
context: { agent: { id: 'b1' } },
|
context: { agent: { id: 'b1' } },
|
||||||
agentContext: 'Generated using gemini',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Verify task usage update
|
// Verify task usage update
|
||||||
@@ -195,42 +192,6 @@ describe('Agent Autofill Workflow', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should run autofill without agentContext when the asset has no context', async () => {
|
|
||||||
mockActivities.getAssetAutofillContextActivity.mockResolvedValue(null)
|
|
||||||
|
|
||||||
const task = await prisma.workflowTask.create({
|
|
||||||
data: {
|
|
||||||
type: 'ai_metadata_autofill',
|
|
||||||
status: 'pending',
|
|
||||||
assetId: 'a1',
|
|
||||||
payload: {
|
|
||||||
projectId: 'p1',
|
|
||||||
agent: { sessionId: 's1', agentId: 'agent-1' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
await agentAutofillMedia(task)
|
|
||||||
|
|
||||||
expect(mockActivities.getAssetAutofillContextActivity).toHaveBeenCalledWith('a1')
|
|
||||||
expect(mockActivities.autofillAiActivity).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
teamId: 't1',
|
|
||||||
images: ['/tmp/test-dir/1.webp'],
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
id: 'title',
|
|
||||||
config: { name: 'Title', type: 'text' },
|
|
||||||
description: 'The title',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
context: { agent: { id: 'b1' } },
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
const aiCallArgs = mockActivities.autofillAiActivity.mock.calls[0][0]
|
|
||||||
expect(aiCallArgs).not.toHaveProperty('agentContext')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should complete early if no image files could be extracted', async () => {
|
it('should complete early if no image files could be extracted', async () => {
|
||||||
mockActivities.extractAiMetadataActivity.mockResolvedValue([])
|
mockActivities.extractAiMetadataActivity.mockResolvedValue([])
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
|||||||
extractAiMetadataActivity,
|
extractAiMetadataActivity,
|
||||||
getProjectAutofillFieldsActivity,
|
getProjectAutofillFieldsActivity,
|
||||||
getAgentAutofillContextActivity,
|
getAgentAutofillContextActivity,
|
||||||
getAssetAutofillContextActivity,
|
|
||||||
autofillAiActivity,
|
autofillAiActivity,
|
||||||
updateTaskUsageActivity,
|
updateTaskUsageActivity,
|
||||||
updateAssetMetadataActivity,
|
updateAssetMetadataActivity,
|
||||||
@@ -132,13 +131,6 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
|||||||
teamId,
|
teamId,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 3c. Fetch Agent-Provided Autofill Context (from create_file/create_version)
|
|
||||||
const agentContext = await executeActivity(
|
|
||||||
agentWorkerQueue,
|
|
||||||
getAssetAutofillContextActivity,
|
|
||||||
asset.id,
|
|
||||||
)
|
|
||||||
|
|
||||||
// 4. Call AI Service
|
// 4. Call AI Service
|
||||||
const aiResult = await executeActivity(agentWorkerQueue, autofillAiActivity, {
|
const aiResult = await executeActivity(agentWorkerQueue, autofillAiActivity, {
|
||||||
teamId,
|
teamId,
|
||||||
@@ -151,7 +143,6 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
context,
|
context,
|
||||||
...(agentContext ? { agentContext } : {}),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (aiResult.usage) {
|
if (aiResult.usage) {
|
||||||
@@ -166,10 +157,12 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
|
|||||||
|
|
||||||
// 6. Update Asset Metadata
|
// 6. Update Asset Metadata
|
||||||
const result = JSON.parse(aiResult.text)
|
const result = JSON.parse(aiResult.text)
|
||||||
const metadataUpdates = Object.entries(result).map(([key, value]) => ({
|
const metadataUpdates = Object.entries(result)
|
||||||
key,
|
.filter(([, value]) => value !== null)
|
||||||
value,
|
.map(([key, value]) => ({
|
||||||
}))
|
key,
|
||||||
|
value,
|
||||||
|
}))
|
||||||
|
|
||||||
if (metadataUpdates.length > 0) {
|
if (metadataUpdates.length > 0) {
|
||||||
await executeActivity(agentWorkerQueue, updateAssetMetadataActivity, {
|
await executeActivity(agentWorkerQueue, updateAssetMetadataActivity, {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/api",
|
"name": "@shumai/api",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -46,10 +46,9 @@ describe('metadata api', () => {
|
|||||||
const mockField = {
|
const mockField = {
|
||||||
key: 'field1',
|
key: 'field1',
|
||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
config: { name: 'Test Field', type: 'text' },
|
config: { name: 'Test Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
aiAutofill: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
||||||
@@ -62,7 +61,7 @@ describe('metadata api', () => {
|
|||||||
expect(json).toHaveLength(1)
|
expect(json).toHaveLength(1)
|
||||||
expect(json[0].id).toBe('field1')
|
expect(json[0].id).toBe('field1')
|
||||||
expect(json[0].config.name).toBe('Test Field')
|
expect(json[0].config.name).toBe('Test Field')
|
||||||
expect(json[0].aiAutofill).toBe(true)
|
expect(json[0].config.autofillSource).toBe('CONTENT')
|
||||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||||
user: expect.anything(),
|
user: expect.anything(),
|
||||||
permission: Permission.Read,
|
permission: Permission.Read,
|
||||||
@@ -75,10 +74,9 @@ describe('metadata api', () => {
|
|||||||
const mockField = {
|
const mockField = {
|
||||||
key: 'newfield',
|
key: 'newfield',
|
||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
config: { name: 'New Field', type: 'text' },
|
config: { name: 'New Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
aiAutofill: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
||||||
@@ -88,8 +86,7 @@ describe('metadata api', () => {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
config: { name: 'New Field', type: 'text' },
|
config: { name: 'New Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
@@ -115,10 +112,9 @@ describe('metadata api', () => {
|
|||||||
const mockField = {
|
const mockField = {
|
||||||
key: 'field1',
|
key: 'field1',
|
||||||
scope: 'PROJECT',
|
scope: 'PROJECT',
|
||||||
config: { name: 'Project Field', type: 'text' },
|
config: { name: 'Project Field', type: 'text', autofillSource: 'NONE' },
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
aiAutofill: false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mocked(metadataService.listProjectFields).mockResolvedValue([
|
vi.mocked(metadataService.listProjectFields).mockResolvedValue([
|
||||||
@@ -198,10 +194,9 @@ describe('metadata api', () => {
|
|||||||
const mockField = {
|
const mockField = {
|
||||||
key: 'f1',
|
key: 'f1',
|
||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
config: { name: 'Updated Field', type: 'text' },
|
config: { name: 'Updated Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
aiAutofill: true,
|
|
||||||
teamId: 't1',
|
teamId: 't1',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,8 +209,7 @@ describe('metadata api', () => {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
config: { name: 'Updated Field', type: 'text' },
|
config: { name: 'Updated Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: 'desc',
|
description: 'desc',
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ function toFieldInfo(
|
|||||||
readOnly: f.readOnly,
|
readOnly: f.readOnly,
|
||||||
visible: visible,
|
visible: visible,
|
||||||
description: f.description,
|
description: f.description,
|
||||||
aiAutofill: f.aiAutofill,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ function toFieldInfo(
|
|||||||
readOnly: f.readOnly,
|
readOnly: f.readOnly,
|
||||||
visible: visible,
|
visible: visible,
|
||||||
description: f.description,
|
description: f.description,
|
||||||
aiAutofill: f.aiAutofill,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ describe('team api', () => {
|
|||||||
|
|
||||||
it('GET /teams/:teamId/sandbox returns sandbox settings', async () => {
|
it('GET /teams/:teamId/sandbox returns sandbox settings', async () => {
|
||||||
mockGetSandboxSettings.mockResolvedValue({
|
mockGetSandboxSettings.mockResolvedValue({
|
||||||
|
networkSandboxEnabled: false,
|
||||||
allowedDomains: ['example.com'],
|
allowedDomains: ['example.com'],
|
||||||
pendingDomains: ['pending.com'],
|
pendingDomains: ['pending.com'],
|
||||||
})
|
})
|
||||||
@@ -300,6 +301,7 @@ describe('team api', () => {
|
|||||||
|
|
||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
expect(data.networkSandboxEnabled).toBe(false)
|
||||||
expect(data.allowedDomains).toEqual(['example.com'])
|
expect(data.allowedDomains).toEqual(['example.com'])
|
||||||
expect(data.pendingDomains).toEqual(['pending.com'])
|
expect(data.pendingDomains).toEqual(['pending.com'])
|
||||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||||
@@ -314,6 +316,7 @@ describe('team api', () => {
|
|||||||
|
|
||||||
it('PUT /teams/:teamId/sandbox updates sandbox settings', async () => {
|
it('PUT /teams/:teamId/sandbox updates sandbox settings', async () => {
|
||||||
mockUpdateSandboxSettings.mockResolvedValue({
|
mockUpdateSandboxSettings.mockResolvedValue({
|
||||||
|
networkSandboxEnabled: true,
|
||||||
allowedDomains: ['new.com'],
|
allowedDomains: ['new.com'],
|
||||||
pendingDomains: ['new-pending.com'],
|
pendingDomains: ['new-pending.com'],
|
||||||
})
|
})
|
||||||
@@ -321,11 +324,16 @@ describe('team api', () => {
|
|||||||
const res = await app.request('/teams/t1/sandbox', {
|
const res = await app.request('/teams/t1/sandbox', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ allowedDomains: ['new.com'], pendingDomains: ['new-pending.com'] }),
|
body: JSON.stringify({
|
||||||
|
networkSandboxEnabled: true,
|
||||||
|
allowedDomains: ['new.com'],
|
||||||
|
pendingDomains: ['new-pending.com'],
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
expect(data.networkSandboxEnabled).toBe(true)
|
||||||
expect(data.allowedDomains).toEqual(['new.com'])
|
expect(data.allowedDomains).toEqual(['new.com'])
|
||||||
expect(data.pendingDomains).toEqual(['new-pending.com'])
|
expect(data.pendingDomains).toEqual(['new-pending.com'])
|
||||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||||
@@ -336,6 +344,7 @@ describe('team api', () => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
expect(mockUpdateSandboxSettings).toHaveBeenCalledWith('t1', {
|
expect(mockUpdateSandboxSettings).toHaveBeenCalledWith('t1', {
|
||||||
|
networkSandboxEnabled: true,
|
||||||
allowedDomains: ['new.com'],
|
allowedDomains: ['new.com'],
|
||||||
pendingDomains: ['new-pending.com'],
|
pendingDomains: ['new-pending.com'],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/core",
|
"name": "@shumai/core",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ describe('MetadataService', () => {
|
|||||||
expect(projectFields[2].visible).toBe(false)
|
expect(projectFields[2].visible).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('AIAutofillAndDescription', async () => {
|
it('AutofillSourceAndDescription', async () => {
|
||||||
const team = await prisma.team.create({
|
const team = await prisma.team.create({
|
||||||
data: { name: 'test-team' },
|
data: { name: 'test-team' },
|
||||||
})
|
})
|
||||||
@@ -103,24 +103,22 @@ describe('MetadataService', () => {
|
|||||||
key: 'teamfield1',
|
key: 'teamfield1',
|
||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
team: { connect: { id: team.id } },
|
team: { connect: { id: team.id } },
|
||||||
config: { name: 'Test Team Field', type: 'text' },
|
config: { name: 'Test Team Field', type: 'text', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: desc,
|
description: desc,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const newDesc = 'Updated description'
|
const newDesc = 'Updated description'
|
||||||
const updatedTeamField = await metadataService.updateTeamField(team.id, teamField.key, {
|
const updatedTeamField = await metadataService.updateTeamField(team.id, teamField.key, {
|
||||||
config: { name: 'Test Team Field', type: 'text' },
|
config: { name: 'Test Team Field', type: 'text', autofillSource: 'NONE' },
|
||||||
aiAutofill: false,
|
|
||||||
description: newDesc,
|
description: newDesc,
|
||||||
})
|
})
|
||||||
expect(updatedTeamField.aiAutofill).toBe(false)
|
expect(updatedTeamField.config?.autofillSource).toBe('NONE')
|
||||||
expect(updatedTeamField.description).toBe(newDesc)
|
expect(updatedTeamField.description).toBe(newDesc)
|
||||||
// IDOR test
|
// IDOR test
|
||||||
await expect(
|
await expect(
|
||||||
metadataService.updateTeamField('wrong-team-id', teamField.key, {
|
metadataService.updateTeamField('wrong-team-id', teamField.key, {
|
||||||
config: { name: 'Hack', type: 'text' },
|
config: { name: 'Hack', type: 'text', autofillSource: 'NONE' },
|
||||||
}),
|
}),
|
||||||
).rejects.toThrow('Field does not belong to this team')
|
).rejects.toThrow('Field does not belong to this team')
|
||||||
})
|
})
|
||||||
@@ -261,4 +259,294 @@ describe('MetadataService', () => {
|
|||||||
const multiVal = values.find((v) => v.fieldKey === userMultiField.key)
|
const multiVal = values.find((v) => v.fieldKey === userMultiField.key)
|
||||||
expect(multiVal?.jsonValue).toEqual(multiUserIds)
|
expect(multiVal?.jsonValue).toEqual(multiUserIds)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should dynamically create new options for select fields and store option id', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'test-team' },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'test-project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const asset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'test-asset',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
type: 'file',
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'ai_provider',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'AI Provider',
|
||||||
|
type: 'select',
|
||||||
|
select: {
|
||||||
|
options: [
|
||||||
|
{ id: 'openai', displayName: 'OpenAI', color: '#f43f5e' },
|
||||||
|
{ id: 'google', displayName: 'Google', color: '#3b82f6' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 1. Add new option 'Kling AI'
|
||||||
|
await metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{ key: selectField.key, value: { newOption: { value: 'Kling AI' } } },
|
||||||
|
])
|
||||||
|
|
||||||
|
// Verify option added to field config
|
||||||
|
const updatedField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: selectField.key },
|
||||||
|
})
|
||||||
|
const options = (updatedField?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
|
expect(options).toHaveLength(3)
|
||||||
|
const klingOpt = options.find((o) => o.displayName === 'Kling AI')
|
||||||
|
expect(klingOpt).toBeDefined()
|
||||||
|
expect(klingOpt?.id).toBe('kling-ai')
|
||||||
|
expect(klingOpt?.color).toBeDefined()
|
||||||
|
|
||||||
|
// Verify asset metadata value stores the option ID
|
||||||
|
const val = await prisma.assetMetadataValue.findUnique({
|
||||||
|
where: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
assetId_fieldKey: {
|
||||||
|
assetId: asset.id,
|
||||||
|
fieldKey: selectField.key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(val?.stringValue).toBe('kling-ai')
|
||||||
|
|
||||||
|
// 2. Deduplication: passing 'kling ai' case-insensitively should reuse existing 'kling-ai'
|
||||||
|
await metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{ key: selectField.key, value: { newOption: { value: 'kling ai' } } },
|
||||||
|
])
|
||||||
|
const updatedField2 = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: selectField.key },
|
||||||
|
})
|
||||||
|
const options2 = (updatedField2?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
|
expect(options2).toHaveLength(3) // Not 4!
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should dynamically create new options for selectMulti fields and store array of option ids', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'test-team' },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'test-project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const asset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'test-asset',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
type: 'file',
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectMultiField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'tags',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
selectMulti: {
|
||||||
|
options: [{ id: 'tag1', displayName: 'Tag 1', color: '#f43f5e' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Pass mixed existing and new option
|
||||||
|
await metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{
|
||||||
|
key: selectMultiField.key,
|
||||||
|
value: ['tag1', { newOption: { value: 'Tag 2' } }],
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
// Verify option added to field config
|
||||||
|
const updatedField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: selectMultiField.key },
|
||||||
|
})
|
||||||
|
const options = (updatedField?.config as PrismaJson.FieldConfig)?.selectMulti?.options || []
|
||||||
|
expect(options).toHaveLength(2)
|
||||||
|
const tag2Opt = options.find((o) => o.displayName === 'Tag 2')
|
||||||
|
expect(tag2Opt).toBeDefined()
|
||||||
|
expect(tag2Opt?.id).toBe('tag-2')
|
||||||
|
|
||||||
|
// Verify asset metadata value stores array of IDs
|
||||||
|
const val = await prisma.assetMetadataValue.findUnique({
|
||||||
|
where: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
assetId_fieldKey: {
|
||||||
|
assetId: asset.id,
|
||||||
|
fieldKey: selectMultiField.key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(val?.jsonValue).toEqual(['tag1', 'tag-2'])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should reject invalid newOption value format', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'test-team' },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'test-project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const asset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'test-asset',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
type: 'file',
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'field_opt',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: { name: 'Field Opt', type: 'select' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{ key: selectField.key, value: { newOption: { value: ' ' } } },
|
||||||
|
]),
|
||||||
|
).rejects.toThrow('value must be a non-empty string')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should handle ID collisions by appending numeric suffix', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'test-team' },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'test-project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const asset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'test-asset',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
type: 'file',
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'collision_test',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Collision Test',
|
||||||
|
type: 'select',
|
||||||
|
select: {
|
||||||
|
options: [
|
||||||
|
{ id: 'kling-ai', displayName: 'Old Kling AI', color: '#f43f5e' },
|
||||||
|
{ id: 'kling-ai-1', displayName: 'Old Kling AI Suffix 1', color: '#3b82f6' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Now adding a new option with different displayName whose slug collides with 'kling-ai'
|
||||||
|
await metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{ key: selectField.key, value: { newOption: { value: 'Kling AI Unique' } } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const updatedField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: selectField.key },
|
||||||
|
})
|
||||||
|
const options = (updatedField?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
|
const newOpt = options.find((o) => o.displayName === 'Kling AI Unique')
|
||||||
|
expect(newOpt).toBeDefined()
|
||||||
|
expect(newOpt?.id).toBe('kling-ai-unique')
|
||||||
|
|
||||||
|
// Test when baseId and candidateId-1 exist, next should be candidateId-2
|
||||||
|
const collisionField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'collision_base',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Collision Base',
|
||||||
|
type: 'select',
|
||||||
|
select: {
|
||||||
|
options: [
|
||||||
|
{ id: 'custom-tool', displayName: 'First Tool', color: '#f43f5e' },
|
||||||
|
{ id: 'custom-tool-1', displayName: 'Second Tool', color: '#3b82f6' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// displayName is 'Custom Tool' which has baseId 'custom-tool' (not matching display names 'First Tool' / 'Second Tool')
|
||||||
|
await metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
{ key: collisionField.key, value: { newOption: { value: 'Custom Tool' } } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const updatedCollisionField = await prisma.metadataField.findUnique({
|
||||||
|
where: { key: collisionField.key },
|
||||||
|
})
|
||||||
|
const collisionOpts =
|
||||||
|
(updatedCollisionField?.config as PrismaJson.FieldConfig)?.select?.options || []
|
||||||
|
const resolvedNewOpt = collisionOpts.find((o) => o.displayName === 'Custom Tool')
|
||||||
|
expect(resolvedNewOpt).toBeDefined()
|
||||||
|
expect(resolvedNewOpt?.id).toBe('custom-tool-2')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should reject non-string and non-newOption items in selectMulti array', async () => {
|
||||||
|
const team = await prisma.team.create({
|
||||||
|
data: { name: 'test-team' },
|
||||||
|
})
|
||||||
|
const project = await prisma.project.create({
|
||||||
|
data: { name: 'test-project', teamId: team.id },
|
||||||
|
})
|
||||||
|
const asset = await prisma.asset.create({
|
||||||
|
data: {
|
||||||
|
name: 'test-asset',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
type: 'file',
|
||||||
|
status: 'uploaded',
|
||||||
|
sizeByte: 100,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectMultiField = await prisma.metadataField.create({
|
||||||
|
data: {
|
||||||
|
key: 'tags_invalid_items',
|
||||||
|
scope: 'PROJECT',
|
||||||
|
project: { connect: { id: project.id } },
|
||||||
|
config: {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Passing invalid items like number or null
|
||||||
|
await expect(
|
||||||
|
metadataService.updateAssetMetadata(asset.id, [
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
{ key: selectMultiField.key, value: ['tag1', 123 as any] },
|
||||||
|
]),
|
||||||
|
).rejects.toThrow('expected string or {newOption}')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,6 +10,36 @@ import { ulid } from 'ulid'
|
|||||||
import { assetService } from '../asset/asset'
|
import { assetService } from '../asset/asset'
|
||||||
import { systemFields } from './system_fields'
|
import { systemFields } from './system_fields'
|
||||||
|
|
||||||
|
export const FIELD_COLORS = [
|
||||||
|
'#f43f5e', // rose
|
||||||
|
'#ec4899', // pink
|
||||||
|
'#d946ef', // fuchsia
|
||||||
|
'#a855f7', // purple
|
||||||
|
'#8b5cf6', // violet
|
||||||
|
'#6366f1', // indigo
|
||||||
|
'#3b82f6', // blue
|
||||||
|
'#0ea5e9', // sky
|
||||||
|
'#06b6d4', // cyan
|
||||||
|
'#14b8a6', // teal
|
||||||
|
'#10b981', // emerald
|
||||||
|
'#22c55e', // green
|
||||||
|
'#84cc16', // lime
|
||||||
|
'#eab308', // yellow
|
||||||
|
'#f59e0b', // amber
|
||||||
|
'#f97316', // orange
|
||||||
|
'#71717a', // zinc
|
||||||
|
'#64748b', // slate
|
||||||
|
]
|
||||||
|
|
||||||
|
export function getNextOptionColor(existingOptions: PrismaJson.SelectOption[] = []): string {
|
||||||
|
const usedColors = new Set(existingOptions.map((o) => o.color))
|
||||||
|
const available = FIELD_COLORS.filter((c) => !usedColors.has(c))
|
||||||
|
if (available.length > 0) {
|
||||||
|
return available[0]
|
||||||
|
}
|
||||||
|
return FIELD_COLORS[existingOptions.length % FIELD_COLORS.length]
|
||||||
|
}
|
||||||
|
|
||||||
export class MetadataService {
|
export class MetadataService {
|
||||||
constructor(private client: typeof prisma = prisma) {}
|
constructor(private client: typeof prisma = prisma) {}
|
||||||
async syncSystemFields(): Promise<void> {
|
async syncSystemFields(): Promise<void> {
|
||||||
@@ -43,7 +73,6 @@ export class MetadataService {
|
|||||||
scope: 'TEAM',
|
scope: 'TEAM',
|
||||||
teamId: teamId,
|
teamId: teamId,
|
||||||
config: req.config,
|
config: req.config,
|
||||||
aiAutofill: req.aiAutofill,
|
|
||||||
description: req.description,
|
description: req.description,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -89,7 +118,6 @@ export class MetadataService {
|
|||||||
where: { id: field.id },
|
where: { id: field.id },
|
||||||
data: {
|
data: {
|
||||||
config: req.config,
|
config: req.config,
|
||||||
aiAutofill: req.aiAutofill ?? field.aiAutofill,
|
|
||||||
description: req.description ?? field.description,
|
description: req.description ?? field.description,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -125,7 +153,6 @@ export class MetadataService {
|
|||||||
projectId: projectId,
|
projectId: projectId,
|
||||||
teamId: p.teamId,
|
teamId: p.teamId,
|
||||||
config: req.config,
|
config: req.config,
|
||||||
aiAutofill: req.aiAutofill,
|
|
||||||
description: req.description,
|
description: req.description,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -239,7 +266,6 @@ export class MetadataService {
|
|||||||
where: { id: field.id },
|
where: { id: field.id },
|
||||||
data: {
|
data: {
|
||||||
config: req.config,
|
config: req.config,
|
||||||
aiAutofill: req.aiAutofill ?? field.aiAutofill,
|
|
||||||
description: req.description ?? field.description,
|
description: req.description ?? field.description,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -262,84 +288,211 @@ export class MetadataService {
|
|||||||
assetId: string,
|
assetId: string,
|
||||||
reqs: UpdateAssetMetadataRequest[],
|
reqs: UpdateAssetMetadataRequest[],
|
||||||
allowReadOnly = false,
|
allowReadOnly = false,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.client.$transaction(async (tx) => {
|
||||||
|
await this.updateAssetMetadataInternal(tx, assetId, reqs, allowReadOnly)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as {@link updateAssetMetadata} but runs inside the caller's transaction,
|
||||||
|
* keeping the metadata write atomic with the surrounding changes.
|
||||||
|
*/
|
||||||
|
async updateAssetMetadataInTx(
|
||||||
|
tx: Prisma.TransactionClient,
|
||||||
|
assetId: string,
|
||||||
|
reqs: UpdateAssetMetadataRequest[],
|
||||||
|
allowReadOnly = false,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.updateAssetMetadataInternal(tx, assetId, reqs, allowReadOnly)
|
||||||
|
}
|
||||||
|
|
||||||
|
private async resolveOrCreateOption(
|
||||||
|
client: Prisma.TransactionClient | typeof prisma,
|
||||||
|
field: Prisma.MetadataFieldGetPayload<Record<string, never>>,
|
||||||
|
rawOption: unknown,
|
||||||
|
): Promise<string> {
|
||||||
|
if (
|
||||||
|
typeof rawOption !== 'object' ||
|
||||||
|
rawOption === null ||
|
||||||
|
!('newOption' in rawOption) ||
|
||||||
|
typeof (rawOption as { newOption?: unknown }).newOption !== 'object' ||
|
||||||
|
(rawOption as { newOption?: unknown }).newOption === null
|
||||||
|
) {
|
||||||
|
throw new Error(`Invalid newOption object for field ${field.key}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = (rawOption as { newOption: { value?: unknown } }).newOption.value
|
||||||
|
if (typeof value !== 'string' || !value.trim()) {
|
||||||
|
throw new Error(
|
||||||
|
`Invalid newOption value for field ${field.key}: value must be a non-empty string`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const trimmedValue = value.trim()
|
||||||
|
const config = (field.config ?? {}) as PrismaJson.FieldConfig
|
||||||
|
const isMulti = config.type === 'selectMulti'
|
||||||
|
const existingOptions: PrismaJson.SelectOption[] =
|
||||||
|
(isMulti ? config.selectMulti?.options : config.select?.options) ?? []
|
||||||
|
|
||||||
|
// 1. Check for case-insensitive match against existing options (id or displayName)
|
||||||
|
const existing = existingOptions.find(
|
||||||
|
(opt) =>
|
||||||
|
opt.id.toLowerCase() === trimmedValue.toLowerCase() ||
|
||||||
|
opt.displayName.toLowerCase() === trimmedValue.toLowerCase(),
|
||||||
|
)
|
||||||
|
if (existing) {
|
||||||
|
return existing.id
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Generate slug id
|
||||||
|
let baseId = trimmedValue.toLowerCase().replace(/\s+/g, '-')
|
||||||
|
if (!baseId) {
|
||||||
|
baseId = ulid().toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
let candidateId = baseId
|
||||||
|
let suffix = 1
|
||||||
|
while (existingOptions.some((opt) => opt.id === candidateId)) {
|
||||||
|
candidateId = `${baseId}-${suffix}`
|
||||||
|
suffix++
|
||||||
|
}
|
||||||
|
|
||||||
|
const newOption: PrismaJson.SelectOption = {
|
||||||
|
id: candidateId,
|
||||||
|
displayName: trimmedValue,
|
||||||
|
color: getNextOptionColor(existingOptions),
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedOptions = [...existingOptions, newOption]
|
||||||
|
const updatedConfig: PrismaJson.FieldConfig = {
|
||||||
|
...config,
|
||||||
|
name: config.name ?? field.key,
|
||||||
|
type: config.type ?? (isMulti ? 'selectMulti' : 'select'),
|
||||||
|
...(isMulti
|
||||||
|
? { selectMulti: { ...(config.selectMulti ?? {}), options: updatedOptions } }
|
||||||
|
: { select: { ...(config.select ?? {}), options: updatedOptions } }),
|
||||||
|
}
|
||||||
|
|
||||||
|
await client.metadataField.update({
|
||||||
|
where: { key: field.key },
|
||||||
|
data: { config: updatedConfig },
|
||||||
|
})
|
||||||
|
|
||||||
|
// Update in-memory field.config for subsequent iterations in the same transaction
|
||||||
|
field.config = updatedConfig
|
||||||
|
|
||||||
|
return candidateId
|
||||||
|
}
|
||||||
|
|
||||||
|
private async updateAssetMetadataInternal(
|
||||||
|
client: Prisma.TransactionClient | typeof prisma,
|
||||||
|
assetId: string,
|
||||||
|
reqs: UpdateAssetMetadataRequest[],
|
||||||
|
allowReadOnly: boolean,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const resolvedAssetId = await assetService.resolveLatestVersionId(assetId)
|
const resolvedAssetId = await assetService.resolveLatestVersionId(assetId)
|
||||||
|
|
||||||
await this.client.$transaction(async (tx) => {
|
for (const req of reqs) {
|
||||||
for (const req of reqs) {
|
const field = await client.metadataField.findUnique({
|
||||||
const field = await tx.metadataField.findUnique({
|
where: { key: req.key },
|
||||||
where: { key: req.key },
|
})
|
||||||
})
|
if (field?.readOnly && !allowReadOnly) {
|
||||||
if (field?.readOnly && !allowReadOnly) {
|
throw new Error(`Field ${field.key} is read-only`)
|
||||||
throw new Error(`Field ${field.key} is read-only`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const value = req.value
|
|
||||||
let stringValue: string | null = null
|
|
||||||
let numberValue: number | null = null
|
|
||||||
let booleanValue: boolean | null = null
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
let jsonValue: any = null
|
|
||||||
let dateValue: Date | null = null
|
|
||||||
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
// Check if it's a valid ISO date string
|
|
||||||
const date = new Date(value)
|
|
||||||
if (!isNaN(date.getTime()) && value.includes('T') && value.includes('-')) {
|
|
||||||
dateValue = date
|
|
||||||
} else {
|
|
||||||
stringValue = value
|
|
||||||
}
|
|
||||||
} else if (typeof value === 'number') {
|
|
||||||
numberValue = value
|
|
||||||
} else if (typeof value === 'boolean') {
|
|
||||||
booleanValue = value
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
dateValue = value
|
|
||||||
} else if (Array.isArray(value)) {
|
|
||||||
jsonValue = value
|
|
||||||
} else if (value === null) {
|
|
||||||
// all null
|
|
||||||
} else if (typeof value === 'object') {
|
|
||||||
jsonValue = value
|
|
||||||
} else {
|
|
||||||
stringValue = String(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
await tx.assetMetadataValue.upsert({
|
|
||||||
where: {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
||||||
assetId_fieldKey: {
|
|
||||||
assetId: resolvedAssetId,
|
|
||||||
fieldKey: req.key,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
create: {
|
|
||||||
assetId: resolvedAssetId,
|
|
||||||
fieldKey: req.key,
|
|
||||||
stringValue,
|
|
||||||
numberValue,
|
|
||||||
booleanValue,
|
|
||||||
jsonValue,
|
|
||||||
dateValue,
|
|
||||||
},
|
|
||||||
update: {
|
|
||||||
stringValue,
|
|
||||||
numberValue,
|
|
||||||
booleanValue,
|
|
||||||
jsonValue,
|
|
||||||
dateValue,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch asset
|
let value = req.value
|
||||||
await tx.asset.update({
|
const config = field?.config as PrismaJson.FieldConfig | null
|
||||||
where: { id: resolvedAssetId },
|
|
||||||
data: {
|
if (
|
||||||
updatedAt: new Date(),
|
field &&
|
||||||
|
config?.type === 'select' &&
|
||||||
|
typeof value === 'object' &&
|
||||||
|
value !== null &&
|
||||||
|
'newOption' in value
|
||||||
|
) {
|
||||||
|
value = await this.resolveOrCreateOption(client, field, value)
|
||||||
|
} else if (field && config?.type === 'selectMulti' && Array.isArray(value)) {
|
||||||
|
const resolvedList: string[] = []
|
||||||
|
for (const item of value) {
|
||||||
|
if (typeof item === 'object' && item !== null && 'newOption' in item) {
|
||||||
|
const resolvedId = await this.resolveOrCreateOption(client, field, item)
|
||||||
|
resolvedList.push(resolvedId)
|
||||||
|
} else if (typeof item === 'string') {
|
||||||
|
resolvedList.push(item)
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`Invalid option value for field ${field.key}: expected string or {newOption}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
value = resolvedList
|
||||||
|
}
|
||||||
|
|
||||||
|
let stringValue: string | null = null
|
||||||
|
let numberValue: number | null = null
|
||||||
|
let booleanValue: boolean | null = null
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
let jsonValue: any = null
|
||||||
|
let dateValue: Date | null = null
|
||||||
|
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
// Check if it's a valid ISO date string
|
||||||
|
const date = new Date(value)
|
||||||
|
if (!isNaN(date.getTime()) && value.includes('T') && value.includes('-')) {
|
||||||
|
dateValue = date
|
||||||
|
} else {
|
||||||
|
stringValue = value
|
||||||
|
}
|
||||||
|
} else if (typeof value === 'number') {
|
||||||
|
numberValue = value
|
||||||
|
} else if (typeof value === 'boolean') {
|
||||||
|
booleanValue = value
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
dateValue = value
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
jsonValue = value
|
||||||
|
} else if (value === null) {
|
||||||
|
// all null
|
||||||
|
} else if (typeof value === 'object') {
|
||||||
|
jsonValue = value
|
||||||
|
} else {
|
||||||
|
stringValue = String(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
await client.assetMetadataValue.upsert({
|
||||||
|
where: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
assetId_fieldKey: {
|
||||||
|
assetId: resolvedAssetId,
|
||||||
|
fieldKey: req.key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
assetId: resolvedAssetId,
|
||||||
|
fieldKey: req.key,
|
||||||
|
stringValue,
|
||||||
|
numberValue,
|
||||||
|
booleanValue,
|
||||||
|
jsonValue,
|
||||||
|
dateValue,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
stringValue,
|
||||||
|
numberValue,
|
||||||
|
booleanValue,
|
||||||
|
jsonValue,
|
||||||
|
dateValue,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Touch asset
|
||||||
|
await client.asset.update({
|
||||||
|
where: { id: resolvedAssetId },
|
||||||
|
data: {
|
||||||
|
updatedAt: new Date(),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,31 +296,36 @@ describe('TeamService', () => {
|
|||||||
name: 'Settings Team',
|
name: 'Settings Team',
|
||||||
})
|
})
|
||||||
|
|
||||||
// Should have default settings
|
// Should have default settings (networkSandboxEnabled is false by default for new teams)
|
||||||
const settings = await teamService.getSandboxSettings(team.id)
|
const settings = await teamService.getSandboxSettings(team.id)
|
||||||
|
expect(settings.networkSandboxEnabled).toBe(false)
|
||||||
expect(settings.allowedDomains).toContain('github.com')
|
expect(settings.allowedDomains).toContain('github.com')
|
||||||
expect(settings.pendingDomains).toEqual([])
|
expect(settings.pendingDomains).toEqual([])
|
||||||
|
|
||||||
// Should update settings
|
// Should update settings
|
||||||
const updated = await teamService.updateSandboxSettings(team.id, {
|
const updated = await teamService.updateSandboxSettings(team.id, {
|
||||||
|
networkSandboxEnabled: true,
|
||||||
allowedDomains: ['example.com'],
|
allowedDomains: ['example.com'],
|
||||||
pendingDomains: ['pending.com'],
|
pendingDomains: ['pending.com'],
|
||||||
})
|
})
|
||||||
|
expect(updated.networkSandboxEnabled).toBe(true)
|
||||||
expect(updated.allowedDomains).toEqual(['example.com'])
|
expect(updated.allowedDomains).toEqual(['example.com'])
|
||||||
expect(updated.pendingDomains).toEqual(['pending.com'])
|
expect(updated.pendingDomains).toEqual(['pending.com'])
|
||||||
|
|
||||||
// Should persist to DB
|
// Should persist to DB
|
||||||
const persisted = await teamService.getSandboxSettings(team.id)
|
const persisted = await teamService.getSandboxSettings(team.id)
|
||||||
|
expect(persisted.networkSandboxEnabled).toBe(true)
|
||||||
expect(persisted.allowedDomains).toEqual(['example.com'])
|
expect(persisted.allowedDomains).toEqual(['example.com'])
|
||||||
expect(persisted.pendingDomains).toEqual(['pending.com'])
|
expect(persisted.pendingDomains).toEqual(['pending.com'])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return empty allowedDomains if sandbox is missing for old team', async () => {
|
it('should return default settings if sandbox is missing for old team', async () => {
|
||||||
const team = await prisma.team.create({
|
const team = await prisma.team.create({
|
||||||
data: { name: 'Old Team' },
|
data: { name: 'Old Team' },
|
||||||
})
|
})
|
||||||
|
|
||||||
const settings = await teamService.getSandboxSettings(team.id)
|
const settings = await teamService.getSandboxSettings(team.id)
|
||||||
|
expect(settings.networkSandboxEnabled).toBe(false)
|
||||||
expect(settings.allowedDomains).toEqual([])
|
expect(settings.allowedDomains).toEqual([])
|
||||||
expect(settings.pendingDomains).toEqual([])
|
expect(settings.pendingDomains).toEqual([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
GetMeResponse,
|
GetMeResponse,
|
||||||
UserInfo,
|
UserInfo,
|
||||||
SandboxSettings,
|
SandboxSettings,
|
||||||
|
UpdateSandboxSettingsRequest,
|
||||||
} from '@shumai/dtos'
|
} from '@shumai/dtos'
|
||||||
|
|
||||||
export class TeamService {
|
export class TeamService {
|
||||||
@@ -330,25 +331,38 @@ export class TeamService {
|
|||||||
where: { teamId },
|
where: { teamId },
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
networkSandboxEnabled: sandbox?.networkSandboxEnabled ?? false,
|
||||||
allowedDomains: sandbox?.allowedDomains || [],
|
allowedDomains: sandbox?.allowedDomains || [],
|
||||||
pendingDomains: sandbox?.pendingDomains || [],
|
pendingDomains: sandbox?.pendingDomains || [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateSandboxSettings(teamId: string, settings: SandboxSettings): Promise<SandboxSettings> {
|
async updateSandboxSettings(
|
||||||
|
teamId: string,
|
||||||
|
settings: UpdateSandboxSettingsRequest,
|
||||||
|
): Promise<SandboxSettings> {
|
||||||
const sandbox = await prisma.sandbox.upsert({
|
const sandbox = await prisma.sandbox.upsert({
|
||||||
where: { teamId },
|
where: { teamId },
|
||||||
create: {
|
create: {
|
||||||
teamId,
|
teamId,
|
||||||
allowedDomains: settings.allowedDomains,
|
networkSandboxEnabled: settings.networkSandboxEnabled ?? false,
|
||||||
pendingDomains: settings.pendingDomains,
|
allowedDomains: settings.allowedDomains ?? [],
|
||||||
|
pendingDomains: settings.pendingDomains ?? [],
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
allowedDomains: settings.allowedDomains,
|
...(settings.networkSandboxEnabled !== undefined && {
|
||||||
pendingDomains: settings.pendingDomains,
|
networkSandboxEnabled: settings.networkSandboxEnabled,
|
||||||
|
}),
|
||||||
|
...(settings.allowedDomains !== undefined && {
|
||||||
|
allowedDomains: settings.allowedDomains,
|
||||||
|
}),
|
||||||
|
...(settings.pendingDomains !== undefined && {
|
||||||
|
pendingDomains: settings.pendingDomains,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
networkSandboxEnabled: sandbox.networkSandboxEnabled,
|
||||||
allowedDomains: sandbox.allowedDomains,
|
allowedDomains: sandbox.allowedDomains,
|
||||||
pendingDomains: sandbox.pendingDomains,
|
pendingDomains: sandbox.pendingDomains,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/db",
|
"name": "@shumai/db",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
-- Backfill autofillSource in config JSON where ai_autofill is true
|
||||||
|
UPDATE "metadata_fields"
|
||||||
|
SET "config" = jsonb_set(COALESCE("config", '{}'::jsonb), '{autofillSource}', '"CONTENT"')
|
||||||
|
WHERE "ai_autofill" = true;
|
||||||
|
|
||||||
|
UPDATE "metadata_fields"
|
||||||
|
SET "config" = jsonb_set(COALESCE("config", '{}'::jsonb), '{autofillSource}', '"NONE"')
|
||||||
|
WHERE "ai_autofill" = false OR "ai_autofill" IS NULL;
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `autofill_context` on the `assets` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `ai_autofill` on the `metadata_fields` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "assets" DROP COLUMN "autofill_context";
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "metadata_fields" DROP COLUMN "ai_autofill";
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "sandboxes" ADD COLUMN "network_sandbox_enabled" BOOLEAN NOT NULL DEFAULT false;
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
-- Data migration: set network_sandbox_enabled to true for existing legacy sandbox records
|
||||||
|
UPDATE "sandboxes" SET "network_sandbox_enabled" = true;
|
||||||
@@ -263,11 +263,12 @@ model Team {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Sandbox {
|
model Sandbox {
|
||||||
id String @id @default(ulid())
|
id String @id @default(ulid())
|
||||||
allowedDomains String[] @default(["npmjs.org", "*.npmjs.org", "registry.npmjs.org", "registry.yarnpkg.com", "pypi.org", "*.pypi.org", "github.com", "*.github.com", "api.github.com", "raw.githubusercontent.com"])
|
networkSandboxEnabled Boolean @default(false) @map("network_sandbox_enabled")
|
||||||
pendingDomains String[] @default([]) @map("pending_domains")
|
allowedDomains String[] @default(["npmjs.org", "*.npmjs.org", "registry.npmjs.org", "registry.yarnpkg.com", "pypi.org", "*.pypi.org", "github.com", "*.github.com", "api.github.com", "raw.githubusercontent.com"])
|
||||||
createdAt DateTime @default(now()) @map("created_at")
|
pendingDomains String[] @default([]) @map("pending_domains")
|
||||||
updatedAt DateTime @updatedAt @map("updated_at")
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
|
updatedAt DateTime @updatedAt @map("updated_at")
|
||||||
|
|
||||||
teamId String @unique @map("team_id")
|
teamId String @unique @map("team_id")
|
||||||
team Team @relation("TeamToSandbox", fields: [teamId], references: [id], onDelete: Cascade)
|
team Team @relation("TeamToSandbox", fields: [teamId], references: [id], onDelete: Cascade)
|
||||||
@@ -450,7 +451,6 @@ model Asset {
|
|||||||
transcodeTaskId String? @map("transcode_task_id")
|
transcodeTaskId String? @map("transcode_task_id")
|
||||||
/// [MediaInfo]
|
/// [MediaInfo]
|
||||||
media Json?
|
media Json?
|
||||||
autofillContext String? @map("autofill_context")
|
|
||||||
isDeleted Boolean @default(false) @map("is_deleted")
|
isDeleted Boolean @default(false) @map("is_deleted")
|
||||||
deletedAt DateTime? @map("deleted_at")
|
deletedAt DateTime? @map("deleted_at")
|
||||||
sortIndex String? @map("sort_index")
|
sortIndex String? @map("sort_index")
|
||||||
@@ -622,9 +622,8 @@ model MetadataField {
|
|||||||
scope MetadataFieldScope?
|
scope MetadataFieldScope?
|
||||||
/// [FieldConfig]
|
/// [FieldConfig]
|
||||||
config Json?
|
config Json?
|
||||||
readOnly Boolean @default(false) @map("read_only")
|
readOnly Boolean @default(false) @map("read_only")
|
||||||
aiAutofill Boolean @default(false) @map("ai_autofill")
|
description String @default("")
|
||||||
description String @default("")
|
|
||||||
|
|
||||||
teamId String? @map("team_id")
|
teamId String? @map("team_id")
|
||||||
team Team? @relation("TeamToMetadataField", fields: [teamId], references: [id])
|
team Team? @relation("TeamToMetadataField", fields: [teamId], references: [id])
|
||||||
|
|||||||
+4
-4
File diff suppressed because one or more lines are too long
@@ -3605,6 +3605,7 @@ export type TeamScalarFieldEnum = (typeof TeamScalarFieldEnum)[keyof typeof Team
|
|||||||
|
|
||||||
export const SandboxScalarFieldEnum = {
|
export const SandboxScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
|
networkSandboxEnabled: 'networkSandboxEnabled',
|
||||||
allowedDomains: 'allowedDomains',
|
allowedDomains: 'allowedDomains',
|
||||||
pendingDomains: 'pendingDomains',
|
pendingDomains: 'pendingDomains',
|
||||||
createdAt: 'createdAt',
|
createdAt: 'createdAt',
|
||||||
@@ -3738,7 +3739,6 @@ export const AssetScalarFieldEnum = {
|
|||||||
status: 'status',
|
status: 'status',
|
||||||
transcodeTaskId: 'transcodeTaskId',
|
transcodeTaskId: 'transcodeTaskId',
|
||||||
media: 'media',
|
media: 'media',
|
||||||
autofillContext: 'autofillContext',
|
|
||||||
isDeleted: 'isDeleted',
|
isDeleted: 'isDeleted',
|
||||||
deletedAt: 'deletedAt',
|
deletedAt: 'deletedAt',
|
||||||
sortIndex: 'sortIndex',
|
sortIndex: 'sortIndex',
|
||||||
@@ -3842,7 +3842,6 @@ export const MetadataFieldScalarFieldEnum = {
|
|||||||
scope: 'scope',
|
scope: 'scope',
|
||||||
config: 'config',
|
config: 'config',
|
||||||
readOnly: 'readOnly',
|
readOnly: 'readOnly',
|
||||||
aiAutofill: 'aiAutofill',
|
|
||||||
description: 'description',
|
description: 'description',
|
||||||
teamId: 'teamId',
|
teamId: 'teamId',
|
||||||
projectId: 'projectId'
|
projectId: 'projectId'
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ export type TeamScalarFieldEnum = (typeof TeamScalarFieldEnum)[keyof typeof Team
|
|||||||
|
|
||||||
export const SandboxScalarFieldEnum = {
|
export const SandboxScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
|
networkSandboxEnabled: 'networkSandboxEnabled',
|
||||||
allowedDomains: 'allowedDomains',
|
allowedDomains: 'allowedDomains',
|
||||||
pendingDomains: 'pendingDomains',
|
pendingDomains: 'pendingDomains',
|
||||||
createdAt: 'createdAt',
|
createdAt: 'createdAt',
|
||||||
@@ -331,7 +332,6 @@ export const AssetScalarFieldEnum = {
|
|||||||
status: 'status',
|
status: 'status',
|
||||||
transcodeTaskId: 'transcodeTaskId',
|
transcodeTaskId: 'transcodeTaskId',
|
||||||
media: 'media',
|
media: 'media',
|
||||||
autofillContext: 'autofillContext',
|
|
||||||
isDeleted: 'isDeleted',
|
isDeleted: 'isDeleted',
|
||||||
deletedAt: 'deletedAt',
|
deletedAt: 'deletedAt',
|
||||||
sortIndex: 'sortIndex',
|
sortIndex: 'sortIndex',
|
||||||
@@ -435,7 +435,6 @@ export const MetadataFieldScalarFieldEnum = {
|
|||||||
scope: 'scope',
|
scope: 'scope',
|
||||||
config: 'config',
|
config: 'config',
|
||||||
readOnly: 'readOnly',
|
readOnly: 'readOnly',
|
||||||
aiAutofill: 'aiAutofill',
|
|
||||||
description: 'description',
|
description: 'description',
|
||||||
teamId: 'teamId',
|
teamId: 'teamId',
|
||||||
projectId: 'projectId'
|
projectId: 'projectId'
|
||||||
|
|||||||
+1
-118
@@ -47,7 +47,6 @@ export type AssetMinAggregateOutputType = {
|
|||||||
sizeByte: bigint | null
|
sizeByte: bigint | null
|
||||||
status: $Enums.AssetStatus | null
|
status: $Enums.AssetStatus | null
|
||||||
transcodeTaskId: string | null
|
transcodeTaskId: string | null
|
||||||
autofillContext: string | null
|
|
||||||
isDeleted: boolean | null
|
isDeleted: boolean | null
|
||||||
deletedAt: Date | null
|
deletedAt: Date | null
|
||||||
sortIndex: string | null
|
sortIndex: string | null
|
||||||
@@ -70,7 +69,6 @@ export type AssetMaxAggregateOutputType = {
|
|||||||
sizeByte: bigint | null
|
sizeByte: bigint | null
|
||||||
status: $Enums.AssetStatus | null
|
status: $Enums.AssetStatus | null
|
||||||
transcodeTaskId: string | null
|
transcodeTaskId: string | null
|
||||||
autofillContext: string | null
|
|
||||||
isDeleted: boolean | null
|
isDeleted: boolean | null
|
||||||
deletedAt: Date | null
|
deletedAt: Date | null
|
||||||
sortIndex: string | null
|
sortIndex: string | null
|
||||||
@@ -95,7 +93,6 @@ export type AssetCountAggregateOutputType = {
|
|||||||
status: number
|
status: number
|
||||||
transcodeTaskId: number
|
transcodeTaskId: number
|
||||||
media:PrismaJson.MediaInfo
|
media:PrismaJson.MediaInfo
|
||||||
autofillContext: number
|
|
||||||
isDeleted: number
|
isDeleted: number
|
||||||
deletedAt: number
|
deletedAt: number
|
||||||
sortIndex: number
|
sortIndex: number
|
||||||
@@ -130,7 +127,6 @@ export type AssetMinAggregateInputType = {
|
|||||||
sizeByte?: true
|
sizeByte?: true
|
||||||
status?: true
|
status?: true
|
||||||
transcodeTaskId?: true
|
transcodeTaskId?: true
|
||||||
autofillContext?: true
|
|
||||||
isDeleted?: true
|
isDeleted?: true
|
||||||
deletedAt?: true
|
deletedAt?: true
|
||||||
sortIndex?: true
|
sortIndex?: true
|
||||||
@@ -153,7 +149,6 @@ export type AssetMaxAggregateInputType = {
|
|||||||
sizeByte?: true
|
sizeByte?: true
|
||||||
status?: true
|
status?: true
|
||||||
transcodeTaskId?: true
|
transcodeTaskId?: true
|
||||||
autofillContext?: true
|
|
||||||
isDeleted?: true
|
isDeleted?: true
|
||||||
deletedAt?: true
|
deletedAt?: true
|
||||||
sortIndex?: true
|
sortIndex?: true
|
||||||
@@ -178,7 +173,6 @@ export type AssetCountAggregateInputType = {
|
|||||||
status?: true
|
status?: true
|
||||||
transcodeTaskId?: true
|
transcodeTaskId?: true
|
||||||
media?: true
|
media?: true
|
||||||
autofillContext?: true
|
|
||||||
isDeleted?: true
|
isDeleted?: true
|
||||||
deletedAt?: true
|
deletedAt?: true
|
||||||
sortIndex?: true
|
sortIndex?: true
|
||||||
@@ -290,7 +284,6 @@ export type AssetGroupByOutputType = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId: string | null
|
transcodeTaskId: string | null
|
||||||
media:PrismaJson.MediaInfo | null
|
media:PrismaJson.MediaInfo | null
|
||||||
autofillContext: string | null
|
|
||||||
isDeleted: boolean
|
isDeleted: boolean
|
||||||
deletedAt: Date | null
|
deletedAt: Date | null
|
||||||
sortIndex: string | null
|
sortIndex: string | null
|
||||||
@@ -338,7 +331,6 @@ export type AssetWhereInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
media?: Prisma.JsonNullableFilter<"Asset">
|
media?: Prisma.JsonNullableFilter<"Asset">
|
||||||
autofillContext?: Prisma.StringNullableFilter<"Asset"> | string | null
|
|
||||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
@@ -382,7 +374,6 @@ export type AssetOrderByWithRelationInput = {
|
|||||||
status?: Prisma.SortOrder
|
status?: Prisma.SortOrder
|
||||||
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
autofillContext?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
||||||
isDeleted?: Prisma.SortOrder
|
isDeleted?: Prisma.SortOrder
|
||||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -430,7 +421,6 @@ export type AssetWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
media?: Prisma.JsonNullableFilter<"Asset">
|
media?: Prisma.JsonNullableFilter<"Asset">
|
||||||
autofillContext?: Prisma.StringNullableFilter<"Asset"> | string | null
|
|
||||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
@@ -474,7 +464,6 @@ export type AssetOrderByWithAggregationInput = {
|
|||||||
status?: Prisma.SortOrder
|
status?: Prisma.SortOrder
|
||||||
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
transcodeTaskId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
media?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
autofillContext?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
||||||
isDeleted?: Prisma.SortOrder
|
isDeleted?: Prisma.SortOrder
|
||||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
sortIndex?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -507,7 +496,6 @@ export type AssetScalarWhereWithAggregatesInput = {
|
|||||||
status?: Prisma.EnumAssetStatusWithAggregatesFilter<"Asset"> | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusWithAggregatesFilter<"Asset"> | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
transcodeTaskId?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
||||||
media?: Prisma.JsonNullableWithAggregatesFilter<"Asset">
|
media?: Prisma.JsonNullableWithAggregatesFilter<"Asset">
|
||||||
autofillContext?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
|
||||||
isDeleted?: Prisma.BoolWithAggregatesFilter<"Asset"> | boolean
|
isDeleted?: Prisma.BoolWithAggregatesFilter<"Asset"> | boolean
|
||||||
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Asset"> | Date | string | null
|
deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Asset"> | Date | string | null
|
||||||
sortIndex?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
sortIndex?: Prisma.StringNullableWithAggregatesFilter<"Asset"> | string | null
|
||||||
@@ -532,7 +520,6 @@ export type AssetCreateInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -570,7 +557,6 @@ export type AssetUncheckedCreateInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -608,7 +594,6 @@ export type AssetUpdateInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -646,7 +631,6 @@ export type AssetUncheckedUpdateInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -684,7 +668,6 @@ export type AssetCreateManyInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -709,7 +692,6 @@ export type AssetUpdateManyMutationInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -728,7 +710,6 @@ export type AssetUncheckedUpdateManyInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -778,7 +759,6 @@ export type AssetCountOrderByAggregateInput = {
|
|||||||
status?: Prisma.SortOrder
|
status?: Prisma.SortOrder
|
||||||
transcodeTaskId?: Prisma.SortOrder
|
transcodeTaskId?: Prisma.SortOrder
|
||||||
media?: Prisma.SortOrder
|
media?: Prisma.SortOrder
|
||||||
autofillContext?: Prisma.SortOrder
|
|
||||||
isDeleted?: Prisma.SortOrder
|
isDeleted?: Prisma.SortOrder
|
||||||
deletedAt?: Prisma.SortOrder
|
deletedAt?: Prisma.SortOrder
|
||||||
sortIndex?: Prisma.SortOrder
|
sortIndex?: Prisma.SortOrder
|
||||||
@@ -806,7 +786,6 @@ export type AssetMaxOrderByAggregateInput = {
|
|||||||
sizeByte?: Prisma.SortOrder
|
sizeByte?: Prisma.SortOrder
|
||||||
status?: Prisma.SortOrder
|
status?: Prisma.SortOrder
|
||||||
transcodeTaskId?: Prisma.SortOrder
|
transcodeTaskId?: Prisma.SortOrder
|
||||||
autofillContext?: Prisma.SortOrder
|
|
||||||
isDeleted?: Prisma.SortOrder
|
isDeleted?: Prisma.SortOrder
|
||||||
deletedAt?: Prisma.SortOrder
|
deletedAt?: Prisma.SortOrder
|
||||||
sortIndex?: Prisma.SortOrder
|
sortIndex?: Prisma.SortOrder
|
||||||
@@ -829,7 +808,6 @@ export type AssetMinOrderByAggregateInput = {
|
|||||||
sizeByte?: Prisma.SortOrder
|
sizeByte?: Prisma.SortOrder
|
||||||
status?: Prisma.SortOrder
|
status?: Prisma.SortOrder
|
||||||
transcodeTaskId?: Prisma.SortOrder
|
transcodeTaskId?: Prisma.SortOrder
|
||||||
autofillContext?: Prisma.SortOrder
|
|
||||||
isDeleted?: Prisma.SortOrder
|
isDeleted?: Prisma.SortOrder
|
||||||
deletedAt?: Prisma.SortOrder
|
deletedAt?: Prisma.SortOrder
|
||||||
sortIndex?: Prisma.SortOrder
|
sortIndex?: Prisma.SortOrder
|
||||||
@@ -1340,7 +1318,6 @@ export type AssetCreateWithoutCreatorInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1377,7 +1354,6 @@ export type AssetUncheckedCreateWithoutCreatorInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1443,7 +1419,6 @@ export type AssetScalarWhereInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFilter<"Asset"> | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
transcodeTaskId?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
media?: Prisma.JsonNullableFilter<"Asset">
|
media?: Prisma.JsonNullableFilter<"Asset">
|
||||||
autofillContext?: Prisma.StringNullableFilter<"Asset"> | string | null
|
|
||||||
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
isDeleted?: Prisma.BoolFilter<"Asset"> | boolean
|
||||||
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
deletedAt?: Prisma.DateTimeNullableFilter<"Asset"> | Date | string | null
|
||||||
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
sortIndex?: Prisma.StringNullableFilter<"Asset"> | string | null
|
||||||
@@ -1468,7 +1443,6 @@ export type AssetCreateWithoutTeamRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1505,7 +1479,6 @@ export type AssetUncheckedCreateWithoutTeamRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1558,7 +1531,6 @@ export type AssetUpdateWithoutTeamRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1595,7 +1567,6 @@ export type AssetUncheckedUpdateWithoutTeamRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1632,7 +1603,6 @@ export type AssetCreateWithoutProjectRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1669,7 +1639,6 @@ export type AssetUncheckedCreateWithoutProjectRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1711,7 +1680,6 @@ export type AssetCreateWithoutProjectShareRootInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1748,7 +1716,6 @@ export type AssetUncheckedCreateWithoutProjectShareRootInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1790,7 +1757,6 @@ export type AssetCreateWithoutProjectInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1827,7 +1793,6 @@ export type AssetUncheckedCreateWithoutProjectInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -1885,7 +1850,6 @@ export type AssetUpdateWithoutProjectRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1922,7 +1886,6 @@ export type AssetUncheckedUpdateWithoutProjectRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -1970,7 +1933,6 @@ export type AssetUpdateWithoutProjectShareRootInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2007,7 +1969,6 @@ export type AssetUncheckedUpdateWithoutProjectShareRootInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2060,7 +2021,6 @@ export type AssetCreateWithoutShareLinkRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2097,7 +2057,6 @@ export type AssetUncheckedCreateWithoutShareLinkRootFolderInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2150,7 +2109,6 @@ export type AssetUpdateWithoutShareLinkRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2187,7 +2145,6 @@ export type AssetUncheckedUpdateWithoutShareLinkRootFolderInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2224,7 +2181,6 @@ export type AssetCreateWithoutWatermarkFilesInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2261,7 +2217,6 @@ export type AssetUncheckedCreateWithoutWatermarkFilesInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2314,7 +2269,6 @@ export type AssetUpdateWithoutWatermarkFilesInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2351,7 +2305,6 @@ export type AssetUncheckedUpdateWithoutWatermarkFilesInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2388,7 +2341,6 @@ export type AssetCreateWithoutChildrenInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2425,7 +2377,6 @@ export type AssetUncheckedCreateWithoutChildrenInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2467,7 +2418,6 @@ export type AssetCreateWithoutParentInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2504,7 +2454,6 @@ export type AssetUncheckedCreateWithoutParentInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2551,7 +2500,6 @@ export type AssetCreateWithoutSymlinksInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2588,7 +2536,6 @@ export type AssetUncheckedCreateWithoutSymlinksInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2630,7 +2577,6 @@ export type AssetCreateWithoutTargetInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2667,7 +2613,6 @@ export type AssetUncheckedCreateWithoutTargetInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2725,7 +2670,6 @@ export type AssetUpdateWithoutChildrenInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2762,7 +2706,6 @@ export type AssetUncheckedUpdateWithoutChildrenInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2826,7 +2769,6 @@ export type AssetUpdateWithoutSymlinksInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2863,7 +2805,6 @@ export type AssetUncheckedUpdateWithoutSymlinksInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -2916,7 +2857,6 @@ export type AssetCreateWithoutStorageKeyInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -2953,7 +2893,6 @@ export type AssetUncheckedCreateWithoutStorageKeyInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3016,7 +2955,6 @@ export type AssetCreateWithoutMetadataValuesInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3053,7 +2991,6 @@ export type AssetUncheckedCreateWithoutMetadataValuesInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3106,7 +3043,6 @@ export type AssetUpdateWithoutMetadataValuesInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3143,7 +3079,6 @@ export type AssetUncheckedUpdateWithoutMetadataValuesInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3180,7 +3115,6 @@ export type AssetCreateWithoutCommentsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3217,7 +3151,6 @@ export type AssetUncheckedCreateWithoutCommentsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3270,7 +3203,6 @@ export type AssetUpdateWithoutCommentsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3307,7 +3239,6 @@ export type AssetUncheckedUpdateWithoutCommentsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3344,7 +3275,6 @@ export type AssetCreateWithoutCommentAttachmentsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3381,7 +3311,6 @@ export type AssetUncheckedCreateWithoutCommentAttachmentsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3434,7 +3363,6 @@ export type AssetUpdateWithoutCommentAttachmentsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3471,7 +3399,6 @@ export type AssetUncheckedUpdateWithoutCommentAttachmentsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3508,7 +3435,6 @@ export type AssetCreateWithoutEmbeddingsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3545,7 +3471,6 @@ export type AssetUncheckedCreateWithoutEmbeddingsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3598,7 +3523,6 @@ export type AssetUpdateWithoutEmbeddingsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3635,7 +3559,6 @@ export type AssetUncheckedUpdateWithoutEmbeddingsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3672,7 +3595,6 @@ export type AssetCreateWithoutNotificationsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3709,7 +3631,6 @@ export type AssetUncheckedCreateWithoutNotificationsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3762,7 +3683,6 @@ export type AssetUpdateWithoutNotificationsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3799,7 +3719,6 @@ export type AssetUncheckedUpdateWithoutNotificationsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -3836,7 +3755,6 @@ export type AssetCreateWithoutTaskInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3873,7 +3791,6 @@ export type AssetUncheckedCreateWithoutTaskInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3936,7 +3853,6 @@ export type AssetCreateWithoutAgentSessionsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -3973,7 +3889,6 @@ export type AssetUncheckedCreateWithoutAgentSessionsInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4026,7 +3941,6 @@ export type AssetUpdateWithoutAgentSessionsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4063,7 +3977,6 @@ export type AssetUncheckedUpdateWithoutAgentSessionsInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4100,7 +4013,6 @@ export type AssetCreateManyCreatorInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4124,7 +4036,6 @@ export type AssetUpdateWithoutCreatorInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4161,7 +4072,6 @@ export type AssetUncheckedUpdateWithoutCreatorInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4198,7 +4108,6 @@ export type AssetUncheckedUpdateManyWithoutCreatorInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4222,7 +4131,6 @@ export type AssetCreateManyProjectInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4246,7 +4154,6 @@ export type AssetUpdateWithoutProjectInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4283,7 +4190,6 @@ export type AssetUncheckedUpdateWithoutProjectInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4320,7 +4226,6 @@ export type AssetUncheckedUpdateManyWithoutProjectInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4344,7 +4249,6 @@ export type AssetCreateManyParentInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4368,7 +4272,6 @@ export type AssetCreateManyTargetInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4392,7 +4295,6 @@ export type AssetUpdateWithoutParentInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4429,7 +4331,6 @@ export type AssetUncheckedUpdateWithoutParentInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4466,7 +4367,6 @@ export type AssetUncheckedUpdateManyWithoutParentInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4490,7 +4390,6 @@ export type AssetUpdateWithoutTargetInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4527,7 +4426,6 @@ export type AssetUncheckedUpdateWithoutTargetInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4564,7 +4462,6 @@ export type AssetUncheckedUpdateManyWithoutTargetInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4588,7 +4485,6 @@ export type AssetCreateManyStorageKeyInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4612,7 +4508,6 @@ export type AssetUpdateWithoutStorageKeyInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4649,7 +4544,6 @@ export type AssetUncheckedUpdateWithoutStorageKeyInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4686,7 +4580,6 @@ export type AssetUncheckedUpdateManyWithoutStorageKeyInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4710,7 +4603,6 @@ export type AssetCreateManyTaskInput = {
|
|||||||
status: $Enums.AssetStatus
|
status: $Enums.AssetStatus
|
||||||
transcodeTaskId?: string | null
|
transcodeTaskId?: string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: string | null
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
sortIndex?: string | null
|
sortIndex?: string | null
|
||||||
@@ -4734,7 +4626,6 @@ export type AssetUpdateWithoutTaskInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4771,7 +4662,6 @@ export type AssetUncheckedUpdateWithoutTaskInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4808,7 +4698,6 @@ export type AssetUncheckedUpdateManyWithoutTaskInput = {
|
|||||||
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
status?: Prisma.EnumAssetStatusFieldUpdateOperationsInput | $Enums.AssetStatus
|
||||||
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
transcodeTaskId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
media?:PrismaJson.MediaInfo | Prisma.NullableJsonNullValueInput
|
||||||
autofillContext?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
isDeleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
sortIndex?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -4935,7 +4824,6 @@ export type AssetSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
|||||||
status?: boolean
|
status?: boolean
|
||||||
transcodeTaskId?: boolean
|
transcodeTaskId?: boolean
|
||||||
media?: boolean
|
media?: boolean
|
||||||
autofillContext?: boolean
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: boolean
|
deletedAt?: boolean
|
||||||
sortIndex?: boolean
|
sortIndex?: boolean
|
||||||
@@ -4980,7 +4868,6 @@ export type AssetSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
|||||||
status?: boolean
|
status?: boolean
|
||||||
transcodeTaskId?: boolean
|
transcodeTaskId?: boolean
|
||||||
media?: boolean
|
media?: boolean
|
||||||
autofillContext?: boolean
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: boolean
|
deletedAt?: boolean
|
||||||
sortIndex?: boolean
|
sortIndex?: boolean
|
||||||
@@ -5011,7 +4898,6 @@ export type AssetSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
|||||||
status?: boolean
|
status?: boolean
|
||||||
transcodeTaskId?: boolean
|
transcodeTaskId?: boolean
|
||||||
media?: boolean
|
media?: boolean
|
||||||
autofillContext?: boolean
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: boolean
|
deletedAt?: boolean
|
||||||
sortIndex?: boolean
|
sortIndex?: boolean
|
||||||
@@ -5042,7 +4928,6 @@ export type AssetSelectScalar = {
|
|||||||
status?: boolean
|
status?: boolean
|
||||||
transcodeTaskId?: boolean
|
transcodeTaskId?: boolean
|
||||||
media?: boolean
|
media?: boolean
|
||||||
autofillContext?: boolean
|
|
||||||
isDeleted?: boolean
|
isDeleted?: boolean
|
||||||
deletedAt?: boolean
|
deletedAt?: boolean
|
||||||
sortIndex?: boolean
|
sortIndex?: boolean
|
||||||
@@ -5056,7 +4941,7 @@ export type AssetSelectScalar = {
|
|||||||
projectId?: boolean
|
projectId?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AssetOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "nameNgram" | "type" | "mediaType" | "fileCount" | "sizeByte" | "status" | "transcodeTaskId" | "media" | "autofillContext" | "isDeleted" | "deletedAt" | "sortIndex" | "createdAt" | "updatedAt" | "parentId" | "targetId" | "storageKeyId" | "creatorId" | "taskId" | "projectId", ExtArgs["result"]["asset"]>
|
export type AssetOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "nameNgram" | "type" | "mediaType" | "fileCount" | "sizeByte" | "status" | "transcodeTaskId" | "media" | "isDeleted" | "deletedAt" | "sortIndex" | "createdAt" | "updatedAt" | "parentId" | "targetId" | "storageKeyId" | "creatorId" | "taskId" | "projectId", ExtArgs["result"]["asset"]>
|
||||||
export type AssetInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type AssetInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
parent?: boolean | Prisma.Asset$parentArgs<ExtArgs>
|
parent?: boolean | Prisma.Asset$parentArgs<ExtArgs>
|
||||||
children?: boolean | Prisma.Asset$childrenArgs<ExtArgs>
|
children?: boolean | Prisma.Asset$childrenArgs<ExtArgs>
|
||||||
@@ -5133,7 +5018,6 @@ export type $AssetPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
|||||||
* [MediaInfo]
|
* [MediaInfo]
|
||||||
*/
|
*/
|
||||||
media:PrismaJson.MediaInfo | null
|
media:PrismaJson.MediaInfo | null
|
||||||
autofillContext: string | null
|
|
||||||
isDeleted: boolean
|
isDeleted: boolean
|
||||||
deletedAt: Date | null
|
deletedAt: Date | null
|
||||||
sortIndex: string | null
|
sortIndex: string | null
|
||||||
@@ -5597,7 +5481,6 @@ export interface AssetFieldRefs {
|
|||||||
readonly status: Prisma.FieldRef<"Asset", 'AssetStatus'>
|
readonly status: Prisma.FieldRef<"Asset", 'AssetStatus'>
|
||||||
readonly transcodeTaskId: Prisma.FieldRef<"Asset", 'String'>
|
readonly transcodeTaskId: Prisma.FieldRef<"Asset", 'String'>
|
||||||
readonly media: Prisma.FieldRef<"Asset", 'Json'>
|
readonly media: Prisma.FieldRef<"Asset", 'Json'>
|
||||||
readonly autofillContext: Prisma.FieldRef<"Asset", 'String'>
|
|
||||||
readonly isDeleted: Prisma.FieldRef<"Asset", 'Boolean'>
|
readonly isDeleted: Prisma.FieldRef<"Asset", 'Boolean'>
|
||||||
readonly deletedAt: Prisma.FieldRef<"Asset", 'DateTime'>
|
readonly deletedAt: Prisma.FieldRef<"Asset", 'DateTime'>
|
||||||
readonly sortIndex: Prisma.FieldRef<"Asset", 'String'>
|
readonly sortIndex: Prisma.FieldRef<"Asset", 'String'>
|
||||||
|
|||||||
+1
-42
@@ -31,7 +31,6 @@ export type MetadataFieldMinAggregateOutputType = {
|
|||||||
key: string | null
|
key: string | null
|
||||||
scope: $Enums.MetadataFieldScope | null
|
scope: $Enums.MetadataFieldScope | null
|
||||||
readOnly: boolean | null
|
readOnly: boolean | null
|
||||||
aiAutofill: boolean | null
|
|
||||||
description: string | null
|
description: string | null
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
projectId: string | null
|
projectId: string | null
|
||||||
@@ -42,7 +41,6 @@ export type MetadataFieldMaxAggregateOutputType = {
|
|||||||
key: string | null
|
key: string | null
|
||||||
scope: $Enums.MetadataFieldScope | null
|
scope: $Enums.MetadataFieldScope | null
|
||||||
readOnly: boolean | null
|
readOnly: boolean | null
|
||||||
aiAutofill: boolean | null
|
|
||||||
description: string | null
|
description: string | null
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
projectId: string | null
|
projectId: string | null
|
||||||
@@ -54,7 +52,6 @@ export type MetadataFieldCountAggregateOutputType = {
|
|||||||
scope: number
|
scope: number
|
||||||
config:PrismaJson.FieldConfig
|
config:PrismaJson.FieldConfig
|
||||||
readOnly: number
|
readOnly: number
|
||||||
aiAutofill: number
|
|
||||||
description: number
|
description: number
|
||||||
teamId: number
|
teamId: number
|
||||||
projectId: number
|
projectId: number
|
||||||
@@ -67,7 +64,6 @@ export type MetadataFieldMinAggregateInputType = {
|
|||||||
key?: true
|
key?: true
|
||||||
scope?: true
|
scope?: true
|
||||||
readOnly?: true
|
readOnly?: true
|
||||||
aiAutofill?: true
|
|
||||||
description?: true
|
description?: true
|
||||||
teamId?: true
|
teamId?: true
|
||||||
projectId?: true
|
projectId?: true
|
||||||
@@ -78,7 +74,6 @@ export type MetadataFieldMaxAggregateInputType = {
|
|||||||
key?: true
|
key?: true
|
||||||
scope?: true
|
scope?: true
|
||||||
readOnly?: true
|
readOnly?: true
|
||||||
aiAutofill?: true
|
|
||||||
description?: true
|
description?: true
|
||||||
teamId?: true
|
teamId?: true
|
||||||
projectId?: true
|
projectId?: true
|
||||||
@@ -90,7 +85,6 @@ export type MetadataFieldCountAggregateInputType = {
|
|||||||
scope?: true
|
scope?: true
|
||||||
config?: true
|
config?: true
|
||||||
readOnly?: true
|
readOnly?: true
|
||||||
aiAutofill?: true
|
|
||||||
description?: true
|
description?: true
|
||||||
teamId?: true
|
teamId?: true
|
||||||
projectId?: true
|
projectId?: true
|
||||||
@@ -175,7 +169,6 @@ export type MetadataFieldGroupByOutputType = {
|
|||||||
scope: $Enums.MetadataFieldScope | null
|
scope: $Enums.MetadataFieldScope | null
|
||||||
config:PrismaJson.FieldConfig | null
|
config:PrismaJson.FieldConfig | null
|
||||||
readOnly: boolean
|
readOnly: boolean
|
||||||
aiAutofill: boolean
|
|
||||||
description: string
|
description: string
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
projectId: string | null
|
projectId: string | null
|
||||||
@@ -208,7 +201,6 @@ export type MetadataFieldWhereInput = {
|
|||||||
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
||||||
config?: Prisma.JsonNullableFilter<"MetadataField">
|
config?: Prisma.JsonNullableFilter<"MetadataField">
|
||||||
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
||||||
aiAutofill?: Prisma.BoolFilter<"MetadataField"> | boolean
|
|
||||||
description?: Prisma.StringFilter<"MetadataField"> | string
|
description?: Prisma.StringFilter<"MetadataField"> | string
|
||||||
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
@@ -222,7 +214,6 @@ export type MetadataFieldOrderByWithRelationInput = {
|
|||||||
scope?: Prisma.SortOrderInput | Prisma.SortOrder
|
scope?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
config?: Prisma.SortOrderInput | Prisma.SortOrder
|
config?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
readOnly?: Prisma.SortOrder
|
readOnly?: Prisma.SortOrder
|
||||||
aiAutofill?: Prisma.SortOrder
|
|
||||||
description?: Prisma.SortOrder
|
description?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrderInput | Prisma.SortOrder
|
teamId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
|
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -239,7 +230,6 @@ export type MetadataFieldWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
||||||
config?: Prisma.JsonNullableFilter<"MetadataField">
|
config?: Prisma.JsonNullableFilter<"MetadataField">
|
||||||
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
||||||
aiAutofill?: Prisma.BoolFilter<"MetadataField"> | boolean
|
|
||||||
description?: Prisma.StringFilter<"MetadataField"> | string
|
description?: Prisma.StringFilter<"MetadataField"> | string
|
||||||
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
@@ -253,7 +243,6 @@ export type MetadataFieldOrderByWithAggregationInput = {
|
|||||||
scope?: Prisma.SortOrderInput | Prisma.SortOrder
|
scope?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
config?: Prisma.SortOrderInput | Prisma.SortOrder
|
config?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
readOnly?: Prisma.SortOrder
|
readOnly?: Prisma.SortOrder
|
||||||
aiAutofill?: Prisma.SortOrder
|
|
||||||
description?: Prisma.SortOrder
|
description?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrderInput | Prisma.SortOrder
|
teamId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
|
projectId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||||
@@ -271,7 +260,6 @@ export type MetadataFieldScalarWhereWithAggregatesInput = {
|
|||||||
scope?: Prisma.EnumMetadataFieldScopeNullableWithAggregatesFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
scope?: Prisma.EnumMetadataFieldScopeNullableWithAggregatesFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
||||||
config?: Prisma.JsonNullableWithAggregatesFilter<"MetadataField">
|
config?: Prisma.JsonNullableWithAggregatesFilter<"MetadataField">
|
||||||
readOnly?: Prisma.BoolWithAggregatesFilter<"MetadataField"> | boolean
|
readOnly?: Prisma.BoolWithAggregatesFilter<"MetadataField"> | boolean
|
||||||
aiAutofill?: Prisma.BoolWithAggregatesFilter<"MetadataField"> | boolean
|
|
||||||
description?: Prisma.StringWithAggregatesFilter<"MetadataField"> | string
|
description?: Prisma.StringWithAggregatesFilter<"MetadataField"> | string
|
||||||
teamId?: Prisma.StringNullableWithAggregatesFilter<"MetadataField"> | string | null
|
teamId?: Prisma.StringNullableWithAggregatesFilter<"MetadataField"> | string | null
|
||||||
projectId?: Prisma.StringNullableWithAggregatesFilter<"MetadataField"> | string | null
|
projectId?: Prisma.StringNullableWithAggregatesFilter<"MetadataField"> | string | null
|
||||||
@@ -283,7 +271,6 @@ export type MetadataFieldCreateInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
team?: Prisma.TeamCreateNestedOneWithoutMetadataFieldsInput
|
team?: Prisma.TeamCreateNestedOneWithoutMetadataFieldsInput
|
||||||
project?: Prisma.ProjectCreateNestedOneWithoutMetadataFieldsInput
|
project?: Prisma.ProjectCreateNestedOneWithoutMetadataFieldsInput
|
||||||
@@ -295,7 +282,6 @@ export type MetadataFieldUncheckedCreateInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
teamId?: string | null
|
teamId?: string | null
|
||||||
projectId?: string | null
|
projectId?: string | null
|
||||||
@@ -307,7 +293,6 @@ export type MetadataFieldUpdateInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
team?: Prisma.TeamUpdateOneWithoutMetadataFieldsNestedInput
|
team?: Prisma.TeamUpdateOneWithoutMetadataFieldsNestedInput
|
||||||
project?: Prisma.ProjectUpdateOneWithoutMetadataFieldsNestedInput
|
project?: Prisma.ProjectUpdateOneWithoutMetadataFieldsNestedInput
|
||||||
@@ -319,7 +304,6 @@ export type MetadataFieldUncheckedUpdateInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -331,7 +315,6 @@ export type MetadataFieldCreateManyInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
teamId?: string | null
|
teamId?: string | null
|
||||||
projectId?: string | null
|
projectId?: string | null
|
||||||
@@ -343,7 +326,6 @@ export type MetadataFieldUpdateManyMutationInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +335,6 @@ export type MetadataFieldUncheckedUpdateManyInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
@@ -375,7 +356,6 @@ export type MetadataFieldCountOrderByAggregateInput = {
|
|||||||
scope?: Prisma.SortOrder
|
scope?: Prisma.SortOrder
|
||||||
config?: Prisma.SortOrder
|
config?: Prisma.SortOrder
|
||||||
readOnly?: Prisma.SortOrder
|
readOnly?: Prisma.SortOrder
|
||||||
aiAutofill?: Prisma.SortOrder
|
|
||||||
description?: Prisma.SortOrder
|
description?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrder
|
teamId?: Prisma.SortOrder
|
||||||
projectId?: Prisma.SortOrder
|
projectId?: Prisma.SortOrder
|
||||||
@@ -386,7 +366,6 @@ export type MetadataFieldMaxOrderByAggregateInput = {
|
|||||||
key?: Prisma.SortOrder
|
key?: Prisma.SortOrder
|
||||||
scope?: Prisma.SortOrder
|
scope?: Prisma.SortOrder
|
||||||
readOnly?: Prisma.SortOrder
|
readOnly?: Prisma.SortOrder
|
||||||
aiAutofill?: Prisma.SortOrder
|
|
||||||
description?: Prisma.SortOrder
|
description?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrder
|
teamId?: Prisma.SortOrder
|
||||||
projectId?: Prisma.SortOrder
|
projectId?: Prisma.SortOrder
|
||||||
@@ -397,7 +376,6 @@ export type MetadataFieldMinOrderByAggregateInput = {
|
|||||||
key?: Prisma.SortOrder
|
key?: Prisma.SortOrder
|
||||||
scope?: Prisma.SortOrder
|
scope?: Prisma.SortOrder
|
||||||
readOnly?: Prisma.SortOrder
|
readOnly?: Prisma.SortOrder
|
||||||
aiAutofill?: Prisma.SortOrder
|
|
||||||
description?: Prisma.SortOrder
|
description?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrder
|
teamId?: Prisma.SortOrder
|
||||||
projectId?: Prisma.SortOrder
|
projectId?: Prisma.SortOrder
|
||||||
@@ -497,7 +475,6 @@ export type MetadataFieldCreateWithoutTeamInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
project?: Prisma.ProjectCreateNestedOneWithoutMetadataFieldsInput
|
project?: Prisma.ProjectCreateNestedOneWithoutMetadataFieldsInput
|
||||||
}
|
}
|
||||||
@@ -508,7 +485,6 @@ export type MetadataFieldUncheckedCreateWithoutTeamInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
projectId?: string | null
|
projectId?: string | null
|
||||||
}
|
}
|
||||||
@@ -548,7 +524,6 @@ export type MetadataFieldScalarWhereInput = {
|
|||||||
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
scope?: Prisma.EnumMetadataFieldScopeNullableFilter<"MetadataField"> | $Enums.MetadataFieldScope | null
|
||||||
config?: Prisma.JsonNullableFilter<"MetadataField">
|
config?: Prisma.JsonNullableFilter<"MetadataField">
|
||||||
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
readOnly?: Prisma.BoolFilter<"MetadataField"> | boolean
|
||||||
aiAutofill?: Prisma.BoolFilter<"MetadataField"> | boolean
|
|
||||||
description?: Prisma.StringFilter<"MetadataField"> | string
|
description?: Prisma.StringFilter<"MetadataField"> | string
|
||||||
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
teamId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
projectId?: Prisma.StringNullableFilter<"MetadataField"> | string | null
|
||||||
@@ -560,7 +535,6 @@ export type MetadataFieldCreateWithoutProjectInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
team?: Prisma.TeamCreateNestedOneWithoutMetadataFieldsInput
|
team?: Prisma.TeamCreateNestedOneWithoutMetadataFieldsInput
|
||||||
}
|
}
|
||||||
@@ -571,7 +545,6 @@ export type MetadataFieldUncheckedCreateWithoutProjectInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
teamId?: string | null
|
teamId?: string | null
|
||||||
}
|
}
|
||||||
@@ -608,7 +581,6 @@ export type MetadataFieldCreateManyTeamInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
projectId?: string | null
|
projectId?: string | null
|
||||||
}
|
}
|
||||||
@@ -619,7 +591,6 @@ export type MetadataFieldUpdateWithoutTeamInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
project?: Prisma.ProjectUpdateOneWithoutMetadataFieldsNestedInput
|
project?: Prisma.ProjectUpdateOneWithoutMetadataFieldsNestedInput
|
||||||
}
|
}
|
||||||
@@ -630,7 +601,6 @@ export type MetadataFieldUncheckedUpdateWithoutTeamInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
}
|
}
|
||||||
@@ -641,7 +611,6 @@ export type MetadataFieldUncheckedUpdateManyWithoutTeamInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
}
|
}
|
||||||
@@ -652,7 +621,6 @@ export type MetadataFieldCreateManyProjectInput = {
|
|||||||
scope?: $Enums.MetadataFieldScope | null
|
scope?: $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: string
|
description?: string
|
||||||
teamId?: string | null
|
teamId?: string | null
|
||||||
}
|
}
|
||||||
@@ -663,7 +631,6 @@ export type MetadataFieldUpdateWithoutProjectInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
team?: Prisma.TeamUpdateOneWithoutMetadataFieldsNestedInput
|
team?: Prisma.TeamUpdateOneWithoutMetadataFieldsNestedInput
|
||||||
}
|
}
|
||||||
@@ -674,7 +641,6 @@ export type MetadataFieldUncheckedUpdateWithoutProjectInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
}
|
}
|
||||||
@@ -685,7 +651,6 @@ export type MetadataFieldUncheckedUpdateManyWithoutProjectInput = {
|
|||||||
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
scope?: Prisma.NullableEnumMetadataFieldScopeFieldUpdateOperationsInput | $Enums.MetadataFieldScope | null
|
||||||
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
config?:PrismaJson.FieldConfig | Prisma.NullableJsonNullValueInput
|
||||||
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
readOnly?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
aiAutofill?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
|
||||||
description?: Prisma.StringFieldUpdateOperationsInput | string
|
description?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
teamId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||||
}
|
}
|
||||||
@@ -698,7 +663,6 @@ export type MetadataFieldSelect<ExtArgs extends runtime.Types.Extensions.Interna
|
|||||||
scope?: boolean
|
scope?: boolean
|
||||||
config?: boolean
|
config?: boolean
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: boolean
|
description?: boolean
|
||||||
teamId?: boolean
|
teamId?: boolean
|
||||||
projectId?: boolean
|
projectId?: boolean
|
||||||
@@ -712,7 +676,6 @@ export type MetadataFieldSelectCreateManyAndReturn<ExtArgs extends runtime.Types
|
|||||||
scope?: boolean
|
scope?: boolean
|
||||||
config?: boolean
|
config?: boolean
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: boolean
|
description?: boolean
|
||||||
teamId?: boolean
|
teamId?: boolean
|
||||||
projectId?: boolean
|
projectId?: boolean
|
||||||
@@ -726,7 +689,6 @@ export type MetadataFieldSelectUpdateManyAndReturn<ExtArgs extends runtime.Types
|
|||||||
scope?: boolean
|
scope?: boolean
|
||||||
config?: boolean
|
config?: boolean
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: boolean
|
description?: boolean
|
||||||
teamId?: boolean
|
teamId?: boolean
|
||||||
projectId?: boolean
|
projectId?: boolean
|
||||||
@@ -740,13 +702,12 @@ export type MetadataFieldSelectScalar = {
|
|||||||
scope?: boolean
|
scope?: boolean
|
||||||
config?: boolean
|
config?: boolean
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
aiAutofill?: boolean
|
|
||||||
description?: boolean
|
description?: boolean
|
||||||
teamId?: boolean
|
teamId?: boolean
|
||||||
projectId?: boolean
|
projectId?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MetadataFieldOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "scope" | "config" | "readOnly" | "aiAutofill" | "description" | "teamId" | "projectId", ExtArgs["result"]["metadataField"]>
|
export type MetadataFieldOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "scope" | "config" | "readOnly" | "description" | "teamId" | "projectId", ExtArgs["result"]["metadataField"]>
|
||||||
export type MetadataFieldInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type MetadataFieldInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
team?: boolean | Prisma.MetadataField$teamArgs<ExtArgs>
|
team?: boolean | Prisma.MetadataField$teamArgs<ExtArgs>
|
||||||
project?: boolean | Prisma.MetadataField$projectArgs<ExtArgs>
|
project?: boolean | Prisma.MetadataField$projectArgs<ExtArgs>
|
||||||
@@ -775,7 +736,6 @@ export type $MetadataFieldPayload<ExtArgs extends runtime.Types.Extensions.Inter
|
|||||||
*/
|
*/
|
||||||
config:PrismaJson.FieldConfig | null
|
config:PrismaJson.FieldConfig | null
|
||||||
readOnly: boolean
|
readOnly: boolean
|
||||||
aiAutofill: boolean
|
|
||||||
description: string
|
description: string
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
projectId: string | null
|
projectId: string | null
|
||||||
@@ -1209,7 +1169,6 @@ export interface MetadataFieldFieldRefs {
|
|||||||
readonly scope: Prisma.FieldRef<"MetadataField", 'MetadataFieldScope'>
|
readonly scope: Prisma.FieldRef<"MetadataField", 'MetadataFieldScope'>
|
||||||
readonly config: Prisma.FieldRef<"MetadataField", 'Json'>
|
readonly config: Prisma.FieldRef<"MetadataField", 'Json'>
|
||||||
readonly readOnly: Prisma.FieldRef<"MetadataField", 'Boolean'>
|
readonly readOnly: Prisma.FieldRef<"MetadataField", 'Boolean'>
|
||||||
readonly aiAutofill: Prisma.FieldRef<"MetadataField", 'Boolean'>
|
|
||||||
readonly description: Prisma.FieldRef<"MetadataField", 'String'>
|
readonly description: Prisma.FieldRef<"MetadataField", 'String'>
|
||||||
readonly teamId: Prisma.FieldRef<"MetadataField", 'String'>
|
readonly teamId: Prisma.FieldRef<"MetadataField", 'String'>
|
||||||
readonly projectId: Prisma.FieldRef<"MetadataField", 'String'>
|
readonly projectId: Prisma.FieldRef<"MetadataField", 'String'>
|
||||||
|
|||||||
+33
-1
@@ -28,6 +28,7 @@ export type AggregateSandbox = {
|
|||||||
|
|
||||||
export type SandboxMinAggregateOutputType = {
|
export type SandboxMinAggregateOutputType = {
|
||||||
id: string | null
|
id: string | null
|
||||||
|
networkSandboxEnabled: boolean | null
|
||||||
createdAt: Date | null
|
createdAt: Date | null
|
||||||
updatedAt: Date | null
|
updatedAt: Date | null
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
@@ -35,6 +36,7 @@ export type SandboxMinAggregateOutputType = {
|
|||||||
|
|
||||||
export type SandboxMaxAggregateOutputType = {
|
export type SandboxMaxAggregateOutputType = {
|
||||||
id: string | null
|
id: string | null
|
||||||
|
networkSandboxEnabled: boolean | null
|
||||||
createdAt: Date | null
|
createdAt: Date | null
|
||||||
updatedAt: Date | null
|
updatedAt: Date | null
|
||||||
teamId: string | null
|
teamId: string | null
|
||||||
@@ -42,6 +44,7 @@ export type SandboxMaxAggregateOutputType = {
|
|||||||
|
|
||||||
export type SandboxCountAggregateOutputType = {
|
export type SandboxCountAggregateOutputType = {
|
||||||
id: number
|
id: number
|
||||||
|
networkSandboxEnabled: number
|
||||||
allowedDomains: number
|
allowedDomains: number
|
||||||
pendingDomains: number
|
pendingDomains: number
|
||||||
createdAt: number
|
createdAt: number
|
||||||
@@ -53,6 +56,7 @@ export type SandboxCountAggregateOutputType = {
|
|||||||
|
|
||||||
export type SandboxMinAggregateInputType = {
|
export type SandboxMinAggregateInputType = {
|
||||||
id?: true
|
id?: true
|
||||||
|
networkSandboxEnabled?: true
|
||||||
createdAt?: true
|
createdAt?: true
|
||||||
updatedAt?: true
|
updatedAt?: true
|
||||||
teamId?: true
|
teamId?: true
|
||||||
@@ -60,6 +64,7 @@ export type SandboxMinAggregateInputType = {
|
|||||||
|
|
||||||
export type SandboxMaxAggregateInputType = {
|
export type SandboxMaxAggregateInputType = {
|
||||||
id?: true
|
id?: true
|
||||||
|
networkSandboxEnabled?: true
|
||||||
createdAt?: true
|
createdAt?: true
|
||||||
updatedAt?: true
|
updatedAt?: true
|
||||||
teamId?: true
|
teamId?: true
|
||||||
@@ -67,6 +72,7 @@ export type SandboxMaxAggregateInputType = {
|
|||||||
|
|
||||||
export type SandboxCountAggregateInputType = {
|
export type SandboxCountAggregateInputType = {
|
||||||
id?: true
|
id?: true
|
||||||
|
networkSandboxEnabled?: true
|
||||||
allowedDomains?: true
|
allowedDomains?: true
|
||||||
pendingDomains?: true
|
pendingDomains?: true
|
||||||
createdAt?: true
|
createdAt?: true
|
||||||
@@ -149,6 +155,7 @@ export type SandboxGroupByArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
|||||||
|
|
||||||
export type SandboxGroupByOutputType = {
|
export type SandboxGroupByOutputType = {
|
||||||
id: string
|
id: string
|
||||||
|
networkSandboxEnabled: boolean
|
||||||
allowedDomains: string[]
|
allowedDomains: string[]
|
||||||
pendingDomains: string[]
|
pendingDomains: string[]
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
@@ -179,6 +186,7 @@ export type SandboxWhereInput = {
|
|||||||
OR?: Prisma.SandboxWhereInput[]
|
OR?: Prisma.SandboxWhereInput[]
|
||||||
NOT?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
NOT?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
||||||
id?: Prisma.StringFilter<"Sandbox"> | string
|
id?: Prisma.StringFilter<"Sandbox"> | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFilter<"Sandbox"> | boolean
|
||||||
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
createdAt?: Prisma.DateTimeFilter<"Sandbox"> | Date | string
|
createdAt?: Prisma.DateTimeFilter<"Sandbox"> | Date | string
|
||||||
@@ -189,6 +197,7 @@ export type SandboxWhereInput = {
|
|||||||
|
|
||||||
export type SandboxOrderByWithRelationInput = {
|
export type SandboxOrderByWithRelationInput = {
|
||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
|
networkSandboxEnabled?: Prisma.SortOrder
|
||||||
allowedDomains?: Prisma.SortOrder
|
allowedDomains?: Prisma.SortOrder
|
||||||
pendingDomains?: Prisma.SortOrder
|
pendingDomains?: Prisma.SortOrder
|
||||||
createdAt?: Prisma.SortOrder
|
createdAt?: Prisma.SortOrder
|
||||||
@@ -203,6 +212,7 @@ export type SandboxWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
AND?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
AND?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
||||||
OR?: Prisma.SandboxWhereInput[]
|
OR?: Prisma.SandboxWhereInput[]
|
||||||
NOT?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
NOT?: Prisma.SandboxWhereInput | Prisma.SandboxWhereInput[]
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFilter<"Sandbox"> | boolean
|
||||||
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
createdAt?: Prisma.DateTimeFilter<"Sandbox"> | Date | string
|
createdAt?: Prisma.DateTimeFilter<"Sandbox"> | Date | string
|
||||||
@@ -212,6 +222,7 @@ export type SandboxWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
|
|
||||||
export type SandboxOrderByWithAggregationInput = {
|
export type SandboxOrderByWithAggregationInput = {
|
||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
|
networkSandboxEnabled?: Prisma.SortOrder
|
||||||
allowedDomains?: Prisma.SortOrder
|
allowedDomains?: Prisma.SortOrder
|
||||||
pendingDomains?: Prisma.SortOrder
|
pendingDomains?: Prisma.SortOrder
|
||||||
createdAt?: Prisma.SortOrder
|
createdAt?: Prisma.SortOrder
|
||||||
@@ -227,6 +238,7 @@ export type SandboxScalarWhereWithAggregatesInput = {
|
|||||||
OR?: Prisma.SandboxScalarWhereWithAggregatesInput[]
|
OR?: Prisma.SandboxScalarWhereWithAggregatesInput[]
|
||||||
NOT?: Prisma.SandboxScalarWhereWithAggregatesInput | Prisma.SandboxScalarWhereWithAggregatesInput[]
|
NOT?: Prisma.SandboxScalarWhereWithAggregatesInput | Prisma.SandboxScalarWhereWithAggregatesInput[]
|
||||||
id?: Prisma.StringWithAggregatesFilter<"Sandbox"> | string
|
id?: Prisma.StringWithAggregatesFilter<"Sandbox"> | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolWithAggregatesFilter<"Sandbox"> | boolean
|
||||||
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
allowedDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
pendingDomains?: Prisma.StringNullableListFilter<"Sandbox">
|
||||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Sandbox"> | Date | string
|
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Sandbox"> | Date | string
|
||||||
@@ -236,6 +248,7 @@ export type SandboxScalarWhereWithAggregatesInput = {
|
|||||||
|
|
||||||
export type SandboxCreateInput = {
|
export type SandboxCreateInput = {
|
||||||
id?: string
|
id?: string
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -245,6 +258,7 @@ export type SandboxCreateInput = {
|
|||||||
|
|
||||||
export type SandboxUncheckedCreateInput = {
|
export type SandboxUncheckedCreateInput = {
|
||||||
id?: string
|
id?: string
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -254,6 +268,7 @@ export type SandboxUncheckedCreateInput = {
|
|||||||
|
|
||||||
export type SandboxUpdateInput = {
|
export type SandboxUpdateInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -263,6 +278,7 @@ export type SandboxUpdateInput = {
|
|||||||
|
|
||||||
export type SandboxUncheckedUpdateInput = {
|
export type SandboxUncheckedUpdateInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -272,6 +288,7 @@ export type SandboxUncheckedUpdateInput = {
|
|||||||
|
|
||||||
export type SandboxCreateManyInput = {
|
export type SandboxCreateManyInput = {
|
||||||
id?: string
|
id?: string
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -281,6 +298,7 @@ export type SandboxCreateManyInput = {
|
|||||||
|
|
||||||
export type SandboxUpdateManyMutationInput = {
|
export type SandboxUpdateManyMutationInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -289,6 +307,7 @@ export type SandboxUpdateManyMutationInput = {
|
|||||||
|
|
||||||
export type SandboxUncheckedUpdateManyInput = {
|
export type SandboxUncheckedUpdateManyInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -311,6 +330,7 @@ export type StringNullableListFilter<$PrismaModel = never> = {
|
|||||||
|
|
||||||
export type SandboxCountOrderByAggregateInput = {
|
export type SandboxCountOrderByAggregateInput = {
|
||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
|
networkSandboxEnabled?: Prisma.SortOrder
|
||||||
allowedDomains?: Prisma.SortOrder
|
allowedDomains?: Prisma.SortOrder
|
||||||
pendingDomains?: Prisma.SortOrder
|
pendingDomains?: Prisma.SortOrder
|
||||||
createdAt?: Prisma.SortOrder
|
createdAt?: Prisma.SortOrder
|
||||||
@@ -320,6 +340,7 @@ export type SandboxCountOrderByAggregateInput = {
|
|||||||
|
|
||||||
export type SandboxMaxOrderByAggregateInput = {
|
export type SandboxMaxOrderByAggregateInput = {
|
||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
|
networkSandboxEnabled?: Prisma.SortOrder
|
||||||
createdAt?: Prisma.SortOrder
|
createdAt?: Prisma.SortOrder
|
||||||
updatedAt?: Prisma.SortOrder
|
updatedAt?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrder
|
teamId?: Prisma.SortOrder
|
||||||
@@ -327,6 +348,7 @@ export type SandboxMaxOrderByAggregateInput = {
|
|||||||
|
|
||||||
export type SandboxMinOrderByAggregateInput = {
|
export type SandboxMinOrderByAggregateInput = {
|
||||||
id?: Prisma.SortOrder
|
id?: Prisma.SortOrder
|
||||||
|
networkSandboxEnabled?: Prisma.SortOrder
|
||||||
createdAt?: Prisma.SortOrder
|
createdAt?: Prisma.SortOrder
|
||||||
updatedAt?: Prisma.SortOrder
|
updatedAt?: Prisma.SortOrder
|
||||||
teamId?: Prisma.SortOrder
|
teamId?: Prisma.SortOrder
|
||||||
@@ -384,6 +406,7 @@ export type SandboxUpdatependingDomainsInput = {
|
|||||||
|
|
||||||
export type SandboxCreateWithoutTeamInput = {
|
export type SandboxCreateWithoutTeamInput = {
|
||||||
id?: string
|
id?: string
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -392,6 +415,7 @@ export type SandboxCreateWithoutTeamInput = {
|
|||||||
|
|
||||||
export type SandboxUncheckedCreateWithoutTeamInput = {
|
export type SandboxUncheckedCreateWithoutTeamInput = {
|
||||||
id?: string
|
id?: string
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxCreateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxCreatependingDomainsInput | string[]
|
||||||
createdAt?: Date | string
|
createdAt?: Date | string
|
||||||
@@ -416,6 +440,7 @@ export type SandboxUpdateToOneWithWhereWithoutTeamInput = {
|
|||||||
|
|
||||||
export type SandboxUpdateWithoutTeamInput = {
|
export type SandboxUpdateWithoutTeamInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -424,6 +449,7 @@ export type SandboxUpdateWithoutTeamInput = {
|
|||||||
|
|
||||||
export type SandboxUncheckedUpdateWithoutTeamInput = {
|
export type SandboxUncheckedUpdateWithoutTeamInput = {
|
||||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||||
|
networkSandboxEnabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||||
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
allowedDomains?: Prisma.SandboxUpdateallowedDomainsInput | string[]
|
||||||
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
pendingDomains?: Prisma.SandboxUpdatependingDomainsInput | string[]
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||||
@@ -434,6 +460,7 @@ export type SandboxUncheckedUpdateWithoutTeamInput = {
|
|||||||
|
|
||||||
export type SandboxSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type SandboxSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: boolean
|
allowedDomains?: boolean
|
||||||
pendingDomains?: boolean
|
pendingDomains?: boolean
|
||||||
createdAt?: boolean
|
createdAt?: boolean
|
||||||
@@ -444,6 +471,7 @@ export type SandboxSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
|||||||
|
|
||||||
export type SandboxSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type SandboxSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: boolean
|
allowedDomains?: boolean
|
||||||
pendingDomains?: boolean
|
pendingDomains?: boolean
|
||||||
createdAt?: boolean
|
createdAt?: boolean
|
||||||
@@ -454,6 +482,7 @@ export type SandboxSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
|
|||||||
|
|
||||||
export type SandboxSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type SandboxSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: boolean
|
allowedDomains?: boolean
|
||||||
pendingDomains?: boolean
|
pendingDomains?: boolean
|
||||||
createdAt?: boolean
|
createdAt?: boolean
|
||||||
@@ -464,6 +493,7 @@ export type SandboxSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
|
|||||||
|
|
||||||
export type SandboxSelectScalar = {
|
export type SandboxSelectScalar = {
|
||||||
id?: boolean
|
id?: boolean
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
allowedDomains?: boolean
|
allowedDomains?: boolean
|
||||||
pendingDomains?: boolean
|
pendingDomains?: boolean
|
||||||
createdAt?: boolean
|
createdAt?: boolean
|
||||||
@@ -471,7 +501,7 @@ export type SandboxSelectScalar = {
|
|||||||
teamId?: boolean
|
teamId?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SandboxOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "allowedDomains" | "pendingDomains" | "createdAt" | "updatedAt" | "teamId", ExtArgs["result"]["sandbox"]>
|
export type SandboxOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "networkSandboxEnabled" | "allowedDomains" | "pendingDomains" | "createdAt" | "updatedAt" | "teamId", ExtArgs["result"]["sandbox"]>
|
||||||
export type SandboxInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type SandboxInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
|
team?: boolean | Prisma.TeamDefaultArgs<ExtArgs>
|
||||||
}
|
}
|
||||||
@@ -489,6 +519,7 @@ export type $SandboxPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
|
|||||||
}
|
}
|
||||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||||
id: string
|
id: string
|
||||||
|
networkSandboxEnabled: boolean
|
||||||
allowedDomains: string[]
|
allowedDomains: string[]
|
||||||
pendingDomains: string[]
|
pendingDomains: string[]
|
||||||
createdAt: Date
|
createdAt: Date
|
||||||
@@ -919,6 +950,7 @@ export interface Prisma__SandboxClient<T, Null = never, ExtArgs extends runtime.
|
|||||||
*/
|
*/
|
||||||
export interface SandboxFieldRefs {
|
export interface SandboxFieldRefs {
|
||||||
readonly id: Prisma.FieldRef<"Sandbox", 'String'>
|
readonly id: Prisma.FieldRef<"Sandbox", 'String'>
|
||||||
|
readonly networkSandboxEnabled: Prisma.FieldRef<"Sandbox", 'Boolean'>
|
||||||
readonly allowedDomains: Prisma.FieldRef<"Sandbox", 'String[]'>
|
readonly allowedDomains: Prisma.FieldRef<"Sandbox", 'String[]'>
|
||||||
readonly pendingDomains: Prisma.FieldRef<"Sandbox", 'String[]'>
|
readonly pendingDomains: Prisma.FieldRef<"Sandbox", 'String[]'>
|
||||||
readonly createdAt: Prisma.FieldRef<"Sandbox", 'DateTime'>
|
readonly createdAt: Prisma.FieldRef<"Sandbox", 'DateTime'>
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ declare global {
|
|||||||
export interface FieldConfig {
|
export interface FieldConfig {
|
||||||
name: string
|
name: string
|
||||||
type: FieldType
|
type: FieldType
|
||||||
|
autofillSource?: 'NONE' | 'CONTENT' | 'CREATION_CONTEXT'
|
||||||
text?: TextConfig
|
text?: TextConfig
|
||||||
longText?: LongTextConfig
|
longText?: LongTextConfig
|
||||||
select?: SelectConfig
|
select?: SelectConfig
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/dtos",
|
"name": "@shumai/dtos",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ export const FieldType = {
|
|||||||
|
|
||||||
export type FieldType = (typeof FieldType)[keyof typeof FieldType]
|
export type FieldType = (typeof FieldType)[keyof typeof FieldType]
|
||||||
|
|
||||||
|
export const AutofillSource = {
|
||||||
|
NONE: 'NONE',
|
||||||
|
CONTENT: 'CONTENT',
|
||||||
|
CREATION_CONTEXT: 'CREATION_CONTEXT',
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type AutofillSource = (typeof AutofillSource)[keyof typeof AutofillSource]
|
||||||
|
|
||||||
export const selectOptionSchema = z.object({
|
export const selectOptionSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
displayName: z.string(),
|
displayName: z.string(),
|
||||||
@@ -39,6 +47,7 @@ export const fieldConfigSchema = z.object({
|
|||||||
'user',
|
'user',
|
||||||
'userMulti',
|
'userMulti',
|
||||||
]),
|
]),
|
||||||
|
autofillSource: z.nativeEnum(AutofillSource).optional(),
|
||||||
text: z.any().optional(),
|
text: z.any().optional(),
|
||||||
longText: z.any().optional(),
|
longText: z.any().optional(),
|
||||||
select: z.any().optional(),
|
select: z.any().optional(),
|
||||||
@@ -56,7 +65,6 @@ export const createFieldRequestSchema = z.object({
|
|||||||
label: z.string().optional(),
|
label: z.string().optional(),
|
||||||
scope: z.string().optional(),
|
scope: z.string().optional(),
|
||||||
config: fieldConfigSchema,
|
config: fieldConfigSchema,
|
||||||
aiAutofill: z.boolean().default(false),
|
|
||||||
description: z.string().default(''),
|
description: z.string().default(''),
|
||||||
})
|
})
|
||||||
export type CreateFieldRequest = z.infer<typeof createFieldRequestSchema>
|
export type CreateFieldRequest = z.infer<typeof createFieldRequestSchema>
|
||||||
@@ -64,7 +72,6 @@ export type CreateFieldRequest = z.infer<typeof createFieldRequestSchema>
|
|||||||
export const updateFieldRequestSchema = z.object({
|
export const updateFieldRequestSchema = z.object({
|
||||||
label: z.string().optional(),
|
label: z.string().optional(),
|
||||||
config: fieldConfigSchema,
|
config: fieldConfigSchema,
|
||||||
aiAutofill: z.boolean().optional(),
|
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
})
|
})
|
||||||
export type UpdateFieldRequest = z.infer<typeof updateFieldRequestSchema>
|
export type UpdateFieldRequest = z.infer<typeof updateFieldRequestSchema>
|
||||||
@@ -93,6 +100,5 @@ export const fieldInfoSchema = z.object({
|
|||||||
readOnly: z.boolean(),
|
readOnly: z.boolean(),
|
||||||
visible: z.boolean(),
|
visible: z.boolean(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
aiAutofill: z.boolean(),
|
|
||||||
})
|
})
|
||||||
export type FieldInfo = z.infer<typeof fieldInfoSchema>
|
export type FieldInfo = z.infer<typeof fieldInfoSchema>
|
||||||
|
|||||||
@@ -83,12 +83,17 @@ export const updateTeamSettingsRequestSchema = z.union([
|
|||||||
export type UpdateTeamSettingsRequest = z.infer<typeof updateTeamSettingsRequestSchema>
|
export type UpdateTeamSettingsRequest = z.infer<typeof updateTeamSettingsRequestSchema>
|
||||||
|
|
||||||
export const sandboxSettingsSchema = z.object({
|
export const sandboxSettingsSchema = z.object({
|
||||||
|
networkSandboxEnabled: z.boolean(),
|
||||||
allowedDomains: z.array(z.string()),
|
allowedDomains: z.array(z.string()),
|
||||||
pendingDomains: z.array(z.string()).default([]),
|
pendingDomains: z.array(z.string()).default([]),
|
||||||
})
|
})
|
||||||
export type SandboxSettings = z.infer<typeof sandboxSettingsSchema>
|
export type SandboxSettings = z.infer<typeof sandboxSettingsSchema>
|
||||||
|
|
||||||
export const updateSandboxSettingsRequestSchema = sandboxSettingsSchema
|
export const updateSandboxSettingsRequestSchema = z.object({
|
||||||
|
networkSandboxEnabled: z.boolean().optional(),
|
||||||
|
allowedDomains: z.array(z.string()).optional(),
|
||||||
|
pendingDomains: z.array(z.string()).optional(),
|
||||||
|
})
|
||||||
export type UpdateSandboxSettingsRequest = z.infer<typeof updateSandboxSettingsRequestSchema>
|
export type UpdateSandboxSettingsRequest = z.infer<typeof updateSandboxSettingsRequestSchema>
|
||||||
|
|
||||||
export const updateTeamMemberRoleRequestSchema = z.object({
|
export const updateTeamMemberRoleRequestSchema = z.object({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/e2e",
|
"name": "@shumai/e2e",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ describe.each(['local', 'temporal'] as const)(
|
|||||||
|
|
||||||
let agentWorkerPromise: Promise<void> | null = null
|
let agentWorkerPromise: Promise<void> | null = null
|
||||||
let transcodeWorkerPromise: Promise<void> | null = null
|
let transcodeWorkerPromise: Promise<void> | null = null
|
||||||
let lastAutofillPrompt = ''
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
// Set bucket environment
|
// Set bucket environment
|
||||||
@@ -36,11 +35,7 @@ describe.each(['local', 'temporal'] as const)(
|
|||||||
// Spy on the harness prompt method to intercept the LLM call while running real activities & tools
|
// Spy on the harness prompt method to intercept the LLM call while running real activities & tools
|
||||||
vi.spyOn(AgentHarness.prototype, 'prompt').mockImplementation(async function (
|
vi.spyOn(AgentHarness.prototype, 'prompt').mockImplementation(async function (
|
||||||
this: AgentHarness,
|
this: AgentHarness,
|
||||||
...args: unknown[]
|
|
||||||
) {
|
) {
|
||||||
// Capture the prompt to verify agent-provided context is propagated
|
|
||||||
lastAutofillPrompt = typeof args[0] === 'string' ? args[0] : ''
|
|
||||||
|
|
||||||
// Find the real autofill_metadata tool configured on the harness
|
// Find the real autofill_metadata tool configured on the harness
|
||||||
const tools = this.getTools()
|
const tools = this.getTools()
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Tool execution mock for E2E harness test
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Tool execution mock for E2E harness test
|
||||||
@@ -119,54 +114,50 @@ describe.each(['local', 'temporal'] as const)(
|
|||||||
data: { name: 'E2E Test Project', teamId: team.id },
|
data: { name: 'E2E Test Project', teamId: team.id },
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create Metadata Field (aiAutofill = true, text)
|
// Create Metadata Field (autofillSource = CONTENT, text)
|
||||||
await prisma.metadataField.create({
|
await prisma.metadataField.create({
|
||||||
data: {
|
data: {
|
||||||
key: 'title',
|
key: 'title',
|
||||||
scope: 'PROJECT',
|
scope: 'PROJECT',
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
config: { name: 'Title', type: 'text' },
|
config: { name: 'Title', type: 'text', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: 'Auto-extracted title',
|
description: 'Auto-extracted title',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create Metadata Field (aiAutofill = true, number)
|
// Create Metadata Field (autofillSource = CONTENT, number)
|
||||||
await prisma.metadataField.create({
|
await prisma.metadataField.create({
|
||||||
data: {
|
data: {
|
||||||
key: 'confidence',
|
key: 'confidence',
|
||||||
scope: 'PROJECT',
|
scope: 'PROJECT',
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
config: { name: 'Confidence', type: 'number' },
|
config: { name: 'Confidence', type: 'number', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: 'AI extraction confidence',
|
description: 'AI extraction confidence',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create Metadata Field (aiAutofill = true, boolean)
|
// Create Metadata Field (autofillSource = CONTENT, boolean)
|
||||||
await prisma.metadataField.create({
|
await prisma.metadataField.create({
|
||||||
data: {
|
data: {
|
||||||
key: 'completed',
|
key: 'completed',
|
||||||
scope: 'PROJECT',
|
scope: 'PROJECT',
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
config: { name: 'Completed', type: 'toggle' },
|
config: { name: 'Completed', type: 'toggle', autofillSource: 'CONTENT' },
|
||||||
aiAutofill: true,
|
|
||||||
description: 'Completed flag',
|
description: 'Completed flag',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create Metadata Field (aiAutofill = false, text)
|
// Create Metadata Field (autofillSource = NONE, text)
|
||||||
await prisma.metadataField.create({
|
await prisma.metadataField.create({
|
||||||
data: {
|
data: {
|
||||||
key: 'manual_notes',
|
key: 'manual_notes',
|
||||||
scope: 'PROJECT',
|
scope: 'PROJECT',
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
config: { name: 'Manual Notes', type: 'text' },
|
config: { name: 'Manual Notes', type: 'text', autofillSource: 'NONE' },
|
||||||
aiAutofill: false,
|
|
||||||
description: 'Manual notes (should not be auto-filled)',
|
description: 'Manual notes (should not be auto-filled)',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -244,7 +235,6 @@ describe.each(['local', 'temporal'] as const)(
|
|||||||
mediaType: 'image/png',
|
mediaType: 'image/png',
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- partial MediaInfo mock for testing
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- partial MediaInfo mock for testing
|
||||||
media: { proxyType: 'image' } as any,
|
media: { proxyType: 'image' } as any,
|
||||||
autofillContext: 'Generated using gemini',
|
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
storageKeyId: storageKey.id,
|
storageKeyId: storageKey.id,
|
||||||
},
|
},
|
||||||
@@ -284,10 +274,6 @@ describe.each(['local', 'temporal'] as const)(
|
|||||||
// 5. Verification
|
// 5. Verification
|
||||||
expect(completedTask.status).toBe('completed')
|
expect(completedTask.status).toBe('completed')
|
||||||
|
|
||||||
// Verify the agent-provided autofill context was included in the LLM prompt
|
|
||||||
expect(lastAutofillPrompt).toContain('Generated using gemini')
|
|
||||||
expect(lastAutofillPrompt).toContain('<context>')
|
|
||||||
|
|
||||||
// Verify placeholder comment is updated correctly
|
// Verify placeholder comment is updated correctly
|
||||||
const comments = await prisma.assetComment.findMany({
|
const comments = await prisma.assetComment.findMany({
|
||||||
where: { assetId: asset.id },
|
where: { assetId: asset.id },
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/tableprinter",
|
"name": "@shumai/tableprinter",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/transcode",
|
"name": "@shumai/transcode",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { CircleHelp, Sparkles, Bot, Ban } from 'lucide-react'
|
||||||
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
|
import { Button } from '@/ui/components/ui/button'
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from '@/ui/components/ui/dialog'
|
||||||
|
|
||||||
|
export function AutofillSourceHelpTrigger() {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
|
<DialogTrigger asChild>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="h-4 w-4 p-0 hover:bg-transparent text-muted-foreground hover:text-foreground inline-flex items-center justify-center shrink-0 ml-1"
|
||||||
|
title={m.autofill_source_help_title()}
|
||||||
|
>
|
||||||
|
<CircleHelp className="h-3.5 w-3.5" />
|
||||||
|
<span className="sr-only">{m.autofill_source_help_title()}</span>
|
||||||
|
</Button>
|
||||||
|
</DialogTrigger>
|
||||||
|
<DialogContent className="sm:max-w-[500px]">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle className="flex items-center gap-2">
|
||||||
|
<CircleHelp className="h-5 w-5 text-muted-foreground" />
|
||||||
|
{m.autofill_source_help_title()}
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogDescription>{m.autofill_source_help_desc()}</DialogDescription>
|
||||||
|
</DialogHeader>
|
||||||
|
<div className="space-y-4 py-2">
|
||||||
|
{/* Option 1: None */}
|
||||||
|
<div className="rounded-lg border p-3.5 space-y-1.5 bg-muted/30">
|
||||||
|
<div className="flex items-center gap-2 font-medium text-sm">
|
||||||
|
<Ban className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
<span>{m.autofill_source_none()}</span>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground leading-relaxed">
|
||||||
|
{m.autofill_source_none_desc()}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs italic text-muted-foreground/80">
|
||||||
|
{m.autofill_source_none_example()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Option 2: Content */}
|
||||||
|
<div className="rounded-lg border p-3.5 space-y-1.5 bg-muted/30">
|
||||||
|
<div className="flex items-center gap-2 font-medium text-sm">
|
||||||
|
<Sparkles className="h-4 w-4 text-amber-500 shrink-0" />
|
||||||
|
<span>{m.autofill_source_content()}</span>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground leading-relaxed">
|
||||||
|
{m.autofill_source_content_desc()}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs italic text-muted-foreground/80">
|
||||||
|
{m.autofill_source_content_example()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Option 3: Creation Context */}
|
||||||
|
<div className="rounded-lg border p-3.5 space-y-1.5 bg-muted/30">
|
||||||
|
<div className="flex items-center gap-2 font-medium text-sm">
|
||||||
|
<Bot className="h-4 w-4 text-blue-500 shrink-0" />
|
||||||
|
<span>{m.autofill_source_creation_context()}</span>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground leading-relaxed">
|
||||||
|
{m.autofill_source_creation_context_desc()}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs italic text-muted-foreground/80">
|
||||||
|
{m.autofill_source_creation_context_example()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import UserField from './fields/user-field'
|
|||||||
import UserMultiField from './fields/user-multi-field'
|
import UserMultiField from './fields/user-multi-field'
|
||||||
|
|
||||||
interface FieldRendererProps {
|
interface FieldRendererProps {
|
||||||
|
fieldId?: string
|
||||||
config: FieldInfo['config']
|
config: FieldInfo['config']
|
||||||
value: unknown
|
value: unknown
|
||||||
onSave?: (value: unknown) => void
|
onSave?: (value: unknown) => void
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
FieldType,
|
FieldType,
|
||||||
|
AutofillSource,
|
||||||
type FieldInfo,
|
type FieldInfo,
|
||||||
type FieldInfo as MetadataFieldInfo,
|
type FieldInfo as MetadataFieldInfo,
|
||||||
type SelectOption,
|
type SelectOption,
|
||||||
@@ -24,8 +25,32 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popo
|
|||||||
import { Input } from '@/ui/components/ui/input'
|
import { Input } from '@/ui/components/ui/input'
|
||||||
import { Label } from '@/ui/components/ui/label'
|
import { Label } from '@/ui/components/ui/label'
|
||||||
import { Switch } from '@/ui/components/ui/switch'
|
import { Switch } from '@/ui/components/ui/switch'
|
||||||
|
import { ToggleGroup, ToggleGroupItem } from '@/ui/components/ui/toggle-group'
|
||||||
import { reorderFieldSubset } from '@/ui/lib/dnd-utils'
|
import { reorderFieldSubset } from '@/ui/lib/dnd-utils'
|
||||||
import { PointerActivationConstraints } from '@dnd-kit/dom'
|
import { PointerActivationConstraints } from '@dnd-kit/dom'
|
||||||
|
import {
|
||||||
|
AlignLeft,
|
||||||
|
Calendar,
|
||||||
|
ChevronDown,
|
||||||
|
GripVertical,
|
||||||
|
Hash,
|
||||||
|
List,
|
||||||
|
Plus,
|
||||||
|
Search,
|
||||||
|
Settings,
|
||||||
|
Sparkles,
|
||||||
|
Bot,
|
||||||
|
Star,
|
||||||
|
Tags,
|
||||||
|
ToggleLeft,
|
||||||
|
Type,
|
||||||
|
X,
|
||||||
|
User,
|
||||||
|
Users,
|
||||||
|
} from 'lucide-react'
|
||||||
|
import { useMemo, useState, useEffect } from 'react'
|
||||||
|
|
||||||
|
import { AutofillSourceHelpTrigger } from '@/ui/components/autofill-source-help-dialog'
|
||||||
|
|
||||||
export const PREDEFINED_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray']
|
export const PREDEFINED_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray']
|
||||||
|
|
||||||
@@ -80,26 +105,6 @@ export function getRandomUnusedColor(existingOptions: SelectOption[] = []): stri
|
|||||||
}
|
}
|
||||||
return PREDEFINED_COLORS[Math.floor(Math.random() * PREDEFINED_COLORS.length)]
|
return PREDEFINED_COLORS[Math.floor(Math.random() * PREDEFINED_COLORS.length)]
|
||||||
}
|
}
|
||||||
import {
|
|
||||||
AlignLeft,
|
|
||||||
Calendar,
|
|
||||||
ChevronDown,
|
|
||||||
GripVertical,
|
|
||||||
Hash,
|
|
||||||
List,
|
|
||||||
Plus,
|
|
||||||
Search,
|
|
||||||
Settings,
|
|
||||||
Sparkles,
|
|
||||||
Star,
|
|
||||||
Tags,
|
|
||||||
ToggleLeft,
|
|
||||||
Type,
|
|
||||||
X,
|
|
||||||
User,
|
|
||||||
Users,
|
|
||||||
} from 'lucide-react'
|
|
||||||
import { useMemo, useState, useEffect } from 'react'
|
|
||||||
|
|
||||||
export const FIELD_TYPE_ICONS: Record<FieldType, React.ComponentType<{ className?: string }>> = {
|
export const FIELD_TYPE_ICONS: Record<FieldType, React.ComponentType<{ className?: string }>> = {
|
||||||
[FieldType.text]: Type,
|
[FieldType.text]: Type,
|
||||||
@@ -135,7 +140,12 @@ function SortableFieldItem({ field, index, onVisibilityChange }: SortableFieldIt
|
|||||||
<GripVertical className="h-4 w-4 text-muted-foreground" />
|
<GripVertical className="h-4 w-4 text-muted-foreground" />
|
||||||
</div>
|
</div>
|
||||||
{Icon && <Icon className="h-4 w-4 text-muted-foreground shrink-0" />}
|
{Icon && <Icon className="h-4 w-4 text-muted-foreground shrink-0" />}
|
||||||
{field.aiAutofill && <Sparkles className="h-4 w-4 text-muted-foreground shrink-0" />}
|
{field.config?.autofillSource === AutofillSource.CONTENT && (
|
||||||
|
<Sparkles className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
)}
|
||||||
|
{field.config?.autofillSource === AutofillSource.CREATION_CONTEXT && (
|
||||||
|
<Bot className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
)}
|
||||||
<span className="text-sm truncate">{field.config?.name}</span>
|
<span className="text-sm truncate">{field.config?.name}</span>
|
||||||
</div>
|
</div>
|
||||||
<Switch
|
<Switch
|
||||||
@@ -158,7 +168,7 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag
|
|||||||
const [view, setView] = useState<'list' | 'create'>('list')
|
const [view, setView] = useState<'list' | 'create'>('list')
|
||||||
const [newFieldName, setNewFieldName] = useState('')
|
const [newFieldName, setNewFieldName] = useState('')
|
||||||
const [newFieldType, setNewFieldType] = useState<FieldType | ''>('')
|
const [newFieldType, setNewFieldType] = useState<FieldType | ''>('')
|
||||||
const [newAiAutofill, setNewAiAutofill] = useState(false)
|
const [newAutofillSource, setNewAutofillSource] = useState<AutofillSource>(AutofillSource.NONE)
|
||||||
const [newDescription, setNewDescription] = useState('')
|
const [newDescription, setNewDescription] = useState('')
|
||||||
const [newOptions, setNewOptions] = useState<SelectOption[]>([])
|
const [newOptions, setNewOptions] = useState<SelectOption[]>([])
|
||||||
|
|
||||||
@@ -265,10 +275,10 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag
|
|||||||
config: {
|
config: {
|
||||||
name: newFieldName,
|
name: newFieldName,
|
||||||
type: newFieldType,
|
type: newFieldType,
|
||||||
|
autofillSource: newAutofillSource,
|
||||||
...typeConfig,
|
...typeConfig,
|
||||||
},
|
},
|
||||||
label: newFieldName,
|
label: newFieldName,
|
||||||
aiAutofill: newAiAutofill,
|
|
||||||
description: newDescription,
|
description: newDescription,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -333,9 +343,38 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center space-x-2">
|
<div className="space-y-2">
|
||||||
<Switch id="ai-autofill" checked={newAiAutofill} onCheckedChange={setNewAiAutofill} />
|
<div className="flex items-center gap-1">
|
||||||
<Label htmlFor="ai-autofill">{m.ai_autofill()}</Label>
|
<Label>{m.autofill_source()}</Label>
|
||||||
|
<AutofillSourceHelpTrigger />
|
||||||
|
</div>
|
||||||
|
<ToggleGroup
|
||||||
|
type="single"
|
||||||
|
value={newAutofillSource}
|
||||||
|
onValueChange={(val: string) => {
|
||||||
|
if (val) setNewAutofillSource(val as AutofillSource)
|
||||||
|
}}
|
||||||
|
className="w-full grid grid-cols-3 border rounded-md p-1 gap-1"
|
||||||
|
>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.NONE}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_none()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CONTENT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_content()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CREATION_CONTEXT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_creation_context()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
</ToggleGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(newFieldType === FieldType.select || newFieldType === FieldType.selectMulti) && (
|
{(newFieldType === FieldType.select || newFieldType === FieldType.selectMulti) && (
|
||||||
@@ -424,7 +463,7 @@ export function FieldsManager({ projectId, onManageFields, onSave }: FieldsManag
|
|||||||
setView('list')
|
setView('list')
|
||||||
setNewFieldName('')
|
setNewFieldName('')
|
||||||
setNewFieldType('')
|
setNewFieldType('')
|
||||||
setNewAiAutofill(false)
|
setNewAutofillSource(AutofillSource.NONE)
|
||||||
setNewDescription('')
|
setNewDescription('')
|
||||||
setNewOptions([])
|
setNewOptions([])
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ export interface FieldProps<T = unknown> {
|
|||||||
config: FieldConfig
|
config: FieldConfig
|
||||||
onSave: (value: T) => void
|
onSave: (value: T) => void
|
||||||
readOnly?: boolean
|
readOnly?: boolean
|
||||||
|
fieldId?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// @vitest-environment happy-dom
|
||||||
|
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||||
|
import React from 'react'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import LongTextField from './long-text-field'
|
||||||
|
|
||||||
|
describe('LongTextField Component', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.clearAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
const dummyConfig = {
|
||||||
|
name: 'Description',
|
||||||
|
type: 'longText' as const,
|
||||||
|
}
|
||||||
|
|
||||||
|
it('renders collapsed placeholder with fixed 2-row height and whitespace-pre-wrap', () => {
|
||||||
|
render(<LongTextField value="Line 1\nLine 2\nLine 3" config={dummyConfig} onSave={vi.fn()} />)
|
||||||
|
const collapsed = screen.getByTitle('Click to expand')
|
||||||
|
expect(collapsed).toBeTruthy()
|
||||||
|
expect(collapsed.className).toContain('h-[48px]')
|
||||||
|
expect(collapsed.className).toContain('line-clamp-2')
|
||||||
|
expect(collapsed.className).toContain('whitespace-pre-wrap')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders Empty state inside 2-row container when value is empty', () => {
|
||||||
|
render(<LongTextField value="" config={dummyConfig} onSave={vi.fn()} />)
|
||||||
|
const collapsed = screen.getByTitle('Click to expand')
|
||||||
|
expect(collapsed.className).toContain('h-[48px]')
|
||||||
|
expect(screen.getByText('Empty')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('expands on click to show full content overlay', () => {
|
||||||
|
render(<LongTextField value="Line 1\nLine 2\nLine 3" config={dummyConfig} onSave={vi.fn()} />)
|
||||||
|
const collapsed = screen.getByTitle('Click to expand')
|
||||||
|
fireEvent.click(collapsed)
|
||||||
|
|
||||||
|
const elements = screen.getAllByText(/Line 1/)
|
||||||
|
expect(elements.length).toBe(2)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -73,7 +73,7 @@ const LongTextField: React.FC<FieldProps<string>> = ({ value, onSave, readOnly }
|
|||||||
{/* Placeholder */}
|
{/* Placeholder */}
|
||||||
<div
|
<div
|
||||||
onClick={handlePlaceholderClick}
|
onClick={handlePlaceholderClick}
|
||||||
className={`w-full text-foreground rounded border border-transparent transition-all px-2 py-1 line-clamp-2 max-h-[3rem] overflow-hidden ${
|
className={`w-full text-foreground rounded border border-transparent transition-all px-2 py-1 h-[48px] line-clamp-2 whitespace-pre-wrap overflow-hidden ${
|
||||||
!readOnly ? 'cursor-pointer hover:bg-accent hover:border-border' : 'cursor-pointer'
|
!readOnly ? 'cursor-pointer hover:bg-accent hover:border-border' : 'cursor-pointer'
|
||||||
}`}
|
}`}
|
||||||
title="Click to expand"
|
title="Click to expand"
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
// @vitest-environment happy-dom
|
||||||
|
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||||
|
import React from 'react'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import SelectField from './select-field'
|
||||||
|
|
||||||
|
// Mock client and stores
|
||||||
|
vi.mock('@/ui/api/client', () => ({
|
||||||
|
client: {
|
||||||
|
api: {
|
||||||
|
fields: {
|
||||||
|
':fieldId': {
|
||||||
|
$put: vi.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('@/ui/stores/fields', () => ({
|
||||||
|
useFieldStore: {
|
||||||
|
getState: () => ({
|
||||||
|
fields: [],
|
||||||
|
updateFields: vi.fn(),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('SelectField Component', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.clearAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
const sampleConfig = {
|
||||||
|
name: 'Status',
|
||||||
|
type: 'select' as const,
|
||||||
|
select: {
|
||||||
|
options: [
|
||||||
|
{ id: 'foo', displayName: 'Foo', color: '#ff0000' },
|
||||||
|
{ id: 'bar', displayName: 'Bar', color: '#00ff00' },
|
||||||
|
{ id: 'abc', displayName: 'abc', color: '#0000ff' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
it('renders selected option badge correctly', () => {
|
||||||
|
const { container } = render(<SelectField value="foo" config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
const badge = screen.getByText('Foo')
|
||||||
|
expect(badge).toBeTruthy()
|
||||||
|
expect(badge.className).toContain('h-[22px]')
|
||||||
|
const trigger = container.querySelector('div[class*="h-[28px]"]')
|
||||||
|
expect(trigger).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders placeholder with text-sm styling', () => {
|
||||||
|
const { container } = render(<SelectField value="" config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
const placeholder = screen.getByText('Select an option')
|
||||||
|
expect(placeholder).toBeTruthy()
|
||||||
|
expect(placeholder.className).toContain('text-sm')
|
||||||
|
const trigger = container.querySelector('div[class*="h-[28px]"]')
|
||||||
|
expect(trigger).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('filters options based on search query', () => {
|
||||||
|
render(<SelectField value="" config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
|
||||||
|
// Click trigger to open popover
|
||||||
|
const trigger = screen.getByText('Select an option')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
// Search box should be visible
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
expect(searchInput).toBeTruthy()
|
||||||
|
|
||||||
|
// Type "bc" -> should only show "abc" and "Add options: bc"
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'bc' } })
|
||||||
|
expect(screen.getByText('abc')).toBeTruthy()
|
||||||
|
expect(screen.queryByText('Foo')).toBeNull()
|
||||||
|
expect(screen.queryByText('Bar')).toBeNull()
|
||||||
|
|
||||||
|
// Add option action should be present for "bc"
|
||||||
|
expect(screen.getByText('Add options: bc')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('hides add option button when user input matches an option exactly', () => {
|
||||||
|
render(<SelectField value="" config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
|
||||||
|
const trigger = screen.getByText('Select an option')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
|
||||||
|
// Type "abc" -> exact match with option "abc"
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'abc' } })
|
||||||
|
expect(screen.getByText('abc')).toBeTruthy()
|
||||||
|
// "Add options: abc" button should be hidden
|
||||||
|
expect(screen.queryByText('Add options: abc')).toBeNull()
|
||||||
|
// Type "foo" -> exact match with option id "foo" / displayName "Foo"
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'foo' } })
|
||||||
|
expect(screen.queryByText('Add options: foo')).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calls API and onSave when adding a new option', async () => {
|
||||||
|
const onSave = vi.fn()
|
||||||
|
const { client } = await import('@/ui/api/client')
|
||||||
|
vi.mocked(client.api.fields[':fieldId'].$put).mockResolvedValue({
|
||||||
|
ok: true,
|
||||||
|
json: async () => ({}),
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
} as any)
|
||||||
|
|
||||||
|
render(<SelectField value="" config={sampleConfig} fieldId="field_123" onSave={onSave} />)
|
||||||
|
|
||||||
|
const trigger = screen.getByText('Select an option')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'New Custom Option' } })
|
||||||
|
|
||||||
|
const addBtn = screen.getByText('Add options: New Custom Option')
|
||||||
|
expect(addBtn).toBeTruthy()
|
||||||
|
fireEvent.click(addBtn)
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(client.api.fields[':fieldId'].$put).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
param: { fieldId: 'field_123' },
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
expect(onSave).toHaveBeenCalledWith('new-custom-option')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,15 +1,37 @@
|
|||||||
import type { SelectOption } from '@shumai/dtos'
|
import type { FieldInfo, SelectOption } from '@shumai/dtos'
|
||||||
import { ChevronDown, X } from 'lucide-react'
|
import { ChevronDown, Plus, Search, X } from 'lucide-react'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
import { toast } from 'sonner'
|
||||||
import type { FieldProps } from './field-types'
|
import type { FieldProps } from './field-types'
|
||||||
|
import { client } from '@/ui/api/client'
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||||
import { getOptionStyle } from '../fields-manager'
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
|
import { useFieldStore } from '@/ui/stores/fields'
|
||||||
|
import { getOptionStyle, getRandomUnusedColor } from '../fields-manager'
|
||||||
|
|
||||||
const SelectField: React.FC<FieldProps<string>> = ({ value, config, onSave, readOnly }) => {
|
const SelectField: React.FC<FieldProps<string>> = ({
|
||||||
|
value,
|
||||||
|
config,
|
||||||
|
onSave,
|
||||||
|
readOnly,
|
||||||
|
fieldId,
|
||||||
|
}) => {
|
||||||
const selectConfig = config?.select
|
const selectConfig = config?.select
|
||||||
|
const options: SelectOption[] = selectConfig?.options || []
|
||||||
const [isEditing, setIsEditing] = useState(false)
|
const [isEditing, setIsEditing] = useState(false)
|
||||||
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
|
|
||||||
const selectedOption = selectConfig?.options?.find((opt: SelectOption) => opt.id === value)
|
const selectedOption = options.find((opt: SelectOption) => opt.id === value)
|
||||||
|
|
||||||
|
const trimmedSearch = searchQuery.trim()
|
||||||
|
const filteredOptions = options.filter((opt: SelectOption) =>
|
||||||
|
opt.displayName.toLowerCase().includes(trimmedSearch.toLowerCase()),
|
||||||
|
)
|
||||||
|
const hasExactMatch = options.some(
|
||||||
|
(opt: SelectOption) =>
|
||||||
|
opt.displayName.trim().toLowerCase() === trimmedSearch.toLowerCase() ||
|
||||||
|
opt.id.toLowerCase() === trimmedSearch.toLowerCase(),
|
||||||
|
)
|
||||||
|
|
||||||
const handleStartEdit = () => {
|
const handleStartEdit = () => {
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
@@ -20,18 +42,68 @@ const SelectField: React.FC<FieldProps<string>> = ({ value, config, onSave, read
|
|||||||
const handleSelect = (optionId: string) => {
|
const handleSelect = (optionId: string) => {
|
||||||
onSave(optionId)
|
onSave(optionId)
|
||||||
setIsEditing(false)
|
setIsEditing(false)
|
||||||
|
setSearchQuery('')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOpenChange = (open: boolean) => {
|
const handleOpenChange = (open: boolean) => {
|
||||||
if (readOnly) return
|
if (readOnly) return
|
||||||
setIsEditing(open)
|
setIsEditing(open)
|
||||||
|
if (!open) {
|
||||||
|
setSearchQuery('')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAddOption = async () => {
|
||||||
|
if (!trimmedSearch) return
|
||||||
|
const newOption: SelectOption = {
|
||||||
|
id: trimmedSearch.toLowerCase().replace(/\s+/g, '-'),
|
||||||
|
displayName: trimmedSearch,
|
||||||
|
color: getRandomUnusedColor(options),
|
||||||
|
}
|
||||||
|
const newOptions = [...options, newOption]
|
||||||
|
const updatedConfig = {
|
||||||
|
...config,
|
||||||
|
select: {
|
||||||
|
...selectConfig,
|
||||||
|
options: newOptions,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fieldId) {
|
||||||
|
try {
|
||||||
|
const res = await client.api.fields[':fieldId'].$put({
|
||||||
|
param: { fieldId },
|
||||||
|
json: { config: updatedConfig },
|
||||||
|
})
|
||||||
|
if (!res.ok) {
|
||||||
|
toast.error(m.failed_update_field())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const updatedField = (await res.json()) as FieldInfo
|
||||||
|
const currentFields = useFieldStore.getState().fields
|
||||||
|
const newFields = currentFields.map((f) =>
|
||||||
|
f.id === updatedField.id
|
||||||
|
? { ...f, ...(updatedField as FieldInfo), visible: f.visible }
|
||||||
|
: f,
|
||||||
|
)
|
||||||
|
useFieldStore.getState().updateFields(newFields)
|
||||||
|
} catch {
|
||||||
|
toast.error(m.failed_update_field())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSave(newOption.id)
|
||||||
|
setSearchQuery('')
|
||||||
|
setIsEditing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderOptionBadge = (option: SelectOption | undefined) => {
|
const renderOptionBadge = (option: SelectOption | undefined) => {
|
||||||
if (!option) return <span className="text-muted-foreground italic">Select an option</span>
|
if (!option)
|
||||||
|
return <span className="text-muted-foreground italic text-sm">Select an option</span>
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
|
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium h-[22px]"
|
||||||
style={getOptionStyle(option.color)}
|
style={getOptionStyle(option.color)}
|
||||||
>
|
>
|
||||||
{option.displayName}
|
{option.displayName}
|
||||||
@@ -45,7 +117,7 @@ const SelectField: React.FC<FieldProps<string>> = ({ value, config, onSave, read
|
|||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<div
|
<div
|
||||||
onClick={handleStartEdit}
|
onClick={handleStartEdit}
|
||||||
className={`flex items-center justify-between w-full min-h-[28px] px-2 py-1 rounded border border-transparent transition-colors ${
|
className={`flex items-center justify-between w-full h-[28px] px-2 rounded border border-transparent transition-colors ${
|
||||||
!readOnly ? 'cursor-pointer hover:bg-accent hover:border-border group' : ''
|
!readOnly ? 'cursor-pointer hover:bg-accent hover:border-border group' : ''
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
@@ -57,29 +129,69 @@ const SelectField: React.FC<FieldProps<string>> = ({ value, config, onSave, read
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
|
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
className="p-1 w-[--radix-popover-trigger-width] min-w-[150px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg"
|
side="bottom"
|
||||||
align="start"
|
align="start"
|
||||||
|
sideOffset={4}
|
||||||
|
className="p-1.5 w-64 max-h-72 flex flex-col bg-popover border border-border rounded-lg shadow-lg"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onClick={() => handleSelect('')}
|
className="relative pb-1.5 border-b border-border mb-1"
|
||||||
className="px-3 py-2 text-sm text-muted-foreground hover:bg-accent cursor-pointer flex items-center gap-2"
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<X className="w-3 h-3" /> Clear
|
<Search className="w-3.5 h-3.5 absolute left-2 top-2 text-muted-foreground" />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="w-full pl-7 pr-2 py-1 text-xs bg-muted/50 border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-ring text-foreground"
|
||||||
|
placeholder={m.search_options_placeholder()}
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{selectConfig?.options?.map((option: SelectOption) => (
|
|
||||||
<div
|
<div className="overflow-y-auto max-h-48 min-h-[120px] space-y-0.5">
|
||||||
key={option.id}
|
{searchQuery === '' && (
|
||||||
onClick={() => handleSelect(option.id)}
|
<div
|
||||||
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center"
|
onClick={() => handleSelect('')}
|
||||||
>
|
className="px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded cursor-pointer flex items-center gap-2"
|
||||||
<span
|
|
||||||
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
|
|
||||||
style={getOptionStyle(option.color)}
|
|
||||||
>
|
>
|
||||||
{option.displayName}
|
<X className="w-3.5 h-3.5" /> Clear
|
||||||
</span>
|
</div>
|
||||||
</div>
|
)}
|
||||||
))}
|
|
||||||
|
{filteredOptions.map((option: SelectOption) => (
|
||||||
|
<div
|
||||||
|
key={option.id}
|
||||||
|
onClick={() => handleSelect(option.id)}
|
||||||
|
className={`px-2.5 py-1.5 text-xs hover:bg-accent rounded cursor-pointer flex items-center justify-between ${
|
||||||
|
value === option.id ? 'bg-accent/50 font-medium' : ''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
|
||||||
|
style={getOptionStyle(option.color)}
|
||||||
|
>
|
||||||
|
{option.displayName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{filteredOptions.length === 0 && !trimmedSearch && (
|
||||||
|
<div className="px-2.5 py-2 text-xs text-muted-foreground italic text-center">
|
||||||
|
{m.no_options_found()}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{trimmedSearch !== '' && !hasExactMatch && (
|
||||||
|
<div
|
||||||
|
onClick={handleAddOption}
|
||||||
|
className="px-2.5 py-1.5 text-xs text-primary hover:bg-accent rounded cursor-pointer flex items-center gap-1.5 font-medium border-t border-border mt-1 pt-1.5"
|
||||||
|
>
|
||||||
|
<Plus className="w-3.5 h-3.5 shrink-0" />
|
||||||
|
<span className="truncate">{m.add_option_with_name({ name: trimmedSearch })}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
// @vitest-environment happy-dom
|
||||||
|
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||||
|
import React from 'react'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import SelectMultiField from './select-multi-field'
|
||||||
|
|
||||||
|
// Mock client and stores
|
||||||
|
vi.mock('@/ui/api/client', () => ({
|
||||||
|
client: {
|
||||||
|
api: {
|
||||||
|
fields: {
|
||||||
|
':fieldId': {
|
||||||
|
$put: vi.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('@/ui/stores/fields', () => ({
|
||||||
|
useFieldStore: {
|
||||||
|
getState: () => ({
|
||||||
|
fields: [],
|
||||||
|
updateFields: vi.fn(),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('SelectMultiField Component', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
cleanup()
|
||||||
|
vi.clearAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
const sampleConfig = {
|
||||||
|
name: 'Tags',
|
||||||
|
type: 'selectMulti' as const,
|
||||||
|
selectMulti: {
|
||||||
|
options: [
|
||||||
|
{ id: 'foo', displayName: 'Foo', color: '#ff0000' },
|
||||||
|
{ id: 'bar', displayName: 'Bar', color: '#00ff00' },
|
||||||
|
{ id: 'abc', displayName: 'abc', color: '#0000ff' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
it('renders Empty placeholder when no values selected', () => {
|
||||||
|
render(<SelectMultiField value={[]} config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
expect(screen.getByText('Empty')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('filters options based on search query in MultiSelect', () => {
|
||||||
|
render(<SelectMultiField value={[]} config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
|
||||||
|
// Click trigger to open popover
|
||||||
|
const trigger = screen.getByText('Empty')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
expect(searchInput).toBeTruthy()
|
||||||
|
|
||||||
|
// Type "bc" -> should show "abc" and "Add options: bc"
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'bc' } })
|
||||||
|
expect(screen.getByText('abc')).toBeTruthy()
|
||||||
|
expect(screen.queryByText('Foo')).toBeNull()
|
||||||
|
|
||||||
|
expect(screen.getByText('Add options: bc')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('hides add option button when exact match exists in MultiSelect', () => {
|
||||||
|
render(<SelectMultiField value={[]} config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
|
||||||
|
const trigger = screen.getByText('Empty')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
|
||||||
|
// Type "abc" -> exact match
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'abc' } })
|
||||||
|
expect(screen.getByText('abc')).toBeTruthy()
|
||||||
|
expect(screen.queryByText('Add options: abc')).toBeNull()
|
||||||
|
// Type "foo" -> exact match with option id "foo" / displayName "Foo"
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'foo' } })
|
||||||
|
expect(screen.queryByText('Add options: foo')).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calls API and onSave when adding a new option in MultiSelect', async () => {
|
||||||
|
const onSave = vi.fn()
|
||||||
|
const { client } = await import('@/ui/api/client')
|
||||||
|
vi.mocked(client.api.fields[':fieldId'].$put).mockResolvedValue({
|
||||||
|
ok: true,
|
||||||
|
json: async () => ({}),
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
} as any)
|
||||||
|
|
||||||
|
render(
|
||||||
|
<SelectMultiField
|
||||||
|
value={['foo']}
|
||||||
|
config={sampleConfig}
|
||||||
|
fieldId="field_multi_123"
|
||||||
|
onSave={onSave}
|
||||||
|
/>,
|
||||||
|
)
|
||||||
|
|
||||||
|
const trigger = screen.getByText('Foo')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
fireEvent.change(searchInput, { target: { value: 'New Multi Option' } })
|
||||||
|
|
||||||
|
const addBtn = screen.getByText('Add options: New Multi Option')
|
||||||
|
expect(addBtn).toBeTruthy()
|
||||||
|
fireEvent.click(addBtn)
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(client.api.fields[':fieldId'].$put).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
param: { fieldId: 'field_multi_123' },
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
expect(onSave).toHaveBeenCalledWith(['foo', 'new-multi-option'])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('opens search input directly on first click even when multiple items are selected', () => {
|
||||||
|
render(<SelectMultiField value={['foo', 'bar']} config={sampleConfig} onSave={vi.fn()} />)
|
||||||
|
|
||||||
|
const trigger = screen.getByText('Foo')
|
||||||
|
fireEvent.click(trigger)
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText('Search options...')
|
||||||
|
expect(searchInput).toBeTruthy()
|
||||||
|
expect(screen.getByText('abc')).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,68 +1,81 @@
|
|||||||
import { Check } from 'lucide-react'
|
import type { FieldInfo, SelectOption } from '@shumai/dtos'
|
||||||
|
import { Check, Plus, Search } from 'lucide-react'
|
||||||
import React, { useLayoutEffect, useRef, useState } from 'react'
|
import React, { useLayoutEffect, useRef, useState } from 'react'
|
||||||
|
import { toast } from 'sonner'
|
||||||
import type { FieldProps } from './field-types'
|
import type { FieldProps } from './field-types'
|
||||||
import type { SelectOption } from '@shumai/dtos'
|
import { client } from '@/ui/api/client'
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||||
import { getOptionStyle } from '../fields-manager'
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
|
import { useFieldStore } from '@/ui/stores/fields'
|
||||||
|
import { getOptionStyle, getRandomUnusedColor } from '../fields-manager'
|
||||||
|
|
||||||
const SelectMultiField: React.FC<FieldProps<string[]>> = ({
|
const SelectMultiField: React.FC<FieldProps<string[]>> = ({
|
||||||
value = [],
|
value = [],
|
||||||
config,
|
config,
|
||||||
onSave,
|
onSave,
|
||||||
readOnly,
|
readOnly,
|
||||||
|
fieldId,
|
||||||
}) => {
|
}) => {
|
||||||
const selectConfig = config?.selectMulti
|
const selectConfig = config?.selectMulti
|
||||||
|
const options: SelectOption[] = selectConfig?.options || []
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
const [isEditing, setIsEditing] = useState(false)
|
const [isEditing, setIsEditing] = useState(false)
|
||||||
const [expanded, setExpanded] = useState(false)
|
|
||||||
const [visibleCount, setVisibleCount] = useState(value.length)
|
const [visibleCount, setVisibleCount] = useState(value.length)
|
||||||
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
|
|
||||||
const selectedOptions =
|
const selectedOptions =
|
||||||
selectConfig?.options?.filter((opt: SelectOption) => (value || []).includes(opt.id)) || []
|
options.filter((opt: SelectOption) => (value || []).includes(opt.id)) || []
|
||||||
|
|
||||||
|
const trimmedSearch = searchQuery.trim()
|
||||||
|
const filteredOptions = options.filter((opt: SelectOption) =>
|
||||||
|
opt.displayName.toLowerCase().includes(trimmedSearch.toLowerCase()),
|
||||||
|
)
|
||||||
|
const hasExactMatch = options.some(
|
||||||
|
(opt: SelectOption) =>
|
||||||
|
opt.displayName.trim().toLowerCase() === trimmedSearch.toLowerCase() ||
|
||||||
|
opt.id.toLowerCase() === trimmedSearch.toLowerCase(),
|
||||||
|
)
|
||||||
|
|
||||||
// Dynamic calculation for how many items fit in one line
|
// Dynamic calculation for how many items fit in one line
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (isEditing || expanded) {
|
if (isEditing) {
|
||||||
// When editing or expanded, we technically don't use visibleCount for rendering
|
|
||||||
// (we render all), but keeping state clean is good.
|
|
||||||
setVisibleCount(selectedOptions.length)
|
setVisibleCount(selectedOptions.length)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (containerRef.current) {
|
if (containerRef.current) {
|
||||||
const containerWidth = containerRef.current.offsetWidth
|
const innerWidth = containerRef.current.clientWidth - 8 // account for px-1 (8px padding)
|
||||||
const canvas = document.createElement('canvas')
|
const canvas = document.createElement('canvas')
|
||||||
const context = canvas.getContext('2d')
|
const context = canvas.getContext('2d')
|
||||||
if (context) {
|
if (context && innerWidth > 0) {
|
||||||
context.font = '12px ui-sans-serif, system-ui, sans-serif'
|
context.font = '500 12px ui-sans-serif, system-ui, sans-serif'
|
||||||
|
const gap = 4
|
||||||
|
const badgeWidths = selectedOptions.map(
|
||||||
|
(opt) => Math.ceil(context.measureText(opt.displayName).width) + 18,
|
||||||
|
)
|
||||||
|
const totalAllWidth =
|
||||||
|
badgeWidths.reduce((a, b) => a + b, 0) + Math.max(0, badgeWidths.length - 1) * gap
|
||||||
|
|
||||||
|
if (totalAllWidth <= innerWidth) {
|
||||||
|
setVisibleCount(selectedOptions.length)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const moreBadgeWidth = 32
|
||||||
|
const maxAvailableWidth = innerWidth - moreBadgeWidth - gap
|
||||||
let currentWidth = 0
|
let currentWidth = 0
|
||||||
let count = 0
|
let count = 0
|
||||||
const moreBadgeWidth = 28
|
|
||||||
// We use a small buffer to be safe
|
|
||||||
const maxAvailableWidth = containerWidth - moreBadgeWidth
|
|
||||||
|
|
||||||
for (let i = 0; i < selectedOptions.length; i++) {
|
for (let i = 0; i < badgeWidths.length; i++) {
|
||||||
const textWidth = context.measureText(selectedOptions[i].displayName).width
|
const widthWithGap = count > 0 ? currentWidth + gap + badgeWidths[i] : badgeWidths[i]
|
||||||
const badgeWidth = textWidth + 16 + 4 // 16px padding, 4px gap
|
if (widthWithGap > maxAvailableWidth) break
|
||||||
|
currentWidth = widthWithGap
|
||||||
if (currentWidth + badgeWidth > maxAvailableWidth && i < selectedOptions.length - 1) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if (i === selectedOptions.length - 1) {
|
|
||||||
if (currentWidth + badgeWidth <= containerWidth) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
currentWidth += badgeWidth
|
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
setVisibleCount(count)
|
setVisibleCount(count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedOptions, isEditing, expanded, value])
|
}, [selectedOptions, isEditing, value])
|
||||||
|
|
||||||
const toggleOption = (optionId: string) => {
|
const toggleOption = (optionId: string) => {
|
||||||
const currentVal = value || []
|
const currentVal = value || []
|
||||||
@@ -75,44 +88,70 @@ const SelectMultiField: React.FC<FieldProps<string[]>> = ({
|
|||||||
onSave(newVal)
|
onSave(newVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePlaceholderClick = (e: React.MouseEvent) => {
|
const handleAddOption = async () => {
|
||||||
e.stopPropagation()
|
if (!trimmedSearch) return
|
||||||
if (isEditing) return
|
const newOption: SelectOption = {
|
||||||
|
id: trimmedSearch.toLowerCase().replace(/\s+/g, '-'),
|
||||||
|
displayName: trimmedSearch,
|
||||||
|
color: getRandomUnusedColor(options),
|
||||||
|
}
|
||||||
|
const newOptions = [...options, newOption]
|
||||||
|
const updatedConfig = {
|
||||||
|
...config,
|
||||||
|
selectMulti: {
|
||||||
|
...selectConfig,
|
||||||
|
options: newOptions,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// "if there is hidden items, first click will expand"
|
if (fieldId) {
|
||||||
const hiddenCount = selectedOptions.length - visibleCount
|
try {
|
||||||
if (!expanded && hiddenCount > 0) {
|
const res = await client.api.fields[':fieldId'].$put({
|
||||||
setExpanded(true)
|
param: { fieldId },
|
||||||
} else {
|
json: { config: updatedConfig },
|
||||||
// "if there is no hidden items, will change to edit mode"
|
})
|
||||||
if (!readOnly) {
|
if (!res.ok) {
|
||||||
setIsEditing(true)
|
toast.error(m.failed_update_field())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const updatedField = (await res.json()) as FieldInfo
|
||||||
|
const currentFields = useFieldStore.getState().fields
|
||||||
|
const newFields = currentFields.map((f) =>
|
||||||
|
f.id === updatedField.id
|
||||||
|
? { ...f, ...(updatedField as FieldInfo), visible: f.visible }
|
||||||
|
: f,
|
||||||
|
)
|
||||||
|
useFieldStore.getState().updateFields(newFields)
|
||||||
|
} catch {
|
||||||
|
toast.error(m.failed_update_field())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSave([...(value || []), newOption.id])
|
||||||
|
setSearchQuery('')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOverlayClick = (e: React.MouseEvent) => {
|
const handlePlaceholderClick = (e: React.MouseEvent) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
// "second click (on expanded) will change to edit mode"
|
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
setIsEditing(true)
|
setIsEditing(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hiddenCount = selectedOptions.length - visibleCount
|
const hiddenCount = selectedOptions.length - visibleCount
|
||||||
const isOpen = (expanded && !isEditing) || isEditing
|
|
||||||
|
|
||||||
const handleOpenChange = (open: boolean) => {
|
const handleOpenChange = (open: boolean) => {
|
||||||
if (readOnly) return
|
if (readOnly) return
|
||||||
|
setIsEditing(open)
|
||||||
if (!open) {
|
if (!open) {
|
||||||
setExpanded(false)
|
setSearchQuery('')
|
||||||
setIsEditing(false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
||||||
<Popover open={!readOnly && isOpen} onOpenChange={handleOpenChange}>
|
<Popover open={!readOnly && isEditing} onOpenChange={handleOpenChange}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
{/* Placeholder Display Mode */}
|
{/* Placeholder Display Mode */}
|
||||||
<div
|
<div
|
||||||
@@ -148,37 +187,36 @@ const SelectMultiField: React.FC<FieldProps<string[]>> = ({
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
|
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
className={`p-1 bg-popover border rounded-lg shadow-xl max-h-60 overflow-auto ${
|
side="bottom"
|
||||||
expanded && !isEditing
|
|
||||||
? 'w-[--radix-popover-trigger-width] min-w-[200px] flex flex-wrap gap-1 border-ring min-h-[32px] h-auto cursor-pointer'
|
|
||||||
: 'w-64 border-border'
|
|
||||||
}`}
|
|
||||||
align="start"
|
align="start"
|
||||||
onClick={expanded && !isEditing ? handleOverlayClick : undefined}
|
sideOffset={4}
|
||||||
|
className="p-1.5 w-64 max-h-72 flex flex-col bg-popover border border-border rounded-lg shadow-lg"
|
||||||
>
|
>
|
||||||
{expanded && !isEditing ? (
|
<div
|
||||||
<>
|
className="relative pb-1.5 border-b border-border mb-1"
|
||||||
{selectedOptions.length === 0 && (
|
onClick={(e) => e.stopPropagation()}
|
||||||
<span className="text-muted-foreground text-sm italic px-1 pt-0.5">Empty</span>
|
>
|
||||||
)}
|
<Search className="w-3.5 h-3.5 absolute left-2 top-2 text-muted-foreground" />
|
||||||
{selectedOptions.map((option: SelectOption) => (
|
<input
|
||||||
<span
|
type="text"
|
||||||
key={option.id}
|
className="w-full pl-7 pr-2 py-1 text-xs bg-muted/50 border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-ring text-foreground"
|
||||||
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-transparent whitespace-nowrap h-[22px]"
|
placeholder={m.search_options_placeholder()}
|
||||||
style={getOptionStyle(option.color)}
|
value={searchQuery}
|
||||||
>
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
{option.displayName}
|
autoFocus
|
||||||
</span>
|
/>
|
||||||
))}
|
</div>
|
||||||
</>
|
|
||||||
) : (
|
<div className="overflow-y-auto max-h-48 min-h-[120px] space-y-0.5">
|
||||||
selectConfig?.options?.map((option: SelectOption) => {
|
{filteredOptions.map((option: SelectOption) => {
|
||||||
const isSelected = (value || []).includes(option.id)
|
const isSelected = (value || []).includes(option.id)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={option.id}
|
key={option.id}
|
||||||
onClick={() => toggleOption(option.id)}
|
onClick={() => toggleOption(option.id)}
|
||||||
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between"
|
className={`px-2.5 py-1.5 hover:bg-accent rounded cursor-pointer flex items-center justify-between text-xs ${
|
||||||
|
isSelected ? 'bg-accent/30 font-medium' : ''
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
|
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
|
||||||
@@ -186,11 +224,27 @@ const SelectMultiField: React.FC<FieldProps<string[]>> = ({
|
|||||||
>
|
>
|
||||||
{option.displayName}
|
{option.displayName}
|
||||||
</span>
|
</span>
|
||||||
{isSelected && <Check className="w-4 h-4 text-primary" />}
|
{isSelected && <Check className="w-3.5 h-3.5 text-primary" />}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})
|
})}
|
||||||
)}
|
|
||||||
|
{filteredOptions.length === 0 && !trimmedSearch && (
|
||||||
|
<div className="px-2.5 py-2 text-xs text-muted-foreground italic text-center">
|
||||||
|
{m.no_options_found()}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{trimmedSearch !== '' && !hasExactMatch && (
|
||||||
|
<div
|
||||||
|
onClick={handleAddOption}
|
||||||
|
className="px-2.5 py-1.5 text-xs text-primary hover:bg-accent rounded cursor-pointer flex items-center gap-1.5 font-medium border-t border-border mt-1 pt-1.5"
|
||||||
|
>
|
||||||
|
<Plus className="w-3.5 h-3.5 shrink-0" />
|
||||||
|
<span className="truncate">{m.add_option_with_name({ name: trimmedSearch })}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
const { members, fetchMembers } = useMemberStore()
|
const { members, fetchMembers } = useMemberStore()
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
const [isEditing, setIsEditing] = useState(false)
|
const [isEditing, setIsEditing] = useState(false)
|
||||||
const [expanded, setExpanded] = useState(false)
|
|
||||||
const [visibleCount, setVisibleCount] = useState(value.length)
|
const [visibleCount, setVisibleCount] = useState(value.length)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -34,45 +33,46 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
|
|
||||||
// Dynamic calculation for how many items fit in one line
|
// Dynamic calculation for how many items fit in one line
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (isEditing || expanded) {
|
if (isEditing) {
|
||||||
setVisibleCount(selectedUsers.length)
|
setVisibleCount(selectedUsers.length)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (containerRef.current) {
|
if (containerRef.current) {
|
||||||
const containerWidth = containerRef.current.offsetWidth
|
const innerWidth = containerRef.current.clientWidth - 8 // account for px-1 (8px padding)
|
||||||
const canvas = document.createElement('canvas')
|
const canvas = document.createElement('canvas')
|
||||||
const context = canvas.getContext('2d')
|
const context = canvas.getContext('2d')
|
||||||
if (context) {
|
if (context && innerWidth > 0) {
|
||||||
context.font = '12px ui-sans-serif, system-ui, sans-serif'
|
context.font = '500 12px ui-sans-serif, system-ui, sans-serif'
|
||||||
|
const gap = 4
|
||||||
|
const badgeWidths = selectedUsers.map((user) => {
|
||||||
|
const textWidth = Math.min(100, Math.ceil(context.measureText(user.name).width))
|
||||||
|
// 16px padding + 2px border + 16px avatar + 6px gap = 40px
|
||||||
|
return textWidth + 40
|
||||||
|
})
|
||||||
|
const totalAllWidth =
|
||||||
|
badgeWidths.reduce((a, b) => a + b, 0) + Math.max(0, badgeWidths.length - 1) * gap
|
||||||
|
|
||||||
|
if (totalAllWidth <= innerWidth) {
|
||||||
|
setVisibleCount(selectedUsers.length)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const moreBadgeWidth = 32
|
||||||
|
const maxAvailableWidth = innerWidth - moreBadgeWidth - gap
|
||||||
let currentWidth = 0
|
let currentWidth = 0
|
||||||
let count = 0
|
let count = 0
|
||||||
const moreBadgeWidth = 28
|
|
||||||
const maxAvailableWidth = containerWidth - moreBadgeWidth
|
|
||||||
|
|
||||||
for (let i = 0; i < selectedUsers.length; i++) {
|
for (let i = 0; i < badgeWidths.length; i++) {
|
||||||
const textWidth = context.measureText(selectedUsers[i].name).width
|
const widthWithGap = count > 0 ? currentWidth + gap + badgeWidths[i] : badgeWidths[i]
|
||||||
// 16px padding + 16px avatar + 6px gap + 4px extra gap
|
if (widthWithGap > maxAvailableWidth) break
|
||||||
const badgeWidth = textWidth + 42
|
currentWidth = widthWithGap
|
||||||
|
|
||||||
if (currentWidth + badgeWidth > maxAvailableWidth && i < selectedUsers.length - 1) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if (i === selectedUsers.length - 1) {
|
|
||||||
if (currentWidth + badgeWidth <= containerWidth) {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
currentWidth += badgeWidth
|
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
setVisibleCount(count)
|
setVisibleCount(count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedUsers, isEditing, expanded, value])
|
}, [selectedUsers, isEditing, value])
|
||||||
|
|
||||||
const toggleUser = (userId: string) => {
|
const toggleUser = (userId: string) => {
|
||||||
const currentVal = value || []
|
const currentVal = value || []
|
||||||
@@ -86,20 +86,6 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handlePlaceholderClick = (e: React.MouseEvent) => {
|
const handlePlaceholderClick = (e: React.MouseEvent) => {
|
||||||
e.stopPropagation()
|
|
||||||
if (isEditing) return
|
|
||||||
|
|
||||||
const hiddenCount = selectedUsers.length - visibleCount
|
|
||||||
if (!expanded && hiddenCount > 0) {
|
|
||||||
setExpanded(true)
|
|
||||||
} else {
|
|
||||||
if (!readOnly) {
|
|
||||||
setIsEditing(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleOverlayClick = (e: React.MouseEvent) => {
|
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
setIsEditing(true)
|
setIsEditing(true)
|
||||||
@@ -107,14 +93,10 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hiddenCount = selectedUsers.length - visibleCount
|
const hiddenCount = selectedUsers.length - visibleCount
|
||||||
const isOpen = (expanded && !isEditing) || isEditing
|
|
||||||
|
|
||||||
const handleOpenChange = (open: boolean) => {
|
const handleOpenChange = (open: boolean) => {
|
||||||
if (readOnly) return
|
if (readOnly) return
|
||||||
if (!open) {
|
setIsEditing(open)
|
||||||
setExpanded(false)
|
|
||||||
setIsEditing(false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderUserBadge = (user: UserInfo) => {
|
const renderUserBadge = (user: UserInfo) => {
|
||||||
@@ -136,7 +118,7 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
||||||
<Popover open={!readOnly && isOpen} onOpenChange={handleOpenChange}>
|
<Popover open={!readOnly && isEditing} onOpenChange={handleOpenChange}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<div
|
<div
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
@@ -162,44 +144,30 @@ const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, re
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
|
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
className={`p-1 bg-popover border rounded-lg shadow-xl max-h-60 overflow-auto ${
|
className="p-1 w-[--radix-popover-trigger-width] min-w-[200px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg"
|
||||||
expanded && !isEditing
|
|
||||||
? 'w-[--radix-popover-trigger-width] min-w-[200px] flex flex-wrap gap-1 border-ring min-h-[32px] h-auto cursor-pointer'
|
|
||||||
: 'w-64 border-border'
|
|
||||||
}`}
|
|
||||||
align="start"
|
align="start"
|
||||||
onClick={expanded && !isEditing ? handleOverlayClick : undefined}
|
|
||||||
>
|
>
|
||||||
{expanded && !isEditing ? (
|
{members.map((user) => {
|
||||||
<>
|
const isSelected = (value || []).includes(user.id)
|
||||||
{selectedUsers.length === 0 && (
|
return (
|
||||||
<span className="text-muted-foreground text-sm italic px-1 pt-0.5">Empty</span>
|
<div
|
||||||
)}
|
key={user.id}
|
||||||
{selectedUsers.map(renderUserBadge)}
|
onClick={() => toggleUser(user.id)}
|
||||||
</>
|
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm"
|
||||||
) : (
|
>
|
||||||
members.map((user) => {
|
<div className="flex items-center gap-2">
|
||||||
const isSelected = (value || []).includes(user.id)
|
<Avatar className="w-5 h-5">
|
||||||
return (
|
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
||||||
<div
|
<AvatarFallback className="text-[10px] bg-rose-400 text-black font-semibold">
|
||||||
key={user.id}
|
{getInitials(user.name)}
|
||||||
onClick={() => toggleUser(user.id)}
|
</AvatarFallback>
|
||||||
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm"
|
</Avatar>
|
||||||
>
|
<span className="text-sm font-medium text-foreground">{user.name}</span>
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Avatar className="w-5 h-5">
|
|
||||||
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
|
||||||
<AvatarFallback className="text-[10px] bg-rose-400 text-black font-semibold">
|
|
||||||
{getInitials(user.name)}
|
|
||||||
</AvatarFallback>
|
|
||||||
</Avatar>
|
|
||||||
<span className="text-sm font-medium text-foreground">{user.name}</span>
|
|
||||||
</div>
|
|
||||||
{isSelected && <Check className="w-4 h-4 text-primary" />}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
{isSelected && <Check className="w-4 h-4 text-primary" />}
|
||||||
})
|
</div>
|
||||||
)}
|
)
|
||||||
|
})}
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -419,6 +419,7 @@ export function FileCard({
|
|||||||
</label>
|
</label>
|
||||||
<div className="min-h-[28px]">
|
<div className="min-h-[28px]">
|
||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
|
fieldId={field.id}
|
||||||
config={field.config}
|
config={field.config}
|
||||||
value={itemFieldValueMap[field.id!]?.value}
|
value={itemFieldValueMap[field.id!]?.value}
|
||||||
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ export function FileListItem({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
|
fieldId={field.id}
|
||||||
config={field.config}
|
config={field.config}
|
||||||
value={itemFieldValueMap[field.id!]?.value}
|
value={itemFieldValueMap[field.id!]?.value}
|
||||||
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
||||||
|
|||||||
@@ -449,6 +449,7 @@ export function FileViewerRightSidebar({
|
|||||||
</label>
|
</label>
|
||||||
<div className="min-h-[28px]">
|
<div className="min-h-[28px]">
|
||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
|
fieldId={field.id}
|
||||||
config={field.config}
|
config={field.config}
|
||||||
value={itemFieldValueMap[field.id!]?.value}
|
value={itemFieldValueMap[field.id!]?.value}
|
||||||
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
onSave={canEdit ? (val) => onSaveField(field.id!, val) : undefined}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { DragDropProvider, KeyboardSensor, PointerSensor, type DragEndEvent } fr
|
|||||||
import { isSortable, useSortable } from '@dnd-kit/react/sortable'
|
import { isSortable, useSortable } from '@dnd-kit/react/sortable'
|
||||||
import {
|
import {
|
||||||
FieldType,
|
FieldType,
|
||||||
|
AutofillSource,
|
||||||
type FieldInfo,
|
type FieldInfo,
|
||||||
type FieldInfo as MetadataFieldInfo,
|
type FieldInfo as MetadataFieldInfo,
|
||||||
type SelectOption,
|
type SelectOption,
|
||||||
@@ -22,6 +23,7 @@ import {
|
|||||||
Plus,
|
Plus,
|
||||||
Settings,
|
Settings,
|
||||||
Sparkles,
|
Sparkles,
|
||||||
|
Bot,
|
||||||
X,
|
X,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
@@ -44,8 +46,9 @@ import {
|
|||||||
} from '@/ui/components/ui/dropdown-menu'
|
} from '@/ui/components/ui/dropdown-menu'
|
||||||
import { Input } from '@/ui/components/ui/input'
|
import { Input } from '@/ui/components/ui/input'
|
||||||
import { Label } from '@/ui/components/ui/label'
|
import { Label } from '@/ui/components/ui/label'
|
||||||
import { Switch } from '@/ui/components/ui/switch'
|
import { ToggleGroup, ToggleGroupItem } from '@/ui/components/ui/toggle-group'
|
||||||
import { cn } from '@/ui/lib/utils'
|
import { cn } from '@/ui/lib/utils'
|
||||||
|
import { AutofillSourceHelpTrigger } from '@/ui/components/autofill-source-help-dialog'
|
||||||
|
|
||||||
type ManageFieldsDialogProps = {
|
type ManageFieldsDialogProps = {
|
||||||
projectId: string
|
projectId: string
|
||||||
@@ -111,7 +114,12 @@ function SortableFieldRow({
|
|||||||
)}
|
)}
|
||||||
{!isSortable && <div className="w-4" />} {/* Spacer */}
|
{!isSortable && <div className="w-4" />} {/* Spacer */}
|
||||||
{Icon && <Icon className="h-4 w-4 text-muted-foreground shrink-0" />}
|
{Icon && <Icon className="h-4 w-4 text-muted-foreground shrink-0" />}
|
||||||
{field.aiAutofill && <Sparkles className="h-4 w-4 text-muted-foreground shrink-0" />}
|
{field.config?.autofillSource === AutofillSource.CONTENT && (
|
||||||
|
<Sparkles className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
)}
|
||||||
|
{field.config?.autofillSource === AutofillSource.CREATION_CONTEXT && (
|
||||||
|
<Bot className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
)}
|
||||||
<div className="flex-1 text-sm font-medium truncate">{field.config?.name}</div>
|
<div className="flex-1 text-sm font-medium truncate">{field.config?.name}</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -134,13 +142,13 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
const [editLabel, setEditLabel] = useState('')
|
const [editLabel, setEditLabel] = useState('')
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const [editConfig, setEditConfig] = useState<any>({})
|
const [editConfig, setEditConfig] = useState<any>({})
|
||||||
const [editAiAutofill, setEditAiAutofill] = useState(false)
|
const [editAutofillSource, setEditAutofillSource] = useState<AutofillSource>(AutofillSource.NONE)
|
||||||
const [editDescription, setEditDescription] = useState('')
|
const [editDescription, setEditDescription] = useState('')
|
||||||
|
|
||||||
// Creator State
|
// Creator State
|
||||||
const [newName, setNewName] = useState('')
|
const [newName, setNewName] = useState('')
|
||||||
const [newType, setNewType] = useState<FieldType | ''>('')
|
const [newType, setNewType] = useState<FieldType | ''>('')
|
||||||
const [newAiAutofill, setNewAiAutofill] = useState(false)
|
const [newAutofillSource, setNewAutofillSource] = useState<AutofillSource>(AutofillSource.NONE)
|
||||||
const [newDescription, setNewDescription] = useState('')
|
const [newDescription, setNewDescription] = useState('')
|
||||||
const [newOptions, setNewOptions] = useState<SelectOption[]>([])
|
const [newOptions, setNewOptions] = useState<SelectOption[]>([])
|
||||||
|
|
||||||
@@ -251,12 +259,12 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
if (field) {
|
if (field) {
|
||||||
setEditLabel(field.config?.name || '') // Using name as label for now if label missing
|
setEditLabel(field.config?.name || '') // Using name as label for now if label missing
|
||||||
setEditConfig(field.config || {})
|
setEditConfig(field.config || {})
|
||||||
setEditAiAutofill(field.aiAutofill || false)
|
setEditAutofillSource(field.config?.autofillSource ?? AutofillSource.NONE)
|
||||||
setEditDescription(field.description || '')
|
setEditDescription(field.description || '')
|
||||||
} else {
|
} else {
|
||||||
setEditLabel('')
|
setEditLabel('')
|
||||||
setEditConfig({})
|
setEditConfig({})
|
||||||
setEditAiAutofill(false)
|
setEditAutofillSource(AutofillSource.NONE)
|
||||||
setEditDescription('')
|
setEditDescription('')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,7 +280,7 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
setSelectedFieldId(null)
|
setSelectedFieldId(null)
|
||||||
setNewName('')
|
setNewName('')
|
||||||
setNewType('')
|
setNewType('')
|
||||||
setNewAiAutofill(false)
|
setNewAutofillSource(AutofillSource.NONE)
|
||||||
setNewDescription('')
|
setNewDescription('')
|
||||||
setNewOptions([])
|
setNewOptions([])
|
||||||
}
|
}
|
||||||
@@ -312,11 +320,11 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
config: {
|
config: {
|
||||||
name: newName,
|
name: newName,
|
||||||
type: newType,
|
type: newType,
|
||||||
|
autofillSource: newAutofillSource,
|
||||||
...typeConfig,
|
...typeConfig,
|
||||||
},
|
},
|
||||||
label: newName,
|
label: newName,
|
||||||
scope: selectedGroup === SCOPE_GROUPS.PROJECT ? undefined : selectedGroup,
|
scope: selectedGroup === SCOPE_GROUPS.PROJECT ? undefined : selectedGroup,
|
||||||
aiAutofill: newAiAutofill,
|
|
||||||
description: newDescription,
|
description: newDescription,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -331,8 +339,8 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
...selectedField.config,
|
...selectedField.config,
|
||||||
...editConfig,
|
...editConfig,
|
||||||
name: editLabel,
|
name: editLabel,
|
||||||
|
autofillSource: editAutofillSource,
|
||||||
},
|
},
|
||||||
aiAutofill: editAiAutofill,
|
|
||||||
description: editDescription,
|
description: editDescription,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -396,9 +404,38 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
placeholder={m.description_optional_placeholder()}
|
placeholder={m.description_optional_placeholder()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="space-y-2">
|
||||||
<Switch checked={newAiAutofill} onCheckedChange={setNewAiAutofill} />
|
<div className="flex items-center gap-1">
|
||||||
<Label>{m.ai_autofill()}</Label>
|
<Label>{m.autofill_source()}</Label>
|
||||||
|
<AutofillSourceHelpTrigger />
|
||||||
|
</div>
|
||||||
|
<ToggleGroup
|
||||||
|
type="single"
|
||||||
|
value={newAutofillSource}
|
||||||
|
onValueChange={(val: string) => {
|
||||||
|
if (val) setNewAutofillSource(val as AutofillSource)
|
||||||
|
}}
|
||||||
|
className="w-full grid grid-cols-3 border rounded-md p-1 gap-1"
|
||||||
|
>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.NONE}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_none()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CONTENT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_content()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CREATION_CONTEXT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_creation_context()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
</ToggleGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(newType === FieldType.select || newType === FieldType.selectMulti) && (
|
{(newType === FieldType.select || newType === FieldType.selectMulti) && (
|
||||||
@@ -518,13 +555,42 @@ export function ManageFieldsDialog({ projectId, open, onOpenChange }: ManageFiel
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center space-x-2">
|
<div className="space-y-2">
|
||||||
<Switch
|
<div className="flex items-center gap-1">
|
||||||
checked={editAiAutofill}
|
<Label>{m.autofill_source()}</Label>
|
||||||
onCheckedChange={setEditAiAutofill}
|
<AutofillSourceHelpTrigger />
|
||||||
|
</div>
|
||||||
|
<ToggleGroup
|
||||||
|
type="single"
|
||||||
|
value={isCreating ? newAutofillSource : editAutofillSource}
|
||||||
|
onValueChange={(val) => {
|
||||||
|
if (val) {
|
||||||
|
if (isCreating) setNewAutofillSource(val as AutofillSource)
|
||||||
|
else setEditAutofillSource(val as AutofillSource)
|
||||||
|
}
|
||||||
|
}}
|
||||||
disabled={isReadOnly}
|
disabled={isReadOnly}
|
||||||
/>
|
className="w-full grid grid-cols-3 border rounded-md p-1 gap-1"
|
||||||
<Label>{m.ai_autofill()}</Label>
|
>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.NONE}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_none()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CONTENT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_content()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value={AutofillSource.CREATION_CONTEXT}
|
||||||
|
className="text-[11px] leading-tight py-1 px-1 h-auto min-h-[32px] w-full text-center justify-center whitespace-normal font-medium"
|
||||||
|
>
|
||||||
|
{m.autofill_source_creation_context()}
|
||||||
|
</ToggleGroupItem>
|
||||||
|
</ToggleGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* TODO: Add specific option editors here */}
|
{/* TODO: Add specific option editors here */}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
|||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
||||||
import { Input } from '@/ui/components/ui/input'
|
import { Input } from '@/ui/components/ui/input'
|
||||||
import { Button } from '@/ui/components/ui/button'
|
import { Button } from '@/ui/components/ui/button'
|
||||||
import { Loader2, Plus, X, Globe, Check, Trash2, ShieldAlert } from 'lucide-react'
|
import { Switch } from '@/ui/components/ui/switch'
|
||||||
|
import { Loader2, Plus, X, Globe, Check, Trash2, ShieldAlert, Info } from 'lucide-react'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import { m } from '@/ui/paraglide/messages.js'
|
import { m } from '@/ui/paraglide/messages.js'
|
||||||
|
|
||||||
@@ -25,7 +26,11 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const { mutate: updateSandbox, isPending: isUpdating } = useMutation({
|
const { mutate: updateSandbox, isPending: isUpdating } = useMutation({
|
||||||
mutationFn: async (params: { allowedDomains: string[]; pendingDomains: string[] }) => {
|
mutationFn: async (params: {
|
||||||
|
networkSandboxEnabled?: boolean
|
||||||
|
allowedDomains?: string[]
|
||||||
|
pendingDomains?: string[]
|
||||||
|
}) => {
|
||||||
const res = await client.api.teams[':teamId'].sandbox.$put({
|
const res = await client.api.teams[':teamId'].sandbox.$put({
|
||||||
param: { teamId },
|
param: { teamId },
|
||||||
json: params,
|
json: params,
|
||||||
@@ -42,6 +47,12 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const handleToggleNetworkSandbox = (enabled: boolean) => {
|
||||||
|
updateSandbox({
|
||||||
|
networkSandboxEnabled: enabled,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleAddDomain = (e: React.FormEvent) => {
|
const handleAddDomain = (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (!newDomain.trim()) return
|
if (!newDomain.trim()) return
|
||||||
@@ -80,6 +91,8 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isNetworkSandboxEnabled = !!sandbox?.networkSandboxEnabled
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollArea className="h-full">
|
<ScrollArea className="h-full">
|
||||||
<div className="space-y-6 pr-4 pb-8">
|
<div className="space-y-6 pr-4 pb-8">
|
||||||
@@ -92,14 +105,42 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
<CardDescription>{m.network_sandbox_description()}</CardDescription>
|
<CardDescription>{m.network_sandbox_description()}</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
|
{/* Toggle Switch */}
|
||||||
|
<div className="flex items-center justify-between p-4 mb-6 rounded-lg border border-border bg-muted/30">
|
||||||
|
<div className="space-y-0.5 pr-4">
|
||||||
|
<label
|
||||||
|
htmlFor="network-sandbox-switch"
|
||||||
|
className="text-sm font-medium text-foreground cursor-pointer"
|
||||||
|
>
|
||||||
|
{m.enable_network_sandbox()}
|
||||||
|
</label>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{m.network_sandbox_enabled_description()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
id="network-sandbox-switch"
|
||||||
|
checked={isNetworkSandboxEnabled}
|
||||||
|
onCheckedChange={handleToggleNetworkSandbox}
|
||||||
|
disabled={isUpdating}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!isNetworkSandboxEnabled && (
|
||||||
|
<div className="flex items-start gap-2.5 p-3.5 mb-6 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-300 text-sm">
|
||||||
|
<Info className="w-4 h-4 mt-0.5 shrink-0" />
|
||||||
|
<span>{m.network_sandbox_disabled_notice()}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<form onSubmit={handleAddDomain} className="flex gap-2 mb-6">
|
<form onSubmit={handleAddDomain} className="flex gap-2 mb-6">
|
||||||
<Input
|
<Input
|
||||||
placeholder="e.g. api.openai.com"
|
placeholder="e.g. api.openai.com"
|
||||||
value={newDomain}
|
value={newDomain}
|
||||||
onChange={(e) => setNewDomain(e.target.value)}
|
onChange={(e) => setNewDomain(e.target.value)}
|
||||||
disabled={isUpdating}
|
disabled={isUpdating || !isNetworkSandboxEnabled}
|
||||||
/>
|
/>
|
||||||
<Button type="submit" disabled={isUpdating}>
|
<Button type="submit" disabled={isUpdating || !isNetworkSandboxEnabled}>
|
||||||
{isUpdating ? (
|
{isUpdating ? (
|
||||||
<Loader2 className="w-4 h-4 animate-spin" />
|
<Loader2 className="w-4 h-4 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
@@ -114,7 +155,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
{m.allowed_domains()}
|
{m.allowed_domains()}
|
||||||
</h4>
|
</h4>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
{sandbox?.allowedDomains.map((domain) => (
|
{sandbox?.allowedDomains.map((domain: string) => (
|
||||||
<div
|
<div
|
||||||
key={domain}
|
key={domain}
|
||||||
className="flex items-center gap-1 px-3 py-1.5 bg-muted rounded-full text-sm border border-border transition-all hover:border-muted-foreground/50"
|
className="flex items-center gap-1 px-3 py-1.5 bg-muted rounded-full text-sm border border-border transition-all hover:border-muted-foreground/50"
|
||||||
@@ -122,8 +163,8 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
<span className="font-medium text-foreground">{domain}</span>
|
<span className="font-medium text-foreground">{domain}</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRemoveDomain(domain)}
|
onClick={() => handleRemoveDomain(domain)}
|
||||||
className="ml-1 text-muted-foreground hover:text-destructive transition-colors"
|
className="ml-1 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
disabled={isUpdating}
|
disabled={isUpdating || !isNetworkSandboxEnabled}
|
||||||
>
|
>
|
||||||
<X className="w-3.5 h-3.5" />
|
<X className="w-3.5 h-3.5" />
|
||||||
</button>
|
</button>
|
||||||
@@ -152,7 +193,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{sandbox?.pendingDomains && sandbox.pendingDomains.length > 0 ? (
|
{sandbox?.pendingDomains && sandbox.pendingDomains.length > 0 ? (
|
||||||
<div className="divide-y divide-border">
|
<div className="divide-y divide-border">
|
||||||
{sandbox.pendingDomains.map((domain) => (
|
{sandbox.pendingDomains.map((domain: string) => (
|
||||||
<div
|
<div
|
||||||
key={domain}
|
key={domain}
|
||||||
className="flex items-center justify-between py-2.5 first:pt-0 last:pb-0"
|
className="flex items-center justify-between py-2.5 first:pt-0 last:pb-0"
|
||||||
@@ -166,7 +207,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 border-emerald-500/20 text-emerald-600 hover:bg-emerald-500/10 hover:text-emerald-600 dark:text-emerald-400 dark:hover:bg-emerald-500/20"
|
className="h-8 border-emerald-500/20 text-emerald-600 hover:bg-emerald-500/10 hover:text-emerald-600 dark:text-emerald-400 dark:hover:bg-emerald-500/20"
|
||||||
onClick={() => handleApproveDomain(domain)}
|
onClick={() => handleApproveDomain(domain)}
|
||||||
disabled={isUpdating}
|
disabled={isUpdating || !isNetworkSandboxEnabled}
|
||||||
>
|
>
|
||||||
<Check className="w-4 h-4 mr-1.5" />
|
<Check className="w-4 h-4 mr-1.5" />
|
||||||
{m.approve()}
|
{m.approve()}
|
||||||
@@ -176,7 +217,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="h-8 border-destructive/20 text-destructive hover:bg-destructive/10"
|
className="h-8 border-destructive/20 text-destructive hover:bg-destructive/10"
|
||||||
onClick={() => handleDeletePendingDomain(domain)}
|
onClick={() => handleDeletePendingDomain(domain)}
|
||||||
disabled={isUpdating}
|
disabled={isUpdating || !isNetworkSandboxEnabled}
|
||||||
>
|
>
|
||||||
<Trash2 className="w-4 h-4 mr-1.5" />
|
<Trash2 className="w-4 h-4 mr-1.5" />
|
||||||
{m.delete()}
|
{m.delete()}
|
||||||
|
|||||||
@@ -491,7 +491,10 @@
|
|||||||
"failed_to_update_sandbox_settings": "Failed to update sandbox settings",
|
"failed_to_update_sandbox_settings": "Failed to update sandbox settings",
|
||||||
"domain_already_exists": "Domain already exists",
|
"domain_already_exists": "Domain already exists",
|
||||||
"network_sandbox": "Network Sandbox",
|
"network_sandbox": "Network Sandbox",
|
||||||
"network_sandbox_description": "Configure allowed domains for the sandboxed agent. By default, only essential domains are allowed.",
|
"network_sandbox_description": "Configure domain access controls for the sandboxed agent.",
|
||||||
|
"enable_network_sandbox": "Enable Network Sandbox",
|
||||||
|
"network_sandbox_enabled_description": "When enabled, network requests from the agent are restricted to allowed domains. When disabled, all network requests are permitted.",
|
||||||
|
"network_sandbox_disabled_notice": "Network Sandbox is currently OFF. All outbound network requests from agent scripts are permitted without restrictions.",
|
||||||
"add_domain": "Add Domain",
|
"add_domain": "Add Domain",
|
||||||
"allowed_domains": "Allowed Domains",
|
"allowed_domains": "Allowed Domains",
|
||||||
"no_custom_domains_allowed": "No custom domains allowed",
|
"no_custom_domains_allowed": "No custom domains allowed",
|
||||||
@@ -701,7 +704,18 @@
|
|||||||
"field_type": "Field Type",
|
"field_type": "Field Type",
|
||||||
"select_field_type": "Select field type",
|
"select_field_type": "Select field type",
|
||||||
"description_optional_placeholder": "Optional, used for AI autofill",
|
"description_optional_placeholder": "Optional, used for AI autofill",
|
||||||
"ai_autofill": "AI Autofill",
|
"autofill_source": "Autofill Source",
|
||||||
|
"autofill_source_none": "None",
|
||||||
|
"autofill_source_content": "Content",
|
||||||
|
"autofill_source_creation_context": "Creation Context",
|
||||||
|
"autofill_source_help_title": "Autofill Source Guide",
|
||||||
|
"autofill_source_help_desc": "Understand how each autofill source option works and when to use it.",
|
||||||
|
"autofill_source_none_desc": "Metadata fields marked as 'None' will not be automatically populated by AI. They are meant for manual user entry.",
|
||||||
|
"autofill_source_none_example": "Example: Internal tags, manual notes, status tracking flags.",
|
||||||
|
"autofill_source_content_desc": "Fields marked as 'Content' are automatically analyzed and extracted from the asset's visual or textual content after upload. Note: A team owner must first create and enable an Autofill Agent in team settings for content extraction to run.",
|
||||||
|
"autofill_source_content_example": "Example: Image subject category, visual color palette, document summary, auto-detected language.",
|
||||||
|
"autofill_source_creation_context_desc": "Fields marked as 'Creation Context' capture details available at creation time (such as generation prompt, model, or provider). If an asset is created by a Shumai AI Agent, the agent will automatically populate these fields upon creation (without needing an Autofill Agent enabled). If uploaded manually by a human user, the user must enter these values manually.",
|
||||||
|
"autofill_source_creation_context_example": "Example: Generation prompt, AI model name, LLM provider, sampler seed parameters.",
|
||||||
"select_field_to_edit": "Select a field to edit options",
|
"select_field_to_edit": "Select a field to edit options",
|
||||||
"type_label": "Type:",
|
"type_label": "Type:",
|
||||||
"options": "Options",
|
"options": "Options",
|
||||||
@@ -717,6 +731,9 @@
|
|||||||
"visible_count": "({count} visible)",
|
"visible_count": "({count} visible)",
|
||||||
"option_name_placeholder": "Option name",
|
"option_name_placeholder": "Option name",
|
||||||
"unknown_field_type": "Unknown Field Type",
|
"unknown_field_type": "Unknown Field Type",
|
||||||
|
"search_options_placeholder": "Search options...",
|
||||||
|
"add_option_with_name": "Add options: {name}",
|
||||||
|
"no_options_found": "No options found",
|
||||||
|
|
||||||
"settings_updated": "Settings updated",
|
"settings_updated": "Settings updated",
|
||||||
"failed_update_settings": "Failed to update settings",
|
"failed_update_settings": "Failed to update settings",
|
||||||
|
|||||||
@@ -491,7 +491,10 @@
|
|||||||
"failed_to_update_sandbox_settings": "更新沙箱设置失败",
|
"failed_to_update_sandbox_settings": "更新沙箱设置失败",
|
||||||
"domain_already_exists": "域名已存在",
|
"domain_already_exists": "域名已存在",
|
||||||
"network_sandbox": "网络沙箱",
|
"network_sandbox": "网络沙箱",
|
||||||
"network_sandbox_description": "配置沙箱智能体的允许域名。默认情况下,仅允许必要域名。",
|
"network_sandbox_description": "配置沙箱智能体的域名访问控制。",
|
||||||
|
"enable_network_sandbox": "启用网络沙箱",
|
||||||
|
"network_sandbox_enabled_description": "启用后,智能体的网络请求将受限于允许的域名列表。禁用时,允许所有网络请求。",
|
||||||
|
"network_sandbox_disabled_notice": "网络沙箱目前处于关闭状态。智能体脚本的所有出站网络请求均不受限制。",
|
||||||
"add_domain": "添加域名",
|
"add_domain": "添加域名",
|
||||||
"allowed_domains": "允许的域名",
|
"allowed_domains": "允许的域名",
|
||||||
"no_custom_domains_allowed": "没有自定义允许域名",
|
"no_custom_domains_allowed": "没有自定义允许域名",
|
||||||
@@ -701,7 +704,18 @@
|
|||||||
"field_type": "字段类型",
|
"field_type": "字段类型",
|
||||||
"select_field_type": "选择字段类型",
|
"select_field_type": "选择字段类型",
|
||||||
"description_optional_placeholder": "可选,用于 AI 自动填充",
|
"description_optional_placeholder": "可选,用于 AI 自动填充",
|
||||||
"ai_autofill": "AI 自动填充",
|
"autofill_source": "自动填充来源",
|
||||||
|
"autofill_source_none": "无",
|
||||||
|
"autofill_source_content": "文件内容",
|
||||||
|
"autofill_source_creation_context": "创建上下文",
|
||||||
|
"autofill_source_help_title": "自动填充来源说明",
|
||||||
|
"autofill_source_help_desc": "了解每种自动填充来源的工作方式及适用场景。",
|
||||||
|
"autofill_source_none_desc": "设置为“无”的字段不会由 AI 自动填充,需由用户手动填写。",
|
||||||
|
"autofill_source_none_example": "示例:内部标签、手动备注、状态标记。",
|
||||||
|
"autofill_source_content_desc": "设置为“文件内容”的字段将在文件上传后,由 AI 自动分析并从文件的视觉或文本内容中提取填写。注意:需要团队 Owner 先在设置中创建并启用“Autofill Agent”(自动填充 Agent),上传后才会触发内容提取。",
|
||||||
|
"autofill_source_content_example": "示例:图片类别、主色调、文档摘要、自动识别语言。",
|
||||||
|
"autofill_source_creation_context_desc": "设置为“创建上下文”的字段用于记录生成资产时的上下文信息(如 Prompt、模型或供应商)。若文件由 Shumai AI Agent 生成/创建,Agent 会在创建时刻自动填入这些字段(无需启用 Autofill Agent);若由真实用户手动上传,则需用户手动填写,不会自动提取。",
|
||||||
|
"autofill_source_creation_context_example": "示例:生成 Prompt、AI 模型名称、LLM 供应商、采样种子参数。",
|
||||||
"select_field_to_edit": "选择一个字段以编辑选项",
|
"select_field_to_edit": "选择一个字段以编辑选项",
|
||||||
"type_label": "类型:",
|
"type_label": "类型:",
|
||||||
"options": "选项",
|
"options": "选项",
|
||||||
@@ -717,6 +731,9 @@
|
|||||||
"visible_count": "({count} 个可见)",
|
"visible_count": "({count} 个可见)",
|
||||||
"option_name_placeholder": "选项名称",
|
"option_name_placeholder": "选项名称",
|
||||||
"unknown_field_type": "未知字段类型",
|
"unknown_field_type": "未知字段类型",
|
||||||
|
"search_options_placeholder": "搜索选项...",
|
||||||
|
"add_option_with_name": "添加选项:{name}",
|
||||||
|
"no_options_found": "未找到选项",
|
||||||
|
|
||||||
"settings_updated": "设置已更新",
|
"settings_updated": "设置已更新",
|
||||||
"failed_update_settings": "更新设置失败",
|
"failed_update_settings": "更新设置失败",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@shumai/webui",
|
"name": "@shumai/webui",
|
||||||
"version": "0.3.6",
|
"version": "0.3.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./index.html",
|
"main": "./index.html",
|
||||||
|
|||||||
+18
-1
@@ -472,6 +472,9 @@ export * from "./failed_to_update_sandbox_settings.js";
|
|||||||
export * from "./domain_already_exists.js";
|
export * from "./domain_already_exists.js";
|
||||||
export * from "./network_sandbox.js";
|
export * from "./network_sandbox.js";
|
||||||
export * from "./network_sandbox_description.js";
|
export * from "./network_sandbox_description.js";
|
||||||
|
export * from "./enable_network_sandbox.js";
|
||||||
|
export * from "./network_sandbox_enabled_description.js";
|
||||||
|
export * from "./network_sandbox_disabled_notice.js";
|
||||||
export * from "./add_domain.js";
|
export * from "./add_domain.js";
|
||||||
export * from "./allowed_domains.js";
|
export * from "./allowed_domains.js";
|
||||||
export * from "./no_custom_domains_allowed.js";
|
export * from "./no_custom_domains_allowed.js";
|
||||||
@@ -662,7 +665,18 @@ export * from "./field_name_placeholder.js";
|
|||||||
export * from "./field_type.js";
|
export * from "./field_type.js";
|
||||||
export * from "./select_field_type.js";
|
export * from "./select_field_type.js";
|
||||||
export * from "./description_optional_placeholder.js";
|
export * from "./description_optional_placeholder.js";
|
||||||
export * from "./ai_autofill.js";
|
export * from "./autofill_source.js";
|
||||||
|
export * from "./autofill_source_none.js";
|
||||||
|
export * from "./autofill_source_content.js";
|
||||||
|
export * from "./autofill_source_creation_context.js";
|
||||||
|
export * from "./autofill_source_help_title.js";
|
||||||
|
export * from "./autofill_source_help_desc.js";
|
||||||
|
export * from "./autofill_source_none_desc.js";
|
||||||
|
export * from "./autofill_source_none_example.js";
|
||||||
|
export * from "./autofill_source_content_desc.js";
|
||||||
|
export * from "./autofill_source_content_example.js";
|
||||||
|
export * from "./autofill_source_creation_context_desc.js";
|
||||||
|
export * from "./autofill_source_creation_context_example.js";
|
||||||
export * from "./select_field_to_edit.js";
|
export * from "./select_field_to_edit.js";
|
||||||
export * from "./type_label.js";
|
export * from "./type_label.js";
|
||||||
export * from "./options.js";
|
export * from "./options.js";
|
||||||
@@ -678,6 +692,9 @@ export * from "./search_fields_placeholder.js";
|
|||||||
export * from "./visible_count.js";
|
export * from "./visible_count.js";
|
||||||
export * from "./option_name_placeholder.js";
|
export * from "./option_name_placeholder.js";
|
||||||
export * from "./unknown_field_type.js";
|
export * from "./unknown_field_type.js";
|
||||||
|
export * from "./search_options_placeholder.js";
|
||||||
|
export * from "./add_option_with_name.js";
|
||||||
|
export * from "./no_options_found.js";
|
||||||
export * from "./settings_updated.js";
|
export * from "./settings_updated.js";
|
||||||
export * from "./failed_update_settings.js";
|
export * from "./failed_update_settings.js";
|
||||||
export * from "./unknown_user.js";
|
export * from "./unknown_user.js";
|
||||||
|
|||||||
+18
-1
@@ -474,6 +474,9 @@ export * from './failed_to_update_sandbox_settings.js'
|
|||||||
export * from './domain_already_exists.js'
|
export * from './domain_already_exists.js'
|
||||||
export * from './network_sandbox.js'
|
export * from './network_sandbox.js'
|
||||||
export * from './network_sandbox_description.js'
|
export * from './network_sandbox_description.js'
|
||||||
|
export * from './enable_network_sandbox.js'
|
||||||
|
export * from './network_sandbox_enabled_description.js'
|
||||||
|
export * from './network_sandbox_disabled_notice.js'
|
||||||
export * from './add_domain.js'
|
export * from './add_domain.js'
|
||||||
export * from './allowed_domains.js'
|
export * from './allowed_domains.js'
|
||||||
export * from './no_custom_domains_allowed.js'
|
export * from './no_custom_domains_allowed.js'
|
||||||
@@ -664,7 +667,18 @@ export * from './field_name_placeholder.js'
|
|||||||
export * from './field_type.js'
|
export * from './field_type.js'
|
||||||
export * from './select_field_type.js'
|
export * from './select_field_type.js'
|
||||||
export * from './description_optional_placeholder.js'
|
export * from './description_optional_placeholder.js'
|
||||||
export * from './ai_autofill.js'
|
export * from './autofill_source.js'
|
||||||
|
export * from './autofill_source_none.js'
|
||||||
|
export * from './autofill_source_content.js'
|
||||||
|
export * from './autofill_source_creation_context.js'
|
||||||
|
export * from './autofill_source_help_title.js'
|
||||||
|
export * from './autofill_source_help_desc.js'
|
||||||
|
export * from './autofill_source_none_desc.js'
|
||||||
|
export * from './autofill_source_none_example.js'
|
||||||
|
export * from './autofill_source_content_desc.js'
|
||||||
|
export * from './autofill_source_content_example.js'
|
||||||
|
export * from './autofill_source_creation_context_desc.js'
|
||||||
|
export * from './autofill_source_creation_context_example.js'
|
||||||
export * from './select_field_to_edit.js'
|
export * from './select_field_to_edit.js'
|
||||||
export * from './type_label.js'
|
export * from './type_label.js'
|
||||||
export * from './options.js'
|
export * from './options.js'
|
||||||
@@ -680,6 +694,9 @@ export * from './search_fields_placeholder.js'
|
|||||||
export * from './visible_count.js'
|
export * from './visible_count.js'
|
||||||
export * from './option_name_placeholder.js'
|
export * from './option_name_placeholder.js'
|
||||||
export * from './unknown_field_type.js'
|
export * from './unknown_field_type.js'
|
||||||
|
export * from './search_options_placeholder.js'
|
||||||
|
export * from './add_option_with_name.js'
|
||||||
|
export * from './no_options_found.js'
|
||||||
export * from './settings_updated.js'
|
export * from './settings_updated.js'
|
||||||
export * from './failed_update_settings.js'
|
export * from './failed_update_settings.js'
|
||||||
export * from './unknown_user.js'
|
export * from './unknown_user.js'
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Add options: {name}" |
|
||||||
|
*
|
||||||
|
* @param {Add_Option_With_NameInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const add_option_with_name: ((inputs: Add_Option_With_NameInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Add_Option_With_NameInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Add_Option_With_NameInputs = {
|
||||||
|
name: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ name: NonNullable<unknown> }} Add_Option_With_NameInputs */
|
||||||
|
|
||||||
|
const en_add_option_with_name = /** @type {(inputs: Add_Option_With_NameInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`Add options: ${i?.name}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_add_option_with_name = /** @type {(inputs: Add_Option_With_NameInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`添加选项:${i?.name}`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Add options: {name}" |
|
||||||
|
*
|
||||||
|
* @param {Add_Option_With_NameInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const add_option_with_name = /** @type {((inputs: Add_Option_With_NameInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Add_Option_With_NameInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_add_option_with_name(inputs)
|
||||||
|
return zh_add_option_with_name(inputs)
|
||||||
|
});
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
||||||
|
|
||||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
||||||
|
|
||||||
/** @typedef {{}} Ai_AutofillInputs */
|
|
||||||
|
|
||||||
const en_ai_autofill = /** @type {(inputs: Ai_AutofillInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`AI Autofill`)
|
|
||||||
};
|
|
||||||
|
|
||||||
const zh_ai_autofill = /** @type {(inputs: Ai_AutofillInputs) => LocalizedString} */ () => {
|
|
||||||
return /** @type {LocalizedString} */ (`AI 自动填充`)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* | output |
|
|
||||||
* | --- |
|
|
||||||
* | "AI Autofill" |
|
|
||||||
*
|
|
||||||
* @param {Ai_AutofillInputs} inputs
|
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
|
||||||
* @returns {LocalizedString}
|
|
||||||
*/
|
|
||||||
export const ai_autofill = /** @type {((inputs?: Ai_AutofillInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Ai_AutofillInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
||||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
||||||
if (locale === "en") return en_ai_autofill(inputs)
|
|
||||||
return zh_ai_autofill(inputs)
|
|
||||||
});
|
|
||||||
Generated
Vendored
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* | output |
|
* | output |
|
||||||
* | --- |
|
* | --- |
|
||||||
* | "AI Autofill" |
|
* | "Autofill Source" |
|
||||||
*
|
*
|
||||||
* @param {Ai_AutofillInputs} inputs
|
* @param {Autofill_SourceInputs} inputs
|
||||||
* @param {{ locale?: "en" | "zh" }} options
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
* @returns {LocalizedString}
|
* @returns {LocalizedString}
|
||||||
*/
|
*/
|
||||||
export const ai_autofill: ((inputs?: Ai_AutofillInputs, options?: {
|
export const autofill_source: ((inputs?: Autofill_SourceInputs, options?: {
|
||||||
locale?: "en" | "zh";
|
locale?: "en" | "zh";
|
||||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Ai_AutofillInputs, {
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_SourceInputs, {
|
||||||
locale?: "en" | "zh";
|
locale?: "en" | "zh";
|
||||||
}, {}>;
|
}, {}>;
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
export type Ai_AutofillInputs = {};
|
export type Autofill_SourceInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_SourceInputs */
|
||||||
|
|
||||||
|
const en_autofill_source = /** @type {(inputs: Autofill_SourceInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Autofill Source`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source = /** @type {(inputs: Autofill_SourceInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`自动填充来源`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Autofill Source" |
|
||||||
|
*
|
||||||
|
* @param {Autofill_SourceInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source = /** @type {((inputs?: Autofill_SourceInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_SourceInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source(inputs)
|
||||||
|
return zh_autofill_source(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Content" |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_ContentInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content: ((inputs?: Autofill_Source_ContentInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_ContentInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_ContentInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_Source_ContentInputs */
|
||||||
|
|
||||||
|
const en_autofill_source_content = /** @type {(inputs: Autofill_Source_ContentInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Content`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source_content = /** @type {(inputs: Autofill_Source_ContentInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`文件内容`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Content" |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_ContentInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content = /** @type {((inputs?: Autofill_Source_ContentInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_Source_ContentInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source_content(inputs)
|
||||||
|
return zh_autofill_source_content(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Fields marked as 'Content' are automatically analyzed and extracted from the asset's visual or textual content after upload. Note: A team owner must first cr..." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Content_DescInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content_desc: ((inputs?: Autofill_Source_Content_DescInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_Content_DescInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_Content_DescInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_Source_Content_DescInputs */
|
||||||
|
|
||||||
|
const en_autofill_source_content_desc = /** @type {(inputs: Autofill_Source_Content_DescInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Fields marked as 'Content' are automatically analyzed and extracted from the asset's visual or textual content after upload. Note: A team owner must first create and enable an Autofill Agent in team settings for content extraction to run.`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source_content_desc = /** @type {(inputs: Autofill_Source_Content_DescInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`设置为“文件内容”的字段将在文件上传后,由 AI 自动分析并从文件的视觉或文本内容中提取填写。注意:需要团队 Owner 先在设置中创建并启用“Autofill Agent”(自动填充 Agent),上传后才会触发内容提取。`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Fields marked as 'Content' are automatically analyzed and extracted from the asset's visual or textual content after upload. Note: A team owner must first cr..." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Content_DescInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content_desc = /** @type {((inputs?: Autofill_Source_Content_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_Source_Content_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source_content_desc(inputs)
|
||||||
|
return zh_autofill_source_content_desc(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Example: Image subject category, visual color palette, document summary, auto-detected language." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Content_ExampleInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content_example: ((inputs?: Autofill_Source_Content_ExampleInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_Content_ExampleInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_Content_ExampleInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_Source_Content_ExampleInputs */
|
||||||
|
|
||||||
|
const en_autofill_source_content_example = /** @type {(inputs: Autofill_Source_Content_ExampleInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Example: Image subject category, visual color palette, document summary, auto-detected language.`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source_content_example = /** @type {(inputs: Autofill_Source_Content_ExampleInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`示例:图片类别、主色调、文档摘要、自动识别语言。`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Example: Image subject category, visual color palette, document summary, auto-detected language." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Content_ExampleInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_content_example = /** @type {((inputs?: Autofill_Source_Content_ExampleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_Source_Content_ExampleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source_content_example(inputs)
|
||||||
|
return zh_autofill_source_content_example(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Creation Context" |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Creation_ContextInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_creation_context: ((inputs?: Autofill_Source_Creation_ContextInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_Creation_ContextInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_Creation_ContextInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_Source_Creation_ContextInputs */
|
||||||
|
|
||||||
|
const en_autofill_source_creation_context = /** @type {(inputs: Autofill_Source_Creation_ContextInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Creation Context`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source_creation_context = /** @type {(inputs: Autofill_Source_Creation_ContextInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`创建上下文`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Creation Context" |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Creation_ContextInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_creation_context = /** @type {((inputs?: Autofill_Source_Creation_ContextInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_Source_Creation_ContextInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source_creation_context(inputs)
|
||||||
|
return zh_autofill_source_creation_context(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Fields marked as 'Creation Context' capture details available at creation time (such as generation prompt, model, or provider). If an asset is created by a S..." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Creation_Context_DescInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_creation_context_desc: ((inputs?: Autofill_Source_Creation_Context_DescInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_Creation_Context_DescInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_Creation_Context_DescInputs = {};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{}} Autofill_Source_Creation_Context_DescInputs */
|
||||||
|
|
||||||
|
const en_autofill_source_creation_context_desc = /** @type {(inputs: Autofill_Source_Creation_Context_DescInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`Fields marked as 'Creation Context' capture details available at creation time (such as generation prompt, model, or provider). If an asset is created by a Shumai AI Agent, the agent will automatically populate these fields upon creation (without needing an Autofill Agent enabled). If uploaded manually by a human user, the user must enter these values manually.`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_autofill_source_creation_context_desc = /** @type {(inputs: Autofill_Source_Creation_Context_DescInputs) => LocalizedString} */ () => {
|
||||||
|
return /** @type {LocalizedString} */ (`设置为“创建上下文”的字段用于记录生成资产时的上下文信息(如 Prompt、模型或供应商)。若文件由 Shumai AI Agent 生成/创建,Agent 会在创建时刻自动填入这些字段(无需启用 Autofill Agent);若由真实用户手动上传,则需用户手动填写,不会自动提取。`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Fields marked as 'Creation Context' capture details available at creation time (such as generation prompt, model, or provider). If an asset is created by a S..." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Creation_Context_DescInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_creation_context_desc = /** @type {((inputs?: Autofill_Source_Creation_Context_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Autofill_Source_Creation_Context_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_autofill_source_creation_context_desc(inputs)
|
||||||
|
return zh_autofill_source_creation_context_desc(inputs)
|
||||||
|
});
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "Example: Generation prompt, AI model name, LLM provider, sampler seed parameters." |
|
||||||
|
*
|
||||||
|
* @param {Autofill_Source_Creation_Context_ExampleInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const autofill_source_creation_context_example: ((inputs?: Autofill_Source_Creation_Context_ExampleInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Autofill_Source_Creation_Context_ExampleInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type Autofill_Source_Creation_Context_ExampleInputs = {};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user