import { BlobStorageItem, BlobStorageItemInput } from '@/modules/blobstorage/domain/types' import { MaybeNullOrUndefined, Nullable, Optional } from '@speckle/shared' import { BlobUploadStatus } from '@speckle/shared/blobs' import type { Readable } from 'stream' import { StoreFileStream } from '@/modules/blobstorage/domain/storageOperations' export type GetBlob = (params: { streamId: string blobId: string }) => Promise> export type GetBlobs = (params: { streamId?: MaybeNullOrUndefined blobIds: string[] }) => Promise export type UpsertBlob = (item: BlobStorageItemInput) => Promise export type UpdateBlob = (params: { id: string item: Partial filter?: { streamId?: string uploadStatus?: BlobUploadStatus } }) => Promise export type DeleteBlob = (params: { id: string; streamId?: string }) => Promise export type FullyDeleteBlob = (params: { blobId: string streamId: string }) => Promise export type GetBlobMetadata = (params: { blobId: string streamId: string }) => Promise export type GetBlobMetadataCollection = (params: { streamId: string query?: Nullable limit?: Nullable cursor?: Nullable }) => Promise<{ blobs: BlobStorageItem[]; cursor: Nullable }> export type UploadFileStream = ( streamData: { streamId: string userId: string | undefined }, blobData: { blobId: string fileName: string fileType: string | undefined fileStream: Readable | Buffer } ) => Promise<{ blobId: string; fileName: string; fileHash: string }> export { StoreFileStream } export type GeneratePresignedUrl = (params: { projectId: string userId: string blobId: string fileName: string urlExpiryDurationSeconds: number }) => Promise export type GetSignedUrl = (params: { objectKey: string urlExpiryDurationSeconds: number }) => Promise export type GetBlobMetadataFromStorage = (params: { objectKey: string }) => Promise<{ eTag: Optional; contentLength: Optional }> export type RegisterCompletedUpload = (params: { projectId: string blobId: string expectedETag: string maximumFileSize: number }) => Promise export type ExpirePendingUploads = (params: { timeoutThresholdSeconds: number errMessage: string }) => Promise