Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tailor-platform/function-types",
"version": "0.7.2",
"version": "0.8.0",
"description": "TypeScript types for Tailor Platform Function service",
"repository": {
"type": "git",
Expand Down
27 changes: 26 additions & 1 deletion packages/types/tailor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ declare namespace tailor.iconv {
*/
declare class TailorDBFileError extends Error {
name: 'TailorDBFileError';
code?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR';
code?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR' | 'FILE_TOO_LARGE';
cause?: unknown;
}

Expand All @@ -135,6 +135,8 @@ interface UploadMetadata {
interface DownloadMetadata {
contentType: string;
fileSize: number;
sha256sum: string;
lastUploadedAt: string;
}

/**
Expand Down Expand Up @@ -179,6 +181,14 @@ interface FileDownloadResponse {
metadata: DownloadMetadata;
}

/**
* Download as Base64 response interface
*/
interface FileDownloadAsBase64Response {
data: string;
metadata: DownloadMetadata;
}

/**
* Stream chunk types
*/
Expand Down Expand Up @@ -213,6 +223,7 @@ interface TailorDBFileAPI {

/**
* Download a file from TailorDB
* @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
*/
download(
namespace: string,
Expand All @@ -221,6 +232,20 @@ interface TailorDBFileAPI {
recordId: string
): Promise<FileDownloadResponse>;

/**
* Download a file from TailorDB as Base64 string
* Unlike download which returns decoded binary data (Uint8Array),
* this returns the raw Base64-encoded string for use cases requiring
* Base64 format (e.g., embedding in JSON responses, data URIs)
* @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
*/
downloadAsBase64(
namespace: string,
typeName: string,
fieldName: string,
recordId: string
): Promise<FileDownloadAsBase64Response>;

/**
* Delete a file from TailorDB
*/
Expand Down