File tree Expand file tree Collapse file tree
apps/sim/lib/workspace-files/application Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,17 +7,15 @@ import {
77 deleteWorkspaceFile ,
88} from '@/lib/uploads/contexts/workspace/file-manager'
99import { defineAuthorizedWorkspaceFileUseCase } from '@/lib/workspace-files/application/authorized-workspace-file-use-case'
10- import { resolveActiveWorkspaceFileContext } from '@/lib/workspace-files/application/file-context'
10+ import {
11+ resolveActiveWorkspaceFileContext ,
12+ type WorkspaceFileReferenceInput ,
13+ } from '@/lib/workspace-files/application/file-context'
1114import { fileOperations } from '@/lib/workspace-files/application/operations'
1215
1316const logger = createLogger ( 'DeleteWorkspaceFile' )
1417
15- export interface DeleteWorkspaceFileInput {
16- fileId : string
17- assertedWorkspaceId ?: string
18- /** Accept the file's exact `files/…` VFS path as `fileId` (the public v2 surface). */
19- acceptVfsPath ?: boolean
20- }
18+ export type DeleteWorkspaceFileInput = WorkspaceFileReferenceInput
2119
2220export interface DeleteWorkspaceFileResult {
2321 id : string
Original file line number Diff line number Diff line change @@ -12,15 +12,19 @@ import { isWorkspaceFileVfsPath } from '@/lib/vfs/path'
1212import { ownedFileKind } from '@/lib/workspace-files/owned-files'
1313import { matchesFileOwner } from '@/lib/workspace-files/ownership'
1414
15- export interface WorkspaceFileContextInput {
15+ /** How a use case names one workspace file: its id, or with `acceptVfsPath` its exact VFS path. */
16+ export interface WorkspaceFileReferenceInput {
1617 fileId : string
18+ assertedWorkspaceId ?: string
1719 /**
1820 * Also accept the file's exact `files/…` VFS path as `fileId`, resolved inside
1921 * `assertedWorkspaceId` to a live workspace file. Only the public v2 surface sets it; every
2022 * other caller passes ids, and a path-shaped string there stays an unknown id.
2123 */
2224 acceptVfsPath ?: boolean
23- assertedWorkspaceId ?: string
25+ }
26+
27+ export interface WorkspaceFileContextInput extends WorkspaceFileReferenceInput {
2428 includeDeleted ?: boolean
2529 /**
2630 * Admit a chat upload (`context = 'mothership'`) addressed by its own id. Only read
Original file line number Diff line number Diff line change @@ -11,14 +11,13 @@ import {
1111 type WorkspaceFileRecord ,
1212} from '@/lib/uploads/contexts/workspace/file-manager'
1313import { defineAuthorizedWorkspaceFileUseCase } from '@/lib/workspace-files/application/authorized-workspace-file-use-case'
14- import { resolveActiveWorkspaceFileContext } from '@/lib/workspace-files/application/file-context'
14+ import {
15+ resolveActiveWorkspaceFileContext ,
16+ type WorkspaceFileReferenceInput ,
17+ } from '@/lib/workspace-files/application/file-context'
1518import { fileOperations } from '@/lib/workspace-files/application/operations'
1619
17- export interface ReadWorkspaceFileMetadataInput {
18- fileId : string
19- assertedWorkspaceId ?: string
20- /** Accept the file's exact `files/…` VFS path as `fileId` (the public v2 surface). */
21- acceptVfsPath ?: boolean
20+ export interface ReadWorkspaceFileMetadataInput extends WorkspaceFileReferenceInput {
2221 /**
2322 * Opt into the archived lifecycle set. It relaxes only the `deleted_at` predicate on the
2423 * canonical row lookup — the workspace the file resolves to, the asserted-workspace check,
Original file line number Diff line number Diff line change @@ -8,16 +8,15 @@ import {
88 type WorkspaceFileRecord ,
99} from '@/lib/uploads/contexts/workspace/file-manager'
1010import { defineAuthorizedWorkspaceFileUseCase } from '@/lib/workspace-files/application/authorized-workspace-file-use-case'
11- import { resolveActiveWorkspaceFileContext } from '@/lib/workspace-files/application/file-context'
11+ import {
12+ resolveActiveWorkspaceFileContext ,
13+ type WorkspaceFileReferenceInput ,
14+ } from '@/lib/workspace-files/application/file-context'
1215import { fileOperations } from '@/lib/workspace-files/application/operations'
1316
1417const logger = createLogger ( 'RenameWorkspaceFile' )
1518
16- export interface RenameWorkspaceFileInput {
17- fileId : string
18- assertedWorkspaceId ?: string
19- /** Accept the file's exact `files/…` VFS path as `fileId` (the public v2 surface). */
20- acceptVfsPath ?: boolean
19+ export interface RenameWorkspaceFileInput extends WorkspaceFileReferenceInput {
2120 name : string
2221}
2322
You can’t perform that action at this time.
0 commit comments