Writer ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from configurator-runtime.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Interface · import type { Writer } from '@holostep-configurators/runtime-client/contract'; · stable · since 2.0.0 · section 5. Writers, transactions, session

The write surface Session and Tx share. C is the commit options the writer accepts: CommitOptions for Session, NoCommitOptions for Tx. Handles obtained from a writer are bound to it and carry the same C. Write helpers take a plain Writer (member options only), so they work with both and never pass a commit option a tx would refuse. A bare Collection or Part is the same: member options only. Type a stored session handle you pass origin or another commit option through as Collection<CommitOptions>, or let TypeScript infer it. Every state write through a writer or its handles that fails inside the runtime before its commit point rolls back and records 'sync-failed' once. An autocommit one undoes only its own uncommitted effects, so a write that committed while it loaded keeps its state, and resolves 'rolled-back' with reason 'internal-error'; one through a tx rolls the transaction holding it back to its opening state (spec section 6.4).

Members ​

Member Kind Summary
node method The root part of the ModelNode nodeId: pose it, hide it, follow it or bound it as a whole.
find method A saved search over loaded models and collections.
collection method The live collection with this name, bound to this writer; created when absent.
apply method Replaces the look's apply() block atomically (spec section 6.10, R2).
applyPatch method Applies RFC 6902 operations to SessionState (recorded; merging; in the write queue).
setSceneModel method Replaces the scene model (recorded; replacing; in the write queue).
select method Selects material (a MaterialNode nodeId) in the global-material GroupNode group (its nodeId): recorded, priced and saved.
stage property The stage: lights, environment, background and the colour pipeline.
materials property Reusable materials and reads of stored MaterialNodes.
assembly property Connectors and connections between placed models.
camera property The camera: view, lens, limits, mode, rotation, and the projection reads.
animations property Clips of loaded models.
labs property Labs members: they serve one app or wrap an engine-shaped capability, and may change in a minor.
state method Read class: intent.
getSceneModel method Read class: intent.

Declaration ​

ts
export interface Writer<C extends object = NoCommitOptions> {
  node(nodeId: string): Part<C>;
  find(query: Query): Parts<C>;
  collection(name: string, options?: CollectionOptions): Collection<C>;
  apply(scene: SceneSpec, options?: C & SignalOption): Promise<Report>;
  applyPatch(patch: readonly JsonPatchOp[], options?: RecordedOptions<C> & SignalOption): Promise<Report>;
  setSceneModel(model: DeepReadonly<SceneModel>, options?: RecordedOptions<C> & SceneModelOptions): Promise<Report>;
  select(group: string, material: string, options?: RecordedOptions<C> & SignalOption): Promise<Report>;
  readonly stage: Stage<C>;
  readonly materials: Materials<C>;
  readonly assembly: Assembly<C>;
  readonly camera: Camera<C>;
  readonly animations: Animations<C>;
  readonly labs: Labs<C>;
  state(): SessionState;
  getSceneModel(): DeepReadonly<SceneModel> | null;
}

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: Writer names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs not recorded: no ledger row names this member or its owner
4. The cheaper fix first not recorded per member (Appendix B decides it per need)