docstudio/designer API reference

Every public export of docstudio/designer in DocStudio 0.2.0: functions, constants, types and interfaces with signatures.

Import from docstudio/designer.

Pure functions return result objects with ok, reason and diagnostics instead of throwing.

Functions

addArg

Adds an argument to the function call at a position inside an expression and returns the edited expression.

addArg(expr: Expr, at: ExprAt): EditResult

addImport

Adds a pinned component import to a document with a unique alias.

addImport(document: JsonValue, ref: string): RewriteResult

applyOp

Applies one patch operation to a JSON document and returns the new document or an error.

applyOp(doc: JsonValue, op: PatchOp): ApplyResult

applyPatch

Applies a list of patch operations to a JSON document as one unit.

applyPatch(doc: JsonValue, patch: Patch): PatchResult

buildCanvasHtml

Compiles a template with sample data and renders it to the HTML shown in the sandboxed canvas frame.

buildCanvasHtml(input: CanvasInput): CanvasOutput

buildIndex

Builds the index of nodes (id, type, pointer, container and position) for a document.

buildIndex(doc: JsonValue): NodeIndex

bumpVersion

Computes the next major, minor or patch version from a version text.

bumpVersion(version: string | undefined, bump: Bump): string

capSample

Caps every collection in sample data to a number of rows for the canvas preview.

capSample(sample: JsonValue, cap: number): CappedSample

contentHash

Returns the content hash of a template used for published versions.

contentHash(value: JsonValue): string | undefined

createDataContext

Creates the data context (sample data, schema and diagnostics) used by the data editor and the expression editor.

createDataContext(options: DataContextOptions): DataContext

createEditor

Creates a headless editor with immutable state, commands, patch history, selection and undo and redo.

createEditor(options: EditorOptions): Editor

Errors. Does not throw for an invalid template. The editor reports diagnostics and refuses commands that would make the document invalid.

import { createEditor } from 'docstudio/designer';

export function run(): { before: number; after: number; undone: number } {
  const editor = createEditor({ template: { schemaVersion: '1.0.0', body: [] } });
  const count = (): number => editor.getState().index.entries.size;
  const before = count();
  const inserted = editor.execute({
    kind: 'insertType',
    container: { kind: 'body' },
    type: 'text',
  });
  if (!inserted.ok) throw new Error(inserted.reason);
  const after = count();
  editor.undo();
  return { before, after, undone: count() };
}

createMemoryLibrary

Creates an in-memory component library that refuses to overwrite a published version.

createMemoryLibrary(initial?: readonly PublishedComponent[]): ComponentLibrary
import { createMemoryLibrary, executePublish, planPublish } from 'docstudio/designer';

export function run(): { version: string; versions: readonly string[] } {
  const library = createMemoryLibrary();
  const template = {
    schemaVersion: '1.0.0',
    body: [{ id: 'title', type: 'text', content: [{ path: '$props.title' }] }],
  };
  const planned = planPublish({
    library,
    name: 'heading',
    template,
    bump: 'minor',
    notes: 'First',
  });
  if (!planned.ok) throw new Error(planned.reason);
  const outcome = executePublish(library, planned.plan, template, '2026-11-29T00:00:00.000Z');
  if (!outcome.ok) throw new Error(outcome.reason);
  const summary = library.list().find((entry) => entry.name === 'heading');
  return {
    version: outcome.published.version,
    versions: summary?.versions.map((item) => item.version) ?? [],
  };
}

declaredSlots

Lists the slot names a library component declares.

declaredSlots(library: ComponentLibrary | undefined, ref: unknown): readonly string[]

defaultCall

Creates a function call expression with default arguments for a function name.

defaultCall(fn: "number" | "add" | "sub" | "mul" | "div" | "mod" | "round" | "abs" | "min" | "max" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "and" | "or" | "not" | "if" | "coalesce" | "exists" | "isEmpty" | "contains" | "in" | "concat" | "upper" | "lower" | "trim" | "length" | "substr" | "sum" | "avg" | "count" | "format"): CallExpr

