trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
38 lines • 1.51 kB
TypeScript
/**
* Field sync policy — durable / realtime / derived (ADR 0018 Phase 1).
*
* @module trellis/core/ontology/sync-policy
*/
import type { FieldSyncTier, PropertyValueSpecification, SchemaDefinition } from './types.js';
/** Thrown when a durable mutate includes a `sync:realtime` field. */
export declare class RealtimeFieldError extends Error {
readonly field: string;
readonly status = 400;
constructor(field: string);
}
/** Thrown when create is asked for an id that already exists. */
export declare class EntityConflictError extends Error {
readonly id: string;
readonly status = 409;
constructor(id: string);
}
/**
* Resolve the effective sync tier for a property.
*
* - explicit `sync` wins
* - formula / rollup / computed → derived
* - otherwise durable
*/
export declare function effectiveFieldSync(field: PropertyValueSpecification): FieldSyncTier;
/** Find a registered schema for an entity type name (open-world tolerant). */
export declare function findSchemaForType(ontologies: Iterable<SchemaDefinition>, type: string): SchemaDefinition | undefined;
/**
* Filter attribute bags for durable create/update.
*
* - unknown fields (no schema / no field spec) → keep (open-world)
* - derived → strip
* - realtime → throw {@link RealtimeFieldError}
* - durable → keep
*/
export declare function filterDurableAttributes<T extends Record<string, unknown>>(attributes: T, schema: SchemaDefinition | undefined): T;
//# sourceMappingURL=sync-policy.d.ts.map