import type { Operation, PushPolicy } from "../ir/operations.js"; import type { Recipe } from "../schema/recipe.js"; /** * Policy assignment for compiler-emitted operations. * * Template structure (templates, sections, fields, renderings, variants) * uses `CreateAndUpdate` — the recipe is the source of truth; if an * author edits the corresponding CMS item, the next push overwrites. * * Datasource items + page items use `CreateOnly` — the recipe seeds * initial content, the CMS owns it thereafter. The `policyFor` switch * is the single seam adding this distinction without rewriting every * emission site in `compile.ts`. */ /** * The kind of op being emitted. `template-structure` covers component * + content + page templates; `composition-structure` covers partial * designs and page designs (still recipe-owned, `CreateAndUpdate`); * `datasource-item` + `page-item` cover seeded content (`CreateOnly`). */ export type OpPurpose = "template-structure" | "composition-structure" | "datasource-item" | "page-item"; export declare const purposeForRecipe: (kind: Recipe["kind"]) => OpPurpose; /** * Policy assignment, given the purpose of the op being emitted. * Template + composition structure → `CreateAndUpdate` (recipe-owned); * datasource + page items → `CreateOnly` (recipe-seeded, CMS-owned). */ export declare const policyFor: (purpose: OpPurpose) => PushPolicy; /** * Convenience: the default policy a recipe of the given kind should attach * to every op it emits. Compiler call site: * * const policy = defaultPolicyForRecipe(recipe.kind); * operations.push({ op: "CreateItem", policy, ... }); */ export declare const defaultPolicyForRecipe: (kind: Recipe["kind"]) => PushPolicy; /** * Type guard for narrowing op kinds — exposed so consumers (planner, * executor, telemetry) can dispatch on policy without re-implementing the * mapping. */ export declare const policyForOp: (op: Operation) => PushPolicy;