describeFormatter

Returns the descriptor of a formatter by name, including host descriptors.

describeFormatter(name: string, extra?: readonly FormatterDescriptor[]): FormatterDescriptor | undefined

Designer

The React component that renders the whole visual editor.

Designer(props: DesignerProps): Element

Errors. Does not throw for an invalid template. A migration that is pending makes the document read only.

import { createDefaultRegistry } from 'docstudio/core';
import { Designer, createEditor, createMemoryLibrary } from 'docstudio/designer';

export function createDesignerElement(stored: unknown, sample: unknown): React.JSX.Element {
  const registry = createDefaultRegistry();
  const editor = createEditor({ template: stored, registry });
  const library = createMemoryLibrary();
  return (
    <Designer
      editor={editor}
      registry={registry}
      sampleData={sample}
      library={library}
      initialFit="page"
      onChange={() => undefined}
    />
  );
}

executePublish

Publishes a planned component version to a library and returns the outcome.

executePublish(library: ComponentLibrary, plan: PublishPlan, template: JsonValue, publishedAt: string): PublishOutcome
import { createMemoryLibrary, executePublish, planPublish } from 'docstudio/designer';

export function run(): { version: string; versions: readonly string[] } {
  const library = createMemoryLibrary();
  const template = {
    schemaVersion: '1.0.0',
    body: [{ id: 'title', type: 'text', content: [{ path: '$props.title' }] }],
  };
  const planned = planPublish({
    library,
    name: 'heading',
    template,
    bump: 'minor',
    notes: 'First',
  });
  if (!planned.ok) throw new Error(planned.reason);
  const outcome = executePublish(library, planned.plan, template, '2026-11-29T00:00:00.000Z');
  if (!outcome.ok) throw new Error(outcome.reason);
  const summary = library.list().find((entry) => entry.name === 'heading');
  return {
    version: outcome.published.version,
    versions: summary?.versions.map((item) => item.version) ?? [],
  };
}

findDependents

Lists the templates and components that depend, directly or transitively, on a component reference.

findDependents(catalog: Catalog, ref: string): readonly Dependent[]

isPending

Tells whether a migration outcome still waits for the author to accept it.

isPending(outcome: MigrationOutcome | undefined, document: JsonValue): boolean

isValidExpression

Checks an expression with the core parser.

isValidExpression(expr: unknown): boolean

latestVersion

Returns the newest version of a library component summary.

latestVersion(summary: ComponentSummary | undefined): string | undefined

libraryEntries

Lists the components of a library as catalog entries.

libraryEntries(library: ComponentLibrary): CatalogEntry[]

libraryStore

Adapts a component library to the component store the compiler reads.

libraryStore(library: ComponentLibrary): ComponentStore

pathChoices

Lists the data paths available at a node scope for suggestions.

pathChoices(scope: NodeScope): readonly PathChoice[]

pinStatuses

Reports for each pinned component reference whether a newer version exists.

pinStatuses(document: JsonValue, library: ComponentLibrary): readonly PinStatus[]

planInstance

Plans the insertion of a component instance with its props.

planInstance(document: JsonValue, index: NodeIndex, ref: string, props?: readonly string[]): InstancePlan

planPublish

Checks a component for publishing and computes the next version, hash and dependencies.

planPublish(input: PublishInput): PlanResult
import { createMemoryLibrary, executePublish, planPublish } from 'docstudio/designer';

export function run(): { version: string; versions: readonly string[] } {
  const library = createMemoryLibrary();
  const template = {
    schemaVersion: '1.0.0',
    body: [{ id: 'title', type: 'text', content: [{ path: '$props.title' }] }],
  };
  const planned = planPublish({
    library,
    name: 'heading',
    template,
    bump: 'minor',
    notes: 'First',
  });
  if (!planned.ok) throw new Error(planned.reason);
  const outcome = executePublish(library, planned.plan, template, '2026-11-29T00:00:00.000Z');
  if (!outcome.ok) throw new Error(outcome.reason);
  const summary = library.list().find((entry) => entry.name === 'heading');
  return {
    version: outcome.published.version,
    versions: summary?.versions.map((item) => item.version) ?? [],
  };
}

