Nurama Developers
Namespaces

scratch

Methods and types of the `scratch` namespace (`client.scratch` / `bot.scratch`).

Interfaces

CompleteUploadBody

Properties

PropertyType
parts{ ETag: string; PartNumber: number; }[]
uploadIdstring

CompleteUploadResponse

Properties

PropertyType
idstring
urlstring | null

PromoteBody

Properties

PropertyTypeDescription
fileName?stringOptional rename — lands on Asset.name. Defaults to a row-id-derived name.

PromoteResponse

Properties

PropertyTypeDescription
alreadyPromotedbooleantrue when the scratch row was already promoted on a prior call (e.g. the same revision was Attached-to-chat earlier and the chat-send pipeline ran the promote synchronously). The returned asset is the existing one. The FE should treat this as a no-op for "newly added" UX (toast copy, list-refresh side effects) while still surfacing the asset.
assetunknown-

Functions

default()

function default(client): {
  completeUpload: Promise<CompleteUploadResponse>;
  promote: Promise<PromoteResponse>;
};

Scratch — platform-wide temporary object-storage with explicit lifecycle.

There is NO public surface for creating scratch rows or minting upload URLs. Parent processes (e.g. AI Revision) initiate the multipart upload server-side and return the { scratchId, uploadId, key, urls[] } bundle in their own response payload. The FE uploads each part directly against its signed URL (same pattern as asset uploads), then calls completeUpload here to finalise.

completeUpload mirrors nuramaClient.asset.completeUpload: the body is the same { uploadId, parts } shape, the server runs the S3-compatible CompleteMultipartUploadCommand, and (for scratch specifically) HEADs the resulting object, increments workspace storage usage, and writes the audit row.

Parameters

ParameterType
clientdefault

Returns

NameTypeDescription
completeUpload()(scratchId, data) => Promise<CompleteUploadResponse>Finish a multipart upload for a scratch row. Same { uploadId, parts } body the asset complete-upload route accepts. Server runs CompleteMultipartUploadCommand against the media bucket, HEADs the object for size, increments workspace storage usage, writes the audit row, and flips status pendingUpload → active. Creator-only.
promote()(scratchId, data?) => Promise<PromoteResponse>Promote a scratch row to a real Asset. Creator-only — only the user who created the scratch row can call this. Destination is derived server-side from the row itself: - row has projectId → asset created in that project - row has only workspace → asset created at the workspace No body fields for destination on purpose: the FE doesn't get to claim a scratch belongs to a different workspace / project. The only optional input is fileName to override the asset's user-facing name.

On this page