Archetype conformance
Classify object lifecycles against six optional versioned archetypes without coupling Platform to their vocabulary.
@fabricorg/archetypes provides six pre-1.0 semantic archetypes: Party, Offering, Agreement,
Resource, Activity, and Settlement. The package is optional. @fabricorg/platform stores its
namespaced annotation as opaque JSON and contains no archetype names.
import {
archetypeSemantics,
assertArchetypeConformance,
} from "@fabricorg/archetypes";
const serviceVisit = {
type: "ServiceVisit",
semantics: archetypeSemantics({
id: "fabric.Activity",
version: "0.1",
stateMap: {
scheduled: "planned",
working: "executing",
blocked: "waiting",
completed: "completed",
},
}),
};
assertArchetypeConformance(fieldServicesModule);
const registry = createModuleRegistry([fieldServicesModule]);Conformance mappings are explicit and versioned. The validator never guesses from state labels. It
checks complete mapping, state-class compatibility, permitted refinements, required base transitions,
and exception behavior. validateArchetypeConformance returns findings as data for report-only tools;
assertArchetypeConformance fails startup when an application explicitly requires enforcement.
Base createModuleRegistry() remains archetype-agnostic. Certification tooling consumes
archetypeConformanceAdapter; the compiler does not need to know any archetype name.
The vocabulary remains pre-1.0 until roofing, restaurant, and Activity/Resource-centric field-service fixtures remain conformant.