prepareTemplate

Runs migrations on a stored template before editing and reports their outcome.

prepareTemplate(input: unknown, migrations: MigrationRegistry | undefined, registry?: Registry): MigrationOutcome

previewExpression

Evaluates an expression against sample data and returns its value, type, binding state and diagnostics.

previewExpression(expr: Expr, scope: Scope | undefined, options: PreviewOptions): Preview

previewRepin

Compiles a document before and after re-pinning a component and lists new and resolved problems.

previewRepin(input: ImpactInput): Impact

propNames

Lists the $props names a component template uses.

propNames(template: JsonValue): readonly string[]

referencesOf

Lists the component references a template contains.

referencesOf(template: JsonValue): readonly string[]

removeArg

Removes an argument from the function call at a position inside an expression.

removeArg(expr: Expr, at: ExprAt, index: number): EditResult

repin

Moves one component reference to another version.

repin(document: JsonValue, from: string, to: string): RewriteResult

repinAll

Moves every reference to a component to one version.

repinAll(document: JsonValue, name: string, to: string): RewriteResult

replaceAt

Replaces the sub-expression at a position inside an expression.

replaceAt(expr: Expr, at: ExprAt, value: Expr): EditResult

rewriteReferences

Rewrites component references through a mapping function.

rewriteReferences(document: JsonValue, match: (ref: string) => string | undefined): RewriteResult

scopeFor

Computes the data scope of a node for suggestions and previews.

scopeFor(context: DataContext, index: NodeIndex, id: string, site?: ScopeSite): NodeScope

setFallback

Sets or clears the fallback of a path expression.

setFallback(expr: Expr, at: ExprAt, fallback: Expr | undefined): EditResult

setFunction

Changes the function of a call expression.

setFunction(expr: Expr, at: ExprAt, fn: string): EditResult

setOf

Sets or clears the per item expression of an aggregate call.

setOf(expr: Expr, at: ExprAt, of: Expr | undefined): EditResult

setPath

Sets the data path of a path expression.

setPath(expr: Expr, at: ExprAt, path: string): EditResult

slotNames

Lists the slot names a component template declares.

slotNames(template: JsonValue): readonly string[]

sortVersions

Sorts version texts from oldest to newest.

sortVersions(versions: readonly string[]): string[]

unwrapCall

Replaces a call expression with one of its arguments.

unwrapCall(expr: Expr, at: ExprAt): EditResult

upgradeAllToLatest

Moves every pinned component to its latest version and counts the changes.

upgradeAllToLatest(document: JsonValue, library: ComponentLibrary): { document: JsonValue; changed: number; }

wrapInCall

Wraps an expression in a function call.

wrapInCall(expr: Expr, at: ExprAt, fn: string): EditResult

Constants

BUILTIN_FORMATTER_DESCRIPTORS

Descriptors of the built-in formatters that drive the formatting editor.

const BUILTIN_FORMATTER_DESCRIPTORS: readonly FormatterDescriptor[]

COMPONENT_NAME

The regular expression a reusable component name must match.

const COMPONENT_NAME: RegExp

COMPONENT_NODE_FACTORIES

Node factories used in component authoring mode, including the slot node.

const COMPONENT_NODE_FACTORIES: Readonly<Record<string, () => JsonObject>>

DEFAULT_MESSAGES

The default English messages of the designer; override parts through the messages prop.

const DEFAULT_MESSAGES: Messages

DEFAULT_NODE_FACTORIES

The factories that create a new node for each toolbox item.

const DEFAULT_NODE_FACTORIES: Readonly<Record<string, () => JsonObject>>

DESIGNER_MODULE_ID

The identifier of the designer module.

