62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import {
|
|
FileUploadConvertedStatus,
|
|
FileUploadRecord,
|
|
FileUploadRecordV2
|
|
} from '@/modules/fileuploads/helpers/types'
|
|
import { Optional } from '@speckle/shared'
|
|
import { FileImportResultPayload } from '@speckle/shared/dist/commonjs/workers/fileimport/job.js'
|
|
import { JobFileImportPayload } from '@/modules/fileuploads/queues/fileimports'
|
|
import { UploadResult } from '@/modules/blobstorage/domain/types'
|
|
|
|
export type GetFileInfo = (args: {
|
|
fileId: string
|
|
}) => Promise<Optional<FileUploadRecord>>
|
|
|
|
export type SaveUploadFileInput = Pick<
|
|
FileUploadRecord,
|
|
'streamId' | 'branchName' | 'userId' | 'fileName' | 'fileType' | 'fileSize'
|
|
> & { fileId: string }
|
|
|
|
export type SaveUploadFileInputV2 = Pick<
|
|
FileUploadRecordV2,
|
|
'projectId' | 'userId' | 'fileName' | 'fileType' | 'fileSize'
|
|
> & { fileId: string; modelId: string; modelName: string }
|
|
|
|
export type SaveUploadFile = (args: SaveUploadFileInput) => Promise<FileUploadRecord>
|
|
|
|
export type InsertNewUploadAndNotify = (
|
|
uploadResults: SaveUploadFileInputV2
|
|
) => Promise<void>
|
|
|
|
export type SaveUploadFileV2 = (
|
|
args: SaveUploadFileInputV2
|
|
) => Promise<FileUploadRecordV2>
|
|
|
|
export type GarbageCollectPendingUploadedFiles = (args: {
|
|
timeoutThresholdSeconds: number
|
|
}) => Promise<FileUploadRecord[]>
|
|
|
|
export type NotifyChangeInFileStatus = (params: {
|
|
file: FileUploadRecord
|
|
}) => Promise<void>
|
|
|
|
export type ProcessFileImportResult = (params: {
|
|
jobId: string
|
|
jobResult: FileImportResultPayload
|
|
}) => Promise<void>
|
|
|
|
export type UpdateFileStatus = (params: {
|
|
fileId: string
|
|
status: FileUploadConvertedStatus
|
|
convertedMessage: string
|
|
}) => Promise<FileUploadRecord>
|
|
|
|
export type UploadedFile = UploadResult & { userId: string }
|
|
|
|
export type FileImportMessage = Pick<
|
|
JobFileImportPayload,
|
|
'modelId' | 'projectId' | 'fileType' | 'blobId'
|
|
> & { jobId: string; userId: string }
|
|
|
|
export type PushJobToFileImporter = (args: FileImportMessage) => Promise<void>
|