Skip to content
scroll to zoom · drag to pan

AssetDTO

type AssetDTO = {
assetId?: string;
blur?: string | null;
bytes: number;
deletedAt?: string | null;
dur?: number | null;
h?: number | null;
id: string;
kind: "image" | "video" | "document" | "audio" | "other";
mime: string;
oext?: string | null;
palette?: | AssetPalette
| null;
presets: string;
sha: string;
status: "processing" | "ready" | "failed";
variants?: AssetVariant[];
visibility?: "public" | "private";
w?: number | null;
};

Defined in: packages/asset-client/src/index.ts:379

Compact wire shape — what the server actually sends. Aliases (w, h, dur) are intentional to shave bytes per asset on dense lists.

optional assetId?: string;

Defined in: packages/asset-client/src/index.ts:389

⭐ The same value as id, under the name the WRITE side uses.

upload() returns assetId; the read endpoints returned only id, so what assets.byHash() handed back could not be fed to assets.get() without renaming a field. Optional here because a DTO produced by an older server will not carry it — read dto.assetId ?? dto.id.


optional blur?: string | null;

Defined in: packages/asset-client/src/index.ts:401

LQIP placeholder (data URL).


bytes: number;

Defined in: packages/asset-client/src/index.ts:394


optional deletedAt?: string | null;

Defined in: packages/asset-client/src/index.ts:428

Soft-delete timestamp (ISO). Hidden from catalog when set.


optional dur?: number | null;

Defined in: packages/asset-client/src/index.ts:399

Duration ms for videos.


optional h?: number | null;

Defined in: packages/asset-client/src/index.ts:397


id: string;

Defined in: packages/asset-client/src/index.ts:380


kind: "image" | "video" | "document" | "audio" | "other";

Defined in: packages/asset-client/src/index.ts:392


mime: string;

Defined in: packages/asset-client/src/index.ts:393


optional oext?: string | null;

Defined in: packages/asset-client/src/index.ts:441

The extension the original variant was really stored under — the server keys it off the uploaded filename, so it cannot be derived from mime. Sent by GET /assets/:id; null when the asset has no original. getAssetUrl uses it automatically when you pass the whole DTO.


optional palette?:
| AssetPalette
| null;

Defined in: packages/asset-client/src/index.ts:402


presets: string;

Defined in: packages/asset-client/src/index.ts:408

Compact list of generated variants as their 1-char codes concatenated, e.g. “tcwh” (image) / “pv” (video without aiproxy). Ordered by ascending dimension.


sha: string;

Defined in: packages/asset-client/src/index.ts:391

First 16 hex chars of sha256 — used to derive CDN URLs.


status: "processing" | "ready" | "failed";

Defined in: packages/asset-client/src/index.ts:409


optional variants?: AssetVariant[];

Defined in: packages/asset-client/src/index.ts:434

Full variant list with URLs + sizes. Sent by GET /assets/:id; absent on the slim list shape used by the resolver / catalog. Use presets for compact existence checks, and this when you need the actual URLs.


optional visibility?: "public" | "private";

Defined in: packages/asset-client/src/index.ts:426

Who may fetch the bytes.

  • "public" — the CDN serves it to anyone with the URL. The default, and what all 27 484 assets were until this field existed.
  • "private" — every public door answers 404: the stored variants, the raw original, the HLS ladder and /t/. The bytes are reachable only through a signed URL under /a/{tenant}/…?exp&sig, which your BACKEND mints with getPrivateAssetUrl.

Optional so an older server that does not send it is read as "public" — which is what such a server means.

⚠️ A 404 on a private asset is not a missing file. It is the feature working. See getPrivateAssetUrl.


optional w?: number | null;

Defined in: packages/asset-client/src/index.ts:396

Source dims (for aspect-ratio calc on the client). Optional for non-images.