const DESIGNER_MODULE_ID: "ds:designer"

FUNCTION_DESCRIPTORS

Descriptions of every expression function used by the expression editor.

const FUNCTION_DESCRIPTORS: Readonly<Record<"number" | "add" | "sub" | "mul" | "div" | "mod" | "round" | "abs" | "min" | "max" | "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "and" | "or" | "not" | "if" | "coalesce" | "exists" | "isEmpty" | "contains" | "in" | "concat" | "upper" | "lower" | "trim" | "length" | "substr" | "sum" | "avg" | "count" | "format", FunctionDescriptor>>

Types

ActionOption

export type ActionOption = boolean | { readonly label?: string };

ApplyResult

export type ApplyResult =
  | { readonly ok: true; readonly doc: JsonValue; readonly inverse: PatchOp }
  | { readonly ok: false; readonly reason: string };

Bump

export type Bump = 'major' | 'minor' | 'patch';

Command

export type Command =
  | {
      readonly kind: 'insert';
      readonly container: ContainerRef;
      readonly index?: number;
      readonly node: JsonObject;
    }
  | {
      readonly kind: 'insertType';
      readonly container: ContainerRef;
      readonly index?: number;
      readonly type: string;
    }
  | { readonly kind: 'delete'; readonly ids: readonly string[] }
  | { readonly kind: 'duplicate'; readonly id: string }
  | {
      readonly kind: 'move';
      readonly id: string;
      readonly container: ContainerRef;
      readonly index: number;
    }
  | {
      readonly kind: 'set';
      readonly target: SetTarget;
      readonly path: readonly string[];
      readonly value: JsonValue | undefined;
    }
  | { readonly kind: 'wrap'; readonly ids: readonly string[]; readonly type: string }
  | { readonly kind: 'unwrap'; readonly id: string }
  | { readonly kind: 'replaceDocument'; readonly document: JsonValue }
  | { readonly kind: 'batch'; readonly commands: readonly Command[]; readonly label?: string };

ContainerRef

export type ContainerRef =
  | { readonly kind: 'body' }
  | { readonly kind: 'header' }
  | { readonly kind: 'footer' }
  | { readonly kind: 'node'; readonly id: string; readonly list: 'children' | 'empty' }
  | { readonly kind: 'slot'; readonly id: string; readonly name: string };

EditResult

export type EditResult =
  { readonly ok: true; readonly value: Expr } | { readonly ok: false; readonly reason: string };

ExecuteResult

export type ExecuteResult =
  | { readonly ok: true; readonly patch: Patch; readonly changed: boolean }
  | { readonly ok: false; readonly reason: string; readonly diagnostics: readonly Diagnostic[] };

Impact

export type Impact =
  | {
      readonly ok: true;
      readonly document: JsonValue;
      readonly before: readonly Diagnostic[];
      readonly after: readonly Diagnostic[];
      readonly added: readonly Diagnostic[];
      readonly resolved: readonly Diagnostic[];
    }
  | { readonly ok: false; readonly reason: string };

MigrationStatus

export type MigrationStatus = 'current' | 'migrated' | 'failed';

NodeDefaults

export type NodeDefaults = Readonly<Record<string, () => JsonObject>>;

Patch

export type Patch = readonly PatchOp[];

PatchOp

export type PatchOp =
  | { readonly op: 'add'; readonly path: string; readonly value: JsonValue }
  | { readonly op: 'remove'; readonly path: string }
  | { readonly op: 'replace'; readonly path: string; readonly value: JsonValue };

PatchResult

export type PatchResult =
  | { readonly ok: true; readonly doc: JsonValue; readonly inverse: Patch }
  | { readonly ok: false; readonly reason: string };

PlanResult

export type PlanResult =
  | { readonly ok: true; readonly plan: PublishPlan }
  | { readonly ok: false; readonly reason: string; readonly diagnostics: readonly Diagnostic[] };

PreviewPurpose

