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/dist/index.d.ts:975

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/dist/index.d.ts:985

⭐ 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/dist/index.d.ts:997

LQIP placeholder (data URL).


bytes: number;

Defined in: packages/asset-client/dist/index.d.ts:990


optional deletedAt?: string | null;

Defined in: packages/asset-client/dist/index.d.ts:1024

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


optional dur?: number | null;

Defined in: packages/asset-client/dist/index.d.ts:995

Duration ms for videos.


optional h?: number | null;

Defined in: packages/asset-client/dist/index.d.ts:993


id: string;

Defined in: packages/asset-client/dist/index.d.ts:976


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

Defined in: packages/asset-client/dist/index.d.ts:988


mime: string;

Defined in: packages/asset-client/dist/index.d.ts:989


optional oext?: string | null;

Defined in: packages/asset-client/dist/index.d.ts:1037

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/dist/index.d.ts:998


presets: string;

Defined in: packages/asset-client/dist/index.d.ts:1004

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/dist/index.d.ts:987

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


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

Defined in: packages/asset-client/dist/index.d.ts:1005


optional variants?: AssetVariant[];

Defined in: packages/asset-client/dist/index.d.ts:1030

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/dist/index.d.ts:1022

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/dist/index.d.ts:992

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