@fabricorg/compiler 2.0.0 → 2.2.0
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 +51 -0
- package/dist/index.cjs +80 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +80 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @fabricorg/compiler
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Release additive public compiler and generator APIs as minor versions. This includes parameterized
|
|
8
|
+
view schema contracts, the exported usage-contract JSON schema, and the runtime Platform validation
|
|
9
|
+
used by capability generation.
|
|
10
|
+
|
|
11
|
+
## 2.1.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b932767: Add portable parameter schemas and validation for projection views. Projection snapshot keys now
|
|
16
|
+
include a canonical parameter identity, generated capability and experience contracts preserve view
|
|
17
|
+
parameter schemas, and compatible snapshots continue through the explicit `upgradeSnapshot` seam.
|
|
18
|
+
|
|
19
|
+
### Additional release notes
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Validate and diff portable projection view parameter schemas in compiled module manifests.
|
|
24
|
+
|
|
25
|
+
## 2.1.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- c504d0a: Make durability a declared, diffable contract.
|
|
30
|
+
|
|
31
|
+
`CapabilityMetadata` gains `workflows`: each declares its task queue, the event that starts it, the
|
|
32
|
+
durable deadlines it carries (resolved from configuration keys, never literals), and which governed
|
|
33
|
+
action reverses each compensatable step. The field is additive, so `MODULE_MANIFEST_VERSION` stays
|
|
34
|
+
at 2.
|
|
35
|
+
|
|
36
|
+
`diffModuleManifests` classifies this plane instead of reporting one blanket capability change:
|
|
37
|
+
adding a workflow, timer or reversal is compatible; moving a task queue, changing a trigger, dropping
|
|
38
|
+
a deadline or repointing a reversal is potentially breaking; removing a workflow or reversal is
|
|
39
|
+
breaking.
|
|
40
|
+
|
|
41
|
+
The compiler validates serialized workflow declarations, which never pass through a registry, and
|
|
42
|
+
rejects an action declaring `completion: "immediate"` while `kind: "saga"` — a manifest contradiction
|
|
43
|
+
that now fails the build rather than a running host.
|
|
44
|
+
|
|
45
|
+
`platform-temporal` executes declared reversals. `runCompensatedSaga` unwinds newest-first, routes
|
|
46
|
+
every reversal through the governed Host under a distinct deterministic
|
|
47
|
+
`compensationInvocationIdentity`, and surfaces a reversal that itself failed on
|
|
48
|
+
`SagaCompensationError` rather than swallowing it. A step that _resolves_ with a non-successful
|
|
49
|
+
status — blocked, failed, parked for approval, sent to reconciliation — now triggers the unwind
|
|
50
|
+
instead of being recorded as completed. Step identities must be unique and may not use the reserved
|
|
51
|
+
`compensate:` prefix, and when a `workflow` declaration is supplied every reversal is checked against
|
|
52
|
+
it.
|
|
53
|
+
|
|
3
54
|
## 2.0.0
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -75,12 +75,42 @@ function compileManifestBundle(input, options = {}) {
|
|
|
75
75
|
)
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
+
function assertManifestWorkflows(module2) {
|
|
79
|
+
for (const action of module2.actions) {
|
|
80
|
+
if (action.execution?.completion === "immediate" && action.kind === "saga") {
|
|
81
|
+
throw new Error(`Action "${action.actionId}" declares immediate completion but is a multi-step saga.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const actionsById = new Map(module2.actions.map((action) => [action.actionId, action]));
|
|
85
|
+
const names = /* @__PURE__ */ new Set();
|
|
86
|
+
for (const workflow of module2.capability?.workflows ?? []) {
|
|
87
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) throw new Error(`Module "${module2.namespace}" declares invalid workflow name "${workflow.name}".`);
|
|
88
|
+
if (names.has(workflow.name)) throw new Error(`Module "${module2.namespace}" declares duplicate workflow "${workflow.name}".`);
|
|
89
|
+
names.add(workflow.name);
|
|
90
|
+
if (!/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" declares invalid task queue "${workflow.taskQueue}".`);
|
|
91
|
+
const timerNames = /* @__PURE__ */ new Set();
|
|
92
|
+
for (const timer of workflow.timers ?? []) {
|
|
93
|
+
if (!timer.name?.trim() || !timer.configKey?.trim()) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" has a timer without a name or configKey.`);
|
|
94
|
+
if (timerNames.has(timer.name)) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" declares duplicate timer "${timer.name}".`);
|
|
95
|
+
timerNames.add(timer.name);
|
|
96
|
+
}
|
|
97
|
+
const steps = /* @__PURE__ */ new Set();
|
|
98
|
+
for (const compensation of workflow.compensations ?? []) {
|
|
99
|
+
if (steps.has(compensation.step)) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" declares duplicate compensation for step "${compensation.step}".`);
|
|
100
|
+
steps.add(compensation.step);
|
|
101
|
+
const compensating = actionsById.get(compensation.actionId);
|
|
102
|
+
if (!compensating) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" compensates step "${compensation.step}" with unknown action "${compensation.actionId}".`);
|
|
103
|
+
if (!compensating.idempotent) throw new Error(`Module "${module2.namespace}" workflow "${workflow.name}" compensates step "${compensation.step}" with non-idempotent action "${compensation.actionId}"; a reversal must be safely repeatable.`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
78
107
|
function assertCompilerManifests(modules, certificationProfiles) {
|
|
79
108
|
const profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));
|
|
80
109
|
if (profiles.size !== certificationProfiles.length) throw new Error("Certification profile IDs must be unique.");
|
|
81
110
|
for (const module2 of modules) {
|
|
82
111
|
if (!module2 || !/^[a-z][a-z0-9-]*$/.test(module2.namespace) || !Array.isArray(module2.objectTypes) || !Array.isArray(module2.actions) || !Array.isArray(module2.views)) throw new Error("Compiler input is not a normalized module manifest.");
|
|
83
112
|
}
|
|
113
|
+
for (const module2 of modules) assertManifestWorkflows(module2);
|
|
84
114
|
const targets = new Set(modules.flatMap((module2) => module2.objectTypes.map((objectType) => `${module2.namespace}.${objectType.type}`)));
|
|
85
115
|
for (const module2 of modules) {
|
|
86
116
|
if (module2.capability) {
|
|
@@ -102,6 +132,7 @@ function assertCompilerManifests(modules, certificationProfiles) {
|
|
|
102
132
|
for (const view of module2.views) {
|
|
103
133
|
if (!view.name.startsWith(`${module2.namespace}/`)) throw new Error(`View "${view.name}" must use module namespace "${module2.namespace}/".`);
|
|
104
134
|
(0, import_platform.assertPortableJsonSchema)(view.shape, `View ${view.name}@${view.version}`);
|
|
135
|
+
if (view.parameterSchema !== void 0) (0, import_platform.assertPortableJsonSchema)(view.parameterSchema, `View ${view.name}@${view.version} parameters`);
|
|
105
136
|
if (view.usage?.collection?.filterSchema) (0, import_platform.assertPortableJsonSchema)(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);
|
|
106
137
|
}
|
|
107
138
|
for (const eventType of module2.eventTypes) if (eventType.schema) (0, import_platform.assertPortableJsonSchema)(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);
|
|
@@ -136,7 +167,8 @@ function diffModuleManifests(before, after) {
|
|
|
136
167
|
}
|
|
137
168
|
const changes = [];
|
|
138
169
|
if (before.version !== after.version) changes.push({ severity: "potentially_breaking", path: "version", code: "module_version_changed", message: "Module version changed." });
|
|
139
|
-
if (stableStringify(before.capability) !== stableStringify(after.capability)) changes.push({ severity: "potentially_breaking", path: "capability", code: "capability_changed", message: "Capability stability, requirements, extensions, deprecation, or certification metadata changed." });
|
|
170
|
+
if (stableStringify(withoutWorkflows(before.capability)) !== stableStringify(withoutWorkflows(after.capability))) changes.push({ severity: "potentially_breaking", path: "capability", code: "capability_changed", message: "Capability stability, requirements, extensions, deprecation, or certification metadata changed." });
|
|
171
|
+
diffCapabilityWorkflows(before.capability?.workflows ?? [], after.capability?.workflows ?? [], changes);
|
|
140
172
|
diffStringList(before.subjectTypes, after.subjectTypes, "subjectTypes", changes);
|
|
141
173
|
diffNamed(before.idPrefixes, after.idPrefixes, "idPrefixes", "prefix", changes, (oldValue, newValue, path2) => {
|
|
142
174
|
if (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: "breaking", path: path2, code: "id_prefix_changed", message: "ID prefix ownership changed." });
|
|
@@ -188,6 +220,7 @@ function diffModuleManifests(before, after) {
|
|
|
188
220
|
if (!newView) changes.push({ severity: "breaking", path: `views.${key}`, code: "view_version_removed", message: `View contract "${key}" was removed.` });
|
|
189
221
|
else {
|
|
190
222
|
diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);
|
|
223
|
+
diffSchema(oldView.parameterSchema, newView.parameterSchema, `views.${key}.parameterSchema`, changes);
|
|
191
224
|
if (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: "potentially_breaking", path: `views.${key}.usage`, code: "view_usage_changed", message: "View usage semantics changed and generated consumers require review." });
|
|
192
225
|
}
|
|
193
226
|
}
|
|
@@ -200,6 +233,52 @@ function diffModuleManifests(before, after) {
|
|
|
200
233
|
});
|
|
201
234
|
return report(changes);
|
|
202
235
|
}
|
|
236
|
+
function withoutWorkflows(capability) {
|
|
237
|
+
if (!capability) return capability;
|
|
238
|
+
const { workflows, ...rest } = capability;
|
|
239
|
+
void workflows;
|
|
240
|
+
return rest;
|
|
241
|
+
}
|
|
242
|
+
function diffCapabilityWorkflows(before, after, changes) {
|
|
243
|
+
const oldWorkflows = new Map(before.map((workflow) => [workflow.name, workflow]));
|
|
244
|
+
const newWorkflows = new Map(after.map((workflow) => [workflow.name, workflow]));
|
|
245
|
+
for (const [name, oldWorkflow] of oldWorkflows) {
|
|
246
|
+
const path2 = `capability.workflows.${name}`;
|
|
247
|
+
const newWorkflow = newWorkflows.get(name);
|
|
248
|
+
if (!newWorkflow) {
|
|
249
|
+
changes.push({ severity: "breaking", path: path2, code: "workflow_removed", message: `Declared workflow "${name}" was removed.` });
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (oldWorkflow.taskQueue !== newWorkflow.taskQueue) changes.push({ severity: "potentially_breaking", path: `${path2}.taskQueue`, code: "workflow_task_queue_changed", message: `Workflow "${name}" moved from task queue "${oldWorkflow.taskQueue}" to "${newWorkflow.taskQueue}"; in-flight executions and worker routing require review.` });
|
|
253
|
+
if (oldWorkflow.startedBy !== newWorkflow.startedBy) changes.push({ severity: "potentially_breaking", path: `${path2}.startedBy`, code: "workflow_trigger_changed", message: `Workflow "${name}" changed the event that starts it.` });
|
|
254
|
+
const oldTimers = new Map((oldWorkflow.timers ?? []).map((timer) => [timer.name, timer]));
|
|
255
|
+
const newTimers = new Map((newWorkflow.timers ?? []).map((timer) => [timer.name, timer]));
|
|
256
|
+
for (const [timerName, oldTimer] of oldTimers) {
|
|
257
|
+
const timerPath = `${path2}.timers.${timerName}`;
|
|
258
|
+
const newTimer = newTimers.get(timerName);
|
|
259
|
+
if (!newTimer) {
|
|
260
|
+
changes.push({ severity: "potentially_breaking", path: timerPath, code: "workflow_timer_removed", message: `Workflow "${name}" no longer carries the deadline "${timerName}".` });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (oldTimer.configKey !== newTimer.configKey) changes.push({ severity: "potentially_breaking", path: `${timerPath}.configKey`, code: "workflow_timer_config_changed", message: `Deadline "${timerName}" now resolves from configuration key "${newTimer.configKey}".` });
|
|
264
|
+
if (oldTimer.description !== newTimer.description) changes.push({ severity: "compatible", path: `${timerPath}.description`, code: "workflow_timer_description_changed", message: `Deadline "${timerName}" changed its description.` });
|
|
265
|
+
}
|
|
266
|
+
for (const timerName of newTimers.keys()) if (!oldTimers.has(timerName)) changes.push({ severity: "compatible", path: `${path2}.timers.${timerName}`, code: "workflow_timer_added", message: `Workflow "${name}" gained the deadline "${timerName}".` });
|
|
267
|
+
const oldCompensations = new Map((oldWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));
|
|
268
|
+
const newCompensations = new Map((newWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));
|
|
269
|
+
for (const [step, oldCompensation] of oldCompensations) {
|
|
270
|
+
const stepPath = `${path2}.compensations.${step}`;
|
|
271
|
+
const newCompensation = newCompensations.get(step);
|
|
272
|
+
if (!newCompensation) {
|
|
273
|
+
changes.push({ severity: "breaking", path: stepPath, code: "workflow_compensation_removed", message: `Workflow "${name}" no longer reverses step "${step}".` });
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if (oldCompensation.actionId !== newCompensation.actionId) changes.push({ severity: "potentially_breaking", path: `${stepPath}.actionId`, code: "workflow_compensation_changed", message: `Step "${step}" is now reversed by "${newCompensation.actionId}".` });
|
|
277
|
+
}
|
|
278
|
+
for (const step of newCompensations.keys()) if (!oldCompensations.has(step)) changes.push({ severity: "compatible", path: `${path2}.compensations.${step}`, code: "workflow_compensation_added", message: `Workflow "${name}" gained a reversal for step "${step}".` });
|
|
279
|
+
}
|
|
280
|
+
for (const name of newWorkflows.keys()) if (!oldWorkflows.has(name)) changes.push({ severity: "compatible", path: `capability.workflows.${name}`, code: "workflow_added", message: `Workflow "${name}" was added.` });
|
|
281
|
+
}
|
|
203
282
|
function diffEventSchema(before, after, path2, changes) {
|
|
204
283
|
const start = changes.length;
|
|
205
284
|
diffSchema(before, after, path2, changes);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype DeclarativeInvariant,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"2.0.0\";\nexport const compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface CompilerConformanceAdapter<Finding = unknown> {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): Finding[];\n}\n\nexport interface CompilerConformanceResult<Finding = unknown> {\n\tadapterId: string;\n\tmoduleNamespace: string;\n\tfindings: Finding[];\n}\n\nexport interface CertificationInvariantContext {\n\tmodule: ModuleManifest;\n\tobjectType: ModuleManifest[\"objectTypes\"][number];\n\tinvariant: DeclarativeInvariant;\n}\n\nexport interface CertificationProfile {\n\tid: string;\n\t/** Resolve evidence owned outside serialized Platform definitions. */\n\tresolveInvariant?(context: CertificationInvariantContext): boolean;\n}\n\nexport interface FabricCompilerIr {\n\tcompilerVersion: string;\n\tmanifestVersion: number;\n\tmanifestDigest: string;\n\tmodules: ModuleManifest[];\n\tconformance: CompilerConformanceResult[];\n}\n\nexport function stableStringify(value: unknown): string {\n\treturn JSON.stringify(sortJson(value));\n}\n\nfunction sortJson(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(sortJson);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>)\n\t\t\t\t.sort(([left], [right]) => compareCanonicalStrings(left, right))\n\t\t\t\t.map(([key, child]) => [key, sortJson(child)]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function compileManifestBundle(\n\tinput: ModuleManifestBundle | ModuleManifestBundleV1,\n\toptions: { conformanceAdapters?: CompilerConformanceAdapter[]; certificationProfiles?: CertificationProfile[] } = {},\n): FabricCompilerIr {\n\tconst bundle = normalizeModuleManifestBundle(input);\n\tconst namespaces = new Set<string>();\n\tfor (const module of bundle.modules) {\n\t\tif (namespaces.has(module.namespace)) throw new Error(`Duplicate module namespace \"${module.namespace}\" in compiler input.`);\n\t\tnamespaces.add(module.namespace);\n\t}\n\tconst modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));\n\tassertCompilerManifests(modules, options.certificationProfiles ?? []);\n\tconst canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });\n\treturn {\n\t\tcompilerVersion: FABRIC_COMPILER_VERSION,\n\t\tmanifestVersion: bundle.manifestVersion,\n\t\tmanifestDigest: createHash(\"sha256\").update(canonical).digest(\"hex\"),\n\t\tmodules,\n\t\tconformance: (options.conformanceAdapters ?? []).flatMap((adapter) =>\n\t\t\tmodules.map((module) => ({ adapterId: adapter.id, moduleNamespace: module.namespace, findings: adapter.evaluate(module) })),\n\t\t),\n\t};\n}\n\nfunction assertCompilerManifests(modules: ModuleManifest[], certificationProfiles: CertificationProfile[]): void {\n\tconst profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));\n\tif (profiles.size !== certificationProfiles.length) throw new Error(\"Certification profile IDs must be unique.\");\n\tfor (const module of modules) {\n\t\tif (!module || !/^[a-z][a-z0-9-]*$/.test(module.namespace) || !Array.isArray(module.objectTypes) || !Array.isArray(module.actions) || !Array.isArray(module.views)) throw new Error(\"Compiler input is not a normalized module manifest.\");\n\t}\n\tconst targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));\n\tfor (const module of modules) {\n\t\tif (module.capability) {\n\t\t\tif (!module.capability.displayName?.trim() || !module.capability.description?.trim()) throw new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t\tif (![\"experimental\", \"beta\", \"stable\", \"deprecated\"].includes(module.capability.stability)) throw new Error(`Module \"${module.namespace}\" capability has invalid stability.`);\n\t\t}\n\t\tconst certification = module.capability?.certification;\n\t\tconst profile = certification?.required ? profiles.get(certification.profile) : undefined;\n\t\tfor (const objectType of module.objectTypes) {\n\t\t\tif (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type \"${objectType.type}\" in compiler input.`);\n\t\t\tif (objectType.schema) assertPortableJsonSchema(objectType.schema, `${module.namespace}.${objectType.type}`);\n\t\t\tfor (const relation of objectType.relations ?? []) if (!targets.has(relation.target)) throw new Error(`Relation ${module.namespace}.${objectType.type}.${relation.name} targets missing object type \"${relation.target}\".`);\n\t\t\tfor (const invariant of objectType.invariants ?? []) {\n\t\t\t\tif (invariant.required && !resolvesRequiredInvariant(module, objectType, invariant, profile)) {\n\t\t\t\t\tthrow new Error(`Required invariant \"${module.namespace}.${objectType.type}.${invariant.id}\" has no resolvable enforcement evidence under certification profile \"${certification?.profile ?? \"none\"}\".`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const view of module.views) {\n\t\t\tif (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View \"${view.name}\" must use module namespace \"${module.namespace}/\".`);\n\t\t\tassertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);\n\t\t\tif (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);\n\t\t}\n\t\tfor (const eventType of module.eventTypes) if (eventType.schema) assertPortableJsonSchema(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);\n\t\tfor (const action of module.actions) {\n\t\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId) || !action.actionId.startsWith(`${module.namespace}.`) || ![\"atomic\", \"saga\"].includes(action.kind) || typeof action.idempotent !== \"boolean\" || typeof action.mutatesDomain !== \"boolean\" || !Array.isArray(action.emitsEvents)) throw new Error(`Action \"${action.actionId}\" is not a normalized manifest action.`);\n\t\t\tif (action.parameterSchema) assertPortableJsonSchema(action.parameterSchema as PortableJsonSchema, `Action ${action.actionId} parameters`);\n\t\t\tif (action.resultSchema) assertPortableJsonSchema(action.resultSchema as PortableJsonSchema, `Action ${action.actionId} result`);\n\t\t}\n\t}\n}\n\nfunction resolvesRequiredInvariant(\n\tmodule: ModuleManifest,\n\tobjectType: ModuleManifest[\"objectTypes\"][number],\n\tinvariant: DeclarativeInvariant,\n\tprofile: CertificationProfile | undefined,\n): boolean {\n\tconst reference = invariant.enforcementRef?.trim();\n\tif (!reference) return false;\n\tif (invariant.enforcement === \"json-schema\") {\n\t\tconst requiredMatch = /^#\\/required\\/([^/]+)$/.exec(reference);\n\t\tif (requiredMatch) return Array.isArray(objectType.schema?.required) && objectType.schema.required.includes(decodeJsonPointerToken(requiredMatch[1]!));\n\t\tconst propertyMatch = /^#\\/properties\\/([^/]+)$/.exec(reference);\n\t\tif (propertyMatch) return Boolean(objectType.schema?.properties?.[decodeJsonPointerToken(propertyMatch[1]!)]);\n\t\treturn false;\n\t}\n\tif (invariant.enforcement === \"state-machine\") return module.stateMachines.some((machine) => machine.entityType === reference);\n\tif (invariant.enforcement === \"policy\") return module.policies.some((policy) => policy.policyId === reference);\n\treturn profile?.resolveInvariant?.({ module, objectType, invariant }) === true;\n}\n\nfunction decodeJsonPointerToken(token: string): string {\n\treturn token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n\nexport type CompatibilitySeverity = \"compatible\" | \"potentially_breaking\" | \"breaking\";\nexport interface CompatibilityChange {\n\tseverity: CompatibilitySeverity;\n\tpath: string;\n\tcode: string;\n\tmessage: string;\n}\nexport interface CompatibilityReport {\n\tcompatible: boolean;\n\thighestSeverity: CompatibilitySeverity;\n\tchanges: CompatibilityChange[];\n}\n\nconst severityRank: Record<CompatibilitySeverity, number> = { compatible: 0, potentially_breaking: 1, breaking: 2 };\n\nexport function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport {\n\tif (before.namespace !== after.namespace) {\n\t\treturn report([{ severity: \"breaking\", path: \"namespace\", code: \"module_renamed\", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);\n\t}\n\tconst changes: CompatibilityChange[] = [];\n\tif (before.version !== after.version) changes.push({ severity: \"potentially_breaking\", path: \"version\", code: \"module_version_changed\", message: \"Module version changed.\" });\n\tif (stableStringify(before.capability) !== stableStringify(after.capability)) changes.push({ severity: \"potentially_breaking\", path: \"capability\", code: \"capability_changed\", message: \"Capability stability, requirements, extensions, deprecation, or certification metadata changed.\" });\n\tdiffStringList(before.subjectTypes, after.subjectTypes, \"subjectTypes\", changes);\n\tdiffNamed(before.idPrefixes, after.idPrefixes, \"idPrefixes\", \"prefix\", changes, (oldValue, newValue, path) => {\n\t\tif (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: \"breaking\", path, code: \"id_prefix_changed\", message: \"ID prefix ownership changed.\" });\n\t});\n\tif (stableStringify(before.dependencies) !== stableStringify(after.dependencies)) changes.push({ severity: \"potentially_breaking\", path: \"dependencies\", code: \"module_dependencies_changed\", message: \"Module dependencies changed.\" });\n\tif (stableStringify(before.policies) !== stableStringify(after.policies)) changes.push({ severity: \"potentially_breaking\", path: \"policies\", code: \"module_policies_changed\", message: \"Module policy definitions changed.\" });\n\tdiffNamed(before.objectTypes, after.objectTypes, \"objectTypes\", \"type\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tconst oldArchetype = oldValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tconst newArchetype = newValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tif (oldArchetype && !newArchetype) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_removed\", message: \"Archetype certification metadata was removed.\" });\n\t\telse if (oldArchetype && newArchetype && stableStringify(oldArchetype) !== stableStringify(newArchetype)) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_mapping_changed\", message: \"Archetype identity, version, or state mapping changed.\" });\n\t\tdiffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, \"name\", changes, (oldRelation, newRelation, relationPath) => {\n\t\t\tif (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: \"breaking\", path: `${relationPath}.cardinality`, code: \"relation_cardinality_changed\", message: \"Relation cardinality changed.\" });\n\t\t\tif (oldRelation.target !== newRelation.target) changes.push({ severity: \"breaking\", path: `${relationPath}.target`, code: \"relation_target_changed\", message: \"Relation target changed.\" });\n\t\t\tif (!oldRelation.required && newRelation.required) changes.push({ severity: \"breaking\", path: `${relationPath}.required`, code: \"relation_became_required\", message: \"Optional relation became required.\" });\n\t\t\tif (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: \"breaking\", path: `${relationPath}.semantics`, code: \"relation_ownership_changed\", message: \"Relation ownership semantics changed.\" });\n\t\t\tif (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: \"breaking\", path: `${relationPath}.onTargetDelete`, code: \"relation_delete_behavior_changed\", message: \"Relation deletion behavior changed.\" });\n\t\t});\n\t\tdiffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, \"id\", changes, (oldInvariant, newInvariant, invariantPath) => {\n\t\t\tif (oldInvariant.enforcement !== newInvariant.enforcement || oldInvariant.enforcementRef !== newInvariant.enforcementRef) changes.push({ severity: \"potentially_breaking\", path: invariantPath, code: \"invariant_enforcement_changed\", message: \"Invariant enforcement ownership or reference changed.\" });\n\t\t\tif (!oldInvariant.required && newInvariant.required) changes.push({ severity: \"breaking\", path: `${invariantPath}.required`, code: \"invariant_became_required\", message: \"Invariant became required.\" });\n\t\t});\n\t});\n\tdiffNamed(before.actions, after.actions, \"actions\", \"actionId\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.parameterSchema as PortableJsonSchema | undefined, newValue.parameterSchema as PortableJsonSchema | undefined, `${path}.parameterSchema`, changes);\n\t\tdiffSchema(oldValue.resultSchema as PortableJsonSchema | undefined, newValue.resultSchema as PortableJsonSchema | undefined, `${path}.resultSchema`, changes);\n\t\tif (stableStringify(oldValue.execution) !== stableStringify(newValue.execution)) changes.push({ severity: oldValue.execution ? \"breaking\" : \"potentially_breaking\", path: `${path}.execution`, code: \"action_execution_changed\", message: \"Action execution semantics changed and hosts or offline consumers must be reviewed.\" });\n\t\tfor (const field of [\"version\", \"kind\", \"idempotent\", \"mutatesDomain\", \"eventPhase\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed.` });\n\t\t}\n\t\tconst oldEvents = new Set(oldValue.emitsEvents);\n\t\tconst newEvents = new Set(newValue.emitsEvents);\n\t\tfor (const event of oldEvents) if (!newEvents.has(event)) changes.push({ severity: \"breaking\", path: `${path}.emitsEvents.${event}`, code: \"action_event_removed\", message: `Declared action event \"${event}\" was removed.` });\n\t\tfor (const event of newEvents) if (!oldEvents.has(event)) changes.push({ severity: \"compatible\", path: `${path}.emitsEvents.${event}`, code: \"action_event_added\", message: `Declared action event \"${event}\" was added.` });\n\t\tfor (const field of [\"policies\", \"requiredRoles\", \"requiredPermissions\", \"stateMachine\", \"adapterSteps\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed and requires consumer review.` });\n\t\t}\n\t});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\n\t\tdiffEventSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tif (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: \"breaking\", path: `${path}.schemaVersion`, code: \"event_version_decreased\", message: \"Event schema version decreased.\" });\n\t\telse if (oldValue.schemaVersion < newValue.schemaVersion) changes.push({ severity: \"potentially_breaking\", path: `${path}.schemaVersion`, code: \"event_version_changed\", message: \"Event schema version changed; old consumers require compatibility evidence.\" });\n\t});\n\tconst oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tconst newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tfor (const [key, oldView] of oldViews) {\n\t\tconst newView = newViews.get(key);\n\t\tif (!newView) changes.push({ severity: \"breaking\", path: `views.${key}`, code: \"view_version_removed\", message: `View contract \"${key}\" was removed.` });\n\t\telse {\n\t\t\tdiffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\n\t\t\tif (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: \"potentially_breaking\", path: `views.${key}.usage`, code: \"view_usage_changed\", message: \"View usage semantics changed and generated consumers require review.\" });\n\t\t}\n\t}\n\tfor (const key of newViews.keys()) if (!oldViews.has(key)) changes.push({ severity: \"compatible\", path: `views.${key}`, code: \"view_version_added\", message: `View contract \"${key}\" was added.` });\n\tdiffNamed(before.stateMachines, after.stateMachines, \"stateMachines\", \"entityType\", changes, (oldValue, newValue, path) => {\n\t\tconst newStates = new Set(newValue.states.map((state) => state.id));\n\t\tfor (const state of oldValue.states) if (!newStates.has(state.id)) changes.push({ severity: \"breaking\", path: `${path}.states.${state.id}`, code: \"state_removed\", message: `State \"${state.id}\" was removed.` });\n\t\tconst transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));\n\t\tfor (const transition of oldValue.transitions) if (!transitions.has(`${transition.from}->${transition.to}`)) changes.push({ severity: \"breaking\", path: `${path}.transitions.${transition.from}->${transition.to}`, code: \"transition_removed\", message: \"A state transition was removed or remapped.\" });\n\t});\n\treturn report(changes);\n}\n\nfunction diffEventSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst start = changes.length;\n\tdiffSchema(before, after, path, changes);\n\tfor (let index = start; index < changes.length; index += 1) {\n\t\tconst change = changes[index]!;\n\t\tchange.code = `event_${change.code}`;\n\t\tchange.message = `Event schema: ${change.message}`;\n\t}\n}\n\nfunction diffStringList(before: string[], after: string[], path: string, changes: CompatibilityChange[]): void {\n\tconst oldValues = new Set(before);\n\tconst newValues = new Set(after);\n\tfor (const value of oldValues) if (!newValues.has(value)) changes.push({ severity: \"breaking\", path: `${path}.${value}`, code: `${path}_removed`, message: `Public ${path} value \"${value}\" was removed.` });\n\tfor (const value of newValues) if (!oldValues.has(value)) changes.push({ severity: \"compatible\", path: `${path}.${value}`, code: `${path}_added`, message: `Public ${path} value \"${value}\" was added.` });\n}\n\nfunction diffNamed<T extends object>(\n\tbefore: T[], after: T[], path: string, key: keyof T, changes: CompatibilityChange[], compare: (before: T, after: T, path: string) => void,\n): void {\n\tconst oldMap = new Map(before.map((value) => [String(value[key]), value]));\n\tconst newMap = new Map(after.map((value) => [String(value[key]), value]));\n\tfor (const [name, value] of oldMap) {\n\t\tconst next = newMap.get(name);\n\t\tif (!next) changes.push({ severity: \"breaking\", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} \"${name}\" was removed.` });\n\t\telse compare(value, next, `${path}.${name}`);\n\t}\n\tfor (const name of newMap.keys()) if (!oldMap.has(name)) changes.push({ severity: \"compatible\", path: `${path}.${name}`, code: `${String(key)}_added`, message: `${String(key)} \"${name}\" was added.` });\n}\n\nfunction diffSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst changeCount = changes.length;\n\tif (!before && after) { changes.push({ severity: \"potentially_breaking\", path, code: \"schema_added\", message: \"A schema was added to an existing contract.\" }); return; }\n\tif (before && !after) { changes.push({ severity: \"breaking\", path, code: \"schema_removed\", message: \"An existing schema was removed.\" }); return; }\n\tif (!before || !after) return;\n\tconst oldRequired = new Set(before.required ?? []);\n\tfor (const required of after.required ?? []) if (!oldRequired.has(required)) changes.push({ severity: \"breaking\", path: `${path}.required.${required}`, code: \"required_property_added\", message: `Required property \"${required}\" was added.` });\n\tconst oldProperties = before.properties ?? {};\n\tconst newProperties = after.properties ?? {};\n\tfor (const property of Object.keys(oldProperties)) if (!(property in newProperties)) changes.push({ severity: \"breaking\", path: `${path}.properties.${property}`, code: \"schema_property_removed\", message: `Schema property \"${property}\" was removed.` });\n\tfor (const property of Object.keys(newProperties)) if (!(property in oldProperties)) changes.push({ severity: (after.required ?? []).includes(property) ? \"breaking\" : \"compatible\", path: `${path}.properties.${property}`, code: \"schema_property_added\", message: `Schema property \"${property}\" was added.` });\n\tfor (const property of Object.keys(oldProperties)) {\n\t\tif (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);\n\t}\n\tif (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: \"breaking\", path: `${path}.additionalProperties`, code: \"additional_properties_forbidden\", message: \"Schema now rejects undeclared properties.\" });\n\tif (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);\n\tfor (const keyword of [\"minimum\", \"maximum\", \"minLength\", \"maxLength\", \"pattern\"] as const) {\n\t\tif (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${keyword}`, code: \"schema_constraint_changed\", message: `Schema constraint \"${keyword}\" changed.` });\n\t}\n\tif (stableStringify(before.type) !== stableStringify(after.type)) {\n\t\tconst oldTypes = new Set(Array.isArray(before.type) ? before.type : before.type ? [before.type] : []);\n\t\tconst newTypes = new Set(Array.isArray(after.type) ? after.type : after.type ? [after.type] : []);\n\t\tconst widened = oldTypes.size > 0 && [...oldTypes].every((type) => newTypes.has(type));\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.type`, code: widened ? \"schema_type_widened\" : \"schema_type_narrowed\", message: widened ? \"Schema type widened; generated consumers may receive a new value type.\" : \"Schema type no longer accepts every prior type.\" });\n\t}\n\tif (before.enum && after.enum && before.enum.some((value) => !after.enum!.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.enum`, code: \"schema_enum_narrowed\", message: \"Schema enum no longer accepts a previously valid value.\" });\n\t}\n\tif (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: \"potentially_breaking\", path, code: \"schema_changed\", message: \"Schema changed and requires consumer review.\" });\n}\n\nfunction report(changes: CompatibilityChange[]): CompatibilityReport {\n\tconst highestSeverity = changes.reduce<CompatibilitySeverity>((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, \"compatible\");\n\treturn { compatible: highestSeverity === \"compatible\", highestSeverity, changes };\n}\n\nexport interface GeneratedFile { path: string; content: string; }\nexport interface GeneratorTarget { name: string; version: string; generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>; }\n\nexport async function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]> {\n\tconst files = await target.generate(ir);\n\tconst paths = new Set<string>();\n\treturn [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {\n\t\tif (!file.path || path.isAbsolute(file.path) || path.win32.isAbsolute(file.path) || file.path.includes(\"\\\\\") || file.path.split(\"/\").includes(\"..\")) throw new Error(`Generator \"${target.name}\" returned unsafe path \"${file.path}\".`);\n\t\tif (paths.has(file.path)) throw new Error(`Generator \"${target.name}\" returned duplicate path \"${file.path}\".`);\n\t\tpaths.add(file.path);\n\t\treturn { path: file.path, content: file.content.endsWith(\"\\n\") ? file.content : `${file.content}\\n` };\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA2B;AAC3B,uBAAiB;AACjB,sBAQO;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAiChH,SAAS,gBAAgB,OAAwB;AACvD,SAAO,KAAK,UAAU,SAAS,KAAK,CAAC;AACtC;AAEA,SAAS,SAAS,OAAyB;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,QAAQ;AACnD,MAAI,SAAS,OAAO,UAA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,QAAK,MAAM,WAAW,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,MAAM,GAAG,EAAE,SAAS,IAAI,EAAG,OAAM,IAAI,MAAM,cAAc,OAAO,IAAI,2BAA2B,KAAK,IAAI,IAAI;AACtO,QAAI,MAAM,IAAI,KAAK,IAAI,EAAG,OAAM,IAAI,MAAM,cAAc,OAAO,IAAI,8BAA8B,KAAK,IAAI,IAAI;AAC9G,UAAM,IAAI,KAAK,IAAI;AACnB,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ,SAAS,IAAI,IAAI,KAAK,UAAU,GAAG,KAAK,OAAO;AAAA,EAAK;AAAA,EACrG,CAAC;AACF;","names":["module","path"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype DeclarativeInvariant,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"2.0.0\";\nexport const compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface CompilerConformanceAdapter<Finding = unknown> {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): Finding[];\n}\n\nexport interface CompilerConformanceResult<Finding = unknown> {\n\tadapterId: string;\n\tmoduleNamespace: string;\n\tfindings: Finding[];\n}\n\nexport interface CertificationInvariantContext {\n\tmodule: ModuleManifest;\n\tobjectType: ModuleManifest[\"objectTypes\"][number];\n\tinvariant: DeclarativeInvariant;\n}\n\nexport interface CertificationProfile {\n\tid: string;\n\t/** Resolve evidence owned outside serialized Platform definitions. */\n\tresolveInvariant?(context: CertificationInvariantContext): boolean;\n}\n\nexport interface FabricCompilerIr {\n\tcompilerVersion: string;\n\tmanifestVersion: number;\n\tmanifestDigest: string;\n\tmodules: ModuleManifest[];\n\tconformance: CompilerConformanceResult[];\n}\n\nexport function stableStringify(value: unknown): string {\n\treturn JSON.stringify(sortJson(value));\n}\n\nfunction sortJson(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(sortJson);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>)\n\t\t\t\t.sort(([left], [right]) => compareCanonicalStrings(left, right))\n\t\t\t\t.map(([key, child]) => [key, sortJson(child)]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function compileManifestBundle(\n\tinput: ModuleManifestBundle | ModuleManifestBundleV1,\n\toptions: { conformanceAdapters?: CompilerConformanceAdapter[]; certificationProfiles?: CertificationProfile[] } = {},\n): FabricCompilerIr {\n\tconst bundle = normalizeModuleManifestBundle(input);\n\tconst namespaces = new Set<string>();\n\tfor (const module of bundle.modules) {\n\t\tif (namespaces.has(module.namespace)) throw new Error(`Duplicate module namespace \"${module.namespace}\" in compiler input.`);\n\t\tnamespaces.add(module.namespace);\n\t}\n\tconst modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));\n\tassertCompilerManifests(modules, options.certificationProfiles ?? []);\n\tconst canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });\n\treturn {\n\t\tcompilerVersion: FABRIC_COMPILER_VERSION,\n\t\tmanifestVersion: bundle.manifestVersion,\n\t\tmanifestDigest: createHash(\"sha256\").update(canonical).digest(\"hex\"),\n\t\tmodules,\n\t\tconformance: (options.conformanceAdapters ?? []).flatMap((adapter) =>\n\t\t\tmodules.map((module) => ({ adapterId: adapter.id, moduleNamespace: module.namespace, findings: adapter.evaluate(module) })),\n\t\t),\n\t};\n}\n\n/**\n * Manifests reach the compiler without passing through a registry, so declared\n * durability is validated here too. A contradiction between an action's declared\n * completion and its kind is a manifest defect, and fails the build rather than a\n * running host.\n */\nfunction assertManifestWorkflows(module: ModuleManifest): void {\n\tfor (const action of module.actions) {\n\t\tif (action.execution?.completion === \"immediate\" && action.kind === \"saga\") {\n\t\t\tthrow new Error(`Action \"${action.actionId}\" declares immediate completion but is a multi-step saga.`);\n\t\t}\n\t}\n\tconst actionsById = new Map(module.actions.map((action) => [action.actionId, action]));\n\tconst names = new Set<string>();\n\tfor (const workflow of module.capability?.workflows ?? []) {\n\t\tif (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) throw new Error(`Module \"${module.namespace}\" declares invalid workflow name \"${workflow.name}\".`);\n\t\tif (names.has(workflow.name)) throw new Error(`Module \"${module.namespace}\" declares duplicate workflow \"${workflow.name}\".`);\n\t\tnames.add(workflow.name);\n\t\tif (!/^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares invalid task queue \"${workflow.taskQueue}\".`);\n\t\tconst timerNames = new Set<string>();\n\t\tfor (const timer of workflow.timers ?? []) {\n\t\t\tif (!timer.name?.trim() || !timer.configKey?.trim()) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a timer without a name or configKey.`);\n\t\t\tif (timerNames.has(timer.name)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate timer \"${timer.name}\".`);\n\t\t\ttimerNames.add(timer.name);\n\t\t}\n\t\tconst steps = new Set<string>();\n\t\tfor (const compensation of workflow.compensations ?? []) {\n\t\t\tif (steps.has(compensation.step)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate compensation for step \"${compensation.step}\".`);\n\t\t\tsteps.add(compensation.step);\n\t\t\tconst compensating = actionsById.get(compensation.actionId);\n\t\t\tif (!compensating) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with unknown action \"${compensation.actionId}\".`);\n\t\t\tif (!compensating.idempotent) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with non-idempotent action \"${compensation.actionId}\"; a reversal must be safely repeatable.`);\n\t\t}\n\t}\n}\n\nfunction assertCompilerManifests(modules: ModuleManifest[], certificationProfiles: CertificationProfile[]): void {\n\tconst profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));\n\tif (profiles.size !== certificationProfiles.length) throw new Error(\"Certification profile IDs must be unique.\");\n\tfor (const module of modules) {\n\t\tif (!module || !/^[a-z][a-z0-9-]*$/.test(module.namespace) || !Array.isArray(module.objectTypes) || !Array.isArray(module.actions) || !Array.isArray(module.views)) throw new Error(\"Compiler input is not a normalized module manifest.\");\n\t}\n\tfor (const module of modules) assertManifestWorkflows(module);\n\tconst targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));\n\tfor (const module of modules) {\n\t\tif (module.capability) {\n\t\t\tif (!module.capability.displayName?.trim() || !module.capability.description?.trim()) throw new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t\tif (![\"experimental\", \"beta\", \"stable\", \"deprecated\"].includes(module.capability.stability)) throw new Error(`Module \"${module.namespace}\" capability has invalid stability.`);\n\t\t}\n\t\tconst certification = module.capability?.certification;\n\t\tconst profile = certification?.required ? profiles.get(certification.profile) : undefined;\n\t\tfor (const objectType of module.objectTypes) {\n\t\t\tif (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type \"${objectType.type}\" in compiler input.`);\n\t\t\tif (objectType.schema) assertPortableJsonSchema(objectType.schema, `${module.namespace}.${objectType.type}`);\n\t\t\tfor (const relation of objectType.relations ?? []) if (!targets.has(relation.target)) throw new Error(`Relation ${module.namespace}.${objectType.type}.${relation.name} targets missing object type \"${relation.target}\".`);\n\t\t\tfor (const invariant of objectType.invariants ?? []) {\n\t\t\t\tif (invariant.required && !resolvesRequiredInvariant(module, objectType, invariant, profile)) {\n\t\t\t\t\tthrow new Error(`Required invariant \"${module.namespace}.${objectType.type}.${invariant.id}\" has no resolvable enforcement evidence under certification profile \"${certification?.profile ?? \"none\"}\".`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const view of module.views) {\n\t\t\tif (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View \"${view.name}\" must use module namespace \"${module.namespace}/\".`);\n\t\t\tassertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);\n\t\t\tif (view.parameterSchema !== undefined) assertPortableJsonSchema(view.parameterSchema, `View ${view.name}@${view.version} parameters`);\n\t\t\tif (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);\n\t\t}\n\t\tfor (const eventType of module.eventTypes) if (eventType.schema) assertPortableJsonSchema(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);\n\t\tfor (const action of module.actions) {\n\t\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId) || !action.actionId.startsWith(`${module.namespace}.`) || ![\"atomic\", \"saga\"].includes(action.kind) || typeof action.idempotent !== \"boolean\" || typeof action.mutatesDomain !== \"boolean\" || !Array.isArray(action.emitsEvents)) throw new Error(`Action \"${action.actionId}\" is not a normalized manifest action.`);\n\t\t\tif (action.parameterSchema) assertPortableJsonSchema(action.parameterSchema as PortableJsonSchema, `Action ${action.actionId} parameters`);\n\t\t\tif (action.resultSchema) assertPortableJsonSchema(action.resultSchema as PortableJsonSchema, `Action ${action.actionId} result`);\n\t\t}\n\t}\n}\n\nfunction resolvesRequiredInvariant(\n\tmodule: ModuleManifest,\n\tobjectType: ModuleManifest[\"objectTypes\"][number],\n\tinvariant: DeclarativeInvariant,\n\tprofile: CertificationProfile | undefined,\n): boolean {\n\tconst reference = invariant.enforcementRef?.trim();\n\tif (!reference) return false;\n\tif (invariant.enforcement === \"json-schema\") {\n\t\tconst requiredMatch = /^#\\/required\\/([^/]+)$/.exec(reference);\n\t\tif (requiredMatch) return Array.isArray(objectType.schema?.required) && objectType.schema.required.includes(decodeJsonPointerToken(requiredMatch[1]!));\n\t\tconst propertyMatch = /^#\\/properties\\/([^/]+)$/.exec(reference);\n\t\tif (propertyMatch) return Boolean(objectType.schema?.properties?.[decodeJsonPointerToken(propertyMatch[1]!)]);\n\t\treturn false;\n\t}\n\tif (invariant.enforcement === \"state-machine\") return module.stateMachines.some((machine) => machine.entityType === reference);\n\tif (invariant.enforcement === \"policy\") return module.policies.some((policy) => policy.policyId === reference);\n\treturn profile?.resolveInvariant?.({ module, objectType, invariant }) === true;\n}\n\nfunction decodeJsonPointerToken(token: string): string {\n\treturn token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n\nexport type CompatibilitySeverity = \"compatible\" | \"potentially_breaking\" | \"breaking\";\nexport interface CompatibilityChange {\n\tseverity: CompatibilitySeverity;\n\tpath: string;\n\tcode: string;\n\tmessage: string;\n}\nexport interface CompatibilityReport {\n\tcompatible: boolean;\n\thighestSeverity: CompatibilitySeverity;\n\tchanges: CompatibilityChange[];\n}\n\nconst severityRank: Record<CompatibilitySeverity, number> = { compatible: 0, potentially_breaking: 1, breaking: 2 };\n\nexport function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport {\n\tif (before.namespace !== after.namespace) {\n\t\treturn report([{ severity: \"breaking\", path: \"namespace\", code: \"module_renamed\", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);\n\t}\n\tconst changes: CompatibilityChange[] = [];\n\tif (before.version !== after.version) changes.push({ severity: \"potentially_breaking\", path: \"version\", code: \"module_version_changed\", message: \"Module version changed.\" });\n\tif (stableStringify(withoutWorkflows(before.capability)) !== stableStringify(withoutWorkflows(after.capability))) changes.push({ severity: \"potentially_breaking\", path: \"capability\", code: \"capability_changed\", message: \"Capability stability, requirements, extensions, deprecation, or certification metadata changed.\" });\n\tdiffCapabilityWorkflows(before.capability?.workflows ?? [], after.capability?.workflows ?? [], changes);\n\tdiffStringList(before.subjectTypes, after.subjectTypes, \"subjectTypes\", changes);\n\tdiffNamed(before.idPrefixes, after.idPrefixes, \"idPrefixes\", \"prefix\", changes, (oldValue, newValue, path) => {\n\t\tif (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: \"breaking\", path, code: \"id_prefix_changed\", message: \"ID prefix ownership changed.\" });\n\t});\n\tif (stableStringify(before.dependencies) !== stableStringify(after.dependencies)) changes.push({ severity: \"potentially_breaking\", path: \"dependencies\", code: \"module_dependencies_changed\", message: \"Module dependencies changed.\" });\n\tif (stableStringify(before.policies) !== stableStringify(after.policies)) changes.push({ severity: \"potentially_breaking\", path: \"policies\", code: \"module_policies_changed\", message: \"Module policy definitions changed.\" });\n\tdiffNamed(before.objectTypes, after.objectTypes, \"objectTypes\", \"type\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tconst oldArchetype = oldValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tconst newArchetype = newValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tif (oldArchetype && !newArchetype) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_removed\", message: \"Archetype certification metadata was removed.\" });\n\t\telse if (oldArchetype && newArchetype && stableStringify(oldArchetype) !== stableStringify(newArchetype)) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_mapping_changed\", message: \"Archetype identity, version, or state mapping changed.\" });\n\t\tdiffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, \"name\", changes, (oldRelation, newRelation, relationPath) => {\n\t\t\tif (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: \"breaking\", path: `${relationPath}.cardinality`, code: \"relation_cardinality_changed\", message: \"Relation cardinality changed.\" });\n\t\t\tif (oldRelation.target !== newRelation.target) changes.push({ severity: \"breaking\", path: `${relationPath}.target`, code: \"relation_target_changed\", message: \"Relation target changed.\" });\n\t\t\tif (!oldRelation.required && newRelation.required) changes.push({ severity: \"breaking\", path: `${relationPath}.required`, code: \"relation_became_required\", message: \"Optional relation became required.\" });\n\t\t\tif (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: \"breaking\", path: `${relationPath}.semantics`, code: \"relation_ownership_changed\", message: \"Relation ownership semantics changed.\" });\n\t\t\tif (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: \"breaking\", path: `${relationPath}.onTargetDelete`, code: \"relation_delete_behavior_changed\", message: \"Relation deletion behavior changed.\" });\n\t\t});\n\t\tdiffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, \"id\", changes, (oldInvariant, newInvariant, invariantPath) => {\n\t\t\tif (oldInvariant.enforcement !== newInvariant.enforcement || oldInvariant.enforcementRef !== newInvariant.enforcementRef) changes.push({ severity: \"potentially_breaking\", path: invariantPath, code: \"invariant_enforcement_changed\", message: \"Invariant enforcement ownership or reference changed.\" });\n\t\t\tif (!oldInvariant.required && newInvariant.required) changes.push({ severity: \"breaking\", path: `${invariantPath}.required`, code: \"invariant_became_required\", message: \"Invariant became required.\" });\n\t\t});\n\t});\n\tdiffNamed(before.actions, after.actions, \"actions\", \"actionId\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.parameterSchema as PortableJsonSchema | undefined, newValue.parameterSchema as PortableJsonSchema | undefined, `${path}.parameterSchema`, changes);\n\t\tdiffSchema(oldValue.resultSchema as PortableJsonSchema | undefined, newValue.resultSchema as PortableJsonSchema | undefined, `${path}.resultSchema`, changes);\n\t\tif (stableStringify(oldValue.execution) !== stableStringify(newValue.execution)) changes.push({ severity: oldValue.execution ? \"breaking\" : \"potentially_breaking\", path: `${path}.execution`, code: \"action_execution_changed\", message: \"Action execution semantics changed and hosts or offline consumers must be reviewed.\" });\n\t\tfor (const field of [\"version\", \"kind\", \"idempotent\", \"mutatesDomain\", \"eventPhase\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed.` });\n\t\t}\n\t\tconst oldEvents = new Set(oldValue.emitsEvents);\n\t\tconst newEvents = new Set(newValue.emitsEvents);\n\t\tfor (const event of oldEvents) if (!newEvents.has(event)) changes.push({ severity: \"breaking\", path: `${path}.emitsEvents.${event}`, code: \"action_event_removed\", message: `Declared action event \"${event}\" was removed.` });\n\t\tfor (const event of newEvents) if (!oldEvents.has(event)) changes.push({ severity: \"compatible\", path: `${path}.emitsEvents.${event}`, code: \"action_event_added\", message: `Declared action event \"${event}\" was added.` });\n\t\tfor (const field of [\"policies\", \"requiredRoles\", \"requiredPermissions\", \"stateMachine\", \"adapterSteps\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed and requires consumer review.` });\n\t\t}\n\t});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\n\t\tdiffEventSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tif (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: \"breaking\", path: `${path}.schemaVersion`, code: \"event_version_decreased\", message: \"Event schema version decreased.\" });\n\t\telse if (oldValue.schemaVersion < newValue.schemaVersion) changes.push({ severity: \"potentially_breaking\", path: `${path}.schemaVersion`, code: \"event_version_changed\", message: \"Event schema version changed; old consumers require compatibility evidence.\" });\n\t});\n\tconst oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tconst newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tfor (const [key, oldView] of oldViews) {\n\t\tconst newView = newViews.get(key);\n\t\tif (!newView) changes.push({ severity: \"breaking\", path: `views.${key}`, code: \"view_version_removed\", message: `View contract \"${key}\" was removed.` });\n\t\telse {\n\t\t\tdiffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\n\t\t\tdiffSchema(oldView.parameterSchema, newView.parameterSchema, `views.${key}.parameterSchema`, changes);\n\t\t\tif (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: \"potentially_breaking\", path: `views.${key}.usage`, code: \"view_usage_changed\", message: \"View usage semantics changed and generated consumers require review.\" });\n\t\t}\n\t}\n\tfor (const key of newViews.keys()) if (!oldViews.has(key)) changes.push({ severity: \"compatible\", path: `views.${key}`, code: \"view_version_added\", message: `View contract \"${key}\" was added.` });\n\tdiffNamed(before.stateMachines, after.stateMachines, \"stateMachines\", \"entityType\", changes, (oldValue, newValue, path) => {\n\t\tconst newStates = new Set(newValue.states.map((state) => state.id));\n\t\tfor (const state of oldValue.states) if (!newStates.has(state.id)) changes.push({ severity: \"breaking\", path: `${path}.states.${state.id}`, code: \"state_removed\", message: `State \"${state.id}\" was removed.` });\n\t\tconst transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));\n\t\tfor (const transition of oldValue.transitions) if (!transitions.has(`${transition.from}->${transition.to}`)) changes.push({ severity: \"breaking\", path: `${path}.transitions.${transition.from}->${transition.to}`, code: \"transition_removed\", message: \"A state transition was removed or remapped.\" });\n\t});\n\treturn report(changes);\n}\n\ntype CapabilityWorkflows = NonNullable<NonNullable<ModuleManifest[\"capability\"]>[\"workflows\"]>;\n\nfunction withoutWorkflows(capability: ModuleManifest[\"capability\"]): unknown {\n\tif (!capability) return capability;\n\tconst { workflows, ...rest } = capability;\n\tvoid workflows;\n\treturn rest;\n}\n\n/**\n * Durability is a contract, so its diff is classified rather than lumped into a\n * single \"capability changed\": gaining a workflow is safe, losing one is not, and\n * moving a queue or a deadline is a review.\n */\nfunction diffCapabilityWorkflows(before: CapabilityWorkflows, after: CapabilityWorkflows, changes: CompatibilityChange[]): void {\n\tconst oldWorkflows = new Map(before.map((workflow) => [workflow.name, workflow]));\n\tconst newWorkflows = new Map(after.map((workflow) => [workflow.name, workflow]));\n\tfor (const [name, oldWorkflow] of oldWorkflows) {\n\t\tconst path = `capability.workflows.${name}`;\n\t\tconst newWorkflow = newWorkflows.get(name);\n\t\tif (!newWorkflow) {\n\t\t\tchanges.push({ severity: \"breaking\", path, code: \"workflow_removed\", message: `Declared workflow \"${name}\" was removed.` });\n\t\t\tcontinue;\n\t\t}\n\t\tif (oldWorkflow.taskQueue !== newWorkflow.taskQueue) changes.push({ severity: \"potentially_breaking\", path: `${path}.taskQueue`, code: \"workflow_task_queue_changed\", message: `Workflow \"${name}\" moved from task queue \"${oldWorkflow.taskQueue}\" to \"${newWorkflow.taskQueue}\"; in-flight executions and worker routing require review.` });\n\t\tif (oldWorkflow.startedBy !== newWorkflow.startedBy) changes.push({ severity: \"potentially_breaking\", path: `${path}.startedBy`, code: \"workflow_trigger_changed\", message: `Workflow \"${name}\" changed the event that starts it.` });\n\n\t\tconst oldTimers = new Map((oldWorkflow.timers ?? []).map((timer) => [timer.name, timer]));\n\t\tconst newTimers = new Map((newWorkflow.timers ?? []).map((timer) => [timer.name, timer]));\n\t\tfor (const [timerName, oldTimer] of oldTimers) {\n\t\t\tconst timerPath = `${path}.timers.${timerName}`;\n\t\t\tconst newTimer = newTimers.get(timerName);\n\t\t\tif (!newTimer) {\n\t\t\t\tchanges.push({ severity: \"potentially_breaking\", path: timerPath, code: \"workflow_timer_removed\", message: `Workflow \"${name}\" no longer carries the deadline \"${timerName}\".` });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (oldTimer.configKey !== newTimer.configKey) changes.push({ severity: \"potentially_breaking\", path: `${timerPath}.configKey`, code: \"workflow_timer_config_changed\", message: `Deadline \"${timerName}\" now resolves from configuration key \"${newTimer.configKey}\".` });\n\t\t\tif (oldTimer.description !== newTimer.description) changes.push({ severity: \"compatible\", path: `${timerPath}.description`, code: \"workflow_timer_description_changed\", message: `Deadline \"${timerName}\" changed its description.` });\n\t\t}\n\t\tfor (const timerName of newTimers.keys()) if (!oldTimers.has(timerName)) changes.push({ severity: \"compatible\", path: `${path}.timers.${timerName}`, code: \"workflow_timer_added\", message: `Workflow \"${name}\" gained the deadline \"${timerName}\".` });\n\n\t\tconst oldCompensations = new Map((oldWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));\n\t\tconst newCompensations = new Map((newWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));\n\t\tfor (const [step, oldCompensation] of oldCompensations) {\n\t\t\tconst stepPath = `${path}.compensations.${step}`;\n\t\t\tconst newCompensation = newCompensations.get(step);\n\t\t\tif (!newCompensation) {\n\t\t\t\tchanges.push({ severity: \"breaking\", path: stepPath, code: \"workflow_compensation_removed\", message: `Workflow \"${name}\" no longer reverses step \"${step}\".` });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (oldCompensation.actionId !== newCompensation.actionId) changes.push({ severity: \"potentially_breaking\", path: `${stepPath}.actionId`, code: \"workflow_compensation_changed\", message: `Step \"${step}\" is now reversed by \"${newCompensation.actionId}\".` });\n\t\t}\n\t\tfor (const step of newCompensations.keys()) if (!oldCompensations.has(step)) changes.push({ severity: \"compatible\", path: `${path}.compensations.${step}`, code: \"workflow_compensation_added\", message: `Workflow \"${name}\" gained a reversal for step \"${step}\".` });\n\t}\n\tfor (const name of newWorkflows.keys()) if (!oldWorkflows.has(name)) changes.push({ severity: \"compatible\", path: `capability.workflows.${name}`, code: \"workflow_added\", message: `Workflow \"${name}\" was added.` });\n}\n\nfunction diffEventSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst start = changes.length;\n\tdiffSchema(before, after, path, changes);\n\tfor (let index = start; index < changes.length; index += 1) {\n\t\tconst change = changes[index]!;\n\t\tchange.code = `event_${change.code}`;\n\t\tchange.message = `Event schema: ${change.message}`;\n\t}\n}\n\nfunction diffStringList(before: string[], after: string[], path: string, changes: CompatibilityChange[]): void {\n\tconst oldValues = new Set(before);\n\tconst newValues = new Set(after);\n\tfor (const value of oldValues) if (!newValues.has(value)) changes.push({ severity: \"breaking\", path: `${path}.${value}`, code: `${path}_removed`, message: `Public ${path} value \"${value}\" was removed.` });\n\tfor (const value of newValues) if (!oldValues.has(value)) changes.push({ severity: \"compatible\", path: `${path}.${value}`, code: `${path}_added`, message: `Public ${path} value \"${value}\" was added.` });\n}\n\nfunction diffNamed<T extends object>(\n\tbefore: T[], after: T[], path: string, key: keyof T, changes: CompatibilityChange[], compare: (before: T, after: T, path: string) => void,\n): void {\n\tconst oldMap = new Map(before.map((value) => [String(value[key]), value]));\n\tconst newMap = new Map(after.map((value) => [String(value[key]), value]));\n\tfor (const [name, value] of oldMap) {\n\t\tconst next = newMap.get(name);\n\t\tif (!next) changes.push({ severity: \"breaking\", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} \"${name}\" was removed.` });\n\t\telse compare(value, next, `${path}.${name}`);\n\t}\n\tfor (const name of newMap.keys()) if (!oldMap.has(name)) changes.push({ severity: \"compatible\", path: `${path}.${name}`, code: `${String(key)}_added`, message: `${String(key)} \"${name}\" was added.` });\n}\n\nfunction diffSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst changeCount = changes.length;\n\tif (!before && after) { changes.push({ severity: \"potentially_breaking\", path, code: \"schema_added\", message: \"A schema was added to an existing contract.\" }); return; }\n\tif (before && !after) { changes.push({ severity: \"breaking\", path, code: \"schema_removed\", message: \"An existing schema was removed.\" }); return; }\n\tif (!before || !after) return;\n\tconst oldRequired = new Set(before.required ?? []);\n\tfor (const required of after.required ?? []) if (!oldRequired.has(required)) changes.push({ severity: \"breaking\", path: `${path}.required.${required}`, code: \"required_property_added\", message: `Required property \"${required}\" was added.` });\n\tconst oldProperties = before.properties ?? {};\n\tconst newProperties = after.properties ?? {};\n\tfor (const property of Object.keys(oldProperties)) if (!(property in newProperties)) changes.push({ severity: \"breaking\", path: `${path}.properties.${property}`, code: \"schema_property_removed\", message: `Schema property \"${property}\" was removed.` });\n\tfor (const property of Object.keys(newProperties)) if (!(property in oldProperties)) changes.push({ severity: (after.required ?? []).includes(property) ? \"breaking\" : \"compatible\", path: `${path}.properties.${property}`, code: \"schema_property_added\", message: `Schema property \"${property}\" was added.` });\n\tfor (const property of Object.keys(oldProperties)) {\n\t\tif (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);\n\t}\n\tif (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: \"breaking\", path: `${path}.additionalProperties`, code: \"additional_properties_forbidden\", message: \"Schema now rejects undeclared properties.\" });\n\tif (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);\n\tfor (const keyword of [\"minimum\", \"maximum\", \"minLength\", \"maxLength\", \"pattern\"] as const) {\n\t\tif (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${keyword}`, code: \"schema_constraint_changed\", message: `Schema constraint \"${keyword}\" changed.` });\n\t}\n\tif (stableStringify(before.type) !== stableStringify(after.type)) {\n\t\tconst oldTypes = new Set(Array.isArray(before.type) ? before.type : before.type ? [before.type] : []);\n\t\tconst newTypes = new Set(Array.isArray(after.type) ? after.type : after.type ? [after.type] : []);\n\t\tconst widened = oldTypes.size > 0 && [...oldTypes].every((type) => newTypes.has(type));\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.type`, code: widened ? \"schema_type_widened\" : \"schema_type_narrowed\", message: widened ? \"Schema type widened; generated consumers may receive a new value type.\" : \"Schema type no longer accepts every prior type.\" });\n\t}\n\tif (before.enum && after.enum && before.enum.some((value) => !after.enum!.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.enum`, code: \"schema_enum_narrowed\", message: \"Schema enum no longer accepts a previously valid value.\" });\n\t}\n\tif (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: \"potentially_breaking\", path, code: \"schema_changed\", message: \"Schema changed and requires consumer review.\" });\n}\n\nfunction report(changes: CompatibilityChange[]): CompatibilityReport {\n\tconst highestSeverity = changes.reduce<CompatibilitySeverity>((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, \"compatible\");\n\treturn { compatible: highestSeverity === \"compatible\", highestSeverity, changes };\n}\n\nexport interface GeneratedFile { path: string; content: string; }\nexport interface GeneratorTarget { name: string; version: string; generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>; }\n\nexport async function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]> {\n\tconst files = await target.generate(ir);\n\tconst paths = new Set<string>();\n\treturn [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {\n\t\tif (!file.path || path.isAbsolute(file.path) || path.win32.isAbsolute(file.path) || file.path.includes(\"\\\\\") || file.path.split(\"/\").includes(\"..\")) throw new Error(`Generator \"${target.name}\" returned unsafe path \"${file.path}\".`);\n\t\tif (paths.has(file.path)) throw new Error(`Generator \"${target.name}\" returned duplicate path \"${file.path}\".`);\n\t\tpaths.add(file.path);\n\t\treturn { path: file.path, content: file.content.endsWith(\"\\n\") ? file.content : `${file.content}\\n` };\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA2B;AAC3B,uBAAiB;AACjB,sBAQO;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAiChH,SAAS,gBAAgB,OAAwB;AACvD,SAAO,KAAK,UAAU,SAAS,KAAK,CAAC;AACtC;AAEA,SAAS,SAAS,OAAyB;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,QAAQ;AACnD,MAAI,SAAS,OAAO,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,MAAM,UAAU,wBAAwB,KAAK,MAAM,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS;AACrG,QAAI,CAAC,KAAK,QAAQ,iBAAAA,QAAK,WAAW,KAAK,IAAI,KAAK,iBAAAA,QAAK,MAAM,WAAW,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,MAAM,GAAG,EAAE,SAAS,IAAI,EAAG,OAAM,IAAI,MAAM,cAAc,OAAO,IAAI,2BAA2B,KAAK,IAAI,IAAI;AACtO,QAAI,MAAM,IAAI,KAAK,IAAI,EAAG,OAAM,IAAI,MAAM,cAAc,OAAO,IAAI,8BAA8B,KAAK,IAAI,IAAI;AAC9G,UAAM,IAAI,KAAK,IAAI;AACnB,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ,SAAS,IAAI,IAAI,KAAK,UAAU,GAAG,KAAK,OAAO;AAAA,EAAK;AAAA,EACrG,CAAC;AACF;","names":["module","path"]}
|
package/dist/index.js
CHANGED
|
@@ -39,12 +39,42 @@ function compileManifestBundle(input, options = {}) {
|
|
|
39
39
|
)
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
function assertManifestWorkflows(module) {
|
|
43
|
+
for (const action of module.actions) {
|
|
44
|
+
if (action.execution?.completion === "immediate" && action.kind === "saga") {
|
|
45
|
+
throw new Error(`Action "${action.actionId}" declares immediate completion but is a multi-step saga.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const actionsById = new Map(module.actions.map((action) => [action.actionId, action]));
|
|
49
|
+
const names = /* @__PURE__ */ new Set();
|
|
50
|
+
for (const workflow of module.capability?.workflows ?? []) {
|
|
51
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) throw new Error(`Module "${module.namespace}" declares invalid workflow name "${workflow.name}".`);
|
|
52
|
+
if (names.has(workflow.name)) throw new Error(`Module "${module.namespace}" declares duplicate workflow "${workflow.name}".`);
|
|
53
|
+
names.add(workflow.name);
|
|
54
|
+
if (!/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" declares invalid task queue "${workflow.taskQueue}".`);
|
|
55
|
+
const timerNames = /* @__PURE__ */ new Set();
|
|
56
|
+
for (const timer of workflow.timers ?? []) {
|
|
57
|
+
if (!timer.name?.trim() || !timer.configKey?.trim()) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" has a timer without a name or configKey.`);
|
|
58
|
+
if (timerNames.has(timer.name)) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" declares duplicate timer "${timer.name}".`);
|
|
59
|
+
timerNames.add(timer.name);
|
|
60
|
+
}
|
|
61
|
+
const steps = /* @__PURE__ */ new Set();
|
|
62
|
+
for (const compensation of workflow.compensations ?? []) {
|
|
63
|
+
if (steps.has(compensation.step)) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" declares duplicate compensation for step "${compensation.step}".`);
|
|
64
|
+
steps.add(compensation.step);
|
|
65
|
+
const compensating = actionsById.get(compensation.actionId);
|
|
66
|
+
if (!compensating) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" compensates step "${compensation.step}" with unknown action "${compensation.actionId}".`);
|
|
67
|
+
if (!compensating.idempotent) throw new Error(`Module "${module.namespace}" workflow "${workflow.name}" compensates step "${compensation.step}" with non-idempotent action "${compensation.actionId}"; a reversal must be safely repeatable.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
42
71
|
function assertCompilerManifests(modules, certificationProfiles) {
|
|
43
72
|
const profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));
|
|
44
73
|
if (profiles.size !== certificationProfiles.length) throw new Error("Certification profile IDs must be unique.");
|
|
45
74
|
for (const module of modules) {
|
|
46
75
|
if (!module || !/^[a-z][a-z0-9-]*$/.test(module.namespace) || !Array.isArray(module.objectTypes) || !Array.isArray(module.actions) || !Array.isArray(module.views)) throw new Error("Compiler input is not a normalized module manifest.");
|
|
47
76
|
}
|
|
77
|
+
for (const module of modules) assertManifestWorkflows(module);
|
|
48
78
|
const targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));
|
|
49
79
|
for (const module of modules) {
|
|
50
80
|
if (module.capability) {
|
|
@@ -66,6 +96,7 @@ function assertCompilerManifests(modules, certificationProfiles) {
|
|
|
66
96
|
for (const view of module.views) {
|
|
67
97
|
if (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View "${view.name}" must use module namespace "${module.namespace}/".`);
|
|
68
98
|
assertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);
|
|
99
|
+
if (view.parameterSchema !== void 0) assertPortableJsonSchema(view.parameterSchema, `View ${view.name}@${view.version} parameters`);
|
|
69
100
|
if (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);
|
|
70
101
|
}
|
|
71
102
|
for (const eventType of module.eventTypes) if (eventType.schema) assertPortableJsonSchema(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);
|
|
@@ -100,7 +131,8 @@ function diffModuleManifests(before, after) {
|
|
|
100
131
|
}
|
|
101
132
|
const changes = [];
|
|
102
133
|
if (before.version !== after.version) changes.push({ severity: "potentially_breaking", path: "version", code: "module_version_changed", message: "Module version changed." });
|
|
103
|
-
if (stableStringify(before.capability) !== stableStringify(after.capability)) changes.push({ severity: "potentially_breaking", path: "capability", code: "capability_changed", message: "Capability stability, requirements, extensions, deprecation, or certification metadata changed." });
|
|
134
|
+
if (stableStringify(withoutWorkflows(before.capability)) !== stableStringify(withoutWorkflows(after.capability))) changes.push({ severity: "potentially_breaking", path: "capability", code: "capability_changed", message: "Capability stability, requirements, extensions, deprecation, or certification metadata changed." });
|
|
135
|
+
diffCapabilityWorkflows(before.capability?.workflows ?? [], after.capability?.workflows ?? [], changes);
|
|
104
136
|
diffStringList(before.subjectTypes, after.subjectTypes, "subjectTypes", changes);
|
|
105
137
|
diffNamed(before.idPrefixes, after.idPrefixes, "idPrefixes", "prefix", changes, (oldValue, newValue, path2) => {
|
|
106
138
|
if (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: "breaking", path: path2, code: "id_prefix_changed", message: "ID prefix ownership changed." });
|
|
@@ -152,6 +184,7 @@ function diffModuleManifests(before, after) {
|
|
|
152
184
|
if (!newView) changes.push({ severity: "breaking", path: `views.${key}`, code: "view_version_removed", message: `View contract "${key}" was removed.` });
|
|
153
185
|
else {
|
|
154
186
|
diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);
|
|
187
|
+
diffSchema(oldView.parameterSchema, newView.parameterSchema, `views.${key}.parameterSchema`, changes);
|
|
155
188
|
if (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: "potentially_breaking", path: `views.${key}.usage`, code: "view_usage_changed", message: "View usage semantics changed and generated consumers require review." });
|
|
156
189
|
}
|
|
157
190
|
}
|
|
@@ -164,6 +197,52 @@ function diffModuleManifests(before, after) {
|
|
|
164
197
|
});
|
|
165
198
|
return report(changes);
|
|
166
199
|
}
|
|
200
|
+
function withoutWorkflows(capability) {
|
|
201
|
+
if (!capability) return capability;
|
|
202
|
+
const { workflows, ...rest } = capability;
|
|
203
|
+
void workflows;
|
|
204
|
+
return rest;
|
|
205
|
+
}
|
|
206
|
+
function diffCapabilityWorkflows(before, after, changes) {
|
|
207
|
+
const oldWorkflows = new Map(before.map((workflow) => [workflow.name, workflow]));
|
|
208
|
+
const newWorkflows = new Map(after.map((workflow) => [workflow.name, workflow]));
|
|
209
|
+
for (const [name, oldWorkflow] of oldWorkflows) {
|
|
210
|
+
const path2 = `capability.workflows.${name}`;
|
|
211
|
+
const newWorkflow = newWorkflows.get(name);
|
|
212
|
+
if (!newWorkflow) {
|
|
213
|
+
changes.push({ severity: "breaking", path: path2, code: "workflow_removed", message: `Declared workflow "${name}" was removed.` });
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (oldWorkflow.taskQueue !== newWorkflow.taskQueue) changes.push({ severity: "potentially_breaking", path: `${path2}.taskQueue`, code: "workflow_task_queue_changed", message: `Workflow "${name}" moved from task queue "${oldWorkflow.taskQueue}" to "${newWorkflow.taskQueue}"; in-flight executions and worker routing require review.` });
|
|
217
|
+
if (oldWorkflow.startedBy !== newWorkflow.startedBy) changes.push({ severity: "potentially_breaking", path: `${path2}.startedBy`, code: "workflow_trigger_changed", message: `Workflow "${name}" changed the event that starts it.` });
|
|
218
|
+
const oldTimers = new Map((oldWorkflow.timers ?? []).map((timer) => [timer.name, timer]));
|
|
219
|
+
const newTimers = new Map((newWorkflow.timers ?? []).map((timer) => [timer.name, timer]));
|
|
220
|
+
for (const [timerName, oldTimer] of oldTimers) {
|
|
221
|
+
const timerPath = `${path2}.timers.${timerName}`;
|
|
222
|
+
const newTimer = newTimers.get(timerName);
|
|
223
|
+
if (!newTimer) {
|
|
224
|
+
changes.push({ severity: "potentially_breaking", path: timerPath, code: "workflow_timer_removed", message: `Workflow "${name}" no longer carries the deadline "${timerName}".` });
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (oldTimer.configKey !== newTimer.configKey) changes.push({ severity: "potentially_breaking", path: `${timerPath}.configKey`, code: "workflow_timer_config_changed", message: `Deadline "${timerName}" now resolves from configuration key "${newTimer.configKey}".` });
|
|
228
|
+
if (oldTimer.description !== newTimer.description) changes.push({ severity: "compatible", path: `${timerPath}.description`, code: "workflow_timer_description_changed", message: `Deadline "${timerName}" changed its description.` });
|
|
229
|
+
}
|
|
230
|
+
for (const timerName of newTimers.keys()) if (!oldTimers.has(timerName)) changes.push({ severity: "compatible", path: `${path2}.timers.${timerName}`, code: "workflow_timer_added", message: `Workflow "${name}" gained the deadline "${timerName}".` });
|
|
231
|
+
const oldCompensations = new Map((oldWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));
|
|
232
|
+
const newCompensations = new Map((newWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));
|
|
233
|
+
for (const [step, oldCompensation] of oldCompensations) {
|
|
234
|
+
const stepPath = `${path2}.compensations.${step}`;
|
|
235
|
+
const newCompensation = newCompensations.get(step);
|
|
236
|
+
if (!newCompensation) {
|
|
237
|
+
changes.push({ severity: "breaking", path: stepPath, code: "workflow_compensation_removed", message: `Workflow "${name}" no longer reverses step "${step}".` });
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (oldCompensation.actionId !== newCompensation.actionId) changes.push({ severity: "potentially_breaking", path: `${stepPath}.actionId`, code: "workflow_compensation_changed", message: `Step "${step}" is now reversed by "${newCompensation.actionId}".` });
|
|
241
|
+
}
|
|
242
|
+
for (const step of newCompensations.keys()) if (!oldCompensations.has(step)) changes.push({ severity: "compatible", path: `${path2}.compensations.${step}`, code: "workflow_compensation_added", message: `Workflow "${name}" gained a reversal for step "${step}".` });
|
|
243
|
+
}
|
|
244
|
+
for (const name of newWorkflows.keys()) if (!oldWorkflows.has(name)) changes.push({ severity: "compatible", path: `capability.workflows.${name}`, code: "workflow_added", message: `Workflow "${name}" was added.` });
|
|
245
|
+
}
|
|
167
246
|
function diffEventSchema(before, after, path2, changes) {
|
|
168
247
|
const start = changes.length;
|
|
169
248
|
diffSchema(before, after, path2, changes);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype DeclarativeInvariant,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"2.0.0\";\nexport const compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface CompilerConformanceAdapter<Finding = unknown> {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): Finding[];\n}\n\nexport interface CompilerConformanceResult<Finding = unknown> {\n\tadapterId: string;\n\tmoduleNamespace: string;\n\tfindings: Finding[];\n}\n\nexport interface CertificationInvariantContext {\n\tmodule: ModuleManifest;\n\tobjectType: ModuleManifest[\"objectTypes\"][number];\n\tinvariant: DeclarativeInvariant;\n}\n\nexport interface CertificationProfile {\n\tid: string;\n\t/** Resolve evidence owned outside serialized Platform definitions. */\n\tresolveInvariant?(context: CertificationInvariantContext): boolean;\n}\n\nexport interface FabricCompilerIr {\n\tcompilerVersion: string;\n\tmanifestVersion: number;\n\tmanifestDigest: string;\n\tmodules: ModuleManifest[];\n\tconformance: CompilerConformanceResult[];\n}\n\nexport function stableStringify(value: unknown): string {\n\treturn JSON.stringify(sortJson(value));\n}\n\nfunction sortJson(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(sortJson);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>)\n\t\t\t\t.sort(([left], [right]) => compareCanonicalStrings(left, right))\n\t\t\t\t.map(([key, child]) => [key, sortJson(child)]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function compileManifestBundle(\n\tinput: ModuleManifestBundle | ModuleManifestBundleV1,\n\toptions: { conformanceAdapters?: CompilerConformanceAdapter[]; certificationProfiles?: CertificationProfile[] } = {},\n): FabricCompilerIr {\n\tconst bundle = normalizeModuleManifestBundle(input);\n\tconst namespaces = new Set<string>();\n\tfor (const module of bundle.modules) {\n\t\tif (namespaces.has(module.namespace)) throw new Error(`Duplicate module namespace \"${module.namespace}\" in compiler input.`);\n\t\tnamespaces.add(module.namespace);\n\t}\n\tconst modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));\n\tassertCompilerManifests(modules, options.certificationProfiles ?? []);\n\tconst canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });\n\treturn {\n\t\tcompilerVersion: FABRIC_COMPILER_VERSION,\n\t\tmanifestVersion: bundle.manifestVersion,\n\t\tmanifestDigest: createHash(\"sha256\").update(canonical).digest(\"hex\"),\n\t\tmodules,\n\t\tconformance: (options.conformanceAdapters ?? []).flatMap((adapter) =>\n\t\t\tmodules.map((module) => ({ adapterId: adapter.id, moduleNamespace: module.namespace, findings: adapter.evaluate(module) })),\n\t\t),\n\t};\n}\n\nfunction assertCompilerManifests(modules: ModuleManifest[], certificationProfiles: CertificationProfile[]): void {\n\tconst profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));\n\tif (profiles.size !== certificationProfiles.length) throw new Error(\"Certification profile IDs must be unique.\");\n\tfor (const module of modules) {\n\t\tif (!module || !/^[a-z][a-z0-9-]*$/.test(module.namespace) || !Array.isArray(module.objectTypes) || !Array.isArray(module.actions) || !Array.isArray(module.views)) throw new Error(\"Compiler input is not a normalized module manifest.\");\n\t}\n\tconst targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));\n\tfor (const module of modules) {\n\t\tif (module.capability) {\n\t\t\tif (!module.capability.displayName?.trim() || !module.capability.description?.trim()) throw new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t\tif (![\"experimental\", \"beta\", \"stable\", \"deprecated\"].includes(module.capability.stability)) throw new Error(`Module \"${module.namespace}\" capability has invalid stability.`);\n\t\t}\n\t\tconst certification = module.capability?.certification;\n\t\tconst profile = certification?.required ? profiles.get(certification.profile) : undefined;\n\t\tfor (const objectType of module.objectTypes) {\n\t\t\tif (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type \"${objectType.type}\" in compiler input.`);\n\t\t\tif (objectType.schema) assertPortableJsonSchema(objectType.schema, `${module.namespace}.${objectType.type}`);\n\t\t\tfor (const relation of objectType.relations ?? []) if (!targets.has(relation.target)) throw new Error(`Relation ${module.namespace}.${objectType.type}.${relation.name} targets missing object type \"${relation.target}\".`);\n\t\t\tfor (const invariant of objectType.invariants ?? []) {\n\t\t\t\tif (invariant.required && !resolvesRequiredInvariant(module, objectType, invariant, profile)) {\n\t\t\t\t\tthrow new Error(`Required invariant \"${module.namespace}.${objectType.type}.${invariant.id}\" has no resolvable enforcement evidence under certification profile \"${certification?.profile ?? \"none\"}\".`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const view of module.views) {\n\t\t\tif (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View \"${view.name}\" must use module namespace \"${module.namespace}/\".`);\n\t\t\tassertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);\n\t\t\tif (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);\n\t\t}\n\t\tfor (const eventType of module.eventTypes) if (eventType.schema) assertPortableJsonSchema(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);\n\t\tfor (const action of module.actions) {\n\t\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId) || !action.actionId.startsWith(`${module.namespace}.`) || ![\"atomic\", \"saga\"].includes(action.kind) || typeof action.idempotent !== \"boolean\" || typeof action.mutatesDomain !== \"boolean\" || !Array.isArray(action.emitsEvents)) throw new Error(`Action \"${action.actionId}\" is not a normalized manifest action.`);\n\t\t\tif (action.parameterSchema) assertPortableJsonSchema(action.parameterSchema as PortableJsonSchema, `Action ${action.actionId} parameters`);\n\t\t\tif (action.resultSchema) assertPortableJsonSchema(action.resultSchema as PortableJsonSchema, `Action ${action.actionId} result`);\n\t\t}\n\t}\n}\n\nfunction resolvesRequiredInvariant(\n\tmodule: ModuleManifest,\n\tobjectType: ModuleManifest[\"objectTypes\"][number],\n\tinvariant: DeclarativeInvariant,\n\tprofile: CertificationProfile | undefined,\n): boolean {\n\tconst reference = invariant.enforcementRef?.trim();\n\tif (!reference) return false;\n\tif (invariant.enforcement === \"json-schema\") {\n\t\tconst requiredMatch = /^#\\/required\\/([^/]+)$/.exec(reference);\n\t\tif (requiredMatch) return Array.isArray(objectType.schema?.required) && objectType.schema.required.includes(decodeJsonPointerToken(requiredMatch[1]!));\n\t\tconst propertyMatch = /^#\\/properties\\/([^/]+)$/.exec(reference);\n\t\tif (propertyMatch) return Boolean(objectType.schema?.properties?.[decodeJsonPointerToken(propertyMatch[1]!)]);\n\t\treturn false;\n\t}\n\tif (invariant.enforcement === \"state-machine\") return module.stateMachines.some((machine) => machine.entityType === reference);\n\tif (invariant.enforcement === \"policy\") return module.policies.some((policy) => policy.policyId === reference);\n\treturn profile?.resolveInvariant?.({ module, objectType, invariant }) === true;\n}\n\nfunction decodeJsonPointerToken(token: string): string {\n\treturn token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n\nexport type CompatibilitySeverity = \"compatible\" | \"potentially_breaking\" | \"breaking\";\nexport interface CompatibilityChange {\n\tseverity: CompatibilitySeverity;\n\tpath: string;\n\tcode: string;\n\tmessage: string;\n}\nexport interface CompatibilityReport {\n\tcompatible: boolean;\n\thighestSeverity: CompatibilitySeverity;\n\tchanges: CompatibilityChange[];\n}\n\nconst severityRank: Record<CompatibilitySeverity, number> = { compatible: 0, potentially_breaking: 1, breaking: 2 };\n\nexport function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport {\n\tif (before.namespace !== after.namespace) {\n\t\treturn report([{ severity: \"breaking\", path: \"namespace\", code: \"module_renamed\", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);\n\t}\n\tconst changes: CompatibilityChange[] = [];\n\tif (before.version !== after.version) changes.push({ severity: \"potentially_breaking\", path: \"version\", code: \"module_version_changed\", message: \"Module version changed.\" });\n\tif (stableStringify(before.capability) !== stableStringify(after.capability)) changes.push({ severity: \"potentially_breaking\", path: \"capability\", code: \"capability_changed\", message: \"Capability stability, requirements, extensions, deprecation, or certification metadata changed.\" });\n\tdiffStringList(before.subjectTypes, after.subjectTypes, \"subjectTypes\", changes);\n\tdiffNamed(before.idPrefixes, after.idPrefixes, \"idPrefixes\", \"prefix\", changes, (oldValue, newValue, path) => {\n\t\tif (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: \"breaking\", path, code: \"id_prefix_changed\", message: \"ID prefix ownership changed.\" });\n\t});\n\tif (stableStringify(before.dependencies) !== stableStringify(after.dependencies)) changes.push({ severity: \"potentially_breaking\", path: \"dependencies\", code: \"module_dependencies_changed\", message: \"Module dependencies changed.\" });\n\tif (stableStringify(before.policies) !== stableStringify(after.policies)) changes.push({ severity: \"potentially_breaking\", path: \"policies\", code: \"module_policies_changed\", message: \"Module policy definitions changed.\" });\n\tdiffNamed(before.objectTypes, after.objectTypes, \"objectTypes\", \"type\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tconst oldArchetype = oldValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tconst newArchetype = newValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tif (oldArchetype && !newArchetype) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_removed\", message: \"Archetype certification metadata was removed.\" });\n\t\telse if (oldArchetype && newArchetype && stableStringify(oldArchetype) !== stableStringify(newArchetype)) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_mapping_changed\", message: \"Archetype identity, version, or state mapping changed.\" });\n\t\tdiffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, \"name\", changes, (oldRelation, newRelation, relationPath) => {\n\t\t\tif (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: \"breaking\", path: `${relationPath}.cardinality`, code: \"relation_cardinality_changed\", message: \"Relation cardinality changed.\" });\n\t\t\tif (oldRelation.target !== newRelation.target) changes.push({ severity: \"breaking\", path: `${relationPath}.target`, code: \"relation_target_changed\", message: \"Relation target changed.\" });\n\t\t\tif (!oldRelation.required && newRelation.required) changes.push({ severity: \"breaking\", path: `${relationPath}.required`, code: \"relation_became_required\", message: \"Optional relation became required.\" });\n\t\t\tif (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: \"breaking\", path: `${relationPath}.semantics`, code: \"relation_ownership_changed\", message: \"Relation ownership semantics changed.\" });\n\t\t\tif (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: \"breaking\", path: `${relationPath}.onTargetDelete`, code: \"relation_delete_behavior_changed\", message: \"Relation deletion behavior changed.\" });\n\t\t});\n\t\tdiffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, \"id\", changes, (oldInvariant, newInvariant, invariantPath) => {\n\t\t\tif (oldInvariant.enforcement !== newInvariant.enforcement || oldInvariant.enforcementRef !== newInvariant.enforcementRef) changes.push({ severity: \"potentially_breaking\", path: invariantPath, code: \"invariant_enforcement_changed\", message: \"Invariant enforcement ownership or reference changed.\" });\n\t\t\tif (!oldInvariant.required && newInvariant.required) changes.push({ severity: \"breaking\", path: `${invariantPath}.required`, code: \"invariant_became_required\", message: \"Invariant became required.\" });\n\t\t});\n\t});\n\tdiffNamed(before.actions, after.actions, \"actions\", \"actionId\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.parameterSchema as PortableJsonSchema | undefined, newValue.parameterSchema as PortableJsonSchema | undefined, `${path}.parameterSchema`, changes);\n\t\tdiffSchema(oldValue.resultSchema as PortableJsonSchema | undefined, newValue.resultSchema as PortableJsonSchema | undefined, `${path}.resultSchema`, changes);\n\t\tif (stableStringify(oldValue.execution) !== stableStringify(newValue.execution)) changes.push({ severity: oldValue.execution ? \"breaking\" : \"potentially_breaking\", path: `${path}.execution`, code: \"action_execution_changed\", message: \"Action execution semantics changed and hosts or offline consumers must be reviewed.\" });\n\t\tfor (const field of [\"version\", \"kind\", \"idempotent\", \"mutatesDomain\", \"eventPhase\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed.` });\n\t\t}\n\t\tconst oldEvents = new Set(oldValue.emitsEvents);\n\t\tconst newEvents = new Set(newValue.emitsEvents);\n\t\tfor (const event of oldEvents) if (!newEvents.has(event)) changes.push({ severity: \"breaking\", path: `${path}.emitsEvents.${event}`, code: \"action_event_removed\", message: `Declared action event \"${event}\" was removed.` });\n\t\tfor (const event of newEvents) if (!oldEvents.has(event)) changes.push({ severity: \"compatible\", path: `${path}.emitsEvents.${event}`, code: \"action_event_added\", message: `Declared action event \"${event}\" was added.` });\n\t\tfor (const field of [\"policies\", \"requiredRoles\", \"requiredPermissions\", \"stateMachine\", \"adapterSteps\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed and requires consumer review.` });\n\t\t}\n\t});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\n\t\tdiffEventSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tif (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: \"breaking\", path: `${path}.schemaVersion`, code: \"event_version_decreased\", message: \"Event schema version decreased.\" });\n\t\telse if (oldValue.schemaVersion < newValue.schemaVersion) changes.push({ severity: \"potentially_breaking\", path: `${path}.schemaVersion`, code: \"event_version_changed\", message: \"Event schema version changed; old consumers require compatibility evidence.\" });\n\t});\n\tconst oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tconst newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tfor (const [key, oldView] of oldViews) {\n\t\tconst newView = newViews.get(key);\n\t\tif (!newView) changes.push({ severity: \"breaking\", path: `views.${key}`, code: \"view_version_removed\", message: `View contract \"${key}\" was removed.` });\n\t\telse {\n\t\t\tdiffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\n\t\t\tif (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: \"potentially_breaking\", path: `views.${key}.usage`, code: \"view_usage_changed\", message: \"View usage semantics changed and generated consumers require review.\" });\n\t\t}\n\t}\n\tfor (const key of newViews.keys()) if (!oldViews.has(key)) changes.push({ severity: \"compatible\", path: `views.${key}`, code: \"view_version_added\", message: `View contract \"${key}\" was added.` });\n\tdiffNamed(before.stateMachines, after.stateMachines, \"stateMachines\", \"entityType\", changes, (oldValue, newValue, path) => {\n\t\tconst newStates = new Set(newValue.states.map((state) => state.id));\n\t\tfor (const state of oldValue.states) if (!newStates.has(state.id)) changes.push({ severity: \"breaking\", path: `${path}.states.${state.id}`, code: \"state_removed\", message: `State \"${state.id}\" was removed.` });\n\t\tconst transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));\n\t\tfor (const transition of oldValue.transitions) if (!transitions.has(`${transition.from}->${transition.to}`)) changes.push({ severity: \"breaking\", path: `${path}.transitions.${transition.from}->${transition.to}`, code: \"transition_removed\", message: \"A state transition was removed or remapped.\" });\n\t});\n\treturn report(changes);\n}\n\nfunction diffEventSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst start = changes.length;\n\tdiffSchema(before, after, path, changes);\n\tfor (let index = start; index < changes.length; index += 1) {\n\t\tconst change = changes[index]!;\n\t\tchange.code = `event_${change.code}`;\n\t\tchange.message = `Event schema: ${change.message}`;\n\t}\n}\n\nfunction diffStringList(before: string[], after: string[], path: string, changes: CompatibilityChange[]): void {\n\tconst oldValues = new Set(before);\n\tconst newValues = new Set(after);\n\tfor (const value of oldValues) if (!newValues.has(value)) changes.push({ severity: \"breaking\", path: `${path}.${value}`, code: `${path}_removed`, message: `Public ${path} value \"${value}\" was removed.` });\n\tfor (const value of newValues) if (!oldValues.has(value)) changes.push({ severity: \"compatible\", path: `${path}.${value}`, code: `${path}_added`, message: `Public ${path} value \"${value}\" was added.` });\n}\n\nfunction diffNamed<T extends object>(\n\tbefore: T[], after: T[], path: string, key: keyof T, changes: CompatibilityChange[], compare: (before: T, after: T, path: string) => void,\n): void {\n\tconst oldMap = new Map(before.map((value) => [String(value[key]), value]));\n\tconst newMap = new Map(after.map((value) => [String(value[key]), value]));\n\tfor (const [name, value] of oldMap) {\n\t\tconst next = newMap.get(name);\n\t\tif (!next) changes.push({ severity: \"breaking\", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} \"${name}\" was removed.` });\n\t\telse compare(value, next, `${path}.${name}`);\n\t}\n\tfor (const name of newMap.keys()) if (!oldMap.has(name)) changes.push({ severity: \"compatible\", path: `${path}.${name}`, code: `${String(key)}_added`, message: `${String(key)} \"${name}\" was added.` });\n}\n\nfunction diffSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst changeCount = changes.length;\n\tif (!before && after) { changes.push({ severity: \"potentially_breaking\", path, code: \"schema_added\", message: \"A schema was added to an existing contract.\" }); return; }\n\tif (before && !after) { changes.push({ severity: \"breaking\", path, code: \"schema_removed\", message: \"An existing schema was removed.\" }); return; }\n\tif (!before || !after) return;\n\tconst oldRequired = new Set(before.required ?? []);\n\tfor (const required of after.required ?? []) if (!oldRequired.has(required)) changes.push({ severity: \"breaking\", path: `${path}.required.${required}`, code: \"required_property_added\", message: `Required property \"${required}\" was added.` });\n\tconst oldProperties = before.properties ?? {};\n\tconst newProperties = after.properties ?? {};\n\tfor (const property of Object.keys(oldProperties)) if (!(property in newProperties)) changes.push({ severity: \"breaking\", path: `${path}.properties.${property}`, code: \"schema_property_removed\", message: `Schema property \"${property}\" was removed.` });\n\tfor (const property of Object.keys(newProperties)) if (!(property in oldProperties)) changes.push({ severity: (after.required ?? []).includes(property) ? \"breaking\" : \"compatible\", path: `${path}.properties.${property}`, code: \"schema_property_added\", message: `Schema property \"${property}\" was added.` });\n\tfor (const property of Object.keys(oldProperties)) {\n\t\tif (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);\n\t}\n\tif (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: \"breaking\", path: `${path}.additionalProperties`, code: \"additional_properties_forbidden\", message: \"Schema now rejects undeclared properties.\" });\n\tif (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);\n\tfor (const keyword of [\"minimum\", \"maximum\", \"minLength\", \"maxLength\", \"pattern\"] as const) {\n\t\tif (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${keyword}`, code: \"schema_constraint_changed\", message: `Schema constraint \"${keyword}\" changed.` });\n\t}\n\tif (stableStringify(before.type) !== stableStringify(after.type)) {\n\t\tconst oldTypes = new Set(Array.isArray(before.type) ? before.type : before.type ? [before.type] : []);\n\t\tconst newTypes = new Set(Array.isArray(after.type) ? after.type : after.type ? [after.type] : []);\n\t\tconst widened = oldTypes.size > 0 && [...oldTypes].every((type) => newTypes.has(type));\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.type`, code: widened ? \"schema_type_widened\" : \"schema_type_narrowed\", message: widened ? \"Schema type widened; generated consumers may receive a new value type.\" : \"Schema type no longer accepts every prior type.\" });\n\t}\n\tif (before.enum && after.enum && before.enum.some((value) => !after.enum!.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.enum`, code: \"schema_enum_narrowed\", message: \"Schema enum no longer accepts a previously valid value.\" });\n\t}\n\tif (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: \"potentially_breaking\", path, code: \"schema_changed\", message: \"Schema changed and requires consumer review.\" });\n}\n\nfunction report(changes: CompatibilityChange[]): CompatibilityReport {\n\tconst highestSeverity = changes.reduce<CompatibilitySeverity>((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, \"compatible\");\n\treturn { compatible: highestSeverity === \"compatible\", highestSeverity, changes };\n}\n\nexport interface GeneratedFile { path: string; content: string; }\nexport interface GeneratorTarget { name: string; version: string; generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>; }\n\nexport async function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]> {\n\tconst files = await target.generate(ir);\n\tconst paths = new Set<string>();\n\treturn [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {\n\t\tif (!file.path || path.isAbsolute(file.path) || path.win32.isAbsolute(file.path) || file.path.includes(\"\\\\\") || file.path.split(\"/\").includes(\"..\")) throw new Error(`Generator \"${target.name}\" returned unsafe path \"${file.path}\".`);\n\t\tif (paths.has(file.path)) throw new Error(`Generator \"${target.name}\" returned duplicate path \"${file.path}\".`);\n\t\tpaths.add(file.path);\n\t\treturn { path: file.path, content: file.content.endsWith(\"\\n\") ? file.content : `${file.content}\\n` };\n\t});\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,OAMM;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAiChH,SAAS,gBAAgB,OAAwB;AACvD,SAAO,KAAK,UAAU,SAAS,KAAK,CAAC;AACtC;AAEA,SAAS,SAAS,OAAyB;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,QAAQ;AACnD,MAAI,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAgC,EAC7C,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,MAAM,wBAAwB,MAAM,KAAK,CAAC,EAC9D,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,SAAS,KAAK,CAAC,CAAC;AAAA,IAC/C;AAA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M,IAAI,KAAK,IAAI;AACnB,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ,SAAS,IAAI,IAAI,KAAK,UAAU,GAAG,KAAK,OAAO;AAAA,EAAK;AAAA,EACrG,CAAC;AACF;","names":["path"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype DeclarativeInvariant,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"2.0.0\";\nexport const compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface CompilerConformanceAdapter<Finding = unknown> {\n\tid: string;\n\tevaluate(manifest: ModuleManifest): Finding[];\n}\n\nexport interface CompilerConformanceResult<Finding = unknown> {\n\tadapterId: string;\n\tmoduleNamespace: string;\n\tfindings: Finding[];\n}\n\nexport interface CertificationInvariantContext {\n\tmodule: ModuleManifest;\n\tobjectType: ModuleManifest[\"objectTypes\"][number];\n\tinvariant: DeclarativeInvariant;\n}\n\nexport interface CertificationProfile {\n\tid: string;\n\t/** Resolve evidence owned outside serialized Platform definitions. */\n\tresolveInvariant?(context: CertificationInvariantContext): boolean;\n}\n\nexport interface FabricCompilerIr {\n\tcompilerVersion: string;\n\tmanifestVersion: number;\n\tmanifestDigest: string;\n\tmodules: ModuleManifest[];\n\tconformance: CompilerConformanceResult[];\n}\n\nexport function stableStringify(value: unknown): string {\n\treturn JSON.stringify(sortJson(value));\n}\n\nfunction sortJson(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(sortJson);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>)\n\t\t\t\t.sort(([left], [right]) => compareCanonicalStrings(left, right))\n\t\t\t\t.map(([key, child]) => [key, sortJson(child)]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function compileManifestBundle(\n\tinput: ModuleManifestBundle | ModuleManifestBundleV1,\n\toptions: { conformanceAdapters?: CompilerConformanceAdapter[]; certificationProfiles?: CertificationProfile[] } = {},\n): FabricCompilerIr {\n\tconst bundle = normalizeModuleManifestBundle(input);\n\tconst namespaces = new Set<string>();\n\tfor (const module of bundle.modules) {\n\t\tif (namespaces.has(module.namespace)) throw new Error(`Duplicate module namespace \"${module.namespace}\" in compiler input.`);\n\t\tnamespaces.add(module.namespace);\n\t}\n\tconst modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));\n\tassertCompilerManifests(modules, options.certificationProfiles ?? []);\n\tconst canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });\n\treturn {\n\t\tcompilerVersion: FABRIC_COMPILER_VERSION,\n\t\tmanifestVersion: bundle.manifestVersion,\n\t\tmanifestDigest: createHash(\"sha256\").update(canonical).digest(\"hex\"),\n\t\tmodules,\n\t\tconformance: (options.conformanceAdapters ?? []).flatMap((adapter) =>\n\t\t\tmodules.map((module) => ({ adapterId: adapter.id, moduleNamespace: module.namespace, findings: adapter.evaluate(module) })),\n\t\t),\n\t};\n}\n\n/**\n * Manifests reach the compiler without passing through a registry, so declared\n * durability is validated here too. A contradiction between an action's declared\n * completion and its kind is a manifest defect, and fails the build rather than a\n * running host.\n */\nfunction assertManifestWorkflows(module: ModuleManifest): void {\n\tfor (const action of module.actions) {\n\t\tif (action.execution?.completion === \"immediate\" && action.kind === \"saga\") {\n\t\t\tthrow new Error(`Action \"${action.actionId}\" declares immediate completion but is a multi-step saga.`);\n\t\t}\n\t}\n\tconst actionsById = new Map(module.actions.map((action) => [action.actionId, action]));\n\tconst names = new Set<string>();\n\tfor (const workflow of module.capability?.workflows ?? []) {\n\t\tif (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) throw new Error(`Module \"${module.namespace}\" declares invalid workflow name \"${workflow.name}\".`);\n\t\tif (names.has(workflow.name)) throw new Error(`Module \"${module.namespace}\" declares duplicate workflow \"${workflow.name}\".`);\n\t\tnames.add(workflow.name);\n\t\tif (!/^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares invalid task queue \"${workflow.taskQueue}\".`);\n\t\tconst timerNames = new Set<string>();\n\t\tfor (const timer of workflow.timers ?? []) {\n\t\t\tif (!timer.name?.trim() || !timer.configKey?.trim()) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a timer without a name or configKey.`);\n\t\t\tif (timerNames.has(timer.name)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate timer \"${timer.name}\".`);\n\t\t\ttimerNames.add(timer.name);\n\t\t}\n\t\tconst steps = new Set<string>();\n\t\tfor (const compensation of workflow.compensations ?? []) {\n\t\t\tif (steps.has(compensation.step)) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate compensation for step \"${compensation.step}\".`);\n\t\t\tsteps.add(compensation.step);\n\t\t\tconst compensating = actionsById.get(compensation.actionId);\n\t\t\tif (!compensating) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with unknown action \"${compensation.actionId}\".`);\n\t\t\tif (!compensating.idempotent) throw new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with non-idempotent action \"${compensation.actionId}\"; a reversal must be safely repeatable.`);\n\t\t}\n\t}\n}\n\nfunction assertCompilerManifests(modules: ModuleManifest[], certificationProfiles: CertificationProfile[]): void {\n\tconst profiles = new Map(certificationProfiles.map((profile) => [profile.id, profile]));\n\tif (profiles.size !== certificationProfiles.length) throw new Error(\"Certification profile IDs must be unique.\");\n\tfor (const module of modules) {\n\t\tif (!module || !/^[a-z][a-z0-9-]*$/.test(module.namespace) || !Array.isArray(module.objectTypes) || !Array.isArray(module.actions) || !Array.isArray(module.views)) throw new Error(\"Compiler input is not a normalized module manifest.\");\n\t}\n\tfor (const module of modules) assertManifestWorkflows(module);\n\tconst targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));\n\tfor (const module of modules) {\n\t\tif (module.capability) {\n\t\t\tif (!module.capability.displayName?.trim() || !module.capability.description?.trim()) throw new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t\tif (![\"experimental\", \"beta\", \"stable\", \"deprecated\"].includes(module.capability.stability)) throw new Error(`Module \"${module.namespace}\" capability has invalid stability.`);\n\t\t}\n\t\tconst certification = module.capability?.certification;\n\t\tconst profile = certification?.required ? profiles.get(certification.profile) : undefined;\n\t\tfor (const objectType of module.objectTypes) {\n\t\t\tif (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type \"${objectType.type}\" in compiler input.`);\n\t\t\tif (objectType.schema) assertPortableJsonSchema(objectType.schema, `${module.namespace}.${objectType.type}`);\n\t\t\tfor (const relation of objectType.relations ?? []) if (!targets.has(relation.target)) throw new Error(`Relation ${module.namespace}.${objectType.type}.${relation.name} targets missing object type \"${relation.target}\".`);\n\t\t\tfor (const invariant of objectType.invariants ?? []) {\n\t\t\t\tif (invariant.required && !resolvesRequiredInvariant(module, objectType, invariant, profile)) {\n\t\t\t\t\tthrow new Error(`Required invariant \"${module.namespace}.${objectType.type}.${invariant.id}\" has no resolvable enforcement evidence under certification profile \"${certification?.profile ?? \"none\"}\".`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const view of module.views) {\n\t\t\tif (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View \"${view.name}\" must use module namespace \"${module.namespace}/\".`);\n\t\t\tassertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);\n\t\t\tif (view.parameterSchema !== undefined) assertPortableJsonSchema(view.parameterSchema, `View ${view.name}@${view.version} parameters`);\n\t\t\tif (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View ${view.name}@${view.version} filter`);\n\t\t}\n\t\tfor (const eventType of module.eventTypes) if (eventType.schema) assertPortableJsonSchema(eventType.schema, `Event ${eventType.eventType}@${eventType.schemaVersion}`);\n\t\tfor (const action of module.actions) {\n\t\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId) || !action.actionId.startsWith(`${module.namespace}.`) || ![\"atomic\", \"saga\"].includes(action.kind) || typeof action.idempotent !== \"boolean\" || typeof action.mutatesDomain !== \"boolean\" || !Array.isArray(action.emitsEvents)) throw new Error(`Action \"${action.actionId}\" is not a normalized manifest action.`);\n\t\t\tif (action.parameterSchema) assertPortableJsonSchema(action.parameterSchema as PortableJsonSchema, `Action ${action.actionId} parameters`);\n\t\t\tif (action.resultSchema) assertPortableJsonSchema(action.resultSchema as PortableJsonSchema, `Action ${action.actionId} result`);\n\t\t}\n\t}\n}\n\nfunction resolvesRequiredInvariant(\n\tmodule: ModuleManifest,\n\tobjectType: ModuleManifest[\"objectTypes\"][number],\n\tinvariant: DeclarativeInvariant,\n\tprofile: CertificationProfile | undefined,\n): boolean {\n\tconst reference = invariant.enforcementRef?.trim();\n\tif (!reference) return false;\n\tif (invariant.enforcement === \"json-schema\") {\n\t\tconst requiredMatch = /^#\\/required\\/([^/]+)$/.exec(reference);\n\t\tif (requiredMatch) return Array.isArray(objectType.schema?.required) && objectType.schema.required.includes(decodeJsonPointerToken(requiredMatch[1]!));\n\t\tconst propertyMatch = /^#\\/properties\\/([^/]+)$/.exec(reference);\n\t\tif (propertyMatch) return Boolean(objectType.schema?.properties?.[decodeJsonPointerToken(propertyMatch[1]!)]);\n\t\treturn false;\n\t}\n\tif (invariant.enforcement === \"state-machine\") return module.stateMachines.some((machine) => machine.entityType === reference);\n\tif (invariant.enforcement === \"policy\") return module.policies.some((policy) => policy.policyId === reference);\n\treturn profile?.resolveInvariant?.({ module, objectType, invariant }) === true;\n}\n\nfunction decodeJsonPointerToken(token: string): string {\n\treturn token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\n\nexport type CompatibilitySeverity = \"compatible\" | \"potentially_breaking\" | \"breaking\";\nexport interface CompatibilityChange {\n\tseverity: CompatibilitySeverity;\n\tpath: string;\n\tcode: string;\n\tmessage: string;\n}\nexport interface CompatibilityReport {\n\tcompatible: boolean;\n\thighestSeverity: CompatibilitySeverity;\n\tchanges: CompatibilityChange[];\n}\n\nconst severityRank: Record<CompatibilitySeverity, number> = { compatible: 0, potentially_breaking: 1, breaking: 2 };\n\nexport function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport {\n\tif (before.namespace !== after.namespace) {\n\t\treturn report([{ severity: \"breaking\", path: \"namespace\", code: \"module_renamed\", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);\n\t}\n\tconst changes: CompatibilityChange[] = [];\n\tif (before.version !== after.version) changes.push({ severity: \"potentially_breaking\", path: \"version\", code: \"module_version_changed\", message: \"Module version changed.\" });\n\tif (stableStringify(withoutWorkflows(before.capability)) !== stableStringify(withoutWorkflows(after.capability))) changes.push({ severity: \"potentially_breaking\", path: \"capability\", code: \"capability_changed\", message: \"Capability stability, requirements, extensions, deprecation, or certification metadata changed.\" });\n\tdiffCapabilityWorkflows(before.capability?.workflows ?? [], after.capability?.workflows ?? [], changes);\n\tdiffStringList(before.subjectTypes, after.subjectTypes, \"subjectTypes\", changes);\n\tdiffNamed(before.idPrefixes, after.idPrefixes, \"idPrefixes\", \"prefix\", changes, (oldValue, newValue, path) => {\n\t\tif (stableStringify(oldValue) !== stableStringify(newValue)) changes.push({ severity: \"breaking\", path, code: \"id_prefix_changed\", message: \"ID prefix ownership changed.\" });\n\t});\n\tif (stableStringify(before.dependencies) !== stableStringify(after.dependencies)) changes.push({ severity: \"potentially_breaking\", path: \"dependencies\", code: \"module_dependencies_changed\", message: \"Module dependencies changed.\" });\n\tif (stableStringify(before.policies) !== stableStringify(after.policies)) changes.push({ severity: \"potentially_breaking\", path: \"policies\", code: \"module_policies_changed\", message: \"Module policy definitions changed.\" });\n\tdiffNamed(before.objectTypes, after.objectTypes, \"objectTypes\", \"type\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tconst oldArchetype = oldValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tconst newArchetype = newValue.semantics?.[\"fabric.archetype\"] as { id?: unknown; version?: unknown; stateMap?: unknown } | undefined;\n\t\tif (oldArchetype && !newArchetype) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_removed\", message: \"Archetype certification metadata was removed.\" });\n\t\telse if (oldArchetype && newArchetype && stableStringify(oldArchetype) !== stableStringify(newArchetype)) changes.push({ severity: \"breaking\", path: `${path}.semantics.fabric.archetype`, code: \"archetype_mapping_changed\", message: \"Archetype identity, version, or state mapping changed.\" });\n\t\tdiffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, \"name\", changes, (oldRelation, newRelation, relationPath) => {\n\t\t\tif (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: \"breaking\", path: `${relationPath}.cardinality`, code: \"relation_cardinality_changed\", message: \"Relation cardinality changed.\" });\n\t\t\tif (oldRelation.target !== newRelation.target) changes.push({ severity: \"breaking\", path: `${relationPath}.target`, code: \"relation_target_changed\", message: \"Relation target changed.\" });\n\t\t\tif (!oldRelation.required && newRelation.required) changes.push({ severity: \"breaking\", path: `${relationPath}.required`, code: \"relation_became_required\", message: \"Optional relation became required.\" });\n\t\t\tif (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: \"breaking\", path: `${relationPath}.semantics`, code: \"relation_ownership_changed\", message: \"Relation ownership semantics changed.\" });\n\t\t\tif (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: \"breaking\", path: `${relationPath}.onTargetDelete`, code: \"relation_delete_behavior_changed\", message: \"Relation deletion behavior changed.\" });\n\t\t});\n\t\tdiffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, \"id\", changes, (oldInvariant, newInvariant, invariantPath) => {\n\t\t\tif (oldInvariant.enforcement !== newInvariant.enforcement || oldInvariant.enforcementRef !== newInvariant.enforcementRef) changes.push({ severity: \"potentially_breaking\", path: invariantPath, code: \"invariant_enforcement_changed\", message: \"Invariant enforcement ownership or reference changed.\" });\n\t\t\tif (!oldInvariant.required && newInvariant.required) changes.push({ severity: \"breaking\", path: `${invariantPath}.required`, code: \"invariant_became_required\", message: \"Invariant became required.\" });\n\t\t});\n\t});\n\tdiffNamed(before.actions, after.actions, \"actions\", \"actionId\", changes, (oldValue, newValue, path) => {\n\t\tdiffSchema(oldValue.parameterSchema as PortableJsonSchema | undefined, newValue.parameterSchema as PortableJsonSchema | undefined, `${path}.parameterSchema`, changes);\n\t\tdiffSchema(oldValue.resultSchema as PortableJsonSchema | undefined, newValue.resultSchema as PortableJsonSchema | undefined, `${path}.resultSchema`, changes);\n\t\tif (stableStringify(oldValue.execution) !== stableStringify(newValue.execution)) changes.push({ severity: oldValue.execution ? \"breaking\" : \"potentially_breaking\", path: `${path}.execution`, code: \"action_execution_changed\", message: \"Action execution semantics changed and hosts or offline consumers must be reviewed.\" });\n\t\tfor (const field of [\"version\", \"kind\", \"idempotent\", \"mutatesDomain\", \"eventPhase\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed.` });\n\t\t}\n\t\tconst oldEvents = new Set(oldValue.emitsEvents);\n\t\tconst newEvents = new Set(newValue.emitsEvents);\n\t\tfor (const event of oldEvents) if (!newEvents.has(event)) changes.push({ severity: \"breaking\", path: `${path}.emitsEvents.${event}`, code: \"action_event_removed\", message: `Declared action event \"${event}\" was removed.` });\n\t\tfor (const event of newEvents) if (!oldEvents.has(event)) changes.push({ severity: \"compatible\", path: `${path}.emitsEvents.${event}`, code: \"action_event_added\", message: `Declared action event \"${event}\" was added.` });\n\t\tfor (const field of [\"policies\", \"requiredRoles\", \"requiredPermissions\", \"stateMachine\", \"adapterSteps\"] as const) {\n\t\t\tif (stableStringify(oldValue[field]) !== stableStringify(newValue[field])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${field}`, code: `action_${field}_changed`, message: `Action ${field} changed and requires consumer review.` });\n\t\t}\n\t});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\n\t\tdiffEventSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);\n\t\tif (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: \"breaking\", path: `${path}.schemaVersion`, code: \"event_version_decreased\", message: \"Event schema version decreased.\" });\n\t\telse if (oldValue.schemaVersion < newValue.schemaVersion) changes.push({ severity: \"potentially_breaking\", path: `${path}.schemaVersion`, code: \"event_version_changed\", message: \"Event schema version changed; old consumers require compatibility evidence.\" });\n\t});\n\tconst oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tconst newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));\n\tfor (const [key, oldView] of oldViews) {\n\t\tconst newView = newViews.get(key);\n\t\tif (!newView) changes.push({ severity: \"breaking\", path: `views.${key}`, code: \"view_version_removed\", message: `View contract \"${key}\" was removed.` });\n\t\telse {\n\t\t\tdiffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\n\t\t\tdiffSchema(oldView.parameterSchema, newView.parameterSchema, `views.${key}.parameterSchema`, changes);\n\t\t\tif (stableStringify(oldView.usage) !== stableStringify(newView.usage)) changes.push({ severity: \"potentially_breaking\", path: `views.${key}.usage`, code: \"view_usage_changed\", message: \"View usage semantics changed and generated consumers require review.\" });\n\t\t}\n\t}\n\tfor (const key of newViews.keys()) if (!oldViews.has(key)) changes.push({ severity: \"compatible\", path: `views.${key}`, code: \"view_version_added\", message: `View contract \"${key}\" was added.` });\n\tdiffNamed(before.stateMachines, after.stateMachines, \"stateMachines\", \"entityType\", changes, (oldValue, newValue, path) => {\n\t\tconst newStates = new Set(newValue.states.map((state) => state.id));\n\t\tfor (const state of oldValue.states) if (!newStates.has(state.id)) changes.push({ severity: \"breaking\", path: `${path}.states.${state.id}`, code: \"state_removed\", message: `State \"${state.id}\" was removed.` });\n\t\tconst transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));\n\t\tfor (const transition of oldValue.transitions) if (!transitions.has(`${transition.from}->${transition.to}`)) changes.push({ severity: \"breaking\", path: `${path}.transitions.${transition.from}->${transition.to}`, code: \"transition_removed\", message: \"A state transition was removed or remapped.\" });\n\t});\n\treturn report(changes);\n}\n\ntype CapabilityWorkflows = NonNullable<NonNullable<ModuleManifest[\"capability\"]>[\"workflows\"]>;\n\nfunction withoutWorkflows(capability: ModuleManifest[\"capability\"]): unknown {\n\tif (!capability) return capability;\n\tconst { workflows, ...rest } = capability;\n\tvoid workflows;\n\treturn rest;\n}\n\n/**\n * Durability is a contract, so its diff is classified rather than lumped into a\n * single \"capability changed\": gaining a workflow is safe, losing one is not, and\n * moving a queue or a deadline is a review.\n */\nfunction diffCapabilityWorkflows(before: CapabilityWorkflows, after: CapabilityWorkflows, changes: CompatibilityChange[]): void {\n\tconst oldWorkflows = new Map(before.map((workflow) => [workflow.name, workflow]));\n\tconst newWorkflows = new Map(after.map((workflow) => [workflow.name, workflow]));\n\tfor (const [name, oldWorkflow] of oldWorkflows) {\n\t\tconst path = `capability.workflows.${name}`;\n\t\tconst newWorkflow = newWorkflows.get(name);\n\t\tif (!newWorkflow) {\n\t\t\tchanges.push({ severity: \"breaking\", path, code: \"workflow_removed\", message: `Declared workflow \"${name}\" was removed.` });\n\t\t\tcontinue;\n\t\t}\n\t\tif (oldWorkflow.taskQueue !== newWorkflow.taskQueue) changes.push({ severity: \"potentially_breaking\", path: `${path}.taskQueue`, code: \"workflow_task_queue_changed\", message: `Workflow \"${name}\" moved from task queue \"${oldWorkflow.taskQueue}\" to \"${newWorkflow.taskQueue}\"; in-flight executions and worker routing require review.` });\n\t\tif (oldWorkflow.startedBy !== newWorkflow.startedBy) changes.push({ severity: \"potentially_breaking\", path: `${path}.startedBy`, code: \"workflow_trigger_changed\", message: `Workflow \"${name}\" changed the event that starts it.` });\n\n\t\tconst oldTimers = new Map((oldWorkflow.timers ?? []).map((timer) => [timer.name, timer]));\n\t\tconst newTimers = new Map((newWorkflow.timers ?? []).map((timer) => [timer.name, timer]));\n\t\tfor (const [timerName, oldTimer] of oldTimers) {\n\t\t\tconst timerPath = `${path}.timers.${timerName}`;\n\t\t\tconst newTimer = newTimers.get(timerName);\n\t\t\tif (!newTimer) {\n\t\t\t\tchanges.push({ severity: \"potentially_breaking\", path: timerPath, code: \"workflow_timer_removed\", message: `Workflow \"${name}\" no longer carries the deadline \"${timerName}\".` });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (oldTimer.configKey !== newTimer.configKey) changes.push({ severity: \"potentially_breaking\", path: `${timerPath}.configKey`, code: \"workflow_timer_config_changed\", message: `Deadline \"${timerName}\" now resolves from configuration key \"${newTimer.configKey}\".` });\n\t\t\tif (oldTimer.description !== newTimer.description) changes.push({ severity: \"compatible\", path: `${timerPath}.description`, code: \"workflow_timer_description_changed\", message: `Deadline \"${timerName}\" changed its description.` });\n\t\t}\n\t\tfor (const timerName of newTimers.keys()) if (!oldTimers.has(timerName)) changes.push({ severity: \"compatible\", path: `${path}.timers.${timerName}`, code: \"workflow_timer_added\", message: `Workflow \"${name}\" gained the deadline \"${timerName}\".` });\n\n\t\tconst oldCompensations = new Map((oldWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));\n\t\tconst newCompensations = new Map((newWorkflow.compensations ?? []).map((compensation) => [compensation.step, compensation]));\n\t\tfor (const [step, oldCompensation] of oldCompensations) {\n\t\t\tconst stepPath = `${path}.compensations.${step}`;\n\t\t\tconst newCompensation = newCompensations.get(step);\n\t\t\tif (!newCompensation) {\n\t\t\t\tchanges.push({ severity: \"breaking\", path: stepPath, code: \"workflow_compensation_removed\", message: `Workflow \"${name}\" no longer reverses step \"${step}\".` });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (oldCompensation.actionId !== newCompensation.actionId) changes.push({ severity: \"potentially_breaking\", path: `${stepPath}.actionId`, code: \"workflow_compensation_changed\", message: `Step \"${step}\" is now reversed by \"${newCompensation.actionId}\".` });\n\t\t}\n\t\tfor (const step of newCompensations.keys()) if (!oldCompensations.has(step)) changes.push({ severity: \"compatible\", path: `${path}.compensations.${step}`, code: \"workflow_compensation_added\", message: `Workflow \"${name}\" gained a reversal for step \"${step}\".` });\n\t}\n\tfor (const name of newWorkflows.keys()) if (!oldWorkflows.has(name)) changes.push({ severity: \"compatible\", path: `capability.workflows.${name}`, code: \"workflow_added\", message: `Workflow \"${name}\" was added.` });\n}\n\nfunction diffEventSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst start = changes.length;\n\tdiffSchema(before, after, path, changes);\n\tfor (let index = start; index < changes.length; index += 1) {\n\t\tconst change = changes[index]!;\n\t\tchange.code = `event_${change.code}`;\n\t\tchange.message = `Event schema: ${change.message}`;\n\t}\n}\n\nfunction diffStringList(before: string[], after: string[], path: string, changes: CompatibilityChange[]): void {\n\tconst oldValues = new Set(before);\n\tconst newValues = new Set(after);\n\tfor (const value of oldValues) if (!newValues.has(value)) changes.push({ severity: \"breaking\", path: `${path}.${value}`, code: `${path}_removed`, message: `Public ${path} value \"${value}\" was removed.` });\n\tfor (const value of newValues) if (!oldValues.has(value)) changes.push({ severity: \"compatible\", path: `${path}.${value}`, code: `${path}_added`, message: `Public ${path} value \"${value}\" was added.` });\n}\n\nfunction diffNamed<T extends object>(\n\tbefore: T[], after: T[], path: string, key: keyof T, changes: CompatibilityChange[], compare: (before: T, after: T, path: string) => void,\n): void {\n\tconst oldMap = new Map(before.map((value) => [String(value[key]), value]));\n\tconst newMap = new Map(after.map((value) => [String(value[key]), value]));\n\tfor (const [name, value] of oldMap) {\n\t\tconst next = newMap.get(name);\n\t\tif (!next) changes.push({ severity: \"breaking\", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} \"${name}\" was removed.` });\n\t\telse compare(value, next, `${path}.${name}`);\n\t}\n\tfor (const name of newMap.keys()) if (!oldMap.has(name)) changes.push({ severity: \"compatible\", path: `${path}.${name}`, code: `${String(key)}_added`, message: `${String(key)} \"${name}\" was added.` });\n}\n\nfunction diffSchema(before: PortableJsonSchema | undefined, after: PortableJsonSchema | undefined, path: string, changes: CompatibilityChange[]): void {\n\tconst changeCount = changes.length;\n\tif (!before && after) { changes.push({ severity: \"potentially_breaking\", path, code: \"schema_added\", message: \"A schema was added to an existing contract.\" }); return; }\n\tif (before && !after) { changes.push({ severity: \"breaking\", path, code: \"schema_removed\", message: \"An existing schema was removed.\" }); return; }\n\tif (!before || !after) return;\n\tconst oldRequired = new Set(before.required ?? []);\n\tfor (const required of after.required ?? []) if (!oldRequired.has(required)) changes.push({ severity: \"breaking\", path: `${path}.required.${required}`, code: \"required_property_added\", message: `Required property \"${required}\" was added.` });\n\tconst oldProperties = before.properties ?? {};\n\tconst newProperties = after.properties ?? {};\n\tfor (const property of Object.keys(oldProperties)) if (!(property in newProperties)) changes.push({ severity: \"breaking\", path: `${path}.properties.${property}`, code: \"schema_property_removed\", message: `Schema property \"${property}\" was removed.` });\n\tfor (const property of Object.keys(newProperties)) if (!(property in oldProperties)) changes.push({ severity: (after.required ?? []).includes(property) ? \"breaking\" : \"compatible\", path: `${path}.properties.${property}`, code: \"schema_property_added\", message: `Schema property \"${property}\" was added.` });\n\tfor (const property of Object.keys(oldProperties)) {\n\t\tif (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);\n\t}\n\tif (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: \"breaking\", path: `${path}.additionalProperties`, code: \"additional_properties_forbidden\", message: \"Schema now rejects undeclared properties.\" });\n\tif (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);\n\tfor (const keyword of [\"minimum\", \"maximum\", \"minLength\", \"maxLength\", \"pattern\"] as const) {\n\t\tif (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: \"potentially_breaking\", path: `${path}.${keyword}`, code: \"schema_constraint_changed\", message: `Schema constraint \"${keyword}\" changed.` });\n\t}\n\tif (stableStringify(before.type) !== stableStringify(after.type)) {\n\t\tconst oldTypes = new Set(Array.isArray(before.type) ? before.type : before.type ? [before.type] : []);\n\t\tconst newTypes = new Set(Array.isArray(after.type) ? after.type : after.type ? [after.type] : []);\n\t\tconst widened = oldTypes.size > 0 && [...oldTypes].every((type) => newTypes.has(type));\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.type`, code: widened ? \"schema_type_widened\" : \"schema_type_narrowed\", message: widened ? \"Schema type widened; generated consumers may receive a new value type.\" : \"Schema type no longer accepts every prior type.\" });\n\t}\n\tif (before.enum && after.enum && before.enum.some((value) => !after.enum!.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {\n\t\tchanges.push({ severity: \"breaking\", path: `${path}.enum`, code: \"schema_enum_narrowed\", message: \"Schema enum no longer accepts a previously valid value.\" });\n\t}\n\tif (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: \"potentially_breaking\", path, code: \"schema_changed\", message: \"Schema changed and requires consumer review.\" });\n}\n\nfunction report(changes: CompatibilityChange[]): CompatibilityReport {\n\tconst highestSeverity = changes.reduce<CompatibilitySeverity>((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, \"compatible\");\n\treturn { compatible: highestSeverity === \"compatible\", highestSeverity, changes };\n}\n\nexport interface GeneratedFile { path: string; content: string; }\nexport interface GeneratorTarget { name: string; version: string; generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>; }\n\nexport async function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]> {\n\tconst files = await target.generate(ir);\n\tconst paths = new Set<string>();\n\treturn [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {\n\t\tif (!file.path || path.isAbsolute(file.path) || path.win32.isAbsolute(file.path) || file.path.includes(\"\\\\\") || file.path.split(\"/\").includes(\"..\")) throw new Error(`Generator \"${target.name}\" returned unsafe path \"${file.path}\".`);\n\t\tif (paths.has(file.path)) throw new Error(`Generator \"${target.name}\" returned duplicate path \"${file.path}\".`);\n\t\tpaths.add(file.path);\n\t\treturn { path: file.path, content: file.content.endsWith(\"\\n\") ? file.content : `${file.content}\\n` };\n\t});\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,OAMM;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAiChH,SAAS,gBAAgB,OAAwB;AACvD,SAAO,KAAK,UAAU,SAAS,KAAK,CAAC;AACtC;AAEA,SAAS,SAAS,OAAyB;AAC1C,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,QAAQ;AACnD,MAAI,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAgC,EAC7C,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,MAAM,wBAAwB,MAAM,KAAK,CAAC,EAC9D,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,SAAS,KAAK,CAAC,CAAC;AAAA,IAC/C;AAAA,EACD;AACA,SAAO;AACR;AAEO,SAAS,sBACf,OACA,UAAkH,CAAC,GAChG;AACnB,QAAM,SAAS,8BAA8B,KAAK;AAClD,QAAM,aAAa,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IAAI;AAC9G,UAAM,IAAI,KAAK,IAAI;AACnB,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ,SAAS,IAAI,IAAI,KAAK,UAAU,GAAG,KAAK,OAAO;AAAA,EAAK;AAAA,EACrG,CAAC;AACF;","names":["path"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabricorg/compiler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Deterministic compiler IR and semantic compatibility analysis for Fabric module manifests.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"CHANGELOG.md"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@fabricorg/platform": "^1.
|
|
28
|
+
"@fabricorg/platform": "^1.2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.10.0",
|
|
32
32
|
"tsup": "^8.5.0",
|
|
33
33
|
"typescript": "^5.7.3",
|
|
34
34
|
"vitest": "^4.1.5",
|
|
35
|
-
"@fabricorg/platform": "^1.
|
|
35
|
+
"@fabricorg/platform": "^1.2.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=20"
|