export type PreviewPurpose = 'text' | 'condition' | 'value' | 'collection';

PreviewState

export type PreviewState = 'unavailable' | 'invalid' | 'ok' | 'failed';

PublishOutcome

export type PublishOutcome =
  | { readonly ok: true; readonly published: PublishedComponent }
  | { readonly ok: false; readonly reason: string };

SchemaSource

export type SchemaSource = 'supplied' | 'inferred' | 'none';

SetTarget

export type SetTarget =
  { readonly kind: 'template' } | { readonly kind: 'node'; readonly id: string };

Interfaces

ActionHandlers

export interface ActionHandlers {
  readonly actions?: DesignerActions;
  readonly onView?: (payload: DocumentPayload) => void;
  readonly onPrint?: (payload: DocumentPayload) => void;
  readonly onSubmit?: (payload: DocumentPayload) => void | Promise<void>;
}

CanvasInput

export interface CanvasInput {
  readonly template: Template | undefined;
  readonly data: unknown;
  readonly target: RenderTarget;
  readonly registry?: Registry;
  readonly formatters?: FormatterRegistry;
  readonly limits?: Limits;
  readonly components?: ComponentStore;
  readonly migrations?: MigrationRegistry;
  readonly sampleProps?: JsonValue;
  readonly componentDocument?: JsonValue;
  readonly lang?: string;
}

CanvasOutput

export interface CanvasOutput {
  readonly html: string;
  readonly ok: boolean;
  readonly diagnostics: readonly Diagnostic[];
}

CappedSample

export interface CappedSample {
  readonly data: JsonValue;
  readonly truncations: readonly Truncation[];
}

Catalog

export interface Catalog {
  entries(): Iterable<CatalogEntry>;
}

CatalogEntry

export interface CatalogEntry {
  readonly id: string;
  readonly kind: 'template' | 'component';
  readonly ref?: string;
  readonly template: JsonValue;
}

ComponentLibrary

export interface ComponentLibrary {
  list(): readonly ComponentSummary[];
  get(name: string, version: string): PublishedComponent | undefined;
  publish(request: PublishRequest): PublishOutcome;
}

ComponentSummary

export interface ComponentSummary {
  readonly name: string;
  readonly versions: readonly VersionInfo[];
}

DataContext

export interface DataContext {
  readonly sample: JsonValue;
  readonly schema: DataSchema | undefined;
  readonly schemaSource: SchemaSource;
  readonly props: JsonValue | undefined;
  readonly propsSchema: DataSchema | undefined;
  readonly diagnostics: readonly Diagnostic[];
}

DataContextOptions

export interface DataContextOptions {
  readonly sampleData: unknown;
  readonly dataSchema?: DataSchema;
  readonly limits?: Limits;
  readonly sampleLimit?: number;
  readonly sampleProps?: JsonValue;
}

Dependent

export interface Dependent {
  readonly id: string;
  readonly kind: 'template' | 'component';
  readonly direct: boolean;
  readonly via: readonly string[];
}

DesignerActions

export interface DesignerActions {
  readonly view?: ActionOption;
  readonly print?: ActionOption;
  readonly submit?: ActionOption;
}

DesignerProps

export interface DesignerProps extends ActionHandlers {
  readonly editor?: Editor;
  readonly defaultTemplate?: unknown;
  readonly onChange?: (template: JsonValue, patch: Patch) => void;
  readonly sampleData?: unknown;
  readonly dataSchema?: DataSchema;
  readonly onSampleDataChange?: (data: unknown) => void;
  readonly formatterDescriptors?: readonly FormatterDescriptor[];
  readonly previewRows?: number;
  readonly themes?: readonly string[];
  readonly registry?: Registry;
  readonly formatters?: FormatterRegistry;
  readonly factories?: NodeDefaults;
  readonly locks?: readonly string[];
  readonly messages?: Partial<Messages>;
  readonly direction?: 'ltr' | 'rtl';
  readonly readOnly?: boolean;
  readonly initialFit?: 'width' | 'page';
  readonly target?: RenderTarget;
  readonly library?: ComponentLibrary;
  readonly catalog?: Catalog;
  readonly migrations?: MigrationRegistry;
  readonly mode?: 'template' | 'component';
  readonly sampleProps?: JsonValue;
  readonly migration?: MigrationOutcome;
  readonly onPublish?: (published: PublishedComponent) => void;
}

