mcut
@mcut/timeline

applyCommand

Generated TypeScript API reference for the public mcut SDK.

mcut SDK


mcut SDK / timeline/src / applyCommand

Function: applyCommand()

function applyCommand(project, command): object;

Defined in: packages/timeline/src/commands.ts:128

Validate and apply a command to a project. Pure: returns a new project, never mutates. Throws CommandError on unknown commands, invalid payloads, or violated invariants (unknown ids, overlapping elements, ...).

Parameters

project

assets

Record<string, { durationMs?: number; hash?: string; height?: number; id: `a-${string}`; kind: "video" | "audio" | "image"; mimeType?: string; name?: string; nativePreview?: boolean; src: string; width?: number; }> = ...

fps

number = ...

height

number = ...

id

string = ...

layouts

object[] = ...

Multicam layout templates this project references. See layouts.ts.

markers

object[] = ...

Timeline markers, sorted by timeMs (the commands keep them sorted).

name

string = ...

presets

object[] = ...

Named inspector value bundles (style presets). See presets.ts.

tracks

object[] = ...

Render order: index 0 is painted first (bottom); last is topmost.

version

1 = ...

Project format version (see migrations.ts). parseProject migrates older documents before validating; the default covers in-memory creation.

width

number = ...

command

AnyCommand

Returns

assets

assets: Record<string, {
  durationMs?: number;
  hash?: string;
  height?: number;
  id: `a-${string}`;
  kind: "video" | "audio" | "image";
  mimeType?: string;
  name?: string;
  nativePreview?: boolean;
  src: string;
  width?: number;
}>;

fps

fps: number;

height

height: number;

id

id: string;

layouts

layouts: object[];

Multicam layout templates this project references. See layouts.ts.

markers

markers: object[];

Timeline markers, sorted by timeMs (the commands keep them sorted).

name

name: string;

presets

presets: object[];

Named inspector value bundles (style presets). See presets.ts.

tracks

tracks: object[];

Render order: index 0 is painted first (bottom); last is topmost.

version

version: 1;

Project format version (see migrations.ts). parseProject migrates older documents before validating; the default covers in-memory creation.

width

width: number;

On this page