mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 12:24:39 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0899a7e59d | ||
|
|
d315253450 | ||
|
|
a049f50c3e | ||
|
|
6b2648fe28 | ||
|
|
c654a4fe03 | ||
|
|
90f076f3ba | ||
|
|
fee6f39828 | ||
|
|
1066900c78 | ||
|
|
f2febaf652 | ||
|
|
5a1655e4ef | ||
|
|
e32445684f | ||
|
|
9c8eb16259 |
@@ -125,7 +125,7 @@ An **Operation** is defined once and exposed across built-in agent tools, the MC
|
||||
- **Route Code-Splitting**: Split all routes into `[route].tsx` (route definition and loaders) and `[route].lazy.tsx` (UI component and heavy imports).
|
||||
- **Radix / Shadcn UI**: Set `modal={false}` on `<DropdownMenu>` when triggering a `Dialog` or `AlertDialog` from inside it to prevent focus-trap UI freezes. Use `ScrollArea` (`@/ui/components/ui/scroll-area`) for scrollable containers.
|
||||
- **Pagination & Infinite Scroll**: Use `useInfiniteQuery` + `react-intersection-observer` with default `limit: 20` and the API's `total` field. Backend list APIs use `paginateQuery` from `packages/core/src/pagination.ts` (default `limit: 20`).
|
||||
- **Internationalization (i18n)**: Hardcoded UI text is strictly forbidden. Add `snake_case` keys to both `packages/webui/messages/en.json` and `packages/webui/messages/zh.json`, run `bun run i18n:compile` (or `bun run i18n:watch`), and import `m` from `@/ui/paraglide/messages.js`.
|
||||
- **Internationalization (i18n)**: Hardcoded UI text is strictly forbidden. Add `snake_case` keys to **all** locale files in `packages/webui/messages/*.json` (do not assume only `en.json` and `zh.json` exist; check the directory for all supported languages), run `bun run i18n:compile` (or `bun run i18n:watch`), and import `m` from `@/ui/paraglide/messages.js`.
|
||||
|
||||
## Database & Prisma (`packages/db`)
|
||||
|
||||
|
||||
@@ -12,6 +12,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
### Changed
|
||||
|
||||
- **provider**: Refresh models for individual AI providers in Settings and choose which models to add. Use Add Provider to set up a new provider.
|
||||
|
||||
## [0.7.2] - 2026-11-27
|
||||
|
||||
### Added
|
||||
|
||||
- **comments**: Add Internal Comments with a Public/Internal selector in the comment composer so team and project members can have private discussions (marked with a lock icon) that never appear on public share links.
|
||||
- **comments**: Allow comment authors to edit their comments inline from the comment menu, including updating text, switching between Public and Internal, removing timestamps, and adding or removing attachments.
|
||||
|
||||
- **comments**: Add a "Print Comments" option in the comments menu (available in both project file views and public share links) that opens a dedicated print-friendly page with asset metadata, comment thumbnails, visual markup overlays, replies, completion status, emoji reactions, and attachments.
|
||||
|
||||
- **share**: See view counts, last viewed times, and activity for public share links, including file and folder views, downloads, and comments.
|
||||
|
||||
- **share**: Add options to create a share link or add to existing share links directly from the media view dropdown menu, and open a quick share dialog with inline renaming, one-click link copying, and security settings upon creation.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **video**: Pause playback while dragging the seekbar and show a lightweight preview in the player until the selected frame is ready.
|
||||
- **comments**: Keep password-protected print links on the share password prompt, keep private folder names out of shared print data, and wait for thumbnails and reply drawings before printing.
|
||||
- **security**: Security improvements.
|
||||
|
||||
### Changed
|
||||
|
||||
## [0.7.1] - 2026-11-23
|
||||
|
||||
### Added
|
||||
@@ -36,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
### Fixed
|
||||
|
||||
- **video**: Fix playback stalling after tapping or clicking the progress bar on slow connections, and stop the hidden seek preview from downloading the whole video in the background.
|
||||
- **cli**: Fix release publication failing to find staged standalone downloads.
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<a href="https://github.com/shumaiOne/shumai/releases"><img alt="GitHub latest release" src="https://img.shields.io/github/v/release/shumaiOne/shumai" /></a>
|
||||
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
|
||||
<a target="_blank" href="https://deepwiki.com/shumaiOne/shumai"><img alt="Ask DeepWiki" src="https://img.shields.io/badge/Ask-DeepWiki-6E56CF" /></a>
|
||||
<a target="_blank" href="https://docs.qq.com/doc/DUmJRWndFVWJPQVRI"><img alt="微信群" src="https://img.shields.io/badge/WeChat-%E5%BE%AE%E4%BF%A1%E7%BE%A4-07C160" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<a href="https://github.com/shumaiOne/shumai/releases"><img alt="GitHub latest release" src="https://img.shields.io/github/v/release/shumaiOne/shumai" /></a>
|
||||
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
|
||||
<a target="_blank" href="https://deepwiki.com/shumaiOne/shumai"><img alt="Ask DeepWiki" src="https://img.shields.io/badge/Ask-DeepWiki-6E56CF" /></a>
|
||||
<a target="_blank" href="https://docs.qq.com/doc/DUmJRWndFVWJPQVRI"><img alt="微信群" src="https://img.shields.io/badge/WeChat-%E5%BE%AE%E4%BF%A1%E7%BE%A4-07C160" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/premiere-uxp",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -68,6 +68,7 @@ apps/web/e2e/
|
||||
| Owner manages resource quotas in settings and resets usage from the dashboard | `tests/team/quotas-settings.spec.ts` |
|
||||
| Owner creates an API token that is shown once, listed by hint, and authenticates API calls | `tests/team/api-tokens.spec.ts` |
|
||||
| Session logs stay within the dialog and scroll through long messages and expanded records on desktop and narrow screens | `tests/team/agent-session-logs.spec.ts` |
|
||||
| Provider cards show credential status, and the selected provider's model preview scrolls on desktop and mobile | `tests/team/provider-model-refresh.spec.ts` |
|
||||
|
||||
### project
|
||||
| Test | File |
|
||||
@@ -77,8 +78,13 @@ apps/web/e2e/
|
||||
| Owner deletes a file, finds it in recently deleted, and restores it | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner deletes a folder and still sees its contents preview and countdown in recently deleted | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner deletes a version stack and restores it from recently deleted | `tests/project/delete-restore.spec.ts` |
|
||||
| Owner creates a share link from a file context menu and lands on the share page | `tests/project/create-share-link.spec.ts` |
|
||||
| Owner creates a share link from a file context menu, edits it in the quick dialog, and opens advanced settings | `tests/project/create-share-link.spec.ts` |
|
||||
| Owner creates a share link and adds to an existing share link from media view | `tests/project/create-share-link.spec.ts` |
|
||||
| Owner protects a share with a password; guests must enter it to view | `tests/project/share-password.spec.ts` |
|
||||
| Guests can unlock a protected printable comments link directly | `tests/project/share-password.spec.ts` |
|
||||
| Public page views and share activity appear in both management sidebars | `tests/project/share-activity.spec.ts` |
|
||||
| Opening a direct historical version link records the selected version | `tests/project/share-activity.spec.ts` |
|
||||
| Concurrent public opens count every view and deduplicate matching activity | `tests/project/share-activity.spec.ts` |
|
||||
| Owner creates a collection from the sidebar; the collection shows project files | `tests/project/create-collection.spec.ts` |
|
||||
| Owner invites a member to a project; the member only sees the invited project | `tests/project/invite-member.spec.ts` |
|
||||
| Owner changes a project member role in the members dialog and permissions update | `tests/project/change-member-role.spec.ts` |
|
||||
@@ -113,6 +119,8 @@ apps/web/e2e/
|
||||
| Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` |
|
||||
| Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` |
|
||||
| Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` |
|
||||
| Create internal and public comments, verify internal comments are hidden on public share links | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
| Author edits comment text, switches to internal, removes timestamp, and updates attachments | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
| Show a breathing poster preview and "Preparing..." while a video is still transcoding | `tests/file/processing-preview.spec.ts` |
|
||||
| Show a preparing circle before the poster is generated | `tests/file/processing-preview.spec.ts` |
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { apiAddAssetsToShare, apiCreateShare, fileCard } from '../../helpers/files'
|
||||
|
||||
test('internal comments show lock icon in workspace and are hidden on public share pages', async ({
|
||||
browser,
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { context, page, projectId, fileId, fileName } = file
|
||||
const publicText = `Public note ${Date.now()}`
|
||||
const internalText = `Internal secret ${Date.now()}`
|
||||
|
||||
await page.goto(`/projects/${projectId}/files/${fileId}`)
|
||||
|
||||
const editor = page.locator('[contenteditable="true"]').first()
|
||||
const sendBtn = page.locator('button:has(svg.lucide-arrow-up)').last()
|
||||
const visibilityTrigger = page.getByTestId('comment-visibility-trigger')
|
||||
|
||||
// Default visibility is Public
|
||||
await expect(visibilityTrigger).toBeVisible()
|
||||
await expect(visibilityTrigger).toContainText('Public')
|
||||
|
||||
// Post a public comment
|
||||
await editor.fill(publicText)
|
||||
await sendBtn.click()
|
||||
await expect(page.getByText(publicText)).toBeVisible()
|
||||
|
||||
// Switch to Internal and post an internal comment
|
||||
await visibilityTrigger.click()
|
||||
await page.getByTestId('comment-visibility-internal').click()
|
||||
await expect(visibilityTrigger).toContainText('Internal')
|
||||
|
||||
await editor.fill(internalText)
|
||||
await sendBtn.click()
|
||||
await expect(page.getByText(internalText)).toBeVisible()
|
||||
|
||||
// Visibility pill resets to Public after sending
|
||||
await expect(visibilityTrigger).toContainText('Public')
|
||||
|
||||
// Internal comment shows lock icon, public comment does not
|
||||
await expect(page.getByTestId('internal-comment-icon')).toHaveCount(1)
|
||||
|
||||
// Verify DB persisted isInternal flags
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const comments = await prisma.assetComment.findMany({
|
||||
where: { assetId: fileId },
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
return comments.map((c) => ({ message: c.message, isInternal: c.isInternal }))
|
||||
})
|
||||
.toEqual([
|
||||
{ message: publicText, isInternal: false },
|
||||
{ message: internalText, isInternal: true },
|
||||
])
|
||||
|
||||
// Create a public share link for this file
|
||||
const share = await apiCreateShare(context.request, projectId, 'External Review Share')
|
||||
await apiAddAssetsToShare(context.request, share.id, [fileId])
|
||||
|
||||
// Open public share page as an unauthenticated guest
|
||||
const guestContext = await browser.newContext()
|
||||
try {
|
||||
const guestPage = await guestContext.newPage()
|
||||
await guestPage.goto(`/share/${share.id}`)
|
||||
|
||||
// File card comment badge should only count the 1 public comment
|
||||
const card = fileCard(guestPage, fileName)
|
||||
await expect(card).toBeVisible()
|
||||
await expect(card).toContainText('1')
|
||||
|
||||
// Open the shared file
|
||||
await card.dblclick()
|
||||
await expect(guestPage.getByText(publicText)).toBeVisible()
|
||||
await expect(guestPage.getByText(internalText)).toHaveCount(0)
|
||||
await expect(guestPage.getByTestId('comment-visibility-trigger')).toHaveCount(0)
|
||||
} finally {
|
||||
await guestContext.close()
|
||||
}
|
||||
})
|
||||
|
||||
test.describe('author edits comment with timestamp and attachments', () => {
|
||||
test.use({ fileOptions: { mediaType: 'audio' } })
|
||||
|
||||
test('author edits comment text, switches to internal, removes timestamp, and updates attachments', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, projectId, fileId } = file
|
||||
const originalText = `Initial audio note ${Date.now()}`
|
||||
const editedText = `Edited private note ${Date.now()}`
|
||||
|
||||
// Wait for audio transcode completion
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const asset = await prisma.asset.findUnique({ where: { id: fileId } })
|
||||
return asset?.status
|
||||
},
|
||||
{ timeout: 30_000 },
|
||||
)
|
||||
.toBe('processed')
|
||||
|
||||
await page.goto(`/projects/${projectId}/files/${fileId}`)
|
||||
|
||||
const mediaEl = page.locator('audio, video').first()
|
||||
await expect(mediaEl).toBeVisible({ timeout: 30_000 })
|
||||
|
||||
// Seek to non-zero timestamp
|
||||
await page.evaluate(() => {
|
||||
const el = document.querySelector('audio, video') as HTMLMediaElement | null
|
||||
if (el) el.currentTime = 1
|
||||
})
|
||||
await page.waitForTimeout(500)
|
||||
|
||||
// Attach initial file in composer
|
||||
const composerFileInput = page.locator('input[type="file"]').last()
|
||||
await composerFileInput.setInputFiles({
|
||||
name: 'old-attachment.txt',
|
||||
mimeType: 'text/plain',
|
||||
buffer: Buffer.from('old attachment content'),
|
||||
})
|
||||
await expect(page.getByText('old-attachment.txt')).toBeVisible()
|
||||
|
||||
// Submit public comment with timestamp and attachment
|
||||
const editor = page.locator('[contenteditable="true"]').first()
|
||||
await editor.fill(originalText)
|
||||
const sendBtn = page.locator('button:has(svg.lucide-arrow-up)').last()
|
||||
await expect(sendBtn).toBeEnabled()
|
||||
await sendBtn.click()
|
||||
|
||||
await expect(page.getByText(originalText)).toBeVisible()
|
||||
await expect(page.getByText('old-attachment.txt')).toBeVisible()
|
||||
|
||||
// Wait for DB persistence
|
||||
await expect
|
||||
.poll(async () => {
|
||||
return prisma.assetComment.findFirst({
|
||||
where: { assetId: fileId, message: originalText },
|
||||
})
|
||||
})
|
||||
.not.toBeNull()
|
||||
|
||||
// Open three-dot menu on comment card and click Edit
|
||||
const moreBtn = page.getByRole('button', { name: 'More options' }).last()
|
||||
await moreBtn.click({ force: true })
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click()
|
||||
|
||||
const editForm = page.getByTestId('comment-edit-form')
|
||||
await expect(editForm).toBeVisible()
|
||||
|
||||
// Remove timestamp
|
||||
await expect(editForm.getByTestId('edit-comment-timestamp')).toBeVisible()
|
||||
await editForm.getByTestId('edit-comment-remove-timestamp').click()
|
||||
await expect(editForm.getByTestId('edit-comment-timestamp')).toHaveCount(0)
|
||||
|
||||
// Remove existing attachment
|
||||
await editForm.getByTestId('edit-existing-attachment').locator('button').click()
|
||||
await expect(editForm.getByTestId('edit-existing-attachment')).toHaveCount(0)
|
||||
|
||||
// Add a new attachment
|
||||
await editForm.getByTestId('edit-comment-file-input').setInputFiles({
|
||||
name: 'new-attachment.txt',
|
||||
mimeType: 'text/plain',
|
||||
buffer: Buffer.from('new attachment content'),
|
||||
})
|
||||
await expect(editForm.getByText('new-attachment.txt')).toBeVisible()
|
||||
|
||||
// Switch Public -> Internal
|
||||
await editForm.getByTestId('comment-visibility-trigger').click()
|
||||
await page.getByTestId('comment-visibility-internal').click()
|
||||
await expect(editForm.getByTestId('comment-visibility-trigger')).toContainText('Internal')
|
||||
|
||||
// Change comment text
|
||||
const editInput = editForm.getByTestId('edit-comment-input')
|
||||
await editInput.click()
|
||||
await page.keyboard.press('ControlOrMeta+a')
|
||||
await page.keyboard.type(editedText)
|
||||
|
||||
// Save
|
||||
const saveBtn = editForm.getByTestId('edit-comment-save')
|
||||
await expect(saveBtn).toBeEnabled()
|
||||
await saveBtn.click()
|
||||
|
||||
await expect(editForm).toHaveCount(0)
|
||||
await expect(page.getByText(editedText)).toBeVisible()
|
||||
await expect(page.getByText('new-attachment.txt')).toBeVisible()
|
||||
await expect(page.getByText('old-attachment.txt')).toHaveCount(0)
|
||||
await expect(page.getByTestId('internal-comment-icon')).toHaveCount(1)
|
||||
|
||||
// Reload and verify persistence in UI and DB
|
||||
await page.reload()
|
||||
await expect(page.getByText(editedText)).toBeVisible()
|
||||
await expect(page.getByText('new-attachment.txt')).toBeVisible()
|
||||
await expect(page.getByTestId('internal-comment-icon')).toHaveCount(1)
|
||||
|
||||
const updated = await prisma.assetComment.findFirst({
|
||||
where: { assetId: fileId, message: editedText },
|
||||
include: { attachments: { include: { asset: true } } },
|
||||
})
|
||||
expect(updated).not.toBeNull()
|
||||
expect(updated?.isInternal).toBe(true)
|
||||
expect(updated?.second).toBeNull()
|
||||
expect(updated?.attachments.map((a) => a.asset.name)).toEqual(['new-attachment.txt'])
|
||||
})
|
||||
})
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { fileCard } from '../../helpers/files'
|
||||
import { apiCreateShare, fileCard } from '../../helpers/files'
|
||||
|
||||
test('owner creates a share link from a file context menu and lands on the share page', async ({
|
||||
test('owner creates a share link from a file context menu, edits it in the quick dialog, and opens advanced settings', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
@@ -14,19 +14,38 @@ test('owner creates a share link from a file context menu and lands on the share
|
||||
await fileCard(page, fileName).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Create Share Link' }).click()
|
||||
|
||||
// The toast offers a "View" action that navigates to the share page
|
||||
const toast = page.locator('[data-sonner-toast]').filter({ hasText: 'Share link created' })
|
||||
await expect(toast).toBeVisible()
|
||||
await toast.getByRole('button', { name: 'View' }).click()
|
||||
// Quick share dialog opens with share name, URL, security controls, and footer actions
|
||||
const dialog = page.getByRole('dialog')
|
||||
await expect(dialog).toBeVisible()
|
||||
await expect(dialog.getByText(fileName)).toBeVisible()
|
||||
await expect(dialog.getByRole('button', { name: 'Copy Link' }).last()).toBeVisible()
|
||||
await expect(dialog.getByRole('button', { name: 'Done' })).toBeVisible()
|
||||
|
||||
// Rename share link inline via the pen icon
|
||||
await dialog.getByRole('button', { name: 'Rename Share Link' }).click()
|
||||
const nameInput = dialog.getByRole('textbox', { name: 'Rename Share Link' })
|
||||
await expect(nameInput).toBeVisible()
|
||||
await nameInput.fill('Client Review Cut')
|
||||
await nameInput.press('Enter')
|
||||
await expect(dialog.getByText('Client Review Cut')).toBeVisible()
|
||||
|
||||
// Toggle Allow download off in quick security settings
|
||||
const allowDownloadRow = dialog.getByText('Allow download').locator('..')
|
||||
await allowDownloadRow.getByRole('switch').click()
|
||||
await expect(page.getByText('Settings updated')).toBeVisible()
|
||||
|
||||
// Navigate to full settings via Advanced settings
|
||||
await dialog.getByRole('button', { name: 'Advanced settings' }).click()
|
||||
await expect(page).toHaveURL(/\/projects\/[^/]+\/shares\/[^/]+/)
|
||||
|
||||
// The shared file is listed in the share contents
|
||||
await expect(fileCard(page, fileName)).toBeVisible()
|
||||
|
||||
// DB: the share exists and the file is symlinked under the share root
|
||||
// DB: the share exists with updated settings and the file is symlinked under the share root
|
||||
const share = await prisma.shareLink.findFirst({ where: { projectId } })
|
||||
expect(share).not.toBeNull()
|
||||
expect(share?.name).toBe('Client Review Cut')
|
||||
expect(share?.allowDownload).toBe(false)
|
||||
|
||||
const symlink = await prisma.asset.findFirst({
|
||||
where: { parentId: share?.rootFolderId, targetId: fileId },
|
||||
@@ -34,3 +53,58 @@ test('owner creates a share link from a file context menu and lands on the share
|
||||
expect(symlink).not.toBeNull()
|
||||
expect(symlink?.type).toBe('symlink')
|
||||
})
|
||||
|
||||
test('owner creates a share link and adds to an existing share link from media view', async ({
|
||||
file,
|
||||
prisma,
|
||||
}) => {
|
||||
const { context, page, projectId, fileName, fileId } = file
|
||||
|
||||
// Seed an existing share link so "Add to Share Links" submenu is available
|
||||
const existingShare = await apiCreateShare(context.request, projectId, 'Existing Client Share')
|
||||
|
||||
await page.goto(`/projects/${projectId}/files/${fileId}`)
|
||||
const headerTrigger = page.getByRole('button', { name: fileName })
|
||||
await expect(headerTrigger).toBeVisible()
|
||||
|
||||
// Open the media view header arrow dropdown and create a new share link
|
||||
await headerTrigger.click()
|
||||
await page.getByRole('menuitem', { name: 'Create Share Link' }).click()
|
||||
|
||||
const dialog = page.getByRole('dialog')
|
||||
await expect(dialog).toBeVisible()
|
||||
await expect(dialog.getByText(fileName)).toBeVisible()
|
||||
await expect(page).toHaveURL(new RegExp(`/projects/${projectId}/files/${fileId}$`))
|
||||
|
||||
// Close the dialog with Done and stay on the media view
|
||||
await dialog.getByRole('button', { name: 'Done' }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(page).toHaveURL(new RegExp(`/projects/${projectId}/files/${fileId}$`))
|
||||
|
||||
// DB: new share link created with symlink to the file
|
||||
const createdShare = await prisma.shareLink.findFirst({
|
||||
where: { projectId, id: { not: existingShare.id } },
|
||||
})
|
||||
expect(createdShare).not.toBeNull()
|
||||
expect(createdShare?.name).toBe(fileName)
|
||||
|
||||
const createdSymlink = await prisma.asset.findFirst({
|
||||
where: { parentId: createdShare?.rootFolderId, targetId: fileId },
|
||||
})
|
||||
expect(createdSymlink).not.toBeNull()
|
||||
expect(createdSymlink?.type).toBe('symlink')
|
||||
|
||||
// Open the header dropdown again and add the file to the existing share link
|
||||
await headerTrigger.click()
|
||||
await page.getByRole('menuitem', { name: 'Add to Share Links' }).hover()
|
||||
await page.getByRole('menuitem', { name: 'Existing Client Share' }).click()
|
||||
|
||||
const addedToast = page.locator('[data-sonner-toast]').filter({ hasText: 'Added to share link' })
|
||||
await expect(addedToast).toBeVisible()
|
||||
|
||||
const addedSymlink = await prisma.asset.findFirst({
|
||||
where: { parentId: existingShare.rootFolderId, targetId: fileId },
|
||||
})
|
||||
expect(addedSymlink).not.toBeNull()
|
||||
expect(addedSymlink?.type).toBe('symlink')
|
||||
})
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
import { expect, test } from '../../fixtures'
|
||||
import { apiAddAssetsToShare, apiCreateShare, fileCard } from '../../helpers/files'
|
||||
|
||||
test('counts public page views and shows activity in both share management sidebars', async ({
|
||||
file,
|
||||
browser,
|
||||
prisma,
|
||||
}) => {
|
||||
const { context, page, projectId, rootFolderId, fileId, fileName } = file
|
||||
const folder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Review Folder',
|
||||
projectId,
|
||||
parentId: rootFolderId,
|
||||
type: 'folder',
|
||||
status: 'processed',
|
||||
},
|
||||
})
|
||||
await prisma.asset.update({ where: { id: fileId }, data: { parentId: folder.id } })
|
||||
const share = await apiCreateShare(context.request, projectId, 'Client Review')
|
||||
await apiAddAssetsToShare(context.request, share.id, [folder.id])
|
||||
const password = 'review-password'
|
||||
const lock = await context.request.put(`/api/shares/${share.id}`, { data: { password } })
|
||||
expect(lock.ok()).toBe(true)
|
||||
const readShare = () => prisma.shareLink.findUniqueOrThrow({ where: { id: share.id } })
|
||||
|
||||
await page.goto(`/projects/${projectId}/shares`)
|
||||
await expect(page.getByText('Never viewed')).toBeVisible()
|
||||
|
||||
const guest = await browser.newContext()
|
||||
try {
|
||||
const guestPage = await guest.newPage()
|
||||
await guestPage.goto(`/share/${share.id}`)
|
||||
await guestPage.getByPlaceholder('Enter password').fill(password)
|
||||
await guestPage.getByRole('button', { name: 'Access Share' }).click()
|
||||
await expect(fileCard(guestPage, folder.name)).toBeVisible()
|
||||
await expect.poll(async () => (await readShare()).views).toBe(1)
|
||||
await fileCard(guestPage, folder.name).click()
|
||||
await expect(fileCard(guestPage, fileName)).toBeVisible()
|
||||
await expect.poll(async () => (await readShare()).views).toBe(2)
|
||||
await fileCard(guestPage, fileName).click()
|
||||
await expect.poll(async () => (await readShare()).views).toBe(3)
|
||||
const beforeReload = (await readShare()).lastViewedAt
|
||||
await guestPage.reload()
|
||||
await expect.poll(async () => (await readShare()).views).toBe(4)
|
||||
expect((await readShare()).lastViewedAt!.getTime()).toBeGreaterThan(beforeReload!.getTime())
|
||||
|
||||
const downloadResponse = guestPage.waitForResponse((response) =>
|
||||
response.url().endsWith('/download-url'),
|
||||
)
|
||||
await guestPage.getByTestId('default-viewer-download-button').click()
|
||||
const download = await downloadResponse
|
||||
expect(download.status()).toBe(200)
|
||||
|
||||
const comment = await context.request.post(`/api/shares/${share.id}/files/${fileId}/comments`, {
|
||||
headers: { 'x-share-password': password },
|
||||
data: { message: 'Ready for review', attachmentIds: [] },
|
||||
})
|
||||
expect(comment.status()).toBe(201)
|
||||
} finally {
|
||||
await guest.close()
|
||||
}
|
||||
|
||||
await page.reload()
|
||||
const row = page.getByRole('row').filter({ hasText: share.name })
|
||||
await expect(row.getByRole('cell', { name: '4', exact: true })).toBeVisible()
|
||||
await expect(row.locator('time')).toContainText('Today')
|
||||
await row.getByRole('button', { name: 'View Activity' }).click()
|
||||
const sidebar = page.getByRole('dialog', { name: 'Activity' })
|
||||
await expect(sidebar.getByText('Opened Share Link')).toHaveCount(1)
|
||||
await expect(sidebar.getByText('Viewed Asset')).toHaveCount(2)
|
||||
await expect(sidebar.getByText(folder.name)).toBeVisible()
|
||||
await expect(sidebar.getByText('Downloaded')).toBeVisible()
|
||||
await expect(sidebar.getByText('Commented')).toBeVisible()
|
||||
await expect(sidebar.getByText('Someone').first()).toBeVisible()
|
||||
|
||||
await page.goto(`/projects/${projectId}/shares/${share.id}`)
|
||||
await expect(page.getByRole('tab', { name: 'Settings' })).toHaveAttribute('aria-selected', 'true')
|
||||
await page.getByRole('tab', { name: 'Activity' }).click()
|
||||
const tab = page.getByRole('tabpanel', { name: 'Activity' })
|
||||
await expect(tab.getByText('Opened Share Link')).toHaveCount(1)
|
||||
await expect(tab.getByText('Viewed Asset')).toHaveCount(2)
|
||||
await expect(tab.getByText('Commented')).toBeVisible()
|
||||
})
|
||||
|
||||
test('a direct historical version link records the version as the viewed asset', async ({
|
||||
file,
|
||||
browser,
|
||||
prisma,
|
||||
}) => {
|
||||
const { context, projectId, rootFolderId, fileId } = file
|
||||
const stack = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Review Versions',
|
||||
projectId,
|
||||
parentId: rootFolderId,
|
||||
type: 'version_stack',
|
||||
status: 'processed',
|
||||
},
|
||||
})
|
||||
await prisma.asset.update({
|
||||
where: { id: fileId },
|
||||
data: { parentId: stack.id, sortIndex: 'a' },
|
||||
})
|
||||
const oldVersion = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Earlier Cut',
|
||||
projectId,
|
||||
parentId: stack.id,
|
||||
sortIndex: 'b',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
},
|
||||
})
|
||||
const share = await apiCreateShare(context.request, projectId, 'Version Review')
|
||||
await apiAddAssetsToShare(context.request, share.id, [stack.id])
|
||||
const guest = await browser.newContext()
|
||||
try {
|
||||
const page = await guest.newPage()
|
||||
await page.goto(`/share/${share.id}/files/${stack.id}?version=${oldVersion.id}`)
|
||||
await expect
|
||||
.poll(() => prisma.shareActivity.count({ where: { shareLinkId: share.id } }))
|
||||
.toBe(2)
|
||||
const activities = await prisma.shareActivity.findMany({ where: { shareLinkId: share.id } })
|
||||
expect(activities).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ kind: 'share_viewed', assetId: null }),
|
||||
expect.objectContaining({ kind: 'asset_viewed', assetId: oldVersion.id }),
|
||||
]),
|
||||
)
|
||||
const link = await prisma.shareLink.findUniqueOrThrow({ where: { id: share.id } })
|
||||
expect(link.views).toBe(1)
|
||||
} finally {
|
||||
await guest.close()
|
||||
}
|
||||
})
|
||||
|
||||
test('concurrent authorized page opens add every view and one matching activity', async ({
|
||||
project,
|
||||
browser,
|
||||
prisma,
|
||||
}) => {
|
||||
const share = await apiCreateShare(
|
||||
project.context.request,
|
||||
project.projectId,
|
||||
'Concurrent Review',
|
||||
)
|
||||
const guest = await browser.newContext()
|
||||
try {
|
||||
const responses = await Promise.all(
|
||||
Array.from({ length: 8 }, () =>
|
||||
guest.request.post(`/api/shares/${share.id}/views`, { data: {} }),
|
||||
),
|
||||
)
|
||||
expect(responses.map((response) => response.status())).toEqual(Array(8).fill(204))
|
||||
const link = await prisma.shareLink.findUniqueOrThrow({ where: { id: share.id } })
|
||||
expect(link).toMatchObject({ views: 8, lastViewedAt: expect.any(Date) })
|
||||
const activities = await prisma.shareActivity.findMany({ where: { shareLinkId: share.id } })
|
||||
expect(activities).toMatchObject([{ kind: 'share_viewed', userId: null, assetId: null }])
|
||||
} finally {
|
||||
await guest.close()
|
||||
}
|
||||
})
|
||||
@@ -49,3 +49,33 @@ test('owner protects a share with a password and guests must enter it to view',
|
||||
await guestContext.close()
|
||||
}
|
||||
})
|
||||
|
||||
test('a guest can unlock a protected printable comments link directly', async ({
|
||||
file,
|
||||
browser,
|
||||
}) => {
|
||||
const { context, projectId, fileName, fileId } = file
|
||||
const share = await apiCreateShare(context.request, projectId, 'Shared Print')
|
||||
await apiAddAssetsToShare(context.request, share.id, [fileId])
|
||||
const res = await context.request.put(`/api/shares/${share.id}`, {
|
||||
data: { password: 'secret123' },
|
||||
})
|
||||
expect(res.ok()).toBe(true)
|
||||
|
||||
const guestContext = await browser.newContext()
|
||||
const page = await guestContext.newPage()
|
||||
try {
|
||||
await page.goto(`/print/comments/${fileId}?shareId=${share.id}`)
|
||||
const passwordInput = page.getByPlaceholder('Enter password')
|
||||
await expect(passwordInput).toBeVisible()
|
||||
await passwordInput.fill('wrong-password')
|
||||
await page.getByRole('button', { name: 'Confirm' }).click()
|
||||
await expect(page.getByText('Incorrect password. Please try again.')).toBeVisible()
|
||||
await passwordInput.fill('secret123')
|
||||
await page.getByRole('button', { name: 'Confirm' }).click()
|
||||
await expect(page.getByTitle(fileName)).toBeVisible()
|
||||
await expect(page).toHaveURL(`/print/comments/${fileId}?shareId=${share.id}`)
|
||||
} finally {
|
||||
await guestContext.close()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -147,8 +147,10 @@ test('dissolving a shared version stack renders the remaining standalone file na
|
||||
// Share the version stack
|
||||
await fileCard(page, fileB.name).click({ button: 'right' })
|
||||
await page.getByRole('menuitem', { name: 'Create Share Link' }).click()
|
||||
const toast = page.locator('[data-sonner-toast]').filter({ hasText: 'Share link created' })
|
||||
await expect(toast).toBeVisible()
|
||||
const shareDialog = page.getByRole('dialog')
|
||||
await expect(shareDialog).toBeVisible()
|
||||
await shareDialog.getByRole('button', { name: 'Done' }).click()
|
||||
await expect(shareDialog).toBeHidden()
|
||||
|
||||
const share = await prisma.shareLink.findFirstOrThrow({
|
||||
where: { projectId },
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import type { RefreshedProviderModel } from '@shumai/dtos'
|
||||
import { expect, test } from '../../fixtures'
|
||||
|
||||
test('provider cards show credential status and open a scrollable preview for the selected provider', async ({
|
||||
owner,
|
||||
prisma,
|
||||
}) => {
|
||||
const { page, teamId } = owner
|
||||
const provider = await prisma.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: 'OpenAI production',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
apiKey: 'saved-test-key',
|
||||
},
|
||||
},
|
||||
})
|
||||
const missing = await prisma.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: 'Anthropic staging',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
apiKey: 'UNSET_E2E_ANTHROPIC_KEY',
|
||||
},
|
||||
},
|
||||
})
|
||||
const models = Array.from({ length: 48 }, (_, index): RefreshedProviderModel => ({
|
||||
modelId: `test-model-${index + 1}`,
|
||||
name: `Test Model ${index + 1}`,
|
||||
config: {
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
}))
|
||||
|
||||
const releasePreview = Promise.withResolvers<void>()
|
||||
await page.route(
|
||||
`**/api/teams/${teamId}/providers/${provider.id}/models/refresh`,
|
||||
async (route) => {
|
||||
await releasePreview.promise
|
||||
await route.fulfill({
|
||||
json: { status: 'ready', providerUpdatedAt: provider.updatedAt.toISOString(), models },
|
||||
})
|
||||
},
|
||||
)
|
||||
await page.goto(`/teams/${teamId}/settings#providers`)
|
||||
|
||||
const cards = page.locator('main [data-slot="card"]')
|
||||
const openai = cards.filter({ hasText: provider.name })
|
||||
const anthropic = cards.filter({ hasText: missing.name })
|
||||
const refresh = openai.getByRole('button', { name: /Refresh models for OpenAI production/ })
|
||||
await expect(cards.first()).toContainText(provider.name)
|
||||
await expect(openai.getByText('Configured', { exact: true })).toBeVisible()
|
||||
await expect(anthropic.getByText('Configured', { exact: true })).toHaveCount(0)
|
||||
await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toBeEnabled()
|
||||
|
||||
await refresh.focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(refresh).toHaveAttribute('aria-busy', 'true')
|
||||
await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toHaveAttribute(
|
||||
'aria-busy',
|
||||
'false',
|
||||
)
|
||||
releasePreview.resolve()
|
||||
|
||||
const dialog = page.getByRole('dialog', { name: 'New models for OpenAI production' })
|
||||
await expect(dialog).toBeVisible()
|
||||
await expect(dialog.getByRole('checkbox', { name: 'Test Model 1 test-model-1' })).toBeVisible()
|
||||
|
||||
for (const viewport of [
|
||||
{ width: 1280, height: 800 },
|
||||
{ width: 390, height: 640 },
|
||||
]) {
|
||||
await page.setViewportSize(viewport)
|
||||
await expect
|
||||
.poll(() =>
|
||||
dialog.locator('[data-slot="scroll-area-viewport"]').evaluate((element) => {
|
||||
const scrollAreaBounds = element.getBoundingClientRect()
|
||||
const dialogBounds = element.closest('[role="dialog"]')?.getBoundingClientRect()
|
||||
return (
|
||||
dialogBounds !== undefined &&
|
||||
dialogBounds.left >= 0 &&
|
||||
dialogBounds.right <= window.innerWidth &&
|
||||
dialogBounds.top >= 0 &&
|
||||
dialogBounds.bottom <= window.innerHeight &&
|
||||
scrollAreaBounds.bottom < dialogBounds.bottom &&
|
||||
element.scrollHeight > element.clientHeight
|
||||
)
|
||||
}),
|
||||
)
|
||||
.toBe(true)
|
||||
}
|
||||
|
||||
await dialog.getByRole('button', { name: 'Cancel' }).click()
|
||||
await expect(dialog).toBeHidden()
|
||||
await expect(refresh).toBeFocused()
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
},
|
||||
"apps/cli": {
|
||||
"name": "@shumai/cli",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"bin": {
|
||||
"shumai-cli": "./src/index.ts",
|
||||
},
|
||||
@@ -59,7 +59,7 @@
|
||||
},
|
||||
"apps/premiere-uxp": {
|
||||
"name": "@shumai/premiere-uxp",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@shumai/api": "workspace:*",
|
||||
"@shumai/dtos": "workspace:*",
|
||||
@@ -113,7 +113,7 @@
|
||||
},
|
||||
"apps/transcode": {
|
||||
"name": "@shumai/transcode-app",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"bin": {
|
||||
"shumai-transcode": "./src/index.ts",
|
||||
},
|
||||
@@ -125,7 +125,7 @@
|
||||
},
|
||||
"apps/web": {
|
||||
"name": "@shumai/web-app",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/api": "workspace:*",
|
||||
@@ -145,11 +145,11 @@
|
||||
},
|
||||
"packages/agent": {
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -169,10 +169,10 @@
|
||||
},
|
||||
"packages/api": {
|
||||
"name": "@shumai/api",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -190,7 +190,7 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@shumai/core",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@ai-sdk/alibaba": "2.0.38",
|
||||
"@ai-sdk/amazon-bedrock": "5.0.67",
|
||||
@@ -214,9 +214,9 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -254,7 +254,7 @@
|
||||
},
|
||||
"packages/db": {
|
||||
"name": "@shumai/db",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@prisma/adapter-pg": "7.10.0",
|
||||
"@prisma/client": "7.10.0",
|
||||
@@ -269,19 +269,19 @@
|
||||
},
|
||||
"packages/dtos": {
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"zod": "4.5.4",
|
||||
},
|
||||
},
|
||||
"packages/e2e": {
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -294,18 +294,18 @@
|
||||
},
|
||||
"packages/operations": {
|
||||
"name": "@shumai/operations",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"zod": "4.5.4",
|
||||
},
|
||||
},
|
||||
"packages/tableprinter": {
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
},
|
||||
"packages/transcode": {
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
@@ -316,15 +316,15 @@
|
||||
},
|
||||
"packages/webui": {
|
||||
"name": "@shumai/webui",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "1.7.0",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@dnd-kit/abstract": "0.5.0",
|
||||
"@dnd-kit/dom": "0.5.0",
|
||||
"@dnd-kit/react": "0.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@ferrucc-io/emoji-picker": "0.1.2",
|
||||
"@hookform/resolvers": "5.9.1",
|
||||
"@lexical/code": "0.49.0",
|
||||
@@ -421,7 +421,7 @@
|
||||
},
|
||||
"packages/workflow-core": {
|
||||
"name": "@shumai/workflow-core",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"dependencies": {
|
||||
"@dbos-inc/dbos-sdk": "5.2.11",
|
||||
"@shumai/core": "workspace:*",
|
||||
@@ -496,21 +496,21 @@
|
||||
|
||||
"@aws-sdk/core": ["@aws-sdk/core@3.977.9", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@aws-sdk/xml-builder": "^3.972.40", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.33.3", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-reqPFEQrZxDZpeGj4PFMepBeR5LGYHRqq/L0motTzgFkCRBA4rFdaVXDSLYyGHhxVz7sT2PDnPN9CluGSfgyJA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="],
|
||||
"@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-uO5TiSvb6j1w9RTe5z28OaOmsrOxVQUPaC5+wZl50RfOXcrYD/KgnS8I9lfyGXc7sGbkCopK6VnhNIAoLqfewQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="],
|
||||
"@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.82", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-vQzlDHlC24Yz42p+rT4NBoP/5VdetkBoujbOLq9h6QYWC8THuZSPYnXIR9OP3XcOrdMgPBBipOrdssfxnIiWUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="],
|
||||
"@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.25", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/credential-provider-env": "^3.972.80", "@aws-sdk/credential-provider-http": "^3.972.82", "@aws-sdk/credential-provider-login": "^3.972.87", "@aws-sdk/credential-provider-process": "^3.972.80", "@aws-sdk/credential-provider-sso": "^3.973.24", "@aws-sdk/credential-provider-web-identity": "^3.972.86", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-b5xl71uCRdWsu7P1VeGpiGuCf6zfYETsSNOv8AmYVTrsgbvTJRXdmmOPVfxkvGGVNsiKkGctClQW3jAn0SZLug=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="],
|
||||
"@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.87", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-C4ZFmcwM+Zj14Z8huVUk54Gv4uzT1ZdzG9cY3Gdh8FePakq7Bss1OFsgZjAhWFOkFOGpBvFBeu0OWjWf8HNKRQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="],
|
||||
"@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.82", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-znDkEOGXB8W3kG1LJUKP3foBZY/9qLM0eil/DxWXSp37XsdsRLQHE/d/OaCGGVgKpA6znR38h/+INk8do1FjiA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="],
|
||||
"@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-xqfixO5aclje7tbQJDias+iNND5wp/3QZixCdZcVQpgWPTZ0V5DfTW9A804A5Z7ezu7sH3WRO+vzUjtiJBA8yg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="],
|
||||
"@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.24", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/token-providers": "3.1161.0", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-nlg3BKG03Cgzvv/dMnhxvDJPhAhQSpaN0RUdwgU7ziwkasoev7iI8el8Xy4Rd5sqzgaDUbV269fOXck5SargqA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="],
|
||||
"@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-zKTyLJBEyfQBVlYqT6Jt+mYV4r8kGbWM7dn6v4Y4MRARizhYafjDXP/iMu76UMRhToSPNmIKX1XAb24gtpBFIA=="],
|
||||
|
||||
"@aws-sdk/eventstream-handler-node": ["@aws-sdk/eventstream-handler-node@3.972.34", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-cTeVzpu1xEAkryTZBYhGwnQ6gOGyp8ZYZvmn0Sg/nI/ABmy/CRHHxPDJDUi9PxwxUtGGaatvfRUB3FCgT/rSWw=="],
|
||||
|
||||
@@ -618,17 +618,17 @@
|
||||
|
||||
"@dnd-kit/state": ["@dnd-kit/state@0.5.0", "", { "dependencies": { "@preact/signals-core": "^1.10.0", "tslib": "^2.6.2" } }, "sha512-y7XbabQqjF58Lk8YmDQuR8l6QjN+Kh4qlGEjUvHuIeasLk1QP+9L5diXS98VMxQIivyMmUtX2//f+3N7qPJX4w=="],
|
||||
|
||||
"@earendil-works/chord": ["@earendil-works/chord@1.5.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0" }, "peerDependencies": { "esbuild": "0.28.2", "ws": "8.21.0" }, "optionalPeers": ["esbuild", "ws"] }, "sha512-jf555zbCM21E03DVBDPD/Tuae0lz64YjaHx/athUxNZ/H7phVVb0dWfZsaYnxaXPQ1odW8iHEoVLOlE/prvUPg=="],
|
||||
"@earendil-works/chord": ["@earendil-works/chord@1.7.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0" }, "peerDependencies": { "esbuild": "^0.28.2", "react": "^19.3.0", "ws": "^8.21.0" }, "optionalPeers": ["esbuild", "react", "ws"] }, "sha512-/zBlRrJkNbw0dJ4OrUzk08PC48mzOIFZQKTUE1qxQUWoPlf/xms95lEigzC30MllS+k5qqih7Clg0cTzYgPs1w=="],
|
||||
|
||||
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.5.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0", "@google/genai": "2.21.0", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.19.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-VeWxNqTHSqRCf8AcY/6kvNwh+neRL6MPxZPePVztIQy6qqK9MR/YoCSN/ZgDnIyCD3pqEXgRyQbzk4KV4uvjbg=="],
|
||||
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.7.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@aws-sdk/credential-provider-node": "3.972.82", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@google/genai": "3.6.1", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.59.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-iKryMlUYniwWbU7YU0uS7W0+cGd9c6oJ6PzRLOn8j4+1njG4c+BQq1cNawctx/npDqGeOx8ME7Gkgl6K6arPuw=="],
|
||||
|
||||
"@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.5.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-PLBJZ17AEWGzOlAAcFuOkw3PxkOti0JlFuZQyeF2GRTqbpuYo4k9t8YqUV2uOQVzrUnKdxahwaFUqc1eNS1WAg=="],
|
||||
"@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.7.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-fhCoh8TLxhdRTOWSEplwp39Uv+JTsu9pCqtgu9gorO8zcaw92vsbVI/G89yFs92csTo2+yB7EsJq/+725Vj+eA=="],
|
||||
|
||||
"@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.5.0", "", { "dependencies": { "@earendil-works/chord": "1.5.0", "@earendil-works/pi-ai": "1.5.0", "@earendil-works/pi-codemode": "1.5.0", "@earendil-works/pi-schema": "1.5.0", "@earendil-works/pi-telemetry": "1.5.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-xeBP2vIo5NvsCMQ4Y/V+Z164xQEi9JWiBWHdjn4Z15EnFqV3c0FxJAX26FqyyyintrYyk+Enre94GNcvRlBA5g=="],
|
||||
"@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.7.0", "", { "dependencies": { "@earendil-works/chord": "1.7.0", "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-codemode": "1.7.0", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-qL9PlFfXrirBNt7QR2bjZfviN6ZVcsGTHEqaj6U4Lxqqx9Vtth7LyIuGNlG2chDKMr3/ABamH8qZ9ggMgTGDOQ=="],
|
||||
|
||||
"@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.5.0", "", {}, "sha512-RW0MbT2tR65OY6xMsgB/yVBb7m/RTNwA+9hurSN1vVXfHZRVmVnXbruBPrx/PzbrQnW5yLVlMRWxErGDQtF1Hg=="],
|
||||
"@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.7.0", "", {}, "sha512-skji4McLg9jum3NFWzFa/4QRGEZhMGnSi3QL8b9VljJkc/QopH2/BFuGKI+VcEwYzKGwsd0I8RzvXGnZGfGltQ=="],
|
||||
|
||||
"@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.5.0", "", {}, "sha512-VW3tcVdnNfl/Vk8wHPTzZdKkxcsCOM12ppiO4DXnd9wMxUCmOfLt/wvUnWeKWbTVlVSRg0uqKtnnhE2UCsG2Bw=="],
|
||||
"@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.7.0", "", {}, "sha512-QZkngqktohuFZ2TZuJSXDuUntld4sCMW1tkUPaD4moMEX/z1lwcjycXnd9ChO9HNxm/Jfo+UTiC+N2hkAF9b0w=="],
|
||||
|
||||
"@electric-sql/pglite": ["@electric-sql/pglite@0.4.3", "", {}, "sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ=="],
|
||||
|
||||
@@ -2498,7 +2498,7 @@
|
||||
|
||||
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||
|
||||
"openai": ["openai@7.19.0", "", { "peerDependencies": { "@aws-sdk/credential-provider-node": ">=3.972.0 <4", "@smithy/hash-node": ">=4.3.0 <5", "@smithy/signature-v4": ">=5.4.0 <6", "undici": ">=5 <9", "ws": "^8.21.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["@aws-sdk/credential-provider-node", "@smithy/hash-node", "@smithy/signature-v4", "undici", "ws", "zod"] }, "sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ=="],
|
||||
"openai": ["openai@7.59.0", "", { "peerDependencies": { "@aws-sdk/credential-provider-node": ">=3.972.0 <4", "@smithy/hash-node": ">=4.3.0 <5", "@smithy/signature-v4": ">=5.4.0 <6", "google-auth-library": ">=9.15.1 <12", "undici": ">=5 <9", "ws": "^8.21.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["@aws-sdk/credential-provider-node", "@smithy/hash-node", "@smithy/signature-v4", "google-auth-library", "undici", "ws", "zod"] }, "sha512-wPYKJkLPFEdNJ2tThSg4jE1Ptsv4X3u8g8LIvu0Qz/UIhsKeCzl73rl48PtQsDVrJL/ku0liXOsbyd2TsRsPJw=="],
|
||||
|
||||
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
|
||||
|
||||
@@ -3046,11 +3046,85 @@
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="],
|
||||
|
||||
"@aws-sdk/client-s3/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="],
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-node/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1161.0", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-ypbXSofNcSHwf/KA40bFCXJb0MLaAKrfT7sot4dFaA+2lsuXNah4zLRJIAU7Qmvs9PFJ6rnY0bZFEC+mE7attA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
|
||||
|
||||
@@ -3060,9 +3134,7 @@
|
||||
|
||||
"@dbos-inc/dbos-sdk/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
|
||||
"@earendil-works/chord/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
|
||||
"@earendil-works/pi-ai/@google/genai": ["@google/genai@2.21.0", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"], "hasInstallScript": true }, "sha512-+PDtco2/Z0ONdzCGekCoCT+O1VJS9xJQNN4XzQpXG/t3El/SWWMkCWlFRO1KmivOHPa4Q0VjUYu1HBKCZ/v33Q=="],
|
||||
"@earendil-works/pi-ai/@google/genai": ["@google/genai@3.6.1", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.6.5", "ws": "^8.21.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-DQIkZkl+VoZc+RUSaJ41vRuywjQDpP0t/oUf5/ddQhNW6JsPjVULW2EgHmuJ1mrr6ACtrmUdPlqtNXF1yfKySg=="],
|
||||
|
||||
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||
|
||||
@@ -3320,25 +3392,77 @@
|
||||
|
||||
"wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-uO5TiSvb6j1w9RTe5z28OaOmsrOxVQUPaC5+wZl50RfOXcrYD/KgnS8I9lfyGXc7sGbkCopK6VnhNIAoLqfewQ=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.82", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-vQzlDHlC24Yz42p+rT4NBoP/5VdetkBoujbOLq9h6QYWC8THuZSPYnXIR9OP3XcOrdMgPBBipOrdssfxnIiWUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.25", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/credential-provider-env": "^3.972.80", "@aws-sdk/credential-provider-http": "^3.972.82", "@aws-sdk/credential-provider-login": "^3.972.87", "@aws-sdk/credential-provider-process": "^3.972.80", "@aws-sdk/credential-provider-sso": "^3.973.24", "@aws-sdk/credential-provider-web-identity": "^3.972.86", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-b5xl71uCRdWsu7P1VeGpiGuCf6zfYETsSNOv8AmYVTrsgbvTJRXdmmOPVfxkvGGVNsiKkGctClQW3jAn0SZLug=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.80", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-xqfixO5aclje7tbQJDias+iNND5wp/3QZixCdZcVQpgWPTZ0V5DfTW9A804A5Z7ezu7sH3WRO+vzUjtiJBA8yg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.24", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/token-providers": "3.1161.0", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-nlg3BKG03Cgzvv/dMnhxvDJPhAhQSpaN0RUdwgU7ziwkasoev7iI8el8Xy4Rd5sqzgaDUbV269fOXck5SargqA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-zKTyLJBEyfQBVlYqT6Jt+mYV4r8kGbWM7dn6v4Y4MRARizhYafjDXP/iMu76UMRhToSPNmIKX1XAb24gtpBFIA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/types": ["@aws-sdk/types@3.975.0", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WQlhs6juByzWOzj5fwxOx0mPJaEqMcG/sDpl3Id61B3XhKE63xY+0QWcnG+sWR/sCfprmreyUo1lM7IKZmHMzw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/core": ["@smithy/core@3.38.1", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-U/mB2XiwTLaf+NSgLSWwJfptsMT/H8aBi0aTAA/E5e2/TagFeGCqAyhKGG0w0A9IWTkm4qYEmLoD/HB6aYfnRA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@smithy/types": ["@smithy/types@4.19.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-r7jh49VJxGerfAcTQA6gXcKc+98zOp/tqRwzYjgOE+iSQsP6cEU1hq2QzbuipmP68QtYdY9wKEhiCQZIzHgZ4Q=="],
|
||||
|
||||
"@earendil-works/pi-ai/@google/genai/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="],
|
||||
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-env/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-process/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
||||
|
||||
@@ -3456,31 +3580,27 @@
|
||||
|
||||
"readdir-glob/minimatch/brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/client-s3/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
"@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.87", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-C4ZFmcwM+Zj14Z8huVUk54Gv4uzT1ZdzG9cY3Gdh8FePakq7Bss1OFsgZjAhWFOkFOGpBvFBeu0OWjWf8HNKRQ=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1161.0", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/nested-clients": "^3.997.54", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-ypbXSofNcSHwf/KA40bFCXJb0MLaAKrfT7sot4dFaA+2lsuXNah4zLRJIAU7Qmvs9PFJ6rnY0bZFEC+mE7attA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core": ["@aws-sdk/core@3.979.1", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@aws-sdk/xml-builder": "^3.972.42", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.38.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ayOlV1VhLNMiq8PW9ZkVobG4gkldnUoHjG69yy2b8j+VYFlhz/uAL7ZdYQAoQ+eShtGUdNDnnG5rxDg6yUJrOg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.54", "", { "dependencies": { "@aws-sdk/core": "^3.979.1", "@aws-sdk/signature-v4-multi-region": "^3.996.51", "@aws-sdk/types": "^3.975.0", "@smithy/core": "^3.38.0", "@smithy/fetch-http-handler": "^5.8.0", "@smithy/node-http-handler": "^4.14.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/OczlavsS7U5sOodRO10Ug4R/AKFVZiXTstKipWe68EfjPkmdDFNXNl9FCJyXWkg1DG6RBm3qAuVB8FNW9O8KQ=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-primitive/@radix-ui/react-slot": ["@radix-ui/react-slot@1.2.3", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A=="],
|
||||
|
||||
@@ -3508,70 +3628,14 @@
|
||||
|
||||
"readdir-glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
"@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
"@aws-sdk/credential-provider-login/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
"@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.42", "", { "dependencies": { "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-smX8/gNP8Kjq+CWTBMZQLQ912vOQjiWExzwzvMO+eujPB5RY8IbtF0AGdUUXHKN7KoDWK9dIcuW0WG269kiP6w=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.51", "", { "dependencies": { "@aws-sdk/types": "^3.975.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-+aHvUugVBuMPXxgkPfWnTMyGdE/yWS8GHi5+qQ37HowS0YqzrbuaDLznj+Dtmtu5jgCdqz36gXmujOToUhNNWw=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.0", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.18.0", "tslib": "^2.6.2" } }, "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.1", "", { "dependencies": { "@smithy/core": "^3.38.1", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-/T6E1jzCL0fErS9uq8JqES/5yYQQ4ppVmmYHwXw2nlov8KFzLb+3QqHR5iAun1BsuAB50IPxZliV8YMgghLwhA=="],
|
||||
"@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-primitive/@radix-ui/react-slot/@radix-ui/react-compose-refs": ["@radix-ui/react-compose-refs@1.1.2", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
|
||||
"@aws-sdk/client-bedrock-runtime/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@smithy/fetch-http-handler/@smithy/core/@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,29 @@ title: "Changelog"
|
||||
description: "Recent updates, new features, and improvements in Shumai"
|
||||
---
|
||||
|
||||
<Update label="v0.7.2" description="November 27, 2026">
|
||||
|
||||
### Added
|
||||
|
||||
- **comments**: Add Internal Comments with a Public/Internal selector in the comment composer so team and project members can have private discussions (marked with a lock icon) that never appear on public share links.
|
||||
- **comments**: Allow comment authors to edit their comments inline from the comment menu, including updating text, switching between Public and Internal, removing timestamps, and adding or removing attachments.
|
||||
|
||||
- **comments**: Add a "Print Comments" option in the comments menu (available in both project file views and public share links) that opens a dedicated print-friendly page with asset metadata, comment thumbnails, visual markup overlays, replies, completion status, emoji reactions, and attachments.
|
||||
|
||||
- **share**: See view counts, last viewed times, and activity for public share links, including file and folder views, downloads, and comments.
|
||||
|
||||
- **share**: Add options to create a share link or add to existing share links directly from the media view dropdown menu, and open a quick share dialog with inline renaming, one-click link copying, and security settings upon creation.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **video**: Pause playback while dragging the seekbar and show a lightweight preview in the player until the selected frame is ready.
|
||||
- **comments**: Keep password-protected print links on the share password prompt, keep private folder names out of shared print data, and wait for thumbnails and reply drawings before printing.
|
||||
- **security**: Security improvements.
|
||||
|
||||
### Changed
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="v0.7.1" description="November 23, 2026">
|
||||
|
||||
### Added
|
||||
@@ -29,6 +52,7 @@ description: "Recent updates, new features, and improvements in Shumai"
|
||||
|
||||
### Fixed
|
||||
|
||||
- **video**: Fix playback stalling after tapping or clicking the progress bar on slow connections, and stop the hidden seek preview from downloading the whole video in the background.
|
||||
- **cli**: Fix release publication failing to find staged standalone downloads.
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -11,7 +11,7 @@ When creating agents for chat or metadata autofill, you must select an underlyin
|
||||
|
||||
## Built-In Providers
|
||||
|
||||
Shumai ships with pre-configured configurations for major LLM providers. Because Shumai uses [Pi](https://github.com/earendil-works/pi) as its core agent framework, the supported provider and model configurations are automatically synchronized with Pi's capabilities.
|
||||
Shumai seeds new teams with provider and model configurations bundled with [Pi](https://github.com/earendil-works/pi). In **Settings → Providers**, choose **Refresh models** on a provider card, select compatible models, then choose **Add selected**. Refresh looks up the public catalog and preserves your saved settings and models. Use **Add Provider** to set up another provider.
|
||||
|
||||
Team Owner can freely edit, delete, or add new providers. All configured provider and model settings are injected directly into the Pi framework at runtime.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Shumai allows you to collaborate with external stakeholders who do not have acco
|
||||
|
||||
1. Select the files or folders you want to share, then right-click and choose **Create New Share Link**.
|
||||
2. Click the newly created **Share Link** in the project sidebar to open its settings page.
|
||||
3. Configure the share link in the right sidebar. You can:
|
||||
3. Use the **Settings** tab in the right sidebar to configure the share link.
|
||||
- Add password protection
|
||||
- Set an expiration date
|
||||
- Allow or disallow downloads
|
||||
@@ -33,6 +33,16 @@ Once a share link is created, you can easily add more files or folders to it wit
|
||||
|
||||
---
|
||||
|
||||
## Viewing Share Activity
|
||||
|
||||
Open **All Share Links** in the project sidebar to see **Views** and **Last Viewed** for each link. Click **View Activity** on a link’s row to open its history, or select the **Activity** tab on that link’s settings page.
|
||||
|
||||
The history groups share opens, file and folder views, downloads, and comments by day. It shows the visitor’s name when available and **Someone** for anonymous activity. A download entry appears when a visitor starts an authorized download.
|
||||
|
||||
Every successful open of the share, a shared folder, or a shared file adds one view and updates **Last Viewed**, including reloads. The history shows matching actions once within 30 minutes. A match uses the share link, action, visitor, and asset when there is one. For this check, all anonymous visitors are treated as the same visitor. For example, if a visitor opens the same file twice in ten minutes, **Views** increases by two and the history shows one **Viewed Asset** entry.
|
||||
|
||||
---
|
||||
|
||||
## Security and Settings
|
||||
|
||||
### Expiration Date
|
||||
|
||||
@@ -11,7 +11,7 @@ description: 将 Shumai 连接至 OpenAI、Anthropic、Gemini 或自定义 LLM
|
||||
|
||||
## 内置模型服务商
|
||||
|
||||
Shumai 预置了主流 LLM 服务商的配置。由于 Shumai 采用 [Pi](https://github.com/earendil-works/pi) 作为底层核心智能体框架,系统支持的服务商与模型配置会自动与 Pi 的功能生态保持同步。
|
||||
Shumai 使用 [Pi](https://github.com/earendil-works/pi) 随附的服务商与模型配置初始化新团队。在**设置 → 服务商**中,点击服务商卡片上的**刷新模型**,选择兼容的模型,然后点击**添加所选**。刷新会查询公开模型目录,并保留现有设置和模型。若要设置其他服务商,请点击**添加服务商**。
|
||||
|
||||
团队所有者可自由编辑、删除或添加新服务商。所有已配置的服务商与模型参数均会在运行时直接注入 Pi 框架。
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Shumai 支持与未注册工作区账号的外部利益相关者协作。借助*
|
||||
|
||||
1. 选中要分享的文件或文件夹,右键单击并选择**创建新分享链接**。
|
||||
2. 在项目侧边栏中点击刚创建的**分享链接**,进入其配置页面。
|
||||
3. 在右侧边栏中配置分享链接参数:
|
||||
3. 在右侧边栏的**设置**选项卡中配置分享链接。
|
||||
- 添加密码保护
|
||||
- 设置过期时间
|
||||
- 开启或禁止文件下载
|
||||
@@ -33,6 +33,16 @@ Shumai 支持与未注册工作区账号的外部利益相关者协作。借助*
|
||||
|
||||
---
|
||||
|
||||
## 查看分享活动
|
||||
|
||||
在项目侧边栏打开**所有分享链接**,即可看到每条链接的**浏览次数**和**最近浏览**时间。点击对应行的**查看活动**,或在该链接的配置页面切换到**活动**选项卡,即可查看活动记录。
|
||||
|
||||
活动按天分组,包括打开分享链接、浏览文件和文件夹、下载以及发表评论。可以识别访客时显示其姓名,匿名活动显示为**有人**。访客开始下载且通过权限验证后,系统会记录下载活动。
|
||||
|
||||
每次成功打开分享页面、共享文件夹或共享文件(包括刷新页面)都会增加一次**浏览次数**,并更新**最近浏览**时间。系统根据分享链接、操作、访客和相关资产(如有)判断活动是否重复,30 分钟内的重复活动只显示一次。判断时,所有匿名访客视为同一位访客。例如,同一位访客在十分钟内两次打开同一文件,**浏览次数**会增加两次,活动列表显示一条**浏览了素材**的记录。
|
||||
|
||||
---
|
||||
|
||||
## 安全与权限配置
|
||||
|
||||
### 有效期
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shumai",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "@shumai/agent",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
"@shumai/db": "workspace:*",
|
||||
|
||||
@@ -601,6 +601,7 @@ export const createCommentActivity = defineStep(
|
||||
sessionId?: string | null
|
||||
agentId?: string | null
|
||||
replyToId?: string | null
|
||||
isInternal?: boolean
|
||||
}) {
|
||||
if (params.sessionId) {
|
||||
const agentId = params.agentId && params.agentId !== 'default' ? params.agentId : 'default'
|
||||
@@ -669,6 +670,7 @@ export const createCommentActivity = defineStep(
|
||||
sessionId: params.sessionId ?? null,
|
||||
creatorId: params.agentId && params.agentId !== 'default' ? params.agentId : null,
|
||||
replyToId: params.replyToId,
|
||||
isInternal: params.isInternal ?? false,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
@@ -205,6 +205,43 @@ describe('Agent Chat Workflow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('marks agent placeholder reply as internal when user comment is internal', async () => {
|
||||
mockActivities.getCommentActivity.mockResolvedValue({
|
||||
id: 'c-internal',
|
||||
message: 'hello agent privately',
|
||||
assetId: 'a1',
|
||||
creatorId: 'user-c1',
|
||||
second: null,
|
||||
annotation: null,
|
||||
replyToId: null,
|
||||
isInternal: true,
|
||||
attachments: [],
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: { userCommentId: 'c-internal', agentId: 'b1' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
||||
assetId: 'a1',
|
||||
message: '__CHAT__',
|
||||
sessionId: 'pending',
|
||||
agentId: 'b1',
|
||||
replyToId: 'c-internal',
|
||||
isInternal: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('should skip session initialization if sessionId is already provided', async () => {
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
|
||||
@@ -85,6 +85,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
sessionId: sessionId || 'pending',
|
||||
agentId: agentId,
|
||||
replyToId: userComment.replyToId ?? userComment.id,
|
||||
...(userComment.isInternal ? { isInternal: true } : {}),
|
||||
})
|
||||
placeholderCommentId = placeholder.id
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@shumai/api",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@hono/zod-validator": "0.7.6",
|
||||
"@modelcontextprotocol/server": "2.0.0",
|
||||
"@shumai/core": "workspace:*",
|
||||
|
||||
@@ -6,6 +6,7 @@ import { AssetType } from '@shumai/db'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
// any is used here because Hono's Context and Next types are complex to mock in vitest.mock
|
||||
@@ -84,4 +85,28 @@ describe('Attachment API', () => {
|
||||
itemId: 'asset1',
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps the upload key inside the attachment folder', async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(assetService.createAsset).mockResolvedValue({ id: 'asset1' } as any)
|
||||
vi.mocked(s3Service.presign).mockResolvedValue('http://mock-s3-url')
|
||||
|
||||
const fileName = '../../files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov'
|
||||
const res = await app.request('/projects/project1/attachments', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer test' },
|
||||
body: JSON.stringify({ fileName, contentType: 'video/quicktime', size: 100 }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const key = vi.mocked(assetService.createAsset).mock.lastCall?.[0].key as string
|
||||
const parts = key.split('/')
|
||||
expect(parts[0]).toBe('attachments')
|
||||
expect(parts).toHaveLength(3)
|
||||
expect(parts).not.toContain('..')
|
||||
expect(s3Service.presign).toHaveBeenCalledWith(expect.any(String), key, 'PUT')
|
||||
expect(assetService.createAsset).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ name: fileName }),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,6 +7,7 @@ import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { AssetType } from '@shumai/db'
|
||||
import { ulid } from 'ulid'
|
||||
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
@@ -27,7 +28,7 @@ const route = new Hono<{ Variables: { user: User } }>().post(
|
||||
id: projectId,
|
||||
})
|
||||
|
||||
const key = `attachments/${ulid()}/${req.fileName}`
|
||||
const key = `attachments/${ulid()}/${sanitizeFilename(req.fileName)}`
|
||||
|
||||
const assetInfo = await assetService.createAsset({
|
||||
name: req.fileName,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Hono, type Context, type Next } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import fileRoute from './file'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { commentFrameService } from '@shumai/core/src/comment/comment-frame'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
@@ -81,6 +82,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, 'updateComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'completeComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'deleteComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'addCommentReaction').mockImplementation(vi.fn())
|
||||
@@ -90,7 +92,10 @@ describe('file api', () => {
|
||||
assetId: 'file1',
|
||||
} as unknown as Awaited<ReturnType<typeof assetService.getComment>>)
|
||||
vi.spyOn(assetService, 'listComments').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'listAllComments').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'getProjectNameForAsset').mockResolvedValue('Demo Project')
|
||||
vi.spyOn(assetService, 'exportComments').mockImplementation(vi.fn())
|
||||
vi.spyOn(commentFrameService, 'extractFrame').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'restoreAssets').mockImplementation(vi.fn())
|
||||
vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn())
|
||||
vi.spyOn(notificationService, 'create').mockImplementation(vi.fn())
|
||||
@@ -287,6 +292,7 @@ describe('file api', () => {
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
})
|
||||
@@ -347,6 +353,7 @@ describe('file api', () => {
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
})
|
||||
@@ -404,6 +411,7 @@ describe('file api', () => {
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
},
|
||||
@@ -549,6 +557,7 @@ describe('file api', () => {
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: true,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: { id: 'user1', name: 'Test User' },
|
||||
reactionCounts: [],
|
||||
})
|
||||
@@ -575,6 +584,110 @@ describe('file api', () => {
|
||||
expect(assetService.getComment).toHaveBeenCalledWith('comment-id', 'user1')
|
||||
})
|
||||
|
||||
it('POST /files/:fileId/comments forwards isInternal', async () => {
|
||||
vi.mocked(assetService.createComment).mockResolvedValue({
|
||||
id: 'comment-internal-id',
|
||||
assetId: 'test-id',
|
||||
message: 'internal note',
|
||||
annotations: null,
|
||||
second: null,
|
||||
creator: { id: 'user1', name: 'Test User' },
|
||||
replies: [],
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: true,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
})
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/test-id/comments', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message: 'internal note', attachmentIds: [], isInternal: true }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(201)
|
||||
const json = await res.json()
|
||||
expect(json.isInternal).toBe(true)
|
||||
expect(assetService.createComment).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
assetId: 'test-id',
|
||||
userId: 'user1',
|
||||
message: 'internal note',
|
||||
isInternal: true,
|
||||
}),
|
||||
expect.anything(),
|
||||
)
|
||||
})
|
||||
|
||||
it('PATCH /comments/:commentId updates comment and logs comment_update audit entry', async () => {
|
||||
vi.mocked(assetService.updateComment).mockResolvedValue({
|
||||
id: 'comment-id',
|
||||
assetId: 'file-id',
|
||||
message: 'edited text',
|
||||
annotations: null,
|
||||
second: null,
|
||||
creator: { id: 'user1', name: 'Test User' },
|
||||
replies: [],
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: true,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
})
|
||||
vi.mocked(assetService.getAssetContext).mockResolvedValue({
|
||||
teamId: 'test-team',
|
||||
projectId: 'proj-1',
|
||||
})
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/comments/comment-id', {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
message: 'edited text',
|
||||
isInternal: true,
|
||||
second: null,
|
||||
attachmentIds: ['att-1'],
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json.message).toBe('edited text')
|
||||
expect(json.isInternal).toBe(true)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user1', name: 'Test User' },
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Comment,
|
||||
id: 'comment-id',
|
||||
})
|
||||
expect(assetService.updateComment).toHaveBeenCalledWith({
|
||||
commentId: 'comment-id',
|
||||
userId: 'user1',
|
||||
message: 'edited text',
|
||||
isInternal: true,
|
||||
second: null,
|
||||
attachmentIds: ['att-1'],
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'comment_update',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: 'proj-1',
|
||||
itemId: 'comment-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /comments/:commentId/complete reopens with isCompleted false', async () => {
|
||||
vi.mocked(runOperation).mockResolvedValue({ commentId: 'comment-id', resolved: false })
|
||||
vi.mocked(assetService.getComment).mockResolvedValue({
|
||||
@@ -1095,4 +1208,90 @@ describe('file api', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /files/:fileId/comments/print and /frame routes', () => {
|
||||
it('returns asset, top-down breadcrumbs, and all comments for printing', async () => {
|
||||
vi.mocked(assetService.getAsset).mockResolvedValue({
|
||||
id: 'file-1',
|
||||
name: 'demo.mp4',
|
||||
sizeByte: 100,
|
||||
fileCount: 1,
|
||||
type: 'file',
|
||||
status: 'active',
|
||||
proxyType: 'video',
|
||||
ancestorFolders: [
|
||||
{ id: 'f2', name: 'Inner' },
|
||||
{ id: 'f1', name: 'Outer' },
|
||||
],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
})
|
||||
vi.mocked(assetService.getProjectNameForAsset).mockResolvedValue('My Project')
|
||||
vi.mocked(assetService.listAllComments).mockResolvedValue([
|
||||
{
|
||||
id: 'c1',
|
||||
assetId: 'file-1',
|
||||
message: 'Looks great',
|
||||
annotations: null,
|
||||
second: 1.5,
|
||||
creator: { id: 'u1', name: 'Alice' },
|
||||
replies: [],
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
},
|
||||
])
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/file-1/comments/print')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.breadcrumbs).toEqual(['My Project', 'Outer', 'Inner'])
|
||||
expect(body.comments).toHaveLength(1)
|
||||
expect(body.asset.id).toBe('file-1')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user1', name: 'Test User' },
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: 'file-1',
|
||||
})
|
||||
})
|
||||
|
||||
it('streams extracted frame image with cache headers', async () => {
|
||||
const buf = Buffer.from('mock-webp-bytes')
|
||||
vi.mocked(commentFrameService.extractFrame).mockResolvedValue({
|
||||
buffer: buf,
|
||||
mimeType: 'image/webp',
|
||||
})
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/file-1/comments/frame?second=2.5&width=400')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toBe('image/webp')
|
||||
expect(res.headers.get('cache-control')).toBe('private, max-age=300')
|
||||
const arr = new Uint8Array(await res.arrayBuffer())
|
||||
expect(Buffer.from(arr).toString()).toBe('mock-webp-bytes')
|
||||
expect(commentFrameService.extractFrame).toHaveBeenCalledWith({
|
||||
assetId: 'file-1',
|
||||
second: 2.5,
|
||||
width: 400,
|
||||
signal: expect.any(AbortSignal),
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects invalid second query parameter with 400', async () => {
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
const res = await app.request('/files/file-1/comments/frame?second=-5')
|
||||
expect(res.status).toBe(400)
|
||||
expect(commentFrameService.extractFrame).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { commentService } from '@shumai/core/src/comment/comment'
|
||||
import { commentFrameService } from '@shumai/core/src/comment/comment-frame'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
import {
|
||||
archiveAssetsRequestSchema,
|
||||
createCommentRequestSchema,
|
||||
updateCommentRequestSchema,
|
||||
deleteFilesRequestSchema,
|
||||
batchGetFilesRequestSchema,
|
||||
paginationParamsSchema,
|
||||
@@ -29,6 +31,7 @@ import {
|
||||
getDownloadLinksRequestSchema,
|
||||
getStoragePathsRequestSchema,
|
||||
completeCommentRequestSchema,
|
||||
commentFrameQuerySchema,
|
||||
exportCommentsRequestSchema,
|
||||
addCommentReactionRequestSchema,
|
||||
removeCommentReactionRequestSchema,
|
||||
@@ -197,6 +200,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
annotations: req.annotations,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
isInternal: req.isInternal,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
@@ -248,6 +252,60 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.body(result.content)
|
||||
},
|
||||
)
|
||||
.get('/files/:fileId/comments/print', async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const [asset, projectName, comments] = await Promise.all([
|
||||
assetService.getAsset({ assetId: fileId }),
|
||||
assetService.getProjectNameForAsset(fileId),
|
||||
assetService.listAllComments(fileId, user.id),
|
||||
])
|
||||
|
||||
const folderNames = (asset.ancestorFolders ?? [])
|
||||
.slice()
|
||||
.reverse()
|
||||
.map((f) => f.name)
|
||||
.filter((name): name is string => Boolean(name))
|
||||
const breadcrumbs = projectName ? [projectName, ...folderNames] : folderNames
|
||||
|
||||
return c.json({
|
||||
asset,
|
||||
breadcrumbs,
|
||||
comments,
|
||||
})
|
||||
})
|
||||
.get('/files/:fileId/comments/frame', zValidator('query', commentFrameQuerySchema), async (c) => {
|
||||
const fileId = c.req.param('fileId')
|
||||
const user = c.get('user')
|
||||
const { second, width } = c.req.valid('query')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id: fileId,
|
||||
})
|
||||
|
||||
const result = await commentFrameService.extractFrame({
|
||||
assetId: fileId,
|
||||
second,
|
||||
width,
|
||||
signal: c.req.raw.signal,
|
||||
})
|
||||
|
||||
return c.body(new Uint8Array(result.buffer), 200, {
|
||||
'Content-Type': result.mimeType,
|
||||
'Cache-Control': 'private, max-age=300',
|
||||
})
|
||||
})
|
||||
.post(
|
||||
'/comments/:commentId/reactions',
|
||||
zValidator('json', addCommentReactionRequestSchema),
|
||||
@@ -305,6 +363,38 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(await assetService.getComment(commentId, user.id))
|
||||
},
|
||||
)
|
||||
.patch('/comments/:commentId', zValidator('json', updateCommentRequestSchema), 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.updateComment({
|
||||
commentId,
|
||||
userId: user.id,
|
||||
message: req.message,
|
||||
isInternal: req.isInternal,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(updated.assetId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.comment_update,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: commentId,
|
||||
})
|
||||
|
||||
return c.json(updated)
|
||||
})
|
||||
.delete('/comments/:commentId', async (c) => {
|
||||
const commentId = c.req.param('commentId')
|
||||
const user = c.get('user')
|
||||
|
||||
@@ -30,7 +30,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const attachment = await kanbanService.createAttachment(teamId, req)
|
||||
const attachment = await kanbanService.createAttachment(teamId, user.id, req)
|
||||
return c.json(attachment)
|
||||
},
|
||||
)
|
||||
@@ -123,7 +123,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: taskId,
|
||||
})
|
||||
|
||||
const events = await kanbanService.listEvents(taskId)
|
||||
const events = await kanbanService.listEvents(taskId, user.id)
|
||||
return c.json({ data: events })
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import { kanbanService } from '@shumai/core/src/kanban/kanban'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { KanbanTaskStatus, KanbanTaskPriority } from '@shumai/db/enums'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { authzService } from '@shumai/core/src/authz/authz'
|
||||
import kanbanRoute from './index'
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
@@ -19,6 +21,7 @@ vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
ResourceType: {
|
||||
Team: 'team',
|
||||
Project: 'project',
|
||||
Asset: 'asset',
|
||||
KanbanGoal: 'kanbanGoal',
|
||||
KanbanTask: 'kanbanTask',
|
||||
},
|
||||
@@ -51,6 +54,7 @@ describe('Kanban API Routes', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
vi.mocked(auditLogService.logAction).mockResolvedValue({} as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(notificationService.notifyKanbanTaskEvent).mockResolvedValue(undefined as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
app = new Hono()
|
||||
@@ -218,6 +222,7 @@ describe('Kanban API Routes', () => {
|
||||
status: 'READY',
|
||||
goalId: 'goal-1',
|
||||
}),
|
||||
'user-1',
|
||||
)
|
||||
})
|
||||
|
||||
@@ -248,7 +253,7 @@ describe('Kanban API Routes', () => {
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json.id).toBe(taskId)
|
||||
expect(mockGet).toHaveBeenCalledWith(taskId)
|
||||
expect(mockGet).toHaveBeenCalledWith(taskId, 'user-1')
|
||||
})
|
||||
|
||||
it('PATCH /teams/:teamId/kanban/tasks/:taskId', async () => {
|
||||
@@ -493,6 +498,74 @@ describe('Kanban API Routes', () => {
|
||||
expect(mockLinkAssets).toHaveBeenCalledWith(teamId, taskId, ['asset-1', 'asset-2'])
|
||||
})
|
||||
|
||||
describe('linking files the caller cannot read', () => {
|
||||
const denyAsset = (deniedAssetId: string) =>
|
||||
vi.mocked(authzService.hasPermission).mockImplementation(async (req) => {
|
||||
if (req.type === 'asset' && req.id === deniedAssetId) {
|
||||
throw new HTTPException(403, { message: 'User has only project scope' })
|
||||
}
|
||||
})
|
||||
|
||||
it('checks Read on every file linked to a task', async () => {
|
||||
const mockLinkAssets = vi.spyOn(kanbanService, 'linkAssets').mockResolvedValue(undefined)
|
||||
denyAsset('asset-2')
|
||||
|
||||
const res = await app.request(`/teams/${teamId}/kanban/tasks/${taskId}/assets`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ assetIds: ['asset-1', 'asset-2'] }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(mockLinkAssets).not.toHaveBeenCalled()
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ type: 'asset', id: 'asset-1', permission: 'Read' }),
|
||||
)
|
||||
})
|
||||
|
||||
it('checks Read on the file when linking it from the file side', async () => {
|
||||
const mockLinkAsset = vi.spyOn(kanbanService, 'linkAsset').mockResolvedValue(undefined)
|
||||
denyAsset('asset-1')
|
||||
|
||||
const res = await app.request(`/teams/${teamId}/kanban/assets/asset-1/tasks`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ taskId }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(mockLinkAsset).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('checks Read on files passed when updating a task', async () => {
|
||||
const mockUpdate = vi.spyOn(kanbanService, 'updateTask')
|
||||
denyAsset('asset-9')
|
||||
|
||||
const res = await app.request(`/teams/${teamId}/kanban/tasks/${taskId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ assetIds: ['asset-9'] }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(mockUpdate).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('checks Read on files passed when creating a task', async () => {
|
||||
const mockCreate = vi.spyOn(kanbanService, 'createTask')
|
||||
denyAsset('asset-9')
|
||||
|
||||
const res = await app.request(`/teams/${teamId}/kanban/tasks`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ title: 'Task', assetIds: ['asset-9'] }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(403)
|
||||
expect(mockCreate).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
it('DELETE /teams/:teamId/kanban/tasks/:taskId/assets/:assetId', async () => {
|
||||
const mockUnlinkAsset = vi.spyOn(kanbanService, 'unlinkAsset').mockResolvedValue(undefined)
|
||||
|
||||
@@ -530,7 +603,7 @@ describe('Kanban API Routes', () => {
|
||||
const json = await res.json()
|
||||
expect(json.total).toBe(1)
|
||||
expect(json.data).toHaveLength(1)
|
||||
expect(mockListTasksForAsset).toHaveBeenCalledWith(teamId, 'asset-1')
|
||||
expect(mockListTasksForAsset).toHaveBeenCalledWith(teamId, 'asset-1', 'user-1')
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/kanban/assets/:assetId/tasks', async () => {
|
||||
@@ -585,7 +658,7 @@ describe('Kanban API Routes', () => {
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json.id).toBe('att-1')
|
||||
expect(mockAttachment).toHaveBeenCalledWith(teamId, {
|
||||
expect(mockAttachment).toHaveBeenCalledWith(teamId, 'user-1', {
|
||||
fileName: 'test.png',
|
||||
size: 1024,
|
||||
contentType: 'image/png',
|
||||
@@ -683,7 +756,7 @@ describe('Kanban API Routes', () => {
|
||||
expect(res.status).toBe(200)
|
||||
const json = await res.json()
|
||||
expect(json.data).toHaveLength(1)
|
||||
expect(mockEvents).toHaveBeenCalledWith(taskId)
|
||||
expect(mockEvents).toHaveBeenCalledWith(taskId, 'user-1')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -22,6 +22,21 @@ import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
/**
|
||||
* Linking a file to a task shows its name, folder path and thumbnail to everyone
|
||||
* who can read the task, so the caller must be able to read each linked file.
|
||||
*/
|
||||
async function assertCanReadAssets(user: User, assetIds: string[] | undefined) {
|
||||
for (const id of new Set(assetIds ?? [])) {
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Asset,
|
||||
id,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const route = new Hono<{ Variables: { user: User } }>()
|
||||
.post('/teams/:teamId/kanban/tasks', zValidator('json', createKanbanTaskSchema), async (c) => {
|
||||
const { teamId } = c.req.param()
|
||||
@@ -40,6 +55,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
throw new HTTPException(403, { message: 'User is not a member of the team' })
|
||||
}
|
||||
|
||||
await assertCanReadAssets(user, req.assetIds)
|
||||
|
||||
const task = await kanbanService.createTask(teamId, req, user.id, role)
|
||||
|
||||
await auditLogService.logAction({
|
||||
@@ -89,7 +106,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await kanbanService.listTasks(teamId, req)
|
||||
const result = await kanbanService.listTasks(teamId, req, user.id)
|
||||
return c.json(result)
|
||||
},
|
||||
)
|
||||
@@ -104,7 +121,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: taskId,
|
||||
})
|
||||
|
||||
const task = await kanbanService.getTask(taskId)
|
||||
const task = await kanbanService.getTask(taskId, user.id)
|
||||
return c.json(task)
|
||||
})
|
||||
.patch(
|
||||
@@ -122,6 +139,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: taskId,
|
||||
})
|
||||
|
||||
await assertCanReadAssets(user, req.assetIds)
|
||||
|
||||
const existing = await kanbanService.getTask(taskId)
|
||||
const role = await resolveEffectiveRole(teamId, existing.projectId ?? undefined, user.id)
|
||||
const task = await kanbanService.updateTask(taskId, req, user.id, role)
|
||||
@@ -262,6 +281,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: taskId,
|
||||
})
|
||||
|
||||
await assertCanReadAssets(user, req.assetIds)
|
||||
|
||||
await kanbanService.linkAssets(teamId, taskId, req.assetIds)
|
||||
return c.json({ success: true })
|
||||
},
|
||||
@@ -291,7 +312,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const tasks = await kanbanService.listTasksForAsset(teamId, assetId)
|
||||
const tasks = await kanbanService.listTasksForAsset(teamId, assetId, user.id)
|
||||
return c.json({ data: tasks, total: tasks.length })
|
||||
})
|
||||
.post(
|
||||
@@ -309,6 +330,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: req.taskId,
|
||||
})
|
||||
|
||||
await assertCanReadAssets(user, [assetId])
|
||||
|
||||
await kanbanService.linkAsset(teamId, req.taskId, assetId)
|
||||
return c.json({ success: true })
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
import { Hono, type Context, type Next } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import providerRoute from './provider'
|
||||
import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
@@ -34,6 +35,7 @@ describe('provider api', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
})
|
||||
|
||||
@@ -320,78 +322,57 @@ describe('provider api', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-check checks for updates', async () => {
|
||||
vi.mocked(providerService.checkUpdates).mockResolvedValue({
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'DEEPSEEK_API_KEY' },
|
||||
models: [],
|
||||
},
|
||||
],
|
||||
totalNewProviders: 1,
|
||||
totalNewModels: 0,
|
||||
})
|
||||
const modelsPath = '/teams/t1/providers/p1/models'
|
||||
const providerUpdatedAt = '2026-11-29T09:15:00.000Z'
|
||||
const selection = {
|
||||
providerUpdatedAt,
|
||||
modelIds: ['test-model'],
|
||||
}
|
||||
const importRequest = {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(selection),
|
||||
}
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-check', {
|
||||
method: 'POST',
|
||||
it('previews refresh results for the requested provider as a team admin', async () => {
|
||||
vi.mocked(providerService.refreshModels).mockResolvedValue({
|
||||
status: 'ready',
|
||||
providerUpdatedAt,
|
||||
models: [],
|
||||
})
|
||||
|
||||
const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.totalNewProviders).toBe(1)
|
||||
expect(data.providers).toHaveLength(1)
|
||||
expect(providerService.checkUpdates).toHaveBeenCalledWith('t1')
|
||||
expect(res.headers.get('Cache-Control')).toBe('no-store')
|
||||
expect(await res.json()).toEqual({ status: 'ready', providerUpdatedAt, models: [] })
|
||||
expect(providerService.refreshModels).toHaveBeenCalledWith('t1', 'p1')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-apply applies sync selection', async () => {
|
||||
vi.mocked(providerService.applySync).mockResolvedValue({
|
||||
addedProviders: 1,
|
||||
addedModels: 3,
|
||||
})
|
||||
|
||||
const payload = {
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'KEY' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'deepseek-v4-flash',
|
||||
name: 'DeepSeek V4 Flash',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
it('returns the server reason for an unavailable refresh', async () => {
|
||||
vi.mocked(providerService.refreshModels).mockResolvedValue({
|
||||
status: 'unavailable',
|
||||
reason: 'catalog_unavailable',
|
||||
})
|
||||
|
||||
const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.addedProviders).toBe(1)
|
||||
expect(data.addedModels).toBe(3)
|
||||
expect(providerService.applySync).toHaveBeenCalledWith('t1', payload)
|
||||
expect(await res.json()).toEqual({ status: 'unavailable', reason: 'catalog_unavailable' })
|
||||
})
|
||||
|
||||
it('imports the selection into the scoped provider and records its audit entry', async () => {
|
||||
vi.mocked(providerService.importModels).mockResolvedValue({ addedModels: 1 })
|
||||
|
||||
const res = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ addedModels: 1 })
|
||||
expect(providerService.importModels).toHaveBeenCalledWith('t1', 'p1', selection)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
@@ -402,6 +383,36 @@ describe('provider api', () => {
|
||||
action: 'provider_update',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
|
||||
it('skips the audit entry when the selected models already exist', async () => {
|
||||
vi.mocked(providerService.importModels).mockResolvedValue({ addedModels: 0 })
|
||||
const res = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ addedModels: 0 })
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects requests without team-admin permission before looking up the provider', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValue(new HTTPException(403))
|
||||
const refresh = await app.request(modelsPath + '/refresh', { method: 'POST' })
|
||||
const apply = await app.request(modelsPath + '/import', importRequest)
|
||||
expect(refresh.status).toBe(403)
|
||||
expect(apply.status).toBe(403)
|
||||
expect(providerService.refreshModels).not.toHaveBeenCalled()
|
||||
expect(providerService.importModels).not.toHaveBeenCalled()
|
||||
expect(auditLogService.logAction).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects an empty import selection before performing a write', async () => {
|
||||
const res = await app.request(modelsPath + '/import', {
|
||||
...importRequest,
|
||||
body: JSON.stringify({ providerUpdatedAt, modelIds: [] }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
expect(providerService.importModels).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import {
|
||||
createModelRequestSchema,
|
||||
createProviderRequestSchema,
|
||||
syncApplyRequestSchema,
|
||||
importProviderModelsRequestSchema,
|
||||
updateModelRequestSchema,
|
||||
updateProviderRequestSchema,
|
||||
AuditAction,
|
||||
@@ -31,8 +31,8 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(providers)
|
||||
})
|
||||
|
||||
.post('/teams/:teamId/providers/sync-check', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
.post('/teams/:teamId/providers/:providerId/models/refresh', async (c) => {
|
||||
const { teamId, providerId } = c.req.param()
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
@@ -42,15 +42,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.checkUpdates(teamId)
|
||||
const result = await providerService.refreshModels(teamId, providerId)
|
||||
c.header('Cache-Control', 'no-store')
|
||||
return c.json(result)
|
||||
})
|
||||
|
||||
.post(
|
||||
'/teams/:teamId/providers/sync-apply',
|
||||
zValidator('json', syncApplyRequestSchema),
|
||||
'/teams/:teamId/providers/:providerId/models/import',
|
||||
zValidator('json', importProviderModelsRequestSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const { teamId, providerId } = c.req.param()
|
||||
const user = c.get('user')
|
||||
const body = c.req.valid('json')
|
||||
|
||||
@@ -61,12 +62,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.applySync(teamId, body)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
})
|
||||
const result = await providerService.importModels(teamId, providerId, body)
|
||||
if (result.addedModels > 0) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
itemId: providerId,
|
||||
})
|
||||
}
|
||||
return c.json(result)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { Hono } from 'hono'
|
||||
import publicShareRoute from './public-share'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { commentFrameService } from '@shumai/core/src/comment/comment-frame'
|
||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { ShareLinkPasswordInvalidError } from '@shumai/core/src/share/errors'
|
||||
|
||||
describe('public share print comments and frame api', () => {
|
||||
beforeEach(() => {
|
||||
vi.spyOn(auth.api, 'getSession').mockResolvedValue(null)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('GET /shares/:shareId/files/:fileId/comments/print returns share-scoped breadcrumbs and comments', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share-1',
|
||||
name: 'Client Review',
|
||||
rootFolderId: 'share-root',
|
||||
projectId: 'proj-1',
|
||||
watermarkConfigId: null,
|
||||
fieldVisibility: { status: true, internalNote: false },
|
||||
} as never)
|
||||
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue({
|
||||
id: 'file-1',
|
||||
name: 'spot.mp4',
|
||||
sizeByte: 100,
|
||||
fileCount: 1,
|
||||
type: 'file',
|
||||
status: 'active',
|
||||
proxyType: 'video',
|
||||
fieldValues: [
|
||||
{ fieldId: 'status', value: 'Approved' },
|
||||
{ fieldId: 'internalNote', value: 'Private note' },
|
||||
{ fieldId: 'rating', value: 3 },
|
||||
],
|
||||
ancestorFolders: [
|
||||
{ id: 'inner', name: 'Inner Folder' },
|
||||
{ id: 'share-root', name: 'Share Root' },
|
||||
{ id: 'private-parent', name: 'Secret Project Folder' },
|
||||
],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
})
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockResolvedValue('file-1')
|
||||
vi.spyOn(assetService, 'resolveTargetAssetId').mockResolvedValue('file-1')
|
||||
vi.spyOn(assetService, 'listAllComments').mockResolvedValue([
|
||||
{
|
||||
id: 'c1',
|
||||
assetId: 'file-1',
|
||||
message: 'Great cut!',
|
||||
annotations: null,
|
||||
second: 3,
|
||||
creator: { id: 'u1', name: 'Guest' },
|
||||
replies: [],
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
sessionId: null,
|
||||
isCompleted: false,
|
||||
isInternal: false,
|
||||
completionLastChangedBy: null,
|
||||
reactionCounts: [],
|
||||
},
|
||||
])
|
||||
|
||||
const app = new Hono().route('/', publicShareRoute)
|
||||
const res = await app.request('/shares/share-1/files/file-1/comments/print', {
|
||||
headers: { 'x-share-password': 'secret' },
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(assetService.listAllComments).toHaveBeenCalledWith('file-1', undefined, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
const body = await res.json()
|
||||
expect(body.breadcrumbs).toEqual(['Client Review', 'Inner Folder'])
|
||||
expect(body.asset.ancestorFolders).toEqual([{ id: 'inner', name: 'Inner Folder' }])
|
||||
expect(body.asset.fieldValues).toEqual([{ fieldId: 'status', value: 'Approved' }])
|
||||
expect(JSON.stringify(body)).not.toContain('Secret Project Folder')
|
||||
expect(JSON.stringify(body)).not.toContain('private-parent')
|
||||
expect(body.comments).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('GET /shares/:shareId/files/:fileId/comments/print returns 401 on invalid password', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockRejectedValue(
|
||||
new ShareLinkPasswordInvalidError('Invalid password'),
|
||||
)
|
||||
|
||||
const app = new Hono().route('/', publicShareRoute)
|
||||
const res = await app.request('/shares/share-1/files/file-1/comments/print')
|
||||
|
||||
expect(res.status).toBe(401)
|
||||
})
|
||||
|
||||
it('GET /shares/:shareId/files/:fileId/comments/frame passes watermarkConfigId and password query param', async () => {
|
||||
const verifySpy = vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share-1',
|
||||
name: 'Watermarked Review',
|
||||
rootFolderId: 'share-root',
|
||||
projectId: 'proj-1',
|
||||
watermarkConfigId: 'wm-1',
|
||||
} as never)
|
||||
vi.spyOn(assetService, 'resolveTargetAssetId').mockResolvedValue('target-file-1')
|
||||
const extractSpy = vi.spyOn(commentFrameService, 'extractFrame').mockResolvedValue({
|
||||
buffer: Buffer.from('wm-webp'),
|
||||
mimeType: 'image/webp',
|
||||
})
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
|
||||
const app = new Hono().route('/', publicShareRoute)
|
||||
const res = await app.request(
|
||||
'/shares/share-1/files/file-1/comments/frame?second=4.2&width=400&p=pw123',
|
||||
)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers.get('content-type')).toBe('image/webp')
|
||||
expect(verifySpy).toHaveBeenCalledWith('share-1', 'file-1', 'pw123')
|
||||
expect(extractSpy).toHaveBeenCalledWith({
|
||||
assetId: 'target-file-1',
|
||||
second: 4.2,
|
||||
width: 400,
|
||||
watermarkConfigId: 'wm-1',
|
||||
signal: expect.any(AbortSignal),
|
||||
})
|
||||
})
|
||||
|
||||
it('GET /shares/:shareId/files/:fileId/comments excludes internal comments', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
id: 'share-1',
|
||||
rootFolderId: 'share-root',
|
||||
projectId: 'proj-1',
|
||||
} as never)
|
||||
vi.spyOn(assetService, 'resolveTargetAssetId').mockResolvedValue('file-1')
|
||||
const listSpy = vi.spyOn(assetService, 'listComments').mockResolvedValue({
|
||||
data: [],
|
||||
pageInfo: { cursor: undefined, total: 0 },
|
||||
})
|
||||
|
||||
const app = new Hono().route('/', publicShareRoute)
|
||||
const res = await app.request('/shares/share-1/files/file-1/comments')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(listSpy).toHaveBeenCalledWith('file-1', expect.anything(), undefined, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /shares/:shareId/files/:fileId/comments rejects isInternal=true with 400', async () => {
|
||||
const app = new Hono().route('/', publicShareRoute)
|
||||
const res = await app.request('/shares/share-1/files/file-1/comments', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message: 'secret', attachmentIds: [], isInternal: true }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
})
|
||||
})
|
||||
@@ -1,11 +1,19 @@
|
||||
import { Hono } from 'hono'
|
||||
import type { Context } from 'hono'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { getCookie } from 'hono/cookie'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { shareActivityService } from '@shumai/core/src/share/share-activity'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { commentFrameService } from '@shumai/core/src/comment/comment-frame'
|
||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||
import { paginationParamsSchema, assetTypeFilterSchema } from '@shumai/dtos'
|
||||
import {
|
||||
paginationParamsSchema,
|
||||
assetTypeFilterSchema,
|
||||
commentFrameQuerySchema,
|
||||
recordShareViewRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { z } from 'zod'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { FieldInfo } from '@shumai/dtos'
|
||||
@@ -115,6 +123,20 @@ async function applyWatermarkToAssetMedia(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps only the custom field values the share link is configured to show.
|
||||
* Fields are hidden by default; `fieldVisibility` lists the keys turned on
|
||||
* for this share, matching what `GET /shares/:shareId/fields` returns.
|
||||
*/
|
||||
function filterSharedFieldValues(asset: AssetInfo, fieldVisibility: unknown): AssetInfo {
|
||||
if (!asset.fieldValues) return asset
|
||||
const visibility = (fieldVisibility || {}) as Record<string, boolean>
|
||||
return {
|
||||
...asset,
|
||||
fieldValues: asset.fieldValues.filter((fv) => Boolean(visibility[fv.fieldId])),
|
||||
}
|
||||
}
|
||||
|
||||
const app = new Hono()
|
||||
|
||||
function toFieldInfo(
|
||||
@@ -133,6 +155,9 @@ function toFieldInfo(
|
||||
}
|
||||
|
||||
export function handlePublicShareError(c: Context, err: unknown) {
|
||||
if (err instanceof HTTPException) {
|
||||
throw err
|
||||
}
|
||||
if (err instanceof ShareLinkPasswordInvalidError) {
|
||||
return c.json({ error: 'Unauthorized' }, 401)
|
||||
}
|
||||
@@ -156,7 +181,36 @@ const sharedChildrenRequestSchema = paginationParamsSchema.extend({
|
||||
assetType: assetTypeFilterSchema.optional().default('file'),
|
||||
})
|
||||
|
||||
async function getPublicShareUserId(c: Context, shareId: string) {
|
||||
const session = await auth.api.getSession({ headers: c.req.raw.headers })
|
||||
if (session?.user) return session.user.id
|
||||
|
||||
const token = getCookie(c, `shumai_guest_${shareId}`) || getCookie(c, 'shumai_guest')
|
||||
const verified = token && verifyGuestToken(token, shareId)
|
||||
if (!verified) return undefined
|
||||
|
||||
const guestUser = await userService.getUserById(verified.userId)
|
||||
return guestUser?.guestEmail ? guestUser.id : undefined
|
||||
}
|
||||
|
||||
const route = app
|
||||
.post('/shares/:shareId/views', zValidator('json', recordShareViewRequestSchema), async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const password = c.req.header('x-share-password')
|
||||
const { assetId, isShareEntry } = c.req.valid('json')
|
||||
try {
|
||||
const share = await shareService.verifyPublicAccess(shareId, assetId, password)
|
||||
const targetId =
|
||||
assetId && assetId !== share.rootFolderId
|
||||
? await assetService.resolveLatestVersionId(assetId)
|
||||
: undefined
|
||||
const userId = await getPublicShareUserId(c, shareId)
|
||||
await shareActivityService.recordView(shareId, { assetId: targetId, isShareEntry, userId })
|
||||
return c.body(null, 204)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.get('/shares/:shareId/info', async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const password = c.req.header('x-share-password')
|
||||
@@ -222,13 +276,16 @@ const route = app
|
||||
order = parts[1]
|
||||
}
|
||||
|
||||
const res = await assetService.listChildren({
|
||||
...req,
|
||||
assetId: folderId,
|
||||
assetType: req.assetType || 'file',
|
||||
sort,
|
||||
order,
|
||||
})
|
||||
const res = await assetService.listChildren(
|
||||
{
|
||||
...req,
|
||||
assetId: folderId,
|
||||
assetType: req.assetType || 'file',
|
||||
sort,
|
||||
order,
|
||||
},
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
|
||||
if (shareLink.watermarkConfigId && res.data.length > 0) {
|
||||
// Resolve symlink targets once and reuse for the media lookup, so each
|
||||
@@ -260,6 +317,8 @@ const route = app
|
||||
}
|
||||
}
|
||||
|
||||
res.data = res.data.map((item) => filterSharedFieldValues(item, shareLink.fieldVisibility))
|
||||
|
||||
return c.json(res)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
@@ -274,7 +333,10 @@ const route = app
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
|
||||
let asset = await assetService.getAsset({ assetId: fileId })
|
||||
let asset = await assetService.getAsset(
|
||||
{ assetId: fileId },
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
|
||||
// Only video/image/3d assets are subject to watermark protection; skip the
|
||||
// watermark lookup entirely for other media types (pdf, audio, ...).
|
||||
@@ -298,19 +360,25 @@ const route = app
|
||||
asset.media.hls.url = `/api/shares/${shareLink.id}/files/${asset.id}/m3u8/master.m3u8${pwQuery}`
|
||||
}
|
||||
|
||||
return c.json(asset)
|
||||
return c.json(filterSharedFieldValues(asset, shareLink.fieldVisibility))
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.post(
|
||||
'/shares/:shareId/files/:fileId/download-url',
|
||||
zValidator('json', z.object({ key: z.string().min(1) })),
|
||||
zValidator(
|
||||
'json',
|
||||
z.object({
|
||||
key: z.string().min(1),
|
||||
purpose: z.enum(['download', 'prepare', 'clipboard']).default('download'),
|
||||
}),
|
||||
),
|
||||
async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const fileId = c.req.param('fileId')
|
||||
const password = c.req.header('x-share-password')
|
||||
const { key } = c.req.valid('json')
|
||||
const { key, purpose } = c.req.valid('json')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
@@ -323,7 +391,16 @@ const route = app
|
||||
return c.json({ error: 'Invalid key' }, 400)
|
||||
}
|
||||
|
||||
const url = await assetService.getDownloadUrl(fileId, key)
|
||||
const { url, assetId } = await assetService.getDownloadUrlWithAsset(fileId, key)
|
||||
if (assetId !== fileId) await shareService.verifyPublicAccess(shareId, assetId, password)
|
||||
if (purpose === 'download') {
|
||||
const userId = await getPublicShareUserId(c, shareId)
|
||||
await shareActivityService.recordEvent(shareId, {
|
||||
kind: 'asset_downloaded',
|
||||
assetId,
|
||||
userId,
|
||||
})
|
||||
}
|
||||
return c.json({ url })
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
@@ -343,32 +420,107 @@ const route = app
|
||||
await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
|
||||
const targetFileId = await assetService.resolveTargetAssetId(fileId)
|
||||
let userId: string | undefined
|
||||
const session = await auth.api.getSession({
|
||||
headers: c.req.raw.headers,
|
||||
const userId = await getPublicShareUserId(c, shareId)
|
||||
const res = await assetService.listComments(targetFileId, req, userId, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
if (session?.user) {
|
||||
userId = session.user.id
|
||||
} else {
|
||||
const cookieName = `shumai_guest_${shareId}`
|
||||
const token = getCookie(c, cookieName) || getCookie(c, 'shumai_guest')
|
||||
if (token) {
|
||||
const verified = verifyGuestToken(token, shareId)
|
||||
if (verified) {
|
||||
const guestUser = await userService.getUserById(verified.userId)
|
||||
if (guestUser && guestUser.guestEmail) {
|
||||
userId = guestUser.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const res = await assetService.listComments(targetFileId, req, userId)
|
||||
return c.json(res)
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
},
|
||||
)
|
||||
.get('/shares/:shareId/files/:fileId/comments/print', async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const fileId = c.req.param('fileId')
|
||||
const password = c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
let asset = await assetService.getAsset(
|
||||
{ assetId: fileId },
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(fileId)
|
||||
|
||||
if (
|
||||
shareLink.watermarkConfigId &&
|
||||
(asset.proxyType === 'video' || asset.proxyType === 'image' || asset.proxyType === '3d')
|
||||
) {
|
||||
const wfMap = await watermarkService.getCompletedWatermarkMediaMap(
|
||||
[targetAssetId],
|
||||
shareLink.watermarkConfigId,
|
||||
)
|
||||
asset = await applyWatermarkToAssetMedia(
|
||||
asset,
|
||||
wfMap.get(targetAssetId) ?? null,
|
||||
shareLink.id,
|
||||
password,
|
||||
)
|
||||
}
|
||||
|
||||
const targetFileId = await assetService.resolveTargetAssetId(fileId)
|
||||
const userId = await getPublicShareUserId(c, shareId)
|
||||
const comments = await assetService.listAllComments(targetFileId, userId, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
|
||||
// Scope breadcrumbs strictly to folders inside the share link root so private
|
||||
// project and parent folder names are never leaked.
|
||||
const ancestors = asset.ancestorFolders ?? []
|
||||
const rootIndex = ancestors.findIndex((f) => f.id === shareLink.rootFolderId)
|
||||
const scopedAncestors = rootIndex !== -1 ? ancestors.slice(0, rootIndex) : []
|
||||
const scopedFolders = [...scopedAncestors]
|
||||
.reverse()
|
||||
.map((f) => f.name)
|
||||
.filter((name): name is string => Boolean(name))
|
||||
const breadcrumbs = shareLink.name ? [shareLink.name, ...scopedFolders] : scopedFolders
|
||||
|
||||
return c.json({
|
||||
asset: {
|
||||
...filterSharedFieldValues(asset, shareLink.fieldVisibility),
|
||||
ancestorFolders: scopedAncestors,
|
||||
},
|
||||
breadcrumbs,
|
||||
comments,
|
||||
})
|
||||
} catch (err) {
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
})
|
||||
.get(
|
||||
'/shares/:shareId/files/:fileId/comments/frame',
|
||||
zValidator('query', commentFrameQuerySchema),
|
||||
async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const fileId = c.req.param('fileId')
|
||||
const password =
|
||||
c.req.header('x-share-password') || c.req.query('password') || c.req.query('p')
|
||||
const { second, width } = c.req.valid('query')
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
const targetFileId = await assetService.resolveTargetAssetId(fileId)
|
||||
const result = await commentFrameService.extractFrame({
|
||||
assetId: targetFileId,
|
||||
second,
|
||||
width,
|
||||
watermarkConfigId: shareLink.watermarkConfigId,
|
||||
signal: c.req.raw.signal,
|
||||
})
|
||||
|
||||
return c.body(new Uint8Array(result.buffer), 200, {
|
||||
'Content-Type': result.mimeType,
|
||||
'Cache-Control': 'private, max-age=300',
|
||||
})
|
||||
} catch (err) {
|
||||
if (err instanceof HTTPException) {
|
||||
throw err
|
||||
}
|
||||
return handlePublicShareError(c, err)
|
||||
}
|
||||
},
|
||||
)
|
||||
.post(
|
||||
'/shares/:shareId/files/:fileId/comments',
|
||||
zValidator('json', createCommentRequestSchema.omit({ assetId: true, userId: true })),
|
||||
@@ -382,49 +534,36 @@ const route = app
|
||||
return c.json({ error: 'Attachments are not allowed on public share comments' }, 400)
|
||||
}
|
||||
|
||||
if (req.isInternal) {
|
||||
return c.json({ error: 'Internal comments are not allowed on public share links' }, 400)
|
||||
}
|
||||
|
||||
try {
|
||||
const shareLink = await shareService.getShareLink(shareId)
|
||||
await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
const shareLink = await shareService.verifyPublicAccess(shareId, fileId, password)
|
||||
|
||||
const targetFileId = await assetService.resolveTargetAssetId(fileId)
|
||||
|
||||
const teamId = await projectService.getProjectTeam(shareLink.projectId)
|
||||
|
||||
// Identify user
|
||||
let userId: string | null = null
|
||||
const session = await auth.api.getSession({
|
||||
headers: c.req.raw.headers,
|
||||
})
|
||||
|
||||
if (session?.user) {
|
||||
userId = session.user.id
|
||||
} else {
|
||||
const cookieName = `shumai_guest_${shareId}`
|
||||
const token = getCookie(c, cookieName) || getCookie(c, 'shumai_guest')
|
||||
if (token) {
|
||||
const verified = verifyGuestToken(token, shareId)
|
||||
if (verified) {
|
||||
const guestUser = await userService.getUserById(verified.userId)
|
||||
if (guestUser && guestUser.guestEmail) {
|
||||
userId = guestUser.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const userId = await getPublicShareUserId(c, shareId)
|
||||
|
||||
if (!userId) {
|
||||
return c.json({ error: 'Unauthorized' }, 401)
|
||||
}
|
||||
|
||||
const comment = await assetService.createComment({
|
||||
assetId: targetFileId,
|
||||
userId: userId,
|
||||
replyToId: req.replyToId,
|
||||
message: req.message,
|
||||
annotations: req.annotations,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
})
|
||||
const comment = await assetService.createComment(
|
||||
{
|
||||
assetId: targetFileId,
|
||||
userId,
|
||||
replyToId: req.replyToId,
|
||||
message: req.message,
|
||||
annotations: req.annotations,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
isInternal: false,
|
||||
},
|
||||
{ shareLinkId: shareId },
|
||||
)
|
||||
|
||||
const notifType = req.replyToId ? 'reply_created' : 'comment_created'
|
||||
|
||||
|
||||
@@ -4,9 +4,15 @@ import shareRoute from './share'
|
||||
import publicShareRoute from './public-share'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { shareActivityService } from '@shumai/core/src/share/share-activity'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { ShareLinkPasswordInvalidError, ShareLinkExpiredError } from '@shumai/core/src/share/errors'
|
||||
import {
|
||||
ShareLinkPasswordInvalidError,
|
||||
ShareLinkExpiredError,
|
||||
ShareLinkNotFoundError,
|
||||
} from '@shumai/core/src/share/errors'
|
||||
import { createGuestToken } from '@shumai/core/src/auth/guest-token'
|
||||
import { userService } from '@shumai/core/src/user/user'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
@@ -93,6 +99,82 @@ describe('Share API', () => {
|
||||
})
|
||||
|
||||
// Public Routes
|
||||
describe('POST /shares/:shareId/views', () => {
|
||||
test('attributes an authorized asset view to a verified guest', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
rootFolderId: 'folder1',
|
||||
} as Awaited<ReturnType<typeof shareService.verifyPublicAccess>>)
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockResolvedValue('asset1')
|
||||
vi.spyOn(userService, 'getUserById').mockResolvedValue({
|
||||
id: 'guest1',
|
||||
guestEmail: 'alice@example.com',
|
||||
} as Awaited<ReturnType<typeof userService.getUserById>>)
|
||||
const record = vi.spyOn(shareActivityService, 'recordView').mockResolvedValue(undefined)
|
||||
const token = createGuestToken({ userId: 'guest1', shareId: 'share1' })
|
||||
|
||||
const res = await app.request('/shares/share1/views', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-share-password': 'pass',
|
||||
Cookie: `shumai_guest_share1=${token}`,
|
||||
},
|
||||
body: JSON.stringify({ assetId: 'alias1', isShareEntry: true }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(204)
|
||||
expect(shareService.verifyPublicAccess).toHaveBeenCalledWith('share1', 'alias1', 'pass')
|
||||
expect(record).toHaveBeenCalledWith('share1', {
|
||||
assetId: 'asset1',
|
||||
isShareEntry: true,
|
||||
userId: 'guest1',
|
||||
})
|
||||
})
|
||||
|
||||
test('a rejected view leaves the counter and history alone', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockRejectedValue(
|
||||
new ShareLinkPasswordInvalidError('Incorrect password'),
|
||||
)
|
||||
const record = vi.spyOn(shareActivityService, 'recordView').mockResolvedValue(undefined)
|
||||
const res = await app.request('/shares/share1/views', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: '{}',
|
||||
})
|
||||
|
||||
expect(res.status).toBe(401)
|
||||
expect(record).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /shares/:shareId/activities', () => {
|
||||
test('returns the requested page to a share reader', async () => {
|
||||
const list = vi.spyOn(shareActivityService, 'list').mockResolvedValue({
|
||||
data: [],
|
||||
pageInfo: { total: 0 },
|
||||
})
|
||||
const res = await app.request('/shares/share1/activities?first=20')
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ data: [], pageInfo: { total: 0 } })
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
id: 'share1',
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Share,
|
||||
}),
|
||||
)
|
||||
expect(list).toHaveBeenCalledWith('share1', { first: 20 })
|
||||
})
|
||||
|
||||
test('denies access to activity without share read permission', async () => {
|
||||
vi.mocked(authzService.hasPermission).mockRejectedValueOnce(new HTTPException(403))
|
||||
const list = vi.spyOn(shareActivityService, 'list')
|
||||
const res = await app.request('/shares/share1/activities')
|
||||
expect(res.status).toBe(403)
|
||||
expect(list).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /shares/:shareId/info', () => {
|
||||
test('Success', async () => {
|
||||
vi.spyOn(shareService, 'getShareLink').mockResolvedValue({
|
||||
@@ -101,6 +183,8 @@ describe('Share API', () => {
|
||||
isDisabled: false,
|
||||
allowDownload: false,
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: true,
|
||||
rootFolderId: 'folder1',
|
||||
projectId: 'project1',
|
||||
@@ -134,6 +218,8 @@ describe('Share API', () => {
|
||||
isDisabled: false,
|
||||
allowDownload: false,
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: true,
|
||||
rootFolderId: 'folder1',
|
||||
projectId: 'project1',
|
||||
@@ -161,6 +247,8 @@ describe('Share API', () => {
|
||||
isDisabled: false,
|
||||
allowDownload: false,
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: true,
|
||||
rootFolderId: 'folder1',
|
||||
projectId: 'project1',
|
||||
@@ -217,6 +305,7 @@ describe('Share API', () => {
|
||||
sort: 'name',
|
||||
order: 'asc',
|
||||
}),
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
})
|
||||
|
||||
@@ -350,6 +439,119 @@ describe('Share API', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('public share field values', () => {
|
||||
const shareLinkWithFields = {
|
||||
id: 'share1',
|
||||
name: 'My Share',
|
||||
isDisabled: false,
|
||||
allowDownload: false,
|
||||
rootFolderId: 'folder1',
|
||||
projectId: 'project1',
|
||||
password: null,
|
||||
expireAt: null,
|
||||
watermarkConfigId: null,
|
||||
fieldVisibility: { status: true, internalNote: false },
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any
|
||||
|
||||
const assetWithFields = {
|
||||
id: 'file1',
|
||||
name: 'a.png',
|
||||
sizeByte: 1,
|
||||
fileCount: 0,
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
proxyType: 'pdf',
|
||||
fieldValues: [
|
||||
{ fieldId: 'status', value: 'Approved' },
|
||||
{ fieldId: 'internalNote', value: 'not for guests' },
|
||||
{ fieldId: 'rating', value: 3 },
|
||||
],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any
|
||||
|
||||
test('children only include field values visible on the share', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithFields)
|
||||
vi.spyOn(assetService, 'listChildren').mockResolvedValue({
|
||||
data: [assetWithFields],
|
||||
pageInfo: { total: 1, cursor: undefined },
|
||||
})
|
||||
|
||||
const res = await app.request('/shares/share1/folders/folder1/children?assetType=file')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.data[0].fieldValues).toEqual([{ fieldId: 'status', value: 'Approved' }])
|
||||
})
|
||||
|
||||
test('children with watermark only include field values visible on the share', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
...shareLinkWithFields,
|
||||
watermarkConfigId: 'cfg1',
|
||||
})
|
||||
vi.spyOn(assetService, 'listChildren').mockResolvedValue({
|
||||
data: [assetWithFields],
|
||||
pageInfo: { total: 1, cursor: undefined },
|
||||
})
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockImplementation(async (id) => id)
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
|
||||
const res = await app.request('/shares/share1/folders/folder1/children?assetType=file')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.data[0].fieldValues).toEqual([{ fieldId: 'status', value: 'Approved' }])
|
||||
})
|
||||
|
||||
test('children include no field values when the share shows no fields', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
...shareLinkWithFields,
|
||||
fieldVisibility: null,
|
||||
})
|
||||
vi.spyOn(assetService, 'listChildren').mockResolvedValue({
|
||||
data: [assetWithFields],
|
||||
pageInfo: { total: 1, cursor: undefined },
|
||||
})
|
||||
|
||||
const res = await app.request('/shares/share1/folders/folder1/children?assetType=file')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.data[0].fieldValues).toEqual([])
|
||||
})
|
||||
|
||||
test('file detail only includes field values visible on the share', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue(shareLinkWithFields)
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue(assetWithFields)
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.fieldValues).toEqual([{ fieldId: 'status', value: 'Approved' }])
|
||||
})
|
||||
|
||||
test('file detail with watermark only includes field values visible on the share', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
...shareLinkWithFields,
|
||||
watermarkConfigId: 'cfg1',
|
||||
})
|
||||
vi.spyOn(assetService, 'getAsset').mockResolvedValue({
|
||||
...assetWithFields,
|
||||
proxyType: 'image',
|
||||
media: { proxyType: 'image', videoTranscodes: [], imageTranscodes: [] },
|
||||
})
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockResolvedValue('file1')
|
||||
vi.spyOn(watermarkService, 'getCompletedWatermarkMediaMap').mockResolvedValue(new Map())
|
||||
|
||||
const res = await app.request('/shares/share1/files/file1')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body.fieldValues).toEqual([{ fieldId: 'status', value: 'Approved' }])
|
||||
})
|
||||
})
|
||||
|
||||
describe('GET /shares/:shareId/files/:fileId', () => {
|
||||
const shareLinkWithWatermark = {
|
||||
id: 'share1',
|
||||
@@ -712,6 +914,8 @@ describe('Share API', () => {
|
||||
rootFolderId: 'root1',
|
||||
projectId: 'project1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
@@ -756,6 +960,8 @@ describe('Share API', () => {
|
||||
rootFolderId: 'root1',
|
||||
projectId: 'project1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
@@ -813,6 +1019,8 @@ describe('Share API', () => {
|
||||
rootFolderId: 'root1',
|
||||
projectId: 'project1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
@@ -844,6 +1052,8 @@ describe('Share API', () => {
|
||||
rootFolderId: 'root1',
|
||||
projectId: 'project1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: false,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
@@ -888,6 +1098,8 @@ describe('Share API', () => {
|
||||
rootFolderId: 'root1',
|
||||
projectId: 'project1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
hasPassword: false,
|
||||
watermarkStatus: 'processing',
|
||||
watermarkConfigId: 'cfg1',
|
||||
@@ -976,12 +1188,60 @@ describe('Share API', () => {
|
||||
})
|
||||
|
||||
describe('POST /shares/:shareId/files/:fileId/download-url', () => {
|
||||
test('requires share access to the concrete asset selected for download', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess')
|
||||
.mockResolvedValueOnce({
|
||||
allowDownload: true,
|
||||
} as Awaited<ReturnType<typeof shareService.verifyPublicAccess>>)
|
||||
.mockRejectedValueOnce(new ShareLinkNotFoundError('Asset is not shared'))
|
||||
vi.spyOn(assetService, 'getDownloadUrlWithAsset').mockResolvedValue({
|
||||
url: 'https://s3.example.com/download',
|
||||
assetId: 'unshared',
|
||||
})
|
||||
const record = vi.spyOn(shareActivityService, 'recordEvent').mockResolvedValue(undefined)
|
||||
const res = await app.request('/shares/share1/files/file1/download-url', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'files/download.png' }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(404)
|
||||
expect(await res.json()).toEqual({ error: 'Asset is not shared' })
|
||||
expect(record).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test.each(['prepare', 'clipboard'])(
|
||||
'does not count a URL requested for %s',
|
||||
async (purpose) => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
allowDownload: true,
|
||||
} as Awaited<ReturnType<typeof shareService.verifyPublicAccess>>)
|
||||
vi.spyOn(assetService, 'getDownloadUrlWithAsset').mockResolvedValue({
|
||||
url: 'https://s3.example.com/download',
|
||||
assetId: 'target1',
|
||||
})
|
||||
const record = vi.spyOn(shareActivityService, 'recordEvent').mockResolvedValue(undefined)
|
||||
const res = await app.request('/shares/share1/files/symlink1/download-url', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ key: 'files/target1/fly.png', purpose }),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(record).not.toHaveBeenCalled()
|
||||
},
|
||||
)
|
||||
|
||||
test('Success for symlink asset in share', async () => {
|
||||
vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({
|
||||
allowDownload: true,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.spyOn(assetService, 'getDownloadUrl').mockResolvedValue('https://s3.example.com/download')
|
||||
vi.spyOn(assetService, 'getDownloadUrlWithAsset').mockResolvedValue({
|
||||
url: 'https://s3.example.com/download',
|
||||
assetId: 'target1',
|
||||
})
|
||||
const record = vi.spyOn(shareActivityService, 'recordEvent').mockResolvedValue(undefined)
|
||||
|
||||
const res = await app.request('/shares/share1/files/symlink1/download-url', {
|
||||
method: 'POST',
|
||||
@@ -993,7 +1253,15 @@ describe('Share API', () => {
|
||||
const body = await res.json()
|
||||
expect(body.url).toBe('https://s3.example.com/download')
|
||||
expect(shareService.verifyPublicAccess).toHaveBeenCalledWith('share1', 'symlink1', undefined)
|
||||
expect(assetService.getDownloadUrl).toHaveBeenCalledWith('symlink1', 'files/target1/fly.png')
|
||||
expect(assetService.getDownloadUrlWithAsset).toHaveBeenCalledWith(
|
||||
'symlink1',
|
||||
'files/target1/fly.png',
|
||||
)
|
||||
expect(record).toHaveBeenCalledWith('share1', {
|
||||
kind: 'asset_downloaded',
|
||||
assetId: 'target1',
|
||||
userId: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
test('Rejects when allowDownload is disabled', async () => {
|
||||
@@ -1004,8 +1272,8 @@ describe('Share API', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
const getDownloadUrlSpy = vi
|
||||
.spyOn(assetService, 'getDownloadUrl')
|
||||
.mockResolvedValue('https://s3.example.com/download')
|
||||
.spyOn(assetService, 'getDownloadUrlWithAsset')
|
||||
.mockResolvedValue({ url: 'https://s3.example.com/download', assetId: 'target1' })
|
||||
|
||||
const res = await app.request('/shares/share1/files/symlink1/download-url', {
|
||||
method: 'POST',
|
||||
@@ -1173,6 +1441,7 @@ describe('Share API', () => {
|
||||
userId: 'guest1',
|
||||
message: 'hello from alice',
|
||||
}),
|
||||
{ shareLinkId: 'share1' },
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ import { Hono } from 'hono'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { shareActivityService } from '@shumai/core/src/share/share-activity'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import {
|
||||
createShareLinkRequestSchema,
|
||||
updateShareLinkRequestSchema,
|
||||
listShareLinksRequestSchema,
|
||||
paginationParamsSchema,
|
||||
addAssetToShareRequestSchema,
|
||||
updateShareLinkWatermarkRequestSchema,
|
||||
AuditAction,
|
||||
@@ -90,6 +92,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const shareLink = await shareService.getShareLink(shareId)
|
||||
return c.json(shareLink)
|
||||
})
|
||||
.get('/shares/:shareId/activities', zValidator('query', paginationParamsSchema), async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
await authzService.hasPermission({
|
||||
user: c.get('user'),
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Share,
|
||||
id: shareId,
|
||||
})
|
||||
return c.json(await shareActivityService.list(shareId, c.req.valid('query')))
|
||||
})
|
||||
.put('/shares/:shareId', zValidator('json', updateShareLinkRequestSchema), async (c) => {
|
||||
const shareId = c.req.param('shareId')
|
||||
const user = c.get('user')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/core",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
@@ -28,9 +28,9 @@
|
||||
"@aws-sdk/s3-request-presigner": "3.1121.0",
|
||||
"@better-auth/mcp": "1.7.12",
|
||||
"@better-auth/oauth-provider": "1.7.12",
|
||||
"@earendil-works/chord": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/chord": "1.7.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@modelcontextprotocol/client": "2.0.0",
|
||||
"@shumai/db": "workspace:*",
|
||||
|
||||
@@ -92,8 +92,10 @@ export async function openSessionCache(sessionId: string) {
|
||||
throw new Error('Session commit sequence mismatch')
|
||||
seq = receipt.seq
|
||||
}
|
||||
if (result.stored !== commits.length)
|
||||
if (result.kind === 'refused') {
|
||||
throw result.refused ?? new Error('Session restoration refused')
|
||||
}
|
||||
if (result.stored !== commits.length) throw new Error('Session restoration was incomplete')
|
||||
}
|
||||
await save(true)
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { getPrismaTestingHelper, prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
@@ -941,7 +941,7 @@ describe('AssetService', () => {
|
||||
).resolves.not.toThrow()
|
||||
})
|
||||
|
||||
it('deleteComment cleans up S3 attachment files and database records', async () => {
|
||||
it('cleans up deleted comment attachments through the asset cleanup job', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
|
||||
// 1. Create StorageKey and Asset for attachment
|
||||
@@ -949,15 +949,15 @@ describe('AssetService', () => {
|
||||
data: {
|
||||
key: 'attachments/test-attachment-file.png',
|
||||
status: 'active',
|
||||
createdAt: new Date(Date.now() - 60_000),
|
||||
},
|
||||
})
|
||||
|
||||
const attachmentAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-attachment-file.png',
|
||||
type: AssetType.file,
|
||||
type: AssetType.attachment,
|
||||
projectId: project.id,
|
||||
parentId: assets.root.id,
|
||||
creatorId: user.id,
|
||||
storageKeyId: storageKey.id,
|
||||
sizeByte: 100,
|
||||
@@ -988,18 +988,278 @@ describe('AssetService', () => {
|
||||
// 5. Verify the comment is deleted from DB
|
||||
await expect(prisma.assetComment.findUnique({ where: { id: comment.id } })).resolves.toBeNull()
|
||||
|
||||
// 6. Verify that the attachment Asset and StorageKey are deleted from DB
|
||||
// 6. The attachment is removed immediately; the storage cleanup owns object deletion.
|
||||
await expect(prisma.asset.findUnique({ where: { id: attachmentAsset.id } })).resolves.toBeNull()
|
||||
expect(s3Service.deleteObject).not.toHaveBeenCalled()
|
||||
|
||||
await assetService.emptyTrash(project.id)
|
||||
|
||||
await expect(prisma.storageKey.findUnique({ where: { id: storageKey.id } })).resolves.toBeNull()
|
||||
|
||||
// 7. Verify S3 deletion was called
|
||||
const { s3Service } = await import('@shumai/core/src/s3/s3')
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(
|
||||
'shumai',
|
||||
'attachments/test-attachment-file.png',
|
||||
)
|
||||
})
|
||||
|
||||
describe('comment attachments', () => {
|
||||
const addProjectReviewer = async (teamId: string) => {
|
||||
const reviewer = await prisma.user.create({
|
||||
data: { name: 'Reviewer', type: 'human', email: `reviewer-${Date.now()}@example.com` },
|
||||
})
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId, userId: reviewer.id, role: 'reviewer' },
|
||||
})
|
||||
return reviewer
|
||||
}
|
||||
|
||||
const createUpload = async (projectId: string, creatorId: string, name: string) => {
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: `attachments/${name}`, status: 'active' },
|
||||
})
|
||||
return await prisma.asset.create({
|
||||
data: {
|
||||
name,
|
||||
type: AssetType.attachment,
|
||||
projectId,
|
||||
creatorId,
|
||||
sizeByte: 1,
|
||||
status: 'uploaded',
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
it('only attaches comment uploads made by the commenter', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
const reviewer = await addProjectReviewer(project.teamId)
|
||||
const ownerUpload = await createUpload(project.id, user.id, 'owner-upload.png')
|
||||
const reviewerUpload = await createUpload(project.id, reviewer.id, 'reviewer-upload.png')
|
||||
|
||||
const comment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: reviewer.id,
|
||||
message: 'looks good',
|
||||
attachmentIds: [assets.fileA2.id, ownerUpload.id, reviewerUpload.id],
|
||||
})
|
||||
|
||||
const links = await prisma.assetCommentAttachment.findMany({
|
||||
where: { commentId: comment.id },
|
||||
})
|
||||
expect(links.map((l) => l.assetId)).toEqual([reviewerUpload.id])
|
||||
})
|
||||
|
||||
it('does not attach an upload that already belongs to another comment', async () => {
|
||||
const { user, assets, project } = await setupBasicAssets()
|
||||
const upload = await createUpload(project.id, user.id, 'shared.png')
|
||||
|
||||
await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'first',
|
||||
attachmentIds: [upload.id],
|
||||
})
|
||||
const second = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'second',
|
||||
attachmentIds: [upload.id],
|
||||
})
|
||||
|
||||
const links = await prisma.assetCommentAttachment.findMany({
|
||||
where: { commentId: second.id },
|
||||
})
|
||||
expect(links).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('allows only one concurrent comment to claim an upload', async () => {
|
||||
// The normal test proxy serializes transactions on a single connection.
|
||||
const db = getPrismaTestingHelper().getUnderlyingClient() as typeof prisma
|
||||
const service = new AssetService(db)
|
||||
const { user, team, project, file, upload } = await db.$transaction(async (tx) => {
|
||||
const user = await tx.user.create({
|
||||
data: { name: 'Commenter', email: `attachment-race-${crypto.randomUUID()}@example.com` },
|
||||
})
|
||||
const team = await tx.team.create({ data: { name: 'Attachment race' } })
|
||||
const project = await tx.project.create({ data: { name: 'Project', teamId: team.id } })
|
||||
const file = await tx.asset.create({
|
||||
data: {
|
||||
name: 'File',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
projectId: project.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
const upload = await tx.asset.create({
|
||||
data: {
|
||||
name: 'Upload',
|
||||
type: AssetType.attachment,
|
||||
status: AssetStatus.uploaded,
|
||||
projectId: project.id,
|
||||
creatorId: user.id,
|
||||
},
|
||||
})
|
||||
return { user, team, project, file, upload }
|
||||
})
|
||||
|
||||
let claims: Promise<PromiseSettledResult<unknown>[]> | undefined
|
||||
try {
|
||||
await db.$transaction(async (tx) => {
|
||||
await tx.$queryRaw`SELECT id FROM assets WHERE id = ${upload.id} FOR UPDATE`
|
||||
claims = Promise.allSettled(
|
||||
['First comment', 'Second comment'].map((message) =>
|
||||
service.createComment(
|
||||
{ assetId: file.id, userId: user.id, message, attachmentIds: [upload.id] },
|
||||
{ triggerAgents: false },
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// Release the upload only after both requests are waiting on its row lock.
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
const [waiters] = await tx.$queryRaw<{ count: number }[]>`
|
||||
WITH RECURSIVE waiters(pid) AS (
|
||||
SELECT pg_backend_pid()
|
||||
UNION
|
||||
SELECT pending.pid
|
||||
FROM waiters
|
||||
JOIN (SELECT DISTINCT pid FROM pg_locks WHERE NOT granted) pending
|
||||
ON waiters.pid = ANY(pg_blocking_pids(pending.pid))
|
||||
)
|
||||
SELECT count(*)::int - 1 AS count FROM waiters
|
||||
`
|
||||
expect(waiters.count).toBe(2)
|
||||
},
|
||||
{ timeout: 3_000 },
|
||||
)
|
||||
})
|
||||
|
||||
expect(await claims).toEqual([
|
||||
expect.objectContaining({ status: 'fulfilled' }),
|
||||
expect.objectContaining({ status: 'fulfilled' }),
|
||||
])
|
||||
await expect(
|
||||
db.assetCommentAttachment.count({ where: { assetId: upload.id } }),
|
||||
).resolves.toBe(1)
|
||||
} finally {
|
||||
await claims
|
||||
await db.asset.deleteMany({ where: { projectId: project.id } })
|
||||
await db.project.delete({ where: { id: project.id } })
|
||||
await db.team.delete({ where: { id: team.id } })
|
||||
await db.user.delete({ where: { id: user.id } })
|
||||
}
|
||||
})
|
||||
|
||||
it('deleteComment keeps project files that are linked to the comment', async () => {
|
||||
const { project, assets } = await setupBasicAssets()
|
||||
const reviewer = await addProjectReviewer(project.teamId)
|
||||
const fileKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/01JAAAAAAAAAAAAAAAAAAAAAAA/deliverable.mov', status: 'active' },
|
||||
})
|
||||
await prisma.asset.update({
|
||||
where: { id: assets.fileA2.id },
|
||||
data: { storageKeyId: fileKey.id },
|
||||
})
|
||||
|
||||
const comment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: reviewer.id,
|
||||
message: 'note',
|
||||
attachmentIds: [],
|
||||
})
|
||||
// A link to a project file, as comments created before attachment checks could hold.
|
||||
await prisma.assetCommentAttachment.create({
|
||||
data: { commentId: comment.id, assetId: assets.fileA2.id },
|
||||
})
|
||||
|
||||
await assetService.deleteComment({ commentId: comment.id, userId: reviewer.id })
|
||||
|
||||
await expect(
|
||||
prisma.assetComment.findUnique({ where: { id: comment.id } }),
|
||||
).resolves.toBeNull()
|
||||
await expect(
|
||||
prisma.asset.findUnique({ where: { id: assets.fileA2.id } }),
|
||||
).resolves.not.toBeNull()
|
||||
await expect(
|
||||
prisma.storageKey.findUnique({ where: { id: fileKey.id } }),
|
||||
).resolves.not.toBeNull()
|
||||
expect(s3Service.deleteObject).not.toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
'files/01JAAAAAAAAAAAAAAAAAAAAAAA/deliverable.mov',
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps an attachment object until the original and copied comments are deleted', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
const upload = await createUpload(project.id, user.id, 'copied-upload.png')
|
||||
const originalComment = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'Original comment',
|
||||
attachmentIds: [upload.id],
|
||||
})
|
||||
const [copiedFileId] = await assetService.copyAssets({
|
||||
assetIds: [assets.fileA1.id],
|
||||
newParentId: assets.root3.id,
|
||||
creatorId: user.id,
|
||||
withComments: true,
|
||||
})
|
||||
const copiedComment = await prisma.assetComment.findFirstOrThrow({
|
||||
where: { assetId: copiedFileId },
|
||||
})
|
||||
const storageKey = await prisma.storageKey.findFirstOrThrow({
|
||||
where: { key: 'attachments/copied-upload.png' },
|
||||
})
|
||||
await prisma.storageKey.update({
|
||||
where: { id: storageKey.id },
|
||||
data: { createdAt: new Date(Date.now() - 60_000) },
|
||||
})
|
||||
|
||||
await assetService.deleteComment({ commentId: copiedComment.id, userId: user.id })
|
||||
await assetService.emptyTrash(project.id)
|
||||
|
||||
const survivingUpload = await prisma.asset.findUniqueOrThrow({ where: { id: upload.id } })
|
||||
expect(survivingUpload.storageKeyId).toBe(storageKey.id)
|
||||
expect(s3Service.deleteObject).not.toHaveBeenCalledWith(expect.any(String), storageKey.key)
|
||||
|
||||
await assetService.deleteComment({ commentId: originalComment.id, userId: user.id })
|
||||
await assetService.emptyTrash(project.id)
|
||||
|
||||
await expect(
|
||||
prisma.storageKey.findUnique({ where: { id: storageKey.id } }),
|
||||
).resolves.toBeNull()
|
||||
expect(s3Service.deleteObject).toHaveBeenCalledWith(expect.any(String), storageKey.key)
|
||||
})
|
||||
|
||||
it('keeps a legacy attachment asset while another comment still links to it', async () => {
|
||||
const { user, project, assets } = await setupBasicAssets()
|
||||
const upload = await createUpload(project.id, user.id, 'legacy-upload.png')
|
||||
const first = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'First comment',
|
||||
attachmentIds: [upload.id],
|
||||
})
|
||||
const second = await assetService.createComment({
|
||||
assetId: assets.fileA1.id,
|
||||
userId: user.id,
|
||||
message: 'Second comment',
|
||||
attachmentIds: [],
|
||||
})
|
||||
await prisma.assetCommentAttachment.create({
|
||||
data: { assetId: upload.id, commentId: second.id },
|
||||
})
|
||||
|
||||
await assetService.deleteComment({ commentId: first.id, userId: user.id })
|
||||
await expect(prisma.asset.findUnique({ where: { id: upload.id } })).resolves.not.toBeNull()
|
||||
|
||||
await assetService.deleteComment({ commentId: second.id, userId: user.id })
|
||||
await expect(prisma.asset.findUnique({ where: { id: upload.id } })).resolves.toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
it('can create and retrieve comments with video timestamp', async () => {
|
||||
const { user, assets } = await setupBasicAssets()
|
||||
|
||||
@@ -5704,4 +5964,367 @@ describe('AssetService — natural sort by name', () => {
|
||||
expect(variant).toContain('http://mock-s3-url')
|
||||
})
|
||||
})
|
||||
|
||||
describe('internal comments and comment editing', () => {
|
||||
async function setupCommentFixture() {
|
||||
const team = await prisma.team.create({ data: { name: 'Comment Team' } })
|
||||
const author = await prisma.user.create({
|
||||
data: { name: 'Author', email: `author-${Date.now()}-${Math.random()}@test.com` },
|
||||
})
|
||||
const owner = await prisma.user.create({
|
||||
data: { name: 'Owner', email: `owner-${Date.now()}-${Math.random()}@test.com` },
|
||||
})
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: author.id, role: 'editor' },
|
||||
})
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: owner.id, role: 'owner' },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Comment Project', teamId: team.id },
|
||||
})
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
const file = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'clip.mp4',
|
||||
type: AssetType.file,
|
||||
projectId: project.id,
|
||||
parentId: rootFolder.id,
|
||||
creatorId: author.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
return { team, author, owner, project, rootFolder, file }
|
||||
}
|
||||
|
||||
async function createAttachmentAsset(projectId: string, creatorId: string, name: string) {
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: `files/attachments/${Date.now()}-${Math.random()}-${name}` },
|
||||
})
|
||||
return prisma.asset.create({
|
||||
data: {
|
||||
name,
|
||||
type: AssetType.attachment,
|
||||
projectId,
|
||||
creatorId,
|
||||
status: AssetStatus.uploaded,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
it('creates public (default) and internal comments, and enforces internal replies on internal parents', async () => {
|
||||
const { author, owner, file } = await setupCommentFixture()
|
||||
|
||||
const pub = await assetService.createComment(
|
||||
{ assetId: file.id, userId: author.id, message: 'Public feedback', attachmentIds: [] },
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
expect(pub.isInternal).toBe(false)
|
||||
|
||||
const internal = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
message: 'Internal note',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
expect(internal.isInternal).toBe(true)
|
||||
|
||||
// Replying to an internal parent forces isInternal: true even if false is passed
|
||||
const replyToInternal = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: owner.id,
|
||||
replyToId: internal.id,
|
||||
message: 'Internal reply',
|
||||
attachmentIds: [],
|
||||
isInternal: false,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
expect(replyToInternal.isInternal).toBe(true)
|
||||
|
||||
// Replying internally to a public parent is allowed
|
||||
const internalReplyOnPublic = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: owner.id,
|
||||
replyToId: pub.id,
|
||||
message: 'Private side note',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
expect(internalReplyOnPublic.isInternal).toBe(true)
|
||||
|
||||
const publicReplyOnPublic = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
replyToId: pub.id,
|
||||
message: 'Public reply',
|
||||
attachmentIds: [],
|
||||
isInternal: false,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
expect(publicReplyOnPublic.isInternal).toBe(false)
|
||||
|
||||
// Authenticated list includes everything
|
||||
const allListed = await assetService.listComments(file.id, { first: 20 }, author.id)
|
||||
expect(allListed.data).toHaveLength(2)
|
||||
expect(allListed.data[0].replies).toHaveLength(2)
|
||||
expect(allListed.data[1].replies).toHaveLength(1)
|
||||
|
||||
// Public share list excludes internal comments and internal replies
|
||||
const publicListed = await assetService.listComments(file.id, { first: 20 }, undefined, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
expect(publicListed.data).toHaveLength(1)
|
||||
expect(publicListed.data[0].id).toBe(pub.id)
|
||||
expect(publicListed.data[0].replies.map((r) => r.id)).toEqual([publicReplyOnPublic.id])
|
||||
|
||||
// listAllComments with excludeInternal matches
|
||||
const publicAll = await assetService.listAllComments(file.id, undefined, {
|
||||
excludeInternal: true,
|
||||
})
|
||||
expect(publicAll).toHaveLength(1)
|
||||
expect(publicAll[0].replies.map((r) => r.id)).toEqual([publicReplyOnPublic.id])
|
||||
})
|
||||
|
||||
it('excludes internal comments and replies under internal parents from public share commentsCount', async () => {
|
||||
const { author, rootFolder, file } = await setupCommentFixture()
|
||||
|
||||
const pub = await assetService.createComment(
|
||||
{ assetId: file.id, userId: author.id, message: 'Public', attachmentIds: [] },
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
replyToId: pub.id,
|
||||
message: 'Internal reply on public',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
const internal = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
message: 'Internal root',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
replyToId: internal.id,
|
||||
message: 'Reply on internal',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
|
||||
const allChildren = await assetService.listChildren({
|
||||
assetId: rootFolder.id,
|
||||
assetType: 'file',
|
||||
})
|
||||
expect(allChildren.data.find((a) => a.id === file.id)?.commentsCount).toBe(4)
|
||||
|
||||
const publicChildren = await assetService.listChildren(
|
||||
{ assetId: rootFolder.id, assetType: 'file' },
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
expect(publicChildren.data.find((a) => a.id === file.id)?.commentsCount).toBe(1)
|
||||
|
||||
const publicFile = await assetService.getAsset(
|
||||
{ assetId: file.id },
|
||||
{ excludeInternalComments: true },
|
||||
)
|
||||
expect(publicFile.commentsCount).toBe(1)
|
||||
})
|
||||
|
||||
it('rejects replying to an internal comment from a public share link', async () => {
|
||||
const { author, file } = await setupCommentFixture()
|
||||
const internal = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
message: 'Internal only',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
|
||||
await expect(
|
||||
assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
replyToId: internal.id,
|
||||
message: 'Guest reply attempt',
|
||||
attachmentIds: [],
|
||||
},
|
||||
{ triggerAgents: false, shareLinkId: 'share-1' },
|
||||
),
|
||||
).rejects.toMatchObject({ status: 404 })
|
||||
})
|
||||
|
||||
it('allows author to edit text, visibility, remove timestamp, and add/delete attachments', async () => {
|
||||
const { author, project, file } = await setupCommentFixture()
|
||||
const att1 = await createAttachmentAsset(project.id, author.id, 'old.png')
|
||||
const att2 = await createAttachmentAsset(project.id, author.id, 'keep.pdf')
|
||||
const att3 = await createAttachmentAsset(project.id, author.id, 'new.png')
|
||||
|
||||
const created = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
message: 'Original message',
|
||||
second: 12.5,
|
||||
attachmentIds: [att1.id, att2.id],
|
||||
isInternal: false,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
|
||||
const updated = await assetService.updateComment({
|
||||
commentId: created.id,
|
||||
userId: author.id,
|
||||
message: 'Updated message',
|
||||
isInternal: true,
|
||||
second: null,
|
||||
attachmentIds: [att2.id, att3.id],
|
||||
})
|
||||
|
||||
expect(updated.message).toBe('Updated message')
|
||||
expect(updated.isInternal).toBe(true)
|
||||
expect(updated.second).toBeNull()
|
||||
expect(updated.attachments.map((a) => a.assetId).sort()).toEqual([att2.id, att3.id].sort())
|
||||
|
||||
// Removed attachment asset should be cleaned up since no comment references it anymore
|
||||
expect(await prisma.asset.findUnique({ where: { id: att1.id } })).toBeNull()
|
||||
expect(await prisma.asset.findUnique({ where: { id: att2.id } })).not.toBeNull()
|
||||
expect(await prisma.asset.findUnique({ where: { id: att3.id } })).not.toBeNull()
|
||||
})
|
||||
|
||||
it('enforces author-only edit, parent-internal reply constraint, non-empty validation, and preserves reply flags', async () => {
|
||||
const { author, owner, file } = await setupCommentFixture()
|
||||
|
||||
const parent = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
message: 'Parent comment',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
const reply = await assetService.createComment(
|
||||
{
|
||||
assetId: file.id,
|
||||
userId: author.id,
|
||||
replyToId: parent.id,
|
||||
message: 'Internal reply',
|
||||
attachmentIds: [],
|
||||
isInternal: true,
|
||||
},
|
||||
{ triggerAgents: false },
|
||||
)
|
||||
|
||||
// Non-author (even team owner) cannot edit
|
||||
await expect(
|
||||
assetService.updateComment({
|
||||
commentId: parent.id,
|
||||
userId: owner.id,
|
||||
message: 'Owner edit attempt',
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 403 })
|
||||
|
||||
// Reply cannot be made public while parent is internal
|
||||
await expect(
|
||||
assetService.updateComment({
|
||||
commentId: reply.id,
|
||||
userId: author.id,
|
||||
isInternal: false,
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 400 })
|
||||
|
||||
// Empty comment without attachments or annotations is rejected
|
||||
await expect(
|
||||
assetService.updateComment({
|
||||
commentId: parent.id,
|
||||
userId: author.id,
|
||||
message: ' ',
|
||||
attachmentIds: [],
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 400 })
|
||||
|
||||
// Toggling parent Internal -> Public keeps reply's own isInternal flag intact
|
||||
const toggledParent = await assetService.updateComment({
|
||||
commentId: parent.id,
|
||||
userId: author.id,
|
||||
isInternal: false,
|
||||
})
|
||||
expect(toggledParent.isInternal).toBe(false)
|
||||
expect(toggledParent.replies[0].isInternal).toBe(true)
|
||||
|
||||
// Agent comments cannot be edited
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Bot',
|
||||
email: `bot-${Date.now()}-${Math.random()}@test.com`,
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
const agent = await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: (await prisma.project.findUniqueOrThrow({ where: { id: file.projectId! } }))
|
||||
.teamId,
|
||||
type: 'chat',
|
||||
config: { provider: 'openai', model: 'gpt-4' },
|
||||
},
|
||||
})
|
||||
const session = await prisma.agentSession.create({
|
||||
data: { agentId: agent.id, cwd: '/tmp' },
|
||||
})
|
||||
const agentComment = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: file.id,
|
||||
creatorId: author.id,
|
||||
sessionId: session.id,
|
||||
message: 'Agent generated reply',
|
||||
},
|
||||
})
|
||||
await expect(
|
||||
assetService.updateComment({
|
||||
commentId: agentComment.id,
|
||||
userId: author.id,
|
||||
message: 'Try edit agent',
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 403 })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -61,6 +61,7 @@ import { dedupeSymlinksToTarget } from './symlink'
|
||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||
import { shareActivityService } from '@shumai/core/src/share/share-activity'
|
||||
import { getAgentRequiredLevel, getRoleLevel } from '@shumai/core/src/agent/permissions'
|
||||
import { resolveEffectiveRole } from '@shumai/core/src/authz/authz'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
@@ -742,7 +743,10 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
async listChildren(req: ListChildrenRequest): Promise<PaginatedData<AssetInfo[]>> {
|
||||
async listChildren(
|
||||
req: ListChildrenRequest,
|
||||
options?: { excludeInternalComments?: boolean },
|
||||
): Promise<PaginatedData<AssetInfo[]>> {
|
||||
let typesToQuery: AssetType[]
|
||||
if (req.assetType === 'file') {
|
||||
typesToQuery = [AssetType.file, AssetType.version_stack]
|
||||
@@ -830,6 +834,7 @@ export class AssetService {
|
||||
|
||||
const infos = await this.toAssetInfos(assets, undefined, {
|
||||
includeDeletedChildren: req.showDeleted,
|
||||
excludeInternalComments: options?.excludeInternalComments,
|
||||
})
|
||||
|
||||
return { data: infos, pageInfo }
|
||||
@@ -1106,7 +1111,10 @@ export class AssetService {
|
||||
return this.getAsset({ assetId: asset.id })
|
||||
}
|
||||
|
||||
async getAsset(req: GetAssetRequest): Promise<AssetInfo> {
|
||||
async getAsset(
|
||||
req: GetAssetRequest,
|
||||
options?: { excludeInternalComments?: boolean },
|
||||
): Promise<AssetInfo> {
|
||||
const a = await this.prismaClient.asset.findUnique({
|
||||
where: { id: req.assetId },
|
||||
include: assetInclude,
|
||||
@@ -1129,7 +1137,9 @@ export class AssetService {
|
||||
afs.push({ id: row.id, name: row.name })
|
||||
}
|
||||
|
||||
const infos = await this.toAssetInfos([a])
|
||||
const infos = await this.toAssetInfos([a], undefined, {
|
||||
excludeInternalComments: options?.excludeInternalComments,
|
||||
})
|
||||
const info = infos[0]
|
||||
info.ancestorFolders = afs
|
||||
|
||||
@@ -1957,6 +1967,27 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
private async lockCommentAttachments(
|
||||
tx: Prisma.TransactionClient,
|
||||
attachmentIds: string[],
|
||||
owner?: { projectId: string | null; userId: string },
|
||||
): Promise<string[]> {
|
||||
if (attachmentIds.length === 0) return []
|
||||
|
||||
// Lock the same rows in the same order when claiming or removing attachments.
|
||||
const ownerFilter = owner
|
||||
? Prisma.sql`AND project_id IS NOT DISTINCT FROM ${owner.projectId} AND creator_id = ${owner.userId}`
|
||||
: Prisma.empty
|
||||
const attachments = await tx.$queryRaw<{ id: string }[]>`
|
||||
SELECT id FROM assets
|
||||
WHERE id IN (${Prisma.join(attachmentIds)}) AND type = 'attachment'
|
||||
${ownerFilter}
|
||||
ORDER BY id
|
||||
FOR NO KEY UPDATE
|
||||
`
|
||||
return attachments.map(({ id }) => id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a comment or reply. Mentions of agents (`<@agentId>`) start a chat with them
|
||||
* unless `triggerAgents` is false, which keeps an agent's own comments from starting
|
||||
@@ -1964,7 +1995,7 @@ export class AssetService {
|
||||
*/
|
||||
async createComment(
|
||||
req: CreateCommentRequest,
|
||||
options: { triggerAgents?: boolean } = {},
|
||||
options: { triggerAgents?: boolean; shareLinkId?: string } = {},
|
||||
): Promise<CommentInfo> {
|
||||
const triggerAgents = options.triggerAgents ?? true
|
||||
let commentId = ''
|
||||
@@ -1979,16 +2010,43 @@ export class AssetService {
|
||||
|
||||
let actualReplyToId = req.replyToId
|
||||
let parentComment = null
|
||||
let parentIsInternal = false
|
||||
if (req.replyToId) {
|
||||
parentComment = await tx.assetComment.findUnique({
|
||||
where: { id: req.replyToId },
|
||||
include: { creator: true },
|
||||
include: {
|
||||
creator: true,
|
||||
replyTo: { select: { id: true, isInternal: true } },
|
||||
},
|
||||
})
|
||||
if (options.shareLinkId) {
|
||||
if (
|
||||
!parentComment ||
|
||||
parentComment.assetId !== a.id ||
|
||||
parentComment.isInternal ||
|
||||
parentComment.replyTo?.isInternal
|
||||
) {
|
||||
throw new HTTPException(404, { message: 'Comment not found' })
|
||||
}
|
||||
}
|
||||
if (parentComment?.replyToId) {
|
||||
actualReplyToId = parentComment.replyToId
|
||||
parentIsInternal = Boolean(parentComment.isInternal || parentComment.replyTo?.isInternal)
|
||||
} else if (parentComment) {
|
||||
parentIsInternal = parentComment.isInternal
|
||||
}
|
||||
}
|
||||
|
||||
const isInternal = options.shareLinkId
|
||||
? false
|
||||
: parentIsInternal
|
||||
? true
|
||||
: Boolean(req.isInternal)
|
||||
|
||||
const attachmentIds = await this.lockCommentAttachments(tx, req.attachmentIds, {
|
||||
projectId: a.projectId,
|
||||
userId: req.userId,
|
||||
})
|
||||
const comment = await tx.assetComment.create({
|
||||
data: {
|
||||
assetId: a.id,
|
||||
@@ -1997,27 +2055,28 @@ export class AssetService {
|
||||
annotation: req.annotations,
|
||||
second: req.second,
|
||||
replyToId: actualReplyToId,
|
||||
isInternal,
|
||||
},
|
||||
})
|
||||
commentId = comment.id
|
||||
|
||||
for (const attachmentId of req.attachmentIds) {
|
||||
const attachmentAsset = await tx.asset.findUnique({
|
||||
where: { id: attachmentId },
|
||||
if (attachmentIds.length > 0) {
|
||||
// Read the links after acquiring the locks to see any claims that committed while waiting.
|
||||
const unclaimed = await tx.asset.findMany({
|
||||
where: { id: { in: attachmentIds }, commentAttachments: { none: {} } },
|
||||
select: { id: true },
|
||||
})
|
||||
if (
|
||||
attachmentAsset &&
|
||||
(attachmentAsset.type === AssetType.attachment ||
|
||||
attachmentAsset.type === AssetType.file) &&
|
||||
attachmentAsset.projectId === a.projectId
|
||||
) {
|
||||
await tx.assetCommentAttachment.create({
|
||||
data: {
|
||||
assetId: attachmentAsset.id,
|
||||
commentId: comment.id,
|
||||
},
|
||||
})
|
||||
}
|
||||
await tx.assetCommentAttachment.createMany({
|
||||
data: unclaimed.map(({ id }) => ({ assetId: id, commentId: comment.id })),
|
||||
})
|
||||
}
|
||||
|
||||
if (options.shareLinkId) {
|
||||
await shareActivityService.recordEvent(
|
||||
options.shareLinkId,
|
||||
{ kind: 'comment_created', assetId: a.id, userId: req.userId },
|
||||
tx,
|
||||
)
|
||||
}
|
||||
|
||||
if (!triggerAgents) return
|
||||
@@ -2195,22 +2254,154 @@ export class AssetService {
|
||||
return this.getComment(commentId, userId)
|
||||
}
|
||||
|
||||
async updateComment(params: {
|
||||
commentId: string
|
||||
userId: string
|
||||
message?: string
|
||||
isInternal?: boolean
|
||||
second?: number | null
|
||||
attachmentIds?: string[]
|
||||
}): Promise<CommentInfo> {
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
const comment = await tx.assetComment.findUnique({
|
||||
where: { id: params.commentId },
|
||||
select: {
|
||||
id: true,
|
||||
creatorId: true,
|
||||
sessionId: true,
|
||||
message: true,
|
||||
annotation: true,
|
||||
second: true,
|
||||
isInternal: true,
|
||||
attachments: { select: { assetId: true } },
|
||||
replyTo: { select: { isInternal: true } },
|
||||
asset: { select: { projectId: true } },
|
||||
},
|
||||
})
|
||||
|
||||
if (!comment) {
|
||||
throw new HTTPException(404, { message: 'Comment not found' })
|
||||
}
|
||||
|
||||
if (comment.sessionId !== null || comment.creatorId !== params.userId) {
|
||||
throw new HTTPException(403, { message: 'Only the comment author can edit this comment' })
|
||||
}
|
||||
|
||||
if (comment.replyTo?.isInternal && params.isInternal === false) {
|
||||
throw new HTTPException(400, {
|
||||
message: 'Cannot make a reply public when its parent comment is internal',
|
||||
})
|
||||
}
|
||||
|
||||
const existingAttachmentIds = comment.attachments.map(({ assetId }) => assetId)
|
||||
const existingSet = new Set(existingAttachmentIds)
|
||||
|
||||
let toAdd: string[] = []
|
||||
let toRemove: string[] = []
|
||||
let keptCount = existingAttachmentIds.length
|
||||
|
||||
if (params.attachmentIds !== undefined) {
|
||||
const desiredIds = Array.from(new Set(params.attachmentIds))
|
||||
const desiredSet = new Set(desiredIds)
|
||||
toAdd = desiredIds.filter((id) => !existingSet.has(id))
|
||||
toRemove = existingAttachmentIds.filter((id) => !desiredSet.has(id))
|
||||
keptCount = existingAttachmentIds.filter((id) => desiredSet.has(id)).length
|
||||
}
|
||||
|
||||
const idsToLock = Array.from(new Set([...toAdd, ...toRemove]))
|
||||
let claimedToAdd: string[] = []
|
||||
let lockedToRemove: string[] = []
|
||||
|
||||
if (idsToLock.length > 0) {
|
||||
const lockedRows = await tx.$queryRaw<
|
||||
{ id: string; projectId: string | null; creatorId: string | null }[]
|
||||
>`
|
||||
SELECT id, project_id AS "projectId", creator_id AS "creatorId" FROM assets
|
||||
WHERE id IN (${Prisma.join(idsToLock)}) AND type = 'attachment'
|
||||
ORDER BY id
|
||||
FOR NO KEY UPDATE
|
||||
`
|
||||
const toAddSet = new Set(toAdd)
|
||||
const toRemoveSet = new Set(toRemove)
|
||||
const ownedToAdd = lockedRows
|
||||
.filter(
|
||||
(row) =>
|
||||
toAddSet.has(row.id) &&
|
||||
row.projectId === comment.asset.projectId &&
|
||||
row.creatorId === params.userId,
|
||||
)
|
||||
.map((row) => row.id)
|
||||
|
||||
lockedToRemove = lockedRows.filter((row) => toRemoveSet.has(row.id)).map((row) => row.id)
|
||||
|
||||
if (ownedToAdd.length > 0) {
|
||||
const unclaimed = await tx.asset.findMany({
|
||||
where: { id: { in: ownedToAdd }, commentAttachments: { none: {} } },
|
||||
select: { id: true },
|
||||
})
|
||||
claimedToAdd = unclaimed.map(({ id }) => id)
|
||||
}
|
||||
}
|
||||
|
||||
const finalMessage = params.message !== undefined ? params.message : (comment.message ?? '')
|
||||
const hasAnnotations = Array.isArray(comment.annotation) && comment.annotation.length > 0
|
||||
const finalAttachmentCount = keptCount + claimedToAdd.length
|
||||
|
||||
if (!finalMessage.trim() && finalAttachmentCount === 0 && !hasAnnotations) {
|
||||
throw new HTTPException(400, { message: 'Comment cannot be empty' })
|
||||
}
|
||||
|
||||
if (toRemove.length > 0) {
|
||||
await tx.assetCommentAttachment.deleteMany({
|
||||
where: {
|
||||
commentId: params.commentId,
|
||||
assetId: { in: toRemove },
|
||||
},
|
||||
})
|
||||
if (lockedToRemove.length > 0) {
|
||||
await tx.asset.deleteMany({
|
||||
where: { id: { in: lockedToRemove }, commentAttachments: { none: {} } },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (claimedToAdd.length > 0) {
|
||||
await tx.assetCommentAttachment.createMany({
|
||||
data: claimedToAdd.map((assetId) => ({ assetId, commentId: params.commentId })),
|
||||
})
|
||||
}
|
||||
|
||||
const updateData: Prisma.AssetCommentUpdateInput = {}
|
||||
if (params.message !== undefined) {
|
||||
updateData.message = params.message
|
||||
}
|
||||
if (params.isInternal !== undefined) {
|
||||
updateData.isInternal = params.isInternal
|
||||
}
|
||||
if (params.second !== undefined) {
|
||||
updateData.second = params.second
|
||||
}
|
||||
|
||||
if (Object.keys(updateData).length > 0) {
|
||||
await tx.assetComment.update({
|
||||
where: { id: params.commentId },
|
||||
data: updateData,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return this.getComment(params.commentId, params.userId)
|
||||
}
|
||||
|
||||
async deleteComment({ commentId, userId }: { commentId: string; userId: string }): Promise<void> {
|
||||
const comment = await this.prismaClient.assetComment.findUnique({
|
||||
where: { id: commentId },
|
||||
include: {
|
||||
attachments: {
|
||||
include: {
|
||||
asset: {
|
||||
include: {
|
||||
storageKey: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
creatorId: true,
|
||||
attachments: { select: { assetId: true } },
|
||||
asset: {
|
||||
select: {
|
||||
project: { select: { id: true, teamId: true } },
|
||||
project: { select: { teamId: true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -2248,75 +2439,70 @@ export class AssetService {
|
||||
throw new HTTPException(403, { message: 'You do not have permission to delete this comment' })
|
||||
}
|
||||
|
||||
// Clean up attachment files from S3/storage and delete their DB records
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
for (const att of comment.attachments) {
|
||||
const asset = att.asset
|
||||
if (asset.storageKey) {
|
||||
try {
|
||||
await s3Service.deleteObject(bucket, asset.storageKey.key)
|
||||
} catch (err) {
|
||||
logger.error({ err, assetId: asset.id }, 'Failed to delete attachment file from S3')
|
||||
}
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
const attachmentIds = await this.lockCommentAttachments(
|
||||
tx,
|
||||
comment.attachments.map(({ assetId }) => assetId),
|
||||
)
|
||||
await tx.assetComment.delete({ where: { id: commentId } })
|
||||
|
||||
if (attachmentIds.length > 0) {
|
||||
// The storage cleanup job removes objects once every asset using their storage key is gone.
|
||||
await tx.asset.deleteMany({
|
||||
where: { id: { in: attachmentIds }, commentAttachments: { none: {} } },
|
||||
})
|
||||
}
|
||||
|
||||
await this.prismaClient.asset.delete({
|
||||
where: { id: asset.id },
|
||||
})
|
||||
|
||||
if (asset.storageKey) {
|
||||
await this.prismaClient.storageKey
|
||||
.delete({
|
||||
where: { id: asset.storageKey.id },
|
||||
})
|
||||
.catch(() => {
|
||||
// Silently ignore if already deleted
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await this.prismaClient.assetComment.delete({
|
||||
where: { id: commentId },
|
||||
})
|
||||
}
|
||||
|
||||
private getCommentInclude(options?: { excludeInternal?: boolean }) {
|
||||
return {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
asset: { include: { storageKey: true } },
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' as const },
|
||||
},
|
||||
replies: {
|
||||
...(options?.excludeInternal ? { where: { isInternal: false } } : {}),
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' as const },
|
||||
},
|
||||
},
|
||||
orderBy: { id: 'asc' as const },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async listComments(
|
||||
assetId: string,
|
||||
params: PaginationParams,
|
||||
requestingUserId?: string,
|
||||
options?: { excludeInternal?: boolean },
|
||||
): Promise<PaginatedData<CommentInfo[]>> {
|
||||
const resolvedAssetId = await this.resolveLatestVersionId(assetId)
|
||||
const where: Prisma.AssetCommentWhereInput = {
|
||||
assetId: resolvedAssetId,
|
||||
replyToId: null,
|
||||
...(options?.excludeInternal ? { isInternal: false } : {}),
|
||||
}
|
||||
|
||||
const { data: comments, pageInfo } = await paginateQuery(
|
||||
async (skip, take) => {
|
||||
return this.prismaClient.assetComment.findMany({
|
||||
where: { assetId: resolvedAssetId, replyToId: null },
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
asset: { include: { storageKey: true } },
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
},
|
||||
replies: {
|
||||
include: {
|
||||
creator: true,
|
||||
completionLastChangedBy: true,
|
||||
attachments: { include: { asset: { include: { storageKey: true } } } },
|
||||
reactions: {
|
||||
include: {
|
||||
user: { select: { id: true, name: true } },
|
||||
},
|
||||
orderBy: { createdAt: 'asc' },
|
||||
},
|
||||
},
|
||||
orderBy: { id: 'asc' },
|
||||
},
|
||||
},
|
||||
where,
|
||||
include: this.getCommentInclude(options),
|
||||
skip,
|
||||
take,
|
||||
orderBy: { id: 'asc' },
|
||||
@@ -2324,7 +2510,7 @@ export class AssetService {
|
||||
},
|
||||
async () =>
|
||||
this.prismaClient.assetComment.count({
|
||||
where: { assetId: resolvedAssetId, replyToId: null },
|
||||
where,
|
||||
}),
|
||||
params,
|
||||
)
|
||||
@@ -2334,6 +2520,36 @@ export class AssetService {
|
||||
return { data: infos, pageInfo }
|
||||
}
|
||||
|
||||
async listAllComments(
|
||||
assetId: string,
|
||||
requestingUserId?: string,
|
||||
options?: { excludeInternal?: boolean },
|
||||
): Promise<CommentInfo[]> {
|
||||
const resolvedAssetId = await this.resolveLatestVersionId(assetId)
|
||||
|
||||
const comments = await this.prismaClient.assetComment.findMany({
|
||||
where: {
|
||||
assetId: resolvedAssetId,
|
||||
replyToId: null,
|
||||
...(options?.excludeInternal ? { isInternal: false } : {}),
|
||||
},
|
||||
include: this.getCommentInclude(options),
|
||||
orderBy: { id: 'asc' },
|
||||
})
|
||||
|
||||
return Promise.all(comments.map((c) => this.toCommentInfo(c, requestingUserId)))
|
||||
}
|
||||
|
||||
async getProjectNameForAsset(assetId: string): Promise<string | null> {
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
select: {
|
||||
project: { select: { name: true } },
|
||||
},
|
||||
})
|
||||
return asset?.project?.name ?? null
|
||||
}
|
||||
|
||||
async exportComments(
|
||||
assetId: string,
|
||||
format: CommentExportFormat,
|
||||
@@ -2432,9 +2648,10 @@ export class AssetService {
|
||||
async toAssetInfos(
|
||||
assets: AssetWithIncludes[],
|
||||
previewFormat?: PreviewFormat,
|
||||
options?: { includeDeletedChildren?: boolean },
|
||||
options?: { includeDeletedChildren?: boolean; excludeInternalComments?: boolean },
|
||||
): Promise<AssetInfo[]> {
|
||||
const includeDeletedChildren = options?.includeDeletedChildren ?? false
|
||||
const excludeInternalComments = options?.excludeInternalComments ?? false
|
||||
const stackIds = new Set<string>()
|
||||
|
||||
for (const a of assets) {
|
||||
@@ -2524,6 +2741,12 @@ export class AssetService {
|
||||
by: ['assetId'],
|
||||
where: {
|
||||
assetId: { in: Array.from(commentTargetIds) },
|
||||
...(excludeInternalComments
|
||||
? {
|
||||
isInternal: false,
|
||||
OR: [{ replyToId: null }, { replyTo: { isInternal: false } }],
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
_count: { _all: true },
|
||||
})
|
||||
@@ -3080,6 +3303,10 @@ export class AssetService {
|
||||
* that belong to an asset they have access to.
|
||||
*/
|
||||
async getDownloadUrl(assetId: string, key: string): Promise<string> {
|
||||
return (await this.getDownloadUrlWithAsset(assetId, key)).url
|
||||
}
|
||||
|
||||
async getDownloadUrlWithAsset(assetId: string, key: string) {
|
||||
const targetAssetId = await this.resolveLatestVersionId(assetId)
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: targetAssetId },
|
||||
@@ -3100,6 +3327,7 @@ export class AssetService {
|
||||
throw new Error('Key does not belong to this asset')
|
||||
}
|
||||
|
||||
let signedAssetId = asset.id
|
||||
let storageKey = asset.storageKey.key
|
||||
let assetDir = storageKey.substring(0, storageKey.lastIndexOf('/') + 1)
|
||||
let targetName = asset.name
|
||||
@@ -3115,12 +3343,14 @@ export class AssetService {
|
||||
storageKey: { key: { startsWith: key.substring(0, key.lastIndexOf('/') + 1) } },
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
status: true,
|
||||
storageKey: { select: { key: true, isArchived: true } },
|
||||
},
|
||||
})
|
||||
if (sibling?.storageKey?.key) {
|
||||
signedAssetId = sibling.id
|
||||
storageKey = sibling.storageKey.key
|
||||
assetDir = storageKey.substring(0, storageKey.lastIndexOf('/') + 1)
|
||||
targetStatus = sibling.status
|
||||
@@ -3176,7 +3406,14 @@ export class AssetService {
|
||||
}
|
||||
}
|
||||
|
||||
return s3Service.presign(process.env.S3_BUCKET || 'shumai', key, 'GET', true, downloadFilename)
|
||||
const url = await s3Service.presign(
|
||||
process.env.S3_BUCKET || 'shumai',
|
||||
key,
|
||||
'GET',
|
||||
true,
|
||||
downloadFilename,
|
||||
)
|
||||
return { url, assetId: signedAssetId }
|
||||
}
|
||||
|
||||
async archiveAssets(
|
||||
@@ -3386,6 +3623,7 @@ export class AssetService {
|
||||
updatedAt: c.updatedAt.toISOString(),
|
||||
sessionId: c.sessionId,
|
||||
isCompleted: c.isCompleted,
|
||||
isInternal: c.isInternal,
|
||||
completionLastChangedBy,
|
||||
reactionCounts,
|
||||
}
|
||||
|
||||
@@ -595,5 +595,70 @@ describe('AuthzService', () => {
|
||||
}),
|
||||
).rejects.toThrow('Permission denied')
|
||||
})
|
||||
|
||||
it('limits Kanban task reads for project-scoped members to their projects and their own tasks', async () => {
|
||||
const owner = await prisma.user.create({
|
||||
data: { name: 'Owner User', email: 'owner-kanban-read@example.com', password: 'pass' },
|
||||
})
|
||||
const client = await prisma.user.create({
|
||||
data: { name: 'Client User', email: 'client-kanban-read@example.com', password: 'pass' },
|
||||
})
|
||||
const teamReviewer = await prisma.user.create({
|
||||
data: { name: 'Team Reviewer', email: 'rev-kanban-read@example.com', password: 'pass' },
|
||||
})
|
||||
|
||||
const team = await prisma.team.create({ data: { name: 'Kanban Read Team' } })
|
||||
const ownProject = await prisma.project.create({
|
||||
data: { name: 'Client Project', teamId: team.id },
|
||||
})
|
||||
const otherProject = await prisma.project.create({
|
||||
data: { name: 'Internal Project', teamId: team.id },
|
||||
})
|
||||
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: owner.id, role: 'owner', scope: 'team' },
|
||||
})
|
||||
const clientMember = await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: client.id, role: 'reviewer', scope: 'project' },
|
||||
})
|
||||
await prisma.projectMember.create({
|
||||
data: { projectId: ownProject.id, teamMemberId: clientMember.id, role: 'reviewer' },
|
||||
})
|
||||
await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: teamReviewer.id, role: 'reviewer', scope: 'team' },
|
||||
})
|
||||
|
||||
const createTask = (title: string, projectId?: string, assigneeId?: string) =>
|
||||
prisma.kanbanTask.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
title,
|
||||
projectId,
|
||||
creatorId: owner.id,
|
||||
reporterId: owner.id,
|
||||
assigneeId,
|
||||
},
|
||||
})
|
||||
const ownTask = await createTask('Client task', ownProject.id)
|
||||
const otherTask = await createTask('Internal task', otherProject.id)
|
||||
const teamTask = await createTask('Team task')
|
||||
const assignedTask = await createTask('Assigned task', otherProject.id, client.id)
|
||||
|
||||
const read = (user: { id: string }, id: string) =>
|
||||
authzService.hasPermission({
|
||||
type: ResourceType.KanbanTask,
|
||||
id,
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
})
|
||||
|
||||
await expect(read(client, ownTask.id)).resolves.toBeUndefined()
|
||||
await expect(read(client, assignedTask.id)).resolves.toBeUndefined()
|
||||
await expect(read(client, otherTask.id)).rejects.toThrow('User has only project scope')
|
||||
await expect(read(client, teamTask.id)).rejects.toThrow('User has only project scope')
|
||||
|
||||
await expect(read(teamReviewer, otherTask.id)).resolves.toBeUndefined()
|
||||
await expect(read(teamReviewer, teamTask.id)).resolves.toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -122,17 +122,16 @@ export class AuthzService {
|
||||
})
|
||||
if (!member) throw new HTTPException(403, { message: 'User is not a member of the team' })
|
||||
|
||||
// If this is a KanbanTask and user is a team member, check if they are the assignee, reporter, or creator
|
||||
// A project-scoped member can read or edit a KanbanTask outside their projects
|
||||
// only when they are its assignee, reporter, or creator.
|
||||
if (req.type === ResourceType.KanbanTask) {
|
||||
if (req.permission === Permission.Read) {
|
||||
return
|
||||
}
|
||||
if (req.permission === Permission.Edit) {
|
||||
if (req.permission === Permission.Read || req.permission === Permission.Edit) {
|
||||
const isParticipant = await this.isKanbanTaskParticipant(req.id, req.user.id)
|
||||
if (isParticipant) {
|
||||
return
|
||||
}
|
||||
}
|
||||
throw new HTTPException(403, { message: 'User has only project scope' })
|
||||
}
|
||||
|
||||
// Project-scoped member on a team-level resource (no project context):
|
||||
|
||||
@@ -0,0 +1,738 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { prisma, AssetType, AssetStatus } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import {
|
||||
CommentFrameService,
|
||||
FrameExtractionQueue,
|
||||
selectBestVideoProxyKey,
|
||||
type ExecFileFn,
|
||||
} from './comment-frame'
|
||||
import { execFileSync } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import sharp from 'sharp'
|
||||
|
||||
async function createSamplePngBuffer(): Promise<Buffer> {
|
||||
return sharp({
|
||||
create: {
|
||||
width: 32,
|
||||
height: 18,
|
||||
channels: 3,
|
||||
background: { r: 20, g: 120, b: 220 },
|
||||
},
|
||||
})
|
||||
.png()
|
||||
.toBuffer()
|
||||
}
|
||||
|
||||
async function createSampleWebpBuffer(): Promise<Buffer> {
|
||||
return sharp({
|
||||
create: {
|
||||
width: 32,
|
||||
height: 18,
|
||||
channels: 3,
|
||||
background: { r: 220, g: 80, b: 40 },
|
||||
},
|
||||
})
|
||||
.webp()
|
||||
.toBuffer()
|
||||
}
|
||||
|
||||
describe('FrameExtractionQueue', () => {
|
||||
it('enforces maxConcurrency and processes queued tasks in FIFO order', async () => {
|
||||
const queue = new FrameExtractionQueue(2)
|
||||
let active = 0
|
||||
let maxObserved = 0
|
||||
const order: number[] = []
|
||||
const resolvers: Array<() => void> = []
|
||||
|
||||
const makeTask = (id: number) =>
|
||||
queue.enqueue(async () => {
|
||||
active++
|
||||
maxObserved = Math.max(maxObserved, active)
|
||||
order.push(id)
|
||||
await new Promise<void>((resolve) => resolvers.push(resolve))
|
||||
active--
|
||||
return id
|
||||
})
|
||||
|
||||
const p1 = makeTask(1)
|
||||
const p2 = makeTask(2)
|
||||
const p3 = makeTask(3)
|
||||
const p4 = makeTask(4)
|
||||
|
||||
expect(queue.activeCount).toBe(2)
|
||||
expect(queue.queuedCount).toBe(2)
|
||||
expect(maxObserved).toBe(2)
|
||||
|
||||
resolvers.shift()?.()
|
||||
await p1
|
||||
expect(queue.activeCount).toBe(2)
|
||||
expect(queue.queuedCount).toBe(1)
|
||||
|
||||
resolvers.shift()?.()
|
||||
await p2
|
||||
expect(queue.activeCount).toBe(2)
|
||||
expect(queue.queuedCount).toBe(0)
|
||||
|
||||
resolvers.shift()?.()
|
||||
await p3
|
||||
resolvers.shift()?.()
|
||||
await p4
|
||||
|
||||
expect(order).toEqual([1, 2, 3, 4])
|
||||
expect(maxObserved).toBe(2)
|
||||
expect(queue.activeCount).toBe(0)
|
||||
expect(queue.queuedCount).toBe(0)
|
||||
})
|
||||
|
||||
it('cancels queued tasks when their AbortSignal fires before execution', async () => {
|
||||
const queue = new FrameExtractionQueue(1)
|
||||
let releaseFirst!: () => void
|
||||
const first = queue.enqueue(
|
||||
() =>
|
||||
new Promise<string>((resolve) => {
|
||||
releaseFirst = () => resolve('first')
|
||||
}),
|
||||
)
|
||||
|
||||
const controller = new AbortController()
|
||||
const runSecond = vi.fn().mockResolvedValue('second')
|
||||
const second = queue.enqueue(runSecond, controller.signal)
|
||||
|
||||
expect(queue.queuedCount).toBe(1)
|
||||
controller.abort()
|
||||
|
||||
await expect(second).rejects.toThrow('Frame extraction aborted')
|
||||
expect(queue.queuedCount).toBe(0)
|
||||
expect(runSecond).not.toHaveBeenCalled()
|
||||
|
||||
releaseFirst()
|
||||
await expect(first).resolves.toBe('first')
|
||||
})
|
||||
})
|
||||
|
||||
describe('selectBestVideoProxyKey', () => {
|
||||
it('prefers SDR proxies over HDR and chooses lowest adequate resolution >= 360p', () => {
|
||||
const key = selectBestVideoProxyKey([
|
||||
{ key: 'hdr-720.mp4', width: 1280, height: 720, hdr: true, resolution: '720p' },
|
||||
{ key: 'sdr-1080.mp4', width: 1920, height: 1080, hdr: false, resolution: '1080p' },
|
||||
{ key: 'sdr-540.mp4', width: 960, height: 540, hdr: false, resolution: '540p' },
|
||||
{ key: 'sdr-240.mp4', width: 426, height: 240, hdr: false, resolution: '240p' },
|
||||
])
|
||||
expect(key).toBe('sdr-540.mp4')
|
||||
})
|
||||
|
||||
it('falls back to highest available SDR proxy if all are below 360p', () => {
|
||||
const key = selectBestVideoProxyKey([
|
||||
{ key: 'sdr-180.mp4', width: 320, height: 180, hdr: false, resolution: '180p' },
|
||||
{ key: 'sdr-240.mp4', width: 426, height: 240, hdr: false, resolution: '240p' },
|
||||
])
|
||||
expect(key).toBe('sdr-240.mp4')
|
||||
})
|
||||
|
||||
it('falls back to HDR proxy if no SDR proxy exists', () => {
|
||||
const key = selectBestVideoProxyKey([
|
||||
{ key: 'hdr-1080.mp4', width: 1920, height: 1080, hdr: true, resolution: '1080p' },
|
||||
{ key: 'hdr-720.mp4', width: 1280, height: 720, hdr: true, resolution: '720p' },
|
||||
])
|
||||
expect(key).toBe('hdr-720.mp4')
|
||||
})
|
||||
|
||||
it('returns null when no valid keys exist', () => {
|
||||
expect(selectBestVideoProxyKey([])).toBeNull()
|
||||
expect(selectBestVideoProxyKey(null)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('CommentFrameService & AssetService print helpers', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let userId: string
|
||||
let teamId: string
|
||||
let projectId: string
|
||||
let rootFolderId: string
|
||||
let subFolderId: string
|
||||
|
||||
beforeEach(async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Alice',
|
||||
email: `alice-${Date.now()}-${Math.random()}@example.com`,
|
||||
},
|
||||
})
|
||||
userId = user.id
|
||||
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Studio Team',
|
||||
},
|
||||
})
|
||||
teamId = team.id
|
||||
|
||||
const rootFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'root',
|
||||
type: AssetType.root,
|
||||
status: AssetStatus.processed,
|
||||
creatorId: userId,
|
||||
},
|
||||
})
|
||||
rootFolderId = rootFolder.id
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: {
|
||||
name: 'Commercial Cut',
|
||||
teamId,
|
||||
rootFolderId,
|
||||
},
|
||||
})
|
||||
projectId = project.id
|
||||
|
||||
await prisma.asset.update({
|
||||
where: { id: rootFolderId },
|
||||
data: { projectId },
|
||||
})
|
||||
|
||||
const subFolder = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Dailies',
|
||||
type: AssetType.folder,
|
||||
status: AssetStatus.processed,
|
||||
projectId,
|
||||
parentId: rootFolderId,
|
||||
creatorId: userId,
|
||||
},
|
||||
})
|
||||
subFolderId = subFolder.id
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('skips extraction when the request is aborted during asset lookup', async () => {
|
||||
const storageKey = await prisma.storageKey.create({ data: { key: 'files/clip.mp4' } })
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'clip.mp4',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'video/mp4',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
const controller = new AbortController()
|
||||
const resolveLatestVersionId = assetService.resolveLatestVersionId.bind(assetService)
|
||||
vi.spyOn(assetService, 'resolveLatestVersionId').mockImplementationOnce(async (assetId) => {
|
||||
const resolvedId = await resolveLatestVersionId(assetId)
|
||||
controller.abort()
|
||||
return resolvedId
|
||||
})
|
||||
const resolveInput = vi.spyOn(s3Service, 'resolveInput').mockResolvedValue('/local/clip.mp4')
|
||||
const execFileFn = vi.fn<ExecFileFn>().mockResolvedValue({ stdout: '', stderr: '' })
|
||||
const service = new CommentFrameService({ execFileFn })
|
||||
|
||||
await expect(
|
||||
service.extractFrame({ assetId: asset.id, second: 0, signal: controller.signal }),
|
||||
).rejects.toMatchObject({ name: 'AbortError' })
|
||||
expect(resolveInput).not.toHaveBeenCalled()
|
||||
expect(execFileFn).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('extracts a video frame using the lowest adequate SDR proxy and deduplicates concurrent requests', async () => {
|
||||
const webpBuffer = await createSampleWebpBuffer()
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/video-original.mp4' },
|
||||
})
|
||||
const videoAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'scene1.mp4',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'video/mp4',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: storageKey.id,
|
||||
media: {
|
||||
proxyType: 'video',
|
||||
duration: 10,
|
||||
filesize: 1000,
|
||||
frames: 240,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [
|
||||
{ key: 'files/proxies/1080p.mp4', width: 1920, height: 1080, hdr: false },
|
||||
{ key: 'files/proxies/540p.mp4', width: 960, height: 540, hdr: false },
|
||||
{ key: 'files/proxies/720p-hdr.mp4', width: 1280, height: 720, hdr: true },
|
||||
],
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const resolveInputSpy = vi
|
||||
.spyOn(s3Service, 'resolveInput')
|
||||
.mockResolvedValue('/local/files/proxies/540p.mp4')
|
||||
|
||||
let releaseExec!: () => void
|
||||
const execFileMock = vi.fn<ExecFileFn>(async (_file, args) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
releaseExec = resolve
|
||||
})
|
||||
const outPath = args[args.length - 1]
|
||||
fs.writeFileSync(outPath, webpBuffer)
|
||||
return { stdout: '', stderr: '' }
|
||||
})
|
||||
|
||||
const service = new CommentFrameService({ maxConcurrency: 2, execFileFn: execFileMock })
|
||||
|
||||
const p1 = service.extractFrame({ assetId: videoAsset.id, second: 2.5, width: 400 })
|
||||
const p2 = service.extractFrame({ assetId: videoAsset.id, second: 2.5, width: 400 })
|
||||
|
||||
// Let async DB lookup finish before releasing exec
|
||||
await vi.waitFor(() => expect(execFileMock).toHaveBeenCalledTimes(1))
|
||||
releaseExec()
|
||||
|
||||
const [r1, r2] = await Promise.all([p1, p2])
|
||||
expect(r1.mimeType).toBe('image/webp')
|
||||
expect(r1.buffer.equals(webpBuffer)).toBe(true)
|
||||
expect(r2.buffer.equals(webpBuffer)).toBe(true)
|
||||
expect(execFileMock).toHaveBeenCalledTimes(1)
|
||||
expect(resolveInputSpy).toHaveBeenCalledWith(expect.any(String), 'files/proxies/540p.mp4')
|
||||
})
|
||||
|
||||
it('extracts a 3D model turntable frame and enforces watermark-only proxies when watermarkConfigId is set', async () => {
|
||||
const webpBuffer = await createSampleWebpBuffer()
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/chair.glb' },
|
||||
})
|
||||
const modelAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'chair.glb',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'model/gltf-binary',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: storageKey.id,
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
duration: 24,
|
||||
filesize: 2000,
|
||||
frames: 24,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [{ key: 'files/proxies/turntable.mp4', width: 1024, height: 1024 }],
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const watermarkSpy = vi
|
||||
.spyOn(watermarkService, 'getCompletedWatermarkMediaMap')
|
||||
.mockResolvedValueOnce(
|
||||
new Map([
|
||||
[
|
||||
modelAsset.id,
|
||||
{
|
||||
proxyType: '3d',
|
||||
duration: 24,
|
||||
filesize: 2000,
|
||||
frames: 24,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [{ key: 'files/wm/turntable-wm.mp4', width: 1024, height: 1024 }],
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
],
|
||||
]),
|
||||
)
|
||||
.mockResolvedValueOnce(new Map())
|
||||
|
||||
const resolveInputSpy = vi
|
||||
.spyOn(s3Service, 'resolveInput')
|
||||
.mockResolvedValue('/local/files/wm/turntable-wm.mp4')
|
||||
|
||||
const execFileMock = vi.fn<ExecFileFn>(async (_file, args) => {
|
||||
const outPath = args[args.length - 1]
|
||||
fs.writeFileSync(outPath, webpBuffer)
|
||||
return { stdout: '', stderr: '' }
|
||||
})
|
||||
|
||||
const service = new CommentFrameService({ execFileFn: execFileMock })
|
||||
|
||||
const res = await service.extractFrame({
|
||||
assetId: modelAsset.id,
|
||||
second: 3,
|
||||
width: 400,
|
||||
watermarkConfigId: 'wm-cfg-1',
|
||||
})
|
||||
expect(res.mimeType).toBe('image/webp')
|
||||
expect(watermarkSpy).toHaveBeenCalledWith([modelAsset.id], 'wm-cfg-1')
|
||||
expect(resolveInputSpy).toHaveBeenCalledWith(expect.any(String), 'files/wm/turntable-wm.mp4')
|
||||
|
||||
// Missing watermark proxy must reject with 422 rather than leaking unwatermarked media
|
||||
await expect(
|
||||
service.extractFrame({
|
||||
assetId: modelAsset.id,
|
||||
second: 3,
|
||||
width: 400,
|
||||
watermarkConfigId: 'wm-cfg-2',
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 422 })
|
||||
})
|
||||
|
||||
it('renders a PDF page frame via pdftoppm and sharp', async () => {
|
||||
const samplePng = await createSamplePngBuffer()
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/deck.pdf' },
|
||||
})
|
||||
const pdfAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'deck.pdf',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'application/pdf',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: storageKey.id,
|
||||
media: {
|
||||
proxyType: 'pdf',
|
||||
duration: 0,
|
||||
filesize: 5000,
|
||||
frames: 5,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [],
|
||||
pdfTranscode: { key: 'files/proxies/deck.pdf' },
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const downloadSpy = vi
|
||||
.spyOn(s3Service, 'downloadToFile')
|
||||
.mockImplementation(async (_bucket, _key, dest) => {
|
||||
fs.writeFileSync(dest, '%PDF-1.4 mock')
|
||||
})
|
||||
|
||||
const execFileMock = vi.fn<ExecFileFn>(async (file, args) => {
|
||||
expect(file).toBe('pdftoppm')
|
||||
expect(args[args.indexOf('-scale-to') + 1]).toBe('400')
|
||||
expect(args).toContain('-f')
|
||||
expect(args).toContain('3')
|
||||
const prefix = args[args.length - 1]
|
||||
fs.writeFileSync(`${prefix}-3.png`, samplePng)
|
||||
return { stdout: '', stderr: '' }
|
||||
})
|
||||
|
||||
const service = new CommentFrameService({ execFileFn: execFileMock })
|
||||
const res = await service.extractFrame({ assetId: pdfAsset.id, second: 3, width: 400 })
|
||||
expect(downloadSpy).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
'files/proxies/deck.pdf',
|
||||
expect.stringContaining(path.sep),
|
||||
)
|
||||
expect(res.mimeType).toBe('image/webp')
|
||||
expect(res.buffer.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('rejects unsupported asset types with 400 and archived assets without proxy with 422', async () => {
|
||||
const imgKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/photo.png' },
|
||||
})
|
||||
const imageAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'photo.png',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'image/png',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: imgKey.id,
|
||||
media: {
|
||||
proxyType: 'image',
|
||||
duration: 0,
|
||||
filesize: 100,
|
||||
frames: 1,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [],
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: null,
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const archivedKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/archived.mp4', isArchived: true },
|
||||
})
|
||||
const archivedVideo = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'archived.mp4',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.archived,
|
||||
mediaType: 'video/mp4',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: archivedKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
const service = new CommentFrameService()
|
||||
await expect(service.extractFrame({ assetId: imageAsset.id, second: 0 })).rejects.toMatchObject(
|
||||
{ status: 400 },
|
||||
)
|
||||
await expect(
|
||||
service.extractFrame({ assetId: archivedVideo.id, second: 1 }),
|
||||
).rejects.toMatchObject({ status: 422 })
|
||||
await expect(
|
||||
service.extractFrame({ assetId: 'non-existent-id', second: 0 }),
|
||||
).rejects.toMatchObject({ status: 404 })
|
||||
})
|
||||
|
||||
it('lists all comments with replies, reactions, completion status, and fetches project name', async () => {
|
||||
vi.spyOn(s3Service, 'presign').mockResolvedValue('http://mock-s3/file')
|
||||
|
||||
const storageKey = await prisma.storageKey.create({
|
||||
data: { key: 'files/cut.mp4' },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'cut.mp4',
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: 'video/mp4',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: storageKey.id,
|
||||
},
|
||||
})
|
||||
|
||||
const parent = await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
creatorId: userId,
|
||||
message: 'Check lighting',
|
||||
second: 1.5,
|
||||
isCompleted: true,
|
||||
completionLastChangedById: userId,
|
||||
},
|
||||
})
|
||||
await prisma.assetCommentReaction.create({
|
||||
data: { commentId: parent.id, userId, code: '👍' },
|
||||
})
|
||||
await prisma.assetComment.create({
|
||||
data: {
|
||||
assetId: asset.id,
|
||||
creatorId: userId,
|
||||
replyToId: parent.id,
|
||||
message: 'Fixed in v2',
|
||||
},
|
||||
})
|
||||
|
||||
const allComments = await assetService.listAllComments(asset.id, userId)
|
||||
expect(allComments).toHaveLength(1)
|
||||
expect(allComments[0].message).toBe('Check lighting')
|
||||
expect(allComments[0].isCompleted).toBe(true)
|
||||
expect(allComments[0].reactionCounts).toEqual([
|
||||
expect.objectContaining({ code: '👍', count: 1, requestingUserReacted: true }),
|
||||
])
|
||||
expect(allComments[0].replies).toHaveLength(1)
|
||||
expect(allComments[0].replies[0].message).toBe('Fixed in v2')
|
||||
|
||||
const projectName = await assetService.getProjectNameForAsset(asset.id)
|
||||
expect(projectName).toBe('Commercial Cut')
|
||||
})
|
||||
|
||||
it('extracts exact frames with real ffmpeg for 30fps video, 23.976fps video, and 6fps 3D turntable', async () => {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'shumai-frame-acc-'))
|
||||
const w = 64
|
||||
const h = 64
|
||||
|
||||
const createColorCodedVideo = (filename: string, rateArg: string, totalFrames: number) => {
|
||||
const raw = Buffer.alloc(w * h * 3 * totalFrames)
|
||||
for (let n = 0; n < totalFrames; n++) {
|
||||
const r = (n * 9) & 255
|
||||
const g = (n * 15) & 255
|
||||
const off = n * w * h * 3
|
||||
for (let i = 0; i < w * h; i++) {
|
||||
raw[off + i * 3] = r
|
||||
raw[off + i * 3 + 1] = g
|
||||
raw[off + i * 3 + 2] = 120
|
||||
}
|
||||
}
|
||||
const rawPath = path.join(tmpDir, `${filename}.rgb`)
|
||||
const mp4Path = path.join(tmpDir, `${filename}.mp4`)
|
||||
fs.writeFileSync(rawPath, raw)
|
||||
execFileSync('ffmpeg', [
|
||||
'-y',
|
||||
'-loglevel',
|
||||
'error',
|
||||
'-f',
|
||||
'rawvideo',
|
||||
'-pix_fmt',
|
||||
'rgb24',
|
||||
'-s',
|
||||
`${w}x${h}`,
|
||||
'-r',
|
||||
rateArg,
|
||||
'-i',
|
||||
rawPath,
|
||||
'-c:v',
|
||||
'libx264',
|
||||
'-pix_fmt',
|
||||
'yuv420p',
|
||||
'-g',
|
||||
'12',
|
||||
'-bf',
|
||||
'2',
|
||||
'-movflags',
|
||||
'+faststart',
|
||||
mp4Path,
|
||||
])
|
||||
return mp4Path
|
||||
}
|
||||
|
||||
const identifyExtractedFrame = async (webpBuffer: Buffer, totalFrames: number) => {
|
||||
const { data, info } = await sharp(webpBuffer).raw().toBuffer({ resolveWithObject: true })
|
||||
const cx = Math.floor(info.width / 2)
|
||||
const cy = Math.floor(info.height / 2)
|
||||
const idx = (cy * info.width + cx) * info.channels
|
||||
const r = data[idx]
|
||||
const g = data[idx + 1]
|
||||
let best = -1
|
||||
let bestDist = Infinity
|
||||
for (let n = 0; n < totalFrames; n++) {
|
||||
const dr = r - ((n * 9) & 255)
|
||||
const dg = g - ((n * 15) & 255)
|
||||
const dist = dr * dr + dg * dg
|
||||
if (dist < bestDist) {
|
||||
bestDist = dist
|
||||
best = n
|
||||
}
|
||||
}
|
||||
return best
|
||||
}
|
||||
|
||||
try {
|
||||
const mp4Fps30 = createColorCodedVideo('v30', '30', 24)
|
||||
const mp4Fps23976 = createColorCodedVideo('v23976', '24000/1001', 24)
|
||||
const mp4Turntable = createColorCodedVideo('turntable', '6', 24)
|
||||
|
||||
const keyMap: Record<string, string> = {
|
||||
'files/proxies/v30.mp4': mp4Fps30,
|
||||
'files/proxies/v23976.mp4': mp4Fps23976,
|
||||
'files/proxies/turntable.mp4': mp4Turntable,
|
||||
}
|
||||
vi.spyOn(s3Service, 'resolveInput').mockImplementation(async (_bucket, key) => keyMap[key])
|
||||
|
||||
const createAsset = async (
|
||||
name: string,
|
||||
proxyType: 'video' | '3d',
|
||||
proxyKey: string,
|
||||
fps: number,
|
||||
totalFrames: number,
|
||||
) => {
|
||||
const sk = await prisma.storageKey.create({ data: { key: `files/${name}` } })
|
||||
return prisma.asset.create({
|
||||
data: {
|
||||
name,
|
||||
type: AssetType.file,
|
||||
status: AssetStatus.processed,
|
||||
mediaType: proxyType === '3d' ? 'model/gltf-binary' : 'video/mp4',
|
||||
projectId,
|
||||
parentId: subFolderId,
|
||||
creatorId: userId,
|
||||
storageKeyId: sk.id,
|
||||
media: {
|
||||
proxyType,
|
||||
duration: totalFrames / fps,
|
||||
filesize: 1000,
|
||||
frames: totalFrames,
|
||||
imageTranscodes: [],
|
||||
videoTranscodes: [{ key: proxyKey, width: 64, height: 64, hdr: false }],
|
||||
finishedAt: new Date().toISOString(),
|
||||
metadata: {
|
||||
originalHeight: h,
|
||||
originalWidth: w,
|
||||
hasAudio: false,
|
||||
bitRate: 100000,
|
||||
frameRate: fps,
|
||||
totalFrames,
|
||||
duration: totalFrames / fps,
|
||||
startTimecode: '00:00:00:00',
|
||||
format: {},
|
||||
},
|
||||
original: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const asset30 = await createAsset('v30.mp4', 'video', 'files/proxies/v30.mp4', 30, 24)
|
||||
const asset23976 = await createAsset(
|
||||
'v23976.mp4',
|
||||
'video',
|
||||
'files/proxies/v23976.mp4',
|
||||
24000 / 1001,
|
||||
24,
|
||||
)
|
||||
const asset3d = await createAsset('chair.glb', '3d', 'files/proxies/turntable.mp4', 6, 24)
|
||||
|
||||
const realService = new CommentFrameService({ maxConcurrency: 2 })
|
||||
|
||||
// Frames where .toFixed(4) previously rounded UP and skipped to N+1:
|
||||
// 30fps: frame 2 (0.06666... -> 0.0667), frame 5 (0.16666... -> 0.1667), frame 23 (last frame)
|
||||
for (const frame of [0, 2, 5, 8, 17, 23]) {
|
||||
const res = await realService.extractFrame({
|
||||
assetId: asset30.id,
|
||||
second: frame / 30,
|
||||
width: 64,
|
||||
})
|
||||
expect(await identifyExtractedFrame(res.buffer, 24)).toBe(frame)
|
||||
}
|
||||
|
||||
// 23.976fps: frame 7 (0.291958 -> 0.2920), frame 8, frame 19, frame 23
|
||||
for (const frame of [0, 7, 8, 19, 23]) {
|
||||
const res = await realService.extractFrame({
|
||||
assetId: asset23976.id,
|
||||
second: frame / (24000 / 1001),
|
||||
width: 64,
|
||||
})
|
||||
expect(await identifyExtractedFrame(res.buffer, 24)).toBe(frame)
|
||||
}
|
||||
|
||||
// 3D 6fps turntable where model-viewer stores center times ((N + 0.5) / 6, last = (23 + 0.25) / 6)
|
||||
for (const frame of [0, 1, 6, 12, 23]) {
|
||||
const centerSec = frame === 23 ? (frame + 0.25) / 6 : (frame + 0.5) / 6
|
||||
const res = await realService.extractFrame({
|
||||
assetId: asset3d.id,
|
||||
second: centerSec,
|
||||
width: 64,
|
||||
})
|
||||
expect(await identifyExtractedFrame(res.buffer, 24)).toBe(frame)
|
||||
}
|
||||
} finally {
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,557 @@
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { secondToTurntableFrame, TURNTABLE_FPS } from '@shumai/core/src/utils/model3d'
|
||||
import { watermarkService } from '@shumai/core/src/watermark/watermark'
|
||||
import { prisma } from '@shumai/db'
|
||||
import '@shumai/db/src/prisma-json-types'
|
||||
import { execFile } from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import sharp from 'sharp'
|
||||
import { ulid } from 'ulid'
|
||||
import { promisify } from 'util'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
const DEFAULT_CONCURRENCY = 4
|
||||
const DEFAULT_FRAME_TIMEOUT_MS = 30_000
|
||||
const MIN_PREFERRED_PROXY_HEIGHT = 360
|
||||
|
||||
export interface ExtractCommentFrameParams {
|
||||
assetId: string
|
||||
second: number
|
||||
width?: number
|
||||
watermarkConfigId?: string | null
|
||||
signal?: AbortSignal
|
||||
}
|
||||
|
||||
export interface ExtractCommentFrameResult {
|
||||
buffer: Buffer
|
||||
mimeType: string
|
||||
}
|
||||
|
||||
export type ExecFileFn = (
|
||||
file: string,
|
||||
args: string[],
|
||||
options?: { signal?: AbortSignal; timeout?: number },
|
||||
) => Promise<{ stdout: string | Buffer; stderr: string | Buffer }>
|
||||
|
||||
interface QueuedTask<T> {
|
||||
run: () => Promise<T>
|
||||
resolve: (value: T) => void
|
||||
reject: (err: unknown) => void
|
||||
signal?: AbortSignal
|
||||
onAbort?: () => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Bounded FIFO concurrency queue dedicated to on-demand comment frame extraction,
|
||||
* isolated from background transcode workers so print requests stay fast without
|
||||
* overloading the main API server.
|
||||
*/
|
||||
export class FrameExtractionQueue {
|
||||
private running = 0
|
||||
private readonly pending: QueuedTask<unknown>[] = []
|
||||
|
||||
constructor(private readonly maxConcurrency: number) {}
|
||||
|
||||
get activeCount(): number {
|
||||
return this.running
|
||||
}
|
||||
|
||||
get queuedCount(): number {
|
||||
return this.pending.length
|
||||
}
|
||||
|
||||
enqueue<T>(run: () => Promise<T>, signal?: AbortSignal): Promise<T> {
|
||||
if (signal?.aborted) {
|
||||
return Promise.reject(new DOMException('Frame extraction aborted', 'AbortError'))
|
||||
}
|
||||
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const task: QueuedTask<T> = { run, resolve, reject, signal }
|
||||
|
||||
if (signal) {
|
||||
const onAbort = () => {
|
||||
const idx = this.pending.indexOf(task as QueuedTask<unknown>)
|
||||
if (idx !== -1) {
|
||||
this.pending.splice(idx, 1)
|
||||
signal.removeEventListener('abort', onAbort)
|
||||
reject(new DOMException('Frame extraction aborted', 'AbortError'))
|
||||
}
|
||||
}
|
||||
task.onAbort = onAbort
|
||||
signal.addEventListener('abort', onAbort, { once: true })
|
||||
}
|
||||
|
||||
this.pending.push(task as QueuedTask<unknown>)
|
||||
this.drain()
|
||||
})
|
||||
}
|
||||
|
||||
private drain(): void {
|
||||
while (this.running < this.maxConcurrency && this.pending.length > 0) {
|
||||
const task = this.pending.shift()
|
||||
if (!task) break
|
||||
|
||||
if (task.signal && task.onAbort) {
|
||||
task.signal.removeEventListener('abort', task.onAbort)
|
||||
}
|
||||
if (task.signal?.aborted) {
|
||||
task.reject(new DOMException('Frame extraction aborted', 'AbortError'))
|
||||
continue
|
||||
}
|
||||
|
||||
this.running++
|
||||
task.run().then(
|
||||
(result) => {
|
||||
this.running--
|
||||
this.drain()
|
||||
task.resolve(result)
|
||||
},
|
||||
(err) => {
|
||||
this.running--
|
||||
this.drain()
|
||||
task.reject(err)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks the fastest video proxy suitable for thumbnail extraction:
|
||||
* 1. Prefer SDR proxies over HDR to avoid washed-out colors.
|
||||
* 2. Among SDR proxies, pick the lowest resolution that is still >= 360p (fast seek + decode
|
||||
* for a ~400px thumbnail). If none are >= 360p, pick the highest available SDR proxy.
|
||||
*/
|
||||
export function selectBestVideoProxyKey(
|
||||
videoTranscodes?: PrismaJson.VideoTranscode[] | null,
|
||||
): string | null {
|
||||
if (!videoTranscodes || videoTranscodes.length === 0) return null
|
||||
|
||||
const valid = videoTranscodes.filter((t) => Boolean(t.key))
|
||||
if (valid.length === 0) return null
|
||||
|
||||
const sdr = valid.filter((t) => !t.hdr)
|
||||
const pool = sdr.length > 0 ? sdr : valid
|
||||
|
||||
const adequate = pool
|
||||
.filter((t) => (t.height || 0) >= MIN_PREFERRED_PROXY_HEIGHT)
|
||||
.sort((a, b) => (a.height || 0) - (b.height || 0))
|
||||
if (adequate.length > 0) {
|
||||
return adequate[0].key ?? null
|
||||
}
|
||||
|
||||
const fallback = [...pool].sort((a, b) => (b.height || 0) - (a.height || 0))
|
||||
return fallback[0]?.key ?? null
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves an ffmpeg `-ss` input seek timestamp that lands squarely on the exact
|
||||
* target frame displayed by Shumai's video and 3D turntable players.
|
||||
*
|
||||
* `ffmpeg -ss T -i input -vframes 1` outputs the first frame with `PTS >= T`.
|
||||
* Passing `N / fps` directly (especially after decimal rounding) or a frame center
|
||||
* `(N + 0.5) / fps` causes ffmpeg to skip frame `N` and emit frame `N + 1` whenever
|
||||
* `T` exceeds `PTS(N)` by even 1µs.
|
||||
*
|
||||
* Instead, we recover integer frame `N` with the exact player formula
|
||||
* (`Math.floor(second * fps + 0.45)` for video, `secondToTurntableFrame` for 3D)
|
||||
* and seek to the midpoint between frame `N - 1` and frame `N`: `(N - 0.5) / fps`,
|
||||
* leaving a full ±0.5 frame tolerance margin on both sides.
|
||||
*/
|
||||
export function resolveFrameAccurateSeek(params: {
|
||||
second: number
|
||||
proxyType: 'video' | '3d'
|
||||
frameRate?: number | null
|
||||
totalFrames?: number | null
|
||||
duration?: number | null
|
||||
}): { seekTime: number; frameIndex: number | null } {
|
||||
const safeSecond = Math.max(0, params.second)
|
||||
|
||||
if (params.proxyType === '3d') {
|
||||
const frameIndex = secondToTurntableFrame(safeSecond)
|
||||
const seekTime = frameIndex <= 0 ? 0 : (frameIndex - 0.5) / TURNTABLE_FPS
|
||||
return { seekTime, frameIndex }
|
||||
}
|
||||
|
||||
const fps = params.frameRate && params.frameRate > 0 ? params.frameRate : null
|
||||
if (fps) {
|
||||
let frameIndex = Math.max(0, Math.floor(safeSecond * fps + 0.45))
|
||||
if (params.totalFrames && params.totalFrames > 0) {
|
||||
frameIndex = Math.min(frameIndex, params.totalFrames - 1)
|
||||
} else if (params.duration && params.duration > 0) {
|
||||
const maxFrame = Math.max(0, Math.round(params.duration * fps) - 1)
|
||||
frameIndex = Math.min(frameIndex, maxFrame)
|
||||
}
|
||||
const seekTime = frameIndex <= 0 ? 0 : (frameIndex - 0.5) / fps
|
||||
return { seekTime, frameIndex }
|
||||
}
|
||||
|
||||
const seekTime =
|
||||
params.duration && params.duration > 0 && safeSecond >= params.duration
|
||||
? Math.max(0, params.duration - 0.05)
|
||||
: safeSecond
|
||||
return { seekTime, frameIndex: null }
|
||||
}
|
||||
|
||||
export class CommentFrameService {
|
||||
private readonly queue: FrameExtractionQueue
|
||||
private readonly inFlight = new Map<
|
||||
string,
|
||||
{
|
||||
promise: Promise<ExtractCommentFrameResult>
|
||||
controller: AbortController
|
||||
waiters: number
|
||||
}
|
||||
>()
|
||||
private readonly execFileFn: ExecFileFn
|
||||
private readonly timeoutMs: number
|
||||
|
||||
constructor(options?: { maxConcurrency?: number; timeoutMs?: number; execFileFn?: ExecFileFn }) {
|
||||
const envConcurrency = Number(process.env.PRINT_FRAME_CONCURRENCY)
|
||||
const maxConcurrency =
|
||||
options?.maxConcurrency ??
|
||||
(Number.isInteger(envConcurrency) && envConcurrency > 0
|
||||
? envConcurrency
|
||||
: DEFAULT_CONCURRENCY)
|
||||
this.queue = new FrameExtractionQueue(maxConcurrency)
|
||||
this.timeoutMs = options?.timeoutMs ?? DEFAULT_FRAME_TIMEOUT_MS
|
||||
this.execFileFn =
|
||||
options?.execFileFn ??
|
||||
((file, args, opts) =>
|
||||
execFileAsync(file, args, {
|
||||
signal: opts?.signal,
|
||||
timeout: opts?.timeout,
|
||||
maxBuffer: 10 * 1024 * 1024,
|
||||
}))
|
||||
}
|
||||
|
||||
async extractFrame(params: ExtractCommentFrameParams): Promise<ExtractCommentFrameResult> {
|
||||
if (params.signal?.aborted) {
|
||||
throw new DOMException('Frame extraction aborted', 'AbortError')
|
||||
}
|
||||
|
||||
const width = Math.max(64, Math.min(1280, Math.round(params.width ?? 400)))
|
||||
const second = Math.max(0, params.second)
|
||||
|
||||
const targetAssetId = await assetService.resolveLatestVersionId(params.assetId)
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: targetAssetId },
|
||||
include: { storageKey: true },
|
||||
})
|
||||
params.signal?.throwIfAborted()
|
||||
|
||||
if (!asset || asset.isDeleted) {
|
||||
throw new HTTPException(404, { message: 'Asset not found' })
|
||||
}
|
||||
|
||||
const media = asset.media as PrismaJson.MediaInfo | null
|
||||
const proxyType = media?.proxyType ?? this.inferProxyType(asset.mediaType)
|
||||
|
||||
if (proxyType !== 'video' && proxyType !== '3d' && proxyType !== 'pdf') {
|
||||
throw new HTTPException(400, {
|
||||
message: 'Frame extraction is only supported for video, 3D model, and PDF assets',
|
||||
})
|
||||
}
|
||||
|
||||
const frameTarget =
|
||||
proxyType === 'pdf'
|
||||
? null
|
||||
: resolveFrameAccurateSeek({
|
||||
second,
|
||||
proxyType,
|
||||
frameRate: media?.metadata?.frameRate,
|
||||
totalFrames: media?.metadata?.totalFrames ?? media?.frames,
|
||||
duration: media?.duration ?? media?.metadata?.duration,
|
||||
})
|
||||
|
||||
const normalizedKeyTime =
|
||||
proxyType === 'pdf'
|
||||
? `p${Math.max(1, Math.round(second))}`
|
||||
: frameTarget!.frameIndex !== null
|
||||
? `f${frameTarget!.frameIndex}`
|
||||
: frameTarget!.seekTime.toFixed(6)
|
||||
const dedupeKey = `${targetAssetId}:${params.watermarkConfigId ?? ''}:${normalizedKeyTime}:${width}`
|
||||
|
||||
let entry = this.inFlight.get(dedupeKey)
|
||||
if (!entry) {
|
||||
const controller = new AbortController()
|
||||
const promise = this.queue
|
||||
.enqueue(async () => {
|
||||
if (proxyType === 'pdf') {
|
||||
return this.extractPdfPageFrame({
|
||||
asset,
|
||||
media,
|
||||
page: Math.max(1, Math.round(second)),
|
||||
width,
|
||||
signal: controller.signal,
|
||||
})
|
||||
}
|
||||
return this.extractVideoFrame({
|
||||
asset,
|
||||
media,
|
||||
second,
|
||||
seekTime: frameTarget!.seekTime,
|
||||
frameRate: proxyType === '3d' ? TURNTABLE_FPS : media?.metadata?.frameRate,
|
||||
width,
|
||||
watermarkConfigId: params.watermarkConfigId,
|
||||
signal: controller.signal,
|
||||
})
|
||||
}, controller.signal)
|
||||
.finally(() => {
|
||||
if (this.inFlight.get(dedupeKey)?.promise === promise) {
|
||||
this.inFlight.delete(dedupeKey)
|
||||
}
|
||||
})
|
||||
|
||||
entry = { promise, controller, waiters: 0 }
|
||||
this.inFlight.set(dedupeKey, entry)
|
||||
}
|
||||
|
||||
entry.waiters++
|
||||
const currentEntry = entry
|
||||
|
||||
if (!params.signal) {
|
||||
return currentEntry.promise.finally(() => {
|
||||
currentEntry.waiters = Math.max(0, currentEntry.waiters - 1)
|
||||
})
|
||||
}
|
||||
|
||||
return new Promise<ExtractCommentFrameResult>((resolve, reject) => {
|
||||
let settled = false
|
||||
const cleanup = () => {
|
||||
params.signal?.removeEventListener('abort', onAbort)
|
||||
currentEntry.waiters = Math.max(0, currentEntry.waiters - 1)
|
||||
if (currentEntry.waiters === 0) {
|
||||
currentEntry.controller.abort()
|
||||
}
|
||||
}
|
||||
const onAbort = () => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
cleanup()
|
||||
reject(new DOMException('Frame extraction aborted', 'AbortError'))
|
||||
}
|
||||
|
||||
params.signal!.addEventListener('abort', onAbort, { once: true })
|
||||
|
||||
currentEntry.promise.then(
|
||||
(res) => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
params.signal?.removeEventListener('abort', onAbort)
|
||||
currentEntry.waiters = Math.max(0, currentEntry.waiters - 1)
|
||||
resolve(res)
|
||||
},
|
||||
(err) => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
params.signal?.removeEventListener('abort', onAbort)
|
||||
currentEntry.waiters = Math.max(0, currentEntry.waiters - 1)
|
||||
reject(err)
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
private inferProxyType(mediaType: string | null): PrismaJson.MediaInfo['proxyType'] | undefined {
|
||||
const lower = (mediaType || '').toLowerCase()
|
||||
if (lower.startsWith('video/')) return 'video'
|
||||
if (lower === 'application/pdf') return 'pdf'
|
||||
if (lower.startsWith('image/')) return 'image'
|
||||
if (lower.startsWith('audio/')) return 'audio'
|
||||
return undefined
|
||||
}
|
||||
|
||||
private async extractVideoFrame(params: {
|
||||
asset: {
|
||||
id: string
|
||||
status: string
|
||||
storageKey: { key: string; isArchived: boolean } | null
|
||||
}
|
||||
media: PrismaJson.MediaInfo | null
|
||||
second: number
|
||||
seekTime: number
|
||||
frameRate?: number | null
|
||||
width: number
|
||||
watermarkConfigId?: string | null
|
||||
signal?: AbortSignal
|
||||
}): Promise<ExtractCommentFrameResult> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
let targetKey: string | null
|
||||
|
||||
if (params.watermarkConfigId) {
|
||||
const wfMap = await watermarkService.getCompletedWatermarkMediaMap(
|
||||
[params.asset.id],
|
||||
params.watermarkConfigId,
|
||||
)
|
||||
const watermarkMedia = wfMap.get(params.asset.id) ?? null
|
||||
targetKey = selectBestVideoProxyKey(watermarkMedia?.videoTranscodes)
|
||||
if (!targetKey) {
|
||||
throw new HTTPException(422, {
|
||||
message: 'Watermarked proxy is not ready for this asset',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
targetKey = selectBestVideoProxyKey(params.media?.videoTranscodes)
|
||||
if (!targetKey) {
|
||||
const originalKey = params.asset.storageKey?.key
|
||||
const isArchived =
|
||||
Boolean(params.asset.storageKey?.isArchived) || params.asset.status === 'archived'
|
||||
if (!originalKey || isArchived) {
|
||||
throw new HTTPException(422, {
|
||||
message: 'Original video file is archived and no proxy is available',
|
||||
})
|
||||
}
|
||||
targetKey = originalKey
|
||||
}
|
||||
}
|
||||
|
||||
const inputSource = await s3Service.resolveInput(bucket, targetKey)
|
||||
const isRemote = inputSource.startsWith('http://') || inputSource.startsWith('https://')
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'shumai-print-frame-'))
|
||||
|
||||
try {
|
||||
const outPath = path.join(tmpDir, `frame-${ulid()}.webp`)
|
||||
const runFfmpeg = async (timestamp: number) => {
|
||||
const args = [
|
||||
'-y',
|
||||
'-loglevel',
|
||||
'warning',
|
||||
...(isRemote
|
||||
? ['-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5']
|
||||
: []),
|
||||
'-ss',
|
||||
timestamp.toFixed(6),
|
||||
'-i',
|
||||
inputSource,
|
||||
'-map',
|
||||
'0:V:0',
|
||||
'-vframes',
|
||||
'1',
|
||||
'-vf',
|
||||
`scale=${params.width}:-2:force_original_aspect_ratio=decrease`,
|
||||
'-c:v',
|
||||
'libwebp',
|
||||
'-q:v',
|
||||
'80',
|
||||
outPath,
|
||||
]
|
||||
await this.execFileFn('ffmpeg', args, {
|
||||
signal: params.signal,
|
||||
timeout: this.timeoutMs,
|
||||
})
|
||||
}
|
||||
|
||||
await runFfmpeg(params.seekTime)
|
||||
|
||||
// If container metadata overestimated totalFrames at EOF, step back one frame and retry.
|
||||
if ((!fs.existsSync(outPath) || fs.statSync(outPath).size === 0) && params.seekTime > 0) {
|
||||
const stepBack = params.frameRate && params.frameRate > 0 ? 1 / params.frameRate : 0.1
|
||||
await runFfmpeg(Math.max(0, params.seekTime - stepBack))
|
||||
}
|
||||
|
||||
if (!fs.existsSync(outPath) || fs.statSync(outPath).size === 0) {
|
||||
throw new HTTPException(404, { message: 'Could not extract frame at requested timestamp' })
|
||||
}
|
||||
|
||||
const buffer = fs.readFileSync(outPath)
|
||||
return { buffer, mimeType: 'image/webp' }
|
||||
} catch (err) {
|
||||
if (err instanceof HTTPException) throw err
|
||||
if ((err as { name?: string })?.name === 'AbortError') throw err
|
||||
logger.error(
|
||||
{ assetId: params.asset.id, second: params.second, err },
|
||||
'Failed to extract video comment frame',
|
||||
)
|
||||
throw new HTTPException(500, { message: 'Failed to extract video frame' })
|
||||
} finally {
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
|
||||
private async extractPdfPageFrame(params: {
|
||||
asset: {
|
||||
id: string
|
||||
status: string
|
||||
storageKey: { key: string; isArchived: boolean } | null
|
||||
}
|
||||
media: PrismaJson.MediaInfo | null
|
||||
page: number
|
||||
width: number
|
||||
signal?: AbortSignal
|
||||
}): Promise<ExtractCommentFrameResult> {
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
const proxyKey = params.media?.pdfTranscode?.key
|
||||
const originalKey = params.asset.storageKey?.key
|
||||
const isArchived =
|
||||
Boolean(params.asset.storageKey?.isArchived) || params.asset.status === 'archived'
|
||||
|
||||
let targetKey: string | null = proxyKey || null
|
||||
if (!targetKey) {
|
||||
if (!originalKey || isArchived) {
|
||||
throw new HTTPException(422, {
|
||||
message: 'Original PDF file is archived and no proxy is available',
|
||||
})
|
||||
}
|
||||
targetKey = originalKey
|
||||
}
|
||||
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'shumai-print-pdf-'))
|
||||
try {
|
||||
const pdfPath = path.join(tmpDir, 'source.pdf')
|
||||
await s3Service.downloadToFile(bucket, targetKey, pdfPath)
|
||||
|
||||
const pagePrefix = path.join(tmpDir, 'page')
|
||||
await this.execFileFn(
|
||||
'pdftoppm',
|
||||
[
|
||||
'-png',
|
||||
'-scale-to',
|
||||
String(params.width),
|
||||
'-f',
|
||||
String(params.page),
|
||||
'-l',
|
||||
String(params.page),
|
||||
pdfPath,
|
||||
pagePrefix,
|
||||
],
|
||||
{
|
||||
signal: params.signal,
|
||||
timeout: this.timeoutMs,
|
||||
},
|
||||
)
|
||||
|
||||
const pngFile = fs.readdirSync(tmpDir).find((f) => f.endsWith('.png'))
|
||||
if (!pngFile) {
|
||||
throw new HTTPException(404, { message: `PDF page ${params.page} not found` })
|
||||
}
|
||||
|
||||
const buffer = await sharp(path.join(tmpDir, pngFile), {
|
||||
limitInputPixels: (params.width + 1) ** 2,
|
||||
})
|
||||
.toColorspace('srgb')
|
||||
.webp({ quality: 82 })
|
||||
.toBuffer()
|
||||
|
||||
return { buffer, mimeType: 'image/webp' }
|
||||
} catch (err) {
|
||||
if (err instanceof HTTPException) throw err
|
||||
if ((err as { name?: string })?.name === 'AbortError') throw err
|
||||
logger.error(
|
||||
{ assetId: params.asset.id, page: params.page, err },
|
||||
'Failed to render PDF comment page frame',
|
||||
)
|
||||
throw new HTTPException(500, { message: 'Failed to render PDF page' })
|
||||
} finally {
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const commentFrameService = new CommentFrameService()
|
||||
@@ -12,6 +12,8 @@ export interface PostCommentParams {
|
||||
/** Timecode in seconds (or the encoded viewing angle for 3D models). */
|
||||
second?: number
|
||||
attachmentIds?: string[]
|
||||
/** Whether the comment is internal and hidden from public share links (default false). */
|
||||
isInternal?: boolean
|
||||
/** Whether mentions of agents start a chat with them (default true). */
|
||||
triggerAgents?: boolean
|
||||
}
|
||||
@@ -31,6 +33,7 @@ export class CommentService {
|
||||
annotations: params.annotations,
|
||||
second: params.second,
|
||||
attachmentIds: params.attachmentIds ?? [],
|
||||
isInternal: params.isInternal,
|
||||
},
|
||||
{ triggerAgents: params.triggerAgents },
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ export * from './asset/auto-archive-job'
|
||||
export * from './auth/auth'
|
||||
export * from './authz/authz'
|
||||
export * from './collection/collection'
|
||||
export * from './comment/comment-frame'
|
||||
export * from './invite/invite'
|
||||
export * from './metadata/metadata'
|
||||
export * from './notification/index'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { KanbanTaskStatus, KanbanTaskPriority } from '@shumai/db/enums'
|
||||
import { KanbanTaskStatus, KanbanTaskPriority, KanbanTaskEventType } from '@shumai/db/enums'
|
||||
import { UNASSIGNED_GOAL_ID } from '@shumai/dtos'
|
||||
import { kanbanService } from './kanban'
|
||||
|
||||
@@ -646,7 +646,7 @@ describe('KanbanService', () => {
|
||||
)
|
||||
|
||||
// Create attachment
|
||||
const att = await kanbanService.createAttachment(team.id, {
|
||||
const att = await kanbanService.createAttachment(team.id, editor.id, {
|
||||
fileName: 'design.png',
|
||||
size: 1024,
|
||||
contentType: 'image/png',
|
||||
@@ -688,6 +688,119 @@ describe('KanbanService', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Comment attachment keys', () => {
|
||||
function payload(key: string) {
|
||||
return [{ id: 'att-1', name: 'file.txt', key, sizeByte: 1, contentType: 'text/plain' }]
|
||||
}
|
||||
|
||||
it('rejects attachment keys that were not issued to the author for the task team', async () => {
|
||||
const { team, editor, reviewer } = await setupTeamAndUsers()
|
||||
const otherTeam = await prisma.team.create({ data: { name: 'Other Team' } })
|
||||
const task = await kanbanService.createTask(team.id, { title: 'Task' }, editor.id, 'editor')
|
||||
|
||||
const foreignTeam = await kanbanService.createAttachment(otherTeam.id, editor.id, {
|
||||
fileName: 'other.png',
|
||||
size: 1,
|
||||
})
|
||||
const otherUser = await kanbanService.createAttachment(team.id, reviewer.id, {
|
||||
fileName: 'theirs.png',
|
||||
size: 1,
|
||||
})
|
||||
const own = await kanbanService.createAttachment(team.id, editor.id, {
|
||||
fileName: 'own.png',
|
||||
size: 1,
|
||||
})
|
||||
const ownDir = own.key.slice(0, own.key.lastIndexOf('/'))
|
||||
|
||||
for (const key of [
|
||||
'files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov',
|
||||
'avatars/someone.png',
|
||||
'kanban/attachments/01JAAAAAAAAAAAAAAAAAAAAAAA/old.png',
|
||||
foreignTeam.key,
|
||||
otherUser.key,
|
||||
`${ownDir}/../../../../../files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov`,
|
||||
`kanban/attachments/${team.id}/${editor.id}/not-a-ulid/own.png`,
|
||||
]) {
|
||||
await expect(
|
||||
kanbanService.addComment(task.id, editor.id, 'see attached', payload(key)),
|
||||
).rejects.toThrow(/Invalid attachment/)
|
||||
}
|
||||
|
||||
const comments = await kanbanService.listComments(task.id)
|
||||
expect(comments).toHaveLength(0)
|
||||
|
||||
const accepted = await kanbanService.addComment(
|
||||
task.id,
|
||||
editor.id,
|
||||
'see attached',
|
||||
payload(own.key),
|
||||
)
|
||||
expect(accepted.attachments.map((a) => a.id)).toEqual(['att-1'])
|
||||
})
|
||||
|
||||
it('does not sign stored attachment keys outside kanban attachments', async () => {
|
||||
const { team, editor } = await setupTeamAndUsers()
|
||||
const task = await kanbanService.createTask(team.id, { title: 'Task' }, editor.id, 'editor')
|
||||
const legacyKey = 'kanban/attachments/01JAAAAAAAAAAAAAAAAAAAAAAA/notes.txt'
|
||||
|
||||
await prisma.kanbanTaskComment.create({
|
||||
data: {
|
||||
taskId: task.id,
|
||||
authorId: editor.id,
|
||||
body: 'stored before validation',
|
||||
attachments: [
|
||||
{
|
||||
id: 'a',
|
||||
name: 'secret',
|
||||
key: 'files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov',
|
||||
sizeByte: 1,
|
||||
},
|
||||
{
|
||||
id: 'b',
|
||||
name: 'escape',
|
||||
key: 'kanban/attachments/../files/x/master.mov',
|
||||
sizeByte: 1,
|
||||
},
|
||||
{ id: 'c', name: 'notes.txt', key: legacyKey, sizeByte: 1 },
|
||||
{
|
||||
id: 'd',
|
||||
name: 'other-team.txt',
|
||||
key: `kanban/attachments/other-team/${editor.id}/01JAAAAAAAAAAAAAAAAAAAAAAA/x.txt`,
|
||||
sizeByte: 1,
|
||||
},
|
||||
{
|
||||
id: 'e',
|
||||
name: 'current.txt',
|
||||
key: `kanban/attachments/${team.id}/${editor.id}/01JAAAAAAAAAAAAAAAAAAAAAAA/y.txt`,
|
||||
sizeByte: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
const [comment] = await kanbanService.listComments(task.id)
|
||||
expect(comment.attachments.map((a) => a.id)).toEqual(['c', 'e'])
|
||||
|
||||
const detail = await kanbanService.getTask(task.id)
|
||||
expect(detail.comments[0].attachments.map((a) => a.id)).toEqual(['c', 'e'])
|
||||
})
|
||||
|
||||
it('keeps attachment uploads inside the team attachment folder', async () => {
|
||||
const { team, editor } = await setupTeamAndUsers()
|
||||
|
||||
const att = await kanbanService.createAttachment(team.id, editor.id, {
|
||||
fileName: '../../files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov',
|
||||
size: 1,
|
||||
})
|
||||
|
||||
const parts = att.key.split('/')
|
||||
expect(parts.slice(0, 4)).toEqual(['kanban', 'attachments', team.id, editor.id])
|
||||
expect(parts).toHaveLength(6)
|
||||
expect(parts).not.toContain('..')
|
||||
expect(att.name).toBe('../../files/01JAAAAAAAAAAAAAAAAAAAAAAA/master.mov')
|
||||
})
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Task Ordering & Fractional Indexing
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -1139,4 +1252,185 @@ describe('KanbanService', () => {
|
||||
expect(pdfDetail?.thumbnailUrl).toContain('posters/doc_poster.webp')
|
||||
})
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Project membership
|
||||
// --------------------------------------------------------------------------
|
||||
describe('Project membership', () => {
|
||||
async function setupProjectScopedMember() {
|
||||
const { team, owner, reviewer } = await setupTeamAndUsers()
|
||||
const client = await prisma.user.create({
|
||||
data: { name: 'Client Reviewer', email: 'client@example.com' },
|
||||
})
|
||||
const ownProject = await prisma.project.create({
|
||||
data: { name: 'Client Project', teamId: team.id },
|
||||
})
|
||||
const otherProject = await prisma.project.create({
|
||||
data: { name: 'Internal Project', teamId: team.id },
|
||||
})
|
||||
const clientMember = await prisma.teamMember.create({
|
||||
data: { teamId: team.id, userId: client.id, role: 'reviewer', scope: 'project' },
|
||||
})
|
||||
await prisma.projectMember.create({
|
||||
data: { projectId: ownProject.id, teamMemberId: clientMember.id, role: 'reviewer' },
|
||||
})
|
||||
|
||||
const ownTask = await kanbanService.createTask(
|
||||
team.id,
|
||||
{ title: 'Client task', projectId: ownProject.id },
|
||||
owner.id,
|
||||
'owner',
|
||||
)
|
||||
const otherTask = await kanbanService.createTask(
|
||||
team.id,
|
||||
{ title: 'Internal task', projectId: otherProject.id },
|
||||
owner.id,
|
||||
'owner',
|
||||
)
|
||||
const teamTask = await kanbanService.createTask(
|
||||
team.id,
|
||||
{ title: 'Team task' },
|
||||
owner.id,
|
||||
'owner',
|
||||
)
|
||||
const assignedTask = await kanbanService.createTask(
|
||||
team.id,
|
||||
{ title: 'Assigned internal task', projectId: otherProject.id, assigneeId: client.id },
|
||||
owner.id,
|
||||
'owner',
|
||||
)
|
||||
|
||||
return {
|
||||
team,
|
||||
owner,
|
||||
reviewer,
|
||||
client,
|
||||
otherProject,
|
||||
ownTask,
|
||||
otherTask,
|
||||
teamTask,
|
||||
assignedTask,
|
||||
}
|
||||
}
|
||||
|
||||
it('lists only tasks in their projects, or that they take part in, for project-scoped members', async () => {
|
||||
const { team, client, otherProject, ownTask, assignedTask } = await setupProjectScopedMember()
|
||||
|
||||
const list = await kanbanService.listTasks(team.id, {}, client.id)
|
||||
expect(list.data.map((t) => t.id).sort()).toEqual([ownTask.id, assignedTask.id].sort())
|
||||
expect(list.pageInfo.total).toBe(2)
|
||||
|
||||
const filtered = await kanbanService.listTasks(
|
||||
team.id,
|
||||
{ projectId: otherProject.id },
|
||||
client.id,
|
||||
)
|
||||
expect(filtered.data.map((t) => t.id)).toEqual([assignedTask.id])
|
||||
})
|
||||
|
||||
it('lists every team task for team-scoped members', async () => {
|
||||
const { team, reviewer, ownTask, otherTask, teamTask, assignedTask } =
|
||||
await setupProjectScopedMember()
|
||||
|
||||
const list = await kanbanService.listTasks(team.id, {}, reviewer.id)
|
||||
expect(list.data.map((t) => t.id).sort()).toEqual(
|
||||
[ownTask.id, otherTask.id, teamTask.id, assignedTask.id].sort(),
|
||||
)
|
||||
})
|
||||
|
||||
it('shows only readable dependencies, dependents, and dependency events', async () => {
|
||||
const { owner, team, client, reviewer, ownTask, otherTask, teamTask, assignedTask } =
|
||||
await setupProjectScopedMember()
|
||||
|
||||
await kanbanService.setDependencies(
|
||||
ownTask.id,
|
||||
[otherTask.id, assignedTask.id, teamTask.id],
|
||||
owner.id,
|
||||
)
|
||||
await kanbanService.setDependencies(ownTask.id, [otherTask.id, assignedTask.id], owner.id)
|
||||
await kanbanService.setDependencies(teamTask.id, [ownTask.id], owner.id)
|
||||
await kanbanService.setDependencies(assignedTask.id, [otherTask.id], owner.id)
|
||||
|
||||
const detail = await kanbanService.getTask(ownTask.id, client.id)
|
||||
expect(detail.dependencies.map((task) => task.id)).toEqual([assignedTask.id])
|
||||
expect(detail.dependents).toEqual([])
|
||||
expect(detail.dependencyCount).toBe(1)
|
||||
expect(detail.dependentCount).toBe(0)
|
||||
|
||||
const events = await kanbanService.listEvents(ownTask.id, client.id)
|
||||
for (const history of [detail.events, events]) {
|
||||
expect(
|
||||
history.filter((event) => event.type === KanbanTaskEventType.DEPENDENCY_ADDED),
|
||||
).toEqual([expect.objectContaining({ data: { parentId: assignedTask.id } })])
|
||||
expect(history).toContainEqual(
|
||||
expect.objectContaining({ type: KanbanTaskEventType.CREATED }),
|
||||
)
|
||||
expect(history).not.toContainEqual(
|
||||
expect.objectContaining({ type: KanbanTaskEventType.DEPENDENCY_REMOVED }),
|
||||
)
|
||||
}
|
||||
|
||||
const teamDetail = await kanbanService.getTask(ownTask.id, reviewer.id)
|
||||
expect(teamDetail.dependencies.map((task) => task.id).sort()).toEqual(
|
||||
[otherTask.id, assignedTask.id].sort(),
|
||||
)
|
||||
expect(teamDetail.dependents.map((task) => task.id)).toEqual([teamTask.id])
|
||||
expect(teamDetail.events).toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: KanbanTaskEventType.DEPENDENCY_REMOVED,
|
||||
data: { parentId: teamTask.id },
|
||||
}),
|
||||
)
|
||||
|
||||
const summary = await kanbanService.listTasks(team.id, {}, client.id)
|
||||
expect(summary.data).toContainEqual(
|
||||
expect.objectContaining({ id: ownTask.id, dependencyCount: 1, dependentCount: 0 }),
|
||||
)
|
||||
|
||||
const updated = await kanbanService.updateTask(
|
||||
assignedTask.id,
|
||||
{ title: 'Updated assigned task' },
|
||||
client.id,
|
||||
null,
|
||||
)
|
||||
expect(updated).toMatchObject({ dependencyCount: 0, dependentCount: 1 })
|
||||
})
|
||||
|
||||
it('lists no tasks for users outside the team', async () => {
|
||||
const { team } = await setupProjectScopedMember()
|
||||
const outsider = await prisma.user.create({
|
||||
data: { name: 'Outsider', email: 'outsider@example.com' },
|
||||
})
|
||||
|
||||
const list = await kanbanService.listTasks(team.id, {}, outsider.id)
|
||||
expect(list.data).toEqual([])
|
||||
})
|
||||
|
||||
it('lists only readable tasks linked to an asset', async () => {
|
||||
const { team, owner, client, reviewer, otherProject, otherTask, assignedTask } =
|
||||
await setupProjectScopedMember()
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'internal.mp4',
|
||||
type: 'file',
|
||||
status: 'processed',
|
||||
projectId: otherProject.id,
|
||||
creatorId: owner.id,
|
||||
},
|
||||
})
|
||||
await kanbanService.linkAsset(team.id, otherTask.id, asset.id)
|
||||
await kanbanService.linkAsset(team.id, assignedTask.id, asset.id)
|
||||
await kanbanService.setDependencies(assignedTask.id, [otherTask.id], owner.id)
|
||||
|
||||
const forClient = await kanbanService.listTasksForAsset(team.id, asset.id, client.id)
|
||||
expect(forClient.map((t) => t.id)).toEqual([assignedTask.id])
|
||||
expect(forClient[0].dependencyCount).toBe(0)
|
||||
|
||||
const forReviewer = await kanbanService.listTasksForAsset(team.id, asset.id, reviewer.id)
|
||||
expect(forReviewer.map((t) => t.id).sort()).toEqual([otherTask.id, assignedTask.id].sort())
|
||||
expect(forReviewer).toContainEqual(
|
||||
expect.objectContaining({ id: assignedTask.id, dependencyCount: 1 }),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,6 +7,7 @@ import { paginateQuery } from '../pagination'
|
||||
import { getAvatarUrl } from '../user/avatar'
|
||||
import { s3Service } from '../s3/s3'
|
||||
import { getProxyType } from '../utils/mime'
|
||||
import { sanitizeFilename } from '../utils/filename'
|
||||
import { assetService } from '../asset/asset'
|
||||
import type {
|
||||
CreateKanbanGoalRequest,
|
||||
@@ -28,6 +29,73 @@ import type {
|
||||
} from '@shumai/dtos'
|
||||
import { UNASSIGNED_GOAL_ID } from '@shumai/dtos'
|
||||
|
||||
type TaskEventWithActor = Prisma.KanbanTaskEventGetPayload<{ include: { actor: true } }>
|
||||
|
||||
function dependencyEventParentId(event: TaskEventWithActor): string | undefined {
|
||||
if (
|
||||
event.type === KanbanTaskEventType.DEPENDENCY_ADDED ||
|
||||
event.type === KanbanTaskEventType.DEPENDENCY_REMOVED
|
||||
) {
|
||||
const parentId = event.data?.parentId
|
||||
if (typeof parentId === 'string') return parentId
|
||||
}
|
||||
}
|
||||
|
||||
function taskRelationCountSelect(
|
||||
taskFilter: Prisma.KanbanTaskWhereInput | undefined,
|
||||
): Prisma.KanbanTaskCountOutputTypeSelect {
|
||||
return {
|
||||
comments: true,
|
||||
assets: true,
|
||||
dependencies: taskFilter ? { where: { parent: taskFilter } } : true,
|
||||
dependents: taskFilter ? { where: { child: taskFilter } } : true,
|
||||
}
|
||||
}
|
||||
|
||||
const ULID_PATTERN = /^[0-9A-HJKMNP-TV-Z]{26}$/
|
||||
|
||||
function isSafeKeySegment(segment: string): boolean {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
return segment !== '' && segment !== '.' && segment !== '..' && !/[\\\x00-\x1f\x7f]/.test(segment)
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a comment attachment key issued by `createAttachment`:
|
||||
* `kanban/attachments/<teamId>/<uploaderId>/<ulid>/<file name>`.
|
||||
*/
|
||||
function parseAttachmentKey(key: string): { teamId: string; uploaderId: string } | null {
|
||||
const parts = key.split('/')
|
||||
if (
|
||||
parts.length !== 6 ||
|
||||
parts[0] !== 'kanban' ||
|
||||
parts[1] !== 'attachments' ||
|
||||
!isSafeKeySegment(parts[2]) ||
|
||||
!isSafeKeySegment(parts[3]) ||
|
||||
!ULID_PATTERN.test(parts[4]) ||
|
||||
!isSafeKeySegment(parts[5])
|
||||
) {
|
||||
return null
|
||||
}
|
||||
return { teamId: parts[2], uploaderId: parts[3] }
|
||||
}
|
||||
|
||||
/** Keys of comment attachments stored before keys carried the team and uploader. */
|
||||
function isLegacyAttachmentKey(key: string): boolean {
|
||||
const parts = key.split('/')
|
||||
return (
|
||||
parts.length === 4 &&
|
||||
parts[0] === 'kanban' &&
|
||||
parts[1] === 'attachments' &&
|
||||
ULID_PATTERN.test(parts[2]) &&
|
||||
isSafeKeySegment(parts[3])
|
||||
)
|
||||
}
|
||||
|
||||
/** Whether a stored attachment key may be signed for a comment on a task in `teamId`. */
|
||||
function isReadableAttachmentKey(key: string, teamId: string): boolean {
|
||||
return parseAttachmentKey(key)?.teamId === teamId || isLegacyAttachmentKey(key)
|
||||
}
|
||||
|
||||
export class KanbanService {
|
||||
// --------------------------------------------------------------------------
|
||||
// Goal CRUD
|
||||
@@ -314,7 +382,7 @@ export class KanbanService {
|
||||
})
|
||||
}
|
||||
|
||||
async getTask(taskId: string): Promise<KanbanTaskDetail> {
|
||||
async getTask(taskId: string, viewerId?: string): Promise<KanbanTaskDetail> {
|
||||
const task = await prisma.kanbanTask.findUnique({
|
||||
where: { id: taskId },
|
||||
include: {
|
||||
@@ -354,27 +422,38 @@ export class KanbanService {
|
||||
throw new HTTPException(404, { message: 'Task not found' })
|
||||
}
|
||||
|
||||
const readableIds = await this.readableRelatedTaskIds(task.teamId, viewerId, [
|
||||
...task.dependencies.map((link) => link.parentId),
|
||||
...task.dependents.map((link) => link.childId),
|
||||
...task.events.map(dependencyEventParentId).filter((id) => id !== undefined),
|
||||
])
|
||||
const dependencies = task.dependencies.filter(
|
||||
(link) => !readableIds || readableIds.has(link.parentId),
|
||||
)
|
||||
const dependents = task.dependents.filter(
|
||||
(link) => !readableIds || readableIds.has(link.childId),
|
||||
)
|
||||
const latestStatusEvent = await this.resolveLatestStatusEvent(taskId, task.status)
|
||||
const resolvedAssets = await this.resolveTaskAssetInfos(task.assets)
|
||||
|
||||
const baseInfo = await this.toTaskInfo(task, {
|
||||
latestStatusEvent,
|
||||
dependencyCount: task.dependencies.length,
|
||||
dependentCount: task.dependents.length,
|
||||
dependencyCount: dependencies.length,
|
||||
dependentCount: dependents.length,
|
||||
commentCount: task.comments.length,
|
||||
assetCount: task.assets.length,
|
||||
})
|
||||
|
||||
return {
|
||||
...baseInfo,
|
||||
dependencies: task.dependencies.map((d) => ({
|
||||
dependencies: dependencies.map((d) => ({
|
||||
id: d.parent.id,
|
||||
title: d.parent.title,
|
||||
isAgentTask: d.parent.isAgentTask,
|
||||
status: d.parent.status,
|
||||
priority: d.parent.priority,
|
||||
})),
|
||||
dependents: task.dependents.map((d) => ({
|
||||
dependents: dependents.map((d) => ({
|
||||
id: d.child.id,
|
||||
title: d.child.title,
|
||||
isAgentTask: d.child.isAgentTask,
|
||||
@@ -392,29 +471,12 @@ export class KanbanService {
|
||||
image: await getAvatarUrl(c.author.image),
|
||||
},
|
||||
body: c.body,
|
||||
attachments: await this.resolveCommentAttachments(c.attachments),
|
||||
attachments: await this.resolveCommentAttachments(c.attachments, task.teamId),
|
||||
createdAt: c.createdAt.toISOString(),
|
||||
updatedAt: c.updatedAt.toISOString(),
|
||||
})),
|
||||
),
|
||||
events: await Promise.all(
|
||||
task.events.map(async (e) => ({
|
||||
id: e.id,
|
||||
taskId: e.taskId,
|
||||
actor: e.actor
|
||||
? {
|
||||
id: e.actor.id,
|
||||
name: e.actor.name,
|
||||
image: await getAvatarUrl(e.actor.image),
|
||||
}
|
||||
: null,
|
||||
type: e.type,
|
||||
fromStatus: e.fromStatus,
|
||||
toStatus: e.toStatus,
|
||||
data: (e.data as Record<string, unknown>) ?? null,
|
||||
createdAt: e.createdAt.toISOString(),
|
||||
})),
|
||||
),
|
||||
events: await this.resolveTaskEvents(task.events, readableIds),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +721,8 @@ export class KanbanService {
|
||||
}
|
||||
|
||||
const latestStatusEvent = await this.resolveLatestStatusEvent(taskId, updated.status)
|
||||
const counts = await this.getTaskCounts(taskId)
|
||||
const taskFilter = await this.readableTaskFilter(updated.teamId, actorId)
|
||||
const counts = await this.getTaskCounts(taskId, taskFilter)
|
||||
|
||||
return await this.toTaskInfo(updated, {
|
||||
latestStatusEvent,
|
||||
@@ -704,10 +767,54 @@ export class KanbanService {
|
||||
return taskInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits kanban tasks to those a user may read. Team-scoped members see every
|
||||
* task in the team; project-scoped members see tasks in the projects they
|
||||
* belong to and tasks they created, report, or are assigned to.
|
||||
*/
|
||||
private async readableTaskFilter(
|
||||
teamId: string,
|
||||
userId: string | undefined,
|
||||
): Promise<Prisma.KanbanTaskWhereInput | undefined> {
|
||||
if (!userId) return
|
||||
const member = await prisma.teamMember.findUnique({
|
||||
where: { teamIdUserId: { teamId, userId } },
|
||||
})
|
||||
if (!member) return { id: { in: [] } }
|
||||
if (member.scope === 'team') return
|
||||
return {
|
||||
teamId,
|
||||
OR: [
|
||||
{ project: { members: { some: { teamMemberId: member.id } } } },
|
||||
{ creatorId: userId },
|
||||
{ reporterId: userId },
|
||||
{ assigneeId: userId },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
private async readableRelatedTaskIds(
|
||||
teamId: string,
|
||||
viewerId: string | undefined,
|
||||
relatedIds: string[],
|
||||
): Promise<Set<string> | undefined> {
|
||||
if (relatedIds.length === 0) return
|
||||
const filter = await this.readableTaskFilter(teamId, viewerId)
|
||||
if (!filter) return
|
||||
|
||||
const tasks = await prisma.kanbanTask.findMany({
|
||||
where: { id: { in: [...new Set(relatedIds)] }, AND: [filter] },
|
||||
select: { id: true },
|
||||
})
|
||||
return new Set(tasks.map((task) => task.id))
|
||||
}
|
||||
|
||||
async listTasks(
|
||||
teamId: string,
|
||||
params: ListKanbanTasksRequest,
|
||||
viewerId?: string,
|
||||
): Promise<{ data: KanbanTaskInfo[]; pageInfo: { total?: number; cursor?: string } }> {
|
||||
const taskFilter = await this.readableTaskFilter(teamId, viewerId)
|
||||
const where: Prisma.KanbanTaskWhereInput = {
|
||||
teamId,
|
||||
...(params.status && { status: params.status }),
|
||||
@@ -721,6 +828,7 @@ export class KanbanService {
|
||||
...(params.priority && { priority: params.priority }),
|
||||
...(params.assigneeId && { assigneeId: params.assigneeId }),
|
||||
...(params.reporterId && { reporterId: params.reporterId }),
|
||||
...(taskFilter && { AND: [taskFilter] }),
|
||||
}
|
||||
|
||||
return await paginateQuery(
|
||||
@@ -732,14 +840,7 @@ export class KanbanService {
|
||||
reporter: true,
|
||||
assignee: true,
|
||||
goal: true,
|
||||
_count: {
|
||||
select: {
|
||||
comments: true,
|
||||
dependencies: true,
|
||||
dependents: true,
|
||||
assets: true,
|
||||
},
|
||||
},
|
||||
_count: { select: taskRelationCountSelect(taskFilter) },
|
||||
},
|
||||
orderBy: [{ sortIndex: 'asc' }, { id: 'asc' }],
|
||||
skip,
|
||||
@@ -869,9 +970,10 @@ export class KanbanService {
|
||||
|
||||
async createAttachment(
|
||||
teamId: string,
|
||||
uploaderId: string,
|
||||
req: { fileName: string; size: number; contentType?: string },
|
||||
): Promise<PostKanbanAttachmentResponse> {
|
||||
const key = `kanban/attachments/${ulid()}/${req.fileName}`
|
||||
const key = `kanban/attachments/${teamId}/${uploaderId}/${ulid()}/${sanitizeFilename(req.fileName)}`
|
||||
const uploadUrl = await s3Service.presign(process.env.S3_BUCKET || 'shumai', key, 'PUT')
|
||||
const proxyType = getProxyType(req.contentType, req.fileName)
|
||||
|
||||
@@ -895,6 +997,16 @@ export class KanbanService {
|
||||
const task = await prisma.kanbanTask.findUnique({ where: { id: taskId } })
|
||||
if (!task) throw new HTTPException(404, { message: 'Task not found' })
|
||||
|
||||
// Attachments are uploaded through createAttachment. Only keys it issued to the
|
||||
// comment author for this task's team may be stored and signed later.
|
||||
const isOwnUpload = (key: string) => {
|
||||
const parsed = parseAttachmentKey(key)
|
||||
return parsed?.teamId === task.teamId && parsed.uploaderId === authorId
|
||||
}
|
||||
if (attachments?.some((att) => !isOwnUpload(att.key))) {
|
||||
throw new HTTPException(400, { message: 'Invalid attachment' })
|
||||
}
|
||||
|
||||
const comment = await prisma.$transaction(async (tx) => {
|
||||
const c = await tx.kanbanTaskComment.create({
|
||||
data: {
|
||||
@@ -917,7 +1029,10 @@ export class KanbanService {
|
||||
return c
|
||||
})
|
||||
|
||||
const resolvedAttachments = await this.resolveCommentAttachments(comment.attachments)
|
||||
const resolvedAttachments = await this.resolveCommentAttachments(
|
||||
comment.attachments,
|
||||
task.teamId,
|
||||
)
|
||||
|
||||
return {
|
||||
id: comment.id,
|
||||
@@ -935,6 +1050,12 @@ export class KanbanService {
|
||||
}
|
||||
|
||||
async listComments(taskId: string): Promise<KanbanCommentInfo[]> {
|
||||
const task = await prisma.kanbanTask.findUnique({
|
||||
where: { id: taskId },
|
||||
select: { teamId: true },
|
||||
})
|
||||
if (!task) throw new HTTPException(404, { message: 'Task not found' })
|
||||
|
||||
const comments = await prisma.kanbanTaskComment.findMany({
|
||||
where: { taskId },
|
||||
include: { author: true },
|
||||
@@ -951,7 +1072,7 @@ export class KanbanService {
|
||||
image: await getAvatarUrl(c.author.image),
|
||||
},
|
||||
body: c.body,
|
||||
attachments: await this.resolveCommentAttachments(c.attachments),
|
||||
attachments: await this.resolveCommentAttachments(c.attachments, task.teamId),
|
||||
createdAt: c.createdAt.toISOString(),
|
||||
updatedAt: c.updatedAt.toISOString(),
|
||||
})),
|
||||
@@ -981,7 +1102,8 @@ export class KanbanService {
|
||||
}
|
||||
|
||||
private async resolveCommentAttachments(
|
||||
attachments?: PrismaJson.KanbanCommentAttachmentList | null,
|
||||
attachments: PrismaJson.KanbanCommentAttachmentList | null | undefined,
|
||||
teamId: string,
|
||||
): Promise<KanbanAttachmentInfo[]> {
|
||||
if (!attachments || !Array.isArray(attachments) || attachments.length === 0) {
|
||||
return []
|
||||
@@ -989,29 +1111,50 @@ export class KanbanService {
|
||||
|
||||
const bucket = process.env.S3_BUCKET || 'shumai'
|
||||
return await Promise.all(
|
||||
attachments.map(async (att) => {
|
||||
const url = await s3Service.presign(bucket, att.key, 'GET')
|
||||
return {
|
||||
id: att.id,
|
||||
name: att.name,
|
||||
sizeByte: att.sizeByte,
|
||||
contentType: att.contentType,
|
||||
url,
|
||||
proxyType: att.proxyType,
|
||||
}
|
||||
}),
|
||||
attachments
|
||||
.filter((att) => typeof att.key === 'string' && isReadableAttachmentKey(att.key, teamId))
|
||||
.map(async (att) => {
|
||||
const url = await s3Service.presign(bucket, att.key, 'GET')
|
||||
return {
|
||||
id: att.id,
|
||||
name: att.name,
|
||||
sizeByte: att.sizeByte,
|
||||
contentType: att.contentType,
|
||||
url,
|
||||
proxyType: att.proxyType,
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
async listEvents(taskId: string): Promise<KanbanEventInfo[]> {
|
||||
const events = await prisma.kanbanTaskEvent.findMany({
|
||||
where: { taskId },
|
||||
include: { actor: true },
|
||||
orderBy: { createdAt: 'desc' },
|
||||
async listEvents(taskId: string, viewerId?: string): Promise<KanbanEventInfo[]> {
|
||||
const task = await prisma.kanbanTask.findUnique({
|
||||
where: { id: taskId },
|
||||
select: {
|
||||
teamId: true,
|
||||
events: { include: { actor: true }, orderBy: { createdAt: 'desc' } },
|
||||
},
|
||||
})
|
||||
if (!task) return []
|
||||
const readableIds = await this.readableRelatedTaskIds(
|
||||
task.teamId,
|
||||
viewerId,
|
||||
task.events.map(dependencyEventParentId).filter((id) => id !== undefined),
|
||||
)
|
||||
return await this.resolveTaskEvents(task.events, readableIds)
|
||||
}
|
||||
|
||||
private async resolveTaskEvents(
|
||||
events: TaskEventWithActor[],
|
||||
readableIds: Set<string> | undefined,
|
||||
): Promise<KanbanEventInfo[]> {
|
||||
const visibleEvents = events.filter((event) => {
|
||||
const parentId = dependencyEventParentId(event)
|
||||
return !readableIds || parentId === undefined || readableIds.has(parentId)
|
||||
})
|
||||
|
||||
return await Promise.all(
|
||||
events.map(async (e) => ({
|
||||
visibleEvents.map(async (e) => ({
|
||||
id: e.id,
|
||||
taskId: e.taskId,
|
||||
actor: e.actor
|
||||
@@ -1024,7 +1167,7 @@ export class KanbanService {
|
||||
type: e.type,
|
||||
fromStatus: e.fromStatus,
|
||||
toStatus: e.toStatus,
|
||||
data: (e.data as Record<string, unknown>) ?? null,
|
||||
data: e.data ?? null,
|
||||
createdAt: e.createdAt.toISOString(),
|
||||
})),
|
||||
)
|
||||
@@ -1115,9 +1258,17 @@ export class KanbanService {
|
||||
return await this.resolveTaskAssetInfos(links)
|
||||
}
|
||||
|
||||
async listTasksForAsset(teamId: string, assetId: string): Promise<KanbanTaskInfo[]> {
|
||||
async listTasksForAsset(
|
||||
teamId: string,
|
||||
assetId: string,
|
||||
viewerId?: string,
|
||||
): Promise<KanbanTaskInfo[]> {
|
||||
const taskFilter = await this.readableTaskFilter(teamId, viewerId)
|
||||
const links = await prisma.kanbanTaskAsset.findMany({
|
||||
where: { assetId },
|
||||
where: {
|
||||
assetId,
|
||||
task: { teamId, ...taskFilter },
|
||||
},
|
||||
include: {
|
||||
task: {
|
||||
include: {
|
||||
@@ -1125,24 +1276,15 @@ export class KanbanService {
|
||||
reporter: true,
|
||||
assignee: true,
|
||||
goal: true,
|
||||
_count: {
|
||||
select: {
|
||||
comments: true,
|
||||
dependencies: true,
|
||||
dependents: true,
|
||||
assets: true,
|
||||
},
|
||||
},
|
||||
_count: { select: taskRelationCountSelect(taskFilter) },
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
})
|
||||
|
||||
const matchingLinks = links.filter((l) => l.task && l.task.teamId === teamId)
|
||||
|
||||
return await Promise.all(
|
||||
matchingLinks.map(async (l) => {
|
||||
links.map(async (l) => {
|
||||
const t = l.task
|
||||
const latestStatusEvent = await this.resolveLatestStatusEvent(t.id, t.status)
|
||||
return await this.toTaskInfo(t, {
|
||||
@@ -1195,19 +1337,25 @@ export class KanbanService {
|
||||
}
|
||||
}
|
||||
|
||||
private async getTaskCounts(taskId: string): Promise<{
|
||||
private async getTaskCounts(
|
||||
taskId: string,
|
||||
taskFilter?: Prisma.KanbanTaskWhereInput,
|
||||
): Promise<{
|
||||
commentCount: number
|
||||
dependencyCount: number
|
||||
dependentCount: number
|
||||
assetCount: number
|
||||
}> {
|
||||
const [commentCount, dependencyCount, dependentCount, assetCount] = await Promise.all([
|
||||
prisma.kanbanTaskComment.count({ where: { taskId } }),
|
||||
prisma.kanbanTaskLink.count({ where: { childId: taskId } }),
|
||||
prisma.kanbanTaskLink.count({ where: { parentId: taskId } }),
|
||||
prisma.kanbanTaskAsset.count({ where: { taskId } }),
|
||||
])
|
||||
return { commentCount, dependencyCount, dependentCount, assetCount }
|
||||
const task = await prisma.kanbanTask.findUnique({
|
||||
where: { id: taskId },
|
||||
select: { _count: { select: taskRelationCountSelect(taskFilter) } },
|
||||
})
|
||||
return {
|
||||
commentCount: task?._count.comments ?? 0,
|
||||
dependencyCount: task?._count.dependencies ?? 0,
|
||||
dependentCount: task?._count.dependents ?? 0,
|
||||
assetCount: task?._count.assets ?? 0,
|
||||
}
|
||||
}
|
||||
|
||||
private async resolveTaskAssetInfos(
|
||||
|
||||
@@ -240,7 +240,12 @@ describe('collaboration Operations', () => {
|
||||
message: 'Too dark at the start',
|
||||
second: 2.5,
|
||||
})
|
||||
expect(comment).toEqual({ id: expect.any(String), assetId: file, replyToId: null })
|
||||
expect(comment).toEqual({
|
||||
id: expect.any(String),
|
||||
assetId: file,
|
||||
replyToId: null,
|
||||
isInternal: false,
|
||||
})
|
||||
|
||||
const reply = await runOperation(createCommentOp, as(owner, 'agent', undefined), {
|
||||
assetId: file,
|
||||
@@ -248,9 +253,17 @@ describe('collaboration Operations', () => {
|
||||
replyToId: comment.id,
|
||||
})
|
||||
expect(reply.replyToId).toBe(comment.id)
|
||||
expect(reply.isInternal).toBe(false)
|
||||
|
||||
const internalComment = await runOperation(createCommentOp, as(reviewer), {
|
||||
assetId: file,
|
||||
message: 'Internal budget note',
|
||||
isInternal: true,
|
||||
})
|
||||
expect(internalComment.isInternal).toBe(true)
|
||||
|
||||
const listed = await runOperation(listCommentsOp, as(reviewer), { assetId: file })
|
||||
expect(listed.total).toBe(1)
|
||||
expect(listed.total).toBe(2)
|
||||
expect(listed.data).toEqual([
|
||||
expect.objectContaining({
|
||||
id: comment.id,
|
||||
@@ -258,14 +271,21 @@ describe('collaboration Operations', () => {
|
||||
author: { id: reviewer.id, name: 'Reviewer' },
|
||||
second: 2.5,
|
||||
resolved: false,
|
||||
isInternal: false,
|
||||
replies: [
|
||||
expect.objectContaining({
|
||||
id: reply.id,
|
||||
message: 'Brightened in v2',
|
||||
author: { id: owner.id, name: 'Owner' },
|
||||
isInternal: false,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: internalComment.id,
|
||||
message: 'Internal budget note',
|
||||
isInternal: true,
|
||||
}),
|
||||
])
|
||||
|
||||
await expect(
|
||||
@@ -276,7 +296,7 @@ describe('collaboration Operations', () => {
|
||||
).resolves.toEqual({ commentId: comment.id, resolved: false })
|
||||
|
||||
const created = await auditRows(AuditAction.comment_create)
|
||||
expect(created.map((r) => r.itemId)).toEqual([comment.id, reply.id])
|
||||
expect(created.map((r) => r.itemId)).toEqual([comment.id, reply.id, internalComment.id])
|
||||
expect(created.every((r) => r.teamId === teamId && r.projectId === projectId)).toBe(true)
|
||||
const completed = await auditRows(AuditAction.comment_complete)
|
||||
expect(completed).toHaveLength(2)
|
||||
|
||||
@@ -20,10 +20,16 @@ export const createCommentOp = implementOperation(createComment, {
|
||||
message: input.message,
|
||||
replyToId: input.replyToId,
|
||||
second: input.second,
|
||||
isInternal: input.isInternal,
|
||||
// Mentions in comments written by Shumai's own agent must not start more agent runs.
|
||||
triggerAgents: ctx.via !== 'agent',
|
||||
})
|
||||
return { id: comment.id, assetId: comment.assetId, replyToId: input.replyToId ?? null }
|
||||
return {
|
||||
id: comment.id,
|
||||
assetId: comment.assetId,
|
||||
replyToId: input.replyToId ?? null,
|
||||
isInternal: comment.isInternal,
|
||||
}
|
||||
},
|
||||
audit: (input, output) => [
|
||||
{ action: AuditAction.comment_create, itemId: output.id, contextAssetId: input.assetId },
|
||||
|
||||
@@ -15,6 +15,7 @@ function toCommentFields(comment: CommentInfo) {
|
||||
second: comment.second,
|
||||
hasMarkup: Array.isArray(comment.annotations) && comment.annotations.length > 0,
|
||||
attachmentCount: comment.attachments.length,
|
||||
isInternal: comment.isInternal,
|
||||
createdAt: comment.createdAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const ENV_MAP: Record<string, string> = {
|
||||
openai: 'OPENAI_API_KEY',
|
||||
anthropic: 'ANTHROPIC_API_KEY',
|
||||
'github-copilot': 'COPILOT_GITHUB_TOKEN',
|
||||
'azure-openai-responses': 'AZURE_OPENAI_API_KEY',
|
||||
azure: 'AZURE_OPENAI_API_KEY',
|
||||
deepseek: 'DEEPSEEK_API_KEY',
|
||||
google: 'GEMINI_API_KEY',
|
||||
'google-vertex': 'GOOGLE_CLOUD_API_KEY',
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"anthropic": {
|
||||
"models": {
|
||||
"claude-3-5-sonnet-20241022": {
|
||||
"id": "claude-3-5-sonnet-20241022",
|
||||
"name": "Claude 3.5 Sonnet",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 200000,
|
||||
"output": 8192
|
||||
},
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 15,
|
||||
"cache_read": 0.3,
|
||||
"cache_write": 3.75
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"openai": {
|
||||
"models": {
|
||||
"gpt-4o": {
|
||||
"id": "gpt-4o",
|
||||
"name": "GPT-4o",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 128000,
|
||||
"output": 4096
|
||||
},
|
||||
"cost": {
|
||||
"input": 2.5,
|
||||
"output": 10
|
||||
}
|
||||
},
|
||||
"gpt-4o-extra-new": {
|
||||
"id": "gpt-4o-extra-new",
|
||||
"name": "GPT-4o Extra New",
|
||||
"tool_call": true,
|
||||
"reasoning": false,
|
||||
"limit": {
|
||||
"context": 128000,
|
||||
"output": 4096
|
||||
},
|
||||
"cost": {
|
||||
"input": 2.5,
|
||||
"output": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "meta/llama-3.1-70b-instruct"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "meta-llama/llama-3.1-8b-instruct",
|
||||
"name": "Meta: Llama 3.1 8B Instruct",
|
||||
"context_length": 131072,
|
||||
"pricing": {
|
||||
"prompt": "0.00000005",
|
||||
"completion": "0.00000008"
|
||||
},
|
||||
"top_provider": {
|
||||
"max_completion_tokens": 8192
|
||||
},
|
||||
"supported_parameters": ["tools"]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,42 +0,0 @@
|
||||
import type { ThinkingLevel, ThinkingLevelMap } from '@earendil-works/pi-ai'
|
||||
|
||||
export type ModelsDevReasoningOption =
|
||||
| { type: 'toggle' }
|
||||
| {
|
||||
type: 'effort'
|
||||
values: Array<
|
||||
'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'default' | null
|
||||
>
|
||||
}
|
||||
| { type: 'budget_tokens'; min?: number; max?: number }
|
||||
|
||||
const THINKING_LEVELS: readonly ThinkingLevel[] = [
|
||||
'minimal',
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
'max',
|
||||
]
|
||||
|
||||
/**
|
||||
* Converts models.dev verified effort values into Pi's selectable thinking levels.
|
||||
* Values without a Pi equivalent (`default` and JSON `null`) are intentionally
|
||||
* omitted.
|
||||
*/
|
||||
export function getEffortThinkingLevelMap(
|
||||
options: readonly ModelsDevReasoningOption[],
|
||||
): ThinkingLevelMap | undefined {
|
||||
const effortValues = options.flatMap((option) => (option.type === 'effort' ? option.values : []))
|
||||
if (effortValues.length === 0) return undefined
|
||||
|
||||
const supported = new Set(effortValues)
|
||||
if (!THINKING_LEVELS.some((level) => supported.has(level)) && !supported.has('none'))
|
||||
return undefined
|
||||
|
||||
const map: ThinkingLevelMap = { off: supported.has('none') ? 'none' : null }
|
||||
for (const level of THINKING_LEVELS) {
|
||||
map[level] = supported.has(level) ? level : null
|
||||
}
|
||||
return map
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
import { PI_AI_VERSION } from '@earendil-works/pi-ai'
|
||||
import { getBuiltinModels, getBuiltinProviders } from '@earendil-works/pi-ai/providers/all'
|
||||
import { CompatSchemasByApi } from '@earendil-works/pi-ai/providers/compat-schema'
|
||||
import { ThinkingLevelMapSchema } from '@earendil-works/pi-ai/providers/model-schema'
|
||||
import {
|
||||
providerModelConfigSchema,
|
||||
type ProviderConfigSerializable,
|
||||
type ProviderRefreshUnavailableReason,
|
||||
type RefreshedProviderModel,
|
||||
} from '@shumai/dtos'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
import { ENV_MAP } from './builtin'
|
||||
|
||||
type RefreshConnection =
|
||||
| { unavailableReason: ProviderRefreshUnavailableReason }
|
||||
| { unavailableReason: null; piProviderId: string }
|
||||
|
||||
type CatalogResult =
|
||||
| { status: 'unavailable'; reason: 'catalog_unavailable' }
|
||||
| { status: 'ready'; models: RefreshedProviderModel[] }
|
||||
|
||||
const REFRESH_TIMEOUT_MS = 10_000
|
||||
const builtinConnections = new Map<string, Set<string>>(
|
||||
getBuiltinProviders().map((id) => [
|
||||
id,
|
||||
new Set(getBuiltinModels(id).map(({ api, baseUrl }) => connectionKey(api, baseUrl))),
|
||||
]),
|
||||
)
|
||||
const catalogSchema = z.record(
|
||||
z.string(),
|
||||
z.looseObject({
|
||||
id: z.string().min(1),
|
||||
provider: z.string(),
|
||||
api: z.string(),
|
||||
baseUrl: z.string(),
|
||||
type: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
const compatSchemas = new Map(
|
||||
Object.entries(CompatSchemasByApi).map(([api, schema]) => [api, z.fromJSONSchema(schema)]),
|
||||
)
|
||||
const thinkingLevelMapSchema = z.fromJSONSchema(ThinkingLevelMapSchema)
|
||||
const catalogHeaderNames = new Set([
|
||||
'user-agent',
|
||||
'editor-version',
|
||||
'editor-plugin-version',
|
||||
'copilot-integration-id',
|
||||
'nvcf-poll-seconds',
|
||||
])
|
||||
const catalogHeadersSchema = z.record(
|
||||
z.string().refine((name) => catalogHeaderNames.has(name.toLowerCase())),
|
||||
z.string().regex(/^[\t\x20-\x7E]*$/),
|
||||
)
|
||||
|
||||
function normalizeBaseUrl(baseUrl?: string): string {
|
||||
return baseUrl?.trim().replace(/\/+$/, '') ?? ''
|
||||
}
|
||||
|
||||
function connectionKey(api: string, baseUrl?: string): string {
|
||||
return JSON.stringify([api, normalizeBaseUrl(baseUrl)])
|
||||
}
|
||||
|
||||
function piProviderName(name: string): string {
|
||||
return name === 'azure-openai-responses' ? 'azure' : name
|
||||
}
|
||||
|
||||
export function isProviderConfigured(name: string, config: ProviderConfigSerializable): boolean {
|
||||
const key = config.apiKey?.trim()
|
||||
if (key) {
|
||||
const envValue = process.env[key]
|
||||
if (envValue !== undefined) return Boolean(envValue.trim())
|
||||
// Existing forms accept literal keys and names such as OPENAI_API_KEY in the same field.
|
||||
return !/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(key)
|
||||
}
|
||||
|
||||
const envName = ENV_MAP[piProviderName(name)]
|
||||
if (envName && process.env[envName]?.trim()) return true
|
||||
if (name === 'amazon-bedrock' && config.api === 'bedrock-converse-stream') {
|
||||
return Boolean(
|
||||
process.env.AWS_BEARER_TOKEN_BEDROCK ||
|
||||
process.env.AWS_PROFILE ||
|
||||
(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||
|
||||
process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||
|
||||
process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||
|
||||
process.env.AWS_WEB_IDENTITY_TOKEN_FILE,
|
||||
)
|
||||
}
|
||||
|
||||
const url = URL.parse(config.baseUrl ?? '')
|
||||
return Boolean(
|
||||
url &&
|
||||
config.api === 'openai-completions' &&
|
||||
(config.authHeader === false ||
|
||||
/^(?:localhost|127\.\d+\.\d+\.\d+|\[::1\])$/.test(url.hostname)),
|
||||
)
|
||||
}
|
||||
|
||||
function azureDeploymentIds(): Set<string> {
|
||||
// Pi uses model-id=deployment-name mappings for Azure's deployment-specific API.
|
||||
const entries = process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP?.split(',') ?? []
|
||||
return new Set(
|
||||
entries.flatMap((entry) => {
|
||||
const [modelId, deployment] = entry.split('=', 2).map((value) => value.trim())
|
||||
return modelId && deployment ? [modelId] : []
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
export function getRefreshConnection(
|
||||
name: string,
|
||||
config: ProviderConfigSerializable,
|
||||
): RefreshConnection {
|
||||
const providerId = piProviderName(name)
|
||||
if (providerId === 'azure' && config.api === 'azure-openai-responses') {
|
||||
const endpoint =
|
||||
config.baseUrl || process.env.AZURE_OPENAI_BASE_URL || process.env.AZURE_OPENAI_RESOURCE_NAME
|
||||
return endpoint && azureDeploymentIds().size > 0
|
||||
? { unavailableReason: null, piProviderId: providerId }
|
||||
: { unavailableReason: 'azure_deployment_required' }
|
||||
}
|
||||
if (
|
||||
providerId === 'kimi-coding' &&
|
||||
config.api === 'anthropic-messages' &&
|
||||
normalizeBaseUrl(config.baseUrl) === 'https://api.kimi.com/coding'
|
||||
) {
|
||||
return { unavailableReason: 'legacy_kimi_connection' }
|
||||
}
|
||||
|
||||
const key = connectionKey(config.api, config.baseUrl)
|
||||
const namedConnections = builtinConnections.get(providerId)
|
||||
if (namedConnections?.has(key)) return { unavailableReason: null, piProviderId: providerId }
|
||||
// A renamed provider can still be resolved if its protocol and endpoint identify one catalog.
|
||||
if (!namedConnections && config.baseUrl) {
|
||||
const matches = [...builtinConnections].filter(([, connections]) => connections.has(key))
|
||||
if (matches.length === 1) return { unavailableReason: null, piProviderId: matches[0][0] }
|
||||
}
|
||||
return { unavailableReason: 'unsupported_connection' }
|
||||
}
|
||||
|
||||
export async function discoverProviderModels(
|
||||
piProviderId: string,
|
||||
config: ProviderConfigSerializable,
|
||||
): Promise<CatalogResult> {
|
||||
const url = new URL(`/api/models/providers/${encodeURIComponent(piProviderId)}`, 'https://pi.dev')
|
||||
url.searchParams.set('pi-version', PI_AI_VERSION)
|
||||
let catalog: z.infer<typeof catalogSchema>
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: { Accept: 'application/json' },
|
||||
redirect: 'error',
|
||||
signal: AbortSignal.timeout(REFRESH_TIMEOUT_MS),
|
||||
})
|
||||
if (response.status === 404 || response.status === 501) {
|
||||
return { status: 'unavailable', reason: 'catalog_unavailable' }
|
||||
}
|
||||
if (!response.ok) throw new Error(`Pi catalog returned HTTP ${response.status}`)
|
||||
catalog = catalogSchema.parse(await response.json())
|
||||
} catch (cause) {
|
||||
throw new HTTPException(502, { message: 'Could not refresh provider models', cause })
|
||||
}
|
||||
|
||||
const key = connectionKey(config.api, config.baseUrl)
|
||||
const azureDeployments = piProviderId === 'azure' ? azureDeploymentIds() : undefined
|
||||
const models = Object.entries(catalog).flatMap(([id, model]) => {
|
||||
if (
|
||||
model.id !== id ||
|
||||
model.provider !== piProviderId ||
|
||||
(model.type && model.type !== 'chat')
|
||||
) {
|
||||
return []
|
||||
}
|
||||
const matches = azureDeployments
|
||||
? model.api === config.api && model.baseUrl === '' && azureDeployments.has(id)
|
||||
: connectionKey(model.api, model.baseUrl) === key
|
||||
if (!matches) return []
|
||||
if (
|
||||
model.compat !== undefined &&
|
||||
!compatSchemas.get(model.api)?.safeParse(model.compat).success
|
||||
)
|
||||
return []
|
||||
if (
|
||||
model.thinkingLevelMap !== undefined &&
|
||||
!thinkingLevelMapSchema.safeParse(model.thinkingLevelMap).success
|
||||
)
|
||||
return []
|
||||
if (model.headers !== undefined && !catalogHeadersSchema.safeParse(model.headers).success)
|
||||
return []
|
||||
|
||||
// Keep omitted flags absent so Pi can apply model- and endpoint-specific defaults.
|
||||
const modelConfig = providerModelConfigSchema.safeParse(model)
|
||||
if (!modelConfig.success) return []
|
||||
const name = typeof model.name === 'string' && model.name ? model.name : id
|
||||
return [{ modelId: id, name, config: modelConfig.data }]
|
||||
})
|
||||
return { status: 'ready', models }
|
||||
}
|
||||
@@ -3,46 +3,53 @@ import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { providerService } from './provider'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import * as generateModelsModule from './generator/generate-models'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import { z } from 'zod'
|
||||
import modelsDevFixture from './fixtures/models-dev.json'
|
||||
import openRouterFixture from './fixtures/openrouter.json'
|
||||
import nvidiaFixture from './fixtures/nvidia.json'
|
||||
|
||||
const originalFetch = globalThis.fetch
|
||||
const openaiConfig = {
|
||||
api: 'openai-responses',
|
||||
baseUrl: 'https://api.openai.com/v1',
|
||||
apiKey: 'saved-test-key',
|
||||
} satisfies ProviderConfigSerializable
|
||||
|
||||
function setupCatalogFetchMock() {
|
||||
return vi.spyOn(globalThis, 'fetch').mockImplementation(async (input: RequestInfo | URL) => {
|
||||
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url
|
||||
if (url.includes('models.dev')) {
|
||||
return new Response(JSON.stringify(modelsDevFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
const candidateConfig = {
|
||||
api: openaiConfig.api,
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 256000,
|
||||
maxTokens: 16000,
|
||||
cost: { input: 1, output: 2, cacheRead: 0, cacheWrite: 0 },
|
||||
} satisfies ProviderModel['config']
|
||||
|
||||
function catalogModel(id: string, options?: Record<string, unknown>) {
|
||||
return {
|
||||
...candidateConfig,
|
||||
provider: 'openai',
|
||||
baseUrl: openaiConfig.baseUrl,
|
||||
id,
|
||||
name: id,
|
||||
...options,
|
||||
}
|
||||
}
|
||||
|
||||
function mockCatalog(models: ReturnType<typeof catalogModel>[]) {
|
||||
const requests: Request[] = []
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
|
||||
const request = new Request(input, init)
|
||||
requests.push(request)
|
||||
if (new URL(request.url).origin !== 'https://pi.dev') {
|
||||
throw new Error('Unexpected catalog host')
|
||||
}
|
||||
if (url.includes('openrouter.ai')) {
|
||||
return new Response(JSON.stringify(openRouterFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
if (url.includes('nvidia')) {
|
||||
return new Response(JSON.stringify(nvidiaFixture), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
if (url.includes('ai-gateway')) {
|
||||
return new Response(JSON.stringify({ data: [] }), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
return originalFetch(input)
|
||||
return Response.json(Object.fromEntries(models.map((model) => [model.id, model])))
|
||||
})
|
||||
return requests
|
||||
}
|
||||
|
||||
function readyPreview(result: Awaited<ReturnType<typeof providerService.refreshModels>>) {
|
||||
if (result.status !== 'ready') throw new Error('Expected refreshed models')
|
||||
return result
|
||||
}
|
||||
|
||||
type ProviderModel = z.infer<typeof providerModelSchema>
|
||||
@@ -385,182 +392,270 @@ describe('ProviderService', () => {
|
||||
expect((modelsAfterUpdate[1].config as { api: string }).api).toBe('anthropic-messages')
|
||||
})
|
||||
|
||||
it('should check for updates and correctly segregate new vs existing providers', async () => {
|
||||
const fetchSpy = setupCatalogFetchMock()
|
||||
try {
|
||||
// 1. Check updates with empty team: all discovered providers are new
|
||||
const emptyTeam = await prisma.team.create({
|
||||
data: { name: 'Empty Provider Team' },
|
||||
describe('model refresh', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
it('reports resolved credentials and eligibility separately and preserves legacy Kimi', async () => {
|
||||
vi.stubEnv('CUSTOM_OPENAI_KEY', 'a-resolved-test-key')
|
||||
vi.stubEnv('UNSET_ANTHROPIC_KEY', undefined)
|
||||
const team = await prisma.team.create({ data: { name: 'Providers' } })
|
||||
const configured = await providerService.create(team.id, 'OpenAI production', {
|
||||
...openaiConfig,
|
||||
apiKey: 'CUSTOM_OPENAI_KEY',
|
||||
})
|
||||
const initialCheck = await providerService.checkUpdates(emptyTeam.id)
|
||||
expect(initialCheck.totalNewProviders).toBeGreaterThan(0)
|
||||
expect(initialCheck.totalNewModels).toBeGreaterThan(0)
|
||||
expect(initialCheck.providers.every((p) => p.isNewProvider)).toBe(true)
|
||||
const unconfigured = await providerService.create(team.id, 'anthropic', {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
apiKey: 'UNSET_ANTHROPIC_KEY',
|
||||
})
|
||||
const legacyConfig = {
|
||||
api: 'anthropic-messages',
|
||||
baseUrl: 'https://api.kimi.com/coding',
|
||||
apiKey: 'literal-kimi-key',
|
||||
} satisfies ProviderConfigSerializable
|
||||
const legacy = await providerService.create(team.id, 'kimi-coding', legacyConfig)
|
||||
const local = await providerService.create(team.id, 'Local Ollama', {
|
||||
api: 'openai-completions',
|
||||
baseUrl: 'http://localhost:11434/v1',
|
||||
})
|
||||
vi.stubEnv('AWS_PROFILE', 'test-profile')
|
||||
const bedrock = await providerService.create(team.id, 'amazon-bedrock', {
|
||||
api: 'bedrock-converse-stream',
|
||||
})
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
expect(providers).toHaveLength(5)
|
||||
expect(providers).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: configured.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: null,
|
||||
config: { ...openaiConfig, apiKey: 'CUSTOM_OPENAI_KEY' },
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: unconfigured.id,
|
||||
configured: false,
|
||||
refreshUnavailableReason: null,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: legacy.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: 'legacy_kimi_connection',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: local.id,
|
||||
configured: true,
|
||||
refreshUnavailableReason: 'unsupported_connection',
|
||||
}),
|
||||
expect.objectContaining({ id: bedrock.id, configured: true }),
|
||||
]),
|
||||
)
|
||||
|
||||
// 2. With default team (which has builtin providers initialized)
|
||||
const teamWithBuiltins = await teamService.ensureDefaultTeam()
|
||||
|
||||
// 3. Check updates after init: existing providers should have isNewProvider: false
|
||||
const afterInitCheck = await providerService.checkUpdates(teamWithBuiltins.id)
|
||||
const existing = afterInitCheck.providers.find((p) => !p.isNewProvider)
|
||||
expect(existing).toBeDefined()
|
||||
if (existing) {
|
||||
expect(existing.isNewProvider).toBe(false)
|
||||
const dbModels = await providerService.listModelsByProvider(
|
||||
teamWithBuiltins.id,
|
||||
(await providerService.listByTeam(teamWithBuiltins.id)).find(
|
||||
(p) => p.name === existing.name,
|
||||
)!.id,
|
||||
)
|
||||
const dbModelIds = new Set(dbModels.map((m) => m.modelId))
|
||||
for (const m of existing.models) {
|
||||
expect(dbModelIds.has(m.modelId)).toBe(false)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
fetchSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('should throw an error when upstream catalog fetch fails in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi
|
||||
.spyOn(generateModelsModule, 'generateModels')
|
||||
.mockRejectedValueOnce(new Error('Failed to load models.dev catalog: 502 Bad Gateway'))
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to load models.dev catalog: 502 Bad Gateway',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
|
||||
it('should throw an error when upstream catalog is empty in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi.spyOn(generateModelsModule, 'generateModels').mockResolvedValueOnce({
|
||||
providers: {},
|
||||
groupedProviders: {},
|
||||
sortedProviderIds: [],
|
||||
const requests = mockCatalog([])
|
||||
await expect(providerService.refreshModels(team.id, unconfigured.id)).resolves.toMatchObject({
|
||||
status: 'ready',
|
||||
models: [],
|
||||
})
|
||||
await expect(providerService.refreshModels(team.id, legacy.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'legacy_kimi_connection',
|
||||
})
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/anthropic',
|
||||
])
|
||||
expect(await providerService.getById(legacy.id)).toMatchObject({ config: legacyConfig })
|
||||
})
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to retrieve model catalog from upstream services',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
it('refreshes only the requested provider and filters existing and incompatible models', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
const openai = providers.find(({ name }) => name === 'openai')!
|
||||
const existingModels = await providerService.listModelsByProvider(team.id, openai.id)
|
||||
const requests = mockCatalog([
|
||||
catalogModel(existingModels[0].modelId),
|
||||
catalogModel('new-model', {
|
||||
compat: { supportsStrictMode: true },
|
||||
thinkingLevelMap: { low: 'low' },
|
||||
}),
|
||||
catalogModel('wrong-api', { api: 'openai-completions' }),
|
||||
catalogModel('wrong-url', { baseUrl: 'https://other.example/v1' }),
|
||||
catalogModel('wrong-provider', { provider: 'anthropic' }),
|
||||
catalogModel('not-chat', { type: 'image' }),
|
||||
catalogModel('invalid-compat', { compat: { supportsStrictMode: 'yes' } }),
|
||||
])
|
||||
|
||||
it('should apply sync by adding selected providers and models without modifying existing ones', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
|
||||
// Create an existing provider with 1 model and a custom apiKey
|
||||
const existingProvider = await providerService.create(
|
||||
team.id,
|
||||
'test-existing-provider',
|
||||
{ api: 'openai-responses', apiKey: 'custom-api-key', baseUrl: 'https://example.com' },
|
||||
[
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
const result = await providerService.refreshModels(team.id, openai.id)
|
||||
expect(result).toMatchObject({
|
||||
status: 'ready',
|
||||
models: [
|
||||
{
|
||||
modelId: 'new-model',
|
||||
name: 'new-model',
|
||||
config: {
|
||||
...candidateConfig,
|
||||
compat: { supportsStrictMode: true },
|
||||
thinkingLevelMap: { low: 'low' },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
// Apply sync with 1 new provider and 1 new model on the existing provider
|
||||
const syncResult = await providerService.applySync(team.id, {
|
||||
providers: [
|
||||
{
|
||||
name: 'test-new-synced-provider',
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
apiKey: 'ENV_SYNC_KEY',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
},
|
||||
models: [
|
||||
{
|
||||
modelId: 'new-p-m1',
|
||||
name: 'New Provider Model 1',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'test-existing-provider',
|
||||
isNewProvider: false,
|
||||
config: { api: 'openai-responses', apiKey: 'should-not-override' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'existing-m2',
|
||||
name: 'Newly Added Model 2',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
// Duplicate model that already exists: should be ignored
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1 Overwrite Attempt',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 999999,
|
||||
maxTokens: 999999,
|
||||
cost: { input: 9, output: 9, cacheRead: 9, cacheWrite: 9 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
})
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/openai',
|
||||
])
|
||||
expect(requests[0].headers.has('Authorization')).toBe(false)
|
||||
expect(JSON.stringify(result)).not.toContain(openaiConfig.apiKey)
|
||||
expect(await providerService.listModelsByProvider(team.id, openai.id)).toEqual(existingModels)
|
||||
expect(await providerService.listByTeam(team.id)).toEqual(providers)
|
||||
})
|
||||
|
||||
expect(syncResult.addedProviders).toBe(1)
|
||||
expect(syncResult.addedModels).toBe(2)
|
||||
it('uses the versioned public OpenRouter catalog without sending saved credentials', async () => {
|
||||
const openRouterKey = 'saved-openrouter-test-key'
|
||||
vi.stubEnv('SHUMAI_TEST_OPENROUTER_KEY', openRouterKey)
|
||||
const team = await prisma.team.create({ data: { name: 'OpenRouter' } })
|
||||
const baseUrl = 'https://openrouter.ai/api/v1'
|
||||
const api = 'openai-completions' as const
|
||||
const provider = await providerService.create(team.id, 'openrouter', {
|
||||
api,
|
||||
baseUrl: baseUrl + '/',
|
||||
apiKey: 'SHUMAI_TEST_OPENROUTER_KEY',
|
||||
})
|
||||
const modelId = 'org/new-openrouter-model'
|
||||
const requests: Request[] = []
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
|
||||
const request = new Request(input, init)
|
||||
requests.push(request)
|
||||
return Response.json({
|
||||
[modelId]: { ...catalogModel(modelId, { api, baseUrl }), provider: 'openrouter' },
|
||||
})
|
||||
})
|
||||
|
||||
// Verify existing provider config was NOT modified
|
||||
const reloadedExisting = await providerService.getById(existingProvider.id)
|
||||
expect((reloadedExisting?.config as { apiKey: string }).apiKey).toBe('custom-api-key')
|
||||
const { models } = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
expect(models.map(({ modelId }) => modelId)).toEqual([modelId])
|
||||
expect(requests.map(({ url }) => url)).toEqual([
|
||||
'https://pi.dev/api/models/providers/openrouter?pi-version=1.7.0',
|
||||
])
|
||||
expect(requests[0].headers.has('Authorization')).toBe(false)
|
||||
|
||||
// Verify existing model was NOT modified
|
||||
const existingModels = await providerService.listModelsByProvider(team.id, existingProvider.id)
|
||||
expect(existingModels).toHaveLength(2)
|
||||
const m1 = existingModels.find((m) => m.modelId === 'existing-m1')
|
||||
expect(m1?.name).toBe('Existing Model 1')
|
||||
expect((m1?.config as { contextWindow: number }).contextWindow).toBe(128000)
|
||||
const customProvider = await providerService.update(team.id, provider.id, {
|
||||
...provider.config,
|
||||
baseUrl: 'https://openrouter-proxy.example/api/v1',
|
||||
})
|
||||
await expect(providerService.refreshModels(team.id, customProvider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'unsupported_connection',
|
||||
})
|
||||
expect(requests).toHaveLength(1)
|
||||
})
|
||||
|
||||
// Verify newly added model on existing provider
|
||||
const m2 = existingModels.find((m) => m.modelId === 'existing-m2')
|
||||
expect(m2).toBeDefined()
|
||||
expect(m2?.name).toBe('Newly Added Model 2')
|
||||
it('distinguishes a successful empty preview from an upstream error', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const provider = (await providerService.listByTeam(team.id)).find(
|
||||
({ name }) => name === 'openai',
|
||||
)!
|
||||
mockCatalog([])
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toMatchObject({
|
||||
status: 'ready',
|
||||
models: [],
|
||||
})
|
||||
vi.restoreAllMocks()
|
||||
const fetchMock = vi.spyOn(globalThis, 'fetch')
|
||||
fetchMock.mockResolvedValueOnce(new Response(null, { status: 404 }))
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'catalog_unavailable',
|
||||
})
|
||||
fetchMock.mockResolvedValueOnce(Response.json({ error: 'malformed catalog' }))
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
|
||||
status: 502,
|
||||
})
|
||||
fetchMock.mockRejectedValueOnce(new DOMException('Timed out', 'TimeoutError'))
|
||||
|
||||
// Verify newly added provider
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
const newProvider = providers.find((p) => p.name === 'test-new-synced-provider')
|
||||
expect(newProvider).toBeDefined()
|
||||
expect(newProvider?.isBuiltin).toBe(true)
|
||||
expect((newProvider?.config as { apiKey: string }).apiKey).toBe('ENV_SYNC_KEY')
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
|
||||
status: 502,
|
||||
})
|
||||
})
|
||||
|
||||
const newProviderModels = await providerService.listModelsByProvider(team.id, newProvider!.id)
|
||||
expect(newProviderModels).toHaveLength(1)
|
||||
expect(newProviderModels[0].modelId).toBe('new-p-m1')
|
||||
it('imports only the selected models once and preserves existing models and settings', async () => {
|
||||
vi.stubEnv('OPENAI_API_KEY', openaiConfig.apiKey)
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const provider = (await providerService.listByTeam(team.id)).find(
|
||||
({ name }) => name === 'openai',
|
||||
)!
|
||||
const original = await providerService.getById(provider.id)
|
||||
const existing = await providerService.listModelsByProvider(team.id, provider.id)
|
||||
mockCatalog([catalogModel('new-model'), catalogModel('unselected-model')])
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
|
||||
|
||||
await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({
|
||||
addedModels: 1,
|
||||
})
|
||||
await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({
|
||||
addedModels: 0,
|
||||
})
|
||||
expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([
|
||||
expect.objectContaining({ modelId: 'new-model', config: candidateConfig }),
|
||||
...existing,
|
||||
])
|
||||
expect(await providerService.getById(provider.id)).toEqual(original)
|
||||
})
|
||||
|
||||
it('rejects out-of-team, unknown, and stale selections without adding models', async () => {
|
||||
const team = await prisma.team.create({ data: { name: 'Refresh Team' } })
|
||||
const otherTeam = await prisma.team.create({ data: { name: 'Other Team' } })
|
||||
const provider = await providerService.create(team.id, 'openai', openaiConfig)
|
||||
const requests = mockCatalog([catalogModel('new-model')])
|
||||
await expect(providerService.refreshModels(otherTeam.id, provider.id)).rejects.toMatchObject({
|
||||
status: 404,
|
||||
})
|
||||
expect(requests).toHaveLength(0)
|
||||
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
|
||||
await expect(
|
||||
providerService.importModels(otherTeam.id, provider.id, selection),
|
||||
).rejects.toMatchObject({ status: 404 })
|
||||
await expect(
|
||||
providerService.importModels(team.id, provider.id, {
|
||||
...selection,
|
||||
modelIds: ['new-model', 'unknown'],
|
||||
}),
|
||||
).rejects.toMatchObject({ status: 409 })
|
||||
|
||||
await providerService.update(team.id, provider.id, { ...openaiConfig, apiKey: 'changed-key' })
|
||||
await expect(
|
||||
providerService.importModels(team.id, provider.id, selection),
|
||||
).rejects.toMatchObject({ status: 409 })
|
||||
expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([])
|
||||
})
|
||||
|
||||
it('refreshes legacy Azure connections using only configured deployment mappings', async () => {
|
||||
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', undefined)
|
||||
const team = await prisma.team.create({ data: { name: 'Azure models' } })
|
||||
const provider = await providerService.create(team.id, 'azure-openai-responses', {
|
||||
api: 'azure-openai-responses',
|
||||
baseUrl: 'https://example.openai.azure.com/openai/v1',
|
||||
})
|
||||
const azure = { provider: 'azure', api: 'azure-openai-responses', baseUrl: '' }
|
||||
const requests = mockCatalog([
|
||||
catalogModel('gpt-deployed', azure),
|
||||
catalogModel('gpt-unmapped', azure),
|
||||
])
|
||||
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
|
||||
status: 'unavailable',
|
||||
reason: 'azure_deployment_required',
|
||||
})
|
||||
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', 'gpt-deployed=team-deployment')
|
||||
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
|
||||
expect(preview.models.map(({ modelId }) => modelId)).toEqual(['gpt-deployed'])
|
||||
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
|
||||
'/api/models/providers/azure',
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import {
|
||||
CreateModelRequest,
|
||||
ImportProviderModelsRequest,
|
||||
ProviderConfigSerializable,
|
||||
ProviderModelRefreshResponse,
|
||||
providerModelSchema,
|
||||
SyncApplyRequest,
|
||||
SyncApplyResponse,
|
||||
SyncCheckResponse,
|
||||
SyncModelItem,
|
||||
SyncProviderItem,
|
||||
UpdateModelRequest,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
ENV_MAP,
|
||||
getBuiltinProvidersMap,
|
||||
PRIORITY_PROVIDERS,
|
||||
} from '@shumai/core/src/provider/builtin'
|
||||
import { generateModels } from '@shumai/core/src/provider/generator/generate-models'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
import { z } from 'zod'
|
||||
import { discoverProviderModels, getRefreshConnection, isProviderConfigured } from './model-refresh'
|
||||
|
||||
type ProviderModel = z.infer<typeof providerModelSchema>
|
||||
|
||||
@@ -70,11 +64,23 @@ export class ProviderService {
|
||||
orderBy: { id: 'desc' },
|
||||
})
|
||||
|
||||
return providers.map((p) => ({
|
||||
...p,
|
||||
modelsCount: p._count.models,
|
||||
_count: undefined,
|
||||
}))
|
||||
return providers.map(
|
||||
({ _count, id, teamId, name, config, isBuiltin, createdAt, updatedAt }) => {
|
||||
const connection = getRefreshConnection(name, config)
|
||||
return {
|
||||
id,
|
||||
teamId,
|
||||
name,
|
||||
config,
|
||||
isBuiltin,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
modelsCount: _count.models,
|
||||
configured: isProviderConfigured(name, config),
|
||||
refreshUnavailableReason: connection.unavailableReason,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
async getById(id: string) {
|
||||
@@ -124,6 +130,11 @@ export class ProviderService {
|
||||
name?: string,
|
||||
) {
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
const provider = await tx.provider.update({
|
||||
where: { id, teamId },
|
||||
data: { config, ...(name ? { name } : {}) },
|
||||
})
|
||||
|
||||
if (models !== undefined) {
|
||||
const existingModels = await tx.model.findMany({
|
||||
where: { providerId: id },
|
||||
@@ -189,15 +200,7 @@ export class ProviderService {
|
||||
}
|
||||
}
|
||||
|
||||
// Update provider config and optional name
|
||||
return tx.provider.update({
|
||||
where: { id, teamId },
|
||||
data: {
|
||||
config,
|
||||
...(name ? { name } : {}),
|
||||
},
|
||||
include: { models: true },
|
||||
})
|
||||
return { ...provider, models: await tx.model.findMany({ where: { providerId: id } }) }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -305,179 +308,66 @@ export class ProviderService {
|
||||
})
|
||||
}
|
||||
|
||||
async checkUpdates(teamId: string): Promise<SyncCheckResponse> {
|
||||
const catalog = await generateModels({ strict: true, timeoutMs: 30000 })
|
||||
|
||||
if (!catalog || catalog.sortedProviderIds.length === 0) {
|
||||
throw new Error('Failed to retrieve model catalog from upstream services')
|
||||
}
|
||||
|
||||
const existingProviders = await this.prismaClient.provider.findMany({
|
||||
where: { teamId },
|
||||
include: { models: true },
|
||||
async refreshModels(teamId: string, providerId: string): Promise<ProviderModelRefreshResponse> {
|
||||
const provider = await this.prismaClient.provider.findUnique({
|
||||
where: { id: providerId, teamId },
|
||||
include: { models: { select: { modelId: true } } },
|
||||
})
|
||||
if (!provider) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
|
||||
const existingProviderMap = new Map<string, (typeof existingProviders)[number]>()
|
||||
for (const p of existingProviders) {
|
||||
existingProviderMap.set(p.name, p)
|
||||
const connection = getRefreshConnection(provider.name, provider.config)
|
||||
if (connection.unavailableReason) {
|
||||
return { status: 'unavailable', reason: connection.unavailableReason }
|
||||
}
|
||||
|
||||
const items: SyncProviderItem[] = []
|
||||
let totalNewProviders = 0
|
||||
let totalNewModels = 0
|
||||
|
||||
for (const providerId of catalog.sortedProviderIds) {
|
||||
const modelsMap = catalog.providers[providerId]
|
||||
if (!modelsMap) continue
|
||||
const modelList = Object.values(modelsMap)
|
||||
if (modelList.length === 0) continue
|
||||
|
||||
const existingProvider = existingProviderMap.get(providerId)
|
||||
|
||||
if (!existingProvider) {
|
||||
const firstModel = modelList[0]
|
||||
const newModels: SyncModelItem[] = modelList.map((m) => ({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: firstModel.api as ProviderConfigSerializable['api'],
|
||||
baseUrl: firstModel.baseUrl,
|
||||
apiKey: ENV_MAP[providerId] || '',
|
||||
},
|
||||
models: newModels,
|
||||
})
|
||||
|
||||
totalNewProviders++
|
||||
totalNewModels += newModels.length
|
||||
} else {
|
||||
const existingModelIds = new Set(existingProvider.models.map((m) => m.modelId))
|
||||
const newModels: SyncModelItem[] = []
|
||||
|
||||
for (const m of modelList) {
|
||||
if (!existingModelIds.has(m.id)) {
|
||||
newModels.push({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (newModels.length > 0) {
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: false,
|
||||
config: existingProvider.config as ProviderConfigSerializable,
|
||||
models: newModels,
|
||||
})
|
||||
totalNewModels += newModels.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
items.sort((a, b) => {
|
||||
const indexA = PRIORITY_PROVIDERS.indexOf(a.name)
|
||||
const indexB = PRIORITY_PROVIDERS.indexOf(b.name)
|
||||
if (indexA !== -1 && indexB !== -1) return indexA - indexB
|
||||
if (indexA !== -1) return -1
|
||||
if (indexB !== -1) return 1
|
||||
return a.name.localeCompare(b.name)
|
||||
})
|
||||
|
||||
const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
|
||||
if (catalog.status === 'unavailable') return catalog
|
||||
const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
|
||||
return {
|
||||
providers: items,
|
||||
totalNewProviders,
|
||||
totalNewModels,
|
||||
status: 'ready',
|
||||
providerUpdatedAt: provider.updatedAt.toISOString(),
|
||||
models: catalog.models.filter(({ modelId }) => !existingIds.has(modelId)),
|
||||
}
|
||||
}
|
||||
|
||||
async applySync(teamId: string, payload: SyncApplyRequest): Promise<SyncApplyResponse> {
|
||||
let addedProviders = 0
|
||||
let addedModels = 0
|
||||
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
for (const providerItem of payload.providers) {
|
||||
let providerId: string
|
||||
|
||||
if (providerItem.isNewProvider) {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) {
|
||||
const created = await tx.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: providerItem.name,
|
||||
isBuiltin: true,
|
||||
config: providerItem.config,
|
||||
},
|
||||
})
|
||||
providerId = created.id
|
||||
addedProviders++
|
||||
} else {
|
||||
providerId = existing.id
|
||||
}
|
||||
} else {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) continue
|
||||
providerId = existing.id
|
||||
}
|
||||
|
||||
for (const modelItem of providerItem.models) {
|
||||
const existingModel = await tx.model.findFirst({
|
||||
where: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
},
|
||||
})
|
||||
if (!existingModel) {
|
||||
await tx.model.create({
|
||||
data: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
name: modelItem.name || modelItem.modelId,
|
||||
config: modelItem.config,
|
||||
},
|
||||
})
|
||||
addedModels++
|
||||
}
|
||||
}
|
||||
}
|
||||
async importModels(
|
||||
teamId: string,
|
||||
providerId: string,
|
||||
{ modelIds, providerUpdatedAt }: ImportProviderModelsRequest,
|
||||
) {
|
||||
const provider = await this.prismaClient.provider.findUnique({
|
||||
where: { id: providerId, teamId },
|
||||
include: { models: { where: { modelId: { in: modelIds } }, select: { modelId: true } } },
|
||||
})
|
||||
if (!provider) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
const staleSelection = () =>
|
||||
new HTTPException(409, { message: 'Refresh the model list before importing' })
|
||||
if (provider.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
|
||||
const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
|
||||
const newIds = new Set(modelIds.filter((modelId) => !existingIds.has(modelId)))
|
||||
if (newIds.size === 0) return { addedModels: 0 }
|
||||
|
||||
return { addedProviders, addedModels }
|
||||
const connection = getRefreshConnection(provider.name, provider.config)
|
||||
if (connection.unavailableReason) throw staleSelection()
|
||||
const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
|
||||
if (catalog.status === 'unavailable') throw staleSelection()
|
||||
const models = catalog.models.filter(({ modelId }) => newIds.has(modelId))
|
||||
if (models.length !== newIds.size) throw staleSelection()
|
||||
|
||||
return this.prismaClient.$transaction(async (tx) => {
|
||||
// The network request finishes before we lock the connection for the insert.
|
||||
const [locked] = await tx.$queryRaw<{ updatedAt: Date }[]>`
|
||||
SELECT updated_at AS "updatedAt" FROM providers
|
||||
WHERE id = ${providerId} AND team_id = ${teamId} FOR NO KEY UPDATE
|
||||
`
|
||||
if (!locked) throw new HTTPException(404, { message: 'Provider not found' })
|
||||
if (locked.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
|
||||
|
||||
const { count } = await tx.model.createMany({
|
||||
data: models.map(({ modelId, name, config }) => ({ providerId, modelId, name, config })),
|
||||
skipDuplicates: true,
|
||||
})
|
||||
return { addedModels: count }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -752,6 +752,18 @@ describe('S3Service implementations', () => {
|
||||
expect(size).toBe(11)
|
||||
})
|
||||
|
||||
it('rejects keys with parent directory segments', async () => {
|
||||
await localS3.putObject('test-bucket', 'files/a/master.mov', 'original', 8)
|
||||
|
||||
await expect(
|
||||
localS3.putObject('test-bucket', 'attachments/x/../../files/a/master.mov', 'evil', 4),
|
||||
).rejects.toThrow(/path traversal/)
|
||||
await expect(
|
||||
localS3.getObjectSize('test-bucket', 'attachments/x/..\\..\\files/a/master.mov'),
|
||||
).rejects.toThrow(/path traversal/)
|
||||
expect(await localS3.getObjectSize('test-bucket', 'files/a/master.mov')).toBe(8)
|
||||
})
|
||||
|
||||
it('removes empty embedding chunk directories after deleting the last chunk', async () => {
|
||||
const key = 'files/asset-1/tmp-embedding-chunks/chunk.mp4'
|
||||
await localS3.putObject('test-bucket', key, 'chunk', 5)
|
||||
|
||||
@@ -850,6 +850,11 @@ export class LocalStorageService implements S3Service {
|
||||
}
|
||||
|
||||
private getFilePath(bucket: string, key: string): string {
|
||||
// Object keys are flat names: a `..` segment must not be resolved into another
|
||||
// object's path (S3 keeps it literally).
|
||||
if (key.split(/[\\/]/).includes('..') || bucket.split(/[\\/]/).includes('..')) {
|
||||
throw new Error(`Invalid path: potential path traversal detected`)
|
||||
}
|
||||
const filePath = path.join(this.basePath, bucket, key)
|
||||
if (!filePath.startsWith(this.basePath)) {
|
||||
throw new Error(`Invalid path: potential path traversal detected`)
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { shareActivityService } from './share-activity'
|
||||
import { shareService } from './share'
|
||||
|
||||
describe('Share activity', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
let shareId: string
|
||||
let projectId: string
|
||||
let assetId: string
|
||||
let userId: string
|
||||
|
||||
beforeEach(async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Reviewer',
|
||||
email: 'reviewer@example.com',
|
||||
image: 'https://example.com/avatar',
|
||||
},
|
||||
})
|
||||
const team = await prisma.team.create({ data: { name: 'Team' } })
|
||||
const project = await prisma.project.create({ data: { name: 'Project', teamId: team.id } })
|
||||
const asset = await prisma.asset.create({
|
||||
data: { name: 'Review Cut', projectId: project.id, type: 'file', status: 'processed' },
|
||||
})
|
||||
const share = await shareService.createShareLink(project.id, { name: 'Review' }, user.id)
|
||||
shareId = share.id
|
||||
projectId = project.id
|
||||
assetId = asset.id
|
||||
userId = user.id
|
||||
})
|
||||
|
||||
it('sets the last view and counts every visit, including a duplicate deep-link visit', async () => {
|
||||
expect(await shareService.getShareLink(shareId)).toMatchObject({ views: 0, lastViewedAt: null })
|
||||
await shareActivityService.recordView(shareId, { assetId, isShareEntry: true })
|
||||
const first = await prisma.shareLink.findUniqueOrThrow({ where: { id: shareId } })
|
||||
expect(first).toMatchObject({ views: 1, lastViewedAt: expect.any(Date) })
|
||||
|
||||
const prior = new Date('2020-01-01T00:00:00Z')
|
||||
await prisma.shareLink.update({ where: { id: shareId }, data: { lastViewedAt: prior } })
|
||||
await shareActivityService.recordView(shareId, { assetId, isShareEntry: true })
|
||||
|
||||
const share = await prisma.shareLink.findUniqueOrThrow({ where: { id: shareId } })
|
||||
expect(share.views).toBe(2)
|
||||
expect(share.lastViewedAt!.getTime()).toBeGreaterThan(prior.getTime())
|
||||
expect(await prisma.shareActivity.findMany({ where: { shareLinkId: shareId } })).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ kind: 'share_viewed', userId: null, assetId: null }),
|
||||
expect.objectContaining({ kind: 'asset_viewed', userId: null, assetId }),
|
||||
]),
|
||||
)
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: shareId } })).toBe(2)
|
||||
})
|
||||
|
||||
it('uses a rolling window from the last recorded event and permits a match after 30 minutes', async () => {
|
||||
const event = { kind: 'asset_downloaded', userId, assetId } as const
|
||||
const record = await prisma.shareActivity.create({
|
||||
data: {
|
||||
...event,
|
||||
shareLinkId: shareId,
|
||||
createdAt: new Date(Date.now() - 29 * 60_000),
|
||||
},
|
||||
})
|
||||
await shareActivityService.recordEvent(shareId, event)
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: shareId } })).toBe(1)
|
||||
expect(await prisma.shareActivity.findUnique({ where: { id: record.id } })).toEqual(record)
|
||||
|
||||
await prisma.shareActivity.update({
|
||||
where: { id: record.id },
|
||||
data: { createdAt: new Date(Date.now() - 30 * 60_000) },
|
||||
})
|
||||
await shareActivityService.recordEvent(shareId, event)
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: shareId } })).toBe(2)
|
||||
})
|
||||
|
||||
it('scopes the deduplication identity to the share, event kind, user and asset', async () => {
|
||||
const otherShare = await shareService.createShareLink(projectId, { name: 'Other' })
|
||||
const otherAsset = await prisma.asset.create({
|
||||
data: { name: 'Other Cut', projectId, type: 'file', status: 'processed' },
|
||||
})
|
||||
await shareActivityService.recordView(shareId, { assetId })
|
||||
await shareActivityService.recordView(shareId, { assetId, userId })
|
||||
await shareActivityService.recordView(shareId, { assetId: otherAsset.id, userId })
|
||||
await shareActivityService.recordView(otherShare.id, { assetId, userId })
|
||||
await shareActivityService.recordEvent(shareId, { kind: 'asset_downloaded', assetId, userId })
|
||||
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: shareId } })).toBe(4)
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: otherShare.id } })).toBe(1)
|
||||
expect(await shareService.getShareLink(shareId)).toMatchObject({ views: 3 })
|
||||
})
|
||||
|
||||
it('records a share comment in its transaction while preserving every comment', async () => {
|
||||
const comment = { assetId, userId, message: 'Looks good', attachmentIds: [] }
|
||||
await assetService.createComment(comment, { shareLinkId: shareId })
|
||||
await assetService.createComment({ ...comment, message: 'Ready' }, { shareLinkId: shareId })
|
||||
await assetService.createComment({ ...comment, message: 'Workspace comment' })
|
||||
expect(await prisma.assetComment.count({ where: { assetId } })).toBe(3)
|
||||
const events = await prisma.shareActivity.findMany({ where: { shareLinkId: shareId } })
|
||||
expect(events).toMatchObject([{ kind: 'comment_created', assetId, userId }])
|
||||
|
||||
await expect(assetService.createComment(comment, { shareLinkId: 'missing' })).rejects.toThrow(
|
||||
'Share link not found',
|
||||
)
|
||||
expect(await prisma.assetComment.count({ where: { assetId } })).toBe(3)
|
||||
})
|
||||
|
||||
it('paginates the feed and resolves current names and missing assets', async () => {
|
||||
await shareActivityService.recordView(shareId, { assetId, userId, isShareEntry: true })
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { name: 'Renamed Cut' } })
|
||||
const first = await shareActivityService.list(shareId, { first: 1 })
|
||||
expect(first.pageInfo).toMatchObject({ total: 2, cursor: expect.any(String) })
|
||||
const second = await shareActivityService.list(shareId, {
|
||||
first: 1,
|
||||
after: first.pageInfo.cursor,
|
||||
})
|
||||
expect(first.data).toHaveLength(1)
|
||||
expect(second.data).toHaveLength(1)
|
||||
expect(first.data[0].id > second.data[0].id).toBe(true)
|
||||
expect([...first.data, ...second.data]).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
kind: 'asset_viewed',
|
||||
user: { name: 'Reviewer', image: 'https://example.com/avatar' },
|
||||
asset: { id: assetId, name: 'Renamed Cut' },
|
||||
}),
|
||||
expect.objectContaining({ kind: 'share_viewed', asset: null }),
|
||||
]),
|
||||
)
|
||||
|
||||
await prisma.asset.update({ where: { id: assetId }, data: { isDeleted: true } })
|
||||
const getAssetEvent = async () =>
|
||||
(await shareActivityService.list(shareId, {})).data.find(
|
||||
(event) => event.kind === 'asset_viewed',
|
||||
)
|
||||
expect((await getAssetEvent())?.asset).toEqual({ id: assetId, name: null })
|
||||
await prisma.asset.delete({ where: { id: assetId } })
|
||||
expect((await getAssetEvent())?.asset).toEqual({ id: assetId, name: null })
|
||||
await shareService.deleteShareLink(shareId)
|
||||
expect(await prisma.shareActivity.count({ where: { shareLinkId: shareId } })).toBe(0)
|
||||
})
|
||||
|
||||
it('checks that a share root is accessible before accepting a root view', async () => {
|
||||
const share = await shareService.getShareLink(shareId)
|
||||
await expect(shareService.verifyPublicAccess(shareId, undefined)).resolves.toMatchObject({
|
||||
id: shareId,
|
||||
})
|
||||
await prisma.asset.update({
|
||||
where: { id: share.rootFolderId },
|
||||
data: { isDeleted: true },
|
||||
})
|
||||
await expect(shareService.verifyPublicAccess(shareId, undefined)).rejects.toThrow(
|
||||
'Asset is not shared',
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,129 @@
|
||||
import { prisma, type Prisma } from '@shumai/db'
|
||||
import type { ShareActivityInfo, ShareActivityKind } from '@shumai/dtos'
|
||||
import { paginateQuery, type PaginationParams } from '@shumai/core/src/pagination'
|
||||
import { getAvatarUrl } from '@shumai/core/src/user/avatar'
|
||||
import { ShareLinkNotFoundError } from './errors'
|
||||
|
||||
const deduplicationWindowMs = 30 * 60 * 1000
|
||||
|
||||
type Activity = {
|
||||
kind: ShareActivityKind
|
||||
userId?: string
|
||||
assetId?: string
|
||||
}
|
||||
|
||||
class ShareActivityService {
|
||||
async recordView(
|
||||
shareLinkId: string,
|
||||
view: { userId?: string; assetId?: string; isShareEntry?: boolean },
|
||||
): Promise<void> {
|
||||
const events: Activity[] = []
|
||||
if (!view.assetId || view.isShareEntry) {
|
||||
events.push({ kind: 'share_viewed', userId: view.userId })
|
||||
}
|
||||
if (view.assetId) {
|
||||
events.push({ kind: 'asset_viewed', userId: view.userId, assetId: view.assetId })
|
||||
}
|
||||
|
||||
await prisma.$transaction(async (tx) => {
|
||||
const now = await this.lockShare(tx, shareLinkId)
|
||||
// A visit updates the counters independently of whether its events are duplicates.
|
||||
await tx.$executeRaw`
|
||||
UPDATE share_links
|
||||
SET views = views + 1,
|
||||
last_viewed_at = GREATEST(last_viewed_at, ${now.toISOString()}::timestamptz AT TIME ZONE 'UTC')
|
||||
WHERE id = ${shareLinkId}
|
||||
`
|
||||
for (const event of events) {
|
||||
await this.insertIfNew(tx, shareLinkId, event, now)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async recordEvent(
|
||||
shareLinkId: string,
|
||||
event: Activity,
|
||||
tx?: Prisma.TransactionClient,
|
||||
): Promise<void> {
|
||||
if (!tx) {
|
||||
await prisma.$transaction((client) => this.recordEvent(shareLinkId, event, client))
|
||||
return
|
||||
}
|
||||
|
||||
const now = await this.lockShare(tx, shareLinkId)
|
||||
await this.insertIfNew(tx, shareLinkId, event, now)
|
||||
}
|
||||
|
||||
async list(shareLinkId: string, params: PaginationParams) {
|
||||
const where = { shareLinkId }
|
||||
const page = await paginateQuery(
|
||||
(skip, take) => prisma.shareActivity.findMany({ where, orderBy: { id: 'desc' }, skip, take }),
|
||||
() => prisma.shareActivity.count({ where }),
|
||||
params,
|
||||
)
|
||||
const userIds = page.data.flatMap(({ userId }) => (userId ? [userId] : []))
|
||||
const assetIds = page.data.flatMap(({ assetId }) => (assetId ? [assetId] : []))
|
||||
const [users, assets] = await Promise.all([
|
||||
prisma.user.findMany({
|
||||
where: { id: { in: userIds } },
|
||||
select: { id: true, name: true, image: true },
|
||||
}),
|
||||
prisma.asset.findMany({
|
||||
where: { id: { in: assetIds }, isDeleted: false },
|
||||
select: { id: true, name: true },
|
||||
}),
|
||||
])
|
||||
const usersById = new Map(
|
||||
await Promise.all(
|
||||
users.map(
|
||||
async ({ id, name, image }) => [id, { name, image: await getAvatarUrl(image) }] as const,
|
||||
),
|
||||
),
|
||||
)
|
||||
const namesById = new Map(assets.map(({ id, name }) => [id, name]))
|
||||
const data: ShareActivityInfo[] = page.data.map((event) => ({
|
||||
id: event.id,
|
||||
kind: event.kind,
|
||||
createdAt: event.createdAt.toISOString(),
|
||||
user: event.userId ? (usersById.get(event.userId) ?? null) : null,
|
||||
asset: event.assetId
|
||||
? { id: event.assetId, name: namesById.get(event.assetId) ?? null }
|
||||
: null,
|
||||
}))
|
||||
return { data, pageInfo: page.pageInfo }
|
||||
}
|
||||
|
||||
private async lockShare(tx: Prisma.TransactionClient, shareLinkId: string) {
|
||||
const rows = await tx.$queryRaw<{ id: string }[]>`
|
||||
SELECT id FROM share_links WHERE id = ${shareLinkId} FOR UPDATE
|
||||
`
|
||||
if (rows.length === 0) throw new ShareLinkNotFoundError('Share link not found')
|
||||
// Read time after acquiring the lock so a queued request uses its actual write time.
|
||||
const [clock] = await tx.$queryRaw<{ now: Date }[]>`SELECT clock_timestamp() AS now`
|
||||
return clock.now
|
||||
}
|
||||
|
||||
private async insertIfNew(
|
||||
tx: Prisma.TransactionClient,
|
||||
shareLinkId: string,
|
||||
event: Activity,
|
||||
now: Date,
|
||||
) {
|
||||
const identity = {
|
||||
shareLinkId,
|
||||
kind: event.kind,
|
||||
userId: event.userId ?? null,
|
||||
assetId: event.assetId ?? null,
|
||||
}
|
||||
const recent = await tx.shareActivity.findFirst({
|
||||
where: {
|
||||
...identity,
|
||||
createdAt: { gt: new Date(now.getTime() - deduplicationWindowMs) },
|
||||
},
|
||||
select: { id: true },
|
||||
})
|
||||
if (!recent) await tx.shareActivity.create({ data: { ...identity, createdAt: now } })
|
||||
}
|
||||
}
|
||||
|
||||
export const shareActivityService = new ShareActivityService()
|
||||
@@ -6,6 +6,12 @@ import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { AssetType } from '@shumai/db'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { timingSafeEqual } from 'node:crypto'
|
||||
|
||||
vi.mock('node:crypto', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('node:crypto')>()
|
||||
return { ...actual, timingSafeEqual: vi.fn(actual.timingSafeEqual) }
|
||||
})
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
@@ -167,6 +173,69 @@ describe('ShareService', () => {
|
||||
).rejects.toThrow('expired')
|
||||
})
|
||||
|
||||
it('includes the saved password in share link settings', async () => {
|
||||
const created = await shareService.createShareLink(projectId, {
|
||||
name: 'Protected Share',
|
||||
password: 'secret-password',
|
||||
})
|
||||
expect(created.hasPassword).toBe(true)
|
||||
expect(created.password).toBe('secret-password')
|
||||
|
||||
const fetched = await shareService.getShareLink(created.id)
|
||||
expect(fetched.hasPassword).toBe(true)
|
||||
expect(fetched.password).toBe('secret-password')
|
||||
|
||||
const updated = await shareService.updateShareLink(created.id, { password: 'other' })
|
||||
expect(updated.hasPassword).toBe(true)
|
||||
expect(updated.password).toBe('other')
|
||||
|
||||
const list = await shareService.listProjectShareLinks({ projectId })
|
||||
expect(list.data).toContainEqual(expect.objectContaining({ id: created.id, password: 'other' }))
|
||||
|
||||
const cleared = await shareService.updateShareLink(created.id, { password: null })
|
||||
expect(cleared.hasPassword).toBe(false)
|
||||
expect(cleared.password).toBeNull()
|
||||
})
|
||||
|
||||
it('rejects missing or different-length share passwords', async () => {
|
||||
const shareLink = await shareService.createShareLink(projectId, {
|
||||
name: 'Protected Share',
|
||||
password: 'secret-password',
|
||||
})
|
||||
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(shareLink.id, shareLink.rootFolderId),
|
||||
).rejects.toThrow('Invalid password')
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(shareLink.id, shareLink.rootFolderId, ''),
|
||||
).rejects.toThrow('Invalid password')
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(shareLink.id, shareLink.rootFolderId, 'secret'),
|
||||
).rejects.toThrow('Invalid password')
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(
|
||||
shareLink.id,
|
||||
shareLink.rootFolderId,
|
||||
'secret-password-and-more',
|
||||
),
|
||||
).rejects.toThrow('Invalid password')
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(shareLink.id, shareLink.rootFolderId, 'secret-password'),
|
||||
).resolves.toBeDefined()
|
||||
})
|
||||
|
||||
it('compares share passwords in constant time', async () => {
|
||||
const shareLink = await shareService.createShareLink(projectId, {
|
||||
name: 'Protected Share',
|
||||
password: 'secret-password',
|
||||
})
|
||||
|
||||
await expect(
|
||||
shareService.verifyPublicAccess(shareLink.id, shareLink.rootFolderId, 'wrong'),
|
||||
).rejects.toThrow('Invalid password')
|
||||
expect(timingSafeEqual).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('traces deep ancestors for public access', async () => {
|
||||
const shareLink = await shareService.createShareLink(projectId, {
|
||||
name: 'Deep Share',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createHash, timingSafeEqual } from 'node:crypto'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { AssetType, Prisma } from '@shumai/db'
|
||||
import {
|
||||
@@ -18,6 +19,17 @@ import {
|
||||
ShareLinkPasswordInvalidError,
|
||||
} from './errors'
|
||||
|
||||
/**
|
||||
* Compares a provided share password with the stored one in constant time.
|
||||
* Both values are hashed first so the comparison does not depend on their lengths.
|
||||
*/
|
||||
function sharePasswordMatches(stored: string, provided: string | undefined): boolean {
|
||||
if (provided === undefined) return false
|
||||
const a = createHash('sha256').update(stored).digest()
|
||||
const b = createHash('sha256').update(provided).digest()
|
||||
return timingSafeEqual(a, b)
|
||||
}
|
||||
|
||||
export class ShareService {
|
||||
async createShareLink(
|
||||
projectId: string,
|
||||
@@ -250,7 +262,7 @@ export class ShareService {
|
||||
|
||||
async verifyPublicAccess(
|
||||
shareLinkId: string,
|
||||
assetId: string,
|
||||
assetId: string | undefined,
|
||||
providedPassword?: string,
|
||||
): Promise<Prisma.ShareLinkGetPayload<true>> {
|
||||
const shareLink = await prisma.shareLink.findUnique({
|
||||
@@ -269,15 +281,17 @@ export class ShareService {
|
||||
throw new ShareLinkExpiredError('Share link has expired')
|
||||
}
|
||||
|
||||
if (shareLink.password && shareLink.password !== providedPassword) {
|
||||
if (shareLink.password && !sharePasswordMatches(shareLink.password, providedPassword)) {
|
||||
throw new ShareLinkPasswordInvalidError('Invalid password for share link')
|
||||
}
|
||||
|
||||
const targetId = assetId ?? shareLink.rootFolderId
|
||||
|
||||
const rows = await prisma.$queryRaw<{ id: string }[]>`
|
||||
WITH RECURSIVE
|
||||
-- Trace ancestors in the real asset tree
|
||||
real_ancestors AS (
|
||||
SELECT id, parent_id, type::text, target_id FROM assets WHERE id = ${assetId} AND is_deleted = false
|
||||
SELECT id, parent_id, type::text, target_id FROM assets WHERE id = ${targetId} AND is_deleted = false
|
||||
UNION ALL
|
||||
SELECT a.id, a.parent_id, a.type::text, a.target_id FROM assets a
|
||||
INNER JOIN real_ancestors ra ON ra.parent_id = a.id
|
||||
@@ -339,6 +353,8 @@ export class ShareService {
|
||||
rootFolderId: l.rootFolderId,
|
||||
projectId: l.projectId,
|
||||
isExpired,
|
||||
views: l.views,
|
||||
lastViewedAt: l.lastViewedAt?.toISOString() ?? null,
|
||||
watermarkConfigId: l.watermarkConfigId,
|
||||
watermarkStatus: l.watermarkStatus || 'disabled',
|
||||
watermarkConfig: watermarkConfig
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/db",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ShareActivityKind" AS ENUM ('share_viewed', 'asset_viewed', 'asset_downloaded', 'comment_created');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "share_links" ADD COLUMN "last_viewed_at" TIMESTAMP(3),
|
||||
ADD COLUMN "views" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "share_activities" (
|
||||
"id" TEXT NOT NULL,
|
||||
"share_link_id" TEXT NOT NULL,
|
||||
"kind" "ShareActivityKind" NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"asset_id" TEXT,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "share_activities_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "share_activities_dedup_idx" ON "share_activities"("share_link_id", "kind", "user_id", "asset_id", "created_at" DESC);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "share_activities_share_link_id_id_idx" ON "share_activities"("share_link_id", "id" DESC);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "share_activities" ADD CONSTRAINT "share_activities_share_link_id_fkey" FOREIGN KEY ("share_link_id") REFERENCES "share_links"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "asset_comments" ADD COLUMN "is_internal" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -479,6 +479,8 @@ model ShareLink {
|
||||
viewMode String? @map("view_mode")
|
||||
/// [ShareLinkFieldVisibility]
|
||||
fieldVisibility Json? @map("field_visibility")
|
||||
views Int @default(0)
|
||||
lastViewedAt DateTime? @map("last_viewed_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -495,9 +497,33 @@ model ShareLink {
|
||||
watermarkStatus WatermarkStatus @default(disabled) @map("watermark_status")
|
||||
watermarkConfig WatermarkConfig? @relation(fields: [watermarkConfigId], references: [id], onDelete: SetNull)
|
||||
|
||||
activities ShareActivity[]
|
||||
|
||||
@@map("share_links")
|
||||
}
|
||||
|
||||
enum ShareActivityKind {
|
||||
share_viewed
|
||||
asset_viewed
|
||||
asset_downloaded
|
||||
comment_created
|
||||
}
|
||||
|
||||
model ShareActivity {
|
||||
id String @id @default(ulid())
|
||||
shareLinkId String @map("share_link_id")
|
||||
shareLink ShareLink @relation(fields: [shareLinkId], references: [id], onDelete: Cascade)
|
||||
kind ShareActivityKind
|
||||
// Historical references retained when the user or asset is deleted.
|
||||
userId String? @map("user_id")
|
||||
assetId String? @map("asset_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([shareLinkId, kind, userId, assetId, createdAt(sort: Desc)], map: "share_activities_dedup_idx")
|
||||
@@index([shareLinkId, id(sort: Desc)])
|
||||
@@map("share_activities")
|
||||
}
|
||||
|
||||
model WatermarkConfig {
|
||||
id String @id @default(ulid())
|
||||
/// [WatermarkConfigSpec]
|
||||
@@ -683,6 +709,7 @@ model AssetComment {
|
||||
creator User? @relation("UserToAssetComment", fields: [creatorId], references: [id])
|
||||
|
||||
isCompleted Boolean @default(false) @map("is_completed")
|
||||
isInternal Boolean @default(false) @map("is_internal")
|
||||
completionLastChangedById String? @map("completion_last_changed_by_id")
|
||||
completionLastChangedBy User? @relation("UserToAssetCommentCompletionChanged", fields: [completionLastChangedById], references: [id])
|
||||
|
||||
|
||||
+5
@@ -77,6 +77,11 @@ export type ProjectMember = Prisma.ProjectMemberModel
|
||||
*
|
||||
*/
|
||||
export type ShareLink = Prisma.ShareLinkModel
|
||||
/**
|
||||
* Model ShareActivity
|
||||
*
|
||||
*/
|
||||
export type ShareActivity = Prisma.ShareActivityModel
|
||||
/**
|
||||
* Model WatermarkConfig
|
||||
*
|
||||
|
||||
+5
@@ -101,6 +101,11 @@ export type ProjectMember = Prisma.ProjectMemberModel
|
||||
*
|
||||
*/
|
||||
export type ShareLink = Prisma.ShareLinkModel
|
||||
/**
|
||||
* Model ShareActivity
|
||||
*
|
||||
*/
|
||||
export type ShareActivity = Prisma.ShareActivityModel
|
||||
/**
|
||||
* Model WatermarkConfig
|
||||
*
|
||||
|
||||
+88
-54
@@ -267,6 +267,17 @@ export type EnumProjectMemberRoleWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumProjectMemberRoleFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntFilter<$PrismaModel> | number
|
||||
}
|
||||
|
||||
export type EnumWatermarkStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.WatermarkStatus | Prisma.EnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.WatermarkStatus[] | Prisma.ListEnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
@@ -274,6 +285,22 @@ export type EnumWatermarkStatusFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedEnumWatermarkStatusFilter<$PrismaModel> | $Enums.WatermarkStatus
|
||||
}
|
||||
|
||||
export type IntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumWatermarkStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.WatermarkStatus | Prisma.EnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.WatermarkStatus[] | Prisma.ListEnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
@@ -284,6 +311,23 @@ export type EnumWatermarkStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumWatermarkStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumShareActivityKindFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.ShareActivityKind | Prisma.EnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel> | $Enums.ShareActivityKind
|
||||
}
|
||||
|
||||
export type EnumShareActivityKindWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.ShareActivityKind | Prisma.EnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumShareActivityKindWithAggregatesFilter<$PrismaModel> | $Enums.ShareActivityKind
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type JsonFilter<$PrismaModel = never> =
|
||||
| Prisma.PatchUndefined<
|
||||
Prisma.Either<Required<JsonFilterBase<$PrismaModel>>, Exclude<keyof Required<JsonFilterBase<$PrismaModel>>, 'path'>>,
|
||||
@@ -359,17 +403,6 @@ export type EnumAssetTypeFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedEnumAssetTypeFilter<$PrismaModel> | $Enums.AssetType
|
||||
}
|
||||
|
||||
export type IntFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntFilter<$PrismaModel> | number
|
||||
}
|
||||
|
||||
export type BigIntFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
in?: bigint[] | number[] | Prisma.ListBigIntFieldRefInput<$PrismaModel>
|
||||
@@ -398,22 +431,6 @@ export type EnumAssetTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumAssetTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BigIntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
in?: bigint[] | number[] | Prisma.ListBigIntFieldRefInput<$PrismaModel>
|
||||
@@ -1147,6 +1164,33 @@ export type NestedEnumWatermarkStatusFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedEnumWatermarkStatusFilter<$PrismaModel> | $Enums.WatermarkStatus
|
||||
}
|
||||
|
||||
export type NestedIntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
|
||||
}
|
||||
|
||||
export type NestedEnumWatermarkStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.WatermarkStatus | Prisma.EnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.WatermarkStatus[] | Prisma.ListEnumWatermarkStatusFieldRefInput<$PrismaModel>
|
||||
@@ -1157,6 +1201,23 @@ export type NestedEnumWatermarkStatusWithAggregatesFilter<$PrismaModel = never>
|
||||
_max?: Prisma.NestedEnumWatermarkStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumShareActivityKindFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.ShareActivityKind | Prisma.EnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel> | $Enums.ShareActivityKind
|
||||
}
|
||||
|
||||
export type NestedEnumShareActivityKindWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.ShareActivityKind | Prisma.EnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.ShareActivityKind[] | Prisma.ListEnumShareActivityKindFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumShareActivityKindWithAggregatesFilter<$PrismaModel> | $Enums.ShareActivityKind
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumShareActivityKindFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedJsonFilter<$PrismaModel = never> =
|
||||
| Prisma.PatchUndefined<
|
||||
Prisma.Either<Required<NestedJsonFilterBase<$PrismaModel>>, Exclude<keyof Required<NestedJsonFilterBase<$PrismaModel>>, 'path'>>,
|
||||
@@ -1233,33 +1294,6 @@ export type NestedEnumAssetTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumAssetTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedIntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
|
||||
}
|
||||
|
||||
export type NestedBigIntWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
in?: bigint[] | number[] | Prisma.ListBigIntFieldRefInput<$PrismaModel>
|
||||
|
||||
+10
@@ -268,6 +268,16 @@ export const KanbanTaskEventType = {
|
||||
export type KanbanTaskEventType = (typeof KanbanTaskEventType)[keyof typeof KanbanTaskEventType]
|
||||
|
||||
|
||||
export const ShareActivityKind = {
|
||||
share_viewed: 'share_viewed',
|
||||
asset_viewed: 'asset_viewed',
|
||||
asset_downloaded: 'asset_downloaded',
|
||||
comment_created: 'comment_created'
|
||||
} as const
|
||||
|
||||
export type ShareActivityKind = (typeof ShareActivityKind)[keyof typeof ShareActivityKind]
|
||||
|
||||
|
||||
export const AgentType = {
|
||||
chat: 'chat',
|
||||
autofill: 'autofill',
|
||||
|
||||
+14
-4
File diff suppressed because one or more lines are too long
+120
-15
@@ -409,6 +409,7 @@ export const ModelName = {
|
||||
Project: 'Project',
|
||||
ProjectMember: 'ProjectMember',
|
||||
ShareLink: 'ShareLink',
|
||||
ShareActivity: 'ShareActivity',
|
||||
WatermarkConfig: 'WatermarkConfig',
|
||||
WatermarkTemplate: 'WatermarkTemplate',
|
||||
WatermarkFile: 'WatermarkFile',
|
||||
@@ -473,7 +474,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "shareActivity" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -1365,6 +1366,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ShareActivity: {
|
||||
payload: Prisma.$ShareActivityPayload<ExtArgs>
|
||||
fields: Prisma.ShareActivityFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ShareActivityFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ShareActivityFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ShareActivityFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ShareActivityFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ShareActivityFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ShareActivityCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ShareActivityCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.ShareActivityCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ShareActivityDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ShareActivityUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ShareActivityDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ShareActivityUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.ShareActivityUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ShareActivityUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ShareActivityPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ShareActivityAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateShareActivity>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ShareActivityGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ShareActivityGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ShareActivityCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ShareActivityCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
WatermarkConfig: {
|
||||
payload: Prisma.$WatermarkConfigPayload<ExtArgs>
|
||||
fields: Prisma.WatermarkConfigFieldRefs
|
||||
@@ -5198,6 +5273,8 @@ export const ShareLinkScalarFieldEnum = {
|
||||
defaultSortOrder: 'defaultSortOrder',
|
||||
viewMode: 'viewMode',
|
||||
fieldVisibility: 'fieldVisibility',
|
||||
views: 'views',
|
||||
lastViewedAt: 'lastViewedAt',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
projectId: 'projectId',
|
||||
@@ -5210,6 +5287,18 @@ export const ShareLinkScalarFieldEnum = {
|
||||
export type ShareLinkScalarFieldEnum = (typeof ShareLinkScalarFieldEnum)[keyof typeof ShareLinkScalarFieldEnum]
|
||||
|
||||
|
||||
export const ShareActivityScalarFieldEnum = {
|
||||
id: 'id',
|
||||
shareLinkId: 'shareLinkId',
|
||||
kind: 'kind',
|
||||
userId: 'userId',
|
||||
assetId: 'assetId',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type ShareActivityScalarFieldEnum = (typeof ShareActivityScalarFieldEnum)[keyof typeof ShareActivityScalarFieldEnum]
|
||||
|
||||
|
||||
export const WatermarkConfigScalarFieldEnum = {
|
||||
id: 'id',
|
||||
config: 'config',
|
||||
@@ -5323,6 +5412,7 @@ export const AssetCommentScalarFieldEnum = {
|
||||
assetId: 'assetId',
|
||||
creatorId: 'creatorId',
|
||||
isCompleted: 'isCompleted',
|
||||
isInternal: 'isInternal',
|
||||
completionLastChangedById: 'completionLastChangedById',
|
||||
replyToId: 'replyToId'
|
||||
} as const
|
||||
@@ -6119,6 +6209,20 @@ export type ListEnumProjectMemberRoleFieldRefInput<$PrismaModel> = FieldRefInput
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int'
|
||||
*/
|
||||
export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int[]'
|
||||
*/
|
||||
export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkStatus'
|
||||
*/
|
||||
@@ -6133,6 +6237,20 @@ export type ListEnumWatermarkStatusFieldRefInput<$PrismaModel> = FieldRefInputTy
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'ShareActivityKind'
|
||||
*/
|
||||
export type EnumShareActivityKindFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ShareActivityKind'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'ShareActivityKind[]'
|
||||
*/
|
||||
export type ListEnumShareActivityKindFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ShareActivityKind[]'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkFileStatus'
|
||||
*/
|
||||
@@ -6161,20 +6279,6 @@ export type ListEnumAssetTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$Pr
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int'
|
||||
*/
|
||||
export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int[]'
|
||||
*/
|
||||
export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'BigInt'
|
||||
*/
|
||||
@@ -6631,6 +6735,7 @@ export type GlobalOmitConfig = {
|
||||
project?: Prisma.ProjectOmit
|
||||
projectMember?: Prisma.ProjectMemberOmit
|
||||
shareLink?: Prisma.ShareLinkOmit
|
||||
shareActivity?: Prisma.ShareActivityOmit
|
||||
watermarkConfig?: Prisma.WatermarkConfigOmit
|
||||
watermarkTemplate?: Prisma.WatermarkTemplateOmit
|
||||
watermarkFile?: Prisma.WatermarkFileOmit
|
||||
|
||||
@@ -63,6 +63,7 @@ export const ModelName = {
|
||||
Project: 'Project',
|
||||
ProjectMember: 'ProjectMember',
|
||||
ShareLink: 'ShareLink',
|
||||
ShareActivity: 'ShareActivity',
|
||||
WatermarkConfig: 'WatermarkConfig',
|
||||
WatermarkTemplate: 'WatermarkTemplate',
|
||||
WatermarkFile: 'WatermarkFile',
|
||||
@@ -298,6 +299,8 @@ export const ShareLinkScalarFieldEnum = {
|
||||
defaultSortOrder: 'defaultSortOrder',
|
||||
viewMode: 'viewMode',
|
||||
fieldVisibility: 'fieldVisibility',
|
||||
views: 'views',
|
||||
lastViewedAt: 'lastViewedAt',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
projectId: 'projectId',
|
||||
@@ -310,6 +313,18 @@ export const ShareLinkScalarFieldEnum = {
|
||||
export type ShareLinkScalarFieldEnum = (typeof ShareLinkScalarFieldEnum)[keyof typeof ShareLinkScalarFieldEnum]
|
||||
|
||||
|
||||
export const ShareActivityScalarFieldEnum = {
|
||||
id: 'id',
|
||||
shareLinkId: 'shareLinkId',
|
||||
kind: 'kind',
|
||||
userId: 'userId',
|
||||
assetId: 'assetId',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type ShareActivityScalarFieldEnum = (typeof ShareActivityScalarFieldEnum)[keyof typeof ShareActivityScalarFieldEnum]
|
||||
|
||||
|
||||
export const WatermarkConfigScalarFieldEnum = {
|
||||
id: 'id',
|
||||
config: 'config',
|
||||
@@ -423,6 +438,7 @@ export const AssetCommentScalarFieldEnum = {
|
||||
assetId: 'assetId',
|
||||
creatorId: 'creatorId',
|
||||
isCompleted: 'isCompleted',
|
||||
isInternal: 'isInternal',
|
||||
completionLastChangedById: 'completionLastChangedById',
|
||||
replyToId: 'replyToId'
|
||||
} as const
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ export type * from './models/TeamMember.ts'
|
||||
export type * from './models/Project.ts'
|
||||
export type * from './models/ProjectMember.ts'
|
||||
export type * from './models/ShareLink.ts'
|
||||
export type * from './models/ShareActivity.ts'
|
||||
export type * from './models/WatermarkConfig.ts'
|
||||
export type * from './models/WatermarkTemplate.ts'
|
||||
export type * from './models/WatermarkFile.ts'
|
||||
|
||||
@@ -1143,14 +1143,6 @@ export type EnumAssetTypeFieldUpdateOperationsInput = {
|
||||
set?: $Enums.AssetType
|
||||
}
|
||||
|
||||
export type IntFieldUpdateOperationsInput = {
|
||||
set?: number
|
||||
increment?: number
|
||||
decrement?: number
|
||||
multiply?: number
|
||||
divide?: number
|
||||
}
|
||||
|
||||
export type BigIntFieldUpdateOperationsInput = {
|
||||
set?: bigint | number
|
||||
increment?: bigint | number
|
||||
|
||||
+72
-1
@@ -46,6 +46,7 @@ export type AssetCommentMinAggregateOutputType = {
|
||||
assetId: string | null
|
||||
creatorId: string | null
|
||||
isCompleted: boolean | null
|
||||
isInternal: boolean | null
|
||||
completionLastChangedById: string | null
|
||||
replyToId: string | null
|
||||
}
|
||||
@@ -60,6 +61,7 @@ export type AssetCommentMaxAggregateOutputType = {
|
||||
assetId: string | null
|
||||
creatorId: string | null
|
||||
isCompleted: boolean | null
|
||||
isInternal: boolean | null
|
||||
completionLastChangedById: string | null
|
||||
replyToId: string | null
|
||||
}
|
||||
@@ -75,6 +77,7 @@ export type AssetCommentCountAggregateOutputType = {
|
||||
assetId: number
|
||||
creatorId: number
|
||||
isCompleted: number
|
||||
isInternal: number
|
||||
completionLastChangedById: number
|
||||
replyToId: number
|
||||
_all: number
|
||||
@@ -99,6 +102,7 @@ export type AssetCommentMinAggregateInputType = {
|
||||
assetId?: true
|
||||
creatorId?: true
|
||||
isCompleted?: true
|
||||
isInternal?: true
|
||||
completionLastChangedById?: true
|
||||
replyToId?: true
|
||||
}
|
||||
@@ -113,6 +117,7 @@ export type AssetCommentMaxAggregateInputType = {
|
||||
assetId?: true
|
||||
creatorId?: true
|
||||
isCompleted?: true
|
||||
isInternal?: true
|
||||
completionLastChangedById?: true
|
||||
replyToId?: true
|
||||
}
|
||||
@@ -128,6 +133,7 @@ export type AssetCommentCountAggregateInputType = {
|
||||
assetId?: true
|
||||
creatorId?: true
|
||||
isCompleted?: true
|
||||
isInternal?: true
|
||||
completionLastChangedById?: true
|
||||
replyToId?: true
|
||||
_all?: true
|
||||
@@ -230,6 +236,7 @@ export type AssetCommentGroupByOutputType = {
|
||||
assetId: string
|
||||
creatorId: string | null
|
||||
isCompleted: boolean
|
||||
isInternal: boolean
|
||||
completionLastChangedById: string | null
|
||||
replyToId: string | null
|
||||
_count: AssetCommentCountAggregateOutputType | null
|
||||
@@ -268,6 +275,7 @@ export type AssetCommentWhereInput = {
|
||||
assetId?: Prisma.StringFilter<"AssetComment"> | string
|
||||
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
isInternal?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
@@ -291,6 +299,7 @@ export type AssetCommentOrderByWithRelationInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
creatorId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
isCompleted?: Prisma.SortOrder
|
||||
isInternal?: Prisma.SortOrder
|
||||
completionLastChangedById?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
session?: Prisma.AgentSessionOrderByWithRelationInput
|
||||
@@ -317,6 +326,7 @@ export type AssetCommentWhereUniqueInput = Prisma.AtLeast<{
|
||||
assetId?: Prisma.StringFilter<"AssetComment"> | string
|
||||
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
isInternal?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
session?: Prisma.XOR<Prisma.AgentSessionNullableScalarRelationFilter, Prisma.AgentSessionWhereInput> | null
|
||||
@@ -340,6 +350,7 @@ export type AssetCommentOrderByWithAggregationInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
creatorId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
isCompleted?: Prisma.SortOrder
|
||||
isInternal?: Prisma.SortOrder
|
||||
completionLastChangedById?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
_count?: Prisma.AssetCommentCountOrderByAggregateInput
|
||||
@@ -363,6 +374,7 @@ export type AssetCommentScalarWhereWithAggregatesInput = {
|
||||
assetId?: Prisma.StringWithAggregatesFilter<"AssetComment"> | string
|
||||
creatorId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
|
||||
isCompleted?: Prisma.BoolWithAggregatesFilter<"AssetComment"> | boolean
|
||||
isInternal?: Prisma.BoolWithAggregatesFilter<"AssetComment"> | boolean
|
||||
completionLastChangedById?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableWithAggregatesFilter<"AssetComment"> | string | null
|
||||
}
|
||||
@@ -375,6 +387,7 @@ export type AssetCommentCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -396,6 +409,7 @@ export type AssetCommentUncheckedCreateInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -411,6 +425,7 @@ export type AssetCommentUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -432,6 +447,7 @@ export type AssetCommentUncheckedUpdateInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -450,6 +466,7 @@ export type AssetCommentCreateManyInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
}
|
||||
@@ -462,6 +479,7 @@ export type AssetCommentUpdateManyMutationInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
}
|
||||
|
||||
export type AssetCommentUncheckedUpdateManyInput = {
|
||||
@@ -475,6 +493,7 @@ export type AssetCommentUncheckedUpdateManyInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
@@ -505,6 +524,7 @@ export type AssetCommentCountOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
creatorId?: Prisma.SortOrder
|
||||
isCompleted?: Prisma.SortOrder
|
||||
isInternal?: Prisma.SortOrder
|
||||
completionLastChangedById?: Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrder
|
||||
}
|
||||
@@ -523,6 +543,7 @@ export type AssetCommentMaxOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
creatorId?: Prisma.SortOrder
|
||||
isCompleted?: Prisma.SortOrder
|
||||
isInternal?: Prisma.SortOrder
|
||||
completionLastChangedById?: Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrder
|
||||
}
|
||||
@@ -537,6 +558,7 @@ export type AssetCommentMinOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
creatorId?: Prisma.SortOrder
|
||||
isCompleted?: Prisma.SortOrder
|
||||
isInternal?: Prisma.SortOrder
|
||||
completionLastChangedById?: Prisma.SortOrder
|
||||
replyToId?: Prisma.SortOrder
|
||||
}
|
||||
@@ -812,6 +834,7 @@ export type AssetCommentCreateWithoutCreatorInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -831,6 +854,7 @@ export type AssetCommentUncheckedCreateWithoutCreatorInput = {
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -856,6 +880,7 @@ export type AssetCommentCreateWithoutCompletionLastChangedByInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -876,6 +901,7 @@ export type AssetCommentUncheckedCreateWithoutCompletionLastChangedByInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
|
||||
@@ -922,6 +948,7 @@ export type AssetCommentScalarWhereInput = {
|
||||
assetId?: Prisma.StringFilter<"AssetComment"> | string
|
||||
creatorId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
isCompleted?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
isInternal?: Prisma.BoolFilter<"AssetComment"> | boolean
|
||||
completionLastChangedById?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
replyToId?: Prisma.StringNullableFilter<"AssetComment"> | string | null
|
||||
}
|
||||
@@ -950,6 +977,7 @@ export type AssetCommentCreateWithoutAssetInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -969,6 +997,7 @@ export type AssetCommentUncheckedCreateWithoutAssetInput = {
|
||||
updatedAt?: Date | string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -1010,6 +1039,7 @@ export type AssetCommentCreateWithoutRepliesInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -1030,6 +1060,7 @@ export type AssetCommentUncheckedCreateWithoutRepliesInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
|
||||
@@ -1049,6 +1080,7 @@ export type AssetCommentCreateWithoutReplyToInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -1069,6 +1101,7 @@ export type AssetCommentUncheckedCreateWithoutReplyToInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedCreateNestedManyWithoutCommentInput
|
||||
@@ -1104,6 +1137,7 @@ export type AssetCommentUpdateWithoutRepliesInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -1124,6 +1158,7 @@ export type AssetCommentUncheckedUpdateWithoutRepliesInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
|
||||
@@ -1154,6 +1189,7 @@ export type AssetCommentCreateWithoutAttachmentsInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -1174,6 +1210,7 @@ export type AssetCommentUncheckedCreateWithoutAttachmentsInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -1204,6 +1241,7 @@ export type AssetCommentUpdateWithoutAttachmentsInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -1224,6 +1262,7 @@ export type AssetCommentUncheckedUpdateWithoutAttachmentsInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -1238,6 +1277,7 @@ export type AssetCommentCreateWithoutReactionsInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
session?: Prisma.AgentSessionCreateNestedOneWithoutCommentsInput
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
@@ -1258,6 +1298,7 @@ export type AssetCommentUncheckedCreateWithoutReactionsInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -1288,6 +1329,7 @@ export type AssetCommentUpdateWithoutReactionsInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -1308,6 +1350,7 @@ export type AssetCommentUncheckedUpdateWithoutReactionsInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -1322,6 +1365,7 @@ export type AssetCommentCreateWithoutSessionInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
asset: Prisma.AssetCreateNestedOneWithoutCommentsInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutCommentsInput
|
||||
completionLastChangedBy?: Prisma.UserCreateNestedOneWithoutCompletionChangedCommentsInput
|
||||
@@ -1341,6 +1385,7 @@ export type AssetCommentUncheckedCreateWithoutSessionInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
replies?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutReplyToInput
|
||||
@@ -1384,6 +1429,7 @@ export type AssetCommentCreateManyCreatorInput = {
|
||||
updatedAt?: Date | string
|
||||
assetId: string
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
}
|
||||
@@ -1399,6 +1445,7 @@ export type AssetCommentCreateManyCompletionLastChangedByInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
replyToId?: string | null
|
||||
}
|
||||
|
||||
@@ -1410,6 +1457,7 @@ export type AssetCommentUpdateWithoutCreatorInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1429,6 +1477,7 @@ export type AssetCommentUncheckedUpdateWithoutCreatorInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -1446,6 +1495,7 @@ export type AssetCommentUncheckedUpdateManyWithoutCreatorInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
@@ -1458,6 +1508,7 @@ export type AssetCommentUpdateWithoutCompletionLastChangedByInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -1478,6 +1529,7 @@ export type AssetCommentUncheckedUpdateWithoutCompletionLastChangedByInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
|
||||
@@ -1495,6 +1547,7 @@ export type AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByInput =
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
@@ -1508,6 +1561,7 @@ export type AssetCommentCreateManyAssetInput = {
|
||||
updatedAt?: Date | string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
}
|
||||
@@ -1520,6 +1574,7 @@ export type AssetCommentUpdateWithoutAssetInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1539,6 +1594,7 @@ export type AssetCommentUncheckedUpdateWithoutAssetInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -1556,6 +1612,7 @@ export type AssetCommentUncheckedUpdateManyWithoutAssetInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
@@ -1571,6 +1628,7 @@ export type AssetCommentCreateManyReplyToInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
}
|
||||
|
||||
@@ -1582,6 +1640,7 @@ export type AssetCommentUpdateWithoutReplyToInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
session?: Prisma.AgentSessionUpdateOneWithoutCommentsNestedInput
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
@@ -1602,6 +1661,7 @@ export type AssetCommentUncheckedUpdateWithoutReplyToInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
attachments?: Prisma.AssetCommentAttachmentUncheckedUpdateManyWithoutCommentNestedInput
|
||||
@@ -1619,6 +1679,7 @@ export type AssetCommentUncheckedUpdateManyWithoutReplyToInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
@@ -1632,6 +1693,7 @@ export type AssetCommentCreateManySessionInput = {
|
||||
assetId: string
|
||||
creatorId?: string | null
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: string | null
|
||||
replyToId?: string | null
|
||||
}
|
||||
@@ -1644,6 +1706,7 @@ export type AssetCommentUpdateWithoutSessionInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
asset?: Prisma.AssetUpdateOneRequiredWithoutCommentsNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutCommentsNestedInput
|
||||
completionLastChangedBy?: Prisma.UserUpdateOneWithoutCompletionChangedCommentsNestedInput
|
||||
@@ -1663,6 +1726,7 @@ export type AssetCommentUncheckedUpdateWithoutSessionInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replies?: Prisma.AssetCommentUncheckedUpdateManyWithoutReplyToNestedInput
|
||||
@@ -1680,6 +1744,7 @@ export type AssetCommentUncheckedUpdateManyWithoutSessionInput = {
|
||||
assetId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isCompleted?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
isInternal?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
completionLastChangedById?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
replyToId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
@@ -1744,6 +1809,7 @@ export type AssetCommentSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
assetId?: boolean
|
||||
creatorId?: boolean
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
@@ -1768,6 +1834,7 @@ export type AssetCommentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
assetId?: boolean
|
||||
creatorId?: boolean
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
@@ -1788,6 +1855,7 @@ export type AssetCommentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
assetId?: boolean
|
||||
creatorId?: boolean
|
||||
isCompleted?: boolean
|
||||
isInternal?: boolean
|
||||
completionLastChangedById?: boolean
|
||||
replyToId?: boolean
|
||||
session?: boolean | Prisma.AssetComment$sessionArgs<ExtArgs>
|
||||
@@ -1808,11 +1876,12 @@ export type AssetCommentSelectScalar = {
|
||||
assetId?: boolean
|
||||
creatorId?: boolean
|
||||
isCompleted?: boolean
|
||||
isInternal?: 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" | "isCompleted" | "completionLastChangedById" | "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" | "isInternal" | "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>
|
||||
@@ -1865,6 +1934,7 @@ export type $AssetCommentPayload<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
assetId: string
|
||||
creatorId: string | null
|
||||
isCompleted: boolean
|
||||
isInternal: boolean
|
||||
completionLastChangedById: string | null
|
||||
replyToId: string | null
|
||||
}, ExtArgs["result"]["assetComment"]>
|
||||
@@ -2308,6 +2378,7 @@ export interface AssetCommentFieldRefs {
|
||||
readonly assetId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
readonly creatorId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
readonly isCompleted: Prisma.FieldRef<"AssetComment", 'Boolean'>
|
||||
readonly isInternal: Prisma.FieldRef<"AssetComment", 'Boolean'>
|
||||
readonly completionLastChangedById: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
readonly replyToId: Prisma.FieldRef<"AssetComment", 'String'>
|
||||
}
|
||||
|
||||
+1386
File diff suppressed because it is too large
Load Diff
+356
-1
@@ -22,10 +22,20 @@ export type ShareLinkModel = runtime.Types.Result.DefaultSelection<Prisma.$Share
|
||||
|
||||
export type AggregateShareLink = {
|
||||
_count: ShareLinkCountAggregateOutputType | null
|
||||
_avg: ShareLinkAvgAggregateOutputType | null
|
||||
_sum: ShareLinkSumAggregateOutputType | null
|
||||
_min: ShareLinkMinAggregateOutputType | null
|
||||
_max: ShareLinkMaxAggregateOutputType | null
|
||||
}
|
||||
|
||||
export type ShareLinkAvgAggregateOutputType = {
|
||||
views: number | null
|
||||
}
|
||||
|
||||
export type ShareLinkSumAggregateOutputType = {
|
||||
views: number | null
|
||||
}
|
||||
|
||||
export type ShareLinkMinAggregateOutputType = {
|
||||
id: string | null
|
||||
name: string | null
|
||||
@@ -35,6 +45,8 @@ export type ShareLinkMinAggregateOutputType = {
|
||||
allowDownload: boolean | null
|
||||
defaultSortOrder: string | null
|
||||
viewMode: string | null
|
||||
views: number | null
|
||||
lastViewedAt: Date | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
projectId: string | null
|
||||
@@ -53,6 +65,8 @@ export type ShareLinkMaxAggregateOutputType = {
|
||||
allowDownload: boolean | null
|
||||
defaultSortOrder: string | null
|
||||
viewMode: string | null
|
||||
views: number | null
|
||||
lastViewedAt: Date | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
projectId: string | null
|
||||
@@ -72,6 +86,8 @@ export type ShareLinkCountAggregateOutputType = {
|
||||
defaultSortOrder: number
|
||||
viewMode: number
|
||||
fieldVisibility: number
|
||||
views: number
|
||||
lastViewedAt: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
projectId: number
|
||||
@@ -83,6 +99,14 @@ export type ShareLinkCountAggregateOutputType = {
|
||||
}
|
||||
|
||||
|
||||
export type ShareLinkAvgAggregateInputType = {
|
||||
views?: true
|
||||
}
|
||||
|
||||
export type ShareLinkSumAggregateInputType = {
|
||||
views?: true
|
||||
}
|
||||
|
||||
export type ShareLinkMinAggregateInputType = {
|
||||
id?: true
|
||||
name?: true
|
||||
@@ -92,6 +116,8 @@ export type ShareLinkMinAggregateInputType = {
|
||||
allowDownload?: true
|
||||
defaultSortOrder?: true
|
||||
viewMode?: true
|
||||
views?: true
|
||||
lastViewedAt?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
projectId?: true
|
||||
@@ -110,6 +136,8 @@ export type ShareLinkMaxAggregateInputType = {
|
||||
allowDownload?: true
|
||||
defaultSortOrder?: true
|
||||
viewMode?: true
|
||||
views?: true
|
||||
lastViewedAt?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
projectId?: true
|
||||
@@ -129,6 +157,8 @@ export type ShareLinkCountAggregateInputType = {
|
||||
defaultSortOrder?: true
|
||||
viewMode?: true
|
||||
fieldVisibility?: true
|
||||
views?: true
|
||||
lastViewedAt?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
projectId?: true
|
||||
@@ -174,6 +204,18 @@ export type ShareLinkAggregateArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Count returned ShareLinks
|
||||
**/
|
||||
_count?: true | ShareLinkCountAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to average
|
||||
**/
|
||||
_avg?: ShareLinkAvgAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to sum
|
||||
**/
|
||||
_sum?: ShareLinkSumAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
@@ -207,6 +249,8 @@ export type ShareLinkGroupByArgs<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
take?: number
|
||||
skip?: number
|
||||
_count?: ShareLinkCountAggregateInputType | true
|
||||
_avg?: ShareLinkAvgAggregateInputType
|
||||
_sum?: ShareLinkSumAggregateInputType
|
||||
_min?: ShareLinkMinAggregateInputType
|
||||
_max?: ShareLinkMaxAggregateInputType
|
||||
}
|
||||
@@ -221,6 +265,8 @@ export type ShareLinkGroupByOutputType = {
|
||||
defaultSortOrder: string | null
|
||||
viewMode: string | null
|
||||
fieldVisibility:PrismaJson.ShareLinkFieldVisibility | null
|
||||
views: number
|
||||
lastViewedAt: Date | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
projectId: string
|
||||
@@ -229,6 +275,8 @@ export type ShareLinkGroupByOutputType = {
|
||||
watermarkConfigId: string | null
|
||||
watermarkStatus: $Enums.WatermarkStatus
|
||||
_count: ShareLinkCountAggregateOutputType | null
|
||||
_avg: ShareLinkAvgAggregateOutputType | null
|
||||
_sum: ShareLinkSumAggregateOutputType | null
|
||||
_min: ShareLinkMinAggregateOutputType | null
|
||||
_max: ShareLinkMaxAggregateOutputType | null
|
||||
}
|
||||
@@ -261,6 +309,8 @@ export type ShareLinkWhereInput = {
|
||||
defaultSortOrder?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
viewMode?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
fieldVisibility?: Prisma.JsonNullableFilter<"ShareLink">
|
||||
views?: Prisma.IntFilter<"ShareLink"> | number
|
||||
lastViewedAt?: Prisma.DateTimeNullableFilter<"ShareLink"> | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
projectId?: Prisma.StringFilter<"ShareLink"> | string
|
||||
@@ -272,6 +322,7 @@ export type ShareLinkWhereInput = {
|
||||
rootFolder?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
|
||||
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
watermarkConfig?: Prisma.XOR<Prisma.WatermarkConfigNullableScalarRelationFilter, Prisma.WatermarkConfigWhereInput> | null
|
||||
activities?: Prisma.ShareActivityListRelationFilter
|
||||
}
|
||||
|
||||
export type ShareLinkOrderByWithRelationInput = {
|
||||
@@ -284,6 +335,8 @@ export type ShareLinkOrderByWithRelationInput = {
|
||||
defaultSortOrder?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
viewMode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
fieldVisibility?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
views?: Prisma.SortOrder
|
||||
lastViewedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
projectId?: Prisma.SortOrder
|
||||
@@ -295,6 +348,7 @@ export type ShareLinkOrderByWithRelationInput = {
|
||||
rootFolder?: Prisma.AssetOrderByWithRelationInput
|
||||
creator?: Prisma.UserOrderByWithRelationInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigOrderByWithRelationInput
|
||||
activities?: Prisma.ShareActivityOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type ShareLinkWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -311,6 +365,8 @@ export type ShareLinkWhereUniqueInput = Prisma.AtLeast<{
|
||||
defaultSortOrder?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
viewMode?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
fieldVisibility?: Prisma.JsonNullableFilter<"ShareLink">
|
||||
views?: Prisma.IntFilter<"ShareLink"> | number
|
||||
lastViewedAt?: Prisma.DateTimeNullableFilter<"ShareLink"> | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
projectId?: Prisma.StringFilter<"ShareLink"> | string
|
||||
@@ -321,6 +377,7 @@ export type ShareLinkWhereUniqueInput = Prisma.AtLeast<{
|
||||
rootFolder?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
|
||||
creator?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
watermarkConfig?: Prisma.XOR<Prisma.WatermarkConfigNullableScalarRelationFilter, Prisma.WatermarkConfigWhereInput> | null
|
||||
activities?: Prisma.ShareActivityListRelationFilter
|
||||
}, "id" | "rootFolderId">
|
||||
|
||||
export type ShareLinkOrderByWithAggregationInput = {
|
||||
@@ -333,6 +390,8 @@ export type ShareLinkOrderByWithAggregationInput = {
|
||||
defaultSortOrder?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
viewMode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
fieldVisibility?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
views?: Prisma.SortOrder
|
||||
lastViewedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
projectId?: Prisma.SortOrder
|
||||
@@ -341,8 +400,10 @@ export type ShareLinkOrderByWithAggregationInput = {
|
||||
watermarkConfigId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
watermarkStatus?: Prisma.SortOrder
|
||||
_count?: Prisma.ShareLinkCountOrderByAggregateInput
|
||||
_avg?: Prisma.ShareLinkAvgOrderByAggregateInput
|
||||
_max?: Prisma.ShareLinkMaxOrderByAggregateInput
|
||||
_min?: Prisma.ShareLinkMinOrderByAggregateInput
|
||||
_sum?: Prisma.ShareLinkSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
export type ShareLinkScalarWhereWithAggregatesInput = {
|
||||
@@ -358,6 +419,8 @@ export type ShareLinkScalarWhereWithAggregatesInput = {
|
||||
defaultSortOrder?: Prisma.StringNullableWithAggregatesFilter<"ShareLink"> | string | null
|
||||
viewMode?: Prisma.StringNullableWithAggregatesFilter<"ShareLink"> | string | null
|
||||
fieldVisibility?: Prisma.JsonNullableWithAggregatesFilter<"ShareLink">
|
||||
views?: Prisma.IntWithAggregatesFilter<"ShareLink"> | number
|
||||
lastViewedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ShareLink"> | Date | string | null
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"ShareLink"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"ShareLink"> | Date | string
|
||||
projectId?: Prisma.StringWithAggregatesFilter<"ShareLink"> | string
|
||||
@@ -377,6 +440,8 @@ export type ShareLinkCreateInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
@@ -384,6 +449,7 @@ export type ShareLinkCreateInput = {
|
||||
rootFolder: Prisma.AssetCreateNestedOneWithoutShareLinkRootFolderInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutShareLinksInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigCreateNestedOneWithoutShareLinksInput
|
||||
activities?: Prisma.ShareActivityCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateInput = {
|
||||
@@ -396,6 +462,8 @@ export type ShareLinkUncheckedCreateInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
@@ -403,6 +471,7 @@ export type ShareLinkUncheckedCreateInput = {
|
||||
creatorId?: string | null
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUpdateInput = {
|
||||
@@ -415,6 +484,8 @@ export type ShareLinkUpdateInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
@@ -422,6 +493,7 @@ export type ShareLinkUpdateInput = {
|
||||
rootFolder?: Prisma.AssetUpdateOneRequiredWithoutShareLinkRootFolderNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutShareLinksNestedInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigUpdateOneWithoutShareLinksNestedInput
|
||||
activities?: Prisma.ShareActivityUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateInput = {
|
||||
@@ -434,6 +506,8 @@ export type ShareLinkUncheckedUpdateInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -441,6 +515,7 @@ export type ShareLinkUncheckedUpdateInput = {
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkConfigId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateManyInput = {
|
||||
@@ -453,6 +528,8 @@ export type ShareLinkCreateManyInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
@@ -472,6 +549,8 @@ export type ShareLinkUpdateManyMutationInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
@@ -487,6 +566,8 @@ export type ShareLinkUncheckedUpdateManyInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -516,6 +597,8 @@ export type ShareLinkCountOrderByAggregateInput = {
|
||||
defaultSortOrder?: Prisma.SortOrder
|
||||
viewMode?: Prisma.SortOrder
|
||||
fieldVisibility?: Prisma.SortOrder
|
||||
views?: Prisma.SortOrder
|
||||
lastViewedAt?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
projectId?: Prisma.SortOrder
|
||||
@@ -525,6 +608,10 @@ export type ShareLinkCountOrderByAggregateInput = {
|
||||
watermarkStatus?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ShareLinkAvgOrderByAggregateInput = {
|
||||
views?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ShareLinkMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
@@ -534,6 +621,8 @@ export type ShareLinkMaxOrderByAggregateInput = {
|
||||
allowDownload?: Prisma.SortOrder
|
||||
defaultSortOrder?: Prisma.SortOrder
|
||||
viewMode?: Prisma.SortOrder
|
||||
views?: Prisma.SortOrder
|
||||
lastViewedAt?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
projectId?: Prisma.SortOrder
|
||||
@@ -552,6 +641,8 @@ export type ShareLinkMinOrderByAggregateInput = {
|
||||
allowDownload?: Prisma.SortOrder
|
||||
defaultSortOrder?: Prisma.SortOrder
|
||||
viewMode?: Prisma.SortOrder
|
||||
views?: Prisma.SortOrder
|
||||
lastViewedAt?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
projectId?: Prisma.SortOrder
|
||||
@@ -561,6 +652,15 @@ export type ShareLinkMinOrderByAggregateInput = {
|
||||
watermarkStatus?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ShareLinkSumOrderByAggregateInput = {
|
||||
views?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ShareLinkScalarRelationFilter = {
|
||||
is?: Prisma.ShareLinkWhereInput
|
||||
isNot?: Prisma.ShareLinkWhereInput
|
||||
}
|
||||
|
||||
export type ShareLinkNullableScalarRelationFilter = {
|
||||
is?: Prisma.ShareLinkWhereInput | null
|
||||
isNot?: Prisma.ShareLinkWhereInput | null
|
||||
@@ -650,10 +750,32 @@ export type ShareLinkUncheckedUpdateManyWithoutProjectNestedInput = {
|
||||
deleteMany?: Prisma.ShareLinkScalarWhereInput | Prisma.ShareLinkScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type IntFieldUpdateOperationsInput = {
|
||||
set?: number
|
||||
increment?: number
|
||||
decrement?: number
|
||||
multiply?: number
|
||||
divide?: number
|
||||
}
|
||||
|
||||
export type EnumWatermarkStatusFieldUpdateOperationsInput = {
|
||||
set?: $Enums.WatermarkStatus
|
||||
}
|
||||
|
||||
export type ShareLinkCreateNestedOneWithoutActivitiesInput = {
|
||||
create?: Prisma.XOR<Prisma.ShareLinkCreateWithoutActivitiesInput, Prisma.ShareLinkUncheckedCreateWithoutActivitiesInput>
|
||||
connectOrCreate?: Prisma.ShareLinkCreateOrConnectWithoutActivitiesInput
|
||||
connect?: Prisma.ShareLinkWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ShareLinkUpdateOneRequiredWithoutActivitiesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ShareLinkCreateWithoutActivitiesInput, Prisma.ShareLinkUncheckedCreateWithoutActivitiesInput>
|
||||
connectOrCreate?: Prisma.ShareLinkCreateOrConnectWithoutActivitiesInput
|
||||
upsert?: Prisma.ShareLinkUpsertWithoutActivitiesInput
|
||||
connect?: Prisma.ShareLinkWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ShareLinkUpdateToOneWithWhereWithoutActivitiesInput, Prisma.ShareLinkUpdateWithoutActivitiesInput>, Prisma.ShareLinkUncheckedUpdateWithoutActivitiesInput>
|
||||
}
|
||||
|
||||
export type ShareLinkCreateNestedManyWithoutWatermarkConfigInput = {
|
||||
create?: Prisma.XOR<Prisma.ShareLinkCreateWithoutWatermarkConfigInput, Prisma.ShareLinkUncheckedCreateWithoutWatermarkConfigInput> | Prisma.ShareLinkCreateWithoutWatermarkConfigInput[] | Prisma.ShareLinkUncheckedCreateWithoutWatermarkConfigInput[]
|
||||
connectOrCreate?: Prisma.ShareLinkCreateOrConnectWithoutWatermarkConfigInput | Prisma.ShareLinkCreateOrConnectWithoutWatermarkConfigInput[]
|
||||
@@ -738,12 +860,15 @@ export type ShareLinkCreateWithoutCreatorInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
project: Prisma.ProjectCreateNestedOneWithoutShareLinksInput
|
||||
rootFolder: Prisma.AssetCreateNestedOneWithoutShareLinkRootFolderInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigCreateNestedOneWithoutShareLinksInput
|
||||
activities?: Prisma.ShareActivityCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateWithoutCreatorInput = {
|
||||
@@ -756,12 +881,15 @@ export type ShareLinkUncheckedCreateWithoutCreatorInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
rootFolderId: string
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateOrConnectWithoutCreatorInput = {
|
||||
@@ -803,6 +931,8 @@ export type ShareLinkScalarWhereInput = {
|
||||
defaultSortOrder?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
viewMode?: Prisma.StringNullableFilter<"ShareLink"> | string | null
|
||||
fieldVisibility?: Prisma.JsonNullableFilter<"ShareLink">
|
||||
views?: Prisma.IntFilter<"ShareLink"> | number
|
||||
lastViewedAt?: Prisma.DateTimeNullableFilter<"ShareLink"> | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ShareLink"> | Date | string
|
||||
projectId?: Prisma.StringFilter<"ShareLink"> | string
|
||||
@@ -822,12 +952,15 @@ export type ShareLinkCreateWithoutProjectInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
rootFolder: Prisma.AssetCreateNestedOneWithoutShareLinkRootFolderInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutShareLinksInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigCreateNestedOneWithoutShareLinksInput
|
||||
activities?: Prisma.ShareActivityCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateWithoutProjectInput = {
|
||||
@@ -840,12 +973,15 @@ export type ShareLinkUncheckedCreateWithoutProjectInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
rootFolderId: string
|
||||
creatorId?: string | null
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateOrConnectWithoutProjectInput = {
|
||||
@@ -874,6 +1010,106 @@ export type ShareLinkUpdateManyWithWhereWithoutProjectInput = {
|
||||
data: Prisma.XOR<Prisma.ShareLinkUpdateManyMutationInput, Prisma.ShareLinkUncheckedUpdateManyWithoutProjectInput>
|
||||
}
|
||||
|
||||
export type ShareLinkCreateWithoutActivitiesInput = {
|
||||
id?: string
|
||||
name: string
|
||||
expireAt?: Date | string | null
|
||||
password?: string | null
|
||||
isDisabled?: boolean
|
||||
allowDownload?: boolean
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
project: Prisma.ProjectCreateNestedOneWithoutShareLinksInput
|
||||
rootFolder: Prisma.AssetCreateNestedOneWithoutShareLinkRootFolderInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutShareLinksInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigCreateNestedOneWithoutShareLinksInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateWithoutActivitiesInput = {
|
||||
id?: string
|
||||
name: string
|
||||
expireAt?: Date | string | null
|
||||
password?: string | null
|
||||
isDisabled?: boolean
|
||||
allowDownload?: boolean
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
rootFolderId: string
|
||||
creatorId?: string | null
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
}
|
||||
|
||||
export type ShareLinkCreateOrConnectWithoutActivitiesInput = {
|
||||
where: Prisma.ShareLinkWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ShareLinkCreateWithoutActivitiesInput, Prisma.ShareLinkUncheckedCreateWithoutActivitiesInput>
|
||||
}
|
||||
|
||||
export type ShareLinkUpsertWithoutActivitiesInput = {
|
||||
update: Prisma.XOR<Prisma.ShareLinkUpdateWithoutActivitiesInput, Prisma.ShareLinkUncheckedUpdateWithoutActivitiesInput>
|
||||
create: Prisma.XOR<Prisma.ShareLinkCreateWithoutActivitiesInput, Prisma.ShareLinkUncheckedCreateWithoutActivitiesInput>
|
||||
where?: Prisma.ShareLinkWhereInput
|
||||
}
|
||||
|
||||
export type ShareLinkUpdateToOneWithWhereWithoutActivitiesInput = {
|
||||
where?: Prisma.ShareLinkWhereInput
|
||||
data: Prisma.XOR<Prisma.ShareLinkUpdateWithoutActivitiesInput, Prisma.ShareLinkUncheckedUpdateWithoutActivitiesInput>
|
||||
}
|
||||
|
||||
export type ShareLinkUpdateWithoutActivitiesInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expireAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isDisabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
allowDownload?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
project?: Prisma.ProjectUpdateOneRequiredWithoutShareLinksNestedInput
|
||||
rootFolder?: Prisma.AssetUpdateOneRequiredWithoutShareLinkRootFolderNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutShareLinksNestedInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigUpdateOneWithoutShareLinksNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateWithoutActivitiesInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
expireAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isDisabled?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
allowDownload?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
rootFolderId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkConfigId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
}
|
||||
|
||||
export type ShareLinkCreateWithoutWatermarkConfigInput = {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -884,12 +1120,15 @@ export type ShareLinkCreateWithoutWatermarkConfigInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
project: Prisma.ProjectCreateNestedOneWithoutShareLinksInput
|
||||
rootFolder: Prisma.AssetCreateNestedOneWithoutShareLinkRootFolderInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutShareLinksInput
|
||||
activities?: Prisma.ShareActivityCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateWithoutWatermarkConfigInput = {
|
||||
@@ -902,12 +1141,15 @@ export type ShareLinkUncheckedCreateWithoutWatermarkConfigInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
rootFolderId: string
|
||||
creatorId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateOrConnectWithoutWatermarkConfigInput = {
|
||||
@@ -946,12 +1188,15 @@ export type ShareLinkCreateWithoutRootFolderInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
project: Prisma.ProjectCreateNestedOneWithoutShareLinksInput
|
||||
creator?: Prisma.UserCreateNestedOneWithoutShareLinksInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigCreateNestedOneWithoutShareLinksInput
|
||||
activities?: Prisma.ShareActivityCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedCreateWithoutRootFolderInput = {
|
||||
@@ -964,12 +1209,15 @@ export type ShareLinkUncheckedCreateWithoutRootFolderInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
creatorId?: string | null
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedCreateNestedManyWithoutShareLinkInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateOrConnectWithoutRootFolderInput = {
|
||||
@@ -998,12 +1246,15 @@ export type ShareLinkUpdateWithoutRootFolderInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
project?: Prisma.ProjectUpdateOneRequiredWithoutShareLinksNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutShareLinksNestedInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigUpdateOneWithoutShareLinksNestedInput
|
||||
activities?: Prisma.ShareActivityUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateWithoutRootFolderInput = {
|
||||
@@ -1016,12 +1267,15 @@ export type ShareLinkUncheckedUpdateWithoutRootFolderInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkConfigId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkCreateManyCreatorInput = {
|
||||
@@ -1034,6 +1288,8 @@ export type ShareLinkCreateManyCreatorInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
@@ -1052,12 +1308,15 @@ export type ShareLinkUpdateWithoutCreatorInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
project?: Prisma.ProjectUpdateOneRequiredWithoutShareLinksNestedInput
|
||||
rootFolder?: Prisma.AssetUpdateOneRequiredWithoutShareLinkRootFolderNestedInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigUpdateOneWithoutShareLinksNestedInput
|
||||
activities?: Prisma.ShareActivityUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateWithoutCreatorInput = {
|
||||
@@ -1070,12 +1329,15 @@ export type ShareLinkUncheckedUpdateWithoutCreatorInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
rootFolderId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
watermarkConfigId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateManyWithoutCreatorInput = {
|
||||
@@ -1088,6 +1350,8 @@ export type ShareLinkUncheckedUpdateManyWithoutCreatorInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1106,6 +1370,8 @@ export type ShareLinkCreateManyProjectInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
rootFolderId: string
|
||||
@@ -1124,12 +1390,15 @@ export type ShareLinkUpdateWithoutProjectInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
rootFolder?: Prisma.AssetUpdateOneRequiredWithoutShareLinkRootFolderNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutShareLinksNestedInput
|
||||
watermarkConfig?: Prisma.WatermarkConfigUpdateOneWithoutShareLinksNestedInput
|
||||
activities?: Prisma.ShareActivityUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateWithoutProjectInput = {
|
||||
@@ -1142,12 +1411,15 @@ export type ShareLinkUncheckedUpdateWithoutProjectInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
rootFolderId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkConfigId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateManyWithoutProjectInput = {
|
||||
@@ -1160,6 +1432,8 @@ export type ShareLinkUncheckedUpdateManyWithoutProjectInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
rootFolderId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1178,6 +1452,8 @@ export type ShareLinkCreateManyWatermarkConfigInput = {
|
||||
defaultSortOrder?: string | null
|
||||
viewMode?: string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: number
|
||||
lastViewedAt?: Date | string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
projectId: string
|
||||
@@ -1196,12 +1472,15 @@ export type ShareLinkUpdateWithoutWatermarkConfigInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
project?: Prisma.ProjectUpdateOneRequiredWithoutShareLinksNestedInput
|
||||
rootFolder?: Prisma.AssetUpdateOneRequiredWithoutShareLinkRootFolderNestedInput
|
||||
creator?: Prisma.UserUpdateOneWithoutShareLinksNestedInput
|
||||
activities?: Prisma.ShareActivityUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateWithoutWatermarkConfigInput = {
|
||||
@@ -1214,12 +1493,15 @@ export type ShareLinkUncheckedUpdateWithoutWatermarkConfigInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
rootFolderId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
creatorId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
watermarkStatus?: Prisma.EnumWatermarkStatusFieldUpdateOperationsInput | $Enums.WatermarkStatus
|
||||
activities?: Prisma.ShareActivityUncheckedUpdateManyWithoutShareLinkNestedInput
|
||||
}
|
||||
|
||||
export type ShareLinkUncheckedUpdateManyWithoutWatermarkConfigInput = {
|
||||
@@ -1232,6 +1514,8 @@ export type ShareLinkUncheckedUpdateManyWithoutWatermarkConfigInput = {
|
||||
defaultSortOrder?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
viewMode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
fieldVisibility?:PrismaJson.ShareLinkFieldVisibility | Prisma.NullableJsonNullValueInput
|
||||
views?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
lastViewedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
projectId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -1241,6 +1525,35 @@ export type ShareLinkUncheckedUpdateManyWithoutWatermarkConfigInput = {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count Type ShareLinkCountOutputType
|
||||
*/
|
||||
|
||||
export type ShareLinkCountOutputType = {
|
||||
activities: number
|
||||
}
|
||||
|
||||
export type ShareLinkCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
activities?: boolean | ShareLinkCountOutputTypeCountActivitiesArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* ShareLinkCountOutputType without action
|
||||
*/
|
||||
export type ShareLinkCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ShareLinkCountOutputType
|
||||
*/
|
||||
select?: Prisma.ShareLinkCountOutputTypeSelect<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* ShareLinkCountOutputType without action
|
||||
*/
|
||||
export type ShareLinkCountOutputTypeCountActivitiesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ShareActivityWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type ShareLinkSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -1252,6 +1565,8 @@ export type ShareLinkSelect<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
defaultSortOrder?: boolean
|
||||
viewMode?: boolean
|
||||
fieldVisibility?: boolean
|
||||
views?: boolean
|
||||
lastViewedAt?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
projectId?: boolean
|
||||
@@ -1263,6 +1578,8 @@ export type ShareLinkSelect<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
rootFolder?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.ShareLink$creatorArgs<ExtArgs>
|
||||
watermarkConfig?: boolean | Prisma.ShareLink$watermarkConfigArgs<ExtArgs>
|
||||
activities?: boolean | Prisma.ShareLink$activitiesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ShareLinkCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["shareLink"]>
|
||||
|
||||
export type ShareLinkSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
@@ -1275,6 +1592,8 @@ export type ShareLinkSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ext
|
||||
defaultSortOrder?: boolean
|
||||
viewMode?: boolean
|
||||
fieldVisibility?: boolean
|
||||
views?: boolean
|
||||
lastViewedAt?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
projectId?: boolean
|
||||
@@ -1298,6 +1617,8 @@ export type ShareLinkSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ext
|
||||
defaultSortOrder?: boolean
|
||||
viewMode?: boolean
|
||||
fieldVisibility?: boolean
|
||||
views?: boolean
|
||||
lastViewedAt?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
projectId?: boolean
|
||||
@@ -1321,6 +1642,8 @@ export type ShareLinkSelectScalar = {
|
||||
defaultSortOrder?: boolean
|
||||
viewMode?: boolean
|
||||
fieldVisibility?: boolean
|
||||
views?: boolean
|
||||
lastViewedAt?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
projectId?: boolean
|
||||
@@ -1330,12 +1653,14 @@ export type ShareLinkSelectScalar = {
|
||||
watermarkStatus?: boolean
|
||||
}
|
||||
|
||||
export type ShareLinkOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "expireAt" | "password" | "isDisabled" | "allowDownload" | "defaultSortOrder" | "viewMode" | "fieldVisibility" | "createdAt" | "updatedAt" | "projectId" | "rootFolderId" | "creatorId" | "watermarkConfigId" | "watermarkStatus", ExtArgs["result"]["shareLink"]>
|
||||
export type ShareLinkOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "expireAt" | "password" | "isDisabled" | "allowDownload" | "defaultSortOrder" | "viewMode" | "fieldVisibility" | "views" | "lastViewedAt" | "createdAt" | "updatedAt" | "projectId" | "rootFolderId" | "creatorId" | "watermarkConfigId" | "watermarkStatus", ExtArgs["result"]["shareLink"]>
|
||||
export type ShareLinkInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
project?: boolean | Prisma.ProjectDefaultArgs<ExtArgs>
|
||||
rootFolder?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
|
||||
creator?: boolean | Prisma.ShareLink$creatorArgs<ExtArgs>
|
||||
watermarkConfig?: boolean | Prisma.ShareLink$watermarkConfigArgs<ExtArgs>
|
||||
activities?: boolean | Prisma.ShareLink$activitiesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ShareLinkCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type ShareLinkIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
project?: boolean | Prisma.ProjectDefaultArgs<ExtArgs>
|
||||
@@ -1357,6 +1682,7 @@ export type $ShareLinkPayload<ExtArgs extends runtime.Types.Extensions.InternalA
|
||||
rootFolder: Prisma.$AssetPayload<ExtArgs>
|
||||
creator: Prisma.$UserPayload<ExtArgs> | null
|
||||
watermarkConfig: Prisma.$WatermarkConfigPayload<ExtArgs> | null
|
||||
activities: Prisma.$ShareActivityPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -1371,6 +1697,8 @@ export type $ShareLinkPayload<ExtArgs extends runtime.Types.Extensions.InternalA
|
||||
* [ShareLinkFieldVisibility]
|
||||
*/
|
||||
fieldVisibility:PrismaJson.ShareLinkFieldVisibility | null
|
||||
views: number
|
||||
lastViewedAt: Date | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
projectId: string
|
||||
@@ -1776,6 +2104,7 @@ export interface Prisma__ShareLinkClient<T, Null = never, ExtArgs extends runtim
|
||||
rootFolder<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.ShareLink$creatorArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ShareLink$creatorArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
watermarkConfig<T extends Prisma.ShareLink$watermarkConfigArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ShareLink$watermarkConfigArgs<ExtArgs>>): Prisma.Prisma__WatermarkConfigClient<runtime.Types.Result.GetResult<Prisma.$WatermarkConfigPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
activities<T extends Prisma.ShareLink$activitiesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ShareLink$activitiesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ShareActivityPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1814,6 +2143,8 @@ export interface ShareLinkFieldRefs {
|
||||
readonly defaultSortOrder: Prisma.FieldRef<"ShareLink", 'String'>
|
||||
readonly viewMode: Prisma.FieldRef<"ShareLink", 'String'>
|
||||
readonly fieldVisibility: Prisma.FieldRef<"ShareLink", 'Json'>
|
||||
readonly views: Prisma.FieldRef<"ShareLink", 'Int'>
|
||||
readonly lastViewedAt: Prisma.FieldRef<"ShareLink", 'DateTime'>
|
||||
readonly createdAt: Prisma.FieldRef<"ShareLink", 'DateTime'>
|
||||
readonly updatedAt: Prisma.FieldRef<"ShareLink", 'DateTime'>
|
||||
readonly projectId: Prisma.FieldRef<"ShareLink", 'String'>
|
||||
@@ -2259,6 +2590,30 @@ export type ShareLink$watermarkConfigArgs<ExtArgs extends runtime.Types.Extensio
|
||||
where?: Prisma.WatermarkConfigWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* ShareLink.activities
|
||||
*/
|
||||
export type ShareLink$activitiesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ShareActivity
|
||||
*/
|
||||
select?: Prisma.ShareActivitySelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ShareActivity
|
||||
*/
|
||||
omit?: Prisma.ShareActivityOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ShareActivityInclude<ExtArgs> | null
|
||||
where?: Prisma.ShareActivityWhereInput
|
||||
orderBy?: Prisma.ShareActivityOrderByWithRelationInput | Prisma.ShareActivityOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ShareActivityWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ShareActivityScalarFieldEnum | Prisma.ShareActivityScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* ShareLink without action
|
||||
*/
|
||||
|
||||
@@ -217,6 +217,10 @@ export class PrismaTestingHelper<
|
||||
return this.proxyClient
|
||||
}
|
||||
|
||||
public getUnderlyingClient(): T {
|
||||
return this.prismaClient
|
||||
}
|
||||
|
||||
public async startNewTransaction(opts?: { timeout?: number; maxWait?: number }): Promise<void> {
|
||||
if (this.endCurrentTransactionPromise != null) {
|
||||
throw new Error(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@shumai/dtos",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"zod": "4.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,9 +238,18 @@ export const createCommentRequestSchema = z.object({
|
||||
annotations: z.any().optional(),
|
||||
second: z.number().optional(),
|
||||
attachmentIds: z.array(z.string()),
|
||||
isInternal: z.boolean().optional(),
|
||||
})
|
||||
export type CreateCommentRequest = z.infer<typeof createCommentRequestSchema>
|
||||
|
||||
export const updateCommentRequestSchema = z.object({
|
||||
message: z.string().optional(),
|
||||
isInternal: z.boolean().optional(),
|
||||
second: z.number().min(0).nullable().optional(),
|
||||
attachmentIds: z.array(z.string()).optional(),
|
||||
})
|
||||
export type UpdateCommentRequest = z.infer<typeof updateCommentRequestSchema>
|
||||
|
||||
export const attachmentInfoSchema = z.object({
|
||||
id: z.string(),
|
||||
assetId: z.string(),
|
||||
@@ -282,6 +291,7 @@ export type CommentInfo = {
|
||||
updatedAt: string
|
||||
sessionId: string | null
|
||||
isCompleted: boolean
|
||||
isInternal: boolean
|
||||
completionLastChangedBy: AssetUserInfo | null
|
||||
reactionCounts: CommentReactionCount[]
|
||||
}
|
||||
@@ -301,6 +311,7 @@ export const commentInfoSchema: z.ZodType<CommentInfo> = z.object({
|
||||
updatedAt: z.string(),
|
||||
sessionId: z.string().nullable(),
|
||||
isCompleted: z.boolean(),
|
||||
isInternal: z.boolean(),
|
||||
completionLastChangedBy: assetUserInfoSchema.nullable(),
|
||||
reactionCounts: z.array(commentReactionCountSchema),
|
||||
})
|
||||
@@ -485,3 +496,18 @@ export type ExportCommentsRequest = z.infer<typeof exportCommentsRequestSchema>
|
||||
export const exportCommentsQuerySchema = exportCommentsRequestSchema
|
||||
/** @deprecated Use ExportCommentsRequest */
|
||||
export type ExportCommentsQuery = ExportCommentsRequest
|
||||
|
||||
export const commentFrameQuerySchema = z.object({
|
||||
second: z.coerce.number().refine((val) => Number.isFinite(val) && val >= 0, {
|
||||
message: 'second must be a non-negative finite number',
|
||||
}),
|
||||
width: z.coerce.number().int().min(64).max(1280).optional().default(400),
|
||||
})
|
||||
export type CommentFrameQuery = z.infer<typeof commentFrameQuerySchema>
|
||||
|
||||
export const printCommentsResponseSchema = z.object({
|
||||
asset: assetInfoSchema,
|
||||
breadcrumbs: z.array(z.string()),
|
||||
comments: z.array(commentInfoSchema),
|
||||
})
|
||||
export type PrintCommentsResponse = z.infer<typeof printCommentsResponseSchema>
|
||||
|
||||
@@ -13,6 +13,10 @@ export const KNOWN_APIS = [
|
||||
'google-vertex',
|
||||
] as const
|
||||
|
||||
const jsonObjectSchema = z
|
||||
.record(z.string(), z.unknown())
|
||||
.refine((value) => z.json().safeParse(value).success)
|
||||
|
||||
// We define a serializable version of ProviderConfig for our API and DB
|
||||
// as the original ProviderConfig interface includes non-serializable fields (functions)
|
||||
export const providerModelConfigSchema = z.object({
|
||||
@@ -21,6 +25,9 @@ export const providerModelConfigSchema = z.object({
|
||||
input: z.array(z.enum(['text', 'image'])).default(['text']),
|
||||
contextWindow: z.number().int().positive().default(128000),
|
||||
maxTokens: z.number().int().positive().default(4096),
|
||||
compat: jsonObjectSchema.optional(),
|
||||
thinkingLevelMap: jsonObjectSchema.optional(),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
cost: z.object({
|
||||
input: z.number().nonnegative().default(0),
|
||||
output: z.number().nonnegative().default(0),
|
||||
@@ -78,60 +85,58 @@ export const updateModelRequestSchema = z.object({
|
||||
|
||||
export type UpdateModelRequest = z.infer<typeof updateModelRequestSchema>
|
||||
|
||||
export const providerRefreshUnavailableReasonSchema = z.enum([
|
||||
'unsupported_connection',
|
||||
'legacy_kimi_connection',
|
||||
'azure_deployment_required',
|
||||
'catalog_unavailable',
|
||||
])
|
||||
|
||||
export type ProviderRefreshUnavailableReason = z.infer<
|
||||
typeof providerRefreshUnavailableReasonSchema
|
||||
>
|
||||
|
||||
export const providerResponseSchema = z.object({
|
||||
id: z.string(),
|
||||
teamId: z.string(),
|
||||
name: z.string(),
|
||||
isBuiltin: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(providerModelSchema).optional(),
|
||||
modelsCount: z.number().optional(),
|
||||
configured: z.boolean(),
|
||||
refreshUnavailableReason: providerRefreshUnavailableReasonSchema.nullable(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
})
|
||||
|
||||
export type ProviderResponse = z.infer<typeof providerResponseSchema>
|
||||
|
||||
export const syncModelItemSchema = z.object({
|
||||
modelId: z.string().min(1),
|
||||
name: z.string().default(''),
|
||||
config: providerModelConfigSchema,
|
||||
export const refreshedProviderModelSchema = createModelRequestSchema.pick({
|
||||
modelId: true,
|
||||
name: true,
|
||||
config: true,
|
||||
})
|
||||
|
||||
export type SyncModelItem = z.infer<typeof syncModelItemSchema>
|
||||
export type RefreshedProviderModel = z.infer<typeof refreshedProviderModelSchema>
|
||||
|
||||
export const syncProviderItemSchema = z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
export const providerModelRefreshResponseSchema = z.discriminatedUnion('status', [
|
||||
z.object({
|
||||
status: z.literal('ready'),
|
||||
providerUpdatedAt: z.iso.datetime(),
|
||||
models: z.array(refreshedProviderModelSchema),
|
||||
}),
|
||||
z.object({
|
||||
status: z.literal('unavailable'),
|
||||
reason: providerRefreshUnavailableReasonSchema,
|
||||
}),
|
||||
])
|
||||
|
||||
export type ProviderModelRefreshResponse = z.infer<typeof providerModelRefreshResponseSchema>
|
||||
|
||||
export const importProviderModelsRequestSchema = z.object({
|
||||
providerUpdatedAt: z.iso.datetime(),
|
||||
modelIds: z.array(z.string().min(1)).min(1),
|
||||
})
|
||||
|
||||
export type SyncProviderItem = z.infer<typeof syncProviderItemSchema>
|
||||
|
||||
export const syncCheckResponseSchema = z.object({
|
||||
providers: z.array(syncProviderItemSchema),
|
||||
totalNewProviders: z.number(),
|
||||
totalNewModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncCheckResponse = z.infer<typeof syncCheckResponseSchema>
|
||||
|
||||
export const syncApplyRequestSchema = z.object({
|
||||
providers: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
}),
|
||||
),
|
||||
})
|
||||
|
||||
export type SyncApplyRequest = z.infer<typeof syncApplyRequestSchema>
|
||||
|
||||
export const syncApplyResponseSchema = z.object({
|
||||
addedProviders: z.number(),
|
||||
addedModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncApplyResponse = z.infer<typeof syncApplyResponseSchema>
|
||||
export type ImportProviderModelsRequest = z.infer<typeof importProviderModelsRequestSchema>
|
||||
|
||||
@@ -16,6 +16,8 @@ export interface ShareLinkInfo {
|
||||
rootFolderId: string
|
||||
projectId: string
|
||||
isExpired: boolean
|
||||
views: number
|
||||
lastViewedAt: string | null
|
||||
watermarkConfigId?: string | null
|
||||
watermarkStatus?: 'disabled' | 'processing' | 'ready' | 'failed'
|
||||
watermarkConfig?: {
|
||||
@@ -28,6 +30,22 @@ export interface ShareLinkInfo {
|
||||
creator?: { id: string; name: string; image?: string | null } | null
|
||||
}
|
||||
|
||||
export type ShareActivityKind =
|
||||
'share_viewed' | 'asset_viewed' | 'asset_downloaded' | 'comment_created'
|
||||
|
||||
export interface ShareActivityInfo {
|
||||
id: string
|
||||
kind: ShareActivityKind
|
||||
createdAt: string
|
||||
user: { name: string; image?: string } | null
|
||||
asset: { id: string; name: string | null } | null
|
||||
}
|
||||
|
||||
export const recordShareViewRequestSchema = z.object({
|
||||
assetId: z.string().min(1).optional(),
|
||||
isShareEntry: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const createShareLinkRequestSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
expireAt: z.string().datetime().optional(),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@shumai/e2e",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-ai": "1.5.0",
|
||||
"@earendil-works/pi-durable": "1.5.0",
|
||||
"@earendil-works/pi-ai": "1.7.0",
|
||||
"@earendil-works/pi-durable": "1.7.0",
|
||||
"@google/genai": "2.28.0",
|
||||
"@shumai/agent": "workspace:*",
|
||||
"@shumai/core": "workspace:*",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/operations",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -22,11 +22,18 @@ export const createComment = defineOperation({
|
||||
.min(0)
|
||||
.optional()
|
||||
.describe('Timecode in seconds on a video or audio file. Omit for other files.'),
|
||||
isInternal: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe(
|
||||
'Whether this is an internal comment hidden from public share links. Defaults to false.',
|
||||
),
|
||||
}),
|
||||
output: z.object({
|
||||
id: z.string().describe('The new comment ID.'),
|
||||
assetId: z.string().describe('The file the comment is on (the latest version for a stack).'),
|
||||
replyToId: z.string().nullable().describe('The thread it replies to, if any.'),
|
||||
isInternal: z.boolean().describe('Whether the created comment is internal.'),
|
||||
}),
|
||||
surfaces: ['agent', 'mcp', 'cli'],
|
||||
annotations: { readOnly: false, destructive: false },
|
||||
@@ -34,7 +41,7 @@ export const createComment = defineOperation({
|
||||
command: ['comment', 'add'],
|
||||
description: 'Comment on a file, or reply to a comment with --reply-to.',
|
||||
positional: ['assetId', 'message'],
|
||||
flags: { replyToId: ['--reply-to'], second: ['-t', '--at'] },
|
||||
flags: { replyToId: ['--reply-to'], second: ['-t', '--at'], isInternal: ['--internal'] },
|
||||
format: (output) => `Posted comment ${output.id}`,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -16,6 +16,9 @@ const commentFields = {
|
||||
/** Whether markup was drawn on the frame or page. */
|
||||
hasMarkup: z.boolean(),
|
||||
attachmentCount: z.number(),
|
||||
isInternal: z
|
||||
.boolean()
|
||||
.describe('Whether this comment is internal (hidden from public share links).'),
|
||||
createdAt: z.string(),
|
||||
}
|
||||
|
||||
@@ -68,9 +71,13 @@ export const listComments = defineOperation({
|
||||
for (const thread of output.data) {
|
||||
const at = thread.second !== null ? ` @${thread.second}s` : ''
|
||||
const status = thread.resolved ? ' [resolved]' : ''
|
||||
lines.push(`${thread.id}${at}${status} ${thread.author.name}: ${thread.message}`)
|
||||
const visibility = thread.isInternal ? ' [internal]' : ''
|
||||
lines.push(
|
||||
`${thread.id}${at}${status}${visibility} ${thread.author.name}: ${thread.message}`,
|
||||
)
|
||||
for (const reply of thread.replies) {
|
||||
lines.push(` ↳ ${reply.id} ${reply.author.name}: ${reply.message}`)
|
||||
const replyVisibility = reply.isInternal ? ' [internal]' : ''
|
||||
lines.push(` ↳ ${reply.id}${replyVisibility} ${reply.author.name}: ${reply.message}`)
|
||||
}
|
||||
}
|
||||
return lines.join('\n')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/tableprinter",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@shumai/transcode",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { client } from './client'
|
||||
|
||||
export function requestShareDownload(
|
||||
shareId: string,
|
||||
fileId: string,
|
||||
key: string,
|
||||
purpose?: 'download' | 'prepare' | 'clipboard',
|
||||
) {
|
||||
const password = localStorage.getItem(`share_pwd_${shareId}`)
|
||||
const postDownload = client.api.shares[':shareId'].files[':fileId']['download-url'].$post
|
||||
const input = { param: { shareId, fileId }, json: { key, purpose } }
|
||||
return password
|
||||
? postDownload(input, { headers: { 'x-share-password': password } })
|
||||
: postDownload(input)
|
||||
}
|
||||
@@ -392,4 +392,105 @@ describe('BreadcrumbNav component', () => {
|
||||
expect(screen.queryByText('Archived')).toBeNull()
|
||||
expect(screen.queryByText('已归档')).toBeNull()
|
||||
})
|
||||
|
||||
it('renders Create Share Link and Add to Share Links at top of dropdown above Download for editors', () => {
|
||||
const editorQueryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
})
|
||||
editorQueryClient.setQueryData(['projects', 'proj-1', 'me'], { role: 'owner' })
|
||||
const onCreateShareLink = vi.fn()
|
||||
const onAddToShareLink = vi.fn()
|
||||
|
||||
render(
|
||||
<QueryClientProvider client={editorQueryClient}>
|
||||
<BreadcrumbNav
|
||||
{...baseProps}
|
||||
fileId="file-share"
|
||||
currentAsset={{ id: 'file-share', name: 'review.mp4', type: 'file', version: 1 }}
|
||||
allowDownload={true}
|
||||
downloadInfo={{ originalKey: 'review.mp4' }}
|
||||
shareLinks={[
|
||||
{
|
||||
id: 'share-1',
|
||||
name: 'Client Cut',
|
||||
isDisabled: false,
|
||||
allowDownload: true,
|
||||
hasPassword: false,
|
||||
rootFolderId: 'rf-1',
|
||||
projectId: 'proj-1',
|
||||
isExpired: false,
|
||||
views: 0,
|
||||
lastViewedAt: null,
|
||||
createdAt: '2026-11-24T00:00:00.000Z',
|
||||
updatedAt: '2026-11-24T00:00:00.000Z',
|
||||
},
|
||||
]}
|
||||
onCreateShareLink={onCreateShareLink}
|
||||
onAddToShareLink={onAddToShareLink}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
const triggerButton = screen.getByRole('button', { name: 'review.mp4' })
|
||||
fireEvent.pointerDown(triggerButton, { button: 0, ctrlKey: false })
|
||||
|
||||
const items = screen.getAllByRole('menuitem')
|
||||
expect(items[0].textContent).toContain('Create Share Link')
|
||||
expect(items[1].textContent).toContain('Add to Share Links')
|
||||
expect(items[2].textContent).toContain('Download')
|
||||
|
||||
fireEvent.click(items[0])
|
||||
expect(onCreateShareLink).toHaveBeenCalledTimes(1)
|
||||
|
||||
fireEvent.pointerDown(triggerButton, { button: 0, ctrlKey: false })
|
||||
fireEvent.click(screen.getByText('Add to Share Links'))
|
||||
fireEvent.click(screen.getByText('Client Cut'))
|
||||
expect(onAddToShareLink).toHaveBeenCalledWith('share-1')
|
||||
})
|
||||
|
||||
it('hides share link options when public or when user lacks edit permission', () => {
|
||||
const reviewerQueryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
})
|
||||
reviewerQueryClient.setQueryData(['projects', 'proj-1', 'me'], { role: 'reviewer' })
|
||||
|
||||
const { rerender } = render(
|
||||
<QueryClientProvider client={reviewerQueryClient}>
|
||||
<BreadcrumbNav
|
||||
{...baseProps}
|
||||
fileId="file-share"
|
||||
currentAsset={{ id: 'file-share', name: 'review.mp4', type: 'file' }}
|
||||
onCreateShareLink={vi.fn()}
|
||||
onAddToShareLink={vi.fn()}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
fireEvent.pointerDown(screen.getByRole('button', { name: 'review.mp4' }), {
|
||||
button: 0,
|
||||
ctrlKey: false,
|
||||
})
|
||||
expect(screen.queryByText('Create Share Link')).toBeNull()
|
||||
expect(screen.queryByText('Add to Share Links')).toBeNull()
|
||||
|
||||
const ownerQueryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
})
|
||||
ownerQueryClient.setQueryData(['projects', 'proj-1', 'me'], { role: 'owner' })
|
||||
|
||||
rerender(
|
||||
<QueryClientProvider client={ownerQueryClient}>
|
||||
<BreadcrumbNav
|
||||
{...baseProps}
|
||||
isPublic={true}
|
||||
fileId="file-share"
|
||||
currentAsset={{ id: 'file-share', name: 'review.mp4', type: 'file' }}
|
||||
onCreateShareLink={vi.fn()}
|
||||
onAddToShareLink={vi.fn()}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
expect(screen.queryByText('Create Share Link')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import { requestShareDownload } from '@/ui/api/share-download'
|
||||
import { Badge } from '@/ui/components/ui/badge'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
@@ -29,7 +30,7 @@ import {
|
||||
import { usePermissions } from '@/ui/hooks/use-permissions'
|
||||
import { cn } from '@/ui/lib/utils'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import type { AncestorFolder } from '@shumai/dtos'
|
||||
import type { AncestorFolder, ShareLinkInfo } from '@shumai/dtos'
|
||||
import { Link, useNavigate } from '@tanstack/react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import {
|
||||
@@ -84,6 +85,10 @@ interface BreadcrumbNavProps {
|
||||
onDelete?: () => void
|
||||
onArchive?: () => void
|
||||
onRestoreArchive?: () => void
|
||||
shareLinks?: ShareLinkInfo[]
|
||||
onCreateShareLink?: () => void
|
||||
onAddToShareLink?: (shareId: string) => void
|
||||
isShareActionPending?: boolean
|
||||
fileId?: string
|
||||
downloadInfo?: {
|
||||
originalKey?: string
|
||||
@@ -131,6 +136,10 @@ export function BreadcrumbNav({
|
||||
onDelete,
|
||||
onArchive,
|
||||
onRestoreArchive,
|
||||
shareLinks,
|
||||
onCreateShareLink,
|
||||
onAddToShareLink,
|
||||
isShareActionPending = false,
|
||||
fileId,
|
||||
shareId,
|
||||
allowDownload = true,
|
||||
@@ -198,10 +207,7 @@ export function BreadcrumbNav({
|
||||
if (!fileId) return
|
||||
try {
|
||||
const res = shareId
|
||||
? await client.api.shares[':shareId'].files[':fileId']['download-url'].$post({
|
||||
param: { shareId, fileId },
|
||||
json: { key },
|
||||
})
|
||||
? await requestShareDownload(shareId, fileId, key)
|
||||
: await client.api.files['download-url'].$post({
|
||||
json: { key, assetId: fileId },
|
||||
})
|
||||
@@ -318,6 +324,31 @@ export function BreadcrumbNav({
|
||||
</DropdownMenuTrigger>
|
||||
</div>
|
||||
<DropdownMenuContent className="w-56" align="center">
|
||||
{canEdit && !isPublic && onCreateShareLink && (
|
||||
<>
|
||||
<DropdownMenuItem onClick={onCreateShareLink} disabled={isShareActionPending}>
|
||||
{m.create_share_link()}
|
||||
</DropdownMenuItem>
|
||||
{shareLinks && shareLinks.length > 0 && onAddToShareLink && (
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>{m.add_to_share_links()}</DropdownMenuSubTrigger>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuSubContent className="w-52">
|
||||
{shareLinks.map((share) => (
|
||||
<DropdownMenuItem
|
||||
key={share.id}
|
||||
disabled={isShareActionPending}
|
||||
onClick={() => onAddToShareLink(share.id)}
|
||||
>
|
||||
<span className="truncate">{share.name}</span>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuPortal>
|
||||
</DropdownMenuSub>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{allowDownload &&
|
||||
(hasVideoTranscodes ? (
|
||||
<DropdownMenuSub>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user