DocumentPayload

export interface DocumentPayload {
  readonly template: JsonValue;
  readonly data: JsonValue;
}

Editor

export interface Editor {
  readonly limits: Limits;
  readonly component: boolean;
  getState(): EditorState;
  subscribe(listener: (state: EditorState, patch: Patch) => void): () => void;
  execute(command: Command, options?: ExecuteOptions): ExecuteResult;
  undo(): boolean;
  redo(): boolean;
  select(ids: readonly string[]): void;
  markSaved(): void;
}

EditorOptions

export interface EditorOptions {
  readonly template: unknown;
  readonly registry?: Registry;
  readonly formatters?: FormatterRegistry;
  readonly limits?: Limits;
  readonly component?: boolean;
  readonly factories?: NodeDefaults;
  readonly maxHistory?: number;
  readonly maxOps?: number;
  readonly coalesceMs?: number;
  readonly now?: () => number;
}

EditorState

export interface EditorState {
  readonly document: JsonValue;
  readonly template: Template | undefined;
  readonly valid: boolean;
  readonly diagnostics: readonly Diagnostic[];
  readonly index: NodeIndex;
  readonly selection: readonly string[];
  readonly canUndo: boolean;
  readonly canRedo: boolean;
  readonly dirty: boolean;
  readonly revision: number;
}

ExecuteOptions

export interface ExecuteOptions {
  readonly coalesceKey?: string;
  readonly label?: string;
}

FormatOption

export interface FormatOption {
  readonly key: string;
  readonly label: string;
  readonly kind: OptionKind;
  readonly options?: readonly string[];
  readonly min?: number;
  readonly max?: number;
  readonly required: boolean;
  readonly pattern?: string;
  readonly fallback?: string | number;
}

FormatterDescriptor

export interface FormatterDescriptor {
  readonly name: string;
  readonly label: string;
  readonly valueKind: FormatValueKind;
  readonly options: readonly FormatOption[];
}

FunctionDescriptor

export interface FunctionDescriptor {
  readonly group: FunctionGroup;
  readonly label: string;
  readonly help: string;
}

ImpactInput

export interface ImpactInput {
  readonly document: JsonValue;
  readonly from: string;
  readonly to: string;
  readonly library: ComponentLibrary;
  readonly data: JsonValue;
  readonly component?: boolean;
  readonly registry?: Registry;
  readonly migrations?: MigrationRegistry;
}

Messages

export interface Messages {
  readonly insp: Readonly<Record<string, string>>;
  readonly ui: UiMessages;
  readonly content: ContentMessages;
  readonly migration: MigrationMessages;
  readonly library: LibraryMessages;
  readonly actions: ActionMessages;
  readonly table: TableMessages;
  readonly expression: ExpressionMessages;
  readonly undo: string;
  readonly redo: string;
  readonly delete: string;
  readonly duplicate: string;
  readonly toolbox: string;
  readonly layers: string;
  readonly inspector: string;
  readonly json: string;
  readonly problems: string;
  readonly canvas: string;
  readonly page: string;
  readonly regions: string;
  readonly header: string;
  readonly footer: string;
  readonly body: string;
  readonly noSelection: string;
  readonly noProblems: string;
  readonly apply: string;
  readonly revert: string;
  readonly zoom: string;
  readonly target: string;
  readonly style: string;
  readonly frame: string;
  readonly size: string;
  readonly properties: string;
  readonly name: string;
  readonly wrap: string;
  readonly unwrap: string;
  readonly moveUp: string;
  readonly moveDown: string;
  readonly indent: string;
  readonly outdent: string;
  readonly locked: string;
  readonly refused: string;
  readonly inserted: string;
  readonly moved: string;
  readonly deleted: string;
  readonly undone: string;
  readonly redone: string;
  readonly invalidJson: string;
  readonly applied: string;
  readonly dragHandle: string;
  readonly bindValue: string;
  readonly noBindablePaths: string;
  readonly noTheme: string;
  readonly data: string;
  readonly sampleData: string;
  readonly schemaSupplied: string;
  readonly schemaInferred: string;
  readonly schemaNone: string;
  readonly bindingPaths: string;
  readonly missingData: string;
  readonly canvasTruncated: string;
  readonly loadFile: string;
  readonly sampleInvalid: string;
  readonly resizeLayers: string;
  readonly resizeInspector: string;
  readonly nodeTypes: Readonly<Record<string, string>>;
}

