@segmentstream/app/storage
10 public exports from @segmentstream/app/storage.
Public exports
BlobUploadTicket
interface BlobUploadTicket {
readonly uploadId: string;
}FileDownloadOptions
interface FileDownloadOptions {
readonly revisionId?: string;
readonly inline?: boolean;
readonly signal?: AbortSignal;
}FileRevision
interface FileRevision {
readonly id: string;
readonly filename: string;
readonly contentType: string;
readonly size: number;
readonly createdAt: string;
}FileTransfer
interface FileTransfer {
readonly url: string;
readonly method: "GET" | "PUT";
readonly headers: Readonly<Record<string, string>>;
readonly expiresAt: string;
}FileUploadOptions
interface FileUploadOptions {
readonly signal?: AbortSignal;
readonly idempotencyKey?: string;
readonly onProgress?: (transferred: number, total: number) => void;
readonly onSession?: (session: UploadSession) => void;
}FileUploadTarget
interface FileUploadTarget {
readonly entity: string;
readonly property: string;
readonly action: string;
readonly recordId?: string;
readonly createIntent?: string;
}OpenUploadSession
interface OpenUploadSession extends UploadSession {
readonly filename: string;
readonly contentType: string;
readonly size: number;
readonly entity: string;
readonly property: string;
readonly action: string;
readonly recordId: string | null;
readonly createIntent: string | null;
readonly createdAt: string;
readonly awaitingAction: boolean;
}OpenUploadSessions
interface OpenUploadSessions {
readonly uploads: ReadonlyArray<OpenUploadSession>;
readonly pending: number;
readonly max: number;
}UploadSession
interface UploadSession {
readonly id: string;
readonly state: string;
readonly expiresAt: string;
readonly ticket?: BlobUploadTicket;
}createBlobStorageClient
Portable client: ontology requests use the member transport; bytes use only a scoped grant.
function createBlobStorageClient(transport: OntologyTransport, transfer?: typeof fetch): {
list(signal?: AbortSignal): Promise<OpenUploadSessions>;
status: (id: string, signal?: AbortSignal) => Promise<UploadSession>;
cancel: (id: string) => Promise<UploadSession>;
uploadForAction(target: FileUploadTarget, file: File, options?: FileUploadOptions): Promise<{
upload: UploadSession;
ticket: BlobUploadTicket;
options: {
createIntent?: string | undefined;
idempotencyKey: string;
};
}>;
download(entity: string, recordId: string, property: string, options?: FileDownloadOptions): Promise<FileTransfer>;
};