Skip to content
1 min read · 230 words

Function: rawPlan()

ts
function rawPlan(
  store: PlanStore,
  planId: string,
  opts?: {
    revision?: number;
  },
): Promise<RawPlanView>;

Defined in: src/batteries/orchestration/raw.ts:59

Fold the plan's op log up to a revision into a RawPlanView.

Parameters

ParameterTypeDescription
storePlanStoreThe plan store to read from.
planIdstringThe plan to read.
opts?{ revision?: number; }Optional revision selector.
opts.revision?numberFold only the op prefix through this revision. Omitted folds the present log.

Returns

Promise<RawPlanView>

The folded content view at the requested revision.

Remarks

The plan IS the fold of its op log, so this is the canonical way to read plan CONTENT. With no revision, it folds the plan's present log. With {revision: N}, it serves a HISTORICAL view: it reads the op prefix throughRevision: N and folds exactly that prefix, so the result is what the content looked like at revision N. A revision the log never reached is REJECTED by the store (which throws rather than silently returning everything) — this function never guesses or truncates.

provenance (clone/template lineage) is read from store.readProvenance(planId) and carried into the view, where it is covered by the digest.

The returned view carries NO lifecycle state — see the module doc. state is a property of the plan NOW and lives on store.readState(), not here.