MigrationOutcome

export interface MigrationOutcome {
  readonly status: MigrationStatus;
  readonly original: JsonValue;
  readonly document: JsonValue;
  readonly applied: readonly { readonly from: string; readonly to: string }[];
  readonly diagnostics: readonly Diagnostic[];
}

NodeEntry

export interface NodeEntry {
  readonly id: string;
  readonly type: string;
  readonly pointer: string;
  readonly listPointer: string;
  readonly index: number;
  readonly container: ContainerRef;
  readonly depth: number;
  readonly node: JsonObject;
}

NodeIndex

export interface NodeIndex {
  readonly entries: ReadonlyMap<string, NodeEntry>;
  readonly truncated: boolean;
  readonly duplicates: readonly string[];
}

NodeScope

export interface NodeScope {
  readonly schema: SchemaScope;
  readonly data: Scope | undefined;
  readonly depth: number;
  readonly hasRows: boolean;
}

PathChoice

export interface PathChoice {
  readonly path: string;
  readonly type: string;
  readonly group: 'current' | 'root' | 'parent' | 'special';
}

PinStatus

export interface PinStatus {
  readonly ref: string;
  readonly name: string;
  readonly version: string | undefined;
  readonly latest: string | undefined;
  readonly known: boolean;
  readonly newer: boolean;
  readonly versions: readonly string[];
}

Preview

export interface Preview {
  readonly state: PreviewState;
  readonly text: string;
  readonly valueType: string;
  readonly value: Value;
  readonly binding: string;
  readonly diagnostics: readonly Diagnostic[];
}

PreviewOptions

export interface PreviewOptions {
  readonly purpose: PreviewPurpose;
  readonly policy?: MissingPolicy;
  readonly placeholder?: string;
  readonly formatters?: FormatterRegistry;
  readonly limits?: Limits;
}

PublishedComponent

export interface PublishedComponent {
  readonly name: string;
  readonly version: string;
  readonly template: JsonValue;
  readonly hash: string;
  readonly notes: string;
  readonly publishedAt: string;
}

PublishInput

export interface PublishInput {
  readonly library: ComponentLibrary;
  readonly name: string;
  readonly template: JsonValue;
  readonly bump: Bump;
  readonly notes: string;
  readonly registry?: Registry;
}

PublishPlan

export interface PublishPlan {
  readonly name: string;
  readonly version: string;
  readonly previous: string | undefined;
  readonly hash: string;
  readonly bump: Bump;
  readonly dependencies: readonly string[];
  readonly notes: string;
}

PublishRequest

export interface PublishRequest {
  readonly name: string;
  readonly version: string;
  readonly template: JsonValue;
  readonly notes: string;
  readonly publishedAt: string;
}

RewriteResult

export interface RewriteResult {
  readonly document: JsonValue;
  readonly changed: number;
}

Truncation

export interface Truncation {
  readonly path: string;
  readonly total: number;
  readonly shown: number;
}

VersionInfo

export interface VersionInfo {
  readonly version: string;
  readonly hash: string;
  readonly notes: string;
  readonly publishedAt: string;
}