Compare commits

...
32 Commits
Author SHA1 Message Date
yiling 6e460430dd Release v0.1.7 2026-07-06 13:01:47 +08:00
yiling ffc578cb45 fix(comments): prevent reload of main viewer by invalidating only comments queries 2026-07-06 12:51:25 +08:00
Yiling-J 1414632c4a Merge pull request #179 from shumaiOne/feat/comment-completion
feat(comments): allow marking comments as complete or incomplete
2026-07-06 12:50:04 +08:00
yiling a312ecf7ef style(comments): use custom filled circle check icon and make actions row always visible 2026-07-06 12:40:20 +08:00
yiling e1d3dd46db feat(comments): allow marking comments as complete or incomplete 2026-07-06 12:24:40 +08:00
yiling af7d636f31 update cn translate 2026-07-06 11:49:51 +08:00
yiling b98b710222 update doc 2026-07-06 11:22:32 +08:00
Yiling-J 79b19d3983 Revise feature descriptions in README_CN.md
Updated feature descriptions and improved clarity in the README_CN.md file.
2026-07-06 11:15:29 +08:00
yiling 474fe7ced1 fix(webui): center unread badge count 2026-07-06 11:06:09 +08:00
Yiling-J bf82eff068 Merge pull request #178 from shumaiOne/feat/i18n-fixes
feat(i18n): localize members dialog, notifications, uploads, user menus, dates, and players
2026-07-06 10:59:24 +08:00
yiling 01a9c7cde6 refactor(i18n): address code review feedback on string legos, hardcoded locales, and fragile checks 2026-07-06 10:52:55 +08:00
yiling 45f3255796 feat(i18n): localize members dialog, notifications, uploads, user menus, dates, and players 2026-07-06 10:38:41 +08:00
Yiling-J 64ad183bc1 Merge pull request #177 from shumaiOne/docs-s3-storage
docs: improve documentation and examples for S3 compatible storage
2026-07-06 10:20:31 +08:00
yiling af8bc30409 docs: improve documentation and examples for S3 compatible storage 2026-07-06 10:13:12 +08:00
Yiling-J aac8bea4e8 Merge pull request #176 from shumaiOne/fix/upload-mime-type
fix(upload): resolve empty and generic MIME types in confirmFileUpload
2026-07-05 22:10:22 +08:00
yiling a05c0ac0db fix(upload): resolve empty and generic MIME types in confirmFileUpload
Use Bun's built-in file resolver to fall back to extension-based MIME type detection when the mediaType is missing, empty, or generic ('application/octet-stream').
2026-07-05 21:55:26 +08:00
Yiling-J 714158b5b2 Merge pull request #175 from shumaiOne/feat/audio-support
feat(audio): support frame-accurate audio playback, comments, and AI safeguards
2026-07-05 19:33:37 +08:00
yiling 8ad25215dd refactor(agent): prevent creating autofill and embedding tasks for audio assets 2026-07-05 16:31:14 +08:00
yiling 73aa374b2b feat(agent): prevent exposing screenshot and analyze_image tools and executing autofill/embeddings for audio files 2026-07-05 16:26:48 +08:00
yiling cee4142936 style(webui): use dark background for audio preview to keep duration clear 2026-07-05 16:16:04 +08:00
yiling 0f6912c977 feat(webui): render duration overlay for audio files in file browser 2026-07-05 16:13:00 +08:00
yiling 868e7b2a7b fix(webui): remount file viewer when file ID changes to reset state 2026-07-05 16:10:01 +08:00
yiling ccfcdce23c fix(upload): correct .wma MIME type to audio prefix on upload and add tests 2026-07-05 15:57:29 +08:00
yiling 8d336836cc test(webui): add audio comment seek roundtrip E2E test case 2026-07-05 15:37:30 +08:00
yiling f24c8afa3d test(webui): add e2e test to verify playhead advances immediately for audio assets 2026-07-05 15:28:18 +08:00
yiling e511af219e fix(webui): immediately use currentTime fallback in useFramePlayer for audio files 2026-07-05 15:23:52 +08:00
yiling 5cae1adce1 fix(webui): hide zoom/fit controls and comment draw button for audio assets 2026-07-05 15:19:53 +08:00
yiling a2e982f2e6 feat(transcode): add audio file support with AAC stereo mp4 proxy and styled viewer 2026-07-05 15:11:19 +08:00
Yiling-J 9a7abaed1a Merge pull request #174 from shumaiOne/refactor/file-viewer-registry
refactor(webui): modularize file viewer components into registry-driven architecture
2026-07-05 12:40:41 +08:00
yiling e03c44a00e docs(webui): add file viewer registry developer documentation 2026-07-05 12:26:50 +08:00
yiling 1524d41392 fix(webui): resolve react hook order violation in video viewer 2026-07-05 12:04:35 +08:00
yiling 4cc35d3453 refactor(webui): modularize file viewer components into registry-driven architecture 2026-07-05 10:51:42 +08:00
166 changed files with 4697 additions and 1457 deletions
+19 -7
View File
@@ -57,14 +57,26 @@ Docker Compose is the fastest way to get Shumai running. You do not need to clon
3. Configure environment variables (optional):
* `SHUMAI_SERVER_PORT` controls the port the Shumai server listens on. The default is `3000`.
* By default, Shumai uses the bundled local storage service in this Docker Compose setup. To use an external S3-compatible storage instead, set `AWS_ENDPOINT_URL_S3` to the provider's endpoint URL and configure the corresponding AWS credentials and bucket settings as needed.
* By default, Shumai uses the bundled local storage service in this Docker Compose setup. To use an external S3-compatible storage instead, configure the environment variables for your S3 provider. Here are examples for AWS S3 and Cloudflare R2:
**AWS S3 Example:**
```yaml
STORAGE_BACKEND: s3
S3_BUCKET: your-bucket-name
S3_ACCESS_KEY_ID: your-access-key-id
S3_SECRET_ACCESS_KEY: your-secret-access-key
AWS_ENDPOINT_URL_S3: https://s3.us-east-1.amazonaws.com
```
**Cloudflare R2 Example:**
```yaml
STORAGE_BACKEND: s3
S3_BUCKET: your-bucket-name
S3_REGION: auto
S3_ACCESS_KEY_ID: your-access-key-id
S3_SECRET_ACCESS_KEY: your-secret-access-key
AWS_ENDPOINT_URL_S3: https://<account-id>.r2.cloudflarestorage.com
```
AWS_ENDPOINT_URL_S3: S3_ENDPOINT_URL
S3_REGION: S3_REGION
S3_BUCKET: BUCKET_NAME
S3_ACCESS_KEY_ID: ID
S3_SECRET_ACCESS_KEY: KEY
```
* By default, `AWS_ENDPOINT_URL_S3` is set to: `http://localhost:{SHUMAI_SERVER_PORT}`, if you use local storage and expose Shumai on a custom host/port combination, set `AWS_ENDPOINT_URL_S3` to the external URL that browsers will use to upload files.
For example, if you change the port mapping in `docker-compose.yaml` from `3000:3000` to `12345:3000` and deploy on a server with IP address `12.34.56.78`, set:
+35 -23
View File
@@ -17,25 +17,26 @@
## 功能特性
- **兼容 S3 与本地存储**:使用本地文件系统或任何兼容 S3 的云存储(AWS S3、Cloudflare R2、阿里云 OSS 等)安全地存储和提供您的创意资产。
- **逐帧批注与评论**:直接在视频和图像资产上使用特定帧的绘图工具和带时间戳的评论,提供精确的反馈。
- **安全分享与合集**:创建安全的公开分享链接和媒体合集,以便与客户和团队进行协作。
- **细粒度访问控制**:使用团队级别和项目级别的基于角色的访问控制来管理访问权限。
- **基于 Temporal 的分布式转码**:将占用大量资源的视频转码任务部署到 Temporal Worker上。
- **自定义资产元数据**:为媒体文件添加可搜索/编辑的自定义元数据字段。
- **兼容 S3 与本地存储**:支持使用本地文件系统或任意兼容 S3 协议的对象存储(AWS S3、Cloudflare R2、MinIO 等)安全存储和访问你的创意资产。
- **逐帧标注与评论**:可直接在图片和视频上进行逐帧绘制标注,并结合时间戳评论,实现精准反馈与协作。
- **安全分享与媒体合集**:支持创建安全的公开分享链接和精心组织的媒体合集,方便与客户及团队成员协同沟通。
- **细粒度权限控制**:基于团队和项目两级角色权限(RBAC),灵活管理工作区访问权限。
- **基于 Temporal 的分布式转码**:将高负载的视频转码任务交由 Temporal 调度的后台 Worker 集群处理,提升系统扩展性与处理效率。
- **自定义资产元数据**:支持定义和扩展动态元数据字段,灵活适配你的制作流程。
#### Shumai 智能体 (Agent)
#### Shumai Agent
- **AI Agent 协作**:通过评论区和 AI 智能体进行交流。
- **自定义技能**:通过添加自定义技能来扩展智能体的能力。
- **隔离的沙箱执行**:在沙箱环境中安全地运行智能体提交的脚本。
- **AI 元数据自动填充**:使用AI为资产自动生填充元数据字段。
- **语义搜索**:基于 Gemini Embedding 2 的图片/视频内容搜索。
- **协作式 AI 对话**:在文件评论区通过 `@mention` 即可唤起具备上下文感知能力的 AI Agent,参与讨论与协作。
- **自定义技能与工具**:支持为 Agent 注册自定义脚本、工具和自动化技能,扩展其能力边界。
- **隔离沙箱执行**:Agent 提交的脚本会在安全隔离的沙箱环境中运行,保障执行安全。
- **AI 自动填充元数据**:为新上传的资产自动生成并填写自定义元数据。
- **语义搜索**:基于向量进行搜索(Gemini Embedding 2),支持按视觉内容或语义概念搜索资产。
> [!NOTE]
> **媒体处理与存储说明:** 在上传媒体文件时,Shumai 会始终完整保留并存储您的原始文件。对于所有媒体类型(图片与视频),Shumai 都会统一生成一张 480p 的 WebP 预览图,用作文件列表页预览。此外:
> * **图片文件:** Shumai 会额外生成一个与原图分辨率完全一致的 WebP 优化版本。
> * **视频文件:** 系统会根据您的转码设置生成至少一个预览版本mp4,同时还会生成一张雪碧图(Sprite)和一个轻量级预览视频(上限 1600 帧),以实现流畅的文件列表页面预览和文件查看页面时间轴快速预览。
> **媒体处理与存储机制:** 上传媒体文件后,Shumai 始终会保留并存储原始文件。无论图片还是视频,都会额外生成一张 480p 的 WebP 封面图,作为文件列表中的预览图。此外:
>
> * **图片:** 会生成一份与原图分辨率完全一致的高质量 WebP 转码版本,在保证画质的同时提升浏览性能。
> * **视频:** 会根据转码配置生成至少一个代理视频,同时生成雪碧图(Sprite)和一段最长 1600 帧的低分辨率转码视频,用于实现快速拖动时间轴和即时视频预览。
---
@@ -62,15 +63,26 @@
3. 配置环境变量(可选):
* `SHUMAI_SERVER_PORT` 用于控制 Shumai 服务监听的端口,默认值为 `3000`。
* 默认情况下,该 Docker Compose 部署会自动启用集成的本地存储。若想切换至外部 S3 兼容存储,请将 `AWS_ENDPOINT_URL_S3` 设置为对应云厂商的 Endpoint URL,并根据需要配置相应的 AWS 凭证和存储桶(Bucket)参数:
```
AWS_ENDPOINT_URL_S3: S3_ENDPOINT_URL
S3_REGION: S3_REGION
S3_BUCKET: BUCKET_NAME
S3_ACCESS_KEY_ID: ID
S3_SECRET_ACCESS_KEY: KEY
* 默认情况下,该 Docker Compose 部署会自动启用集成的本地存储。若想切换至外部 S3 兼容存储,请在 `environment` 中配置 S3 提供商的环境变量。以下是 AWS S3 和 Cloudflare R2 的配置示例:
```
**AWS S3 示例:**
```yaml
STORAGE_BACKEND: s3
S3_BUCKET: your-bucket-name
S3_ACCESS_KEY_ID: your-access-key-id
S3_SECRET_ACCESS_KEY: your-secret-access-key
AWS_ENDPOINT_URL_S3: https://s3.us-east-1.amazonaws.com
```
**Cloudflare R2 示例:**
```yaml
STORAGE_BACKEND: s3
S3_BUCKET: your-bucket-name
S3_REGION: auto
S3_ACCESS_KEY_ID: your-access-key-id
S3_SECRET_ACCESS_KEY: your-secret-access-key
AWS_ENDPOINT_URL_S3: https://<account-id>.r2.cloudflarestorage.com
```
* 默认情况下 `AWS_ENDPOINT_URL_S3` 指向 `http://localhost:{SHUMAI_SERVER_PORT}`。如果您使用本地存储,但希望在自定义的主机名或端口上公开访问 Shumai,请务必将 `AWS_ENDPOINT_URL_S3` 修改为浏览器访问该服务时所使用的外部 URL。
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent-app",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/cli",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode-app",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/web-app",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"dependencies": {
-1
View File
@@ -45,7 +45,6 @@ Shumai supports storing files locally or on S3-compatible endpoints.
| `S3_ACCESS_KEY_ID` | Access key credentials for S3. | `minioadmin` (default) |
| `S3_SECRET_ACCESS_KEY` | Secret key credentials for S3. | `minioadmin` (default) |
| `S3_REGION` | S3 storage region. | `auto` (default) |
| `S3_USE_SSL` | Set to `true` to use HTTPS for S3 endpoints. | `false` (default) |
| `PRESIGNED_URL_EXPIRES_IN` | Number of hours for which generated presigned download/upload links are valid. | `5` (default) |
### Local Storage Port Configuration
+5 -1
View File
@@ -16,7 +16,11 @@
"groups": [
{
"group": "Getting Started",
"pages": ["getting-started/overview", "getting-started/quickstart"]
"pages": [
"getting-started/overview",
"getting-started/quickstart",
"getting-started/s3-storage"
]
},
{
"group": "Using Shumai",
+125
View File
@@ -0,0 +1,125 @@
---
title: S3 Compatible Storage
description: Configure AWS S3 or any S3-compatible storage backend (Cloudflare R2, MinIO, Google Cloud Storage, etc.) for Shumai.
---
Shumai uses Bun's high-performance native S3 client to store and serve creative assets. By utilizing standard S3 APIs, Shumai can connect to any S3-compatible storage provider, including AWS S3, Cloudflare R2, MinIO, Google Cloud Storage, and more.
Using external S3 storage is highly recommended for production teams. It allows you to separate storage from the application server, scale storage capacity independently, and support distributed media transcoding.
---
## Configuration Variables
To enable S3-compatible storage, update the following environment variables in your `.env` file or Docker Compose configuration:
| Variable | Description | Required | Default / Example |
| :------------------------- | :------------------------------------------------------------------------ | :------- | :----------------------------------- |
| `STORAGE_BACKEND` | Set to `s3` to enable S3 compatible storage. | Yes | `s3` |
| `S3_BUCKET` | The name of the S3 bucket where files will be stored. | Yes | `shumai-bucket` |
| `S3_REGION` | The region of your S3 bucket. | No | `auto` |
| `S3_ACCESS_KEY_ID` | The access key ID for your storage service. | Yes | `your-access-key-id` |
| `S3_SECRET_ACCESS_KEY` | The secret access key for your storage service. | Yes | `your-secret-access-key` |
| `AWS_ENDPOINT_URL_S3` | The endpoint URL of your S3 compatible storage provider. | Yes | `https://s3.us-east-1.amazonaws.com` |
| `PRESIGNED_URL_EXPIRES_IN` | Duration in hours before generated presigned download/upload URLs expire. | No | `5` |
---
## Provider Examples
Below are configuration templates for popular S3 providers. Add these variables to your `.env` file or under the `environment` section in your `docker-compose.yaml`.
### AWS S3
For standard AWS S3, configure the corresponding endpoint URL:
```env
STORAGE_BACKEND=s3
S3_BUCKET=your-shumai-bucket
S3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
S3_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS_ENDPOINT_URL_S3=https://s3.us-east-1.amazonaws.com
```
### Cloudflare R2
Cloudflare R2 requires your Cloudflare account ID to construct the endpoint URL. Set the region to `auto`:
```env
STORAGE_BACKEND=s3
S3_BUCKET=your-shumai-bucket
S3_ACCESS_KEY_ID=your-r2-access-key-id
S3_SECRET_ACCESS_KEY=your-r2-secret-access-key
AWS_ENDPOINT_URL_S3=https://<account-id>.r2.cloudflarestorage.com
```
### MinIO (Self-Hosted)
For local development or self-hosted environments using MinIO, set the endpoint to your MinIO server URL and port (usually `9000`):
```env
STORAGE_BACKEND=s3
S3_BUCKET=shumai
S3_ACCESS_KEY_ID=minioadmin
S3_SECRET_ACCESS_KEY=minioadmin
AWS_ENDPOINT_URL_S3=http://localhost:9000
```
### Google Cloud Storage (GCS)
Google Cloud Storage provides an S3-compatible XML API. Configure your HMAC credentials and set the endpoint to standard GCS storage:
```env
STORAGE_BACKEND=s3
S3_BUCKET=your-gcs-bucket
S3_ACCESS_KEY_ID=GOOG1EXAMPLETOCKENKEY
S3_SECRET_ACCESS_KEY=your-gcs-hmac-secret-access-key
AWS_ENDPOINT_URL_S3=https://storage.googleapis.com
```
### DigitalOcean Spaces
For DigitalOcean Spaces, set the endpoint URL to match your space's region:
```env
STORAGE_BACKEND=s3
S3_BUCKET=your-spaces-bucket
S3_ACCESS_KEY_ID=your-spaces-access-key-id
S3_SECRET_ACCESS_KEY=your-spaces-secret-access-key
AWS_ENDPOINT_URL_S3=https://nyc3.digitaloceanspaces.com
```
### Supabase Storage
To connect to Supabase Storage via S3, ensure you have enabled S3 connection support in the Supabase Dashboard (`Settings > Storage > Enable connection via S3 protocol`). Copy the endpoint URL and region details from the same settings page:
```env
STORAGE_BACKEND=s3
S3_BUCKET=your-supabase-bucket
S3_REGION=us-east-1
S3_ACCESS_KEY_ID=your-supabase-access-key-id
S3_SECRET_ACCESS_KEY=your-supabase-secret-access-key
AWS_ENDPOINT_URL_S3=https://<account-id>.supabase.co/storage/v1/s3
```
---
## CORS Configuration
Since Shumai uploads files directly from the user's browser using presigned URLs, you must configure **Cross-Origin Resource Sharing (CORS)** on your storage bucket. Without CORS configuration, uploads will fail with network or origin errors.
Ensure your bucket CORS policy allows the following rules from your Shumai application URL (e.g., `http://localhost:3000` or `https://app.shumai.one`):
### CORS JSON Policy Example (AWS S3, R2, GCS)
```json
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedOrigins": ["http://localhost:3000", "https://your-shumai-domain.com"],
"ExposeHeaders": ["ETag"],
"MaxAgeSeconds": 3000
}
]
```
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "shumai",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/agent",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -2,7 +2,7 @@ import { prisma } from '@shumai/db'
import { setupTestDbHooks } from '@shumai/db/test'
import { s3Service } from '@shumai/core/src/s3/s3'
import { type SessionTreeEntry } from '@earendil-works/pi-agent-core'
import { describe, expect, it, vi } from 'vitest'
import { describe, expect, it, vi, afterEach } from 'vitest'
import { DatabaseSessionStorage } from './database-session-storage'
import { agentService } from '@shumai/core/src/agent/agent'
import { createAgentSession } from './index'
@@ -13,6 +13,10 @@ import * as screenshotModule from './tools/screenshot'
describe('DatabaseSessionStorage', () => {
setupTestDbHooks()
afterEach(() => {
vi.restoreAllMocks()
})
const mockModelConfig: PrismaJson.ModelConfig = {
reasoning: false,
input: ['text'],
@@ -392,7 +396,7 @@ describe('DatabaseSessionStorage', () => {
expect(entries[2].id).toBe('01C')
})
it('should use the current comment ID for media tools in subsequent turns', async () => {
it('should use the current comment ID for media tools in subsequent turns (image)', async () => {
const { agent, user, team } = await setupTestData()
// Create a project and asset to satisfy FK constraints
@@ -441,6 +445,58 @@ describe('DatabaseSessionStorage', () => {
// 4. Assert that the tools were instantiated using the new comment ID, not the original one
expect(createAnalyzeImageToolSpy).toHaveBeenCalledWith(asset.id, 'new-comment-456')
expect(createScreenshotToolSpy).not.toHaveBeenCalled()
})
it('should use the current comment ID for media tools in subsequent turns (video)', async () => {
const { agent, user, team } = await setupTestData()
// Create a project and asset to satisfy FK constraints
const project = await prisma.project.create({
data: { name: 'Test Project', teamId: team.id },
})
const asset = await prisma.asset.create({
data: {
id: 'asset-456',
name: 'test.mp4',
type: 'file',
mediaType: 'video/mp4',
projectId: project.id,
status: 'uploaded',
},
})
// 1. Create a session with an original comment ID and an asset ID using the storage class
const initialStorage = await DatabaseSessionStorage.create({
agentId: agent.id,
userId: user.id,
cwd: '/test/cwd',
assetId: asset.id,
userCommentId: 'original-comment-123',
})
const sessionId = initialStorage.sessionId
// 2. Spy on media tools constructors
const createAnalyzeImageToolSpy = vi.spyOn(analyzeImageModule, 'createAnalyzeImageTool')
const createScreenshotToolSpy = vi.spyOn(screenshotModule, 'createScreenshotTool')
// 3. Resume the session via createAgentSession with a NEW comment ID
await createAgentSession({
teamId: 't1',
agentId: agent.id,
providerName: 'test-provider',
modelId: 'test-model',
systemPrompt: 'Test prompt',
teamSkills: [],
allowedDomains: [],
sessionId: sessionId,
userId: user.id,
userCommentId: 'new-comment-456',
providers: [],
})
// 4. Assert that the tools were instantiated using the new comment ID, not the original one
expect(createScreenshotToolSpy).toHaveBeenCalledWith(asset.id, 'new-comment-456')
expect(createAnalyzeImageToolSpy).not.toHaveBeenCalled()
})
})
+12 -4
View File
@@ -15,6 +15,7 @@ import { agentService } from '@shumai/core/src/agent/agent'
import { DatabaseSessionStorage } from './database-session-storage'
import { createAnalyzeImageTool } from './tools/analyze-image'
import { createScreenshotTool } from './tools/screenshot'
import { getSimpleMediaType } from './workflows/agent-chat-prompt-builder'
import { createCreateFileTool } from './tools/create-file'
import { createCreateFolderTool } from './tools/create-folder'
import { createCreateVersionTool } from './tools/create-version'
@@ -212,10 +213,17 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
const mediaTools: AgentTool[] = []
if (assetId) {
mediaTools.push(
createAnalyzeImageTool(assetId, userCommentId),
createScreenshotTool(assetId, userCommentId),
)
const asset = await prisma.asset.findUnique({
where: { id: assetId },
})
if (asset?.mediaType) {
const type = getSimpleMediaType(asset.mediaType)
if (type === 'image') {
mediaTools.push(createAnalyzeImageTool(assetId, userCommentId))
} else if (type === 'video') {
mediaTools.push(createScreenshotTool(assetId, userCommentId))
}
}
}
const sandboxedBash = createSandboxedBashTool(process.cwd(), skillEnvs, {
@@ -283,4 +283,32 @@ describe('Agent Autofill Workflow', () => {
tmpDir: '/tmp/test-dir',
})
})
it('should fail with non-retryable ApplicationFailure for unsupported audio files', async () => {
mockActivities.getAssetActivity.mockResolvedValue({
id: 'a1',
storageKey: { key: 'asset-key' },
project: { id: 'p1', teamId: 't1' },
mediaType: 'audio/mp3',
})
const task = await prisma.workflowTask.create({
data: {
type: 'ai_metadata_autofill',
status: 'pending',
assetId: 'a1',
},
})
await expect(agentAutofillMedia(task)).rejects.toThrow(
'unsupported media type for autofill: audio/mp3',
)
// Verify task failed status
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
taskId: task.id,
status: 'failed',
output: { error: 'unsupported media type for autofill: audio/mp3' },
})
})
})
@@ -65,6 +65,14 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
// 2. Prepare Data (Images)
const isImage = asset.mediaType?.startsWith('image/') || false
const isVideo = asset.mediaType?.startsWith('video/') || false
if (!isImage && !isVideo) {
throw ApplicationFailure.create({
message: `unsupported media type for autofill: ${asset.mediaType}`,
nonRetryable: true,
})
}
const download = await executeActivity(transcodeWorkerQueue, downloadMediaToTmpActivity, {
assetKey: key,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/api",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
+47
View File
@@ -56,6 +56,7 @@ describe('file api', () => {
vi.spyOn(assetService, 'updateAssetName').mockImplementation(vi.fn())
vi.spyOn(assetService, 'deleteAssets').mockImplementation(vi.fn())
vi.spyOn(assetService, 'createComment').mockImplementation(vi.fn())
vi.spyOn(assetService, 'completeComment').mockImplementation(vi.fn())
vi.spyOn(assetService, 'listComments').mockImplementation(vi.fn())
vi.spyOn(assetService, 'restoreAssets').mockImplementation(vi.fn())
vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn())
@@ -185,6 +186,8 @@ describe('file api', () => {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
sessionId: null,
isCompleted: false,
completionLastChangedBy: null,
})
// Mock assetService.getAsset to return teamId for notification
@@ -234,6 +237,8 @@ describe('file api', () => {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
sessionId: null,
isCompleted: false,
completionLastChangedBy: null,
})
// Mock assetService.getAsset to return teamId for notification
@@ -290,6 +295,8 @@ describe('file api', () => {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
sessionId: null,
isCompleted: false,
completionLastChangedBy: null,
},
],
pageInfo: { cursor: 'cursor', total: 1 },
@@ -311,6 +318,46 @@ describe('file api', () => {
})
})
it('POST /comments/:commentId/complete', async () => {
vi.mocked(assetService.completeComment).mockResolvedValue({
id: 'comment-id',
assetId: 'file-id',
message: 'hello',
annotations: null,
second: null,
creator: { id: 'user-id', name: 'Test User' },
replies: [],
attachments: [],
mentions: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
sessionId: null,
isCompleted: true,
completionLastChangedBy: { id: 'user1', name: 'Test User' },
})
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
const res = await app.request('/comments/comment-id/complete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ isCompleted: true }),
})
expect(res.status).toBe(200)
const json = await res.json()
expect(json.isCompleted).toBe(true)
expect(json.completionLastChangedBy.id).toBe('user1')
expect(authzService.hasPermission).toHaveBeenCalledWith({
user: { id: 'user1', name: 'Test User' },
permission: Permission.Read,
type: ResourceType.Comment,
id: 'comment-id',
})
})
it('POST /teams/:teamId/files - image with compression', async () => {
vi.mocked(s3Service.putObject).mockResolvedValue(undefined)
+20
View File
@@ -16,6 +16,7 @@ import {
updateFileRequestSchema,
uploadFileRequestSchema,
getDownloadLinksRequestSchema,
completeCommentRequestSchema,
} from '@shumai/dtos'
import { transcodeService } from '@shumai/core'
import fs from 'fs'
@@ -200,6 +201,25 @@ const route = new Hono<{ Variables: { user: User } }>()
const comments = await assetService.listComments(fileId, req)
return c.json(comments)
})
.post(
'/comments/:commentId/complete',
zValidator('json', completeCommentRequestSchema),
async (c) => {
const commentId = c.req.param('commentId')
const user = c.get('user')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Read,
type: ResourceType.Comment,
id: commentId,
})
const updated = await assetService.completeComment(commentId, req.isCompleted, user.id)
return c.json(updated)
},
)
.post('/files/restore', zValidator('json', restoreFilesRequestSchema), async (c) => {
const user = c.get('user')
const req = c.req.valid('json')
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/core",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
+25
View File
@@ -855,6 +855,31 @@ describe('AssetService', () => {
expect(listWithReplies.data[0].replies[1].id).toBe(r2.id)
})
it('can mark comments as complete and incomplete', async () => {
const { user, assets } = await setupBasicAssets()
const comment = await assetService.createComment({
assetId: assets.fileA1.id,
userId: user.id,
message: 'To be completed',
attachmentIds: [],
})
expect(comment.isCompleted).toBe(false)
expect(comment.completionLastChangedBy).toBeNull()
// Mark as complete
const completed = await assetService.completeComment(comment.id, true, user.id)
expect(completed.isCompleted).toBe(true)
expect(completed.completionLastChangedBy).toBeDefined()
expect(completed.completionLastChangedBy?.id).toBe(user.id)
// Mark as incomplete
const incompleted = await assetService.completeComment(comment.id, false, user.id)
expect(incompleted.isCompleted).toBe(false)
expect(incompleted.completionLastChangedBy?.id).toBe(user.id)
})
it('triggers AI workflow on bot mention', async () => {
const { user, project } = await setupBasicAssets()
+31
View File
@@ -48,10 +48,12 @@ type AssetWithIncludes = Prisma.AssetGetPayload<{
type CommentWithIncludes = Prisma.AssetCommentGetPayload<{
include: {
creator: true
completionLastChangedBy: true
attachments: { include: { asset: { include: { storageKey: true } } } }
replies: {
include: {
creator: true
completionLastChangedBy: true
attachments: { include: { asset: { include: { storageKey: true } } } }
}
}
@@ -1379,11 +1381,13 @@ export class AssetService {
where: { id: commentId },
include: {
creator: true,
completionLastChangedBy: true,
asset: { include: { storageKey: true } },
attachments: { include: { asset: { include: { storageKey: true } } } },
replies: {
include: {
creator: true,
completionLastChangedBy: true,
attachments: { include: { asset: { include: { storageKey: true } } } },
},
orderBy: { id: 'asc' },
@@ -1394,6 +1398,21 @@ export class AssetService {
return this.toCommentInfo(c)
}
async completeComment(
commentId: string,
isCompleted: boolean,
userId: string,
): Promise<CommentInfo> {
await this.prismaClient.assetComment.update({
where: { id: commentId },
data: {
isCompleted,
completionLastChangedById: userId,
},
})
return this.getComment(commentId)
}
async listComments(
assetId: string,
params: PaginationParams,
@@ -1406,11 +1425,13 @@ export class AssetService {
where: { assetId: resolvedAssetId, replyToId: null },
include: {
creator: true,
completionLastChangedBy: true,
asset: { include: { storageKey: true } },
attachments: { include: { asset: { include: { storageKey: true } } } },
replies: {
include: {
creator: true,
completionLastChangedBy: true,
attachments: { include: { asset: { include: { storageKey: true } } } },
},
orderBy: { id: 'asc' },
@@ -1973,6 +1994,14 @@ export class AssetService {
creator.image = await getAvatarUrl(c.creator.image)
}
const completionLastChangedBy: AssetUserInfo | null = c.completionLastChangedBy
? {
id: c.completionLastChangedBy.id,
name: c.completionLastChangedBy.name,
image: await getAvatarUrl(c.completionLastChangedBy.image),
}
: null
return {
id: c.id,
assetId: c.assetId,
@@ -1986,6 +2015,8 @@ export class AssetService {
createdAt: c.createdAt.toISOString(),
updatedAt: c.updatedAt.toISOString(),
sessionId: c.sessionId,
isCompleted: c.isCompleted,
completionLastChangedBy,
}
}
}
+9 -10
View File
@@ -42,7 +42,7 @@ describe('S3Service implementations', () => {
describe('S3StorageService', () => {
it('should correctly build standard endpoints', () => {
const s3 = new S3StorageService('s3.example.com', 'key', 'secret', 'test-bucket', true)
const s3 = new S3StorageService('https://s3.example.com', 'key', 'secret', 'test-bucket')
expect(s3).toBeDefined()
expect(s3ClientConstructorSpy).toHaveBeenCalledWith(
expect.objectContaining({ region: 'auto' }),
@@ -52,11 +52,10 @@ describe('S3Service implementations', () => {
it('should use provided region', () => {
s3ClientConstructorSpy.mockClear()
const s3 = new S3StorageService(
's3.example.com',
'https://s3.example.com',
'key',
'secret',
'test-bucket',
true,
'ap-singapore',
)
expect(s3).toBeDefined()
@@ -66,14 +65,14 @@ describe('S3Service implementations', () => {
})
it('should implement presign correctly', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
const url = await s3.presign('bucket', 'key', 'GET')
expect(url).toBe('http://presigned-url')
expect(s3PresignSpy).toHaveBeenCalledWith('key', expect.objectContaining({ method: 'GET' }))
})
it('should cache GET presign URLs', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
s3PresignSpy.mockClear()
s3PresignSpy.mockReturnValueOnce('http://presigned-url-1')
@@ -88,7 +87,7 @@ describe('S3Service implementations', () => {
})
it('should NOT cache PUT presign URLs', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
s3PresignSpy.mockReset()
s3PresignSpy.mockReturnValueOnce('http://unique-put-url-1')
@@ -104,7 +103,7 @@ describe('S3Service implementations', () => {
it('should respect PRESIGNED_URL_EXPIRES_IN env', async () => {
process.env.PRESIGNED_URL_EXPIRES_IN = '10'
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
s3PresignSpy.mockClear()
await s3.presign('bucket', 'key', 'GET')
@@ -118,7 +117,7 @@ describe('S3Service implementations', () => {
})
it('should not set contentDisposition for normal GET presign', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
await s3.presign('bucket', 'key', 'GET')
expect(s3PresignSpy).toHaveBeenCalledWith(
@@ -130,7 +129,7 @@ describe('S3Service implementations', () => {
})
it('should set contentDisposition attachment when download is true', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
await s3.presign('bucket', 'key', 'GET', true)
expect(s3PresignSpy).toHaveBeenCalledWith(
@@ -142,7 +141,7 @@ describe('S3Service implementations', () => {
})
it('should not cache download presign URLs', async () => {
const s3 = new S3StorageService('localhost:9000', 'key', 'secret', 'test-bucket', false)
const s3 = new S3StorageService('http://localhost:9000', 'key', 'secret', 'test-bucket')
s3PresignSpy.mockClear()
s3PresignSpy.mockReturnValueOnce('http://download-url-1')
+1 -9
View File
@@ -67,18 +67,11 @@ export class S3StorageService implements S3Service {
accessKeyId: string,
secretAccessKey: string,
bucket: string,
useSsl: boolean,
region: string = 'auto',
) {
let fullEndpoint = endpoint
if (!fullEndpoint.startsWith('http://') && !fullEndpoint.startsWith('https://')) {
const scheme = useSsl ? 'https' : 'http'
fullEndpoint = `${scheme}://${endpoint}`
}
this.client = new S3Client({
region,
endpoint: fullEndpoint,
endpoint,
accessKeyId,
secretAccessKey,
bucket,
@@ -461,7 +454,6 @@ export const s3Service: S3Service =
process.env.S3_ACCESS_KEY_ID || 'minioadmin',
process.env.S3_SECRET_ACCESS_KEY || 'minioadmin',
process.env.S3_BUCKET || 'shumai',
process.env.S3_USE_SSL === 'true',
process.env.S3_REGION || 'auto',
)
: new LocalStorageService(s3Endpoint)
@@ -270,4 +270,81 @@ describe('TranscodeService', () => {
expect(task.payload?.projectId).toBe('proj-123')
expect(task.payload?.transcode?.videoStrategy).toBe('best_match')
})
it('should parse audio info correctly from ffprobe output', async () => {
/* eslint-disable @typescript-eslint/naming-convention */
const mockOutput = JSON.stringify({
format: { duration: '120.4', bit_rate: '256000' },
streams: [
{
codec_type: 'audio',
codec_name: 'flac',
channels: 6,
sample_rate: '44100',
bits_per_sample: '24',
tags: {
mime_codec_string: 'fLaC',
},
},
],
})
/* eslint-enable @typescript-eslint/naming-convention */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(child_process.execFile as any).mockImplementation((file: string, args: string[], cb: any) => {
cb(null, { stdout: mockOutput, stderr: '' })
})
const info = await transcodeService.getAudioInfo('test.flac')
expect(info.originalWidth).toBe(0)
expect(info.originalHeight).toBe(0)
expect(info.duration).toBe(120.4)
expect(info.frameRate).toBe(0)
expect(info.hasAudio).toBe(true)
expect(info.videoCodec).toBeUndefined()
expect(info.audioCodec).toBe('Fres Lossless Audio Codec')
expect(info.audioChannels).toBe(6)
expect(info.audioSampleRate).toBe(44100)
expect(info.audioBitDepth).toBe(24)
expect(child_process.execFile).toHaveBeenCalledWith(
'ffprobe',
expect.any(Array),
expect.any(Function),
)
})
it('should construct correct ffmpeg arguments for audio transcoding', async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(child_process.execFile as any).mockImplementation((file: string, args: string[], cb: any) => {
cb(null, { stdout: '', stderr: '' })
})
await transcodeService.transcodeAudio({
inputFile: 'input.wav',
outputFile: 'output.mp4',
bitrate: '128k',
})
expect(child_process.execFile).toHaveBeenCalledWith(
'ffmpeg',
[
'-y',
'-loglevel',
'warning',
'-i',
'input.wav',
'-vn',
'-c:a',
'aac',
'-b:a',
'128k',
'-ac',
'2',
'output.mp4',
],
expect.any(Function),
)
})
})
+61
View File
@@ -292,6 +292,67 @@ export class TranscodeService {
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
}
async getAudioInfo(inputFile: string): Promise<MediaMetadata> {
const { stdout } = await execFileAsync('ffprobe', [
'-v',
'quiet',
'-print_format',
'json',
'-show_format',
'-show_streams',
inputFile,
])
const info = JSON.parse(stdout)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const audioStream = info.streams.find((s: any) => s.codec_type === 'audio')
if (!audioStream) {
throw new Error('No audio stream found')
}
const duration = parseFloat(info.format.duration)
return {
originalWidth: 0,
originalHeight: 0,
duration: isNaN(duration) ? 0 : duration,
bitRate: parseFloat(info.format.bit_rate) || 0,
frameRate: 0,
totalFrames: 0,
startTimecode: undefined,
hasAudio: true,
videoCodec: undefined,
audioCodec: this.resolveCodecName(audioStream),
audioChannels: audioStream?.channels,
audioSampleRate: this.safeParseInt(audioStream?.sample_rate),
audioBitDepth:
this.safeParseInt(audioStream?.bits_per_raw_sample) ??
this.safeParseInt(audioStream?.bits_per_sample),
mimeType: '',
}
}
async transcodeAudio(params: {
inputFile: string
outputFile: string
bitrate?: string
}): Promise<void> {
const bitrate = params.bitrate || '128k'
const args = [
'-i',
params.inputFile,
'-vn',
'-c:a',
'aac',
'-b:a',
bitrate,
'-ac',
'2',
params.outputFile,
]
await execFileAsync('ffmpeg', ['-y', '-loglevel', 'warning', ...args])
}
async extractVideoFrames(params: ExtractVideoFramesParams): Promise<string[]> {
if (params.isImage) {
const outputFile = path.join(params.outputDir, '1.webp')
+99
View File
@@ -262,6 +262,72 @@ describe('UploadService', () => {
expect(workflowTask).toBeNull()
})
it('should confirm file upload and resolve empty mediaType using Bun resolver for audio', async () => {
const task = await prisma.task.create({
data: { creatorId: userId, total: 1, uploaded: 0, type: 'upload' },
})
const asset = await prisma.asset.create({
data: {
name: 'audio.mp3',
type: AssetType.file,
project: { connect: { id: projectId } },
parent: { connect: { id: parentId } },
status: AssetStatus.uploading,
storageKey: {
connectOrCreate: {
where: { key: 'test-key-audio-empty' },
create: { key: 'test-key-audio-empty' },
},
},
mediaType: '',
},
})
await uploadService.confirmFileUpload(userId, task.id, { fileId: asset.id })
const updatedAsset = await prisma.asset.findUnique({ where: { id: asset.id } })
expect(updatedAsset?.mediaType).toBe('audio/mpeg')
expect(updatedAsset?.status).toBe(AssetStatus.uploaded)
const workflowTask = await prisma.workflowTask.findFirst({
where: { assetId: asset.id, type: WorkflowTaskType.transcode },
})
expect(workflowTask).toBeDefined()
})
it('should confirm file upload and resolve application/octet-stream mediaType using Bun resolver for audio', async () => {
const task = await prisma.task.create({
data: { creatorId: userId, total: 1, uploaded: 0, type: 'upload' },
})
const asset = await prisma.asset.create({
data: {
name: 'song.wav',
type: AssetType.file,
project: { connect: { id: projectId } },
parent: { connect: { id: parentId } },
status: AssetStatus.uploading,
storageKey: {
connectOrCreate: {
where: { key: 'test-key-audio-octet' },
create: { key: 'test-key-audio-octet' },
},
},
mediaType: 'application/octet-stream',
},
})
await uploadService.confirmFileUpload(userId, task.id, { fileId: asset.id })
const updatedAsset = await prisma.asset.findUnique({ where: { id: asset.id } })
expect(updatedAsset?.mediaType).toBe('audio/x-wav')
expect(updatedAsset?.status).toBe(AssetStatus.uploaded)
const workflowTask = await prisma.workflowTask.findFirst({
where: { assetId: asset.id, type: WorkflowTaskType.transcode },
})
expect(workflowTask).toBeDefined()
})
it('should create a version stack when parentId is a file', async () => {
// Create an existing file
const fileA = await prisma.asset.create({
@@ -388,4 +454,37 @@ describe('UploadService', () => {
expect(result.data[0].id).toBe(task.id)
expect(result.data[0].name).toBe('test-upload-task')
})
it('should correct the mediaType for .wma files that browser incorrectly reports as video', async () => {
const req = {
parentId: parentId,
files: [
{
name: 'song.wma',
id: '1',
size: 100,
type: 'file' as const,
mediaType: 'video/x-ms-wma',
children: [],
},
{
name: 'other_song.WMA',
id: '2',
size: 200,
type: 'file' as const,
mediaType: 'video/x-ms-asf',
children: [],
},
],
}
const resp = await uploadService.createUploadTask(userId, req)
expect(resp.taskId).toBeDefined()
const song1 = await prisma.asset.findFirst({ where: { name: 'song.wma' } })
expect(song1?.mediaType).toBe('audio/x-ms-wma')
const song2 = await prisma.asset.findFirst({ where: { name: 'other_song.WMA' } })
expect(song2?.mediaType).toBe('audio/x-ms-asf')
})
})
+21 -5
View File
@@ -134,13 +134,18 @@ export class UploadService {
key = `files/${ulid()}/${sanitizeFilename(file.name)}`
}
let mediaType = file.mediaType
if (mediaType && file.name.toLowerCase().endsWith('.wma') && mediaType.startsWith('video/')) {
mediaType = mediaType.replace(/^video\//, 'audio/')
}
const newAsset = await tx.asset.create({
data: {
name: file.name,
type: assetType,
storageKey: key ? { create: { key } } : undefined,
sortIndex: newSortIndex,
mediaType: file.mediaType,
mediaType: mediaType,
status: assetType === AssetType.folder ? AssetStatus.uploaded : AssetStatus.uploading,
sizeByte: file.size,
creator: userId ? { connect: { id: userId } } : undefined,
@@ -225,12 +230,18 @@ export class UploadService {
const project = asset.project
await this.prismaClient.$transaction(async (tx) => {
let resolvedMediaType = asset.mediaType
if (!resolvedMediaType || resolvedMediaType === 'application/octet-stream') {
resolvedMediaType = Bun.file(asset.name).type || 'application/octet-stream'
}
// Update asset
const updatedAsset = await tx.asset.update({
where: { id: asset.id },
data: {
status: AssetStatus.uploaded,
sizeByte: size,
mediaType: resolvedMediaType,
},
})
@@ -289,7 +300,11 @@ export class UploadService {
},
})
if (autofillAgent) {
const isVideo = asset.mediaType?.startsWith('video/')
const isImage = asset.mediaType?.startsWith('image/')
const isAudio = asset.mediaType?.startsWith('audio/')
if (autofillAgent && (isVideo || isImage)) {
await tx.workflowTask.create({
data: {
assetId: asset.id,
@@ -305,9 +320,7 @@ export class UploadService {
})
}
const isVideo = asset.mediaType?.startsWith('video/')
const isImage = asset.mediaType?.startsWith('image/')
if (!isVideo && !isImage) {
if (!isVideo && !isImage && !isAudio) {
await tx.asset.update({
where: { id: asset.id },
data: { status: AssetStatus.processed },
@@ -322,6 +335,9 @@ export class UploadService {
.withSprite()
.withPoster()
.submit()
} else if (isAudio) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await new VideoTranscoder(tx as any, asset.id, team.id, projectId).submit()
} else if (isImage) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await new ImageTranscoder(tx as any, asset.id, team.id, projectId).withThumbnail().submit()
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/db",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -0,0 +1,6 @@
-- AlterTable
ALTER TABLE "asset_comments" ADD COLUMN "completion_last_changed_by_id" TEXT,
ADD COLUMN "is_completed" BOOLEAN NOT NULL DEFAULT false;
-- AddForeignKey
ALTER TABLE "asset_comments" ADD CONSTRAINT "asset_comments_completion_last_changed_by_id_fkey" FOREIGN KEY ("completion_last_changed_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+6 -1
View File
@@ -136,7 +136,8 @@ model User {
authTokens AuthToken[] @relation("UserToAuthToken")
tasks Task[] @relation("UserToTask")
teamMembers TeamMember[] @relation("UserToTeamMember")
comments AssetComment[] @relation("UserToAssetComment")
comments AssetComment[] @relation("UserToAssetComment")
completionChangedComments AssetComment[] @relation("UserToAssetCommentCompletionChanged")
createdInvites Invite[] @relation("UserToInvite")
createdNotifications Notification[] @relation("UserToCreatedNotification")
notifications Notification[] @relation("UserToNotification")
@@ -471,6 +472,10 @@ model AssetComment {
creatorId String? @map("creator_id")
creator User? @relation("UserToAssetComment", fields: [creatorId], references: [id])
isCompleted Boolean @default(false) @map("is_completed")
completionLastChangedById String? @map("completion_last_changed_by_id")
completionLastChangedBy User? @relation("UserToAssetCommentCompletionChanged", fields: [completionLastChangedById], references: [id])
replyToId String? @map("reply_to_id")
replyTo AssetComment? @relation("CommentReplies", fields: [replyToId], references: [id], onDelete: Cascade)
replies AssetComment[] @relation("CommentReplies")
File diff suppressed because one or more lines are too long
@@ -3149,6 +3149,8 @@ export const AssetCommentScalarFieldEnum = {
updatedAt: 'updatedAt',
assetId: 'assetId',
creatorId: 'creatorId',
isCompleted: 'isCompleted',
completionLastChangedById: 'completionLastChangedById',
replyToId: 'replyToId'
} as const
@@ -334,6 +334,8 @@ export const AssetCommentScalarFieldEnum = {
updatedAt: 'updatedAt',
assetId: 'assetId',
creatorId: 'creatorId',
isCompleted: 'isCompleted',
completionLastChangedById: 'completionLastChangedById',
replyToId: 'replyToId'
} as const
+312 -1
View File
@@ -45,6 +45,8 @@ export type AssetCommentMinAggregateOutputType = {
updatedAt: Date | null
assetId: string | null
creatorId: string | null
isCompleted: boolean | null
completionLastChangedById: string | null
replyToId: string | null
}
@@ -57,6 +59,8 @@ export type AssetCommentMaxAggregateOutputType = {
updatedAt: Date | null
assetId: string | null
creatorId: string | null
isCompleted: boolean | null
completionLastChangedById: string | null
replyToId: string | null
}
@@ -70,6 +74,8 @@ export type AssetCommentCountAggregateOutputType = {
updatedAt: number
assetId: number
creatorId: number
isCompleted: number
completionLastChangedById: number
replyToId: number
_all: number
}
@@ -92,6 +98,8 @@ export type AssetCommentMinAggregateInputType = {
updatedAt?: true
assetId?: true
creatorId?: true
isCompleted?: true
completionLastChangedById?: true
replyToId?: true
}
@@ -104,6 +112,8 @@ export type AssetCommentMaxAggregateInputType = {
updatedAt?: true
assetId?: true
creatorId?: true
isCompleted?: true
completionLastChangedById?: true
replyToId?: true
}
@@ -117,6 +127,8 @@ export type AssetCommentCountAggregateInputType = {
updatedAt?: true
assetId?: true
creatorId?: true
isCompleted?: true
completionLastChangedById?: true
replyToId?: true
_all?: true
}
@@ -217,6 +229,8 @@ export type AssetCommentGroupByOutputType = {
updatedAt: Date
assetId: string
creatorId: string | null
isCompleted: boolean
completionLastChangedById: string | null
replyToId: string | null
_count: AssetCommentCountAggregateOutputType | null
_avg: AssetCommentAvgAggregateOutputType | null
@@ -253,10 +267,13 @@ export type AssetCommentWhereInput = {
updatedAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
assetId?: Prisma.StringFilter<"AssetComment"> | string
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
asset?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
completionLastChangedBy?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
replyTo?: Prisma.XOR<Prisma.AssetCommentNullableScalarRelationFilter, Prisma.AssetCommentWhereInput> | null
replies?: Prisma.AssetCommentListRelationFilter
attachments?: Prisma.AssetCommentAttachmentListRelationFilter
@@ -272,10 +289,13 @@ export type AssetCommentOrderByWithRelationInput = {
updatedAt?: Prisma.SortOrder
assetId?: Prisma.SortOrder
creatorId?: Prisma.SortOrderInput | Prisma.SortOrder
isCompleted?: Prisma.SortOrder
completionLastChangedById?: Prisma.SortOrderInput | Prisma.SortOrder
replyToId?: Prisma.SortOrderInput | Prisma.SortOrder
session?: Prisma.AgentSessionOrderByWithRelationInput
asset?: Prisma.AssetOrderByWithRelationInput
creator?: Prisma.UserOrderByWithRelationInput
completionLastChangedBy?: Prisma.UserOrderByWithRelationInput
replyTo?: Prisma.AssetCommentOrderByWithRelationInput
replies?: Prisma.AssetCommentOrderByRelationAggregateInput
attachments?: Prisma.AssetCommentAttachmentOrderByRelationAggregateInput
@@ -294,10 +314,13 @@ export type AssetCommentWhereUniqueInput = Prisma.AtLeast<{
updatedAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
assetId?: Prisma.StringFilter<"AssetComment"> | string
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
asset?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
completionLastChangedBy?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
replyTo?: Prisma.XOR<Prisma.AssetCommentNullableScalarRelationFilter, Prisma.AssetCommentWhereInput> | null
replies?: Prisma.AssetCommentListRelationFilter
attachments?: Prisma.AssetCommentAttachmentListRelationFilter
@@ -313,6 +336,8 @@ export type AssetCommentOrderByWithAggregationInput = {
updatedAt?: Prisma.SortOrder
assetId?: Prisma.SortOrder
creatorId?: Prisma.SortOrderInput | Prisma.SortOrder
isCompleted?: Prisma.SortOrder
completionLastChangedById?: Prisma.SortOrderInput | Prisma.SortOrder
replyToId?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.AssetCommentCountOrderByAggregateInput
_avg?: Prisma.AssetCommentAvgOrderByAggregateInput
@@ -334,6 +359,8 @@ export type AssetCommentScalarWhereWithAggregatesInput = {
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"AssetComment"> | Date | string
assetId?: Prisma.StringWithAggregatesFilter<"AssetComment"> | string
creatorId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
isCompleted?: Prisma.BoolWithAggregatesFilter<"AssetComment"> | boolean
completionLastChangedById?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
replyToId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
}
@@ -344,9 +371,11 @@ export type AssetCommentCreateInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
@@ -362,6 +391,8 @@ export type AssetCommentUncheckedCreateInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
@@ -374,9 +405,11 @@ export type AssetCommentUpdateInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
@@ -392,6 +425,8 @@ export type AssetCommentUncheckedUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
@@ -407,6 +442,8 @@ export type AssetCommentCreateManyInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
}
@@ -417,6 +454,7 @@ export type AssetCommentUpdateManyMutationInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AssetCommentUncheckedUpdateManyInput = {
@@ -429,6 +467,8 @@ export type AssetCommentUncheckedUpdateManyInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -457,6 +497,8 @@ export type AssetCommentCountOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder
assetId?: Prisma.SortOrder
creatorId?: Prisma.SortOrder
isCompleted?: Prisma.SortOrder
completionLastChangedById?: Prisma.SortOrder
replyToId?: Prisma.SortOrder
}
@@ -473,6 +515,8 @@ export type AssetCommentMaxOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder
assetId?: Prisma.SortOrder
creatorId?: Prisma.SortOrder
isCompleted?: Prisma.SortOrder
completionLastChangedById?: Prisma.SortOrder
replyToId?: Prisma.SortOrder
}
@@ -485,6 +529,8 @@ export type AssetCommentMinOrderByAggregateInput = {
updatedAt?: Prisma.SortOrder
assetId?: Prisma.SortOrder
creatorId?: Prisma.SortOrder
isCompleted?: Prisma.SortOrder
completionLastChangedById?: Prisma.SortOrder
replyToId?: Prisma.SortOrder
}
@@ -504,6 +550,13 @@ export type AssetCommentCreateNestedManyWithoutCreatorInput = {
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
}
export type AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput> | Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput[] | Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput | Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput[]
createMany?: Prisma.AssetCommentCreateManyCompletionLastChangedByInputEnvelope
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
}
export type AssetCommentUncheckedCreateNestedManyWithoutCreatorInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCreatorInput, Prisma.AssetCommentUncheckedCreateWithoutCreatorInput> | Prisma.AssetCommentCreateWithoutCreatorInput[] | Prisma.AssetCommentUncheckedCreateWithoutCreatorInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCreatorInput | Prisma.AssetCommentCreateOrConnectWithoutCreatorInput[]
@@ -511,6 +564,13 @@ export type AssetCommentUncheckedCreateNestedManyWithoutCreatorInput = {
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
}
export type AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput> | Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput[] | Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput | Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput[]
createMany?: Prisma.AssetCommentCreateManyCompletionLastChangedByInputEnvelope
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
}
export type AssetCommentUpdateManyWithoutCreatorNestedInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCreatorInput, Prisma.AssetCommentUncheckedCreateWithoutCreatorInput> | Prisma.AssetCommentCreateWithoutCreatorInput[] | Prisma.AssetCommentUncheckedCreateWithoutCreatorInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCreatorInput | Prisma.AssetCommentCreateOrConnectWithoutCreatorInput[]
@@ -525,6 +585,20 @@ export type AssetCommentUpdateManyWithoutCreatorNestedInput = {
deleteMany?: Prisma.AssetCommentScalarWhereInput | Prisma.AssetCommentScalarWhereInput[]
}
export type AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput> | Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput[] | Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput | Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput[]
upsert?: Prisma.AssetCommentUpsertWithWhereUniqueWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpsertWithWhereUniqueWithoutCompletionLastChangedByInput[]
createMany?: Prisma.AssetCommentCreateManyCompletionLastChangedByInputEnvelope
set?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
disconnect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
delete?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
update?: Prisma.AssetCommentUpdateWithWhereUniqueWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpdateWithWhereUniqueWithoutCompletionLastChangedByInput[]
updateMany?: Prisma.AssetCommentUpdateManyWithWhereWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpdateManyWithWhereWithoutCompletionLastChangedByInput[]
deleteMany?: Prisma.AssetCommentScalarWhereInput | Prisma.AssetCommentScalarWhereInput[]
}
export type AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCreatorInput, Prisma.AssetCommentUncheckedCreateWithoutCreatorInput> | Prisma.AssetCommentCreateWithoutCreatorInput[] | Prisma.AssetCommentUncheckedCreateWithoutCreatorInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCreatorInput | Prisma.AssetCommentCreateOrConnectWithoutCreatorInput[]
@@ -539,6 +613,20 @@ export type AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput = {
deleteMany?: Prisma.AssetCommentScalarWhereInput | Prisma.AssetCommentScalarWhereInput[]
}
export type AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput> | Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput[] | Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput | Prisma.AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput[]
upsert?: Prisma.AssetCommentUpsertWithWhereUniqueWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpsertWithWhereUniqueWithoutCompletionLastChangedByInput[]
createMany?: Prisma.AssetCommentCreateManyCompletionLastChangedByInputEnvelope
set?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
disconnect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
delete?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
connect?: Prisma.AssetCommentWhereUniqueInput | Prisma.AssetCommentWhereUniqueInput[]
update?: Prisma.AssetCommentUpdateWithWhereUniqueWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpdateWithWhereUniqueWithoutCompletionLastChangedByInput[]
updateMany?: Prisma.AssetCommentUpdateManyWithWhereWithoutCompletionLastChangedByInput | Prisma.AssetCommentUpdateManyWithWhereWithoutCompletionLastChangedByInput[]
deleteMany?: Prisma.AssetCommentScalarWhereInput | Prisma.AssetCommentScalarWhereInput[]
}
export type AssetCommentCreateNestedManyWithoutAssetInput = {
create?: Prisma.XOR<Prisma.AssetCommentCreateWithoutAssetInput, Prisma.AssetCommentUncheckedCreateWithoutAssetInput> | Prisma.AssetCommentCreateWithoutAssetInput[] | Prisma.AssetCommentUncheckedCreateWithoutAssetInput[]
connectOrCreate?: Prisma.AssetCommentCreateOrConnectWithoutAssetInput | Prisma.AssetCommentCreateOrConnectWithoutAssetInput[]
@@ -702,8 +790,10 @@ export type AssetCommentCreateWithoutCreatorInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
@@ -718,6 +808,8 @@ export type AssetCommentUncheckedCreateWithoutCreatorInput = {
createdAt?: Date | string
updatedAt?: Date | string
assetId: string
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
@@ -733,6 +825,48 @@ export type AssetCommentCreateManyCreatorInputEnvelope = {
skipDuplicates?: boolean
}
export type AssetCommentCreateWithoutCompletionLastChangedByInput = {
id?: string
message?: string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
}
export type AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput = {
id?: string
message?: string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: number | null
sessionId?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
}
export type AssetCommentCreateOrConnectWithoutCompletionLastChangedByInput = {
where: Prisma.AssetCommentWhereUniqueInput
create: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput>
}
export type AssetCommentCreateManyCompletionLastChangedByInputEnvelope = {
data: Prisma.AssetCommentCreateManyCompletionLastChangedByInput | Prisma.AssetCommentCreateManyCompletionLastChangedByInput[]
skipDuplicates?: boolean
}
export type AssetCommentUpsertWithWhereUniqueWithoutCreatorInput = {
where: Prisma.AssetCommentWhereUniqueInput
update: Prisma.XOR<Prisma.AssetCommentUpdateWithoutCreatorInput, Prisma.AssetCommentUncheckedUpdateWithoutCreatorInput>
@@ -762,9 +896,27 @@ export type AssetCommentScalarWhereInput = {
updatedAt?: Prisma.DateTimeFilter<"AssetComment"> | Date | string
assetId?: Prisma.StringFilter<"AssetComment"> | string
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
}
export type AssetCommentUpsertWithWhereUniqueWithoutCompletionLastChangedByInput = {
where: Prisma.AssetCommentWhereUniqueInput
update: Prisma.XOR<Prisma.AssetCommentUpdateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedUpdateWithoutCompletionLastChangedByInput>
create: Prisma.XOR<Prisma.AssetCommentCreateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput>
}
export type AssetCommentUpdateWithWhereUniqueWithoutCompletionLastChangedByInput = {
where: Prisma.AssetCommentWhereUniqueInput
data: Prisma.XOR<Prisma.AssetCommentUpdateWithoutCompletionLastChangedByInput, Prisma.AssetCommentUncheckedUpdateWithoutCompletionLastChangedByInput>
}
export type AssetCommentUpdateManyWithWhereWithoutCompletionLastChangedByInput = {
where: Prisma.AssetCommentScalarWhereInput
data: Prisma.XOR<Prisma.AssetCommentUpdateManyMutationInput, Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByInput>
}
export type AssetCommentCreateWithoutAssetInput = {
id?: string
message?: string | null
@@ -772,8 +924,10 @@ export type AssetCommentCreateWithoutAssetInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
@@ -788,6 +942,8 @@ export type AssetCommentUncheckedCreateWithoutAssetInput = {
createdAt?: Date | string
updatedAt?: Date | string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
@@ -826,9 +982,11 @@ export type AssetCommentCreateWithoutRepliesInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
}
@@ -843,6 +1001,8 @@ export type AssetCommentUncheckedCreateWithoutRepliesInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
}
@@ -859,9 +1019,11 @@ export type AssetCommentCreateWithoutReplyToInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
}
@@ -876,6 +1038,8 @@ export type AssetCommentUncheckedCreateWithoutReplyToInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
}
@@ -908,9 +1072,11 @@ export type AssetCommentUpdateWithoutRepliesInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
}
@@ -925,6 +1091,8 @@ export type AssetCommentUncheckedUpdateWithoutRepliesInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
}
@@ -952,9 +1120,11 @@ export type AssetCommentCreateWithoutAttachmentsInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
}
@@ -969,6 +1139,8 @@ export type AssetCommentUncheckedCreateWithoutAttachmentsInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
}
@@ -996,9 +1168,11 @@ export type AssetCommentUpdateWithoutAttachmentsInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
}
@@ -1013,6 +1187,8 @@ export type AssetCommentUncheckedUpdateWithoutAttachmentsInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
}
@@ -1024,8 +1200,10 @@ export type AssetCommentCreateWithoutSessionInput = {
second?: number | null
createdAt?: Date | string
updatedAt?: Date | string
isCompleted?: boolean
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
replyTo?: Prisma.AssetCommentCreateNestedOneWithoutRepliesInput
replies?: Prisma.AssetCommentCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentCreateNestedManyWithoutCommentInput
@@ -1040,6 +1218,8 @@ export type AssetCommentUncheckedCreateWithoutSessionInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
@@ -1080,6 +1260,22 @@ export type AssetCommentCreateManyCreatorInput = {
createdAt?: Date | string
updatedAt?: Date | string
assetId: string
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
}
export type AssetCommentCreateManyCompletionLastChangedByInput = {
id?: string
message?: string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: number | null
sessionId?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
replyToId?: string | null
}
@@ -1090,8 +1286,10 @@ export type AssetCommentUpdateWithoutCreatorInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
@@ -1106,6 +1304,8 @@ export type AssetCommentUncheckedUpdateWithoutCreatorInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
@@ -1120,6 +1320,54 @@ export type AssetCommentUncheckedUpdateManyWithoutCreatorInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type AssetCommentUpdateWithoutCompletionLastChangedByInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
}
export type AssetCommentUncheckedUpdateWithoutCompletionLastChangedByInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
}
export type AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
annotation?:PrismaJson.AnnotationList | Prisma.NullableJsonNullValueInput
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
sessionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -1132,6 +1380,8 @@ export type AssetCommentCreateManyAssetInput = {
createdAt?: Date | string
updatedAt?: Date | string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
}
@@ -1142,8 +1392,10 @@ export type AssetCommentUpdateWithoutAssetInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
@@ -1158,6 +1410,8 @@ export type AssetCommentUncheckedUpdateWithoutAssetInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
@@ -1172,6 +1426,8 @@ export type AssetCommentUncheckedUpdateManyWithoutAssetInput = {
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -1185,6 +1441,8 @@ export type AssetCommentCreateManyReplyToInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
}
export type AssetCommentUpdateWithoutReplyToInput = {
@@ -1194,9 +1452,11 @@ export type AssetCommentUpdateWithoutReplyToInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
}
@@ -1211,6 +1471,8 @@ export type AssetCommentUncheckedUpdateWithoutReplyToInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
}
@@ -1225,6 +1487,8 @@ export type AssetCommentUncheckedUpdateManyWithoutReplyToInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type AssetCommentCreateManySessionInput = {
@@ -1236,6 +1500,8 @@ export type AssetCommentCreateManySessionInput = {
updatedAt?: Date | string
assetId: string
creatorId?: string | null
isCompleted?: boolean
completionLastChangedById?: string | null
replyToId?: string | null
}
@@ -1246,8 +1512,10 @@ export type AssetCommentUpdateWithoutSessionInput = {
second?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
replyTo?: Prisma.AssetCommentUpdateOneWithoutRepliesNestedInput
replies?: Prisma.AssetCommentUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUpdateManyWithoutCommentNestedInput
@@ -1262,6 +1530,8 @@ export type AssetCommentUncheckedUpdateWithoutSessionInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
@@ -1276,6 +1546,8 @@ export type AssetCommentUncheckedUpdateManyWithoutSessionInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -1329,10 +1601,13 @@ export type AssetCommentSelect<ExtArgs extends runtime.Types.Extensions.Internal
updatedAt?: boolean
assetId?: boolean
creatorId?: boolean
isCompleted?: boolean
completionLastChangedById?: boolean
replyToId?: boolean
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
replies?: boolean | Prisma.AssetComment$repliesArgs<ExtArgs>
attachments?: boolean | Prisma.AssetComment$attachmentsArgs<ExtArgs>
@@ -1349,10 +1624,13 @@ export type AssetCommentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.
updatedAt?: boolean
assetId?: boolean
creatorId?: boolean
isCompleted?: boolean
completionLastChangedById?: boolean
replyToId?: boolean
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
}, ExtArgs["result"]["assetComment"]>
@@ -1366,10 +1644,13 @@ export type AssetCommentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.
updatedAt?: boolean
assetId?: boolean
creatorId?: boolean
isCompleted?: boolean
completionLastChangedById?: boolean
replyToId?: boolean
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
}, ExtArgs["result"]["assetComment"]>
@@ -1383,14 +1664,17 @@ export type AssetCommentSelectScalar = {
updatedAt?: boolean
assetId?: boolean
creatorId?: boolean
isCompleted?: boolean
completionLastChangedById?: boolean
replyToId?: boolean
}
export type AssetCommentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "message" | "annotation" | "second" | "sessionId" | "createdAt" | "updatedAt" | "assetId" | "creatorId" | "replyToId", ExtArgs["result"]["assetComment"]>
export type AssetCommentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "message" | "annotation" | "second" | "sessionId" | "createdAt" | "updatedAt" | "assetId" | "creatorId" | "isCompleted" | "completionLastChangedById" | "replyToId", ExtArgs["result"]["assetComment"]>
export type AssetCommentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
replies?: boolean | Prisma.AssetComment$repliesArgs<ExtArgs>
attachments?: boolean | Prisma.AssetComment$attachmentsArgs<ExtArgs>
@@ -1400,12 +1684,14 @@ export type AssetCommentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
}
export type AssetCommentIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
creator?: boolean | Prisma.AssetComment$creatorArgs<ExtArgs>
completionLastChangedBy?: boolean | Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>
replyTo?: boolean | Prisma.AssetComment$replyToArgs<ExtArgs>
}
@@ -1415,6 +1701,7 @@ export type $AssetCommentPayload<ExtArgs extends runtime.Types.Extensions.Intern
session: Prisma.$AgentSessionPayload<ExtArgs> | null
asset: Prisma.$AssetPayload<ExtArgs>
creator: Prisma.$UserPayload<ExtArgs> | null
completionLastChangedBy: Prisma.$UserPayload<ExtArgs> | null
replyTo: Prisma.$AssetCommentPayload<ExtArgs> | null
replies: Prisma.$AssetCommentPayload<ExtArgs>[]
attachments: Prisma.$AssetCommentAttachmentPayload<ExtArgs>[]
@@ -1432,6 +1719,8 @@ export type $AssetCommentPayload<ExtArgs extends runtime.Types.Extensions.Intern
updatedAt: Date
assetId: string
creatorId: string | null
isCompleted: boolean
completionLastChangedById: string | null
replyToId: string | null
}, ExtArgs["result"]["assetComment"]>
composites: {}
@@ -1830,6 +2119,7 @@ export interface Prisma__AssetCommentClient<T, Null = never, ExtArgs extends run
session<T extends Prisma.AssetComment$sessionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$sessionArgs<ExtArgs>>): Prisma.Prisma__AgentSessionClient<runtime.Types.Result.GetResult<Prisma.$AgentSessionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
asset<T extends Prisma.AssetDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetDefaultArgs<ExtArgs>>): Prisma.Prisma__AssetClient<runtime.Types.Result.GetResult<Prisma.$AssetPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
creator<T extends Prisma.AssetComment$creatorArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$creatorArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
completionLastChangedBy<T extends Prisma.AssetComment$completionLastChangedByArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$completionLastChangedByArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
replyTo<T extends Prisma.AssetComment$replyToArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$replyToArgs<ExtArgs>>): Prisma.Prisma__AssetCommentClient<runtime.Types.Result.GetResult<Prisma.$AssetCommentPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
replies<T extends Prisma.AssetComment$repliesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$repliesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AssetCommentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
attachments<T extends Prisma.AssetComment$attachmentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AssetComment$attachmentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AssetCommentAttachmentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
@@ -1871,6 +2161,8 @@ export interface AssetCommentFieldRefs {
readonly updatedAt: Prisma.FieldRef<"AssetComment", 'DateTime'>
readonly assetId: Prisma.FieldRef<"AssetComment", 'String'>
readonly creatorId: Prisma.FieldRef<"AssetComment", 'String'>
readonly isCompleted: Prisma.FieldRef<"AssetComment", 'Boolean'>
readonly completionLastChangedById: Prisma.FieldRef<"AssetComment", 'String'>
readonly replyToId: Prisma.FieldRef<"AssetComment", 'String'>
}
@@ -2310,6 +2602,25 @@ export type AssetComment$creatorArgs<ExtArgs extends runtime.Types.Extensions.In
where?: Prisma.UserWhereInput
}
/**
* AssetComment.completionLastChangedBy
*/
export type AssetComment$completionLastChangedByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the User
*/
select?: Prisma.UserSelect<ExtArgs> | null
/**
* Omit specific fields from the User
*/
omit?: Prisma.UserOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.UserInclude<ExtArgs> | null
where?: Prisma.UserWhereInput
}
/**
* AssetComment.replyTo
*/
+260
View File
@@ -233,6 +233,7 @@ export type UserWhereInput = {
tasks?: Prisma.TaskListRelationFilter
teamMembers?: Prisma.TeamMemberListRelationFilter
comments?: Prisma.AssetCommentListRelationFilter
completionChangedComments?: Prisma.AssetCommentListRelationFilter
createdInvites?: Prisma.InviteListRelationFilter
createdNotifications?: Prisma.NotificationListRelationFilter
notifications?: Prisma.NotificationListRelationFilter
@@ -263,6 +264,7 @@ export type UserOrderByWithRelationInput = {
tasks?: Prisma.TaskOrderByRelationAggregateInput
teamMembers?: Prisma.TeamMemberOrderByRelationAggregateInput
comments?: Prisma.AssetCommentOrderByRelationAggregateInput
completionChangedComments?: Prisma.AssetCommentOrderByRelationAggregateInput
createdInvites?: Prisma.InviteOrderByRelationAggregateInput
createdNotifications?: Prisma.NotificationOrderByRelationAggregateInput
notifications?: Prisma.NotificationOrderByRelationAggregateInput
@@ -296,6 +298,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
tasks?: Prisma.TaskListRelationFilter
teamMembers?: Prisma.TeamMemberListRelationFilter
comments?: Prisma.AssetCommentListRelationFilter
completionChangedComments?: Prisma.AssetCommentListRelationFilter
createdInvites?: Prisma.InviteListRelationFilter
createdNotifications?: Prisma.NotificationListRelationFilter
notifications?: Prisma.NotificationListRelationFilter
@@ -360,6 +363,7 @@ export type UserCreateInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -390,6 +394,7 @@ export type UserUncheckedCreateInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -420,6 +425,7 @@ export type UserUpdateInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -450,6 +456,7 @@ export type UserUncheckedUpdateInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -669,6 +676,12 @@ export type UserCreateNestedOneWithoutCommentsInput = {
connect?: Prisma.UserWhereUniqueInput
}
export type UserCreateNestedOneWithoutCompletionChangedCommentsInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedCreateWithoutCompletionChangedCommentsInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutCompletionChangedCommentsInput
connect?: Prisma.UserWhereUniqueInput
}
export type UserUpdateOneWithoutCommentsNestedInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutCommentsInput, Prisma.UserUncheckedCreateWithoutCommentsInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutCommentsInput
@@ -679,6 +692,16 @@ export type UserUpdateOneWithoutCommentsNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutCommentsInput, Prisma.UserUpdateWithoutCommentsInput>, Prisma.UserUncheckedUpdateWithoutCommentsInput>
}
export type UserUpdateOneWithoutCompletionChangedCommentsNestedInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedCreateWithoutCompletionChangedCommentsInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutCompletionChangedCommentsInput
upsert?: Prisma.UserUpsertWithoutCompletionChangedCommentsInput
disconnect?: Prisma.UserWhereInput | boolean
delete?: Prisma.UserWhereInput | boolean
connect?: Prisma.UserWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutCompletionChangedCommentsInput, Prisma.UserUpdateWithoutCompletionChangedCommentsInput>, Prisma.UserUncheckedUpdateWithoutCompletionChangedCommentsInput>
}
export type UserCreateNestedOneWithoutCreatedInvitesInput = {
create?: Prisma.XOR<Prisma.UserCreateWithoutCreatedInvitesInput, Prisma.UserUncheckedCreateWithoutCreatedInvitesInput>
connectOrCreate?: Prisma.UserCreateOrConnectWithoutCreatedInvitesInput
@@ -832,6 +855,7 @@ export type UserCreateWithoutSessionsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -861,6 +885,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -906,6 +931,7 @@ export type UserUpdateWithoutSessionsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -935,6 +961,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -964,6 +991,7 @@ export type UserCreateWithoutAccountsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -993,6 +1021,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1038,6 +1067,7 @@ export type UserUpdateWithoutAccountsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1067,6 +1097,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1095,6 +1126,7 @@ export type UserCreateWithoutAuthTokensInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -1124,6 +1156,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1169,6 +1202,7 @@ export type UserUpdateWithoutAuthTokensInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1198,6 +1232,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1227,6 +1262,7 @@ export type UserCreateWithoutTeamMembersInput = {
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -1256,6 +1292,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1301,6 +1338,7 @@ export type UserUpdateWithoutTeamMembersInput = {
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1330,6 +1368,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1360,6 +1399,7 @@ export type UserCreateWithoutShareLinksInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -1389,6 +1429,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1434,6 +1475,7 @@ export type UserUpdateWithoutShareLinksInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1463,6 +1505,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1491,6 +1534,7 @@ export type UserCreateWithoutAssetsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -1520,6 +1564,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1565,6 +1610,7 @@ export type UserUpdateWithoutAssetsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1594,6 +1640,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1623,6 +1670,7 @@ export type UserCreateWithoutCommentsInput = {
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -1652,6 +1700,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -1670,6 +1719,71 @@ export type UserCreateOrConnectWithoutCommentsInput = {
create: Prisma.XOR<Prisma.UserCreateWithoutCommentsInput, Prisma.UserUncheckedCreateWithoutCommentsInput>
}
export type UserCreateWithoutCompletionChangedCommentsInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountCreateNestedManyWithoutUserInput
agent?: Prisma.AgentCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
}
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
id?: string
type?: $Enums.UserType
name: string
email: string
emailVerified?: boolean
image?: string | null
password?: string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: string | null
createdAt?: Date | string
updatedAt?: Date | string
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutCreatorInput
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput
agent?: Prisma.AgentUncheckedCreateNestedOneWithoutUserInput
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutUserInput
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
}
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
where: Prisma.UserWhereUniqueInput
create: Prisma.XOR<Prisma.UserCreateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedCreateWithoutCompletionChangedCommentsInput>
}
export type UserUpsertWithoutCommentsInput = {
update: Prisma.XOR<Prisma.UserUpdateWithoutCommentsInput, Prisma.UserUncheckedUpdateWithoutCommentsInput>
create: Prisma.XOR<Prisma.UserCreateWithoutCommentsInput, Prisma.UserUncheckedCreateWithoutCommentsInput>
@@ -1697,6 +1811,7 @@ export type UserUpdateWithoutCommentsInput = {
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -1726,6 +1841,78 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUncheckedUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
}
export type UserUpsertWithoutCompletionChangedCommentsInput = {
update: Prisma.XOR<Prisma.UserUpdateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedUpdateWithoutCompletionChangedCommentsInput>
create: Prisma.XOR<Prisma.UserCreateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedCreateWithoutCompletionChangedCommentsInput>
where?: Prisma.UserWhereInput
}
export type UserUpdateToOneWithWhereWithoutCompletionChangedCommentsInput = {
where?: Prisma.UserWhereInput
data: Prisma.XOR<Prisma.UserUpdateWithoutCompletionChangedCommentsInput, Prisma.UserUncheckedUpdateWithoutCompletionChangedCommentsInput>
}
export type UserUpdateWithoutCompletionChangedCommentsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput
agent?: Prisma.AgentUpdateOneWithoutUserNestedInput
agentSessions?: Prisma.AgentSessionUpdateManyWithoutUserNestedInput
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
}
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
name?: Prisma.StringFieldUpdateOperationsInput | string
email?: Prisma.StringFieldUpdateOperationsInput | string
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
assets?: Prisma.AssetUncheckedUpdateManyWithoutCreatorNestedInput
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -1756,6 +1943,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
@@ -1785,6 +1973,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
@@ -1830,6 +2019,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
@@ -1859,6 +2049,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
@@ -1888,6 +2079,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
@@ -1917,6 +2109,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
@@ -1951,6 +2144,7 @@ export type UserCreateWithoutNotificationsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
@@ -1980,6 +2174,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
@@ -2025,6 +2220,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
@@ -2054,6 +2250,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
@@ -2094,6 +2291,7 @@ export type UserUpdateWithoutNotificationsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
@@ -2123,6 +2321,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
@@ -2151,6 +2350,7 @@ export type UserCreateWithoutTasksInput = {
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2180,6 +2380,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2225,6 +2426,7 @@ export type UserUpdateWithoutTasksInput = {
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2254,6 +2456,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2284,6 +2487,7 @@ export type UserCreateWithoutAgentInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2313,6 +2517,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2358,6 +2563,7 @@ export type UserUpdateWithoutAgentInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2387,6 +2593,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2416,6 +2623,7 @@ export type UserCreateWithoutAgentSessionsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2445,6 +2653,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2490,6 +2699,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2519,6 +2729,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2548,6 +2759,7 @@ export type UserCreateWithoutUserMetadataInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2577,6 +2789,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2622,6 +2835,7 @@ export type UserUpdateWithoutUserMetadataInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2651,6 +2865,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2680,6 +2895,7 @@ export type UserCreateWithoutCollectionsInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2709,6 +2925,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2754,6 +2971,7 @@ export type UserUpdateWithoutCollectionsInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2783,6 +3001,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2812,6 +3031,7 @@ export type UserCreateWithoutApiTokensInput = {
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
@@ -2841,6 +3061,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
@@ -2886,6 +3107,7 @@ export type UserUpdateWithoutApiTokensInput = {
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
@@ -2915,6 +3137,7 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
@@ -2938,6 +3161,7 @@ export type UserCountOutputType = {
tasks: number
teamMembers: number
comments: number
completionChangedComments: number
createdInvites: number
createdNotifications: number
notifications: number
@@ -2956,6 +3180,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
tasks?: boolean | UserCountOutputTypeCountTasksArgs
teamMembers?: boolean | UserCountOutputTypeCountTeamMembersArgs
comments?: boolean | UserCountOutputTypeCountCommentsArgs
completionChangedComments?: boolean | UserCountOutputTypeCountCompletionChangedCommentsArgs
createdInvites?: boolean | UserCountOutputTypeCountCreatedInvitesArgs
createdNotifications?: boolean | UserCountOutputTypeCountCreatedNotificationsArgs
notifications?: boolean | UserCountOutputTypeCountNotificationsArgs
@@ -3013,6 +3238,13 @@ export type UserCountOutputTypeCountCommentsArgs<ExtArgs extends runtime.Types.E
where?: Prisma.AssetCommentWhereInput
}
/**
* UserCountOutputType without action
*/
export type UserCountOutputTypeCountCompletionChangedCommentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.AssetCommentWhereInput
}
/**
* UserCountOutputType without action
*/
@@ -3101,6 +3333,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
tasks?: boolean | Prisma.User$tasksArgs<ExtArgs>
teamMembers?: boolean | Prisma.User$teamMembersArgs<ExtArgs>
comments?: boolean | Prisma.User$commentsArgs<ExtArgs>
completionChangedComments?: boolean | Prisma.User$completionChangedCommentsArgs<ExtArgs>
createdInvites?: boolean | Prisma.User$createdInvitesArgs<ExtArgs>
createdNotifications?: boolean | Prisma.User$createdNotificationsArgs<ExtArgs>
notifications?: boolean | Prisma.User$notificationsArgs<ExtArgs>
@@ -3164,6 +3397,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
tasks?: boolean | Prisma.User$tasksArgs<ExtArgs>
teamMembers?: boolean | Prisma.User$teamMembersArgs<ExtArgs>
comments?: boolean | Prisma.User$commentsArgs<ExtArgs>
completionChangedComments?: boolean | Prisma.User$completionChangedCommentsArgs<ExtArgs>
createdInvites?: boolean | Prisma.User$createdInvitesArgs<ExtArgs>
createdNotifications?: boolean | Prisma.User$createdNotificationsArgs<ExtArgs>
notifications?: boolean | Prisma.User$notificationsArgs<ExtArgs>
@@ -3188,6 +3422,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
tasks: Prisma.$TaskPayload<ExtArgs>[]
teamMembers: Prisma.$TeamMemberPayload<ExtArgs>[]
comments: Prisma.$AssetCommentPayload<ExtArgs>[]
completionChangedComments: Prisma.$AssetCommentPayload<ExtArgs>[]
createdInvites: Prisma.$InvitePayload<ExtArgs>[]
createdNotifications: Prisma.$NotificationPayload<ExtArgs>[]
notifications: Prisma.$NotificationPayload<ExtArgs>[]
@@ -3614,6 +3849,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
tasks<T extends Prisma.User$tasksArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$tasksArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$TaskPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
teamMembers<T extends Prisma.User$teamMembersArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$teamMembersArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$TeamMemberPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
comments<T extends Prisma.User$commentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$commentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AssetCommentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
completionChangedComments<T extends Prisma.User$completionChangedCommentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$completionChangedCommentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AssetCommentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
createdInvites<T extends Prisma.User$createdInvitesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$createdInvitesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InvitePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
createdNotifications<T extends Prisma.User$createdNotificationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$createdNotificationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$NotificationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
notifications<T extends Prisma.User$notificationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$notificationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$NotificationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
@@ -4177,6 +4413,30 @@ export type User$commentsArgs<ExtArgs extends runtime.Types.Extensions.InternalA
distinct?: Prisma.AssetCommentScalarFieldEnum | Prisma.AssetCommentScalarFieldEnum[]
}
/**
* User.completionChangedComments
*/
export type User$completionChangedCommentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the AssetComment
*/
select?: Prisma.AssetCommentSelect<ExtArgs> | null
/**
* Omit specific fields from the AssetComment
*/
omit?: Prisma.AssetCommentOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.AssetCommentInclude<ExtArgs> | null
where?: Prisma.AssetCommentWhereInput
orderBy?: Prisma.AssetCommentOrderByWithRelationInput | Prisma.AssetCommentOrderByWithRelationInput[]
cursor?: Prisma.AssetCommentWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.AssetCommentScalarFieldEnum | Prisma.AssetCommentScalarFieldEnum[]
}
/**
* User.createdInvites
*/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/dtos",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
+9
View File
@@ -204,6 +204,8 @@ export type CommentInfo = {
createdAt: string
updatedAt: string
sessionId: string | null
isCompleted: boolean
completionLastChangedBy: AssetUserInfo | null
}
export const commentInfoSchema: z.ZodType<CommentInfo> = z.object({
@@ -220,8 +222,15 @@ export const commentInfoSchema: z.ZodType<CommentInfo> = z.object({
createdAt: z.string(),
updatedAt: z.string(),
sessionId: z.string().nullable(),
isCompleted: z.boolean(),
completionLastChangedBy: assetUserInfoSchema.nullable(),
})
export const completeCommentRequestSchema = z.object({
isCompleted: z.boolean(),
})
export type CompleteCommentRequest = z.infer<typeof completeCommentRequestSchema>
export const reparentAssetsRequestSchema = z.object({
newParentId: z.string(),
assetIds: z.array(z.string()),
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/tableprinter",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/transcode",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./src/index.ts",
@@ -14,6 +14,7 @@ import {
overlayAnnotationsActivity,
takeScreenshotsActivity,
transcodeVideoActivity,
transcodeAudioActivity,
updateAssetMediaActivity,
downloadMediaToTmpActivity,
transcodeImageActivity,
@@ -36,8 +37,10 @@ vi.mock('@shumai/core/src/s3/s3', () => ({
vi.mock('@shumai/core/src/transcode/transcode', () => ({
transcodeService: {
getVideoInfo: vi.fn(),
getAudioInfo: vi.fn(),
getImageInfo: vi.fn(),
transcodeVideo: vi.fn(),
transcodeAudio: vi.fn(),
transcodeImage: vi.fn(),
generateSprite: vi.fn(),
createTempDir: vi.fn().mockReturnValue('/tmp'),
@@ -143,20 +146,49 @@ describe('Transcode Activities', () => {
)
})
it('should set file_type to audio for audio files', async () => {
it('should set file_type to audio for audio files and extract audio metadata', async () => {
const asset = await prisma.asset.create({
data: { name: 'a.mp3', type: 'file', status: 'uploaded' },
})
vi.mocked(transcodeService.getAudioInfo).mockResolvedValue({
originalWidth: 0,
originalHeight: 0,
duration: 45.5,
bitRate: 128000,
frameRate: 0,
totalFrames: 0,
hasAudio: true,
audioCodec: 'mp3',
audioChannels: 2,
audioSampleRate: 44100,
audioBitDepth: 16,
mimeType: 'audio/mpeg',
})
await getMediaInfoActivity({
const result = await getMediaInfoActivity({
assetId: asset.id,
filePath: '/tmp/a.mp3',
mediaType: 'audio/mpeg',
})
expect(transcodeService.getAudioInfo).toHaveBeenCalledWith('/tmp/a.mp3')
expect(result.duration).toBe(45.5)
expect(result.metadata?.duration).toBe(45.5)
expect(result.metadata?.audioCodec).toBe('mp3')
expect(result.metadata?.audioChannels).toBe(2)
expect(result.metadata?.audioSampleRate).toBe(44100)
expect(result.metadata?.audioBitDepth).toBe(16)
expect(metadataService.updateAssetMetadata).toHaveBeenCalledWith(
asset.id,
expect.arrayContaining([{ key: 'file_type', value: 'audio' }]),
expect.arrayContaining([
{ key: 'file_type', value: 'audio' },
{ key: 'duration', value: 45.5 },
{ key: 'audio_codec', value: 'mp3' },
{ key: 'audio_channels', value: 2 },
{ key: 'audio_sample_rate', value: 44100 },
{ key: 'audio_bit_depth', value: 16 },
]),
true,
)
})
@@ -437,5 +469,53 @@ describe('Transcode Activities', () => {
await deleteS3ObjectActivity({ key: 'files/test-key.mp4' })
expect(s3Service.deleteObject).toHaveBeenCalledWith('shumai', 'files/test-key.mp4')
})
it('should transcode audio file and upload proxy to S3', async () => {
vi.mocked(s3Service.headObject).mockRejectedValue(new Error('Not found'))
vi.mocked(transcodeService.transcodeAudio).mockResolvedValue()
const res = await transcodeAudioActivity({
assetKey: 'files/proj-123/a.wav',
filePath: '/tmp/a.wav',
})
expect(transcodeService.transcodeAudio).toHaveBeenCalledWith({
inputFile: '/tmp/a.wav',
outputFile: expect.stringContaining('a-audio-proxy.mp4'),
bitrate: '128k',
})
expect(s3Service.putObject).toHaveBeenCalledWith(
'shumai',
'files/proj-123/a-audio-proxy.mp4',
expect.any(Buffer),
expect.any(Number),
'video/mp4',
)
expect(res).toEqual({
width: 0,
height: 0,
key: 'files/proj-123/a-audio-proxy.mp4',
})
})
it('should return existing audio transcode if already exists in S3', async () => {
vi.mocked(s3Service.headObject).mockResolvedValue(
{} as Awaited<ReturnType<typeof s3Service.headObject>>,
)
const res = await transcodeAudioActivity({
assetKey: 'files/proj-123/a.wav',
filePath: '/tmp/a.wav',
})
expect(transcodeService.transcodeAudio).not.toHaveBeenCalled()
expect(res).toEqual({
width: 0,
height: 0,
key: 'files/proj-123/a-audio-proxy.mp4',
})
})
})
})
+105 -15
View File
@@ -116,6 +116,36 @@ export async function getMediaInfoActivity(params: {
metadataUpdates.push({ key: 'audio_sample_rate', value: info.audioSampleRate })
if (info.audioBitDepth !== undefined)
metadataUpdates.push({ key: 'audio_bit_depth', value: info.audioBitDepth })
} else if (isAudio) {
const info = await transcodeService.getAudioInfo(params.filePath)
mediaInfo.duration = info.duration
mediaInfo.metadata = {
originalWidth: 0,
originalHeight: 0,
duration: info.duration,
bitRate: info.bitRate,
frameRate: 0,
totalFrames: 0,
startTimecode: '00:00:00:00',
hasAudio: true,
videoCodec: undefined,
audioCodec: info.audioCodec,
audioChannels: info.audioChannels,
audioSampleRate: info.audioSampleRate,
audioBitDepth: info.audioBitDepth,
format: {},
}
metadataUpdates.push(
{ key: 'duration', value: info.duration },
{ key: 'bitRate', value: info.bitRate / 1000 },
)
if (info.audioCodec) metadataUpdates.push({ key: 'audio_codec', value: info.audioCodec })
if (info.audioChannels !== undefined)
metadataUpdates.push({ key: 'audio_channels', value: info.audioChannels })
if (info.audioSampleRate !== undefined)
metadataUpdates.push({ key: 'audio_sample_rate', value: info.audioSampleRate })
if (info.audioBitDepth !== undefined)
metadataUpdates.push({ key: 'audio_bit_depth', value: info.audioBitDepth })
} else if (isImage) {
const info = await transcodeService.getImageInfo(params.filePath)
mediaInfo.metadata = {
@@ -230,6 +260,64 @@ export async function transcodeVideoActivity(
}
}
export interface AudioActivityParams {
assetKey: string
filePath: string
}
export async function transcodeAudioActivity(
params: AudioActivityParams,
): Promise<PrismaJson.VideoTranscode> {
const bucket = process.env.S3_BUCKET || 'shumai'
const stem = stemFromKey(params.assetKey)
const key = path.posix.join(path.posix.dirname(params.assetKey), `${stem}-audio-proxy.mp4`)
try {
await s3Service.headObject(bucket, key)
return { width: 0, height: 0, key }
} catch {
// Not found
}
const tmpDir = path.dirname(params.filePath)
const outputFile = path.join(tmpDir, `${stem}-audio-proxy.mp4`)
try {
await transcodeService.transcodeAudio({
inputFile: params.filePath,
outputFile,
bitrate: '128k',
})
const buffer = fs.readFileSync(outputFile)
await s3Service.putObject(bucket, key, buffer, buffer.length, 'video/mp4')
return { width: 0, height: 0, key }
} catch (err) {
const { code, message } = getErrorDetails(err)
const lowerMsg = message.toLowerCase()
if (
code === 'ENOENT' ||
lowerMsg.includes('enoent') ||
lowerMsg.includes('ffmpeg') ||
lowerMsg.includes('ffprobe') ||
lowerMsg.includes('spawn') ||
lowerMsg.includes('format') ||
lowerMsg.includes('no video stream found')
) {
throw ApplicationFailure.create({
message: `Audio transcoding failed: ${message}`,
nonRetryable: true,
cause: err instanceof Error ? err : undefined,
})
}
throw err
} finally {
if (fs.existsSync(outputFile)) fs.unlinkSync(outputFile)
}
}
export interface ImageActivityParams {
assetKey: string
filePath: string
@@ -494,23 +582,25 @@ export interface CreateEmbeddingTaskIfEnabledParams {
export async function createEmbeddingTaskIfEnabledActivity(
params: CreateEmbeddingTaskIfEnabledParams,
): Promise<void> {
let teamId = params.teamId
let projectId = params.projectId
// Resolve teamId and projectId from asset if missing
if (!teamId || !projectId) {
const asset = await prisma.asset.findUnique({
where: { id: params.assetId },
include: {
project: true,
},
})
if (asset) {
projectId = projectId || asset.projectId
teamId = teamId || asset.project?.teamId || null
}
const asset = await prisma.asset.findUnique({
where: { id: params.assetId },
include: {
project: true,
},
})
if (!asset) {
return
}
const isVideo = asset.mediaType?.startsWith('video/')
const isImage = asset.mediaType?.startsWith('image/')
if (!isVideo && !isImage) {
return
}
const teamId = params.teamId || asset.project?.teamId || null
const projectId = params.projectId || asset.projectId
if (!teamId) {
return
}
@@ -25,6 +25,7 @@ describe('Transcode Workflow', () => {
getAssetActivity: Object.assign(vi.fn(), { _activityName: 'getAssetActivity' }),
getMediaInfoActivity: Object.assign(vi.fn(), { _activityName: 'getMediaInfoActivity' }),
transcodeVideoActivity: Object.assign(vi.fn(), { _activityName: 'transcodeVideoActivity' }),
transcodeAudioActivity: Object.assign(vi.fn(), { _activityName: 'transcodeAudioActivity' }),
transcodeImageActivity: Object.assign(vi.fn(), { _activityName: 'transcodeImageActivity' }),
generateSpriteActivity: Object.assign(vi.fn(), { _activityName: 'generateSpriteActivity' }),
updateAssetMediaActivity: Object.assign(vi.fn(), {
@@ -388,4 +389,87 @@ describe('Transcode Workflow', () => {
output: { key: 'files/asset-image/annotations/ann1.webp' },
})
})
it('should run audio transcoding workflow successfully', async () => {
const task: WorkflowTask = {
id: 'task-audio',
assetId: 'asset-audio',
type: WorkflowTaskType.transcode,
status: WorkflowTaskStatus.pending,
output: null,
payload: {
projectId: 'proj-1',
transcode: {},
},
createdAt: new Date(),
updatedAt: new Date(),
heartbeat: null,
teamId: 'team-1',
projectId: 'proj-1',
uid: 'task-uid-2',
model: null,
inputTokens: 0,
outputTokens: 0,
}
mockActivities.getAssetActivity.mockResolvedValue({
id: 'asset-audio',
storageKey: { key: 'audio.wav' },
mediaType: 'audio/wav',
})
mockActivities.getMediaInfoActivity.mockResolvedValue({
mimeType: 'audio/wav',
metadata: {
originalWidth: 0,
originalHeight: 0,
duration: 30,
bitRate: 1411200,
frameRate: 0,
totalFrames: 0,
hasAudio: true,
audioCodec: 'pcm_s16le',
audioChannels: 2,
},
original: {
key: 'audio.wav',
downloadUrl: '',
filesizeInBytes: 0,
codec: '',
},
videoTranscodes: [],
})
mockActivities.transcodeAudioActivity.mockResolvedValue({
width: 0,
height: 0,
key: 'files/asset-audio/audio-audio-proxy.mp4',
})
await transcodeMedia(task)
expect(mockActivities.transcodeAudioActivity).toHaveBeenCalledWith({
assetKey: 'audio.wav',
filePath: '/tmp/video.mp4',
})
expect(mockActivities.updateAssetMediaActivity).toHaveBeenCalledWith({
assetId: 'asset-audio',
mediaInfo: expect.objectContaining({
mimeType: 'audio/wav',
videoTranscodes: [
{
width: 0,
height: 0,
key: 'files/asset-audio/audio-audio-proxy.mp4',
},
],
}),
})
expect(mockActivities.updateTaskStatusActivity).toHaveBeenCalledWith({
taskId: 'task-audio',
status: WorkflowTaskStatus.completed,
})
})
})
@@ -10,6 +10,7 @@ export async function transcodeMedia(task: WorkflowTask): Promise<void> {
getAssetActivity,
getMediaInfoActivity,
transcodeVideoActivity,
transcodeAudioActivity,
transcodeImageActivity,
generateSpriteActivity,
updateAssetMediaActivity,
@@ -181,6 +182,16 @@ export async function transcodeMedia(task: WorkflowTask): Promise<void> {
})
}
// 6.5 Audio Transcoding
const isAudio = mimeType.startsWith('audio/')
if (isAudio && metadata) {
const audioTranscode = await executeActivity(workerQueue, transcodeAudioActivity, {
assetKey: key,
filePath,
})
mediaInfo.videoTranscodes.push(audioTranscode)
}
// 7. Image Transcoding
const isImage = mimeType.startsWith('image/')
const isPsd = isMimePsd(mimeType)
+5 -1
View File
@@ -34,6 +34,7 @@ interface BreadcrumbNavProps {
name?: string
type: 'file' | 'folder'
version?: number
mediaType?: string | null
}
isRootFolder: boolean
displayStyle?: 'card' | 'list'
@@ -135,8 +136,11 @@ export function BreadcrumbNav({
}
}
const isAudio = currentAsset.mediaType?.startsWith('audio/')
const hasVideoTranscodes =
downloadInfo?.videoTranscodes && downloadInfo.videoTranscodes.filter((t) => !t.isRaw).length > 0
!isAudio &&
downloadInfo?.videoTranscodes &&
downloadInfo.videoTranscodes.filter((t) => !t.isRaw).length > 0
const breadcrumbs: { name: string; path?: string; id?: string; isMuted?: boolean }[] = isPublic
? [
+97 -16
View File
@@ -10,16 +10,17 @@ import {
import { Separator } from '@/ui/components/ui/separator'
import { formatTimeAgo } from '@/ui/lib/time'
import type { AttachmentInfo, CommentInfo, UserInfo } from '@shumai/dtos'
import { useQuery } from '@tanstack/react-query'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { Download, File, Terminal } from 'lucide-react'
import React from 'react'
import Markdown from 'react-markdown'
import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar'
import { DrawAnnotation } from '../ui/icons'
import { Skeleton } from '../ui/skeleton'
import { formatTimecode } from '../viewers/utils'
import { formatTimecode } from '../viewers/video/utils'
import { m } from '@/ui/paraglide/messages.js'
import { useUiStore } from '@/ui/stores/ui'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip'
interface MessageCardProps {
teamId?: string
@@ -37,6 +38,42 @@ interface MessageCardProps {
rootParentId?: string
}
const UnfilledCircleCheck: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<circle cx="12" cy="12" r="10" />
<path d="m9 12 2 2 4-4" />
</svg>
)
const FilledCircleCheck: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="none"
{...props}
>
<circle cx="12" cy="12" r="10" />
<path
d="m9 12 2 2 4-4"
fill="none"
stroke="white"
strokeWidth="2.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
/* eslint-disable @typescript-eslint/naming-convention */
const AI_PLACEHOLDERS: Record<string, string> = {
__CHAT__: 'Generating...',
@@ -91,6 +128,23 @@ export const MessageCard: React.FC<MessageCardProps> = ({
const isAdmin = me?.role === 'owner'
const queryClient = useQueryClient()
const { mutate: toggleComplete } = useMutation({
mutationFn: async () => {
const res = await client.api.comments[':commentId'].complete.$post({
param: { commentId: message.id },
json: { isCompleted: !message.isCompleted },
})
if (!res.ok) throw new Error('Failed to update comment completion status')
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({
predicate: (query) => query.queryKey.includes('comments'),
})
},
})
const { data: logs, isLoading: isLogsLoading } = useQuery({
queryKey: ['agent-sessions', message.sessionId, 'entries'],
queryFn: async () => {
@@ -273,13 +327,40 @@ export const MessageCard: React.FC<MessageCardProps> = ({
)}
{/* Actions */}
<div className="mt-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center gap-4">
<div className="mt-2 flex items-center justify-between w-full">
<button
onClick={handleReply}
className="text-xs font-medium text-gray-500 hover:text-blue-600 flex items-center gap-1 cursor-pointer"
>
Reply
{m.reply()}
</button>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<button
onClick={(e) => {
e.stopPropagation()
toggleComplete()
}}
className={`flex items-center justify-center p-1 rounded-full transition-colors cursor-pointer ${
message.isCompleted
? 'text-green-500 hover:text-green-600 hover:bg-green-500/10'
: 'text-gray-400 hover:text-green-500 hover:bg-green-500/10'
}`}
>
{message.isCompleted ? (
<FilledCircleCheck className="w-5 h-5" />
) : (
<UnfilledCircleCheck className="w-5 h-5" />
)}
</button>
</TooltipTrigger>
<TooltipContent>
{message.isCompleted ? m.mark_as_incomplete() : m.mark_as_complete()}
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
</div>
@@ -289,11 +370,9 @@ export const MessageCard: React.FC<MessageCardProps> = ({
<DialogHeader className="pb-4 border-b border-foreground/15">
<DialogTitle className="flex items-center gap-2 text-xl font-bold">
<Terminal className="w-5 h-5 text-violet-500" />
Agent Session Logs
{m.agent_session_logs()}
</DialogTitle>
<DialogDescription>
Step-by-step execution trace of the agent's background tasks and tool calls.
</DialogDescription>
<DialogDescription>{m.agent_logs_description()}</DialogDescription>
</DialogHeader>
<div className="flex-1 overflow-y-auto pr-1 py-4 space-y-4 min-h-0 select-text">
@@ -338,20 +417,22 @@ export const MessageCard: React.FC<MessageCardProps> = ({
if (msg.role === 'user') {
badgeColor =
'bg-slate-100 text-slate-800 dark:bg-slate-900/30 dark:text-slate-300'
roleName = 'User'
roleName = m.role_user()
} else if (msg.role === 'assistant') {
badgeColor =
'bg-violet-100 text-violet-800 dark:bg-violet-900/30 dark:text-violet-300'
roleName = 'Agent'
roleName = m.role_agent()
} else if (msg.role === 'toolResult') {
badgeColor = msg.isError
? 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300'
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300'
roleName = `Tool Result: ${String(msg.toolName || 'Unknown')}`
roleName = m.tool_result_with_name({
name: String(msg.toolName || m.unknown()),
})
} else if (msg.role === 'thought') {
badgeColor =
'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300'
roleName = 'Thinking'
roleName = m.role_thinking()
}
const renderToolCallArguments = (args: unknown) => {
@@ -450,7 +531,7 @@ export const MessageCard: React.FC<MessageCardProps> = ({
if (type === 'toolCall') {
const toolName = String(
itemObj.name || itemObj.toolName || 'Unknown',
itemObj.name || itemObj.toolName || m.unknown(),
)
const toolArgs = itemObj.arguments || itemObj.args
renderedBlocks.push(
@@ -480,7 +561,7 @@ export const MessageCard: React.FC<MessageCardProps> = ({
key={`img-${idx}`}
className="text-xs text-muted-foreground italic flex items-center gap-1.5 py-1"
>
[Image Object]
{m.image_object()}
</div>,
)
return
@@ -574,9 +655,9 @@ export const MessageCard: React.FC<MessageCardProps> = ({
) : (
<div className="flex flex-col items-center justify-center py-12 text-center text-muted-foreground">
<Terminal className="w-8 h-8 text-muted-foreground/40 mb-2 animate-pulse" />
<p className="text-sm font-medium">No logs found for this session.</p>
<p className="text-sm font-medium">{m.no_logs_found()}</p>
<p className="text-xs text-muted-foreground/60 mt-1">
The session might have been initialized but has not produced any entries yet.
{m.session_no_entries_yet()}
</p>
</div>
)}
@@ -1,4 +1,5 @@
import type { CommentInfo, PostAttachmentRequest, PostAttachmentResponse } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
import type { BotInfo } from '@shumai/dtos'
import type { UserInfo } from '@shumai/dtos'
import { client } from '@/ui/api/client'
@@ -27,7 +28,7 @@ import { Button } from '../ui/button'
import { DrawAnnotation } from '../ui/icons'
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
import { ProgressCircle } from '../ui/progress-circle'
import { formatTimecode } from '../viewers/utils'
import { formatTimecode } from '../viewers/video/utils'
import { useUiStore } from '@/ui/stores/ui'
type UploadingFile = {
@@ -603,7 +604,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
{replyingTo && (
<div className="flex items-center justify-between bg-muted p-2 px-3 rounded-lg border border-border">
<div className="text-xs text-muted-foreground truncate mr-2">
reply to: {replyingTo.message}
{m.reply_to_message({ message: replyingTo.message || '' })}
</div>
<button
onClick={onCancelReply}
@@ -674,7 +675,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
suppressContentEditableWarning
onInput={handleInput}
onKeyDown={handleKeyDown}
data-placeholder={replyingTo ? 'Reply...' : 'Message...'}
data-placeholder={replyingTo ? m.reply_placeholder() : m.message_placeholder()}
className={`bg-transparent border-none focus:ring-0 resize-none min-h-[40px] leading-relaxed py-2 focus:outline-none block ${paddingLeftClass}`}
/>
</div>
@@ -784,7 +785,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
variant={isTimestampEnabled ? 'secondary' : 'ghost'}
size="icon"
className={`p-2 rounded-full cursor-pointer ${isTimestampEnabled ? 'text-blue-600 bg-blue-50 dark:bg-blue-900/20' : ''}`}
title={isTimestampEnabled ? 'Disable Timestamp' : 'Enable Timestamp'}
title={isTimestampEnabled ? m.disable_timestamp() : m.enable_timestamp()}
>
<Clock className="w-4 h-4" />
</Button>
@@ -794,7 +795,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
className="p-2 rounded-full cursor-pointer"
variant="ghost"
size="icon"
title="Attach files"
title={m.attach_files()}
>
<Paperclip className="w-4 h-4" />
</Button>
@@ -804,7 +805,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
variant="ghost"
size="icon"
className="p-2 rounded-full cursor-pointer"
title="Toggle Annotation"
title={m.toggle_annotation()}
>
<DrawAnnotation className="w-4 h-4" />
</Button>
@@ -1,9 +1,9 @@
import { ImageControlBar } from '@/ui/components/viewers/image-control-bar'
import { ImageControlBar } from '@/ui/components/viewers/image/image-control-bar'
import {
VideoControlBar,
type DisplayTranscode,
type PlayerState,
} from '@/ui/components/viewers/video-control-bar'
} from '@/ui/components/viewers/video/video-control-bar'
import type { AssetInfo } from '@shumai/dtos'
import { Maximize, Minimize } from 'lucide-react'
import type { PaneReportedState } from './types'
@@ -85,10 +85,10 @@ export function CompareControlBar({
toggleMute={onToggleMute}
handleVolumeChange={onVolumeChange}
changePlaybackRate={onChangePlaybackRate}
changeResolution={(res) => onChangeResolution(res.resolution)}
handleDownload={(key) => onDownload(key)}
changeResolution={(res: DisplayTranscode) => onChangeResolution(res.resolution)}
handleDownload={(key?: string) => onDownload(key)}
toggleFullScreen={onToggleFullScreen}
onZoomChange={(nz) => (nz >= activeState.zoom ? onZoomIn() : onZoomOut())}
onZoomChange={(nz: number) => (nz >= activeState.zoom ? onZoomIn() : onZoomOut())}
onZoomReset={onFit}
frameRate={v.frameRate}
totalFrames={v.totalFrames}
@@ -4,12 +4,10 @@ import type { AssetInfo } from '@shumai/dtos'
import { useQuery } from '@tanstack/react-query'
import { Loader2 } from 'lucide-react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { getViewerForFile } from '@/ui/components/viewers/registry'
import { CompareControlBar } from './compare-control-bar'
import { CompareImagePane } from './compare-image-pane'
import { ComparePaneTopbar } from './compare-pane-topbar'
import { isSameType, kindOf } from './compare-utils'
import { CompareVideoPane } from './compare-video-pane'
import type { ComparePaneHandle, CompareSide, PaneKind, PaneReportedState } from './types'
import type { ComparePaneHandle, CompareSide, PaneReportedState } from './types'
interface VersionItem {
id: string
@@ -89,9 +87,9 @@ export function CompareViewer({
const { data: leftAsset, isLoading: leftLoading } = useCompareAsset(leftId, isPublic, shareId)
const { data: rightAsset, isLoading: rightLoading } = useCompareAsset(rightId, isPublic, shareId)
const leftKind = kindOf(leftAsset?.mediaType)
const rightKind = kindOf(rightAsset?.mediaType)
const sameType = isSameType(leftKind, rightKind)
const leftDef = getViewerForFile(leftAsset)
const rightDef = getViewerForFile(rightAsset)
const sameType = !!leftAsset && !!rightAsset && leftDef.id === rightDef.id
const activeAsset = activeSide === 'left' ? leftAsset : rightAsset
const activeState = activeSide === 'left' ? leftState : rightState
@@ -219,51 +217,41 @@ export function CompareViewer({
[activeAsset?.media?.videoPreview?.url],
)
const renderPane = (side: CompareSide, asset: AssetInfo, kind: PaneKind) => {
const renderPane = (side: CompareSide, asset: AssetInfo) => {
const def = getViewerForFile(asset)
const ComparePane = def?.comparePane
if (!ComparePane) {
return (
<div className="flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950">
<p className="text-muted-foreground">Preview unavailable</p>
</div>
)
}
const isActive = activeSide === side
const paneRef = side === 'left' ? leftRef : rightRef
const onStateChange = side === 'left' ? handleStateChangeLeft : handleStateChangeRight
const onUserPan = side === 'left' ? handleUserPanLeft : handleUserPanRight
const paneAnnotations = isActive ? annotations : []
if (kind === 'video') {
return (
<CompareVideoPane
key={asset.id}
ref={paneRef}
file={asset}
shareId={shareId}
isActive={isActive}
muted={isActive ? userMuted : true}
volume={userVolume}
annotations={paneAnnotations}
onStateChange={onStateChange}
onActivate={() => onActiveSideChange(side)}
onRequestTogglePlay={handleRequestTogglePlay}
onTimeUpdate={onTimeUpdate}
onPlay={onPlay}
/>
)
}
if (kind === 'image') {
return (
<CompareImagePane
key={asset.id}
ref={paneRef}
file={asset}
shareId={shareId}
isActive={isActive}
annotations={paneAnnotations}
onStateChange={onStateChange}
onUserPan={onUserPan}
onActivate={() => onActiveSideChange(side)}
/>
)
}
return (
<div className="flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950">
<p className="text-muted-foreground">Preview unavailable</p>
</div>
<ComparePane
key={asset.id}
ref={paneRef}
file={asset}
shareId={shareId}
isActive={isActive}
annotations={paneAnnotations}
onStateChange={onStateChange}
onUserPan={onUserPan}
onActivate={() => onActiveSideChange(side)}
muted={isActive ? userMuted : true}
volume={userVolume}
onPlay={onPlay}
onTimeUpdate={onTimeUpdate}
onRequestTogglePlay={handleRequestTogglePlay}
/>
)
}
@@ -290,7 +278,7 @@ export function CompareViewer({
)}
<div className="relative flex min-h-0 flex-1">
{leftAsset ? (
renderPane('left', leftAsset, leftKind)
renderPane('left', leftAsset)
) : (
<div className="flex flex-1 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-foreground" />
@@ -316,7 +304,7 @@ export function CompareViewer({
)}
<div className="relative flex min-h-0 flex-1">
{rightAsset ? (
renderPane('right', rightAsset, rightKind)
renderPane('right', rightAsset)
) : (
<div className="flex flex-1 items-center justify-center">
<Loader2 className="h-6 w-6 animate-spin text-foreground" />
@@ -513,7 +513,10 @@ export function FileBrowser({
fileCount: 0,
type: 'file',
status: hasUrl ? 'uploading' : 'error',
mediaType: f.file.type || null,
mediaType:
f.file.name.toLowerCase().endsWith('.wma') && f.file.type?.startsWith('video/')
? f.file.type.replace(/^video\//, 'audio/')
: f.file.type || null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
@@ -846,13 +849,17 @@ export function FileBrowser({
}
const fileWithId = { file, id: ulid() }
fileWithIds.push(fileWithId)
let mediaType = file.type
if (fileName.toLowerCase().endsWith('.wma') && mediaType?.startsWith('video/')) {
mediaType = mediaType.replace(/^video\//, 'audio/')
}
currentLevel.push({
name: fileName,
size: file.size,
type: 'file',
id: fileWithId.id,
children: [],
mediaType: file.type,
mediaType,
})
}
filesToUpload = fileWithIds
@@ -1,5 +1,6 @@
import { client } from '@/ui/api/client'
import type { AssetInfo, FieldValueInfo } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
import { useQuery } from '@tanstack/react-query'
import { Badge } from '@/ui/components/ui/badge'
@@ -292,8 +293,11 @@ export function FileCard({
className="h-auto p-0 text-sm text-foreground !bg-transparent"
/>
<p className="text-sm text-muted-foreground">
{displayItem.createdAt && formatTimeAgo(displayItem.createdAt)} by{' '}
{displayItem.creator?.name}
{displayItem.createdAt &&
m.created_by_at({
time: formatTimeAgo(displayItem.createdAt),
author: displayItem.creator?.name || m.unknown_user(),
})}
</p>
</div>
<DropdownMenu modal={false}>
@@ -317,7 +321,7 @@ export function FileCard({
}}
>
<Download className="mr-2 h-4 w-4" />
<span>Download</span>
<span>{m.download()}</span>
</DropdownMenuItem>
{canEdit && (
<DropdownMenuItem
@@ -328,7 +332,7 @@ export function FileCard({
className="text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
<span>Remove from Share</span>
<span>{m.remove_from_share()}</span>
</DropdownMenuItem>
)}
</>
@@ -340,7 +344,7 @@ export function FileCard({
}}
>
<History className="mr-2 h-4 w-4" />
<span>Restore</span>
<span>{m.restore()}</span>
</DropdownMenuItem>
) : (
<>
@@ -352,7 +356,7 @@ export function FileCard({
}}
>
<Edit className="mr-2 h-4 w-4" />
<span>Rename</span>
<span>{m.rename()}</span>
</DropdownMenuItem>
)}
<DropdownMenuItem
@@ -362,7 +366,7 @@ export function FileCard({
}}
>
<Download className="mr-2 h-4 w-4" />
<span>Download</span>
<span>{m.download()}</span>
</DropdownMenuItem>
{canEdit && (
<>
@@ -375,7 +379,7 @@ export function FileCard({
className="text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
<span>Delete</span>
<span>{m.delete()}</span>
</DropdownMenuItem>
</>
)}
@@ -3,7 +3,7 @@ import { client } from '@/ui/api/client'
import { useQuery } from '@tanstack/react-query'
import { useDraggable } from '@dnd-kit/react'
import { File, Folder, MoreVertical } from 'lucide-react'
import { File, Folder, MoreVertical, AudioLines } from 'lucide-react'
import React, { useEffect, useMemo, useRef, useState } from 'react'
import { cn } from '@/ui/lib/utils'
import type { DragState } from '../dnd-types'
@@ -214,6 +214,9 @@ export function FileListItem({
alt=""
className="w-full h-full object-cover"
/>
) : displayItem.preview?.mediaType?.startsWith('audio/') ||
displayItem.mediaType?.startsWith('audio/') ? (
<AudioLines className="h-4 w-4 text-muted-foreground" />
) : displayItem.type === 'folder' ? (
<Folder className="h-4 w-4 text-primary" />
) : (
@@ -1,6 +1,6 @@
import { File, Folder } from 'lucide-react'
import { File, Folder, AudioLines } from 'lucide-react'
import { SpriteScrubber } from '../sprite-scrubber'
import { formatTime } from '../viewers/utils'
import { formatTime } from '../viewers/video/utils'
type FilePreviewItem = {
type?: string | null
@@ -21,9 +21,11 @@ interface FilePreviewProps {
export const FilePreview = ({ item, showDuration = false }: FilePreviewProps) => {
const isVideo = item.preview?.mediaType?.startsWith('video/')
const isAudio = item.preview?.mediaType?.startsWith('audio/')
const hasDuration = isVideo || isAudio
const duration = item.preview?.duration
const durationOverlay =
showDuration && isVideo && typeof duration === 'number' && duration > 0 ? (
showDuration && hasDuration && typeof duration === 'number' && duration > 0 ? (
<span className="pointer-events-none absolute bottom-1 right-1 text-xs font-medium tabular-nums text-white">
{formatTime(duration)}
</span>
@@ -63,6 +65,17 @@ export const FilePreview = ({ item, showDuration = false }: FilePreviewProps) =>
)
}
if (isAudio) {
return (
<>
<div className="w-full h-full flex items-center justify-center bg-zinc-950">
<AudioLines className="w-8 h-8 text-zinc-500" />
</div>
{durationOverlay}
</>
)
}
// Assumption: folders in latestChildren have no media type.
if (!item.type) {
return (
@@ -10,6 +10,7 @@ import { EditableText } from '@/ui/components/ui/editable-text'
import { cn } from '@/ui/lib/utils'
import { useDraggable, useDroppable } from '@dnd-kit/react'
import type { AssetInfo, ChildPreview } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
import { Download, Edit, History, MoreHorizontal, Trash2 } from 'lucide-react'
import React, { useEffect, useMemo, useRef, useState } from 'react'
import type { DragState } from '../dnd-types'
@@ -344,7 +345,9 @@ export function FolderCard({
<div className="flex items-center justify-between text-muted-foreground">
<span className="text-xs tracking-wide opacity-80">
{item.fileCount || 0} {(item.fileCount || 0) === 1 ? 'Item' : 'Items'}
{(item.fileCount || 0) === 1
? m.n_items_singular({ count: item.fileCount || 0 })
: m.n_items_plural({ count: item.fileCount || 0 })}
</span>
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
@@ -365,7 +368,7 @@ export function FolderCard({
}}
>
<Download className="mr-2 h-4 w-4" />
<span>Download</span>
<span>{m.download()}</span>
</DropdownMenuItem>
{canEdit && (
<DropdownMenuItem
@@ -376,7 +379,7 @@ export function FolderCard({
className="text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
<span>Remove from Share</span>
<span>{m.remove_from_share()}</span>
</DropdownMenuItem>
)}
</>
@@ -388,7 +391,7 @@ export function FolderCard({
}}
>
<History className="mr-2 h-4 w-4" />
<span>Restore</span>
<span>{m.restore()}</span>
</DropdownMenuItem>
) : (
<>
@@ -400,7 +403,7 @@ export function FolderCard({
}}
>
<Edit className="mr-2 h-4 w-4" />
<span>Rename</span>
<span>{m.rename()}</span>
</DropdownMenuItem>
)}
<DropdownMenuItem
@@ -410,7 +413,7 @@ export function FolderCard({
}}
>
<Download className="mr-2 h-4 w-4" />
<span>Download</span>
<span>{m.download()}</span>
</DropdownMenuItem>
{canEdit && (
<>
@@ -423,7 +426,7 @@ export function FolderCard({
className="text-destructive"
>
<Trash2 className="mr-2 h-4 w-4" />
<span>Delete</span>
<span>{m.delete()}</span>
</DropdownMenuItem>
</>
)}
@@ -382,7 +382,8 @@ export function FileBrowserToolbar({
<MembersDialog
open={isMembersDialogOpen}
onOpenChange={handleOpenMembersDialog}
title="Project Members"
title={m.project_members()}
type="project"
members={members || []}
isOwner={me?.role === 'owner'}
onInvite={handleInvite}
@@ -2,7 +2,7 @@ import { client } from '@/ui/api/client'
import { cn } from '@/ui/lib/utils'
import type { AssetInfo, AssetInfoPaginatedList } from '@shumai/dtos'
import { Link } from '@tanstack/react-router'
import { File, Loader2 } from 'lucide-react'
import { File, Loader2, AudioLines } from 'lucide-react'
import type { FC } from 'react'
import { useEffect, useRef, useState } from 'react'
import { useInView } from 'react-intersection-observer'
@@ -22,6 +22,16 @@ export const CarouselFilePreview = ({ item }: { item: AssetInfo }) => {
)
}
const isAudio =
item.preview?.mediaType?.startsWith('audio/') || item.mediaType?.startsWith('audio/')
if (isAudio) {
return (
<div className="w-full h-full flex items-center justify-center bg-muted">
<AudioLines className="w-5 h-5 text-muted-foreground" />
</div>
)
}
return (
<div className="w-full h-full flex items-center justify-center bg-muted">
<File className="w-5 h-5 text-muted-foreground" />
@@ -15,6 +15,8 @@ import { ChatInput } from './chat/message-input'
import FieldRenderer from './field-renderer'
import { GuestIdentityPopup } from './guest-identity-popup'
import { ScrollArea } from './ui/scroll-area'
import { m } from '@/ui/paraglide/messages.js'
import { getViewerForFile } from '@/ui/components/viewers/registry'
interface FileViewerRightSidebarProps {
teamId: string
@@ -88,7 +90,8 @@ export function FileViewerRightSidebar({
enabled: !!projectId && !readOnly,
})
const isAiEnabled = file?.mediaType?.startsWith('image/') || file?.mediaType?.startsWith('video/')
const viewerDef = getViewerForFile(file)
const isAiEnabled = !!viewerDef?.commentsConfig?.hasAiBots
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const enabledBots = isAiEnabled ? (bots as any[]) || [] : []
@@ -302,10 +305,8 @@ export function FileViewerRightSidebar({
return (
<div className="flex h-full items-center justify-center p-8 text-center bg-background">
<div className="space-y-2">
<p className="text-sm font-medium text-foreground">No item selected</p>
<p className="text-xs text-muted-foreground">
Select a file to view its details and comments.
</p>
<p className="text-sm font-medium text-foreground">{m.no_item_selected()}</p>
<p className="text-xs text-muted-foreground">{m.select_file_to_view_details()}</p>
</div>
</div>
)
@@ -336,10 +337,10 @@ export function FileViewerRightSidebar({
<Tabs defaultValue="comments" className="p-1 flex-1 flex flex-col px-2 min-h-0">
<TabsList className="w-full shrink-0">
<TabsTrigger value="comments" className="flex-1">
Comments
{m.comments()}
</TabsTrigger>
<TabsTrigger value="fields" className="flex-1">
Fields
{m.fields()}
</TabsTrigger>
</TabsList>
<TabsContent value="comments" className="flex-1 flex flex-col overflow-hidden min-h-0 mt-0">
@@ -355,12 +356,12 @@ export function FileViewerRightSidebar({
onViewAttachment={setViewingAttachment}
hasReplies={!!comment.replies?.length}
frameRate={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.frameRate || 30
: undefined
}
startTimecode={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.startTimecode
: undefined
}
@@ -381,12 +382,12 @@ export function FileViewerRightSidebar({
hasReplies={false}
isLastReply={index === (comment.replies?.length ?? 0) - 1}
frameRate={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.frameRate || 30
: undefined
}
startTimecode={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.startTimecode
: undefined
}
@@ -417,14 +418,14 @@ export function FileViewerRightSidebar({
bots={enabledBots}
hideAnnotationControl={hideAnnotationControl}
disableMentions={isPublic}
currentTime={file?.mediaType?.startsWith('video/') ? currentTime : undefined}
currentTime={viewerDef?.commentsConfig?.hasTimestamp ? currentTime : undefined}
frameRate={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.frameRate || 30
: undefined
}
startTimecode={
file?.mediaType?.startsWith('video/')
viewerDef?.commentsConfig?.hasTimestamp
? file?.media?.metadata?.startTimecode
: undefined
}
+22 -289
View File
@@ -1,33 +1,14 @@
import { useScreenSize } from '@/ui/hooks/useScreenSize'
import { client } from '@/ui/api/client'
import { getBestTranscode } from '@/ui/lib/media'
import type { AssetInfo } from '@shumai/dtos'
import { Download } from 'lucide-react'
import type { ReactNode, RefObject } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import type Player from 'video.js/dist/types/player'
import DrawingCanvas from './drawing-canvas'
import VideoPlayer from './viewers/video-player'
import { ImageControlBar } from './viewers/image-control-bar'
import { getViewerForFile } from './viewers/registry'
import type { FileViewerProps, MediaController } from './viewers/types'
import React, { RefObject } from 'react'
import { useAnnotationStore } from '@/ui/stores/annotation-store'
import type { Annotation } from '@/ui/types'
type FileViewerProps = {
file: AssetInfo
videoRef?: RefObject<Player | null>
onPlay?: () => void
onPause?: () => void
onTimeUpdate?: (time: number) => void
annotations?: Annotation[]
startTime?: number
shareId?: string
children?: ReactNode
interface OuterFileViewerProps extends FileViewerProps {
mediaControllerRef?: RefObject<MediaController | null>
}
export function FileViewer({
file,
videoRef,
mediaControllerRef,
onPlay,
onPause,
onTimeUpdate,
@@ -35,271 +16,23 @@ export function FileViewer({
startTime,
shareId,
children,
}: FileViewerProps) {
const { width: screenWidth } = useScreenSize()
const isImage = file.mediaType?.startsWith('image/')
const isVideo = file.mediaType?.startsWith('video/')
// Annotation Store
const {
isDrawing,
currentTool,
currentColor,
addAnnotation,
annotations: draftAnnotations,
reset: resetAnnotations,
} = useAnnotationStore()
// Reset annotations when file changes
useEffect(() => {
resetAnnotations()
}, [file.id, resetAnnotations])
// State for Image Viewer
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })
const [zoom, setZoom] = useState(1)
const [pan, setPan] = useState({ x: 0, y: 0 })
const [copied, setCopied] = useState(false)
const observerRef = useRef<ResizeObserver | null>(null)
const containerRef = useCallback((node: HTMLDivElement | null) => {
if (observerRef.current) {
observerRef.current.disconnect()
observerRef.current = null
}
if (node !== null) {
const observer = new ResizeObserver((entries) => {
const entry = entries[0]
if (entry) {
setContainerSize({
width: entry.contentRect.width,
height: entry.contentRect.height,
})
}
})
observer.observe(node)
observerRef.current = observer
}
}, [])
const imgW = file.media?.metadata?.originalWidth ?? 1920
const imgH = file.media?.metadata?.originalHeight ?? 1080
const conW = containerSize.width
const conH = containerSize.height
let baseScale = 1
if (conW > 0 && conH > 0) {
baseScale = Math.min(conW / imgW, conH / imgH)
}
// Reset/Fit logic
useEffect(() => {
if (conW > 0 && conH > 0 && isImage) {
setZoom(baseScale)
// Center
const x = (conW - imgW * baseScale) / 2
const y = (conH - imgH * baseScale) / 2
setPan({ x, y })
}
}, [file.id, conW, conH, isImage, baseScale, imgW, imgH])
const handleZoom = (factor: number) => {
const cx = conW / 2
const cy = conH / 2
// Limit min/max zoom if needed?
const newZoom = zoom * factor
if (newZoom < 0.01 || newZoom > 50) return
const newPanX = cx - (cx - pan.x) * (newZoom / zoom)
const newPanY = cy - (cy - pan.y) * (newZoom / zoom)
setZoom(newZoom)
setPan({ x: newPanX, y: newPanY })
}
const handleFit = () => {
setZoom(baseScale)
const x = (conW - imgW * baseScale) / 2
const y = (conH - imgH * baseScale) / 2
setPan({ x, y })
}
let bestUrl = file.media?.original?.downloadUrl
if (isImage) {
const bestTranscode = getBestTranscode(file.media?.imageTranscodes, screenWidth)
if (bestTranscode?.url) {
bestUrl = bestTranscode.url
}
}
const handleDownload = async () => {
const key = file.media?.original?.key
if (!key || !file.id) return
try {
const res = shareId
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
param: { shareId, fileId: file.id },
json: { key },
})
: await client.api.files['download-url'].$post({
json: { key, assetId: file.id },
})
if (!res.ok) return
const { url } = await res.json()
const link = document.createElement('a')
link.href = url
link.download = ''
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch {
// silently fail
}
}
const handleCopy = async () => {
const webpUrl = bestUrl
if (!webpUrl) return
try {
// To support Safari and iOS, we must invoke navigator.clipboard.write
// synchronously inside the click handler. We can pass a promise to ClipboardItem
// which resolves to the Blob asynchronously.
const copyPromise = (async () => {
const response = await fetch(webpUrl)
const blob = await response.blob()
const img = new Image()
img.crossOrigin = 'anonymous'
const objectUrl = URL.createObjectURL(blob)
img.src = objectUrl
try {
await new Promise((resolve, reject) => {
img.onload = resolve
img.onerror = (e) => reject(new Error('Failed to load image: ' + String(e)))
})
const canvas = document.createElement('canvas')
canvas.width = img.width
canvas.height = img.height
const ctx = canvas.getContext('2d')
if (!ctx) throw new Error('Could not get canvas context')
ctx.drawImage(img, 0, 0)
const pngBlob = await new Promise<Blob | null>((resolve) => {
canvas.toBlob(resolve, 'image/png')
})
if (!pngBlob) throw new Error('Failed to convert image to PNG')
return pngBlob
} finally {
URL.revokeObjectURL(objectUrl)
}
})()
await navigator.clipboard.write([
new ClipboardItem({
'image/png': copyPromise,
}),
])
setCopied(true)
setTimeout(() => setCopied(false), 2000)
} catch (err) {
console.error('Failed to copy image to clipboard:', err)
}
}
const isUnsupported = !bestUrl || (!isImage && !isVideo)
if (isUnsupported) {
return (
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div className="flex-1 flex items-center justify-center">
<p className="text-muted-foreground">Preview unavailable</p>
</div>
</div>
<div className="relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200">
<button
onClick={handleDownload}
disabled={!file.media?.original?.key}
className="flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200"
title="Download original file"
>
<Download size={14} />
Download
</button>
</div>
</div>
)
}
// Combine saved annotations and draft annotations
const displayAnnotations = [...(annotations || []), ...draftAnnotations]
}: OuterFileViewerProps) {
const viewerDef = getViewerForFile(file)
const ViewerComponent = viewerDef.viewer
return (
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
{isImage && (
<>
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div ref={containerRef} className="flex-1 relative overflow-hidden">
<DrawingCanvas
width={conW}
height={conH}
mediaDimensions={{
width: imgW,
height: imgH,
}}
imageUrl={bestUrl}
annotations={displayAnnotations}
scale={zoom}
offset={pan}
onPan={setPan}
className="absolute inset-0 z-0"
// Drawing Props
isDrawing={isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={addAnnotation}
/>
</div>
</div>
{/* Zoom Toolbar */}
<ImageControlBar
zoom={zoom}
onZoomIn={() => handleZoom(1.2)}
onZoomOut={() => handleZoom(0.8)}
onFit={handleFit}
onDownload={handleDownload}
canDownload={!!file.media?.original?.key}
onCopy={handleCopy}
copied={copied}
canCopy={!!bestUrl}
/>
</>
)}
{isVideo && (
<VideoPlayer
key={file.id}
data={file}
playerRef={videoRef}
onPlay={onPlay}
onPause={onPause}
onTimeUpdate={onTimeUpdate}
annotations={displayAnnotations}
startTime={startTime}
shareId={shareId}
>
{children}
</VideoPlayer>
)}
</div>
<ViewerComponent
key={file.id}
ref={mediaControllerRef}
file={file}
onPlay={onPlay}
onPause={onPause}
onTimeUpdate={onTimeUpdate}
annotations={annotations}
startTime={startTime}
shareId={shareId}
>
{children}
</ViewerComponent>
)
}
@@ -7,6 +7,7 @@ import { Input } from '@/ui/components/ui/input'
import { Label } from '@/ui/components/ui/label'
import { client } from '@/ui/api/client'
import { Loader2 } from 'lucide-react'
import { m } from '@/ui/paraglide/messages.js'
interface GuestIdentityPopupProps {
isOpen: boolean
@@ -58,31 +59,29 @@ export function GuestIdentityPopup({
<PopoverContent className="w-80" align="end" side="top">
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<h4 className="font-medium leading-none">Enter your details</h4>
<p className="text-sm text-muted-foreground">
Please provide your name and email to add a comment.
</p>
<h4 className="font-medium leading-none">{m.enter_your_details()}</h4>
<p className="text-sm text-muted-foreground">{m.provide_name_email_for_comment()}</p>
</div>
<div className="grid gap-2">
<div className="grid gap-1">
<Label htmlFor="name">Name</Label>
<Label htmlFor="name">{m.name()}</Label>
<Input
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="John Doe"
placeholder={m.name_placeholder()}
size={32}
required
/>
</div>
<div className="grid gap-1">
<Label htmlFor="email">Email</Label>
<Label htmlFor="email">{m.email()}</Label>
<Input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="john@example.com"
placeholder={m.email_field_placeholder()}
required
/>
</div>
@@ -90,11 +89,11 @@ export function GuestIdentityPopup({
</div>
<div className="flex justify-end gap-2">
<Button type="button" variant="outline" size="sm" onClick={onClose}>
Cancel
{m.cancel()}
</Button>
<Button type="submit" size="sm" disabled={isLoading}>
{isLoading && <Loader2 className="mr-2 h-3 w-3 animate-spin" />}
Confirm
{m.confirm()}
</Button>
</div>
</form>
+52 -29
View File
@@ -22,6 +22,7 @@ import { Input } from '@/ui/components/ui/input'
import { ChevronDown, Copy, Loader2, Trash2 } from 'lucide-react'
import { useState } from 'react'
import { toast } from 'sonner'
import { m } from '@/ui/paraglide/messages.js'
export interface Member {
id?: string
@@ -43,6 +44,7 @@ interface MembersDialogProps {
currentUserId?: string
availableMembersToAdd?: Member[]
onAddMember?: (userId: string, role: 'editor' | 'reviewer') => Promise<void>
type?: 'project' | 'team'
}
export function MembersDialog({
@@ -57,6 +59,7 @@ export function MembersDialog({
currentUserId,
availableMembersToAdd,
onAddMember,
type = 'team',
}: MembersDialogProps) {
const [inviteRole, setInviteRole] = useState<'editor' | 'reviewer'>('editor')
const [inviteLink, setInviteLink] = useState<string | null>(null)
@@ -66,6 +69,20 @@ export function MembersDialog({
const [rolesToAdd, setRolesToAdd] = useState<Record<string, 'editor' | 'reviewer'>>({})
const [addingMemberId, setAddingMemberId] = useState<string | null>(null)
const localizeRole = (role?: string) => {
if (!role) return ''
switch (role.toLowerCase()) {
case 'owner':
return m.owner()
case 'editor':
return m.editor()
case 'reviewer':
return m.reviewer()
default:
return role
}
}
const setRoleToAdd = (memberId: string, role: 'editor' | 'reviewer') => {
setRolesToAdd((prev) => ({ ...prev, [memberId]: role }))
}
@@ -75,10 +92,10 @@ export function MembersDialog({
setUpdatingMemberId(memberId)
try {
await onUpdateRole(memberId, role)
toast.success('Member role updated')
toast.success(m.member_role_updated())
} catch (error) {
console.error(error)
toast.error('Failed to update member role')
toast.error(m.failed_to_update_member_role())
} finally {
setUpdatingMemberId(null)
}
@@ -89,11 +106,11 @@ export function MembersDialog({
setUpdatingMemberId(memberToRemove.id)
try {
await onRemoveMember(memberToRemove.id)
toast.success('Member removed')
toast.success(m.member_removed())
setMemberToRemove(null)
} catch (error) {
console.error(error)
toast.error('Failed to remove member')
toast.error(m.failed_to_remove_member())
} finally {
setUpdatingMemberId(null)
}
@@ -108,7 +125,7 @@ export function MembersDialog({
setInviteLink(url)
} catch (error) {
console.error(error)
toast.error('Failed to generate invite link')
toast.error(m.failed_to_generate_invite_link())
} finally {
setIsGenerating(false)
}
@@ -117,7 +134,7 @@ export function MembersDialog({
const copyToClipboard = () => {
if (inviteLink) {
navigator.clipboard.writeText(inviteLink)
toast.success('Invite link copied to clipboard')
toast.success(m.invite_link_copied())
}
}
@@ -169,13 +186,13 @@ export function MembersDialog({
<span className="text-sm font-medium">{member.name}</span>
<div className="flex items-center gap-2">
<span className="text-xs text-muted-foreground capitalize">
{member.role}
{localizeRole(member.role)}
</span>
{member.scope && (
<>
<span className="text-[10px] text-muted-foreground/70">•</span>
<span className="text-xs text-muted-foreground capitalize">
{member.scope === 'team' ? 'Team Member' : 'Project Member'}
{member.scope === 'team' ? m.team_member() : m.project_member()}
</span>
</>
)}
@@ -193,7 +210,7 @@ export function MembersDialog({
className="h-8 px-2 text-xs capitalize w-26"
disabled={updatingMemberId === member.id}
>
{member.role}
{localizeRole(member.role)}
<ChevronDown className="ml-1 h-3 w-3 opacity-50" />
</Button>
</DropdownMenuTrigger>
@@ -205,10 +222,10 @@ export function MembersDialog({
}
>
<DropdownMenuRadioItem value="editor" className="text-xs">
Editor
{m.editor()}
</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="reviewer" className="text-xs">
Reviewer
{m.reviewer()}
</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
@@ -237,26 +254,28 @@ export function MembersDialog({
>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Remove Member</AlertDialogTitle>
<AlertDialogTitle>{m.remove_member()}</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to remove <strong>{memberToRemove?.name}</strong> from this{' '}
{title.toLowerCase()}? This action cannot be undone.
{m.remove_member_confirmation({
name: memberToRemove?.name || '',
type: type === 'project' ? m.project() : m.team(),
})}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogCancel>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
onClick={handleRemoveMember}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
Remove
{m.remove()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>{' '}
{isOwner && onAddMember && availableMembersToAdd && availableMembersToAdd.length > 0 && (
<div className="border-t pt-4">
<h4 className="text-sm font-medium mb-3">Add Team Member to Project</h4>
<h4 className="text-sm font-medium mb-3">{m.add_team_member_to_project()}</h4>
<div className="max-h-[200px] overflow-y-auto space-y-2 pr-1">
{availableMembersToAdd.map((member) => {
const currentRole = rolesToAdd[member.id!] || 'editor'
@@ -279,7 +298,7 @@ export function MembersDialog({
<div className="flex flex-col">
<span className="text-sm font-medium">{member.name}</span>
<span className="text-xs text-muted-foreground capitalize">
{member.scope === 'team' ? 'Team Member' : 'Project Member'}
{member.scope === 'team' ? m.team_member() : m.project_member()}
</span>
</div>
</div>
@@ -293,7 +312,7 @@ export function MembersDialog({
className="h-8 px-2 text-xs capitalize w-26"
disabled={addingMemberId === member.id}
>
{currentRole}
{localizeRole(currentRole)}
<ChevronDown className="ml-1 h-3 w-3 opacity-50" />
</Button>
</DropdownMenuTrigger>
@@ -305,10 +324,10 @@ export function MembersDialog({
}
>
<DropdownMenuRadioItem value="editor" className="text-xs">
Editor
{m.editor()}
</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="reviewer" className="text-xs">
Reviewer
{m.reviewer()}
</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
@@ -319,10 +338,12 @@ export function MembersDialog({
setAddingMemberId(member.id!)
try {
await onAddMember(member.id!, currentRole)
toast.success(`Added ${member.name} successfully`)
toast.success(
m.added_member_successfully({ name: member.name || '' }),
)
} catch (error) {
console.error(error)
toast.error(`Failed to add ${member.name}`)
toast.error(m.failed_to_add_member({ name: member.name || '' }))
} finally {
setAddingMemberId(null)
}
@@ -334,7 +355,7 @@ export function MembersDialog({
{addingMemberId === member.id ? (
<Loader2 className="h-3 w-3 animate-spin" />
) : (
'Add'
m.add()
)}
</Button>
</div>
@@ -346,13 +367,13 @@ export function MembersDialog({
)}
{isOwner && onInvite && (
<div className="border-t pt-4">
<h4 className="text-sm font-medium mb-3">Invite New Member</h4>
<h4 className="text-sm font-medium mb-3">{m.invite_new_member()}</h4>
<div className="space-y-3">
<div className="flex gap-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" className="w-[120px] justify-between">
{inviteRole === 'editor' ? 'Editor' : 'Reviewer'}
{inviteRole === 'editor' ? m.editor() : m.reviewer()}
<ChevronDown className="h-4 w-4 opacity-50" />
</Button>
</DropdownMenuTrigger>
@@ -361,14 +382,16 @@ export function MembersDialog({
value={inviteRole}
onValueChange={(v) => setInviteRole(v as 'editor' | 'reviewer')}
>
<DropdownMenuRadioItem value="editor">Editor</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="reviewer">Reviewer</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="editor">{m.editor()}</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="reviewer">
{m.reviewer()}
</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
<Button onClick={handleGenerate} disabled={isGenerating} className="flex-1">
{isGenerating && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
Generate Link
{m.generate_link()}
</Button>
</div>
+60 -46
View File
@@ -2,78 +2,92 @@ import type { NotificationInfo } from '@shumai/dtos'
import { formatTimeAgo } from '@/ui/lib/time'
import { cn } from '@/ui/lib/utils'
import { SpriteScrubber } from './sprite-scrubber'
import { m } from '@/ui/paraglide/messages.js'
import React from 'react'
interface NotificationCardProps {
notification: NotificationInfo
}
const renderNotification = (
messageTemplate: string,
placeholders: Record<string, React.ReactNode>,
) => {
const regex = new RegExp(
`(${Object.keys(placeholders)
.map((k) => `\\{${k}\\}`)
.join('|')})`,
'g',
)
return (
<span>
{messageTemplate.split(regex).map((part, index) => {
const match = part.match(/^\{(.+)\}$/)
if (match && placeholders[match[1]]) {
return <React.Fragment key={index}>{placeholders[match[1]]}</React.Fragment>
}
return part
})}
</span>
)
}
export const NotificationCard = ({ notification }: NotificationCardProps) => {
const { creator, createdAt, isRead, type, asset, project, team, user } = notification
const message = (() => {
const creatorName = creator?.name || 'Unknown User'
const assetName = asset?.name || 'unknown asset'
const projectName = project?.name || 'unknown project'
const teamName = team?.name || 'unknown team'
const targetUserName = user?.name || 'unknown user'
const creatorName = creator?.name || m.unknown_user()
const assetName = asset?.name || m.unknown_asset()
const projectName = project?.name || m.unknown_project()
const teamName = team?.name || m.unknown_team()
const targetUserName = user?.name || m.unknown_user()
const placeholders = {
creator: <span className="font-semibold">{creatorName}</span>,
asset: <span className="font-semibold">{assetName}</span>,
project: <span className="font-semibold">{projectName}</span>,
team: <span className="font-semibold">{teamName}</span>,
user: <span className="font-semibold">{targetUserName}</span>,
}
switch (type) {
case 'comment_created':
return (
<span>
<span className="font-semibold">{creatorName}</span> commented on{' '}
<span className="font-semibold">{assetName}</span>
</span>
return renderNotification(
m.notification_commented_on({ creator: '{creator}', asset: '{asset}' }),
placeholders,
)
case 'reply_created':
return (
<span>
<span className="font-semibold">{creatorName}</span> replied to a comment on{' '}
<span className="font-semibold">{assetName}</span>
</span>
return renderNotification(
m.notification_replied_to({ creator: '{creator}', asset: '{asset}' }),
placeholders,
)
case 'mention':
return (
<span>
<span className="font-semibold">{creatorName}</span> mentioned you in{' '}
<span className="font-semibold">{assetName}</span>
</span>
return renderNotification(
m.notification_mentioned_you({ creator: '{creator}', asset: '{asset}' }),
placeholders,
)
case 'successful_file_uploaded':
return (
<span>
<span className="font-semibold">{creatorName}</span> uploaded{' '}
<span className="font-semibold">{assetName}</span> to{' '}
<span className="font-semibold">{projectName}</span>
</span>
return renderNotification(
m.notification_uploaded({ creator: '{creator}', asset: '{asset}', project: '{project}' }),
placeholders,
)
case 'metadata_field_updated_status':
return (
<span>
<span className="font-semibold">{creatorName}</span> updated status of{' '}
<span className="font-semibold">{assetName}</span>
</span>
return renderNotification(
m.notification_status_updated({ creator: '{creator}', asset: '{asset}' }),
placeholders,
)
case 'new_user_join_team':
return (
<span>
<span className="font-semibold">{targetUserName}</span> joined{' '}
<span className="font-semibold">{teamName}</span>
</span>
return renderNotification(
m.notification_joined_team({ user: '{user}', team: '{team}' }),
placeholders,
)
case 'new_user_join_project':
return (
<span>
<span className="font-semibold">{targetUserName}</span> joined{' '}
<span className="font-semibold">{projectName}</span>
</span>
return renderNotification(
m.notification_joined_project({ user: '{user}', project: '{project}' }),
placeholders,
)
default:
return (
<span>
New notification from <span className="font-semibold">{creatorName}</span>
</span>
)
return renderNotification(m.notification_generic({ creator: '{creator}' }), placeholders)
}
})()
@@ -3,6 +3,7 @@ import { NotificationCard } from '@/ui/components/notification-card'
import { Button } from '@/ui/components/ui/button'
import { Tabs, TabsList, TabsTrigger } from '@/ui/components/ui/tabs'
import { useTeamContextStore } from '@/ui/stores/team-context'
import { m } from '@/ui/paraglide/messages.js'
import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { CheckCheckIcon, Loader2 } from 'lucide-react'
import { useEffect, useMemo, useState } from 'react'
@@ -126,10 +127,10 @@ export const NotificationList = () => {
<div className="flex items-center justify-between mb-2">
<TabsList className="h-8">
<TabsTrigger value="all" className="text-xs px-3 h-6">
All
{m.all()}
</TabsTrigger>
<TabsTrigger value="unread" className="text-xs px-3 h-6">
Unread
{m.unread()}
</TabsTrigger>
</TabsList>
@@ -139,7 +140,7 @@ export const NotificationList = () => {
className="h-8 px-2 text-muted-foreground hover:text-foreground"
onClick={handleMarkAllRead}
disabled={notifications.length === 0 || markReadMutation.isPending}
title="Mark all as read"
title={m.mark_all_as_read()}
>
<CheckCheckIcon className="w-4 h-4" />
</Button>
@@ -156,7 +157,7 @@ export const NotificationList = () => {
{!isLoading && notifications.length === 0 && (
<div className="flex flex-col items-center justify-center h-40 text-muted-foreground">
<p className="text-sm">No notifications</p>
<p className="text-sm">{m.no_notifications()}</p>
</div>
)}
@@ -18,7 +18,7 @@ import { FieldInfo } from '@shumai/dtos'
import { FileViewer } from './file-viewer'
import { CompareViewer } from './compare/compare-viewer'
import { pickDefaultCompareVersions } from './compare/compare-utils'
import type Player from 'video.js/dist/types/player'
import type { MediaController } from './viewers/types'
import type { Annotation } from '@/ui/types'
import { useNavigate } from '@tanstack/react-router'
@@ -141,7 +141,7 @@ export function PublicShareManager({
const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set())
const [rightSidebarWidth, setRightSidebarWidth] = useState(360)
const [isRightSidebarCollapsed, setIsRightSidebarCollapsed] = useState(() => !initialFileId)
const videoRef = useRef<Player | null>(null)
const mediaControllerRef = useRef<MediaController | null>(null)
const [annotations, setAnnotations] = useState<Annotation[]>([])
const [currentTime, setCurrentTime] = useState(0)
const [selectedCommentId, setSelectedCommentId] = useState<string | null>(null)
@@ -359,14 +359,10 @@ export function PublicShareManager({
}
if (comment.second !== null && comment.second !== undefined) {
if (videoRef.current) {
videoRef.current.currentTime(comment.second)
videoRef.current.pause()
}
mediaControllerRef.current?.seekTo(comment.second)
mediaControllerRef.current?.pause()
} else if (newAnnotations && newAnnotations.length > 0) {
if (videoRef.current) {
videoRef.current.pause()
}
mediaControllerRef.current?.pause()
}
}
@@ -416,6 +412,7 @@ export function PublicShareManager({
? (stackFileData.versionStack.versions.find((v) => v.id === activeFileId)?.version ??
stackFileData.versionStack.versions.length)
: undefined,
mediaType: viewingFileData?.mediaType || null,
},
isRootFolder: currentFolderId === shareInfo.rootFolderId && !viewingFileId,
isPublic: true,
@@ -580,7 +577,7 @@ export function PublicShareManager({
viewingFileData && (
<FileViewer
file={viewingFileData}
videoRef={videoRef}
mediaControllerRef={mediaControllerRef}
onPlay={handlePlay}
onTimeUpdate={setCurrentTime}
annotations={annotations}
@@ -647,11 +644,13 @@ export function PublicShareManager({
shareId={shareId}
currentTime={currentTime}
onTyping={() => {
if (videoRef.current) {
videoRef.current.pause()
}
mediaControllerRef.current?.pause()
}}
selectedCommentId={selectedCommentId}
hideAnnotationControl={(isCompareMode
? compareActiveAsset
: currentSelectedItem
)?.mediaType?.startsWith('audio/')}
/>
</div>
</>
+16 -15
View File
@@ -9,19 +9,20 @@ import { useInView } from 'react-intersection-observer'
import { format, parseISO, isToday, isYesterday } from 'date-fns'
import { Progress } from '@/ui/components/ui/progress'
import { formatTimeAgo } from '@/ui/lib/time'
import { m } from '@/ui/paraglide/messages.js'
function formatDayHeader(dateString: string): string {
const date = parseISO(dateString)
if (isNaN(date.getTime())) {
return 'Unknown Date'
return m.unknown_date()
}
if (isToday(date)) {
return 'Today'
return m.today()
}
if (isYesterday(date)) {
return 'Yesterday'
return m.yesterday()
}
return format(date, 'MMMM d, yyyy')
return format(date, m.date_format_long())
}
function formatBytes(bytes: number): string {
@@ -51,7 +52,7 @@ function UploadTaskItem({ task }: { task: TaskInfo }) {
try {
formattedTime = formatTimeAgo(task.createdAt)
} catch {
formattedTime = 'unknown'
formattedTime = m.unknown()
}
return (
@@ -63,19 +64,19 @@ function UploadTaskItem({ task }: { task: TaskInfo }) {
className="text-sm font-semibold tracking-tight text-sidebar-foreground truncate block"
title={task.name}
>
{task.name || 'Untitled Upload'}
{task.name || m.untitled_upload()}
</span>
</div>
<div className="flex-shrink-0">
{isCompleted ? (
<span className="inline-flex items-center gap-1 text-xs font-semibold text-muted-foreground bg-muted px-2 py-0.5 rounded-full transition-colors">
<CheckCircle2 className="w-3.5 h-3.5" />
Done
{m.done()}
</span>
) : (
<span className="inline-flex items-center gap-1 text-xs font-semibold text-sidebar-primary bg-sidebar-primary/10 px-2 py-0.5 rounded-full animate-pulse">
<Loader2 className="w-3.5 h-3.5 animate-spin" />
Uploading
{m.uploading_status()}
</span>
)}
</div>
@@ -92,8 +93,8 @@ function UploadTaskItem({ task }: { task: TaskInfo }) {
<div className="flex items-center justify-between text-xs font-semibold">
<span className="text-muted-foreground/80">
{clientProgress
? `${formatBytes(clientProgress.loaded)} / ${formatBytes(clientProgress.total)} (${task.uploaded} / ${task.total} ${task.total === 1 ? 'file' : 'files'})`
: `${task.uploaded} / ${task.total} ${task.total === 1 ? 'file' : 'files'}`}
? `${formatBytes(clientProgress.loaded)} / ${formatBytes(clientProgress.total)} (${m.files_progress({ uploaded: task.uploaded, total: task.total })})`
: m.files_progress({ uploaded: task.uploaded, total: task.total })}
</span>
{!isCompleted && (
<span className="text-sidebar-primary font-mono font-bold">{Math.round(percent)}%</span>
@@ -181,10 +182,8 @@ export function UploadTasks() {
return (
<div className="flex flex-col items-center justify-center p-8 text-center border border-dashed border-border rounded-xl bg-muted/10 my-4">
<UploadCloud className="h-8 w-8 text-muted-foreground/50 mb-3" />
<p className="text-sm font-semibold text-muted-foreground">No uploads yet</p>
<p className="text-xs text-muted-foreground/60 mt-1 max-w-[180px]">
Upload files in the project view to track progress here.
</p>
<p className="text-sm font-semibold text-muted-foreground">{m.no_uploads_yet()}</p>
<p className="text-xs text-muted-foreground/60 mt-1 max-w-[180px]">{m.no_uploads_hint()}</p>
</div>
)
}
@@ -211,7 +210,9 @@ export function UploadTasks() {
{group.day}
</span>
<span className="text-[10px] font-semibold text-muted-foreground/60 bg-muted px-2 py-0.5 rounded-full">
{group.tasks.length} {group.tasks.length === 1 ? 'task' : 'tasks'}
{group.tasks.length === 1
? m.n_tasks_singular({ count: group.tasks.length })
: m.n_tasks_plural({ count: group.tasks.length })}
</span>
</div>
{/* Tasks in Day */}
+17 -1
View File
@@ -44,6 +44,20 @@ export function UserMenu() {
const { clearAuth } = useAuthStore()
const teamId = useTeamId()
const localizeRole = (role?: string) => {
if (!role) return ''
switch (role.toLowerCase()) {
case 'owner':
return m.owner()
case 'editor':
return m.editor()
case 'reviewer':
return m.reviewer()
default:
return role
}
}
const { data: me } = useQuery({
queryKey: ['teams', teamId, 'me'],
queryFn: async () => {
@@ -95,7 +109,9 @@ export function UserMenu() {
<DropdownMenuLabel className="font-normal">
<div className="flex flex-col space-y-1">
<p className="text-sm font-medium leading-none">{me.name}</p>
<p className="text-xs leading-none text-muted-foreground">{me.role}</p>
<p className="text-xs leading-none text-muted-foreground">
{localizeRole(me.role)}
</p>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
@@ -0,0 +1,64 @@
import { client } from '@/ui/api/client'
import { Download } from 'lucide-react'
import React, { useImperativeHandle } from 'react'
import { FileViewerProps, MediaController } from '../types'
export const DefaultViewer = React.forwardRef<MediaController, FileViewerProps>(
({ file, shareId, children }, ref) => {
// Implement no-op media controller
useImperativeHandle(ref, () => ({
play: () => {},
pause: () => {},
seekTo: () => {},
}))
const handleDownload = async () => {
const key = file.media?.original?.key
if (!key || !file.id) return
try {
const res = shareId
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
param: { shareId, fileId: file.id },
json: { key },
})
: await client.api.files['download-url'].$post({
json: { key, assetId: file.id },
})
if (!res.ok) return
const { url } = await res.json()
const link = document.createElement('a')
link.href = url
link.download = ''
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch {
// silently fail
}
}
return (
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div className="flex-1 flex items-center justify-center">
<p className="text-muted-foreground">Preview unavailable</p>
</div>
</div>
<div className="relative px-4 py-3 bg-card border-t border-gray-200 dark:border-gray-700 z-10 flex items-center justify-end gap-2 transition-colors duration-200">
<button
onClick={handleDownload}
disabled={!file.media?.original?.key}
className="flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200"
title="Download original file"
>
<Download size={14} />
Download
</button>
</div>
</div>
)
},
)
export default DefaultViewer
@@ -0,0 +1,14 @@
import { FileTypeDefinition } from '../types'
import DefaultViewer from './default-viewer'
export const defaultTypeDefinition: FileTypeDefinition = {
id: 'default',
name: 'Default',
match: () => true,
viewer: DefaultViewer,
commentsConfig: {
hasTimestamp: false,
hasAnnotations: false,
hasAiBots: false,
},
}
@@ -6,7 +6,7 @@ import { useAnnotationStore } from '@/ui/stores/annotation-store'
import type { Annotation } from '@/ui/types'
import type { AssetInfo } from '@shumai/dtos'
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react'
import type { ComparePaneHandle, PaneReportedState } from './types'
import type { ComparePaneHandle, PaneReportedState } from '../../compare/types'
interface CompareImagePaneProps {
file: AssetInfo
@@ -1,4 +1,5 @@
import { Check, Copy, Download, Maximize, Minimize, Minus, Plus } from 'lucide-react'
import { m } from '@/ui/paraglide/messages.js'
export interface ImageControlBarProps {
zoom: number
@@ -32,7 +33,7 @@ export function ImageControlBar({
<button
onClick={onZoomOut}
className="p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors"
title="Zoom Out"
title={m.zoom_out()}
>
<Minus size={16} />
</button>
@@ -42,7 +43,7 @@ export function ImageControlBar({
<button
onClick={onZoomIn}
className="p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors"
title="Zoom In"
title={m.zoom_in()}
>
<Plus size={16} />
</button>
@@ -51,33 +52,33 @@ export function ImageControlBar({
onClick={onFit}
className="text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent animate-in fade-in zoom-in-95 duration-200"
>
Fit
{m.fit()}
</button>
{onCopy && (
<button
onClick={onCopy}
disabled={!canCopy}
className="flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200"
title="Copy optimized image to clipboard"
title={m.copy_image_to_clipboard()}
>
{copied ? <Check size={14} className="text-green-500" /> : <Copy size={14} />}
{copied ? 'Copied' : 'Copy'}
{copied ? m.copied() : m.copy()}
</button>
)}
<button
onClick={onDownload}
disabled={!canDownload}
className="flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded bg-gray-200/50 dark:bg-white/10 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors border border-transparent disabled:opacity-50 animate-in fade-in zoom-in-95 duration-200"
title="Download original image"
title={m.download_original_image()}
>
<Download size={14} />
Download
{m.download()}
</button>
{fullscreen && (
<button
onClick={fullscreen.onToggle}
className="p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 transition-colors"
title="Fullscreen"
title={m.fullscreen()}
>
{fullscreen.isFullScreen ? <Minimize size={16} /> : <Maximize size={16} />}
</button>
@@ -0,0 +1,223 @@
import { useScreenSize } from '@/ui/hooks/useScreenSize'
import { client } from '@/ui/api/client'
import { getBestTranscode } from '@/ui/lib/media'
import React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react'
import DrawingCanvas from '@/ui/components/drawing-canvas'
import { ImageControlBar } from './image-control-bar'
import { useAnnotationStore } from '@/ui/stores/annotation-store'
import { FileViewerProps, MediaController } from '../types'
export const ImageViewer = React.forwardRef<MediaController, FileViewerProps>(
({ file, annotations, shareId, children }, ref) => {
// Implement no-op media controller since images are static
useImperativeHandle(ref, () => ({
play: () => {},
pause: () => {},
seekTo: () => {},
}))
const { width: screenWidth } = useScreenSize()
const {
isDrawing,
currentTool,
currentColor,
addAnnotation,
annotations: draftAnnotations,
} = useAnnotationStore()
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })
const [zoom, setZoom] = useState(1)
const [pan, setPan] = useState({ x: 0, y: 0 })
const [copied, setCopied] = useState(false)
const observerRef = useRef<ResizeObserver | null>(null)
const containerRef = useCallback((node: HTMLDivElement | null) => {
if (observerRef.current) {
observerRef.current.disconnect()
observerRef.current = null
}
if (node !== null) {
const observer = new ResizeObserver((entries) => {
const entry = entries[0]
if (entry) {
setContainerSize({
width: entry.contentRect.width,
height: entry.contentRect.height,
})
}
})
observer.observe(node)
observerRef.current = observer
}
}, [])
const imgW = file.media?.metadata?.originalWidth ?? 1920
const imgH = file.media?.metadata?.originalHeight ?? 1080
const conW = containerSize.width
const conH = containerSize.height
let baseScale = 1
if (conW > 0 && conH > 0) {
baseScale = Math.min(conW / imgW, conH / imgH)
}
// Reset/Fit logic
useEffect(() => {
if (conW > 0 && conH > 0) {
setZoom(baseScale)
// Center
const x = (conW - imgW * baseScale) / 2
const y = (conH - imgH * baseScale) / 2
setPan({ x, y })
}
}, [file.id, conW, conH, baseScale, imgW, imgH])
const handleZoom = (factor: number) => {
const cx = conW / 2
const cy = conH / 2
const newZoom = zoom * factor
if (newZoom < 0.01 || newZoom > 50) return
const newPanX = cx - (cx - pan.x) * (newZoom / zoom)
const newPanY = cy - (cy - pan.y) * (newZoom / zoom)
setZoom(newZoom)
setPan({ x: newPanX, y: newPanY })
}
const handleFit = () => {
setZoom(baseScale)
const x = (conW - imgW * baseScale) / 2
const y = (conH - imgH * baseScale) / 2
setPan({ x, y })
}
let bestUrl = file.media?.original?.downloadUrl
const bestTranscode = getBestTranscode(file.media?.imageTranscodes, screenWidth)
if (bestTranscode?.url) {
bestUrl = bestTranscode.url
}
const handleDownload = async () => {
const key = file.media?.original?.key
if (!key || !file.id) return
try {
const res = shareId
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
param: { shareId, fileId: file.id },
json: { key },
})
: await client.api.files['download-url'].$post({
json: { key, assetId: file.id },
})
if (!res.ok) return
const { url } = await res.json()
const link = document.createElement('a')
link.href = url
link.download = ''
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch {
// silently fail
}
}
const handleCopy = async () => {
const webpUrl = bestUrl
if (!webpUrl) return
try {
const copyPromise = (async () => {
const response = await fetch(webpUrl)
const blob = await response.blob()
const img = new Image()
img.crossOrigin = 'anonymous'
const objectUrl = URL.createObjectURL(blob)
img.src = objectUrl
try {
await new Promise((resolve, reject) => {
img.onload = resolve
img.onerror = (e) => reject(new Error('Failed to load image: ' + String(e)))
})
const canvas = document.createElement('canvas')
canvas.width = img.width
canvas.height = img.height
const ctx = canvas.getContext('2d')
if (!ctx) throw new Error('Could not get canvas context')
ctx.drawImage(img, 0, 0)
const pngBlob = await new Promise<Blob | null>((resolve) => {
canvas.toBlob(resolve, 'image/png')
})
if (!pngBlob) throw new Error('Failed to convert image to PNG')
return pngBlob
} finally {
URL.revokeObjectURL(objectUrl)
}
})()
await navigator.clipboard.write([
new ClipboardItem({
'image/png': copyPromise,
}),
])
setCopied(true)
setTimeout(() => setCopied(false), 2000)
} catch (err) {
console.error('Failed to copy image to clipboard:', err)
}
}
const displayAnnotations = [...(annotations || []), ...draftAnnotations]
return (
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div ref={containerRef} className="flex-1 relative overflow-hidden">
<DrawingCanvas
width={conW}
height={conH}
mediaDimensions={{
width: imgW,
height: imgH,
}}
imageUrl={bestUrl}
annotations={displayAnnotations}
scale={zoom}
offset={pan}
onPan={setPan}
className="absolute inset-0 z-0"
isDrawing={isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={addAnnotation}
/>
</div>
</div>
<ImageControlBar
zoom={zoom}
onZoomIn={() => handleZoom(1.2)}
onZoomOut={() => handleZoom(0.8)}
onFit={handleFit}
onDownload={handleDownload}
canDownload={!!file.media?.original?.key}
onCopy={handleCopy}
copied={copied}
canCopy={!!bestUrl}
/>
</div>
)
},
)
export default ImageViewer
@@ -0,0 +1,16 @@
import { FileTypeDefinition } from '../types'
import ImageViewer from './image-viewer'
import { CompareImagePane } from './compare-image-pane'
export const imageTypeDefinition: FileTypeDefinition = {
id: 'image',
name: 'Image',
match: (file) => !!file.mediaType?.startsWith('image/'),
viewer: ImageViewer,
comparePane: CompareImagePane,
commentsConfig: {
hasTimestamp: false,
hasAnnotations: true,
hasAiBots: true,
},
}
@@ -0,0 +1,17 @@
import type { AssetInfo } from '@shumai/dtos'
import { FileTypeDefinition } from './types'
import { videoTypeDefinition } from './video'
import { imageTypeDefinition } from './image'
import { defaultTypeDefinition } from './default'
const registry: FileTypeDefinition[] = [videoTypeDefinition, imageTypeDefinition]
export function getViewerForFile(file: AssetInfo | null | undefined): FileTypeDefinition {
if (!file) return defaultTypeDefinition
const match = registry.find((viewer) => viewer.match(file))
return match || defaultTypeDefinition
}
export function getAllViewers(): FileTypeDefinition[] {
return registry
}
@@ -0,0 +1,53 @@
import type { AssetInfo } from '@shumai/dtos'
import type { Annotation } from '@/ui/types'
import type { ComparePaneHandle, PaneReportedState } from '@/ui/components/compare/types'
import type React from 'react'
export interface MediaController {
play: () => void
pause: () => void
seekTo: (second: number) => void
getCurrentTime?: () => number
getDuration?: () => number
}
export interface FileViewerProps {
file: AssetInfo
annotations?: Annotation[]
onPlay?: () => void
onPause?: () => void
onTimeUpdate?: (time: number) => void
startTime?: number
shareId?: string
children?: React.ReactNode
}
export interface ComparePaneProps {
file: AssetInfo
isActive: boolean
annotations: Annotation[]
onStateChange: (state: PaneReportedState) => void
onActivate: () => void
onUserPan?: (dx: number, dy: number) => void
shareId?: string
muted?: boolean
volume?: number
onPlay?: () => void
onTimeUpdate?: (second: number) => void
onRequestTogglePlay?: () => void
}
export interface FileTypeDefinition {
id: string
name: string
match: (file: AssetInfo) => boolean
viewer: React.ForwardRefExoticComponent<FileViewerProps & React.RefAttributes<MediaController>>
comparePane?: React.ForwardRefExoticComponent<
ComparePaneProps & React.RefAttributes<ComparePaneHandle>
>
commentsConfig?: {
hasTimestamp?: boolean
hasAnnotations?: boolean
hasAiBots?: boolean
}
}
@@ -1,644 +0,0 @@
import type { AssetInfo } from '@shumai/dtos'
import { client } from '@/ui/api/client'
import { cn } from '@/ui/lib/utils'
import { Play } from 'lucide-react'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import videojs from 'video.js'
import type Player from 'video.js/dist/types/player'
import { useFramePlayer } from './use-frame-player'
import { resolveTotalFrames } from './utils'
import { VideoControlBar, type PlayerState, type DisplayTranscode } from './video-control-bar'
import type { Annotation } from '@/ui/types'
import DrawingCanvas from '../drawing-canvas'
import { useAnnotationStore } from '@/ui/stores/annotation-store'
interface VideoPlayerProps {
data: AssetInfo
playerRef?: React.RefObject<Player | null>
onPlay?: () => void
onPause?: () => void
onTimeUpdate?: (time: number) => void
annotations?: Annotation[]
startTime?: number
shareId?: string
children?: React.ReactNode
}
const VideoPlayer: React.FC<VideoPlayerProps> = ({
data,
playerRef: passedPlayerRef,
onPlay,
onPause,
onTimeUpdate,
annotations,
startTime,
shareId,
children,
}) => {
const localPlayerRef = useRef<Player | null>(null)
const playerRef = passedPlayerRef || localPlayerRef
// We use a container ref to manually append the video element
const videoContainerRef = useRef<HTMLDivElement>(null)
const containerRef = useRef<HTMLDivElement>(null)
const rootRef = useRef<HTMLDivElement>(null)
const controlsTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const isOverControlsRef = useRef(false)
const [videoHtmlEl, setVideoHtmlEl] = useState<HTMLVideoElement | undefined>(undefined)
const videoRef = useRef<HTMLVideoElement | null>(null)
const [zoom, setZoom] = useState(1)
const [hasManuallyZoomed, setHasManuallyZoomed] = useState(false)
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })
const handleZoomChange = (newZoom: number) => {
setZoom(newZoom)
setHasManuallyZoomed(true)
}
const handleZoomReset = () => {
setHasManuallyZoomed(false)
}
// Store
const {
isDrawing,
currentTool,
currentColor,
addAnnotation,
annotations: draftAnnotations,
} = useAnnotationStore()
// Combine annotations
const displayAnnotations = [...(annotations || []), ...draftAnnotations]
// Resize Observer for container
useEffect(() => {
if (!containerRef.current) return
const observer = new ResizeObserver((entries) => {
const entry = entries[0]
if (entry) {
setContainerSize({
width: entry.contentRect.width,
height: entry.contentRect.height,
})
}
})
observer.observe(containerRef.current)
return () => observer.disconnect()
}, [])
// Fit to screen initial / responsive resize
useEffect(() => {
if (containerSize.width > 0 && containerSize.height > 0) {
const vidW = data.media?.metadata?.originalWidth ?? 1920
const vidH = data.media?.metadata?.originalHeight ?? 1080
const scale = Math.min(containerSize.width / vidW, containerSize.height / vidH)
if (!hasManuallyZoomed) {
setZoom(scale)
}
}
}, [containerSize.width, containerSize.height, data.media?.metadata, hasManuallyZoomed])
// Cleanup ref when player is disposed
useEffect(() => {
return () => {
videoRef.current = null
}
}, [])
if (!data.media?.original?.downloadUrl || !data.media.metadata) {
return (
<div className="flex h-full w-full items-center justify-center">
<p className="text-muted-foreground">Media is not available.</p>
</div>
)
}
// Initial resolution setup
const originalRes: DisplayTranscode = {
id: 'original',
url: data.media.original.downloadUrl,
key: data.media.original.key ?? '',
width: data.media.metadata.originalWidth ?? 0,
height: data.media.metadata.originalHeight ?? 0,
size: 0,
isRaw: true,
resolution: 'Original',
}
const resolutions: DisplayTranscode[] = (data.media.videoTranscodes ?? []).map((t) => {
const longSide = Math.max(t.width, t.height)
let resolution = `${t.height}p`
if (longSide >= 3840) resolution = '2160p'
else if (longSide >= 1920) resolution = '1080p'
else if (longSide >= 1280) resolution = '720p'
else if (longSide >= 960) resolution = '540p'
else if (longSide >= 640) resolution = '360p'
else if (longSide >= 320) resolution = '180p'
return {
...t,
resolution: t.isRaw ? 'Original' : resolution,
}
})
const previewResolutions = resolutions.filter((r) => !r.isRaw)
// Logic to select best resolution based on screen size
const getInitialResolution = (): DisplayTranscode => {
if (previewResolutions.length === 0) return originalRes
if (typeof window === 'undefined') return previewResolutions[0]
// Use device pixel ratio for high DPI screens
const screenWidth = window.innerWidth * (window.devicePixelRatio || 1)
// 1. Sort by width ascending
const sortedResolutions = [...previewResolutions].sort((a, b) => {
const wA = a.width ?? 0
const wB = b.width ?? 0
return wA - wB
})
// 2. Find first one >= screenWidth
const bestFit = sortedResolutions.find((r) => (r.width ?? 0) >= screenWidth)
// 3. If found, return it. If not (all are smaller), return the last one (largest).
return bestFit || sortedResolutions[sortedResolutions.length - 1]
}
const initialRes = getInitialResolution()
// State
const [state, setState] = useState<PlayerState>({
isPlaying: false,
progress: 0,
currentTime: 0,
duration: data.media.metadata.duration || 0,
volume: 1,
isMuted: false,
isLooping: false,
playbackRate: 1,
isFullScreen: false,
showFrames: false,
currentResolution: initialRes.resolution,
currentSrc: initialRes.url,
})
const [buffered, setBuffered] = useState(0)
const [isControlsVisible, setIsControlsVisible] = useState(true)
const [isPlayerReady, setIsPlayerReady] = useState(false)
const lastProcessedStartTimeRef = useRef<number | null>(null)
// Frame-accurate hook and derived state
const metadata = data.media.metadata
const frameRate = metadata.frameRate || 30
const dbTotalFrames = metadata.totalFrames || 0
const containerDuration = metadata.duration || 0
const totalFrames = resolveTotalFrames({ dbTotalFrames, containerDuration, frameRate })
const { currentFrame, seekToFrame } = useFramePlayer(videoRef, frameRate, totalFrames)
const currentTime = currentFrame / frameRate
const duration = totalFrames / frameRate
const progress = duration > 0 ? (currentTime / duration) * 100 : 0
const controlBarState: PlayerState = {
...state,
currentTime,
duration,
progress,
}
// Trigger time update event reactively
useEffect(() => {
if (onTimeUpdate) {
onTimeUpdate(currentFrame / frameRate)
}
}, [currentFrame, frameRate, onTimeUpdate])
// Initialize Video.js
useEffect(() => {
if (!videoContainerRef.current) return
// 1. Create the video element manually
// This avoids conflicts with React Strict Mode where the DOM might not match React's virtual DOM expectations after Video.js modifies it.
const videoElement = document.createElement('video-js')
videoElement.classList.add('vjs-big-play-centered', '!h-full', '!w-full')
// Hide it, but keep it in DOM
videoElement.style.opacity = '0'
videoElement.style.pointerEvents = 'none'
// Append to our container
videoContainerRef.current.appendChild(videoElement)
// 2. Initialize the player
const player = (playerRef.current = videojs(videoElement, {
controls: false,
autoplay: false,
preload: 'auto',
playsinline: true,
sources: [
{
src: state.currentSrc,
type: 'video/mp4',
},
],
}))
// Extract video element for Konva
const htmlVid = videoElement.querySelector('video')
if (htmlVid) {
setVideoHtmlEl(htmlVid)
videoRef.current = htmlVid
} else {
// Fallback: try player.tech().el()
// Wait for ready?
player.ready(() => {
const techEl = player.tech({ iWillNotUseThisInPlugins: true })?.el() as HTMLVideoElement
if (techEl) {
setVideoHtmlEl(techEl)
videoRef.current = techEl
}
})
}
player.on('play', () => {
setState((p) => ({ ...p, isPlaying: true }))
onPlay?.()
})
player.on('pause', () => {
setState((p) => ({ ...p, isPlaying: false }))
onPause?.()
})
player.on('ended', () => setState((p) => ({ ...p, isPlaying: false })))
player.on('loadedmetadata', () => {
setIsPlayerReady(true)
})
player.on('loadstart', () => {
setIsPlayerReady(false)
})
player.on('timeupdate', () => {
const playerDuration = player.duration() || data.media?.metadata?.duration || 0
const bufferedEnd = player.bufferedEnd()
if (playerDuration > 0) {
setBuffered((bufferedEnd / playerDuration) * 100)
}
})
player.on('volumechange', () => {
const vol = player.volume()
const muted = player.muted()
setState((prev) => ({
...prev,
volume: vol || 0,
isMuted: muted || false,
}))
})
player.on('ratechange', () => {
setState((prev) => ({
...prev,
playbackRate: player.playbackRate() || 1,
}))
})
player.on('error', () => {
console.error('VideoJS Error:', player.error())
})
// Set initial state
player.volume(state.volume)
// 4. Cleanup
return () => {
if (player && !player.isDisposed()) {
player.dispose()
playerRef.current = null
videoRef.current = null
}
}
}, [data])
// Handle changes to startTime (e.g., clicking different chunks in search results)
useEffect(() => {
if (!isPlayerReady) return
if (startTime !== undefined && startTime !== null && startTime > 0) {
if (startTime !== lastProcessedStartTimeRef.current) {
lastProcessedStartTimeRef.current = startTime
const targetFrame = Math.floor(startTime * frameRate + 0.45)
seekToFrame(targetFrame)
}
}
}, [startTime, frameRate, seekToFrame, isPlayerReady])
const scheduleHide = useCallback(() => {
if (controlsTimeoutRef.current) {
clearTimeout(controlsTimeoutRef.current)
}
// Never hide while the cursor rests over the control bar itself.
if (state.isFullScreen && !isOverControlsRef.current) {
controlsTimeoutRef.current = setTimeout(() => {
setIsControlsVisible(false)
}, 1200)
}
}, [state.isFullScreen])
const handleMouseMove = useCallback(() => {
// Always show controls on movement, then (re)start the idle hide timer.
setIsControlsVisible(true)
scheduleHide()
}, [scheduleHide])
const handleControlsMouseEnter = useCallback(() => {
isOverControlsRef.current = true
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
setIsControlsVisible(true)
}, [])
const handleControlsMouseLeave = useCallback(() => {
isOverControlsRef.current = false
scheduleHide()
}, [scheduleHide])
const handleMouseLeave = useCallback(() => {
// If the cursor leaves the player while fullscreen, hide the controls.
if (state.isFullScreen) {
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
setIsControlsVisible(false)
}
}, [state.isFullScreen])
// Clean up timeout on unmount or state change
useEffect(() => {
return () => {
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
}
}, [])
// Windowed mode: controls are always visible. Fullscreen: show now and let
// the idle timer hide them (re-runs on play/pause so pausing re-reveals them).
useEffect(() => {
if (!state.isFullScreen) {
setIsControlsVisible(true)
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
} else {
handleMouseMove()
}
}, [state.isPlaying, state.isFullScreen, handleMouseMove])
// -- Event Handlers --
const togglePlay = useCallback(() => {
// Disable click-to-play if drawing
if (useAnnotationStore.getState().isDrawing) return
const player = playerRef.current
if (!player) return
if (player.paused() || player.ended()) {
const playPromise = player.play()
if (playPromise !== undefined) {
playPromise.catch((error) => {
// Ignore AbortError which happens when pausing rapidly after playing
if (error.name === 'AbortError') return
console.error('Play failed:', error)
})
}
} else {
player.pause()
}
}, [])
const toggleLoop = () => {
const player = playerRef.current
if (!player) return
const newLoop = !state.isLooping
player.loop(newLoop)
setState((prev) => ({ ...prev, isLooping: newLoop }))
}
const handleVolumeChange = (newVolume: number) => {
// Optimistic update to prevent slider jumping and ensure immediate UI feedback
setState((prev) => ({
...prev,
volume: newVolume,
isMuted: newVolume === 0, // If dragging to 0, consider it muted
}))
const player = playerRef.current
if (!player) return
// Set volume first so if we unmute, it is at the correct level
player.volume(newVolume)
// Manage mute state based on volume
if (newVolume > 0 && player.muted()) {
player.muted(false)
} else if (newVolume === 0 && !player.muted()) {
player.muted(true)
}
}
const toggleMute = () => {
const player = playerRef.current
if (!player) return
const isMuted = player.muted()
if (isMuted) {
player.muted(false)
// If volume was 0 (e.g. user dragged to 0), restore to default 0.5 so they hear something
if (player.volume() === 0) {
player.volume(0.5)
}
} else {
player.muted(true)
}
}
const changePlaybackRate = (rate: number) => {
const player = playerRef.current
if (!player) return
player.playbackRate(rate)
}
const changeResolution = (res: DisplayTranscode) => {
const player = playerRef.current
if (!player) return
const wasPlaying = !player.paused()
const currentT = player.currentTime()
setState((prev) => ({
...prev,
currentResolution: res.resolution,
currentSrc: res.url,
}))
player.src({ type: 'video/mp4', src: res.url })
player.one('loadedmetadata', () => {
player.currentTime(currentT)
if (wasPlaying) {
const playPromise = player.play()
if (playPromise !== undefined) {
playPromise.catch((error) => {
if (error.name === 'AbortError') return
console.error('Play after seek failed:', error)
})
}
}
player.playbackRate(state.playbackRate)
})
}
const toggleFullScreen = () => {
if (!rootRef.current) return
if (!document.fullscreenElement) {
rootRef.current.requestFullscreen()
setState((prev) => ({ ...prev, isFullScreen: true }))
} else {
document.exitFullscreen()
setState((prev) => ({ ...prev, isFullScreen: false }))
}
}
const handleDownload = async (key: string) => {
try {
const res = shareId
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
param: { shareId, fileId: data.id! },
json: { key },
})
: await client.api.files['download-url'].$post({
json: { key, assetId: data.id! },
})
if (!res.ok) return
const { url } = await res.json()
const link = document.createElement('a')
link.href = url
link.download = ''
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch {
// silently fail
}
}
// Listen for fullscreen change events (ESC key)
useEffect(() => {
const onFsChange = () => {
setState((prev) => ({
...prev,
isFullScreen: !!document.fullscreenElement,
}))
}
document.addEventListener('fullscreenchange', onFsChange)
return () => document.removeEventListener('fullscreenchange', onFsChange)
}, [])
// Calculate center pan
const vidW = data.media?.metadata?.originalWidth ?? 1920
const vidH = data.media?.metadata?.originalHeight ?? 1080
const scale = zoom
const panX = (containerSize.width - vidW * scale) / 2
const panY = (containerSize.height - vidH * scale) / 2
return (
<div
ref={rootRef}
className={cn(
'group shadow-2xl font-sans select-none flex flex-col mx-auto transition-all duration-300 relative',
state.isFullScreen ? 'h-full w-full rounded-none bg-black' : 'w-full h-full',
!isControlsVisible && state.isFullScreen ? 'cursor-none' : '',
)}
onMouseMove={handleMouseMove}
onMouseLeave={handleMouseLeave}
>
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{/* Render Carousel/Sidebar here if not fullscreen */}
{!state.isFullScreen && children}
{/* Video Area */}
<div
ref={containerRef}
className={cn(
'flex-1 bg-black cursor-pointer relative flex items-center justify-center overflow-hidden min-h-0',
)}
onClick={togglePlay}
data-vjs-player
data-testid="video-area"
>
{/* Hidden VideoJS container */}
<div ref={videoContainerRef} className="absolute inset-0 z-[-1]" />
{/* Drawing Canvas (Visible) */}
{videoHtmlEl && containerSize.width > 0 && (
<DrawingCanvas
width={containerSize.width}
height={containerSize.height}
mediaDimensions={{
width: vidW,
height: vidH,
}}
videoElement={videoHtmlEl}
annotations={displayAnnotations}
scale={scale}
offset={{ x: panX, y: panY }}
className="absolute inset-0"
onClick={togglePlay}
// Drawing Props
isDrawing={isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={addAnnotation}
/>
)}
{/* Big Play Button Overlay (when paused) */}
{!state.isPlaying && !isDrawing && (
<div className="absolute inset-0 flex items-center justify-center bg-black/20 pointer-events-none z-10">
<div className="w-20 h-20 bg-white/10 backdrop-blur-sm rounded-full flex items-center justify-center border-2 border-white/30 animate-pulse">
<Play className="w-10 h-10 text-white ml-1 fill-white" />
</div>
</div>
)}
</div>
</div>
<VideoControlBar
state={controlBarState}
zoom={zoom}
isControlsVisible={isControlsVisible}
buffered={buffered}
data={data}
resolutions={resolutions}
togglePlay={togglePlay}
toggleLoop={toggleLoop}
toggleMute={toggleMute}
handleVolumeChange={handleVolumeChange}
changePlaybackRate={changePlaybackRate}
changeResolution={changeResolution}
handleDownload={handleDownload}
toggleFullScreen={toggleFullScreen}
onZoomChange={handleZoomChange}
onZoomReset={handleZoomReset}
frameRate={frameRate}
totalFrames={totalFrames}
currentFrame={currentFrame}
seekToFrame={seekToFrame}
onMouseEnter={handleControlsMouseEnter}
onMouseLeave={handleControlsMouseLeave}
/>
</div>
)
}
export default VideoPlayer
@@ -4,25 +4,25 @@ import { cn } from '@/ui/lib/utils'
import { useAnnotationStore } from '@/ui/stores/annotation-store'
import type { Annotation } from '@/ui/types'
import type { AssetInfo } from '@shumai/dtos'
import { Play } from 'lucide-react'
import { Play, AudioLines } from 'lucide-react'
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react'
import videojs from 'video.js'
import type Player from 'video.js/dist/types/player'
import { useFramePlayer } from '@/ui/components/viewers/use-frame-player'
import { resolveTotalFrames } from '@/ui/components/viewers/utils'
import { clampFrame as clampFrameUtil } from './compare-utils'
import type { ComparePaneHandle, DisplayTranscode, PaneReportedState } from './types'
import { useFramePlayer } from './use-frame-player'
import { resolveTotalFrames } from './utils'
import { clampFrame as clampFrameUtil } from '../../compare/compare-utils'
import type { ComparePaneHandle, DisplayTranscode, PaneReportedState } from '../../compare/types'
interface CompareVideoPaneProps {
file: AssetInfo
shareId?: string
isActive: boolean
/** Whether this pane's audio should be muted (only the active side plays audio). */
muted: boolean
volume: number
muted?: boolean
volume?: number
annotations: Annotation[]
onStateChange: (state: PaneReportedState) => void
onActivate?: () => void
onActivate: () => void
onRequestTogglePlay?: () => void
/** Called with the current playhead time in seconds (used only for the active pane). */
onTimeUpdate?: (second: number) => void
@@ -68,8 +68,8 @@ export const CompareVideoPane = forwardRef<ComparePaneHandle, CompareVideoPanePr
file,
shareId,
isActive,
muted,
volume,
muted = true,
volume = 1,
annotations,
onStateChange,
onActivate,
@@ -118,7 +118,8 @@ export const CompareVideoPane = forwardRef<ComparePaneHandle, CompareVideoPanePr
const [currentResolution, setCurrentResolution] = useState(initialRes?.resolution ?? 'Original')
const currentSrcRef = useRef(initialRes?.url)
const { currentFrame, seekToFrame } = useFramePlayer(videoRef, frameRate, totalFrames)
const isAudio = file.mediaType?.startsWith('audio/')
const { currentFrame, seekToFrame } = useFramePlayer(videoRef, frameRate, totalFrames, isAudio)
const zoomRef = useRef(zoom)
zoomRef.current = zoom
@@ -138,8 +139,8 @@ export const CompareVideoPane = forwardRef<ComparePaneHandle, CompareVideoPanePr
return () => observer.disconnect()
}, [])
const vidW = metadata?.originalWidth ?? 1920
const vidH = metadata?.originalHeight ?? 1080
const vidW = metadata?.originalWidth || 1920
const vidH = metadata?.originalHeight || 1080
// Auto-fit zoom
useEffect(() => {
@@ -439,22 +440,34 @@ export const CompareVideoPane = forwardRef<ComparePaneHandle, CompareVideoPanePr
>
<div ref={videoContainerRef} className="absolute inset-0 z-[-1]" />
{videoHtmlEl && containerSize.width > 0 && (
<DrawingCanvas
width={containerSize.width}
height={containerSize.height}
mediaDimensions={{ width: vidW, height: vidH }}
videoElement={videoHtmlEl}
annotations={displayAnnotations}
scale={scale}
offset={{ x: panX, y: panY }}
className="absolute inset-0"
onClick={handleAreaClick}
isDrawing={isActive && isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={isActive ? addAnnotation : undefined}
/>
{file.mediaType?.startsWith('audio/') ? (
<div className="flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none">
<AudioLines
className={cn(
'w-16 h-16 text-foreground/75 transition-transform duration-500',
isPlaying ? 'animate-pulse scale-110 text-primary' : '',
)}
/>
</div>
) : (
videoHtmlEl &&
containerSize.width > 0 && (
<DrawingCanvas
width={containerSize.width}
height={containerSize.height}
mediaDimensions={{ width: vidW, height: vidH }}
videoElement={videoHtmlEl}
annotations={displayAnnotations}
scale={scale}
offset={{ x: panX, y: panY }}
className="absolute inset-0"
onClick={handleAreaClick}
isDrawing={isActive && isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={isActive ? addAnnotation : undefined}
/>
)
)}
{!isPlaying && !isDrawing && (
@@ -0,0 +1,16 @@
import { FileTypeDefinition } from '../types'
import VideoViewer from './video-viewer'
import { CompareVideoPane } from './compare-video-pane'
export const videoTypeDefinition: FileTypeDefinition = {
id: 'video',
name: 'Video',
match: (file) => !!file.mediaType?.startsWith('video/') || !!file.mediaType?.startsWith('audio/'),
viewer: VideoViewer,
comparePane: CompareVideoPane,
commentsConfig: {
hasTimestamp: true,
hasAnnotations: true,
hasAiBots: true,
},
}
@@ -24,6 +24,7 @@ export function useFramePlayer(
videoRef: React.RefObject<HTMLVideoElement | null>,
frameRate: number,
totalFrames: number,
isAudio?: boolean,
): UseFramePlayerResult {
const [currentFrame, setCurrentFrame] = useState<number>(0)
const isSeekingRef = useRef<boolean>(false)
@@ -113,7 +114,7 @@ export function useFramePlayer(
const rVfcStalledAfterDelivery = hasDeliveredVfc && sinceLastVfc > stallThreshold
const rVfcNeverDelivered = !hasDeliveredVfc && sinceLastVfc > INITIAL_VFC_GRACE_MS
const useCurrentTimeFallback =
!rVfcSupported || rVfcStalledAfterDelivery || rVfcNeverDelivered
isAudio || !rVfcSupported || rVfcStalledAfterDelivery || rVfcNeverDelivered
if (useCurrentTimeFallback) {
const frame = Math.floor(video.currentTime * frameRate + 0.45)
@@ -1,4 +1,5 @@
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import { useUiStore } from '@/ui/stores/ui'
import type { AssetInfo, VideoTranscode } from '@shumai/dtos'
import {
@@ -23,8 +24,8 @@ import {
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuTrigger,
} from '../ui/dropdown-menu'
import { Slider } from '../ui/slider'
} from '../../ui/dropdown-menu'
import { Slider } from '../../ui/slider'
import ProgressBar from './progress-bar'
import { formatTime, formatTimecode } from './utils'
@@ -113,6 +114,7 @@ export const VideoControlBar: React.FC<ControlBarProps> = ({
// fullscreen). Compare keeps it in-flow. Colors stay theme-aware either way.
const overlay = state.isFullScreen && floatOverlayInFullScreen
const isAudio = data.mediaType?.startsWith('audio/')
const previewResolutions = resolutions.filter((r) => !r.isRaw)
const startTimecode = data.media?.metadata?.startTimecode
@@ -196,7 +198,7 @@ export const VideoControlBar: React.FC<ControlBarProps> = ({
<div className="w-24 px-1">
<Slider
value={state.isMuted ? [0] : [state.volume]}
onValueChange={(v) => handleVolumeChange(v[0])}
onValueChange={(v: number[]) => handleVolumeChange(v[0])}
max={1}
step={0.05}
/>
@@ -253,31 +255,35 @@ export const VideoControlBar: React.FC<ControlBarProps> = ({
{/* Right Side: Zoom, Speed, Res, Download, Fullscreen */}
<div className="relative flex items-center gap-3">
{/* Zoom Controls */}
<div className="flex items-center gap-1">
<div className="flex items-center gap-1 rounded-md bg-muted p-0.5">
{!isAudio && (
<div className="flex items-center gap-1">
<div className="flex items-center gap-1 rounded-md bg-muted p-0.5">
<button
onClick={() => onZoomChange(zoom * 0.8)}
className="p-1 hover:text-primary rounded"
title={m.zoom_out()}
>
<Minus size={14} />
</button>
<span className="text-xs w-8 text-center tabular-nums">
{Math.round(zoom * 100)}%
</span>
<button
onClick={() => onZoomChange(zoom * 1.2)}
className="p-1 hover:text-primary rounded"
title={m.zoom_in()}
>
<Plus size={14} />
</button>
</div>
<button
onClick={() => onZoomChange(zoom * 0.8)}
className="p-1 hover:text-primary rounded"
onClick={onZoomReset}
className="text-xs font-medium px-2 py-1 rounded bg-muted hover:text-primary transition-colors"
>
<Minus size={14} />
</button>
<span className="text-xs w-8 text-center tabular-nums">
{Math.round(zoom * 100)}%
</span>
<button
onClick={() => onZoomChange(zoom * 1.2)}
className="p-1 hover:text-primary rounded"
>
<Plus size={14} />
{m.fit()}
</button>
</div>
<button
onClick={onZoomReset}
className="text-xs font-medium px-2 py-1 rounded bg-muted hover:text-primary transition-colors"
>
Fit
</button>
</div>
)}
{/* Playback Rate */}
<DropdownMenu>
@@ -304,63 +310,84 @@ export const VideoControlBar: React.FC<ControlBarProps> = ({
</DropdownMenuContent>
</DropdownMenu>
{/* Resolution Selector */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-1 rounded border border-border px-2 py-0.5 text-sm font-semibold hover:bg-muted transition-colors">
<Settings className="h-3.5 w-3.5" />
<span>{state.currentResolution}</span>
</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>Quality</DropdownMenuLabel>
{previewResolutions.map((res) => (
<DropdownMenuItem
key={res.resolution}
onClick={() => changeResolution(res)}
className={cn(
'flex w-full items-center justify-between',
state.currentResolution === res.resolution
? 'text-primary font-medium'
: 'text-foreground',
)}
>
<span>{res.resolution}</span>
<span className="pl-5 text-xs text-muted-foreground">
{res.width}x{res.height}
{/* Settings / Resolution */}
{!isAudio && previewResolutions.length > 0 && (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-1 rounded border border-border px-2 py-0.5 text-sm font-semibold hover:bg-muted transition-colors">
<Settings className="h-3.5 w-3.5" />
<span>
{state.currentResolution === 'Original'
? m.original()
: state.currentResolution}
</span>
</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu>
</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>{m.quality()}</DropdownMenuLabel>
{previewResolutions.map((res) => (
<DropdownMenuItem
key={res.resolution}
onClick={() => changeResolution(res)}
className={cn(
'flex w-full items-center justify-between',
state.currentResolution === res.resolution
? 'text-primary font-medium'
: 'text-foreground',
)}
>
<span>{res.resolution === 'Original' ? m.original() : res.resolution}</span>
<span className="pl-5 text-xs text-muted-foreground">
{res.width}x{res.height}
</span>
</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu>
)}
{/* Download */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="transition-colors hover:text-primary" title="Download">
<Download className="h-5 w-5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>Download</DropdownMenuLabel>
{resolutions.map((res) => (
<DropdownMenuItem
key={res.resolution}
onClick={() => handleDownload(res.key ?? '')}
className="flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground"
>
<span>{res.resolution}</span>
<span className="text-xs text-muted-foreground">
{res.isRaw ? data.name?.split('.').pop()?.toUpperCase() || 'RAW' : 'MP4'}
</span>
</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu>
{isAudio ? (
<button
onClick={() => handleDownload(data.media?.original?.key || '')}
className="transition-colors hover:text-primary"
title={m.download()}
disabled={!data.media?.original?.key}
>
<Download className="h-5 w-5" />
</button>
) : (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="transition-colors hover:text-primary" title={m.download()}>
<Download className="h-5 w-5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>{m.download()}</DropdownMenuLabel>
{resolutions.map((res) => (
<DropdownMenuItem
key={res.resolution}
onClick={() => handleDownload(res.key ?? '')}
className="flex w-full items-center justify-between px-3 py-2 text-left text-sm text-foreground"
>
<span>{res.resolution === 'Original' ? m.original() : res.resolution}</span>
<span className="text-xs text-muted-foreground">
{res.isRaw ? data.name?.split('.').pop()?.toUpperCase() || 'RAW' : 'MP4'}
</span>
</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu>
)}
{/* Fullscreen */}
<button onClick={toggleFullScreen} className="transition-colors hover:text-primary">
<button
onClick={toggleFullScreen}
className="transition-colors hover:text-primary"
title={m.fullscreen()}
>
{state.isFullScreen ? (
<Minimize className="h-6 w-6" />
) : (
@@ -0,0 +1,663 @@
import { client } from '@/ui/api/client'
import { cn } from '@/ui/lib/utils'
import { Play, AudioLines } from 'lucide-react'
import React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react'
import videojs from 'video.js'
import type Player from 'video.js/dist/types/player'
import { useFramePlayer } from './use-frame-player'
import { resolveTotalFrames } from './utils'
import { VideoControlBar, type PlayerState, type DisplayTranscode } from './video-control-bar'
import DrawingCanvas from '@/ui/components/drawing-canvas'
import { useAnnotationStore } from '@/ui/stores/annotation-store'
import { FileViewerProps, MediaController } from '../types'
const VideoViewer = React.forwardRef<MediaController, FileViewerProps>(
(
{ file: data, onPlay, onPause, onTimeUpdate, annotations, startTime, shareId, children },
ref,
) => {
const localPlayerRef = useRef<Player | null>(null)
const playerRef = localPlayerRef
const hasMedia = !!data.media?.original?.downloadUrl && !!data.media?.metadata
// We use a container ref to manually append the video element
const videoContainerRef = useRef<HTMLDivElement>(null)
const containerRef = useRef<HTMLDivElement>(null)
const rootRef = useRef<HTMLDivElement>(null)
const controlsTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
useImperativeHandle(ref, () => ({
play: () => {
if (localPlayerRef.current) {
localPlayerRef.current.play()
}
},
pause: () => {
if (localPlayerRef.current) {
localPlayerRef.current.pause()
}
},
seekTo: (second: number) => {
if (localPlayerRef.current) {
localPlayerRef.current.currentTime(second)
}
},
getCurrentTime: () => {
return (localPlayerRef.current ? localPlayerRef.current.currentTime() : 0) ?? 0
},
getDuration: () => {
return (localPlayerRef.current ? localPlayerRef.current.duration() : 0) ?? 0
},
}))
const isOverControlsRef = useRef(false)
const [videoHtmlEl, setVideoHtmlEl] = useState<HTMLVideoElement | undefined>(undefined)
const videoRef = useRef<HTMLVideoElement | null>(null)
const [zoom, setZoom] = useState(1)
const [hasManuallyZoomed, setHasManuallyZoomed] = useState(false)
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })
const handleZoomChange = (newZoom: number) => {
setZoom(newZoom)
setHasManuallyZoomed(true)
}
const handleZoomReset = () => {
setHasManuallyZoomed(false)
}
// Store
const {
isDrawing,
currentTool,
currentColor,
addAnnotation,
annotations: draftAnnotations,
} = useAnnotationStore()
// Combine annotations
const displayAnnotations = [...(annotations || []), ...draftAnnotations]
// Resize Observer for container
useEffect(() => {
if (!containerRef.current) return
const observer = new ResizeObserver((entries) => {
const entry = entries[0]
if (entry) {
setContainerSize({
width: entry.contentRect.width,
height: entry.contentRect.height,
})
}
})
observer.observe(containerRef.current)
return () => observer.disconnect()
}, [])
// Fit to screen initial / responsive resize
useEffect(() => {
if (containerSize.width > 0 && containerSize.height > 0) {
const vidW = data.media?.metadata?.originalWidth || 1920
const vidH = data.media?.metadata?.originalHeight || 1080
const scale = Math.min(containerSize.width / vidW, containerSize.height / vidH)
if (!hasManuallyZoomed) {
setZoom(scale)
}
}
}, [containerSize.width, containerSize.height, data.media?.metadata, hasManuallyZoomed])
// Cleanup ref when player is disposed
useEffect(() => {
return () => {
videoRef.current = null
}
}, [])
// Initial resolution setup
const originalRes: DisplayTranscode = {
id: 'original',
url: data.media?.original?.downloadUrl || '',
key: data.media?.original?.key ?? '',
width: data.media?.metadata?.originalWidth ?? 0,
height: data.media?.metadata?.originalHeight ?? 0,
size: 0,
isRaw: true,
resolution: 'Original',
}
const resolutions: DisplayTranscode[] = (data.media?.videoTranscodes ?? []).map((t) => {
const longSide = Math.max(t.width, t.height)
let resolution = `${t.height}p`
if (longSide >= 3840) resolution = '2160p'
else if (longSide >= 1920) resolution = '1080p'
else if (longSide >= 1280) resolution = '720p'
else if (longSide >= 960) resolution = '540p'
else if (longSide >= 640) resolution = '360p'
else if (longSide >= 320) resolution = '180p'
return {
...t,
resolution: t.isRaw ? 'Original' : resolution,
}
})
const previewResolutions = resolutions.filter((r) => !r.isRaw)
// Logic to select best resolution based on screen size
const getInitialResolution = (): DisplayTranscode => {
if (previewResolutions.length === 0) return originalRes
if (typeof window === 'undefined') return previewResolutions[0]
// Use device pixel ratio for high DPI screens
const screenWidth = window.innerWidth * (window.devicePixelRatio || 1)
// 1. Sort by width ascending
const sortedResolutions = [...previewResolutions].sort((a, b) => {
const wA = a.width ?? 0
const wB = b.width ?? 0
return wA - wB
})
// 2. Find first one >= screenWidth
const bestFit = sortedResolutions.find((r) => (r.width ?? 0) >= screenWidth)
// 3. If found, return it. If not (all are smaller), return the last one (largest).
return bestFit || sortedResolutions[sortedResolutions.length - 1]
}
const initialRes = getInitialResolution()
// State
const [state, setState] = useState<PlayerState>({
isPlaying: false,
progress: 0,
currentTime: 0,
duration: data.media?.metadata?.duration || 0,
volume: 1,
isMuted: false,
isLooping: false,
playbackRate: 1,
isFullScreen: false,
showFrames: false,
currentResolution: initialRes?.resolution || 'Original',
currentSrc: initialRes?.url || '',
})
const [buffered, setBuffered] = useState(0)
const [isControlsVisible, setIsControlsVisible] = useState(true)
const [isPlayerReady, setIsPlayerReady] = useState(false)
const lastProcessedStartTimeRef = useRef<number | null>(null)
// Frame-accurate hook and derived state
const metadata = data.media?.metadata
const frameRate = metadata?.frameRate || 30
const dbTotalFrames = metadata?.totalFrames || 0
const containerDuration = metadata?.duration || 0
const isAudio = data.mediaType?.startsWith('audio/')
const totalFrames = resolveTotalFrames({ dbTotalFrames, containerDuration, frameRate })
const { currentFrame, seekToFrame } = useFramePlayer(videoRef, frameRate, totalFrames, isAudio)
const currentTime = currentFrame / frameRate
const duration = totalFrames / frameRate
const progress = duration > 0 ? (currentTime / duration) * 100 : 0
const controlBarState: PlayerState = {
...state,
currentTime,
duration,
progress,
}
// Trigger time update event reactively
useEffect(() => {
if (onTimeUpdate) {
onTimeUpdate(currentFrame / frameRate)
}
}, [currentFrame, frameRate, onTimeUpdate])
// Initialize Video.js
useEffect(() => {
if (!videoContainerRef.current) return
// 1. Create the video element manually
// This avoids conflicts with React Strict Mode where the DOM might not match React's virtual DOM expectations after Video.js modifies it.
const videoElement = document.createElement('video-js')
videoElement.classList.add('vjs-big-play-centered', '!h-full', '!w-full')
// Hide it, but keep it in DOM
videoElement.style.opacity = '0'
videoElement.style.pointerEvents = 'none'
// Append to our container
videoContainerRef.current.appendChild(videoElement)
// 2. Initialize the player
const player = (playerRef.current = videojs(videoElement, {
controls: false,
autoplay: false,
preload: 'auto',
playsinline: true,
sources: [
{
src: state.currentSrc,
type: 'video/mp4',
},
],
}))
// Extract video element for Konva
const htmlVid = videoElement.querySelector('video')
if (htmlVid) {
setVideoHtmlEl(htmlVid)
videoRef.current = htmlVid
} else {
// Fallback: try player.tech().el()
// Wait for ready?
player.ready(() => {
const techEl = player.tech({ iWillNotUseThisInPlugins: true })?.el() as HTMLVideoElement
if (techEl) {
setVideoHtmlEl(techEl)
videoRef.current = techEl
}
})
}
player.on('play', () => {
setState((p) => ({ ...p, isPlaying: true }))
onPlay?.()
})
player.on('pause', () => {
setState((p) => ({ ...p, isPlaying: false }))
onPause?.()
})
player.on('ended', () => setState((p) => ({ ...p, isPlaying: false })))
player.on('loadedmetadata', () => {
setIsPlayerReady(true)
})
player.on('loadstart', () => {
setIsPlayerReady(false)
})
player.on('timeupdate', () => {
const playerDuration = player.duration() || data.media?.metadata?.duration || 0
const bufferedEnd = player.bufferedEnd()
if (playerDuration > 0) {
setBuffered((bufferedEnd / playerDuration) * 100)
}
})
player.on('volumechange', () => {
const vol = player.volume()
const muted = player.muted()
setState((prev) => ({
...prev,
volume: vol || 0,
isMuted: muted || false,
}))
})
player.on('ratechange', () => {
setState((prev) => ({
...prev,
playbackRate: player.playbackRate() || 1,
}))
})
player.on('error', () => {
console.error('VideoJS Error:', player.error())
})
// Set initial state
player.volume(state.volume)
// 4. Cleanup
return () => {
if (player && !player.isDisposed()) {
player.dispose()
playerRef.current = null
videoRef.current = null
}
}
}, [data])
// Handle changes to startTime (e.g., clicking different chunks in search results)
useEffect(() => {
if (!isPlayerReady) return
if (startTime !== undefined && startTime !== null && startTime > 0) {
if (startTime !== lastProcessedStartTimeRef.current) {
lastProcessedStartTimeRef.current = startTime
const targetFrame = Math.floor(startTime * frameRate + 0.45)
seekToFrame(targetFrame)
}
}
}, [startTime, frameRate, seekToFrame, isPlayerReady])
const scheduleHide = useCallback(() => {
if (controlsTimeoutRef.current) {
clearTimeout(controlsTimeoutRef.current)
}
// Never hide while the cursor rests over the control bar itself.
if (state.isFullScreen && !isOverControlsRef.current) {
controlsTimeoutRef.current = setTimeout(() => {
setIsControlsVisible(false)
}, 1200)
}
}, [state.isFullScreen])
const handleMouseMove = useCallback(() => {
// Always show controls on movement, then (re)start the idle hide timer.
setIsControlsVisible(true)
scheduleHide()
}, [scheduleHide])
const handleControlsMouseEnter = useCallback(() => {
isOverControlsRef.current = true
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
setIsControlsVisible(true)
}, [])
const handleControlsMouseLeave = useCallback(() => {
isOverControlsRef.current = false
scheduleHide()
}, [scheduleHide])
const handleMouseLeave = useCallback(() => {
// If the cursor leaves the player while fullscreen, hide the controls.
if (state.isFullScreen) {
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
setIsControlsVisible(false)
}
}, [state.isFullScreen])
// Clean up timeout on unmount or state change
useEffect(() => {
return () => {
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
}
}, [])
// Windowed mode: controls are always visible. Fullscreen: show now and let
// the idle timer hide them (re-runs on play/pause so pausing re-reveals them).
useEffect(() => {
if (!state.isFullScreen) {
setIsControlsVisible(true)
if (controlsTimeoutRef.current) clearTimeout(controlsTimeoutRef.current)
} else {
handleMouseMove()
}
}, [state.isPlaying, state.isFullScreen, handleMouseMove])
// -- Event Handlers --
const togglePlay = useCallback(() => {
// Disable click-to-play if drawing
if (useAnnotationStore.getState().isDrawing) return
const player = playerRef.current
if (!player) return
if (player.paused() || player.ended()) {
const playPromise = player.play()
if (playPromise !== undefined) {
playPromise.catch((error) => {
// Ignore AbortError which happens when pausing rapidly after playing
if (error.name === 'AbortError') return
console.error('Play failed:', error)
})
}
} else {
player.pause()
}
}, [])
const toggleLoop = () => {
const player = playerRef.current
if (!player) return
const newLoop = !state.isLooping
player.loop(newLoop)
setState((prev) => ({ ...prev, isLooping: newLoop }))
}
const handleVolumeChange = (newVolume: number) => {
// Optimistic update to prevent slider jumping and ensure immediate UI feedback
setState((prev) => ({
...prev,
volume: newVolume,
isMuted: newVolume === 0, // If dragging to 0, consider it muted
}))
const player = playerRef.current
if (!player) return
// Set volume first so if we unmute, it is at the correct level
player.volume(newVolume)
// Manage mute state based on volume
if (newVolume > 0 && player.muted()) {
player.muted(false)
} else if (newVolume === 0 && !player.muted()) {
player.muted(true)
}
}
const toggleMute = () => {
const player = playerRef.current
if (!player) return
const isMuted = player.muted()
if (isMuted) {
player.muted(false)
// If volume was 0 (e.g. user dragged to 0), restore to default 0.5 so they hear something
if (player.volume() === 0) {
player.volume(0.5)
}
} else {
player.muted(true)
}
}
const changePlaybackRate = (rate: number) => {
const player = playerRef.current
if (!player) return
player.playbackRate(rate)
}
const changeResolution = (res: DisplayTranscode) => {
const player = playerRef.current
if (!player) return
const wasPlaying = !player.paused()
const currentT = player.currentTime()
setState((prev) => ({
...prev,
currentResolution: res.resolution,
currentSrc: res.url,
}))
player.src({ type: 'video/mp4', src: res.url })
player.one('loadedmetadata', () => {
player.currentTime(currentT)
if (wasPlaying) {
const playPromise = player.play()
if (playPromise !== undefined) {
playPromise.catch((error) => {
if (error.name === 'AbortError') return
console.error('Play after seek failed:', error)
})
}
}
player.playbackRate(state.playbackRate)
})
}
const toggleFullScreen = () => {
if (!rootRef.current) return
if (!document.fullscreenElement) {
rootRef.current.requestFullscreen()
setState((prev) => ({ ...prev, isFullScreen: true }))
} else {
document.exitFullscreen()
setState((prev) => ({ ...prev, isFullScreen: false }))
}
}
const handleDownload = async (key: string) => {
try {
const res = shareId
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
param: { shareId, fileId: data.id! },
json: { key },
})
: await client.api.files['download-url'].$post({
json: { key, assetId: data.id! },
})
if (!res.ok) return
const { url } = await res.json()
const link = document.createElement('a')
link.href = url
link.download = ''
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch {
// silently fail
}
}
// Listen for fullscreen change events (ESC key)
useEffect(() => {
const onFsChange = () => {
setState((prev) => ({
...prev,
isFullScreen: !!document.fullscreenElement,
}))
}
document.addEventListener('fullscreenchange', onFsChange)
return () => document.removeEventListener('fullscreenchange', onFsChange)
}, [])
// Calculate center pan
const vidW = data.media?.metadata?.originalWidth || 1920
const vidH = data.media?.metadata?.originalHeight || 1080
const scale = zoom
const panX = (containerSize.width - vidW * scale) / 2
const panY = (containerSize.height - vidH * scale) / 2
if (!hasMedia) {
return (
<div className="flex h-full w-full items-center justify-center">
<p className="text-muted-foreground">Media is not available.</p>
</div>
)
}
return (
<div
ref={rootRef}
className={cn(
'group shadow-2xl font-sans select-none flex flex-col mx-auto transition-all duration-300 relative',
state.isFullScreen ? 'h-full w-full rounded-none bg-black' : 'w-full h-full',
!isControlsVisible && state.isFullScreen ? 'cursor-none' : '',
)}
onMouseMove={handleMouseMove}
onMouseLeave={handleMouseLeave}
>
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{/* Render Carousel/Sidebar here if not fullscreen */}
{!state.isFullScreen && children}
{/* Video Area */}
<div
ref={containerRef}
className={cn(
'flex-1 bg-black cursor-pointer relative flex items-center justify-center overflow-hidden min-h-0',
)}
onClick={togglePlay}
data-vjs-player
data-testid="video-area"
>
{/* Hidden VideoJS container */}
<div ref={videoContainerRef} className="absolute inset-0 z-[-1]" />
{data.mediaType?.startsWith('audio/') ? (
<div className="flex flex-col items-center justify-center text-muted-foreground w-full h-full pointer-events-none select-none">
<AudioLines
className={cn(
'w-16 h-16 text-foreground/75 transition-transform duration-500',
state.isPlaying ? 'animate-pulse scale-110 text-primary' : '',
)}
/>
</div>
) : (
/* Drawing Canvas (Visible) */
videoHtmlEl &&
containerSize.width > 0 && (
<DrawingCanvas
width={containerSize.width}
height={containerSize.height}
mediaDimensions={{
width: vidW,
height: vidH,
}}
videoElement={videoHtmlEl}
annotations={displayAnnotations}
scale={scale}
offset={{ x: panX, y: panY }}
className="absolute inset-0"
onClick={togglePlay}
// Drawing Props
isDrawing={isDrawing}
currentTool={currentTool}
currentColor={currentColor}
onAddAnnotation={addAnnotation}
/>
)
)}
{/* Big Play Button Overlay (when paused) */}
{!state.isPlaying && !isDrawing && (
<div className="absolute inset-0 flex items-center justify-center bg-black/20 pointer-events-none z-10">
<div className="w-20 h-20 bg-white/10 backdrop-blur-sm rounded-full flex items-center justify-center border-2 border-white/30 animate-pulse">
<Play className="w-10 h-10 text-white ml-1 fill-white" />
</div>
</div>
)}
</div>
</div>
<VideoControlBar
state={controlBarState}
zoom={zoom}
isControlsVisible={isControlsVisible}
buffered={buffered}
data={data}
resolutions={resolutions}
togglePlay={togglePlay}
toggleLoop={toggleLoop}
toggleMute={toggleMute}
handleVolumeChange={handleVolumeChange}
changePlaybackRate={changePlaybackRate}
changeResolution={changeResolution}
handleDownload={handleDownload}
toggleFullScreen={toggleFullScreen}
onZoomChange={handleZoomChange}
onZoomReset={handleZoomReset}
frameRate={frameRate}
totalFrames={totalFrames}
currentFrame={currentFrame}
seekToFrame={seekToFrame}
onMouseEnter={handleControlsMouseEnter}
onMouseLeave={handleControlsMouseLeave}
/>
</div>
)
},
)
export default VideoViewer
+195
View File
@@ -0,0 +1,195 @@
# File Viewer Registry System
The **File Viewer Registry** is a modular, type-safe system that makes it easy for developers to add support for new file types (e.g., audio, markdown, pdf, images, and videos) in Shumai's WebUI.
By registering a file type, the detail pages (`FileViewer`), split-screen comparison interfaces (`CompareViewer`), and sidebars automatically adapt to the content, control schemes, and comment features of that file type.
---
## 1. Core Architecture
The system is located under `packages/webui/components/viewers/` and is divided into:
* **Types Definition (`types.ts`)**: Outlines the standard props and imperative controllers every viewer must share.
* **Central Registry (`registry.ts`)**: Matches files dynamically using file metadata (mime-types, extensions, etc.) to load the correct viewer configuration.
* **Viewer Modules**: Self-contained directories containing components, control bars, styles, and tests for each file type (e.g. `video/`, `image/`).
```text
packages/webui/components/viewers/
├── types.ts # Shared types (MediaController, FileViewerProps)
├── registry.ts # Registry definition & matcher helpers
├── video/ # Video viewer module
│ ├── index.tsx # Video type definition export
│ ├── video-viewer.tsx # Content viewer (forwardRef)
│ ├── video-control-bar.tsx
│ └── compare-video-pane.tsx # Comparison pane
├── image/ # Image viewer module
│ ├── index.tsx # Image type definition export
│ ├── image-viewer.tsx
│ └── compare-image-pane.tsx
└── default/ # Fallback for unsupported types
├── index.tsx
└── default-viewer.tsx
```
---
## 2. Shared Interfaces (`types.ts`)
To ensure type safety across all file types, the registry enforces strict TypeScript definitions.
### `MediaController`
Abstracts time-based media control (e.g., seeking, playing, pausing) from outer layout and comments components:
```typescript
export interface MediaController {
play: () => void
pause: () => void
seekTo: (second: number) => void
getCurrentTime?: () => number
getDuration?: () => number
}
```
### `FileTypeDefinition`
The schema that every registered file type configuration must satisfy:
```typescript
export interface FileTypeDefinition {
id: string; // Unique ID (e.g., 'video', 'image')
name: string;
match: (file: AssetInfo) => boolean;
// Renders the main content & control bar, forwarding MediaController ref
viewer: React.ForwardRefExoticComponent<
FileViewerProps & React.RefAttributes<MediaController>
>;
// Optional split-screen comparison pane
comparePane?: React.ForwardRefExoticComponent<
ComparePaneProps & React.RefAttributes<ComparePaneHandle>
>;
// Configuration for comments and sidebar features
commentsConfig?: {
hasTimestamp?: boolean; // Enables timestamped comments
hasAnnotations?: boolean; // Enables annotation drawing canvas
hasAiBots?: boolean; // Enables metadata/autofill AI bots
};
}
```
---
## 3. How to Add a New File Type (Step-by-Step)
To add support for a new file type (e.g., **Audio**):
### Step 1: Create the Folder Structure
Create a new folder under `packages/webui/components/viewers/audio/`.
### Step 2: Implement the Viewer Component
Create `audio-viewer.tsx`. This component handles the content viewport (e.g. waveform display) and the play controls. It **must** forward its ref as a `MediaController`:
```typescript
import React, { useImperativeHandle, useRef } from 'react'
import { FileViewerProps, MediaController } from '../types'
export const AudioViewer = React.forwardRef<MediaController, FileViewerProps>(
({ file, children, onPlay, onTimeUpdate }, ref) => {
const audioEl = useRef<HTMLAudioElement | null>(null)
// Expose control actions to the parent pages/comment areas
useImperativeHandle(ref, () => ({
play: () => audioEl.current?.play(),
pause: () => audioEl.current?.pause(),
seekTo: (second: number) => {
if (audioEl.current) audioEl.current.currentTime = second
},
getCurrentTime: () => audioEl.current?.currentTime || 0,
getDuration: () => audioEl.current?.duration || 0,
}))
return (
<div className="flex flex-col flex-1 h-full bg-background relative">
{/* Render Carousel/LeftSidebar if present */}
{children}
<div className="flex-1 flex items-center justify-center">
<audio
ref={audioEl}
src={file.media?.original?.downloadUrl}
onPlay={onPlay}
onTimeUpdate={(e) => onTimeUpdate?.((e.target as HTMLAudioElement).currentTime)}
controls
/>
</div>
</div>
)
}
)
```
### Step 3: (Optional) Implement the Compare Pane Component
If your file type supports comparison mode, create `compare-audio-pane.tsx`. It must forward a `ComparePaneHandle` ref:
```typescript
import React, { forwardRef, useImperativeHandle, useRef } from 'react'
import { ComparePaneProps } from '../types'
import { ComparePaneHandle } from '../../compare/types'
export const CompareAudioPane = forwardRef<ComparePaneHandle, CompareAudioPaneProps>(
({ file, isActive, onStateChange, onActivate }, ref) => {
const audioEl = useRef<HTMLAudioElement | null>(null)
useImperativeHandle(ref, () => ({
getKind: () => 'audio',
play: () => audioEl.current?.play(),
pause: () => audioEl.current?.pause(),
// ... implement remaining ComparePaneHandle methods
}))
return (
<div onClick={onActivate} className="flex-1 flex flex-col items-center justify-center">
<audio ref={audioEl} src={file.media?.original?.downloadUrl} />
</div>
)
}
)
```
### Step 4: Create the Module Entrypoint
Create `index.tsx` inside your folder and define the `FileTypeDefinition`:
```typescript
import { FileTypeDefinition } from '../types'
import { AudioViewer } from './audio-viewer'
import { CompareAudioPane } from './compare-audio-pane'
export const audioTypeDefinition: FileTypeDefinition = {
id: 'audio',
name: 'Audio',
match: (file) => !!file.mediaType?.startsWith('audio/'),
viewer: AudioViewer,
comparePane: CompareAudioPane,
commentsConfig: {
hasTimestamp: true,
hasAnnotations: false,
hasAiBots: false,
},
}
```
### Step 5: Register the File Type
Add the definition import and reference to the `registry` array in `packages/webui/components/viewers/registry.ts`:
```typescript
import { videoTypeDefinition } from './video'
import { imageTypeDefinition } from './image'
import { audioTypeDefinition } from './audio' // 1. Import
const registry: FileTypeDefinition[] = [
videoTypeDefinition,
imageTypeDefinition,
audioTypeDefinition, // 2. Add to registry
]
```
That's it! The detail page, sidebars, and comparison layout will now dynamically resolve and support your new file type.
Binary file not shown.
+26
View File
@@ -136,3 +136,29 @@ export const longAudioVideoAsset: AssetInfo = {
},
},
}
export const SAMPLE_AUDIO_URL = '/sample-audio.mp4'
export const SAMPLE_AUDIO_DURATION = 3.0
export const SAMPLE_AUDIO_COMPUTED_TOTAL_FRAMES = Math.round(
SAMPLE_AUDIO_DURATION * SAMPLE_FRAME_RATE,
)
export const sampleAudioAsset: AssetInfo = {
...sampleVideoAsset,
id: 'e2e-sample-audio-asset',
name: 'sample-audio.mp4',
mediaType: 'audio/mp4',
media: {
original: {
downloadUrl: SAMPLE_AUDIO_URL,
key: 'sample-audio.mp4',
},
metadata: {
duration: SAMPLE_AUDIO_DURATION,
originalWidth: 0,
originalHeight: 0,
frameRate: SAMPLE_FRAME_RATE,
totalFrames: SAMPLE_AUDIO_COMPUTED_TOTAL_FRAMES,
},
},
}
+10 -8
View File
@@ -1,14 +1,15 @@
import { type ReactElement, useCallback, useRef, useState } from 'react'
import ReactDOM from 'react-dom/client'
import type Player from 'video.js/dist/types/player'
import VideoPlayer from '@/ui/components/viewers/video-player'
import { calculateFrameCenterTime } from '@/ui/components/viewers/utils'
import type { MediaController } from '@/ui/components/viewers/types'
import VideoPlayer from '@/ui/components/viewers/video/video-viewer'
import { calculateFrameCenterTime } from '@/ui/components/viewers/video/utils'
import { useUiStore } from '@/ui/stores/ui'
import {
SAMPLE_FRAME_RATE,
sampleVideoAsset,
containerLongerVideoAsset,
longAudioVideoAsset,
sampleAudioAsset,
} from './fixture'
/**
@@ -58,6 +59,7 @@ function resolveAsset() {
: null
if (variant === 'container-longer') return containerLongerVideoAsset
if (variant === 'long-audio') return longAudioVideoAsset
if (variant === 'audio') return sampleAudioAsset
return sampleVideoAsset
}
@@ -70,7 +72,7 @@ interface HarnessComment {
}
function Harness(): ReactElement {
const playerRef = useRef<Player | null>(null)
const playerRef = useRef<MediaController | null>(null)
// Latest player time (seconds) as reported by the real onTimeUpdate prop.
const currentTimeRef = useRef<number>(0)
const seekInputRef = useRef<HTMLInputElement>(null)
@@ -92,7 +94,7 @@ function Harness(): ReactElement {
if (!player) return
const frame = Number.parseInt(seekInputRef.current?.value ?? '', 10)
if (Number.isNaN(frame)) return
player.currentTime(calculateFrameCenterTime(frame, SAMPLE_FRAME_RATE))
player.seekTo(calculateFrameCenterTime(frame, SAMPLE_FRAME_RATE))
player.pause()
}, [])
@@ -114,7 +116,7 @@ function Harness(): ReactElement {
const handleCommentClick = useCallback((second: number) => {
const player = playerRef.current
if (!player) return
player.currentTime(second)
player.seekTo(second)
player.pause()
}, [])
@@ -132,8 +134,8 @@ function Harness(): ReactElement {
<div className="flex flex-col flex-1 h-full overflow-hidden relative">
<VideoPlayer
key={playerKey}
data={harnessAsset}
playerRef={playerRef}
file={harnessAsset}
ref={playerRef}
onTimeUpdate={handleTimeUpdate}
/>
</div>
+4
View File
@@ -30,6 +30,10 @@ const server = Bun.serve({
new Response(Bun.file(join(fixturesDir, 'sample-long-audio.mp4')), {
headers: { 'Content-Type': 'video/mp4' },
}),
'/sample-audio.mp4': () =>
new Response(Bun.file(join(fixturesDir, 'sample-audio.mp4')), {
headers: { 'Content-Type': 'video/mp4' },
}),
'/': index,
'/*': index,
},
@@ -51,6 +51,11 @@ export class CommentSeekPage {
await this.waitUntilReady()
}
async gotoVariant(variant: string): Promise<void> {
await this.page.goto(`/?variant=${encodeURIComponent(variant)}`)
await this.waitUntilReady()
}
/** Wait until the video.js engine has metadata and a usable frame readout. */
async waitUntilReady(): Promise<void> {
await this.video.waitFor({ state: 'attached' })
@@ -0,0 +1,34 @@
import { expect, test } from '@playwright/test'
import { VideoPlayerPage } from '../pages/video-player.page'
test.beforeEach(async ({ page }) => {
await page.route(/^https?:\/\/[^/]+\/(api|files)\//, (route) =>
route.fulfill({ status: 200, contentType: 'application/json', body: '{}' }),
)
})
test.describe('audio player e2e', () => {
test('playhead advances immediately without freeze on play', async ({ page }) => {
const vp = new VideoPlayerPage(page)
await vp.gotoVariant('audio')
await vp.muteNativeVideo()
// Starts paused at frame 0.
const initial = await vp.snapshot()
expect(initial.paused).toBe(true)
expect(initial.readoutFrame).toBe(0)
// Play via the control
await vp.clickPlayToggle()
await expect.poll(() => vp.isPaused(), { timeout: 5_000 }).toBe(false)
// Wait for 300ms. If the playhead froze (which happened under the bug where
// it waited 1000ms for rVFC grace period), readoutFrame would still be 0.
// With the fix, the playhead should advance immediately.
await page.waitForTimeout(300)
const afterPlay = await vp.snapshot()
expect(afterPlay.readoutFrame).toBeGreaterThan(0)
expect(afterPlay.currentTime).toBeGreaterThan(0)
})
})
@@ -107,4 +107,73 @@ test.describe('video player comment seek roundtrip', () => {
expect(seen.nativeFrame).toBe(frame)
}
})
test('user A comments on 5 random frames in an audio file, user B seeks back to each', async ({
page,
}, testInfo) => {
const audioTotalFrames = 90
const frames = pickRandomFramesForTotal(COMMENT_COUNT, audioTotalFrames)
// Record the sampled frames so a failing run is reproducible.
testInfo.annotations.push({ type: 'random-frames-audio', description: frames.join(', ') })
const cs = new CommentSeekPage(page)
await cs.gotoVariant('audio')
await cs.muteNativeVideo()
// Starts paused at frame 0.
const initial = await cs.snapshot()
expect(initial.paused).toBe(true)
expect(initial.readoutFrame).toBe(0)
// -- Phase A: user A authors a comment on each random frame. --
for (const frame of frames) {
await cs.seekToFrame(frame)
// The frame user A is actually looking at (readout and native clock agree).
const authored = await cs.snapshot()
expect(authored.paused).toBe(true)
expect(authored.readoutFrame).toBe(frame)
expect(authored.nativeFrame).toBe(frame)
await cs.clickCreateComment()
// Goal 1: the comment is stored at exactly the frame user A saw.
const commentFrames = await cs.commentFrames()
expect(commentFrames[commentFrames.length - 1]).toBe(frame)
}
// All five comments exist and correspond, in order, to the authored frames.
expect(await cs.commentCount()).toBe(COMMENT_COUNT)
expect(await cs.commentFrames()).toEqual(frames)
// -- Phase B: a second user opens the page fresh (player remounts at 0). --
await cs.reloadAsUserB()
await cs.muteNativeVideo()
const afterReload = await cs.snapshot()
expect(afterReload.readoutFrame).toBe(0)
// Clicking each comment lands the player back on exactly user A's frame.
const commentFrames = await cs.commentFrames()
for (let index = 0; index < commentFrames.length; index++) {
const frame = commentFrames[index]
await cs.clickCommentByIndex(index)
await cs.waitUntilSettledOn(frame)
// Goal 2: user B sees exactly the frame user A commented on.
const seen = await cs.snapshot()
expect(seen.paused).toBe(true)
expect(seen.readoutFrame).toBe(frame)
expect(seen.nativeFrame).toBe(frame)
}
})
})
function pickRandomFramesForTotal(count: number, total: number): number[] {
const min = 1
const max = total - 2
const chosen = new Set<number>()
while (chosen.size < count) {
chosen.add(min + Math.floor(Math.random() * (max - min + 1)))
}
return [...chosen].sort((a, b) => a - b)
}
+9 -6
View File
@@ -1,4 +1,5 @@
import { differenceInDays, format, isToday, isYesterday, parseISO } from 'date-fns'
import { m } from '@/ui/paraglide/messages.js'
export const formatTimeAgo = (dateString: string) => {
const date = parseISO(dateString)
@@ -11,14 +12,15 @@ export const formatTimeAgo = (dateString: string) => {
const time = format(date, 'HH:mm')
if (isToday(date)) {
return `Today ${time}`
return m.today_with_time({ time })
}
if (isYesterday(date)) {
return `Yesterday ${time}`
return m.yesterday_with_time({ time })
}
const daysAgo = differenceInDays(now, date)
return `${daysAgo >= 0 ? daysAgo : 0} days ago`
const count = daysAgo >= 0 ? daysAgo : 0
return count === 1 ? m.n_days_ago_singular({ count }) : m.n_days_ago_plural({ count })
}
export const formatDateAgo = (dateString: string) => {
@@ -30,12 +32,13 @@ export const formatDateAgo = (dateString: string) => {
}
if (isToday(date)) {
return 'Today'
return m.today()
}
if (isYesterday(date)) {
return 'Yesterday'
return m.yesterday()
}
const daysAgo = differenceInDays(now, date)
return `${daysAgo >= 0 ? daysAgo : 0} days ago`
const count = daysAgo >= 0 ? daysAgo : 0
return count === 1 ? m.n_days_ago_singular({ count }) : m.n_days_ago_plural({ count })
}
+22 -1
View File
@@ -646,6 +646,8 @@
"all": "All",
"unread": "Unread",
"mark_all_as_read": "Mark all as read",
"mark_as_complete": "Mark as complete",
"mark_as_incomplete": "Mark as incomplete",
"no_notifications": "No notifications",
"unknown_date": "Unknown Date",
@@ -798,5 +800,24 @@
"failed_fetch_files": "Failed to fetch files",
"failed_remove": "Failed to remove",
"failed_update": "Failed to update",
"failed_fetch_fields": "Failed to fetch fields"
"failed_fetch_fields": "Failed to fetch fields",
"project": "project",
"team": "team",
"owner": "Owner",
"n_files_singular": "{count} file",
"n_files_plural": "{count} files",
"files_progress": "{uploaded} / {total} files",
"n_tasks_singular": "{count} task",
"n_tasks_plural": "{count} tasks",
"n_days_ago_singular": "{count} day ago",
"n_days_ago_plural": "{count} days ago",
"today_with_time": "Today {time}",
"yesterday_with_time": "Yesterday {time}",
"n_items_singular": "{count} Item",
"n_items_plural": "{count} Items",
"fullscreen": "Fullscreen",
"created_by_at": "{time} by {author}",
"date_format_long": "MMMM d, yyyy",
"tool_result_with_name": "Tool Result: {name}",
"reply_to_message": "reply to: {message}"
}
+44 -23
View File
@@ -13,7 +13,7 @@
"select_a_team": "选择团队",
"projects": "项目",
"select_asset_to_view_details": "选择资产查看详情",
"all_collections": "所有收藏集",
"all_collections": "所有媒体合集",
"file_not_found": "文件未找到。",
"recently_deleted_notice": "项目将在 30 天后自动删除。",
"all_share_links": "所有分享链接",
@@ -128,21 +128,21 @@
"all_files": "全部文件",
"recently_deleted": "最近删除",
"collections": "收藏集",
"collections": "媒体合集",
"shares": "分享",
"no_collections_yet": "暂无收藏集。",
"collection_name": "收藏集名称",
"no_collections_yet": "暂无媒体合集。",
"collection_name": "媒体合集名称",
"creator": "创建者",
"created_date": "创建日期",
"collection_created": "收藏集已创建",
"failed_create_collection": "创建收藏集失败",
"failed_save_collection": "保存收藏集失败",
"loading_collection": "正在加载收藏集...",
"untitled_collection": "未命名收藏集",
"collection_saved": "收藏集已保存",
"collection_renamed": "收藏集已重命名",
"collection_deleted": "收藏集已删除",
"collection_created": "媒体合集已创建",
"failed_create_collection": "创建媒体合集失败",
"failed_save_collection": "保存媒体合集失败",
"loading_collection": "正在加载媒体合集...",
"untitled_collection": "未命名媒体合集",
"collection_saved": "媒体合集已保存",
"collection_renamed": "媒体合集已重命名",
"collection_deleted": "媒体合集已删除",
"no_share_links_yet": "暂无分享链接。",
"share_link_created": "分享链接已创建",
@@ -467,13 +467,13 @@
"folder_tree_assets": "资产",
"share_links": "分享链接",
"all_collections_count": "所有收藏集 ({count})",
"all_collections_count": "所有媒体合集 ({count})",
"all_share_links_count": "所有分享链接 ({count})",
"rename_collection": "重命名收藏集",
"rename_collection": "重命名媒体合集",
"rename_share_link": "重命名分享链接",
"rename_folder": "重命名文件夹",
"enter_new_name": "输入新名称",
"delete_collection_confirm": "删除收藏集?",
"delete_collection_confirm": "删除媒体合集?",
"delete_share_link_confirm": "删除分享链接?",
"delete_folder_confirm": "删除文件夹?",
"delete_confirm_description": "确定要删除此{type}吗?此操作无法撤销。",
@@ -582,8 +582,8 @@
"team_member": "团队成员",
"project_member": "项目成员",
"editor": "编辑者",
"reviewer": "审阅者",
"editor": "创作者",
"reviewer": "评审员",
"remove_member": "移除成员",
"remove_member_confirmation": "确定要从此{type}中移除 {name} 吗?此操作无法撤销。",
"member_role_updated": "成员角色已更新",
@@ -646,6 +646,8 @@
"all": "全部",
"unread": "未读",
"mark_all_as_read": "全部标记为已读",
"mark_as_complete": "标记为已完成",
"mark_as_incomplete": "标记为未完成",
"no_notifications": "暂无通知",
"unknown_date": "未知日期",
@@ -727,7 +729,7 @@
"match_found_at": "在以下位置找到匹配",
"matched_items": "匹配了 {count} 项",
"saving_ellipsis": "保存中...",
"save_as_collection": "保存为收藏集",
"save_as_collection": "保存为媒体合集",
"apply_and_close": "应用并关闭",
"generating": "正在生成...",
@@ -767,16 +769,16 @@
"media_not_available": "媒体不可用。",
"original": "原始",
"collection": "收藏集",
"collection": "媒体合集",
"share_link": "分享链接",
"failed_fetch_share_links": "获取分享链接失败",
"failed_fetch_collections": "获取收藏集失败",
"failed_fetch_collections": "获取媒体合集失败",
"failed_create_share_link": "创建分享链接失败",
"failed_rename_folder": "重命名文件夹失败",
"failed_delete_folder": "删除文件夹失败",
"failed_rename_collection": "重命名收藏集失败",
"failed_delete_collection": "删除收藏集失败",
"failed_rename_collection": "重命名媒体合集失败",
"failed_delete_collection": "删除媒体合集失败",
"failed_rename_share_link": "重命名分享链接失败",
"failed_delete_share_link": "删除分享链接失败",
"failed_to_fetch_folder_children": "获取子文件夹失败",
@@ -798,5 +800,24 @@
"failed_fetch_files": "获取文件失败",
"failed_remove": "移除失败",
"failed_update": "更新失败",
"failed_fetch_fields": "获取字段列表失败"
"failed_fetch_fields": "获取字段列表失败",
"project": "项目",
"team": "团队",
"owner": "管理员",
"n_files_singular": "{count} 个文件",
"n_files_plural": "{count} 个文件",
"files_progress": "{uploaded} / {total} 个文件",
"n_tasks_singular": "{count} 个任务",
"n_tasks_plural": "{count} 个任务",
"n_days_ago_singular": "{count} 天前",
"n_days_ago_plural": "{count} 天前",
"today_with_time": "今天 {time}",
"yesterday_with_time": "昨天 {time}",
"n_items_singular": "{count} 个项目",
"n_items_plural": "{count} 个项目",
"fullscreen": "全屏",
"created_by_at": "{time} 由 {author} 创建",
"date_format_long": "yyyy年M月d日",
"tool_result_with_name": "工具结果:{name}",
"reply_to_message": "回复:{message}"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@shumai/webui",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"main": "./index.html",
+21
View File
@@ -606,6 +606,8 @@ export * from "./notification_generic.js";
export * from "./all.js";
export * from "./unread.js";
export * from "./mark_all_as_read.js";
export * from "./mark_as_complete.js";
export * from "./mark_as_incomplete.js";
export * from "./no_notifications.js";
export * from "./unknown_date.js";
export * from "./today.js";
@@ -746,4 +748,23 @@ export * from "./failed_fetch_files.js";
export * from "./failed_remove.js";
export * from "./failed_update.js";
export * from "./failed_fetch_fields.js";
export * from "./project.js";
export * from "./team.js";
export * from "./owner.js";
export * from "./n_files_singular.js";
export * from "./n_files_plural.js";
export * from "./files_progress.js";
export * from "./n_tasks_singular.js";
export * from "./n_tasks_plural.js";
export * from "./n_days_ago_singular.js";
export * from "./n_days_ago_plural.js";
export * from "./today_with_time.js";
export * from "./yesterday_with_time.js";
export * from "./n_items_singular.js";
export * from "./n_items_plural.js";
export * from "./fullscreen.js";
export * from "./created_by_at.js";
export * from "./date_format_long.js";
export * from "./tool_result_with_name.js";
export * from "./reply_to_message.js";
export type LocalizedString = import("../runtime.js").LocalizedString;
+22 -1
View File
@@ -608,6 +608,8 @@ export * from './notification_generic.js'
export * from './all.js'
export * from './unread.js'
export * from './mark_all_as_read.js'
export * from './mark_as_complete.js'
export * from './mark_as_incomplete.js'
export * from './no_notifications.js'
export * from './unknown_date.js'
export * from './today.js'
@@ -747,4 +749,23 @@ export * from './failed_fetch_folders.js'
export * from './failed_fetch_files.js'
export * from './failed_remove.js'
export * from './failed_update.js'
export * from './failed_fetch_fields.js'
export * from './failed_fetch_fields.js'
export * from './project.js'
export * from './team.js'
export * from './owner.js'
export * from './n_files_singular.js'
export * from './n_files_plural.js'
export * from './files_progress.js'
export * from './n_tasks_singular.js'
export * from './n_tasks_plural.js'
export * from './n_days_ago_singular.js'
export * from './n_days_ago_plural.js'
export * from './today_with_time.js'
export * from './yesterday_with_time.js'
export * from './n_items_singular.js'
export * from './n_items_plural.js'
export * from './fullscreen.js'
export * from './created_by_at.js'
export * from './date_format_long.js'
export * from './tool_result_with_name.js'
export * from './reply_to_message.js'
+1 -1
View File
@@ -10,7 +10,7 @@ const en_all_collections = /** @type {(inputs: All_CollectionsInputs) => Localiz
};
const zh_all_collections = /** @type {(inputs: All_CollectionsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`所有收藏集`)
return /** @type {LocalizedString} */ (`所有媒体合集`)
};
/**
+1 -1
View File
@@ -10,7 +10,7 @@ const en_all_collections_count = /** @type {(inputs: All_Collections_CountInputs
};
const zh_all_collections_count = /** @type {(inputs: All_Collections_CountInputs) => LocalizedString} */ (i) => {
return /** @type {LocalizedString} */ (`所有收藏集 (${i?.count})`)
return /** @type {LocalizedString} */ (`所有媒体合集 (${i?.count})`)
};
/**
+1 -1
View File
@@ -10,7 +10,7 @@ const en_collection = /** @type {(inputs: CollectionInputs) => LocalizedString}
};
const zh_collection = /** @type {(inputs: CollectionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`收藏集`)
return /** @type {LocalizedString} */ (`媒体合集`)
};
/**
+1 -1
View File
@@ -10,7 +10,7 @@ const en_collection_created = /** @type {(inputs: Collection_CreatedInputs) => L
};
const zh_collection_created = /** @type {(inputs: Collection_CreatedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`收藏集已创建`)
return /** @type {LocalizedString} */ (`媒体合集已创建`)
};
/**

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