@fabricorg/archetypes 2.0.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +15 -0
- package/dist/index.cjs +109 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -6
- package/dist/index.d.ts +49 -6
- package/dist/index.js +106 -8
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @fabricorg/archetypes
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1b81b20: Publish with real build provenance, and name the repository each attestation points at. `pnpm publish` accepts `--provenance` and drops it, so every release until now was unattested while the release document claimed otherwise. The pipeline now packs with pnpm and uploads the tarball with `npm publish --provenance`, and every package declares `repository`, `homepage`, and `bugs`.
|
|
8
|
+
|
|
9
|
+
## 2.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 4c358ad: The archetype set was closed: a module annotated with an id outside the six shipped ones reported `unknown_archetype` and could not be certified. A platform meant for verticals nobody has named yet cannot ship their nouns, so the seam is now the definition. `defineArchetype` validates a vertical's own archetype structurally, and `createArchetypeConformance` builds `validate`, `assert`, and a manifest conformance adapter over that set, including the six reference archetypes by default and carrying an adapter id distinct from the shipped adapter's. The `fabric.` namespace is reserved for the reference set. `validateArchetypeConformance` and `assertArchetypeConformance` accept an optional definition set and behave exactly as before without one.
|
|
14
|
+
|
|
15
|
+
Two validator corrections found on the way: the exception-guard check compared a state's name to the literal `exception` rather than its class, so a vertical that named its exception state anything else was never checked; it now checks the class. And every shipped archetype now passes `defineArchetype`, which required the rule "a state to start in" to admit an active state, since `fabric.Offering` is born available.
|
|
16
|
+
|
|
17
|
+
Disclosed as a type change: `ArchetypeId` stays the closed reference union, and `ArchetypeReference.id` and `ArchetypeDefinition.id` widen to `AnyArchetypeId`, the union with any string, so code that switched exhaustively on a reference's id will see a wider type.
|
|
18
|
+
|
|
3
19
|
## 2.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -26,3 +26,18 @@ const registry = createModuleRegistry([module]);
|
|
|
26
26
|
Use `validateArchetypeConformance` for report-only build tooling. Use
|
|
27
27
|
`assertArchetypeConformance` explicitly before Platform registration when startup enforcement is
|
|
28
28
|
required. Base Platform registration never interprets archetype annotations.
|
|
29
|
+
|
|
30
|
+
## Your own archetypes
|
|
31
|
+
|
|
32
|
+
The six shipped archetypes are a reference vocabulary, not the whole set. A vertical defines its own
|
|
33
|
+
with `defineArchetype` and certifies against it with `createArchetypeConformance`, which includes the
|
|
34
|
+
reference set by default so one assembly certifies both:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const conformance = createArchetypeConformance([defineArchetype({ id: "outdoor.Relationship", /* ... */ })]);
|
|
38
|
+
conformance.assert(module);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Ids are `<namespace>.<PascalName>`. A definition is validated structurally before it can certify
|
|
42
|
+
anything, and an id that collides with a reference archetype under a different meaning is refused.
|
|
43
|
+
|
package/dist/index.cjs
CHANGED
|
@@ -21,16 +21,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ARCHETYPES: () => ARCHETYPES,
|
|
24
|
+
ARCHETYPE_ID: () => ARCHETYPE_ID,
|
|
24
25
|
ARCHETYPE_SEMANTIC_KEY: () => ARCHETYPE_SEMANTIC_KEY,
|
|
25
26
|
archetypeConformanceAdapter: () => archetypeConformanceAdapter,
|
|
26
27
|
archetypeSemantics: () => archetypeSemantics,
|
|
27
28
|
assertArchetypeConformance: () => assertArchetypeConformance,
|
|
29
|
+
createArchetypeConformance: () => createArchetypeConformance,
|
|
30
|
+
defineArchetype: () => defineArchetype,
|
|
28
31
|
readArchetypeReference: () => readArchetypeReference,
|
|
29
32
|
validateArchetypeConformance: () => validateArchetypeConformance
|
|
30
33
|
});
|
|
31
34
|
module.exports = __toCommonJS(index_exports);
|
|
32
35
|
var import_platform = require("@fabricorg/platform");
|
|
33
36
|
var ARCHETYPE_SEMANTIC_KEY = "fabric.archetype";
|
|
37
|
+
var ARCHETYPE_ID = /^[a-z][a-z0-9-]*\.[A-Z][A-Za-z0-9]*$/;
|
|
38
|
+
var RESERVED_NAMESPACE = "fabric.";
|
|
34
39
|
var states = (definitions) => Object.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));
|
|
35
40
|
var ARCHETYPES = {
|
|
36
41
|
"fabric.Party": {
|
|
@@ -82,6 +87,99 @@ var ARCHETYPES = {
|
|
|
82
87
|
obligations: ["value and currency are explicit", "settlement is attributable to an agreement"]
|
|
83
88
|
}
|
|
84
89
|
};
|
|
90
|
+
var STATE_CLASSES = /* @__PURE__ */ new Set(["initial", "active", "waiting", "terminal", "exception"]);
|
|
91
|
+
function defineArchetype(definition) {
|
|
92
|
+
if (typeof definition.id !== "string" || !ARCHETYPE_ID.test(definition.id)) {
|
|
93
|
+
throw new Error(`Archetype id "${String(definition.id)}" must be <namespace>.<PascalName>.`);
|
|
94
|
+
}
|
|
95
|
+
if (typeof definition.version !== "string" || definition.version.trim() === "") {
|
|
96
|
+
throw new Error(`Archetype "${definition.id}" must declare a version.`);
|
|
97
|
+
}
|
|
98
|
+
if (typeof definition.description !== "string" || definition.description.trim() === "") {
|
|
99
|
+
throw new Error(`Archetype "${definition.id}" must describe what it classifies.`);
|
|
100
|
+
}
|
|
101
|
+
if (!definition.states || typeof definition.states !== "object" || Array.isArray(definition.states)) {
|
|
102
|
+
throw new Error(`Archetype "${definition.id}" must declare its states as a record keyed by id.`);
|
|
103
|
+
}
|
|
104
|
+
const stateIds = Object.keys(definition.states);
|
|
105
|
+
if (stateIds.length === 0) throw new Error(`Archetype "${definition.id}" must declare at least one state.`);
|
|
106
|
+
for (const [key, state] of Object.entries(definition.states)) {
|
|
107
|
+
if (!state || state.id !== key) throw new Error(`Archetype "${definition.id}" state "${key}" must be keyed by its own id.`);
|
|
108
|
+
if (!STATE_CLASSES.has(state.stateClass)) throw new Error(`Archetype "${definition.id}" state "${key}" has unknown state class "${String(state.stateClass)}".`);
|
|
109
|
+
}
|
|
110
|
+
if (!Object.values(definition.states).some((state) => state.stateClass === "initial" || state.stateClass === "active")) {
|
|
111
|
+
throw new Error(`Archetype "${definition.id}" must declare an initial or active state to start in.`);
|
|
112
|
+
}
|
|
113
|
+
if (!Object.values(definition.states).some((state) => state.stateClass === "terminal" || state.stateClass === "exception")) {
|
|
114
|
+
throw new Error(`Archetype "${definition.id}" must declare a terminal or exception state, or nothing ever ends.`);
|
|
115
|
+
}
|
|
116
|
+
if (!Array.isArray(definition.transitions)) {
|
|
117
|
+
throw new Error(`Archetype "${definition.id}" must declare its transitions as an array.`);
|
|
118
|
+
}
|
|
119
|
+
const seen = /* @__PURE__ */ new Set();
|
|
120
|
+
for (const transition of definition.transitions) {
|
|
121
|
+
if (!Object.hasOwn(definition.states, transition.from) || !Object.hasOwn(definition.states, transition.to)) {
|
|
122
|
+
throw new Error(`Archetype "${definition.id}" transition "${transition.from}" -> "${transition.to}" names an undeclared state.`);
|
|
123
|
+
}
|
|
124
|
+
if (transition.from === transition.to) throw new Error(`Archetype "${definition.id}" transition "${transition.from}" -> "${transition.to}" is a self-loop.`);
|
|
125
|
+
const key = transitionKey(transition.from, transition.to);
|
|
126
|
+
if (seen.has(key)) throw new Error(`Archetype "${definition.id}" declares transition "${transition.from}" -> "${transition.to}" twice.`);
|
|
127
|
+
seen.add(key);
|
|
128
|
+
}
|
|
129
|
+
if (!Array.isArray(definition.obligations) || definition.obligations.some((item) => typeof item !== "string" || item.trim() === "")) {
|
|
130
|
+
throw new Error(`Archetype "${definition.id}" obligations must be non-empty strings.`);
|
|
131
|
+
}
|
|
132
|
+
if (definition.id.startsWith(RESERVED_NAMESPACE)) {
|
|
133
|
+
const reference = Object.hasOwn(ARCHETYPES, definition.id) ? ARCHETYPES[definition.id] : void 0;
|
|
134
|
+
if (!reference || !sameArchetype(reference, definition)) {
|
|
135
|
+
throw new Error(`Archetype "${definition.id}" uses the reserved "fabric." namespace; choose a namespace of your own.`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return Object.freeze({
|
|
139
|
+
id: definition.id,
|
|
140
|
+
version: definition.version,
|
|
141
|
+
description: definition.description,
|
|
142
|
+
states: Object.freeze(Object.fromEntries(Object.entries(definition.states).map(([key, state]) => [key, Object.freeze({ ...state })]))),
|
|
143
|
+
transitions: Object.freeze(definition.transitions.map((transition) => Object.freeze({ ...transition }))),
|
|
144
|
+
obligations: Object.freeze([...definition.obligations])
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function createArchetypeConformance(definitions, options = {}) {
|
|
148
|
+
const merged = options.includeReference === false ? {} : { ...ARCHETYPES };
|
|
149
|
+
for (const definition of definitions) {
|
|
150
|
+
const defined = defineArchetype(definition);
|
|
151
|
+
const existing = merged[defined.id];
|
|
152
|
+
if (existing && !sameArchetype(existing, defined)) {
|
|
153
|
+
throw new Error(`Archetype "${defined.id}" is defined twice.`);
|
|
154
|
+
}
|
|
155
|
+
merged[defined.id] = existing ?? defined;
|
|
156
|
+
}
|
|
157
|
+
const frozen = Object.freeze(merged);
|
|
158
|
+
const validate = (manifest) => validateArchetypeConformance(manifest, frozen);
|
|
159
|
+
const adapterId = options.id ?? `@fabricorg/archetypes:${[
|
|
160
|
+
...options.includeReference === false ? [] : ["reference"],
|
|
161
|
+
...definitions.map((definition) => definition.id).sort()
|
|
162
|
+
].join("+") || "none"}`;
|
|
163
|
+
return {
|
|
164
|
+
definitions: frozen,
|
|
165
|
+
validate,
|
|
166
|
+
assert(module2) {
|
|
167
|
+
assertArchetypeConformance(module2, frozen);
|
|
168
|
+
},
|
|
169
|
+
adapter: { id: adapterId, evaluate: validate }
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function sameArchetype(left, right) {
|
|
173
|
+
const canonical = (definition) => JSON.stringify({
|
|
174
|
+
id: definition.id,
|
|
175
|
+
version: definition.version,
|
|
176
|
+
description: definition.description,
|
|
177
|
+
states: Object.keys(definition.states).sort().map((key) => [key, definition.states[key].stateClass]),
|
|
178
|
+
transitions: definition.transitions.map((transition) => JSON.stringify([transition.from, transition.to, transition.required === true])).sort(),
|
|
179
|
+
obligations: [...definition.obligations].sort()
|
|
180
|
+
});
|
|
181
|
+
return canonical(left) === canonical(right);
|
|
182
|
+
}
|
|
85
183
|
function archetypeSemantics(reference) {
|
|
86
184
|
return { [ARCHETYPE_SEMANTIC_KEY]: reference };
|
|
87
185
|
}
|
|
@@ -95,17 +193,17 @@ function readArchetypeReference(objectType) {
|
|
|
95
193
|
return { id: record.id, version: record.version, stateMap: record.stateMap };
|
|
96
194
|
}
|
|
97
195
|
var transitionKey = (from, to) => `${from}->${to}`;
|
|
98
|
-
function validateArchetypeConformance(manifest) {
|
|
99
|
-
return manifest.objectTypes.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== void 0).map((objectType) => validateObject(manifest, objectType));
|
|
196
|
+
function validateArchetypeConformance(manifest, definitions = ARCHETYPES) {
|
|
197
|
+
return manifest.objectTypes.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== void 0).map((objectType) => validateObject(manifest, objectType, definitions));
|
|
100
198
|
}
|
|
101
|
-
function validateObject(manifest, objectType) {
|
|
199
|
+
function validateObject(manifest, objectType, definitions) {
|
|
102
200
|
const findings = [];
|
|
103
201
|
const reference = readArchetypeReference(objectType);
|
|
104
202
|
if (!reference) {
|
|
105
203
|
findings.push({ code: "invalid_annotation", objectType: objectType.type, message: `Object "${objectType.type}" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });
|
|
106
204
|
return { conforms: false, objectType: objectType.type, findings };
|
|
107
205
|
}
|
|
108
|
-
const definition =
|
|
206
|
+
const definition = Object.hasOwn(definitions, reference.id) ? definitions[reference.id] : void 0;
|
|
109
207
|
if (!definition) {
|
|
110
208
|
findings.push({ code: "unknown_archetype", objectType: objectType.type, message: `Unknown archetype "${reference.id}".` });
|
|
111
209
|
return { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };
|
|
@@ -128,7 +226,7 @@ function validateObject(manifest, objectType) {
|
|
|
128
226
|
findings.push({ code: "unmapped_state", objectType: objectType.type, state: state.id, message: `State "${state.id}" is not mapped.` });
|
|
129
227
|
continue;
|
|
130
228
|
}
|
|
131
|
-
const base = definition.states[mapped];
|
|
229
|
+
const base = Object.hasOwn(definition.states, mapped) ? definition.states[mapped] : void 0;
|
|
132
230
|
if (!base) {
|
|
133
231
|
findings.push({ code: "unknown_archetype_state", objectType: objectType.type, state: state.id, target: mapped, message: `State "${state.id}" maps to unknown archetype state "${mapped}".` });
|
|
134
232
|
} else if (base.stateClass !== state.stateClass) {
|
|
@@ -141,7 +239,7 @@ function validateObject(manifest, objectType) {
|
|
|
141
239
|
const from = reference.stateMap[transition.from];
|
|
142
240
|
const to = reference.stateMap[transition.to];
|
|
143
241
|
if (!from || !to) continue;
|
|
144
|
-
if (to === "exception" && !transition.hasGuard) {
|
|
242
|
+
if (Object.hasOwn(definition.states, to) && definition.states[to].stateClass === "exception" && !transition.hasGuard) {
|
|
145
243
|
findings.push({ code: "exception_transition_unguarded", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition "${transition.from}" -> "${transition.to}" must declare a governance guard.` });
|
|
146
244
|
}
|
|
147
245
|
if (from !== to && !permitted.has(transitionKey(from, to))) {
|
|
@@ -157,8 +255,8 @@ function validateObject(manifest, objectType) {
|
|
|
157
255
|
}
|
|
158
256
|
return { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };
|
|
159
257
|
}
|
|
160
|
-
function assertArchetypeConformance(module2) {
|
|
161
|
-
const failures = validateArchetypeConformance((0, import_platform.exportModuleManifest)(module2)).filter((report) => !report.conforms);
|
|
258
|
+
function assertArchetypeConformance(module2, definitions = ARCHETYPES) {
|
|
259
|
+
const failures = validateArchetypeConformance((0, import_platform.exportModuleManifest)(module2), definitions).filter((report) => !report.conforms);
|
|
162
260
|
if (failures.length > 0) {
|
|
163
261
|
throw new Error(`Archetype conformance failed:
|
|
164
262
|
${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join("\n")}`);
|
|
@@ -171,10 +269,13 @@ var archetypeConformanceAdapter = {
|
|
|
171
269
|
// Annotate the CommonJS export names for ESM import in node:
|
|
172
270
|
0 && (module.exports = {
|
|
173
271
|
ARCHETYPES,
|
|
272
|
+
ARCHETYPE_ID,
|
|
174
273
|
ARCHETYPE_SEMANTIC_KEY,
|
|
175
274
|
archetypeConformanceAdapter,
|
|
176
275
|
archetypeSemantics,
|
|
177
276
|
assertArchetypeConformance,
|
|
277
|
+
createArchetypeConformance,
|
|
278
|
+
defineArchetype,
|
|
178
279
|
readArchetypeReference,
|
|
179
280
|
validateArchetypeConformance
|
|
180
281
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n\texportModuleManifest,\n\ttype FabricModule,\n\ttype JsonValue,\n\ttype ModuleManifest,\n\ttype ModuleManifestObjectType,\n\ttype StateClass,\n} from \"@fabricorg/platform\";\n\nexport const ARCHETYPE_SEMANTIC_KEY = \"fabric.archetype\" as const;\n\nexport type ArchetypeId =\n\t| \"fabric.Party\"\n\t| \"fabric.Offering\"\n\t| \"fabric.Agreement\"\n\t| \"fabric.Resource\"\n\t| \"fabric.Activity\"\n\t| \"fabric.Settlement\";\n\nexport interface ArchetypeReference {\n\tid: ArchetypeId;\n\tversion: string;\n\tstateMap: Record<string, string>;\n}\n\nexport interface ArchetypeState {\n\tid: string;\n\tstateClass: StateClass;\n}\n\nexport interface ArchetypeTransition {\n\tfrom: string;\n\tto: string;\n\trequired?: boolean;\n}\n\nexport interface ArchetypeDefinition {\n\tid: ArchetypeId;\n\tversion: string;\n\tdescription: string;\n\tstates: Record<string, ArchetypeState>;\n\ttransitions: ArchetypeTransition[];\n\tobligations: string[];\n}\n\nexport type ConformanceFindingCode =\n\t| \"invalid_annotation\"\n\t| \"unknown_archetype\"\n\t| \"unsupported_archetype_version\"\n\t| \"missing_state_machine\"\n\t| \"unmapped_state\"\n\t| \"unknown_mapped_state\"\n\t| \"unknown_archetype_state\"\n\t| \"incompatible_state_class\"\n\t| \"transition_not_permitted\"\n\t| \"exception_transition_unguarded\"\n\t| \"required_transition_unreachable\";\n\nexport interface ConformanceFinding {\n\tcode: ConformanceFindingCode;\n\tmessage: string;\n\tobjectType: string;\n\tstate?: string;\n\ttarget?: string;\n}\n\nexport interface ArchetypeConformanceReport {\n\tconforms: boolean;\n\tobjectType: string;\n\tarchetype?: string;\n\tfindings: ConformanceFinding[];\n}\n\nexport interface ManifestConformanceAdapter {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n}\n\nconst states = (definitions: Array<[string, StateClass]>): Record<string, ArchetypeState> =>\n\tObject.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));\n\nexport const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>> = {\n\t\"fabric.Party\": {\n\t\tid: \"fabric.Party\", version: \"0.1\", description: \"A person or organization participating in business relationships.\",\n\t\tstates: states([[\"prospective\", \"initial\"], [\"active\", \"active\"], [\"inactive\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"prospective\", to: \"active\", required: true }, { from: \"active\", to: \"inactive\" }, { from: \"prospective\", to: \"exception\" }, { from: \"active\", to: \"exception\" }],\n\t\tobligations: [\"identity is tenant-scoped\", \"participation is attributable\"],\n\t},\n\t\"fabric.Offering\": {\n\t\tid: \"fabric.Offering\", version: \"0.1\", description: \"Something a party makes available under defined terms.\",\n\t\tstates: states([[\"available\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"retired\" }, { from: \"available\", to: \"exception\" }],\n\t\tobligations: [\"terms are identifiable\", \"availability is explicit\"],\n\t},\n\t\"fabric.Agreement\": {\n\t\tid: \"fabric.Agreement\", version: \"0.1\", description: \"A governed commitment between parties.\",\n\t\tstates: states([[\"proposed\", \"initial\"], [\"committed\", \"active\"], [\"resolved\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"proposed\", to: \"committed\", required: true }, { from: \"committed\", to: \"resolved\", required: true }, { from: \"proposed\", to: \"exception\" }, { from: \"committed\", to: \"exception\" }],\n\t\tobligations: [\"participating parties are attributable\", \"commitment and resolution are auditable\"],\n\t},\n\t\"fabric.Resource\": {\n\t\tid: \"fabric.Resource\", version: \"0.1\", description: \"A capacity or asset allocated by activities.\",\n\t\tstates: states([[\"available\", \"initial\"], [\"allocated\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"allocated\", required: true }, { from: \"allocated\", to: \"available\" }, { from: \"available\", to: \"retired\" }, { from: \"allocated\", to: \"exception\" }],\n\t\tobligations: [\"allocation is identifiable\", \"conflicting allocation is governed\"],\n\t},\n\t\"fabric.Activity\": {\n\t\tid: \"fabric.Activity\", version: \"0.1\", description: \"Work planned and performed toward an outcome.\",\n\t\tstates: states([[\"planned\", \"initial\"], [\"executing\", \"active\"], [\"waiting\", \"waiting\"], [\"completed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"planned\", to: \"executing\", required: true }, { from: \"executing\", to: \"waiting\" }, { from: \"waiting\", to: \"executing\" }, { from: \"executing\", to: \"completed\", required: true }, { from: \"waiting\", to: \"completed\" }, { from: \"planned\", to: \"exception\" }, { from: \"executing\", to: \"exception\" }, { from: \"waiting\", to: \"exception\" }],\n\t\tobligations: [\"responsible party is attributable\", \"resource use and outcome are auditable\"],\n\t},\n\t\"fabric.Settlement\": {\n\t\tid: \"fabric.Settlement\", version: \"0.1\", description: \"Resolution of value exchange associated with an agreement.\",\n\t\tstates: states([[\"pending\", \"initial\"], [\"settled\", \"terminal\"], [\"reversed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"pending\", to: \"settled\", required: true }, { from: \"settled\", to: \"reversed\" }, { from: \"pending\", to: \"exception\" }],\n\t\tobligations: [\"value and currency are explicit\", \"settlement is attributable to an agreement\"],\n\t},\n};\n\nexport function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue> {\n\treturn { [ARCHETYPE_SEMANTIC_KEY]: reference as unknown as JsonValue };\n}\n\nexport function readArchetypeReference(\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeReference | undefined {\n\tconst value = objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY];\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, JsonValue>;\n\tif (typeof record.id !== \"string\" || typeof record.version !== \"string\" || !record.stateMap || typeof record.stateMap !== \"object\" || Array.isArray(record.stateMap)) return undefined;\n\tif (!Object.values(record.stateMap).every((state) => typeof state === \"string\")) return undefined;\n\treturn { id: record.id as ArchetypeId, version: record.version, stateMap: record.stateMap as Record<string, string> };\n}\n\nconst transitionKey = (from: string, to: string) => `${from}->${to}`;\n\nexport function validateArchetypeConformance(\n\tmanifest: ModuleManifest,\n): ArchetypeConformanceReport[] {\n\treturn manifest.objectTypes\n\t\t.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== undefined)\n\t\t.map((objectType) => validateObject(manifest, objectType));\n}\n\nfunction validateObject(\n\tmanifest: ModuleManifest,\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeConformanceReport {\n\tconst findings: ConformanceFinding[] = [];\n\tconst reference = readArchetypeReference(objectType);\n\tif (!reference) {\n\t\tfindings.push({ code: \"invalid_annotation\", objectType: objectType.type, message: `Object \"${objectType.type}\" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });\n\t\treturn { conforms: false, objectType: objectType.type, findings };\n\t}\n\tconst definition = ARCHETYPES[reference.id];\n\tif (!definition) {\n\t\tfindings.push({ code: \"unknown_archetype\", objectType: objectType.type, message: `Unknown archetype \"${reference.id}\".` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tif (reference.version !== definition.version) {\n\t\tfindings.push({ code: \"unsupported_archetype_version\", objectType: objectType.type, message: `Archetype \"${reference.id}\" supports version ${definition.version}, received ${reference.version}.` });\n\t}\n\tconst machine = (manifest.stateMachines ?? []).find((candidate) => candidate.entityType === objectType.type);\n\tif (!machine) {\n\t\tfindings.push({ code: \"missing_state_machine\", objectType: objectType.type, message: `Object \"${objectType.type}\" needs a state machine for archetype conformance.` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tconst declaredStates = new Set(machine.states.map((state) => state.id));\n\tfor (const state of Object.keys(reference.stateMap)) {\n\t\tif (!declaredStates.has(state)) findings.push({ code: \"unknown_mapped_state\", objectType: objectType.type, state, message: `State mapping \"${state}\" does not name a declared state.` });\n\t}\n\tfor (const state of machine.states) {\n\t\tconst mapped = reference.stateMap[state.id];\n\t\tif (!mapped) {\n\t\t\tfindings.push({ code: \"unmapped_state\", objectType: objectType.type, state: state.id, message: `State \"${state.id}\" is not mapped.` });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = definition.states[mapped];\n\t\tif (!base) {\n\t\t\tfindings.push({ code: \"unknown_archetype_state\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" maps to unknown archetype state \"${mapped}\".` });\n\t\t} else if (base.stateClass !== state.stateClass) {\n\t\t\tfindings.push({ code: \"incompatible_state_class\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" (${state.stateClass}) is incompatible with \"${mapped}\" (${base.stateClass}).` });\n\t\t}\n\t}\n\tconst permitted = new Set(definition.transitions.map((transition) => transitionKey(transition.from, transition.to)));\n\tconst realized = new Set<string>();\n\tfor (const transition of machine.transitions) {\n\t\tconst from = reference.stateMap[transition.from];\n\t\tconst to = reference.stateMap[transition.to];\n\t\tif (!from || !to) continue;\n\t\tif (to === \"exception\" && !transition.hasGuard) {\n\t\t\tfindings.push({ code: \"exception_transition_unguarded\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition \"${transition.from}\" -> \"${transition.to}\" must declare a governance guard.` });\n\t\t}\n\t\tif (from !== to && !permitted.has(transitionKey(from, to))) {\n\t\t\tfindings.push({ code: \"transition_not_permitted\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Transition \"${transition.from}\" -> \"${transition.to}\" maps to disallowed archetype transition \"${from}\" -> \"${to}\".` });\n\t\t} else if (from !== to) {\n\t\t\trealized.add(transitionKey(from, to));\n\t\t}\n\t}\n\tfor (const required of definition.transitions.filter((transition) => transition.required)) {\n\t\tif (!realized.has(transitionKey(required.from, required.to))) {\n\t\t\tfindings.push({ code: \"required_transition_unreachable\", objectType: objectType.type, state: required.from, target: required.to, message: `Required archetype transition \"${required.from}\" -> \"${required.to}\" is not realized.` });\n\t\t}\n\t}\n\treturn { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n}\n\nexport function assertArchetypeConformance(module: FabricModule<unknown>): void {\n\tconst failures = validateArchetypeConformance(exportModuleManifest(module)).filter((report) => !report.conforms);\n\tif (failures.length > 0) {\n\t\tthrow new Error(`Archetype conformance failed:\\n${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join(\"\\n\")}`);\n\t}\n}\n\nexport const archetypeConformanceAdapter: ManifestConformanceAdapter = {\n\tid: \"@fabricorg/archetypes\",\n\tevaluate: validateArchetypeConformance,\n};\n"],"m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AI,CAAC,EAAE;AAAA,EAC5K;AACD;AAEO,IAAM,8BAA0D;AAAA,EACtE,IAAI;AAAA,EACJ,UAAU;AACX;","names":["module"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n\texportModuleManifest,\n\ttype FabricModule,\n\ttype JsonValue,\n\ttype ModuleManifest,\n\ttype ModuleManifestObjectType,\n\ttype StateClass,\n} from \"@fabricorg/platform\";\n\nexport const ARCHETYPE_SEMANTIC_KEY = \"fabric.archetype\" as const;\n\n/** The six archetypes this package ships. A reference vocabulary, not the whole vocabulary. */\nexport type ArchetypeId =\n\t| \"fabric.Party\"\n\t| \"fabric.Offering\"\n\t| \"fabric.Agreement\"\n\t| \"fabric.Resource\"\n\t| \"fabric.Activity\"\n\t| \"fabric.Settlement\";\n\n/** The same set under the name that says what it is. */\nexport type ReferenceArchetypeId = ArchetypeId;\n\n/**\n * Any archetype id a reference may name: a shipped one, or one a vertical\n * defined with `defineArchetype`. The intersection keeps editor completion for\n * the shipped ids without closing the set.\n */\nexport type AnyArchetypeId = ArchetypeId | (string & {});\n\n/** `<namespace>.<PascalName>`, so a vertical's vocabulary cannot be mistaken for the reference set. */\nexport const ARCHETYPE_ID = /^[a-z][a-z0-9-]*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** Only the reference set may live under this namespace. */\nconst RESERVED_NAMESPACE = \"fabric.\";\n\nexport interface ArchetypeReference {\n\tid: AnyArchetypeId;\n\tversion: string;\n\tstateMap: Record<string, string>;\n}\n\nexport interface ArchetypeState {\n\tid: string;\n\tstateClass: StateClass;\n}\n\nexport interface ArchetypeTransition {\n\tfrom: string;\n\tto: string;\n\trequired?: boolean;\n}\n\nexport interface ArchetypeDefinition {\n\tid: AnyArchetypeId;\n\tversion: string;\n\tdescription: string;\n\tstates: Record<string, ArchetypeState>;\n\ttransitions: ArchetypeTransition[];\n\tobligations: string[];\n}\n\nexport type ConformanceFindingCode =\n\t| \"invalid_annotation\"\n\t| \"unknown_archetype\"\n\t| \"unsupported_archetype_version\"\n\t| \"missing_state_machine\"\n\t| \"unmapped_state\"\n\t| \"unknown_mapped_state\"\n\t| \"unknown_archetype_state\"\n\t| \"incompatible_state_class\"\n\t| \"transition_not_permitted\"\n\t| \"exception_transition_unguarded\"\n\t| \"required_transition_unreachable\";\n\nexport interface ConformanceFinding {\n\tcode: ConformanceFindingCode;\n\tmessage: string;\n\tobjectType: string;\n\tstate?: string;\n\ttarget?: string;\n}\n\nexport interface ArchetypeConformanceReport {\n\tconforms: boolean;\n\tobjectType: string;\n\tarchetype?: string;\n\tfindings: ConformanceFinding[];\n}\n\nexport interface ManifestConformanceAdapter {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n}\n\nconst states = (definitions: Array<[string, StateClass]>): Record<string, ArchetypeState> =>\n\tObject.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));\n\nexport const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>> = {\n\t\"fabric.Party\": {\n\t\tid: \"fabric.Party\", version: \"0.1\", description: \"A person or organization participating in business relationships.\",\n\t\tstates: states([[\"prospective\", \"initial\"], [\"active\", \"active\"], [\"inactive\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"prospective\", to: \"active\", required: true }, { from: \"active\", to: \"inactive\" }, { from: \"prospective\", to: \"exception\" }, { from: \"active\", to: \"exception\" }],\n\t\tobligations: [\"identity is tenant-scoped\", \"participation is attributable\"],\n\t},\n\t\"fabric.Offering\": {\n\t\tid: \"fabric.Offering\", version: \"0.1\", description: \"Something a party makes available under defined terms.\",\n\t\tstates: states([[\"available\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"retired\" }, { from: \"available\", to: \"exception\" }],\n\t\tobligations: [\"terms are identifiable\", \"availability is explicit\"],\n\t},\n\t\"fabric.Agreement\": {\n\t\tid: \"fabric.Agreement\", version: \"0.1\", description: \"A governed commitment between parties.\",\n\t\tstates: states([[\"proposed\", \"initial\"], [\"committed\", \"active\"], [\"resolved\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"proposed\", to: \"committed\", required: true }, { from: \"committed\", to: \"resolved\", required: true }, { from: \"proposed\", to: \"exception\" }, { from: \"committed\", to: \"exception\" }],\n\t\tobligations: [\"participating parties are attributable\", \"commitment and resolution are auditable\"],\n\t},\n\t\"fabric.Resource\": {\n\t\tid: \"fabric.Resource\", version: \"0.1\", description: \"A capacity or asset allocated by activities.\",\n\t\tstates: states([[\"available\", \"initial\"], [\"allocated\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"allocated\", required: true }, { from: \"allocated\", to: \"available\" }, { from: \"available\", to: \"retired\" }, { from: \"allocated\", to: \"exception\" }],\n\t\tobligations: [\"allocation is identifiable\", \"conflicting allocation is governed\"],\n\t},\n\t\"fabric.Activity\": {\n\t\tid: \"fabric.Activity\", version: \"0.1\", description: \"Work planned and performed toward an outcome.\",\n\t\tstates: states([[\"planned\", \"initial\"], [\"executing\", \"active\"], [\"waiting\", \"waiting\"], [\"completed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"planned\", to: \"executing\", required: true }, { from: \"executing\", to: \"waiting\" }, { from: \"waiting\", to: \"executing\" }, { from: \"executing\", to: \"completed\", required: true }, { from: \"waiting\", to: \"completed\" }, { from: \"planned\", to: \"exception\" }, { from: \"executing\", to: \"exception\" }, { from: \"waiting\", to: \"exception\" }],\n\t\tobligations: [\"responsible party is attributable\", \"resource use and outcome are auditable\"],\n\t},\n\t\"fabric.Settlement\": {\n\t\tid: \"fabric.Settlement\", version: \"0.1\", description: \"Resolution of value exchange associated with an agreement.\",\n\t\tstates: states([[\"pending\", \"initial\"], [\"settled\", \"terminal\"], [\"reversed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"pending\", to: \"settled\", required: true }, { from: \"settled\", to: \"reversed\" }, { from: \"pending\", to: \"exception\" }],\n\t\tobligations: [\"value and currency are explicit\", \"settlement is attributable to an agreement\"],\n\t},\n};\n\nconst STATE_CLASSES: ReadonlySet<string> = new Set([\"initial\", \"active\", \"waiting\", \"terminal\", \"exception\"]);\n\n/**\n * Define an archetype a vertical owns.\n *\n * The shipped six are a reference vocabulary. A platform that has to support\n * verticals nobody has thought of yet cannot ship their nouns, so the seam is\n * the definition itself: a vertical declares its lifecycle classes, permitted\n * refinements, and obligations, and gets the same conformance the reference\n * set gets. Validation here is structural — a definition that names a state\n * its transitions never reach, or a required transition it never declared,\n * would certify nothing and fail nothing.\n */\nexport function defineArchetype(definition: ArchetypeDefinition): ArchetypeDefinition {\n\tif (typeof definition.id !== \"string\" || !ARCHETYPE_ID.test(definition.id)) {\n\t\tthrow new Error(`Archetype id \"${String(definition.id)}\" must be <namespace>.<PascalName>.`);\n\t}\n\tif (typeof definition.version !== \"string\" || definition.version.trim() === \"\") {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare a version.`);\n\t}\n\tif (typeof definition.description !== \"string\" || definition.description.trim() === \"\") {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must describe what it classifies.`);\n\t}\n\tif (!definition.states || typeof definition.states !== \"object\" || Array.isArray(definition.states)) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare its states as a record keyed by id.`);\n\t}\n\tconst stateIds = Object.keys(definition.states);\n\tif (stateIds.length === 0) throw new Error(`Archetype \"${definition.id}\" must declare at least one state.`);\n\tfor (const [key, state] of Object.entries(definition.states)) {\n\t\tif (!state || state.id !== key) throw new Error(`Archetype \"${definition.id}\" state \"${key}\" must be keyed by its own id.`);\n\t\tif (!STATE_CLASSES.has(state.stateClass)) throw new Error(`Archetype \"${definition.id}\" state \"${key}\" has unknown state class \"${String(state.stateClass)}\".`);\n\t}\n\t// A place to start: an initial state, or an active one an object can be\n\t// born into. fabric.Offering has no initial state and is born available.\n\tif (!Object.values(definition.states).some((state) => state.stateClass === \"initial\" || state.stateClass === \"active\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare an initial or active state to start in.`);\n\t}\n\tif (!Object.values(definition.states).some((state) => state.stateClass === \"terminal\" || state.stateClass === \"exception\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare a terminal or exception state, or nothing ever ends.`);\n\t}\n\tif (!Array.isArray(definition.transitions)) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare its transitions as an array.`);\n\t}\n\tconst seen = new Set<string>();\n\tfor (const transition of definition.transitions) {\n\t\tif (!Object.hasOwn(definition.states, transition.from) || !Object.hasOwn(definition.states, transition.to)) {\n\t\t\tthrow new Error(`Archetype \"${definition.id}\" transition \"${transition.from}\" -> \"${transition.to}\" names an undeclared state.`);\n\t\t}\n\t\tif (transition.from === transition.to) throw new Error(`Archetype \"${definition.id}\" transition \"${transition.from}\" -> \"${transition.to}\" is a self-loop.`);\n\t\tconst key = transitionKey(transition.from, transition.to);\n\t\tif (seen.has(key)) throw new Error(`Archetype \"${definition.id}\" declares transition \"${transition.from}\" -> \"${transition.to}\" twice.`);\n\t\tseen.add(key);\n\t}\n\tif (!Array.isArray(definition.obligations) || definition.obligations.some((item) => typeof item !== \"string\" || item.trim() === \"\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" obligations must be non-empty strings.`);\n\t}\n\t// Shape first, then name: a malformed definition gets the named error for\n\t// its shape, and only a well-formed one is compared to the reference set.\n\tif (definition.id.startsWith(RESERVED_NAMESPACE)) {\n\t\tconst reference = Object.hasOwn(ARCHETYPES, definition.id) ? ARCHETYPES[definition.id as ArchetypeId] : undefined;\n\t\tif (!reference || !sameArchetype(reference, definition)) {\n\t\t\tthrow new Error(`Archetype \"${definition.id}\" uses the reserved \"fabric.\" namespace; choose a namespace of your own.`);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tdescription: definition.description,\n\t\tstates: Object.freeze(Object.fromEntries(Object.entries(definition.states).map(([key, state]) => [key, Object.freeze({ ...state })]))),\n\t\ttransitions: Object.freeze(definition.transitions.map((transition) => Object.freeze({ ...transition }))) as ArchetypeTransition[],\n\t\tobligations: Object.freeze([...definition.obligations]) as string[],\n\t});\n}\n\nexport interface ArchetypeConformance {\n\t/** Every archetype this conformance recognises, by id. */\n\treadonly definitions: Readonly<Record<string, ArchetypeDefinition>>;\n\tvalidate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n\tassert(module: FabricModule<unknown>): void;\n\t/** For certification tooling; the compiler never learns an archetype name. */\n\treadonly adapter: ManifestConformanceAdapter;\n}\n\n/**\n * Conformance over a vertical's archetypes plus, by default, the reference set.\n *\n * An id the reference set already uses is accepted only when it is the very\n * same definition. Two meanings of `fabric.Party` in one assembly is not an\n * extension, it is a collision, and it is refused here rather than discovered\n * when two modules disagree at registration.\n */\nexport function createArchetypeConformance(\n\tdefinitions: readonly ArchetypeDefinition[],\n\toptions: { includeReference?: boolean; id?: string } = {},\n): ArchetypeConformance {\n\tconst merged: Record<string, ArchetypeDefinition> = options.includeReference === false ? {} : { ...ARCHETYPES };\n\tfor (const definition of definitions) {\n\t\tconst defined = defineArchetype(definition);\n\t\tconst existing = merged[defined.id];\n\t\tif (existing && !sameArchetype(existing, defined)) {\n\t\t\tthrow new Error(`Archetype \"${defined.id}\" is defined twice.`);\n\t\t}\n\t\tmerged[defined.id] = existing ?? defined;\n\t}\n\tconst frozen = Object.freeze(merged);\n\tconst validate = (manifest: ModuleManifest) => validateArchetypeConformance(manifest, frozen);\n\t// A distinct default id: certification tooling keys results by adapter id\n\t// and does not dedupe, so this must not collide with the shipped adapter.\n\tconst adapterId = options.id ?? `@fabricorg/archetypes:${[\n\t\t...(options.includeReference === false ? [] : [\"reference\"]),\n\t\t...definitions.map((definition) => definition.id).sort(),\n\t].join(\"+\") || \"none\"}`;\n\treturn {\n\t\tdefinitions: frozen,\n\t\tvalidate,\n\t\tassert(module) { assertArchetypeConformance(module, frozen); },\n\t\tadapter: { id: adapterId, evaluate: validate },\n\t};\n}\n\n/** Same meaning, whatever the object identity: a definition repeated verbatim is not a collision. */\nfunction sameArchetype(left: ArchetypeDefinition, right: ArchetypeDefinition): boolean {\n\tconst canonical = (definition: ArchetypeDefinition) => JSON.stringify({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tdescription: definition.description,\n\t\tstates: Object.keys(definition.states).sort().map((key) => [key, definition.states[key]!.stateClass]),\n\t\ttransitions: definition.transitions\n\t\t\t.map((transition) => JSON.stringify([transition.from, transition.to, transition.required === true]))\n\t\t\t.sort(),\n\t\tobligations: [...definition.obligations].sort(),\n\t});\n\treturn canonical(left) === canonical(right);\n}\n\nexport function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue> {\n\treturn { [ARCHETYPE_SEMANTIC_KEY]: reference as unknown as JsonValue };\n}\n\nexport function readArchetypeReference(\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeReference | undefined {\n\tconst value = objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY];\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, JsonValue>;\n\tif (typeof record.id !== \"string\" || typeof record.version !== \"string\" || !record.stateMap || typeof record.stateMap !== \"object\" || Array.isArray(record.stateMap)) return undefined;\n\tif (!Object.values(record.stateMap).every((state) => typeof state === \"string\")) return undefined;\n\treturn { id: record.id as AnyArchetypeId, version: record.version, stateMap: record.stateMap as Record<string, string> };\n}\n\nconst transitionKey = (from: string, to: string) => `${from}->${to}`;\n\nexport function validateArchetypeConformance(\n\tmanifest: ModuleManifest,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>> = ARCHETYPES,\n): ArchetypeConformanceReport[] {\n\treturn manifest.objectTypes\n\t\t.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== undefined)\n\t\t.map((objectType) => validateObject(manifest, objectType, definitions));\n}\n\nfunction validateObject(\n\tmanifest: ModuleManifest,\n\tobjectType: ModuleManifestObjectType,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>>,\n): ArchetypeConformanceReport {\n\tconst findings: ConformanceFinding[] = [];\n\tconst reference = readArchetypeReference(objectType);\n\tif (!reference) {\n\t\tfindings.push({ code: \"invalid_annotation\", objectType: objectType.type, message: `Object \"${objectType.type}\" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });\n\t\treturn { conforms: false, objectType: objectType.type, findings };\n\t}\n\tconst definition = Object.hasOwn(definitions, reference.id) ? definitions[reference.id] : undefined;\n\tif (!definition) {\n\t\tfindings.push({ code: \"unknown_archetype\", objectType: objectType.type, message: `Unknown archetype \"${reference.id}\".` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tif (reference.version !== definition.version) {\n\t\tfindings.push({ code: \"unsupported_archetype_version\", objectType: objectType.type, message: `Archetype \"${reference.id}\" supports version ${definition.version}, received ${reference.version}.` });\n\t}\n\tconst machine = (manifest.stateMachines ?? []).find((candidate) => candidate.entityType === objectType.type);\n\tif (!machine) {\n\t\tfindings.push({ code: \"missing_state_machine\", objectType: objectType.type, message: `Object \"${objectType.type}\" needs a state machine for archetype conformance.` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tconst declaredStates = new Set(machine.states.map((state) => state.id));\n\tfor (const state of Object.keys(reference.stateMap)) {\n\t\tif (!declaredStates.has(state)) findings.push({ code: \"unknown_mapped_state\", objectType: objectType.type, state, message: `State mapping \"${state}\" does not name a declared state.` });\n\t}\n\tfor (const state of machine.states) {\n\t\tconst mapped = reference.stateMap[state.id];\n\t\tif (!mapped) {\n\t\t\tfindings.push({ code: \"unmapped_state\", objectType: objectType.type, state: state.id, message: `State \"${state.id}\" is not mapped.` });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = Object.hasOwn(definition.states, mapped) ? definition.states[mapped] : undefined;\n\t\tif (!base) {\n\t\t\tfindings.push({ code: \"unknown_archetype_state\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" maps to unknown archetype state \"${mapped}\".` });\n\t\t} else if (base.stateClass !== state.stateClass) {\n\t\t\tfindings.push({ code: \"incompatible_state_class\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" (${state.stateClass}) is incompatible with \"${mapped}\" (${base.stateClass}).` });\n\t\t}\n\t}\n\tconst permitted = new Set(definition.transitions.map((transition) => transitionKey(transition.from, transition.to)));\n\tconst realized = new Set<string>();\n\tfor (const transition of machine.transitions) {\n\t\tconst from = reference.stateMap[transition.from];\n\t\tconst to = reference.stateMap[transition.to];\n\t\tif (!from || !to) continue;\n\t\t// By class, never by name: a vertical calls its exception state whatever it likes.\n\t\tif (Object.hasOwn(definition.states, to) && definition.states[to]!.stateClass === \"exception\" && !transition.hasGuard) {\n\t\t\tfindings.push({ code: \"exception_transition_unguarded\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition \"${transition.from}\" -> \"${transition.to}\" must declare a governance guard.` });\n\t\t}\n\t\tif (from !== to && !permitted.has(transitionKey(from, to))) {\n\t\t\tfindings.push({ code: \"transition_not_permitted\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Transition \"${transition.from}\" -> \"${transition.to}\" maps to disallowed archetype transition \"${from}\" -> \"${to}\".` });\n\t\t} else if (from !== to) {\n\t\t\trealized.add(transitionKey(from, to));\n\t\t}\n\t}\n\tfor (const required of definition.transitions.filter((transition) => transition.required)) {\n\t\tif (!realized.has(transitionKey(required.from, required.to))) {\n\t\t\tfindings.push({ code: \"required_transition_unreachable\", objectType: objectType.type, state: required.from, target: required.to, message: `Required archetype transition \"${required.from}\" -> \"${required.to}\" is not realized.` });\n\t\t}\n\t}\n\treturn { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n}\n\nexport function assertArchetypeConformance(\n\tmodule: FabricModule<unknown>,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>> = ARCHETYPES,\n): void {\n\tconst failures = validateArchetypeConformance(exportModuleManifest(module), definitions).filter((report) => !report.conforms);\n\tif (failures.length > 0) {\n\t\tthrow new Error(`Archetype conformance failed:\\n${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join(\"\\n\")}`);\n\t}\n}\n\nexport const archetypeConformanceAdapter: ManifestConformanceAdapter = {\n\tid: \"@fabricorg/archetypes\",\n\tevaluate: validateArchetypeConformance,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOO;AAEA,IAAM,yBAAyB;AAsB/B,IAAM,eAAe;AAG5B,IAAM,qBAAqB;AA6D3B,IAAM,SAAS,CAAC,gBACf,OAAO,YAAY,YAAY,IAAI,CAAC,CAAC,IAAI,UAAU,MAAM,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC;AAE5E,IAAM,aAAiE;AAAA,EAC7E,gBAAgB;AAAA,IACf,IAAI;AAAA,IAAgB,SAAS;AAAA,IAAO,aAAa;AAAA,IACjD,QAAQ,OAAO,CAAC,CAAC,eAAe,SAAS,GAAG,CAAC,UAAU,QAAQ,GAAG,CAAC,YAAY,UAAU,GAAG,CAAC,aAAa,WAAW,CAAC,CAAC;AAAA,IACvH,aAAa,CAAC,EAAE,MAAM,eAAe,IAAI,UAAU,UAAU,KAAK,GAAG,EAAE,MAAM,UAAU,IAAI,WAAW,GAAG,EAAE,MAAM,eAAe,IAAI,YAAY,GAAG,EAAE,MAAM,UAAU,IAAI,YAAY,CAAC;AAAA,IACtL,aAAa,CAAC,6BAA6B,+BAA+B;AAAA,EAC3E;AAAA,EACA,mBAAmB;AAAA,IAClB,IAAI;AAAA,IAAmB,SAAS;AAAA,IAAO,aAAa;AAAA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AAC,WAAW,OAAO,SAAS,IAAI,CAAC,YAAY,KAAK,OAAO,UAAU,KAAK,QAAQ,OAAO,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;AAAA,EAC5K;AACD;AAEO,IAAM,8BAA0D;AAAA,EACtE,IAAI;AAAA,EACJ,UAAU;AACX;","names":["module"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { StateClass, ModuleManifest,
|
|
1
|
+
import { StateClass, ModuleManifest, FabricModule, JsonValue, ModuleManifestObjectType } from '@fabricorg/platform';
|
|
2
2
|
|
|
3
3
|
declare const ARCHETYPE_SEMANTIC_KEY: "fabric.archetype";
|
|
4
|
+
/** The six archetypes this package ships. A reference vocabulary, not the whole vocabulary. */
|
|
4
5
|
type ArchetypeId = "fabric.Party" | "fabric.Offering" | "fabric.Agreement" | "fabric.Resource" | "fabric.Activity" | "fabric.Settlement";
|
|
6
|
+
/** The same set under the name that says what it is. */
|
|
7
|
+
type ReferenceArchetypeId = ArchetypeId;
|
|
8
|
+
/**
|
|
9
|
+
* Any archetype id a reference may name: a shipped one, or one a vertical
|
|
10
|
+
* defined with `defineArchetype`. The intersection keeps editor completion for
|
|
11
|
+
* the shipped ids without closing the set.
|
|
12
|
+
*/
|
|
13
|
+
type AnyArchetypeId = ArchetypeId | (string & {});
|
|
14
|
+
/** `<namespace>.<PascalName>`, so a vertical's vocabulary cannot be mistaken for the reference set. */
|
|
15
|
+
declare const ARCHETYPE_ID: RegExp;
|
|
5
16
|
interface ArchetypeReference {
|
|
6
|
-
id:
|
|
17
|
+
id: AnyArchetypeId;
|
|
7
18
|
version: string;
|
|
8
19
|
stateMap: Record<string, string>;
|
|
9
20
|
}
|
|
@@ -17,7 +28,7 @@ interface ArchetypeTransition {
|
|
|
17
28
|
required?: boolean;
|
|
18
29
|
}
|
|
19
30
|
interface ArchetypeDefinition {
|
|
20
|
-
id:
|
|
31
|
+
id: AnyArchetypeId;
|
|
21
32
|
version: string;
|
|
22
33
|
description: string;
|
|
23
34
|
states: Record<string, ArchetypeState>;
|
|
@@ -43,10 +54,42 @@ interface ManifestConformanceAdapter {
|
|
|
43
54
|
evaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
44
55
|
}
|
|
45
56
|
declare const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>>;
|
|
57
|
+
/**
|
|
58
|
+
* Define an archetype a vertical owns.
|
|
59
|
+
*
|
|
60
|
+
* The shipped six are a reference vocabulary. A platform that has to support
|
|
61
|
+
* verticals nobody has thought of yet cannot ship their nouns, so the seam is
|
|
62
|
+
* the definition itself: a vertical declares its lifecycle classes, permitted
|
|
63
|
+
* refinements, and obligations, and gets the same conformance the reference
|
|
64
|
+
* set gets. Validation here is structural — a definition that names a state
|
|
65
|
+
* its transitions never reach, or a required transition it never declared,
|
|
66
|
+
* would certify nothing and fail nothing.
|
|
67
|
+
*/
|
|
68
|
+
declare function defineArchetype(definition: ArchetypeDefinition): ArchetypeDefinition;
|
|
69
|
+
interface ArchetypeConformance {
|
|
70
|
+
/** Every archetype this conformance recognises, by id. */
|
|
71
|
+
readonly definitions: Readonly<Record<string, ArchetypeDefinition>>;
|
|
72
|
+
validate(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
73
|
+
assert(module: FabricModule<unknown>): void;
|
|
74
|
+
/** For certification tooling; the compiler never learns an archetype name. */
|
|
75
|
+
readonly adapter: ManifestConformanceAdapter;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Conformance over a vertical's archetypes plus, by default, the reference set.
|
|
79
|
+
*
|
|
80
|
+
* An id the reference set already uses is accepted only when it is the very
|
|
81
|
+
* same definition. Two meanings of `fabric.Party` in one assembly is not an
|
|
82
|
+
* extension, it is a collision, and it is refused here rather than discovered
|
|
83
|
+
* when two modules disagree at registration.
|
|
84
|
+
*/
|
|
85
|
+
declare function createArchetypeConformance(definitions: readonly ArchetypeDefinition[], options?: {
|
|
86
|
+
includeReference?: boolean;
|
|
87
|
+
id?: string;
|
|
88
|
+
}): ArchetypeConformance;
|
|
46
89
|
declare function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue>;
|
|
47
90
|
declare function readArchetypeReference(objectType: ModuleManifestObjectType): ArchetypeReference | undefined;
|
|
48
|
-
declare function validateArchetypeConformance(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
49
|
-
declare function assertArchetypeConformance(module: FabricModule<unknown
|
|
91
|
+
declare function validateArchetypeConformance(manifest: ModuleManifest, definitions?: Readonly<Record<string, ArchetypeDefinition>>): ArchetypeConformanceReport[];
|
|
92
|
+
declare function assertArchetypeConformance(module: FabricModule<unknown>, definitions?: Readonly<Record<string, ArchetypeDefinition>>): void;
|
|
50
93
|
declare const archetypeConformanceAdapter: ManifestConformanceAdapter;
|
|
51
94
|
|
|
52
|
-
export { ARCHETYPES, ARCHETYPE_SEMANTIC_KEY, type ArchetypeConformanceReport, type ArchetypeDefinition, type ArchetypeId, type ArchetypeReference, type ArchetypeState, type ArchetypeTransition, type ConformanceFinding, type ConformanceFindingCode, type ManifestConformanceAdapter, archetypeConformanceAdapter, archetypeSemantics, assertArchetypeConformance, readArchetypeReference, validateArchetypeConformance };
|
|
95
|
+
export { ARCHETYPES, ARCHETYPE_ID, ARCHETYPE_SEMANTIC_KEY, type AnyArchetypeId, type ArchetypeConformance, type ArchetypeConformanceReport, type ArchetypeDefinition, type ArchetypeId, type ArchetypeReference, type ArchetypeState, type ArchetypeTransition, type ConformanceFinding, type ConformanceFindingCode, type ManifestConformanceAdapter, type ReferenceArchetypeId, archetypeConformanceAdapter, archetypeSemantics, assertArchetypeConformance, createArchetypeConformance, defineArchetype, readArchetypeReference, validateArchetypeConformance };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { StateClass, ModuleManifest,
|
|
1
|
+
import { StateClass, ModuleManifest, FabricModule, JsonValue, ModuleManifestObjectType } from '@fabricorg/platform';
|
|
2
2
|
|
|
3
3
|
declare const ARCHETYPE_SEMANTIC_KEY: "fabric.archetype";
|
|
4
|
+
/** The six archetypes this package ships. A reference vocabulary, not the whole vocabulary. */
|
|
4
5
|
type ArchetypeId = "fabric.Party" | "fabric.Offering" | "fabric.Agreement" | "fabric.Resource" | "fabric.Activity" | "fabric.Settlement";
|
|
6
|
+
/** The same set under the name that says what it is. */
|
|
7
|
+
type ReferenceArchetypeId = ArchetypeId;
|
|
8
|
+
/**
|
|
9
|
+
* Any archetype id a reference may name: a shipped one, or one a vertical
|
|
10
|
+
* defined with `defineArchetype`. The intersection keeps editor completion for
|
|
11
|
+
* the shipped ids without closing the set.
|
|
12
|
+
*/
|
|
13
|
+
type AnyArchetypeId = ArchetypeId | (string & {});
|
|
14
|
+
/** `<namespace>.<PascalName>`, so a vertical's vocabulary cannot be mistaken for the reference set. */
|
|
15
|
+
declare const ARCHETYPE_ID: RegExp;
|
|
5
16
|
interface ArchetypeReference {
|
|
6
|
-
id:
|
|
17
|
+
id: AnyArchetypeId;
|
|
7
18
|
version: string;
|
|
8
19
|
stateMap: Record<string, string>;
|
|
9
20
|
}
|
|
@@ -17,7 +28,7 @@ interface ArchetypeTransition {
|
|
|
17
28
|
required?: boolean;
|
|
18
29
|
}
|
|
19
30
|
interface ArchetypeDefinition {
|
|
20
|
-
id:
|
|
31
|
+
id: AnyArchetypeId;
|
|
21
32
|
version: string;
|
|
22
33
|
description: string;
|
|
23
34
|
states: Record<string, ArchetypeState>;
|
|
@@ -43,10 +54,42 @@ interface ManifestConformanceAdapter {
|
|
|
43
54
|
evaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
44
55
|
}
|
|
45
56
|
declare const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>>;
|
|
57
|
+
/**
|
|
58
|
+
* Define an archetype a vertical owns.
|
|
59
|
+
*
|
|
60
|
+
* The shipped six are a reference vocabulary. A platform that has to support
|
|
61
|
+
* verticals nobody has thought of yet cannot ship their nouns, so the seam is
|
|
62
|
+
* the definition itself: a vertical declares its lifecycle classes, permitted
|
|
63
|
+
* refinements, and obligations, and gets the same conformance the reference
|
|
64
|
+
* set gets. Validation here is structural — a definition that names a state
|
|
65
|
+
* its transitions never reach, or a required transition it never declared,
|
|
66
|
+
* would certify nothing and fail nothing.
|
|
67
|
+
*/
|
|
68
|
+
declare function defineArchetype(definition: ArchetypeDefinition): ArchetypeDefinition;
|
|
69
|
+
interface ArchetypeConformance {
|
|
70
|
+
/** Every archetype this conformance recognises, by id. */
|
|
71
|
+
readonly definitions: Readonly<Record<string, ArchetypeDefinition>>;
|
|
72
|
+
validate(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
73
|
+
assert(module: FabricModule<unknown>): void;
|
|
74
|
+
/** For certification tooling; the compiler never learns an archetype name. */
|
|
75
|
+
readonly adapter: ManifestConformanceAdapter;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Conformance over a vertical's archetypes plus, by default, the reference set.
|
|
79
|
+
*
|
|
80
|
+
* An id the reference set already uses is accepted only when it is the very
|
|
81
|
+
* same definition. Two meanings of `fabric.Party` in one assembly is not an
|
|
82
|
+
* extension, it is a collision, and it is refused here rather than discovered
|
|
83
|
+
* when two modules disagree at registration.
|
|
84
|
+
*/
|
|
85
|
+
declare function createArchetypeConformance(definitions: readonly ArchetypeDefinition[], options?: {
|
|
86
|
+
includeReference?: boolean;
|
|
87
|
+
id?: string;
|
|
88
|
+
}): ArchetypeConformance;
|
|
46
89
|
declare function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue>;
|
|
47
90
|
declare function readArchetypeReference(objectType: ModuleManifestObjectType): ArchetypeReference | undefined;
|
|
48
|
-
declare function validateArchetypeConformance(manifest: ModuleManifest): ArchetypeConformanceReport[];
|
|
49
|
-
declare function assertArchetypeConformance(module: FabricModule<unknown
|
|
91
|
+
declare function validateArchetypeConformance(manifest: ModuleManifest, definitions?: Readonly<Record<string, ArchetypeDefinition>>): ArchetypeConformanceReport[];
|
|
92
|
+
declare function assertArchetypeConformance(module: FabricModule<unknown>, definitions?: Readonly<Record<string, ArchetypeDefinition>>): void;
|
|
50
93
|
declare const archetypeConformanceAdapter: ManifestConformanceAdapter;
|
|
51
94
|
|
|
52
|
-
export { ARCHETYPES, ARCHETYPE_SEMANTIC_KEY, type ArchetypeConformanceReport, type ArchetypeDefinition, type ArchetypeId, type ArchetypeReference, type ArchetypeState, type ArchetypeTransition, type ConformanceFinding, type ConformanceFindingCode, type ManifestConformanceAdapter, archetypeConformanceAdapter, archetypeSemantics, assertArchetypeConformance, readArchetypeReference, validateArchetypeConformance };
|
|
95
|
+
export { ARCHETYPES, ARCHETYPE_ID, ARCHETYPE_SEMANTIC_KEY, type AnyArchetypeId, type ArchetypeConformance, type ArchetypeConformanceReport, type ArchetypeDefinition, type ArchetypeId, type ArchetypeReference, type ArchetypeState, type ArchetypeTransition, type ConformanceFinding, type ConformanceFindingCode, type ManifestConformanceAdapter, type ReferenceArchetypeId, archetypeConformanceAdapter, archetypeSemantics, assertArchetypeConformance, createArchetypeConformance, defineArchetype, readArchetypeReference, validateArchetypeConformance };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
exportModuleManifest
|
|
4
4
|
} from "@fabricorg/platform";
|
|
5
5
|
var ARCHETYPE_SEMANTIC_KEY = "fabric.archetype";
|
|
6
|
+
var ARCHETYPE_ID = /^[a-z][a-z0-9-]*\.[A-Z][A-Za-z0-9]*$/;
|
|
7
|
+
var RESERVED_NAMESPACE = "fabric.";
|
|
6
8
|
var states = (definitions) => Object.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));
|
|
7
9
|
var ARCHETYPES = {
|
|
8
10
|
"fabric.Party": {
|
|
@@ -54,6 +56,99 @@ var ARCHETYPES = {
|
|
|
54
56
|
obligations: ["value and currency are explicit", "settlement is attributable to an agreement"]
|
|
55
57
|
}
|
|
56
58
|
};
|
|
59
|
+
var STATE_CLASSES = /* @__PURE__ */ new Set(["initial", "active", "waiting", "terminal", "exception"]);
|
|
60
|
+
function defineArchetype(definition) {
|
|
61
|
+
if (typeof definition.id !== "string" || !ARCHETYPE_ID.test(definition.id)) {
|
|
62
|
+
throw new Error(`Archetype id "${String(definition.id)}" must be <namespace>.<PascalName>.`);
|
|
63
|
+
}
|
|
64
|
+
if (typeof definition.version !== "string" || definition.version.trim() === "") {
|
|
65
|
+
throw new Error(`Archetype "${definition.id}" must declare a version.`);
|
|
66
|
+
}
|
|
67
|
+
if (typeof definition.description !== "string" || definition.description.trim() === "") {
|
|
68
|
+
throw new Error(`Archetype "${definition.id}" must describe what it classifies.`);
|
|
69
|
+
}
|
|
70
|
+
if (!definition.states || typeof definition.states !== "object" || Array.isArray(definition.states)) {
|
|
71
|
+
throw new Error(`Archetype "${definition.id}" must declare its states as a record keyed by id.`);
|
|
72
|
+
}
|
|
73
|
+
const stateIds = Object.keys(definition.states);
|
|
74
|
+
if (stateIds.length === 0) throw new Error(`Archetype "${definition.id}" must declare at least one state.`);
|
|
75
|
+
for (const [key, state] of Object.entries(definition.states)) {
|
|
76
|
+
if (!state || state.id !== key) throw new Error(`Archetype "${definition.id}" state "${key}" must be keyed by its own id.`);
|
|
77
|
+
if (!STATE_CLASSES.has(state.stateClass)) throw new Error(`Archetype "${definition.id}" state "${key}" has unknown state class "${String(state.stateClass)}".`);
|
|
78
|
+
}
|
|
79
|
+
if (!Object.values(definition.states).some((state) => state.stateClass === "initial" || state.stateClass === "active")) {
|
|
80
|
+
throw new Error(`Archetype "${definition.id}" must declare an initial or active state to start in.`);
|
|
81
|
+
}
|
|
82
|
+
if (!Object.values(definition.states).some((state) => state.stateClass === "terminal" || state.stateClass === "exception")) {
|
|
83
|
+
throw new Error(`Archetype "${definition.id}" must declare a terminal or exception state, or nothing ever ends.`);
|
|
84
|
+
}
|
|
85
|
+
if (!Array.isArray(definition.transitions)) {
|
|
86
|
+
throw new Error(`Archetype "${definition.id}" must declare its transitions as an array.`);
|
|
87
|
+
}
|
|
88
|
+
const seen = /* @__PURE__ */ new Set();
|
|
89
|
+
for (const transition of definition.transitions) {
|
|
90
|
+
if (!Object.hasOwn(definition.states, transition.from) || !Object.hasOwn(definition.states, transition.to)) {
|
|
91
|
+
throw new Error(`Archetype "${definition.id}" transition "${transition.from}" -> "${transition.to}" names an undeclared state.`);
|
|
92
|
+
}
|
|
93
|
+
if (transition.from === transition.to) throw new Error(`Archetype "${definition.id}" transition "${transition.from}" -> "${transition.to}" is a self-loop.`);
|
|
94
|
+
const key = transitionKey(transition.from, transition.to);
|
|
95
|
+
if (seen.has(key)) throw new Error(`Archetype "${definition.id}" declares transition "${transition.from}" -> "${transition.to}" twice.`);
|
|
96
|
+
seen.add(key);
|
|
97
|
+
}
|
|
98
|
+
if (!Array.isArray(definition.obligations) || definition.obligations.some((item) => typeof item !== "string" || item.trim() === "")) {
|
|
99
|
+
throw new Error(`Archetype "${definition.id}" obligations must be non-empty strings.`);
|
|
100
|
+
}
|
|
101
|
+
if (definition.id.startsWith(RESERVED_NAMESPACE)) {
|
|
102
|
+
const reference = Object.hasOwn(ARCHETYPES, definition.id) ? ARCHETYPES[definition.id] : void 0;
|
|
103
|
+
if (!reference || !sameArchetype(reference, definition)) {
|
|
104
|
+
throw new Error(`Archetype "${definition.id}" uses the reserved "fabric." namespace; choose a namespace of your own.`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
id: definition.id,
|
|
109
|
+
version: definition.version,
|
|
110
|
+
description: definition.description,
|
|
111
|
+
states: Object.freeze(Object.fromEntries(Object.entries(definition.states).map(([key, state]) => [key, Object.freeze({ ...state })]))),
|
|
112
|
+
transitions: Object.freeze(definition.transitions.map((transition) => Object.freeze({ ...transition }))),
|
|
113
|
+
obligations: Object.freeze([...definition.obligations])
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function createArchetypeConformance(definitions, options = {}) {
|
|
117
|
+
const merged = options.includeReference === false ? {} : { ...ARCHETYPES };
|
|
118
|
+
for (const definition of definitions) {
|
|
119
|
+
const defined = defineArchetype(definition);
|
|
120
|
+
const existing = merged[defined.id];
|
|
121
|
+
if (existing && !sameArchetype(existing, defined)) {
|
|
122
|
+
throw new Error(`Archetype "${defined.id}" is defined twice.`);
|
|
123
|
+
}
|
|
124
|
+
merged[defined.id] = existing ?? defined;
|
|
125
|
+
}
|
|
126
|
+
const frozen = Object.freeze(merged);
|
|
127
|
+
const validate = (manifest) => validateArchetypeConformance(manifest, frozen);
|
|
128
|
+
const adapterId = options.id ?? `@fabricorg/archetypes:${[
|
|
129
|
+
...options.includeReference === false ? [] : ["reference"],
|
|
130
|
+
...definitions.map((definition) => definition.id).sort()
|
|
131
|
+
].join("+") || "none"}`;
|
|
132
|
+
return {
|
|
133
|
+
definitions: frozen,
|
|
134
|
+
validate,
|
|
135
|
+
assert(module) {
|
|
136
|
+
assertArchetypeConformance(module, frozen);
|
|
137
|
+
},
|
|
138
|
+
adapter: { id: adapterId, evaluate: validate }
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function sameArchetype(left, right) {
|
|
142
|
+
const canonical = (definition) => JSON.stringify({
|
|
143
|
+
id: definition.id,
|
|
144
|
+
version: definition.version,
|
|
145
|
+
description: definition.description,
|
|
146
|
+
states: Object.keys(definition.states).sort().map((key) => [key, definition.states[key].stateClass]),
|
|
147
|
+
transitions: definition.transitions.map((transition) => JSON.stringify([transition.from, transition.to, transition.required === true])).sort(),
|
|
148
|
+
obligations: [...definition.obligations].sort()
|
|
149
|
+
});
|
|
150
|
+
return canonical(left) === canonical(right);
|
|
151
|
+
}
|
|
57
152
|
function archetypeSemantics(reference) {
|
|
58
153
|
return { [ARCHETYPE_SEMANTIC_KEY]: reference };
|
|
59
154
|
}
|
|
@@ -67,17 +162,17 @@ function readArchetypeReference(objectType) {
|
|
|
67
162
|
return { id: record.id, version: record.version, stateMap: record.stateMap };
|
|
68
163
|
}
|
|
69
164
|
var transitionKey = (from, to) => `${from}->${to}`;
|
|
70
|
-
function validateArchetypeConformance(manifest) {
|
|
71
|
-
return manifest.objectTypes.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== void 0).map((objectType) => validateObject(manifest, objectType));
|
|
165
|
+
function validateArchetypeConformance(manifest, definitions = ARCHETYPES) {
|
|
166
|
+
return manifest.objectTypes.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== void 0).map((objectType) => validateObject(manifest, objectType, definitions));
|
|
72
167
|
}
|
|
73
|
-
function validateObject(manifest, objectType) {
|
|
168
|
+
function validateObject(manifest, objectType, definitions) {
|
|
74
169
|
const findings = [];
|
|
75
170
|
const reference = readArchetypeReference(objectType);
|
|
76
171
|
if (!reference) {
|
|
77
172
|
findings.push({ code: "invalid_annotation", objectType: objectType.type, message: `Object "${objectType.type}" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });
|
|
78
173
|
return { conforms: false, objectType: objectType.type, findings };
|
|
79
174
|
}
|
|
80
|
-
const definition =
|
|
175
|
+
const definition = Object.hasOwn(definitions, reference.id) ? definitions[reference.id] : void 0;
|
|
81
176
|
if (!definition) {
|
|
82
177
|
findings.push({ code: "unknown_archetype", objectType: objectType.type, message: `Unknown archetype "${reference.id}".` });
|
|
83
178
|
return { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };
|
|
@@ -100,7 +195,7 @@ function validateObject(manifest, objectType) {
|
|
|
100
195
|
findings.push({ code: "unmapped_state", objectType: objectType.type, state: state.id, message: `State "${state.id}" is not mapped.` });
|
|
101
196
|
continue;
|
|
102
197
|
}
|
|
103
|
-
const base = definition.states[mapped];
|
|
198
|
+
const base = Object.hasOwn(definition.states, mapped) ? definition.states[mapped] : void 0;
|
|
104
199
|
if (!base) {
|
|
105
200
|
findings.push({ code: "unknown_archetype_state", objectType: objectType.type, state: state.id, target: mapped, message: `State "${state.id}" maps to unknown archetype state "${mapped}".` });
|
|
106
201
|
} else if (base.stateClass !== state.stateClass) {
|
|
@@ -113,7 +208,7 @@ function validateObject(manifest, objectType) {
|
|
|
113
208
|
const from = reference.stateMap[transition.from];
|
|
114
209
|
const to = reference.stateMap[transition.to];
|
|
115
210
|
if (!from || !to) continue;
|
|
116
|
-
if (to === "exception" && !transition.hasGuard) {
|
|
211
|
+
if (Object.hasOwn(definition.states, to) && definition.states[to].stateClass === "exception" && !transition.hasGuard) {
|
|
117
212
|
findings.push({ code: "exception_transition_unguarded", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition "${transition.from}" -> "${transition.to}" must declare a governance guard.` });
|
|
118
213
|
}
|
|
119
214
|
if (from !== to && !permitted.has(transitionKey(from, to))) {
|
|
@@ -129,8 +224,8 @@ function validateObject(manifest, objectType) {
|
|
|
129
224
|
}
|
|
130
225
|
return { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };
|
|
131
226
|
}
|
|
132
|
-
function assertArchetypeConformance(module) {
|
|
133
|
-
const failures = validateArchetypeConformance(exportModuleManifest(module)).filter((report) => !report.conforms);
|
|
227
|
+
function assertArchetypeConformance(module, definitions = ARCHETYPES) {
|
|
228
|
+
const failures = validateArchetypeConformance(exportModuleManifest(module), definitions).filter((report) => !report.conforms);
|
|
134
229
|
if (failures.length > 0) {
|
|
135
230
|
throw new Error(`Archetype conformance failed:
|
|
136
231
|
${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join("\n")}`);
|
|
@@ -142,10 +237,13 @@ var archetypeConformanceAdapter = {
|
|
|
142
237
|
};
|
|
143
238
|
export {
|
|
144
239
|
ARCHETYPES,
|
|
240
|
+
ARCHETYPE_ID,
|
|
145
241
|
ARCHETYPE_SEMANTIC_KEY,
|
|
146
242
|
archetypeConformanceAdapter,
|
|
147
243
|
archetypeSemantics,
|
|
148
244
|
assertArchetypeConformance,
|
|
245
|
+
createArchetypeConformance,
|
|
246
|
+
defineArchetype,
|
|
149
247
|
readArchetypeReference,
|
|
150
248
|
validateArchetypeConformance
|
|
151
249
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n\texportModuleManifest,\n\ttype FabricModule,\n\ttype JsonValue,\n\ttype ModuleManifest,\n\ttype ModuleManifestObjectType,\n\ttype StateClass,\n} from \"@fabricorg/platform\";\n\nexport const ARCHETYPE_SEMANTIC_KEY = \"fabric.archetype\" as const;\n\nexport type ArchetypeId =\n\t| \"fabric.Party\"\n\t| \"fabric.Offering\"\n\t| \"fabric.Agreement\"\n\t| \"fabric.Resource\"\n\t| \"fabric.Activity\"\n\t| \"fabric.Settlement\";\n\nexport interface ArchetypeReference {\n\tid: ArchetypeId;\n\tversion: string;\n\tstateMap: Record<string, string>;\n}\n\nexport interface ArchetypeState {\n\tid: string;\n\tstateClass: StateClass;\n}\n\nexport interface ArchetypeTransition {\n\tfrom: string;\n\tto: string;\n\trequired?: boolean;\n}\n\nexport interface ArchetypeDefinition {\n\tid: ArchetypeId;\n\tversion: string;\n\tdescription: string;\n\tstates: Record<string, ArchetypeState>;\n\ttransitions: ArchetypeTransition[];\n\tobligations: string[];\n}\n\nexport type ConformanceFindingCode =\n\t| \"invalid_annotation\"\n\t| \"unknown_archetype\"\n\t| \"unsupported_archetype_version\"\n\t| \"missing_state_machine\"\n\t| \"unmapped_state\"\n\t| \"unknown_mapped_state\"\n\t| \"unknown_archetype_state\"\n\t| \"incompatible_state_class\"\n\t| \"transition_not_permitted\"\n\t| \"exception_transition_unguarded\"\n\t| \"required_transition_unreachable\";\n\nexport interface ConformanceFinding {\n\tcode: ConformanceFindingCode;\n\tmessage: string;\n\tobjectType: string;\n\tstate?: string;\n\ttarget?: string;\n}\n\nexport interface ArchetypeConformanceReport {\n\tconforms: boolean;\n\tobjectType: string;\n\tarchetype?: string;\n\tfindings: ConformanceFinding[];\n}\n\nexport interface ManifestConformanceAdapter {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n}\n\nconst states = (definitions: Array<[string, StateClass]>): Record<string, ArchetypeState> =>\n\tObject.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));\n\nexport const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>> = {\n\t\"fabric.Party\": {\n\t\tid: \"fabric.Party\", version: \"0.1\", description: \"A person or organization participating in business relationships.\",\n\t\tstates: states([[\"prospective\", \"initial\"], [\"active\", \"active\"], [\"inactive\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"prospective\", to: \"active\", required: true }, { from: \"active\", to: \"inactive\" }, { from: \"prospective\", to: \"exception\" }, { from: \"active\", to: \"exception\" }],\n\t\tobligations: [\"identity is tenant-scoped\", \"participation is attributable\"],\n\t},\n\t\"fabric.Offering\": {\n\t\tid: \"fabric.Offering\", version: \"0.1\", description: \"Something a party makes available under defined terms.\",\n\t\tstates: states([[\"available\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"retired\" }, { from: \"available\", to: \"exception\" }],\n\t\tobligations: [\"terms are identifiable\", \"availability is explicit\"],\n\t},\n\t\"fabric.Agreement\": {\n\t\tid: \"fabric.Agreement\", version: \"0.1\", description: \"A governed commitment between parties.\",\n\t\tstates: states([[\"proposed\", \"initial\"], [\"committed\", \"active\"], [\"resolved\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"proposed\", to: \"committed\", required: true }, { from: \"committed\", to: \"resolved\", required: true }, { from: \"proposed\", to: \"exception\" }, { from: \"committed\", to: \"exception\" }],\n\t\tobligations: [\"participating parties are attributable\", \"commitment and resolution are auditable\"],\n\t},\n\t\"fabric.Resource\": {\n\t\tid: \"fabric.Resource\", version: \"0.1\", description: \"A capacity or asset allocated by activities.\",\n\t\tstates: states([[\"available\", \"initial\"], [\"allocated\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"allocated\", required: true }, { from: \"allocated\", to: \"available\" }, { from: \"available\", to: \"retired\" }, { from: \"allocated\", to: \"exception\" }],\n\t\tobligations: [\"allocation is identifiable\", \"conflicting allocation is governed\"],\n\t},\n\t\"fabric.Activity\": {\n\t\tid: \"fabric.Activity\", version: \"0.1\", description: \"Work planned and performed toward an outcome.\",\n\t\tstates: states([[\"planned\", \"initial\"], [\"executing\", \"active\"], [\"waiting\", \"waiting\"], [\"completed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"planned\", to: \"executing\", required: true }, { from: \"executing\", to: \"waiting\" }, { from: \"waiting\", to: \"executing\" }, { from: \"executing\", to: \"completed\", required: true }, { from: \"waiting\", to: \"completed\" }, { from: \"planned\", to: \"exception\" }, { from: \"executing\", to: \"exception\" }, { from: \"waiting\", to: \"exception\" }],\n\t\tobligations: [\"responsible party is attributable\", \"resource use and outcome are auditable\"],\n\t},\n\t\"fabric.Settlement\": {\n\t\tid: \"fabric.Settlement\", version: \"0.1\", description: \"Resolution of value exchange associated with an agreement.\",\n\t\tstates: states([[\"pending\", \"initial\"], [\"settled\", \"terminal\"], [\"reversed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"pending\", to: \"settled\", required: true }, { from: \"settled\", to: \"reversed\" }, { from: \"pending\", to: \"exception\" }],\n\t\tobligations: [\"value and currency are explicit\", \"settlement is attributable to an agreement\"],\n\t},\n};\n\nexport function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue> {\n\treturn { [ARCHETYPE_SEMANTIC_KEY]: reference as unknown as JsonValue };\n}\n\nexport function readArchetypeReference(\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeReference | undefined {\n\tconst value = objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY];\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, JsonValue>;\n\tif (typeof record.id !== \"string\" || typeof record.version !== \"string\" || !record.stateMap || typeof record.stateMap !== \"object\" || Array.isArray(record.stateMap)) return undefined;\n\tif (!Object.values(record.stateMap).every((state) => typeof state === \"string\")) return undefined;\n\treturn { id: record.id as ArchetypeId, version: record.version, stateMap: record.stateMap as Record<string, string> };\n}\n\nconst transitionKey = (from: string, to: string) => `${from}->${to}`;\n\nexport function validateArchetypeConformance(\n\tmanifest: ModuleManifest,\n): ArchetypeConformanceReport[] {\n\treturn manifest.objectTypes\n\t\t.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== undefined)\n\t\t.map((objectType) => validateObject(manifest, objectType));\n}\n\nfunction validateObject(\n\tmanifest: ModuleManifest,\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeConformanceReport {\n\tconst findings: ConformanceFinding[] = [];\n\tconst reference = readArchetypeReference(objectType);\n\tif (!reference) {\n\t\tfindings.push({ code: \"invalid_annotation\", objectType: objectType.type, message: `Object \"${objectType.type}\" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });\n\t\treturn { conforms: false, objectType: objectType.type, findings };\n\t}\n\tconst definition = ARCHETYPES[reference.id];\n\tif (!definition) {\n\t\tfindings.push({ code: \"unknown_archetype\", objectType: objectType.type, message: `Unknown archetype \"${reference.id}\".` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tif (reference.version !== definition.version) {\n\t\tfindings.push({ code: \"unsupported_archetype_version\", objectType: objectType.type, message: `Archetype \"${reference.id}\" supports version ${definition.version}, received ${reference.version}.` });\n\t}\n\tconst machine = (manifest.stateMachines ?? []).find((candidate) => candidate.entityType === objectType.type);\n\tif (!machine) {\n\t\tfindings.push({ code: \"missing_state_machine\", objectType: objectType.type, message: `Object \"${objectType.type}\" needs a state machine for archetype conformance.` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tconst declaredStates = new Set(machine.states.map((state) => state.id));\n\tfor (const state of Object.keys(reference.stateMap)) {\n\t\tif (!declaredStates.has(state)) findings.push({ code: \"unknown_mapped_state\", objectType: objectType.type, state, message: `State mapping \"${state}\" does not name a declared state.` });\n\t}\n\tfor (const state of machine.states) {\n\t\tconst mapped = reference.stateMap[state.id];\n\t\tif (!mapped) {\n\t\t\tfindings.push({ code: \"unmapped_state\", objectType: objectType.type, state: state.id, message: `State \"${state.id}\" is not mapped.` });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = definition.states[mapped];\n\t\tif (!base) {\n\t\t\tfindings.push({ code: \"unknown_archetype_state\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" maps to unknown archetype state \"${mapped}\".` });\n\t\t} else if (base.stateClass !== state.stateClass) {\n\t\t\tfindings.push({ code: \"incompatible_state_class\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" (${state.stateClass}) is incompatible with \"${mapped}\" (${base.stateClass}).` });\n\t\t}\n\t}\n\tconst permitted = new Set(definition.transitions.map((transition) => transitionKey(transition.from, transition.to)));\n\tconst realized = new Set<string>();\n\tfor (const transition of machine.transitions) {\n\t\tconst from = reference.stateMap[transition.from];\n\t\tconst to = reference.stateMap[transition.to];\n\t\tif (!from || !to) continue;\n\t\tif (to === \"exception\" && !transition.hasGuard) {\n\t\t\tfindings.push({ code: \"exception_transition_unguarded\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition \"${transition.from}\" -> \"${transition.to}\" must declare a governance guard.` });\n\t\t}\n\t\tif (from !== to && !permitted.has(transitionKey(from, to))) {\n\t\t\tfindings.push({ code: \"transition_not_permitted\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Transition \"${transition.from}\" -> \"${transition.to}\" maps to disallowed archetype transition \"${from}\" -> \"${to}\".` });\n\t\t} else if (from !== to) {\n\t\t\trealized.add(transitionKey(from, to));\n\t\t}\n\t}\n\tfor (const required of definition.transitions.filter((transition) => transition.required)) {\n\t\tif (!realized.has(transitionKey(required.from, required.to))) {\n\t\t\tfindings.push({ code: \"required_transition_unreachable\", objectType: objectType.type, state: required.from, target: required.to, message: `Required archetype transition \"${required.from}\" -> \"${required.to}\" is not realized.` });\n\t\t}\n\t}\n\treturn { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n}\n\nexport function assertArchetypeConformance(module: FabricModule<unknown>): void {\n\tconst failures = validateArchetypeConformance(exportModuleManifest(module)).filter((report) => !report.conforms);\n\tif (failures.length > 0) {\n\t\tthrow new Error(`Archetype conformance failed:\\n${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join(\"\\n\")}`);\n\t}\n}\n\nexport const archetypeConformanceAdapter: ManifestConformanceAdapter = {\n\tid: \"@fabricorg/archetypes\",\n\tevaluate: validateArchetypeConformance,\n};\n"],"mappings":";AAAA;AAAA,EACC;AAAA,OAMM;AAEA,IAAM,yBAAyB;AAqEtC,IAAM,SAAS,CAAC,gBACf,OAAO,YAAY,YAAY,IAAI,CAAC,CAAC,IAAI,UAAU,MAAM,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC;AAE5E,IAAM,aAAiE;AAAA,EAC7E,gBAAgB;AAAA,IACf,IAAI;AAAA,IAAgB,SAAS;AAAA,IAAO,aAAa;AAAA,IACjD,QAAQ,OAAO,CAAC,CAAC,eAAe,SAAS,GAAG,CAAC,UAAU,QAAQ,GAAG,CAAC,YAAY,UAAU,GAAG,CAAC,aAAa,WAAW,CAAC,CAAC;AAAA,IACvH,aAAa,CAAC,EAAE,MAAM,eAAe,IAAI,UAAU,UAAU,KAAK,GAAG,EAAE,MAAM,UAAU,IAAI,WAAW,GAAG,EAAE,MAAM,eAAe,IAAI,YAAY,GAAG,EAAE,MAAM,UAAU,IAAI,YAAY,CAAC;AAAA,IACtL,aAAa,CAAC,6BAA6B,+BAA+B;AAAA,EAC3E;AAAA,EACA,mBAAmB;AAAA,IAClB,IA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AAE,qBAAqB,CAAC;AAAA,IACpO;AAAA,EACD;AACA,SAAO,EAAE,UAAU,SAAS,WAAW,GAAG,YAAY,WAAW,MAAM,WAAW,GAAG,UAAU,EAAE,IAAI,UAAU,OAAO,IAAI,SAAS;AACpI;AAEO,SAAS,2BAA2B,QAAqC;AAC/E,QAAM,WAAW,6BAA6B,qBAAqB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,QAAQ;AAC/G,MAAI,SAAS,SAAS,GAAG;AACxB,UAAM,IAAI,MAAM;AAAA,EAAkC,SAAS,QAAQ,CAAC,WAAW,OAAO,SAAS,IAAI,CAAC,YAAY,KAAK,OAAO,UAAU,KAAK,QAAQ,OAAO,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;AAAA,EAC5K;AACD;AAEO,IAAM,8BAA0D;AAAA,EACtE,IAAI;AAAA,EACJ,UAAU;AACX;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import {\n\texportModuleManifest,\n\ttype FabricModule,\n\ttype JsonValue,\n\ttype ModuleManifest,\n\ttype ModuleManifestObjectType,\n\ttype StateClass,\n} from \"@fabricorg/platform\";\n\nexport const ARCHETYPE_SEMANTIC_KEY = \"fabric.archetype\" as const;\n\n/** The six archetypes this package ships. A reference vocabulary, not the whole vocabulary. */\nexport type ArchetypeId =\n\t| \"fabric.Party\"\n\t| \"fabric.Offering\"\n\t| \"fabric.Agreement\"\n\t| \"fabric.Resource\"\n\t| \"fabric.Activity\"\n\t| \"fabric.Settlement\";\n\n/** The same set under the name that says what it is. */\nexport type ReferenceArchetypeId = ArchetypeId;\n\n/**\n * Any archetype id a reference may name: a shipped one, or one a vertical\n * defined with `defineArchetype`. The intersection keeps editor completion for\n * the shipped ids without closing the set.\n */\nexport type AnyArchetypeId = ArchetypeId | (string & {});\n\n/** `<namespace>.<PascalName>`, so a vertical's vocabulary cannot be mistaken for the reference set. */\nexport const ARCHETYPE_ID = /^[a-z][a-z0-9-]*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** Only the reference set may live under this namespace. */\nconst RESERVED_NAMESPACE = \"fabric.\";\n\nexport interface ArchetypeReference {\n\tid: AnyArchetypeId;\n\tversion: string;\n\tstateMap: Record<string, string>;\n}\n\nexport interface ArchetypeState {\n\tid: string;\n\tstateClass: StateClass;\n}\n\nexport interface ArchetypeTransition {\n\tfrom: string;\n\tto: string;\n\trequired?: boolean;\n}\n\nexport interface ArchetypeDefinition {\n\tid: AnyArchetypeId;\n\tversion: string;\n\tdescription: string;\n\tstates: Record<string, ArchetypeState>;\n\ttransitions: ArchetypeTransition[];\n\tobligations: string[];\n}\n\nexport type ConformanceFindingCode =\n\t| \"invalid_annotation\"\n\t| \"unknown_archetype\"\n\t| \"unsupported_archetype_version\"\n\t| \"missing_state_machine\"\n\t| \"unmapped_state\"\n\t| \"unknown_mapped_state\"\n\t| \"unknown_archetype_state\"\n\t| \"incompatible_state_class\"\n\t| \"transition_not_permitted\"\n\t| \"exception_transition_unguarded\"\n\t| \"required_transition_unreachable\";\n\nexport interface ConformanceFinding {\n\tcode: ConformanceFindingCode;\n\tmessage: string;\n\tobjectType: string;\n\tstate?: string;\n\ttarget?: string;\n}\n\nexport interface ArchetypeConformanceReport {\n\tconforms: boolean;\n\tobjectType: string;\n\tarchetype?: string;\n\tfindings: ConformanceFinding[];\n}\n\nexport interface ManifestConformanceAdapter {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n}\n\nconst states = (definitions: Array<[string, StateClass]>): Record<string, ArchetypeState> =>\n\tObject.fromEntries(definitions.map(([id, stateClass]) => [id, { id, stateClass }]));\n\nexport const ARCHETYPES: Readonly<Record<ArchetypeId, ArchetypeDefinition>> = {\n\t\"fabric.Party\": {\n\t\tid: \"fabric.Party\", version: \"0.1\", description: \"A person or organization participating in business relationships.\",\n\t\tstates: states([[\"prospective\", \"initial\"], [\"active\", \"active\"], [\"inactive\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"prospective\", to: \"active\", required: true }, { from: \"active\", to: \"inactive\" }, { from: \"prospective\", to: \"exception\" }, { from: \"active\", to: \"exception\" }],\n\t\tobligations: [\"identity is tenant-scoped\", \"participation is attributable\"],\n\t},\n\t\"fabric.Offering\": {\n\t\tid: \"fabric.Offering\", version: \"0.1\", description: \"Something a party makes available under defined terms.\",\n\t\tstates: states([[\"available\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"retired\" }, { from: \"available\", to: \"exception\" }],\n\t\tobligations: [\"terms are identifiable\", \"availability is explicit\"],\n\t},\n\t\"fabric.Agreement\": {\n\t\tid: \"fabric.Agreement\", version: \"0.1\", description: \"A governed commitment between parties.\",\n\t\tstates: states([[\"proposed\", \"initial\"], [\"committed\", \"active\"], [\"resolved\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"proposed\", to: \"committed\", required: true }, { from: \"committed\", to: \"resolved\", required: true }, { from: \"proposed\", to: \"exception\" }, { from: \"committed\", to: \"exception\" }],\n\t\tobligations: [\"participating parties are attributable\", \"commitment and resolution are auditable\"],\n\t},\n\t\"fabric.Resource\": {\n\t\tid: \"fabric.Resource\", version: \"0.1\", description: \"A capacity or asset allocated by activities.\",\n\t\tstates: states([[\"available\", \"initial\"], [\"allocated\", \"active\"], [\"retired\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"available\", to: \"allocated\", required: true }, { from: \"allocated\", to: \"available\" }, { from: \"available\", to: \"retired\" }, { from: \"allocated\", to: \"exception\" }],\n\t\tobligations: [\"allocation is identifiable\", \"conflicting allocation is governed\"],\n\t},\n\t\"fabric.Activity\": {\n\t\tid: \"fabric.Activity\", version: \"0.1\", description: \"Work planned and performed toward an outcome.\",\n\t\tstates: states([[\"planned\", \"initial\"], [\"executing\", \"active\"], [\"waiting\", \"waiting\"], [\"completed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"planned\", to: \"executing\", required: true }, { from: \"executing\", to: \"waiting\" }, { from: \"waiting\", to: \"executing\" }, { from: \"executing\", to: \"completed\", required: true }, { from: \"waiting\", to: \"completed\" }, { from: \"planned\", to: \"exception\" }, { from: \"executing\", to: \"exception\" }, { from: \"waiting\", to: \"exception\" }],\n\t\tobligations: [\"responsible party is attributable\", \"resource use and outcome are auditable\"],\n\t},\n\t\"fabric.Settlement\": {\n\t\tid: \"fabric.Settlement\", version: \"0.1\", description: \"Resolution of value exchange associated with an agreement.\",\n\t\tstates: states([[\"pending\", \"initial\"], [\"settled\", \"terminal\"], [\"reversed\", \"terminal\"], [\"exception\", \"exception\"]]),\n\t\ttransitions: [{ from: \"pending\", to: \"settled\", required: true }, { from: \"settled\", to: \"reversed\" }, { from: \"pending\", to: \"exception\" }],\n\t\tobligations: [\"value and currency are explicit\", \"settlement is attributable to an agreement\"],\n\t},\n};\n\nconst STATE_CLASSES: ReadonlySet<string> = new Set([\"initial\", \"active\", \"waiting\", \"terminal\", \"exception\"]);\n\n/**\n * Define an archetype a vertical owns.\n *\n * The shipped six are a reference vocabulary. A platform that has to support\n * verticals nobody has thought of yet cannot ship their nouns, so the seam is\n * the definition itself: a vertical declares its lifecycle classes, permitted\n * refinements, and obligations, and gets the same conformance the reference\n * set gets. Validation here is structural — a definition that names a state\n * its transitions never reach, or a required transition it never declared,\n * would certify nothing and fail nothing.\n */\nexport function defineArchetype(definition: ArchetypeDefinition): ArchetypeDefinition {\n\tif (typeof definition.id !== \"string\" || !ARCHETYPE_ID.test(definition.id)) {\n\t\tthrow new Error(`Archetype id \"${String(definition.id)}\" must be <namespace>.<PascalName>.`);\n\t}\n\tif (typeof definition.version !== \"string\" || definition.version.trim() === \"\") {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare a version.`);\n\t}\n\tif (typeof definition.description !== \"string\" || definition.description.trim() === \"\") {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must describe what it classifies.`);\n\t}\n\tif (!definition.states || typeof definition.states !== \"object\" || Array.isArray(definition.states)) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare its states as a record keyed by id.`);\n\t}\n\tconst stateIds = Object.keys(definition.states);\n\tif (stateIds.length === 0) throw new Error(`Archetype \"${definition.id}\" must declare at least one state.`);\n\tfor (const [key, state] of Object.entries(definition.states)) {\n\t\tif (!state || state.id !== key) throw new Error(`Archetype \"${definition.id}\" state \"${key}\" must be keyed by its own id.`);\n\t\tif (!STATE_CLASSES.has(state.stateClass)) throw new Error(`Archetype \"${definition.id}\" state \"${key}\" has unknown state class \"${String(state.stateClass)}\".`);\n\t}\n\t// A place to start: an initial state, or an active one an object can be\n\t// born into. fabric.Offering has no initial state and is born available.\n\tif (!Object.values(definition.states).some((state) => state.stateClass === \"initial\" || state.stateClass === \"active\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare an initial or active state to start in.`);\n\t}\n\tif (!Object.values(definition.states).some((state) => state.stateClass === \"terminal\" || state.stateClass === \"exception\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare a terminal or exception state, or nothing ever ends.`);\n\t}\n\tif (!Array.isArray(definition.transitions)) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" must declare its transitions as an array.`);\n\t}\n\tconst seen = new Set<string>();\n\tfor (const transition of definition.transitions) {\n\t\tif (!Object.hasOwn(definition.states, transition.from) || !Object.hasOwn(definition.states, transition.to)) {\n\t\t\tthrow new Error(`Archetype \"${definition.id}\" transition \"${transition.from}\" -> \"${transition.to}\" names an undeclared state.`);\n\t\t}\n\t\tif (transition.from === transition.to) throw new Error(`Archetype \"${definition.id}\" transition \"${transition.from}\" -> \"${transition.to}\" is a self-loop.`);\n\t\tconst key = transitionKey(transition.from, transition.to);\n\t\tif (seen.has(key)) throw new Error(`Archetype \"${definition.id}\" declares transition \"${transition.from}\" -> \"${transition.to}\" twice.`);\n\t\tseen.add(key);\n\t}\n\tif (!Array.isArray(definition.obligations) || definition.obligations.some((item) => typeof item !== \"string\" || item.trim() === \"\")) {\n\t\tthrow new Error(`Archetype \"${definition.id}\" obligations must be non-empty strings.`);\n\t}\n\t// Shape first, then name: a malformed definition gets the named error for\n\t// its shape, and only a well-formed one is compared to the reference set.\n\tif (definition.id.startsWith(RESERVED_NAMESPACE)) {\n\t\tconst reference = Object.hasOwn(ARCHETYPES, definition.id) ? ARCHETYPES[definition.id as ArchetypeId] : undefined;\n\t\tif (!reference || !sameArchetype(reference, definition)) {\n\t\t\tthrow new Error(`Archetype \"${definition.id}\" uses the reserved \"fabric.\" namespace; choose a namespace of your own.`);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tdescription: definition.description,\n\t\tstates: Object.freeze(Object.fromEntries(Object.entries(definition.states).map(([key, state]) => [key, Object.freeze({ ...state })]))),\n\t\ttransitions: Object.freeze(definition.transitions.map((transition) => Object.freeze({ ...transition }))) as ArchetypeTransition[],\n\t\tobligations: Object.freeze([...definition.obligations]) as string[],\n\t});\n}\n\nexport interface ArchetypeConformance {\n\t/** Every archetype this conformance recognises, by id. */\n\treadonly definitions: Readonly<Record<string, ArchetypeDefinition>>;\n\tvalidate(manifest: ModuleManifest): ArchetypeConformanceReport[];\n\tassert(module: FabricModule<unknown>): void;\n\t/** For certification tooling; the compiler never learns an archetype name. */\n\treadonly adapter: ManifestConformanceAdapter;\n}\n\n/**\n * Conformance over a vertical's archetypes plus, by default, the reference set.\n *\n * An id the reference set already uses is accepted only when it is the very\n * same definition. Two meanings of `fabric.Party` in one assembly is not an\n * extension, it is a collision, and it is refused here rather than discovered\n * when two modules disagree at registration.\n */\nexport function createArchetypeConformance(\n\tdefinitions: readonly ArchetypeDefinition[],\n\toptions: { includeReference?: boolean; id?: string } = {},\n): ArchetypeConformance {\n\tconst merged: Record<string, ArchetypeDefinition> = options.includeReference === false ? {} : { ...ARCHETYPES };\n\tfor (const definition of definitions) {\n\t\tconst defined = defineArchetype(definition);\n\t\tconst existing = merged[defined.id];\n\t\tif (existing && !sameArchetype(existing, defined)) {\n\t\t\tthrow new Error(`Archetype \"${defined.id}\" is defined twice.`);\n\t\t}\n\t\tmerged[defined.id] = existing ?? defined;\n\t}\n\tconst frozen = Object.freeze(merged);\n\tconst validate = (manifest: ModuleManifest) => validateArchetypeConformance(manifest, frozen);\n\t// A distinct default id: certification tooling keys results by adapter id\n\t// and does not dedupe, so this must not collide with the shipped adapter.\n\tconst adapterId = options.id ?? `@fabricorg/archetypes:${[\n\t\t...(options.includeReference === false ? [] : [\"reference\"]),\n\t\t...definitions.map((definition) => definition.id).sort(),\n\t].join(\"+\") || \"none\"}`;\n\treturn {\n\t\tdefinitions: frozen,\n\t\tvalidate,\n\t\tassert(module) { assertArchetypeConformance(module, frozen); },\n\t\tadapter: { id: adapterId, evaluate: validate },\n\t};\n}\n\n/** Same meaning, whatever the object identity: a definition repeated verbatim is not a collision. */\nfunction sameArchetype(left: ArchetypeDefinition, right: ArchetypeDefinition): boolean {\n\tconst canonical = (definition: ArchetypeDefinition) => JSON.stringify({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tdescription: definition.description,\n\t\tstates: Object.keys(definition.states).sort().map((key) => [key, definition.states[key]!.stateClass]),\n\t\ttransitions: definition.transitions\n\t\t\t.map((transition) => JSON.stringify([transition.from, transition.to, transition.required === true]))\n\t\t\t.sort(),\n\t\tobligations: [...definition.obligations].sort(),\n\t});\n\treturn canonical(left) === canonical(right);\n}\n\nexport function archetypeSemantics(reference: ArchetypeReference): Record<string, JsonValue> {\n\treturn { [ARCHETYPE_SEMANTIC_KEY]: reference as unknown as JsonValue };\n}\n\nexport function readArchetypeReference(\n\tobjectType: ModuleManifestObjectType,\n): ArchetypeReference | undefined {\n\tconst value = objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY];\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, JsonValue>;\n\tif (typeof record.id !== \"string\" || typeof record.version !== \"string\" || !record.stateMap || typeof record.stateMap !== \"object\" || Array.isArray(record.stateMap)) return undefined;\n\tif (!Object.values(record.stateMap).every((state) => typeof state === \"string\")) return undefined;\n\treturn { id: record.id as AnyArchetypeId, version: record.version, stateMap: record.stateMap as Record<string, string> };\n}\n\nconst transitionKey = (from: string, to: string) => `${from}->${to}`;\n\nexport function validateArchetypeConformance(\n\tmanifest: ModuleManifest,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>> = ARCHETYPES,\n): ArchetypeConformanceReport[] {\n\treturn manifest.objectTypes\n\t\t.filter((objectType) => objectType.semantics?.[ARCHETYPE_SEMANTIC_KEY] !== undefined)\n\t\t.map((objectType) => validateObject(manifest, objectType, definitions));\n}\n\nfunction validateObject(\n\tmanifest: ModuleManifest,\n\tobjectType: ModuleManifestObjectType,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>>,\n): ArchetypeConformanceReport {\n\tconst findings: ConformanceFinding[] = [];\n\tconst reference = readArchetypeReference(objectType);\n\tif (!reference) {\n\t\tfindings.push({ code: \"invalid_annotation\", objectType: objectType.type, message: `Object \"${objectType.type}\" has an invalid ${ARCHETYPE_SEMANTIC_KEY} annotation.` });\n\t\treturn { conforms: false, objectType: objectType.type, findings };\n\t}\n\tconst definition = Object.hasOwn(definitions, reference.id) ? definitions[reference.id] : undefined;\n\tif (!definition) {\n\t\tfindings.push({ code: \"unknown_archetype\", objectType: objectType.type, message: `Unknown archetype \"${reference.id}\".` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tif (reference.version !== definition.version) {\n\t\tfindings.push({ code: \"unsupported_archetype_version\", objectType: objectType.type, message: `Archetype \"${reference.id}\" supports version ${definition.version}, received ${reference.version}.` });\n\t}\n\tconst machine = (manifest.stateMachines ?? []).find((candidate) => candidate.entityType === objectType.type);\n\tif (!machine) {\n\t\tfindings.push({ code: \"missing_state_machine\", objectType: objectType.type, message: `Object \"${objectType.type}\" needs a state machine for archetype conformance.` });\n\t\treturn { conforms: false, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n\t}\n\tconst declaredStates = new Set(machine.states.map((state) => state.id));\n\tfor (const state of Object.keys(reference.stateMap)) {\n\t\tif (!declaredStates.has(state)) findings.push({ code: \"unknown_mapped_state\", objectType: objectType.type, state, message: `State mapping \"${state}\" does not name a declared state.` });\n\t}\n\tfor (const state of machine.states) {\n\t\tconst mapped = reference.stateMap[state.id];\n\t\tif (!mapped) {\n\t\t\tfindings.push({ code: \"unmapped_state\", objectType: objectType.type, state: state.id, message: `State \"${state.id}\" is not mapped.` });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = Object.hasOwn(definition.states, mapped) ? definition.states[mapped] : undefined;\n\t\tif (!base) {\n\t\t\tfindings.push({ code: \"unknown_archetype_state\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" maps to unknown archetype state \"${mapped}\".` });\n\t\t} else if (base.stateClass !== state.stateClass) {\n\t\t\tfindings.push({ code: \"incompatible_state_class\", objectType: objectType.type, state: state.id, target: mapped, message: `State \"${state.id}\" (${state.stateClass}) is incompatible with \"${mapped}\" (${base.stateClass}).` });\n\t\t}\n\t}\n\tconst permitted = new Set(definition.transitions.map((transition) => transitionKey(transition.from, transition.to)));\n\tconst realized = new Set<string>();\n\tfor (const transition of machine.transitions) {\n\t\tconst from = reference.stateMap[transition.from];\n\t\tconst to = reference.stateMap[transition.to];\n\t\tif (!from || !to) continue;\n\t\t// By class, never by name: a vertical calls its exception state whatever it likes.\n\t\tif (Object.hasOwn(definition.states, to) && definition.states[to]!.stateClass === \"exception\" && !transition.hasGuard) {\n\t\t\tfindings.push({ code: \"exception_transition_unguarded\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Exception transition \"${transition.from}\" -> \"${transition.to}\" must declare a governance guard.` });\n\t\t}\n\t\tif (from !== to && !permitted.has(transitionKey(from, to))) {\n\t\t\tfindings.push({ code: \"transition_not_permitted\", objectType: objectType.type, state: transition.from, target: transition.to, message: `Transition \"${transition.from}\" -> \"${transition.to}\" maps to disallowed archetype transition \"${from}\" -> \"${to}\".` });\n\t\t} else if (from !== to) {\n\t\t\trealized.add(transitionKey(from, to));\n\t\t}\n\t}\n\tfor (const required of definition.transitions.filter((transition) => transition.required)) {\n\t\tif (!realized.has(transitionKey(required.from, required.to))) {\n\t\t\tfindings.push({ code: \"required_transition_unreachable\", objectType: objectType.type, state: required.from, target: required.to, message: `Required archetype transition \"${required.from}\" -> \"${required.to}\" is not realized.` });\n\t\t}\n\t}\n\treturn { conforms: findings.length === 0, objectType: objectType.type, archetype: `${reference.id}@${reference.version}`, findings };\n}\n\nexport function assertArchetypeConformance(\n\tmodule: FabricModule<unknown>,\n\tdefinitions: Readonly<Record<string, ArchetypeDefinition>> = ARCHETYPES,\n): void {\n\tconst failures = validateArchetypeConformance(exportModuleManifest(module), definitions).filter((report) => !report.conforms);\n\tif (failures.length > 0) {\n\t\tthrow new Error(`Archetype conformance failed:\\n${failures.flatMap((report) => report.findings.map((finding) => `- ${report.objectType}: ${finding.message}`)).join(\"\\n\")}`);\n\t}\n}\n\nexport const archetypeConformanceAdapter: ManifestConformanceAdapter = {\n\tid: \"@fabricorg/archetypes\",\n\tevaluate: validateArchetypeConformance,\n};\n"],"mappings":";AAAA;AAAA,EACC;AAAA,OAMM;AAEA,IAAM,yBAAyB;AAsB/B,IAAM,eAAe;AAG5B,IAAM,qBAAqB;AA6D3B,IAAM,SAAS,CAAC,gBACf,OAAO,YAAY,YAAY,IAAI,CAAC,CAAC,IAAI,UAAU,MAAM,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC;AAE5E,IAAM,aAAiE;AAAA,EAC7E,gBAAgB;AAAA,IACf,IAAI;AAAA,IAAgB,SAAS;AAAA,IAAO,aAAa;AAAA,IACjD,QAAQ,OAAO,CAAC,CAAC,eAAe,SAAS,GAAG,CAAC,UAAU,QAAQ,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BAAqB,CAAC;AAAA,IACpO;AAAA,EACD;AACA,SAAO,EAAE,UAAU,SAAS,WAAW,GAAG,YAAY,WAAW,MAAM,WAAW,GAAG,UAAU,EAAE,IAAI,UAAU,OAAO,IAAI,SAAS;AACpI;AAEO,SAAS,2BACf,QACA,cAA6D,YACtD;AACP,QAAM,WAAW,6BAA6B,qBAAqB,MAAM,GAAG,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,QAAQ;AAC5H,MAAI,SAAS,SAAS,GAAG;AACxB,UAAM,IAAI,MAAM;AAAA,EAAkC,SAAS,QAAQ,CAAC,WAAW,OAAO,SAAS,IAAI,CAAC,YAAY,KAAK,OAAO,UAAU,KAAK,QAAQ,OAAO,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;AAAA,EAC5K;AACD;AAEO,IAAM,8BAA0D;AAAA,EACtE,IAAI;AAAA,EACJ,UAAU;AACX;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabricorg/archetypes",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Optional cross-industry archetype vocabulary and conformance tools for Fabric module manifests.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Fabric-Pro/fabric-platform.git",
|
|
9
|
+
"directory": "packages/archetypes"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Fabric-Pro/fabric-platform/tree/main/packages/archetypes#readme",
|
|
12
|
+
"bugs": "https://github.com/Fabric-Pro/fabric-platform/issues",
|
|
6
13
|
"type": "module",
|
|
7
14
|
"sideEffects": false,
|
|
8
15
|
"main": "./dist/index.cjs",
|
|
@@ -25,14 +32,14 @@
|
|
|
25
32
|
"CHANGELOG.md"
|
|
26
33
|
],
|
|
27
34
|
"peerDependencies": {
|
|
28
|
-
"@fabricorg/platform": "^1.
|
|
35
|
+
"@fabricorg/platform": "^1.5.1"
|
|
29
36
|
},
|
|
30
37
|
"devDependencies": {
|
|
31
38
|
"@types/node": "^22.10.0",
|
|
32
39
|
"tsup": "^8.5.0",
|
|
33
40
|
"typescript": "^5.7.3",
|
|
34
41
|
"vitest": "^4.1.5",
|
|
35
|
-
"@fabricorg/platform": "^1.
|
|
42
|
+
"@fabricorg/platform": "^1.5.1"
|
|
36
43
|
},
|
|
37
44
|
"engines": {
|
|
38
45
|
"node": ">=20"
|