@fabricorg/compiler 0.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 ADDED
@@ -0,0 +1,19 @@
1
+ # @fabricorg/compiler
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add deterministic Fabric manifest compilation, semantic compatibility analysis, conformance adapters,
8
+ and the generator target contract.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+ - Updated dependencies
14
+ - @fabricorg/platform@0.11.0
15
+
16
+ ## 0.1.0
17
+
18
+ - Add deterministic compiler IR, manifest digest, conformance adapters, semantic differ, and generator
19
+ target contract.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fabric
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # `@fabricorg/compiler`
2
+
3
+ Build-time compiler for versioned Fabric module manifests. It normalizes v1/v2 inputs, produces a
4
+ stable namespace-ordered IR and SHA-256 manifest digest, runs optional conformance adapters, classifies
5
+ semantic compatibility, and invokes deterministic generator targets.
6
+
7
+ It does not load live modules, execute handlers, or run inside `@fabricorg/platform`.
package/dist/index.cjs ADDED
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ FABRIC_COMPILER_VERSION: () => FABRIC_COMPILER_VERSION,
24
+ compareCanonicalStrings: () => compareCanonicalStrings,
25
+ compileManifestBundle: () => compileManifestBundle,
26
+ diffModuleManifests: () => diffModuleManifests,
27
+ runGenerator: () => runGenerator,
28
+ stableStringify: () => stableStringify
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+ var import_node_crypto = require("crypto");
32
+ var import_platform = require("@fabricorg/platform");
33
+ var FABRIC_COMPILER_VERSION = "0.1.0";
34
+ var compareCanonicalStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
35
+ function stableStringify(value) {
36
+ return JSON.stringify(sortJson(value));
37
+ }
38
+ function sortJson(value) {
39
+ if (Array.isArray(value)) return value.map(sortJson);
40
+ if (value && typeof value === "object") {
41
+ return Object.fromEntries(
42
+ Object.entries(value).sort(([left], [right]) => compareCanonicalStrings(left, right)).map(([key, child]) => [key, sortJson(child)])
43
+ );
44
+ }
45
+ return value;
46
+ }
47
+ function compileManifestBundle(input, options = {}) {
48
+ const bundle = (0, import_platform.normalizeModuleManifestBundle)(input);
49
+ const namespaces = /* @__PURE__ */ new Set();
50
+ for (const module2 of bundle.modules) {
51
+ if (namespaces.has(module2.namespace)) throw new Error(`Duplicate module namespace "${module2.namespace}" in compiler input.`);
52
+ namespaces.add(module2.namespace);
53
+ }
54
+ const modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));
55
+ assertCompilerManifests(modules);
56
+ const canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });
57
+ return {
58
+ compilerVersion: FABRIC_COMPILER_VERSION,
59
+ manifestVersion: bundle.manifestVersion,
60
+ manifestDigest: (0, import_node_crypto.createHash)("sha256").update(canonical).digest("hex"),
61
+ modules,
62
+ conformance: (options.conformanceAdapters ?? []).flatMap(
63
+ (adapter) => modules.map((module2) => ({ adapterId: adapter.id, moduleNamespace: module2.namespace, findings: adapter.evaluate(module2) }))
64
+ )
65
+ };
66
+ }
67
+ function assertCompilerManifests(modules) {
68
+ for (const module2 of modules) {
69
+ 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.");
70
+ }
71
+ const targets = new Set(modules.flatMap((module2) => module2.objectTypes.map((objectType) => `${module2.namespace}.${objectType.type}`)));
72
+ for (const module2 of modules) {
73
+ if (module2.capability) {
74
+ if (!module2.capability.displayName?.trim() || !module2.capability.description?.trim()) throw new Error(`Module "${module2.namespace}" capability requires displayName and description.`);
75
+ if (!["experimental", "beta", "stable", "deprecated"].includes(module2.capability.stability)) throw new Error(`Module "${module2.namespace}" capability has invalid stability.`);
76
+ }
77
+ for (const objectType of module2.objectTypes) {
78
+ if (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type "${objectType.type}" in compiler input.`);
79
+ if (objectType.schema) (0, import_platform.assertPortableJsonSchema)(objectType.schema, `${module2.namespace}.${objectType.type}`);
80
+ for (const relation of objectType.relations ?? []) if (!targets.has(relation.target)) throw new Error(`Relation ${module2.namespace}.${objectType.type}.${relation.name} targets missing object type "${relation.target}".`);
81
+ }
82
+ for (const view of module2.views) {
83
+ if (!view.name.startsWith(`${module2.namespace}/`)) throw new Error(`View "${view.name}" must use module namespace "${module2.namespace}/".`);
84
+ (0, import_platform.assertPortableJsonSchema)(view.shape, `View ${view.name}@${view.version}`);
85
+ }
86
+ for (const action of module2.actions) {
87
+ if (!/^[a-z][a-z0-9-]*\.[a-z][a-z0-9_]*$/.test(action.actionId) || !action.actionId.startsWith(`${module2.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.`);
88
+ if (action.parameterSchema) (0, import_platform.assertPortableJsonSchema)(action.parameterSchema, `Action ${action.actionId} parameters`);
89
+ if (action.resultSchema) (0, import_platform.assertPortableJsonSchema)(action.resultSchema, `Action ${action.actionId} result`);
90
+ }
91
+ }
92
+ }
93
+ var severityRank = { compatible: 0, potentially_breaking: 1, breaking: 2 };
94
+ function diffModuleManifests(before, after) {
95
+ if (before.namespace !== after.namespace) {
96
+ return report([{ severity: "breaking", path: "namespace", code: "module_renamed", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);
97
+ }
98
+ const changes = [];
99
+ diffNamed(before.objectTypes, after.objectTypes, "objectTypes", "type", changes, (oldValue, newValue, path) => {
100
+ diffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);
101
+ const oldArchetype = oldValue.semantics?.["fabric.archetype"];
102
+ const newArchetype = newValue.semantics?.["fabric.archetype"];
103
+ if (oldArchetype && !newArchetype) changes.push({ severity: "breaking", path: `${path}.semantics.fabric.archetype`, code: "archetype_removed", message: "Archetype certification metadata was removed." });
104
+ else 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." });
105
+ diffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, "name", changes, (oldRelation, newRelation, relationPath) => {
106
+ if (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: "breaking", path: `${relationPath}.cardinality`, code: "relation_cardinality_changed", message: "Relation cardinality changed." });
107
+ if (oldRelation.target !== newRelation.target) changes.push({ severity: "breaking", path: `${relationPath}.target`, code: "relation_target_changed", message: "Relation target changed." });
108
+ if (!oldRelation.required && newRelation.required) changes.push({ severity: "breaking", path: `${relationPath}.required`, code: "relation_became_required", message: "Optional relation became required." });
109
+ if (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: "breaking", path: `${relationPath}.semantics`, code: "relation_ownership_changed", message: "Relation ownership semantics changed." });
110
+ if (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: "breaking", path: `${relationPath}.onTargetDelete`, code: "relation_delete_behavior_changed", message: "Relation deletion behavior changed." });
111
+ });
112
+ diffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, "id", changes, (oldInvariant, newInvariant, invariantPath) => {
113
+ if (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." });
114
+ if (!oldInvariant.required && newInvariant.required) changes.push({ severity: "breaking", path: `${invariantPath}.required`, code: "invariant_became_required", message: "Invariant became required." });
115
+ });
116
+ });
117
+ diffNamed(before.actions, after.actions, "actions", "actionId", changes, (oldValue, newValue, path) => {
118
+ diffSchema(oldValue.parameterSchema, newValue.parameterSchema, `${path}.parameterSchema`, changes);
119
+ diffSchema(oldValue.resultSchema, newValue.resultSchema, `${path}.resultSchema`, changes);
120
+ });
121
+ diffNamed(before.eventTypes, after.eventTypes, "eventTypes", "eventType", changes, (oldValue, newValue, path) => {
122
+ if (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: "breaking", path: `${path}.schemaVersion`, code: "event_version_decreased", message: "Event schema version decreased." });
123
+ else 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." });
124
+ });
125
+ const oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));
126
+ const newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));
127
+ for (const [key, oldView] of oldViews) {
128
+ const newView = newViews.get(key);
129
+ if (!newView) changes.push({ severity: "breaking", path: `views.${key}`, code: "view_version_removed", message: `View contract "${key}" was removed.` });
130
+ else diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);
131
+ }
132
+ for (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.` });
133
+ diffNamed(before.stateMachines, after.stateMachines, "stateMachines", "entityType", changes, (oldValue, newValue, path) => {
134
+ const newStates = new Set(newValue.states.map((state) => state.id));
135
+ for (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.` });
136
+ const transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));
137
+ for (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." });
138
+ });
139
+ return report(changes);
140
+ }
141
+ function diffNamed(before, after, path, key, changes, compare) {
142
+ const oldMap = new Map(before.map((value) => [String(value[key]), value]));
143
+ const newMap = new Map(after.map((value) => [String(value[key]), value]));
144
+ for (const [name, value] of oldMap) {
145
+ const next = newMap.get(name);
146
+ if (!next) changes.push({ severity: "breaking", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} "${name}" was removed.` });
147
+ else compare(value, next, `${path}.${name}`);
148
+ }
149
+ for (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.` });
150
+ }
151
+ function diffSchema(before, after, path, changes) {
152
+ const changeCount = changes.length;
153
+ if (!before && after) {
154
+ changes.push({ severity: "potentially_breaking", path, code: "schema_added", message: "A schema was added to an existing contract." });
155
+ return;
156
+ }
157
+ if (before && !after) {
158
+ changes.push({ severity: "breaking", path, code: "schema_removed", message: "An existing schema was removed." });
159
+ return;
160
+ }
161
+ if (!before || !after) return;
162
+ const oldRequired = new Set(before.required ?? []);
163
+ for (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.` });
164
+ const oldProperties = before.properties ?? {};
165
+ const newProperties = after.properties ?? {};
166
+ for (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.` });
167
+ for (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.` });
168
+ for (const property of Object.keys(oldProperties)) {
169
+ if (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);
170
+ }
171
+ if (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: "breaking", path: `${path}.additionalProperties`, code: "additional_properties_forbidden", message: "Schema now rejects undeclared properties." });
172
+ if (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);
173
+ for (const keyword of ["minimum", "maximum", "minLength", "maxLength", "pattern"]) {
174
+ if (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: "potentially_breaking", path: `${path}.${keyword}`, code: "schema_constraint_changed", message: `Schema constraint "${keyword}" changed.` });
175
+ }
176
+ if (stableStringify(before.type) !== stableStringify(after.type)) changes.push({ severity: "breaking", path: `${path}.type`, code: "schema_type_changed", message: "Schema type changed." });
177
+ if (before.enum && after.enum && before.enum.some((value) => !after.enum.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {
178
+ changes.push({ severity: "breaking", path: `${path}.enum`, code: "schema_enum_narrowed", message: "Schema enum no longer accepts a previously valid value." });
179
+ }
180
+ if (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: "potentially_breaking", path, code: "schema_changed", message: "Schema changed and requires consumer review." });
181
+ }
182
+ function report(changes) {
183
+ const highestSeverity = changes.reduce((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, "compatible");
184
+ return { compatible: highestSeverity === "compatible", highestSeverity, changes };
185
+ }
186
+ async function runGenerator(target, ir) {
187
+ const files = await target.generate(ir);
188
+ const paths = /* @__PURE__ */ new Set();
189
+ return [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {
190
+ if (!file.path || file.path.startsWith("/") || file.path.split("/").includes("..")) throw new Error(`Generator "${target.name}" returned unsafe path "${file.path}".`);
191
+ if (paths.has(file.path)) throw new Error(`Generator "${target.name}" returned duplicate path "${file.path}".`);
192
+ paths.add(file.path);
193
+ return { path: file.path, content: file.content.endsWith("\n") ? file.content : `${file.content}
194
+ ` };
195
+ });
196
+ }
197
+ // Annotate the CommonJS export names for ESM import in node:
198
+ 0 && (module.exports = {
199
+ FABRIC_COMPILER_VERSION,
200
+ compareCanonicalStrings,
201
+ compileManifestBundle,
202
+ diffModuleManifests,
203
+ runGenerator,
204
+ stableStringify
205
+ });
206
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"0.1.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 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[] } = {},\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);\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[]): void {\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\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}\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}\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\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\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});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\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 diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\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 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)) changes.push({ severity: \"breaking\", path: `${path}.type`, code: \"schema_type_changed\", message: \"Schema type changed.\" });\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 || file.path.startsWith(\"/\") || 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,sBAOO;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAqBhH,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,KA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 -0,0 +1,49 @@
1
+ import { ModuleManifest, ModuleManifestBundle, ModuleManifestBundleV1 } from '@fabricorg/platform';
2
+
3
+ declare const FABRIC_COMPILER_VERSION = "0.1.0";
4
+ declare const compareCanonicalStrings: (left: string, right: string) => number;
5
+ interface CompilerConformanceAdapter<Finding = unknown> {
6
+ id: string;
7
+ evaluate(manifest: ModuleManifest): Finding[];
8
+ }
9
+ interface CompilerConformanceResult<Finding = unknown> {
10
+ adapterId: string;
11
+ moduleNamespace: string;
12
+ findings: Finding[];
13
+ }
14
+ interface FabricCompilerIr {
15
+ compilerVersion: string;
16
+ manifestVersion: number;
17
+ manifestDigest: string;
18
+ modules: ModuleManifest[];
19
+ conformance: CompilerConformanceResult[];
20
+ }
21
+ declare function stableStringify(value: unknown): string;
22
+ declare function compileManifestBundle(input: ModuleManifestBundle | ModuleManifestBundleV1, options?: {
23
+ conformanceAdapters?: CompilerConformanceAdapter[];
24
+ }): FabricCompilerIr;
25
+ type CompatibilitySeverity = "compatible" | "potentially_breaking" | "breaking";
26
+ interface CompatibilityChange {
27
+ severity: CompatibilitySeverity;
28
+ path: string;
29
+ code: string;
30
+ message: string;
31
+ }
32
+ interface CompatibilityReport {
33
+ compatible: boolean;
34
+ highestSeverity: CompatibilitySeverity;
35
+ changes: CompatibilityChange[];
36
+ }
37
+ declare function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport;
38
+ interface GeneratedFile {
39
+ path: string;
40
+ content: string;
41
+ }
42
+ interface GeneratorTarget {
43
+ name: string;
44
+ version: string;
45
+ generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>;
46
+ }
47
+ declare function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]>;
48
+
49
+ export { type CompatibilityChange, type CompatibilityReport, type CompatibilitySeverity, type CompilerConformanceAdapter, type CompilerConformanceResult, FABRIC_COMPILER_VERSION, type FabricCompilerIr, type GeneratedFile, type GeneratorTarget, compareCanonicalStrings, compileManifestBundle, diffModuleManifests, runGenerator, stableStringify };
@@ -0,0 +1,49 @@
1
+ import { ModuleManifest, ModuleManifestBundle, ModuleManifestBundleV1 } from '@fabricorg/platform';
2
+
3
+ declare const FABRIC_COMPILER_VERSION = "0.1.0";
4
+ declare const compareCanonicalStrings: (left: string, right: string) => number;
5
+ interface CompilerConformanceAdapter<Finding = unknown> {
6
+ id: string;
7
+ evaluate(manifest: ModuleManifest): Finding[];
8
+ }
9
+ interface CompilerConformanceResult<Finding = unknown> {
10
+ adapterId: string;
11
+ moduleNamespace: string;
12
+ findings: Finding[];
13
+ }
14
+ interface FabricCompilerIr {
15
+ compilerVersion: string;
16
+ manifestVersion: number;
17
+ manifestDigest: string;
18
+ modules: ModuleManifest[];
19
+ conformance: CompilerConformanceResult[];
20
+ }
21
+ declare function stableStringify(value: unknown): string;
22
+ declare function compileManifestBundle(input: ModuleManifestBundle | ModuleManifestBundleV1, options?: {
23
+ conformanceAdapters?: CompilerConformanceAdapter[];
24
+ }): FabricCompilerIr;
25
+ type CompatibilitySeverity = "compatible" | "potentially_breaking" | "breaking";
26
+ interface CompatibilityChange {
27
+ severity: CompatibilitySeverity;
28
+ path: string;
29
+ code: string;
30
+ message: string;
31
+ }
32
+ interface CompatibilityReport {
33
+ compatible: boolean;
34
+ highestSeverity: CompatibilitySeverity;
35
+ changes: CompatibilityChange[];
36
+ }
37
+ declare function diffModuleManifests(before: ModuleManifest, after: ModuleManifest): CompatibilityReport;
38
+ interface GeneratedFile {
39
+ path: string;
40
+ content: string;
41
+ }
42
+ interface GeneratorTarget {
43
+ name: string;
44
+ version: string;
45
+ generate(ir: FabricCompilerIr): GeneratedFile[] | Promise<GeneratedFile[]>;
46
+ }
47
+ declare function runGenerator(target: GeneratorTarget, ir: FabricCompilerIr): Promise<GeneratedFile[]>;
48
+
49
+ export { type CompatibilityChange, type CompatibilityReport, type CompatibilitySeverity, type CompilerConformanceAdapter, type CompilerConformanceResult, FABRIC_COMPILER_VERSION, type FabricCompilerIr, type GeneratedFile, type GeneratorTarget, compareCanonicalStrings, compileManifestBundle, diffModuleManifests, runGenerator, stableStringify };
package/dist/index.js ADDED
@@ -0,0 +1,179 @@
1
+ // index.ts
2
+ import { createHash } from "crypto";
3
+ import {
4
+ normalizeModuleManifestBundle,
5
+ assertPortableJsonSchema
6
+ } from "@fabricorg/platform";
7
+ var FABRIC_COMPILER_VERSION = "0.1.0";
8
+ var compareCanonicalStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
9
+ function stableStringify(value) {
10
+ return JSON.stringify(sortJson(value));
11
+ }
12
+ function sortJson(value) {
13
+ if (Array.isArray(value)) return value.map(sortJson);
14
+ if (value && typeof value === "object") {
15
+ return Object.fromEntries(
16
+ Object.entries(value).sort(([left], [right]) => compareCanonicalStrings(left, right)).map(([key, child]) => [key, sortJson(child)])
17
+ );
18
+ }
19
+ return value;
20
+ }
21
+ function compileManifestBundle(input, options = {}) {
22
+ const bundle = normalizeModuleManifestBundle(input);
23
+ const namespaces = /* @__PURE__ */ new Set();
24
+ for (const module of bundle.modules) {
25
+ if (namespaces.has(module.namespace)) throw new Error(`Duplicate module namespace "${module.namespace}" in compiler input.`);
26
+ namespaces.add(module.namespace);
27
+ }
28
+ const modules = [...bundle.modules].sort((left, right) => compareCanonicalStrings(left.namespace, right.namespace));
29
+ assertCompilerManifests(modules);
30
+ const canonical = stableStringify({ manifestVersion: bundle.manifestVersion, modules });
31
+ return {
32
+ compilerVersion: FABRIC_COMPILER_VERSION,
33
+ manifestVersion: bundle.manifestVersion,
34
+ manifestDigest: createHash("sha256").update(canonical).digest("hex"),
35
+ modules,
36
+ conformance: (options.conformanceAdapters ?? []).flatMap(
37
+ (adapter) => modules.map((module) => ({ adapterId: adapter.id, moduleNamespace: module.namespace, findings: adapter.evaluate(module) }))
38
+ )
39
+ };
40
+ }
41
+ function assertCompilerManifests(modules) {
42
+ for (const module of modules) {
43
+ 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.");
44
+ }
45
+ const targets = new Set(modules.flatMap((module) => module.objectTypes.map((objectType) => `${module.namespace}.${objectType.type}`)));
46
+ for (const module of modules) {
47
+ if (module.capability) {
48
+ if (!module.capability.displayName?.trim() || !module.capability.description?.trim()) throw new Error(`Module "${module.namespace}" capability requires displayName and description.`);
49
+ if (!["experimental", "beta", "stable", "deprecated"].includes(module.capability.stability)) throw new Error(`Module "${module.namespace}" capability has invalid stability.`);
50
+ }
51
+ for (const objectType of module.objectTypes) {
52
+ if (!/^[A-Z][A-Za-z0-9]*$/.test(objectType.type)) throw new Error(`Invalid object type "${objectType.type}" in compiler input.`);
53
+ if (objectType.schema) assertPortableJsonSchema(objectType.schema, `${module.namespace}.${objectType.type}`);
54
+ for (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}".`);
55
+ }
56
+ for (const view of module.views) {
57
+ if (!view.name.startsWith(`${module.namespace}/`)) throw new Error(`View "${view.name}" must use module namespace "${module.namespace}/".`);
58
+ assertPortableJsonSchema(view.shape, `View ${view.name}@${view.version}`);
59
+ }
60
+ for (const action of module.actions) {
61
+ if (!/^[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.`);
62
+ if (action.parameterSchema) assertPortableJsonSchema(action.parameterSchema, `Action ${action.actionId} parameters`);
63
+ if (action.resultSchema) assertPortableJsonSchema(action.resultSchema, `Action ${action.actionId} result`);
64
+ }
65
+ }
66
+ }
67
+ var severityRank = { compatible: 0, potentially_breaking: 1, breaking: 2 };
68
+ function diffModuleManifests(before, after) {
69
+ if (before.namespace !== after.namespace) {
70
+ return report([{ severity: "breaking", path: "namespace", code: "module_renamed", message: `Module namespace changed from ${before.namespace} to ${after.namespace}.` }]);
71
+ }
72
+ const changes = [];
73
+ diffNamed(before.objectTypes, after.objectTypes, "objectTypes", "type", changes, (oldValue, newValue, path) => {
74
+ diffSchema(oldValue.schema, newValue.schema, `${path}.schema`, changes);
75
+ const oldArchetype = oldValue.semantics?.["fabric.archetype"];
76
+ const newArchetype = newValue.semantics?.["fabric.archetype"];
77
+ if (oldArchetype && !newArchetype) changes.push({ severity: "breaking", path: `${path}.semantics.fabric.archetype`, code: "archetype_removed", message: "Archetype certification metadata was removed." });
78
+ else 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." });
79
+ diffNamed(oldValue.relations ?? [], newValue.relations ?? [], `${path}.relations`, "name", changes, (oldRelation, newRelation, relationPath) => {
80
+ if (oldRelation.cardinality !== newRelation.cardinality) changes.push({ severity: "breaking", path: `${relationPath}.cardinality`, code: "relation_cardinality_changed", message: "Relation cardinality changed." });
81
+ if (oldRelation.target !== newRelation.target) changes.push({ severity: "breaking", path: `${relationPath}.target`, code: "relation_target_changed", message: "Relation target changed." });
82
+ if (!oldRelation.required && newRelation.required) changes.push({ severity: "breaking", path: `${relationPath}.required`, code: "relation_became_required", message: "Optional relation became required." });
83
+ if (oldRelation.semantics !== newRelation.semantics) changes.push({ severity: "breaking", path: `${relationPath}.semantics`, code: "relation_ownership_changed", message: "Relation ownership semantics changed." });
84
+ if (oldRelation.onTargetDelete !== newRelation.onTargetDelete) changes.push({ severity: "breaking", path: `${relationPath}.onTargetDelete`, code: "relation_delete_behavior_changed", message: "Relation deletion behavior changed." });
85
+ });
86
+ diffNamed(oldValue.invariants ?? [], newValue.invariants ?? [], `${path}.invariants`, "id", changes, (oldInvariant, newInvariant, invariantPath) => {
87
+ if (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." });
88
+ if (!oldInvariant.required && newInvariant.required) changes.push({ severity: "breaking", path: `${invariantPath}.required`, code: "invariant_became_required", message: "Invariant became required." });
89
+ });
90
+ });
91
+ diffNamed(before.actions, after.actions, "actions", "actionId", changes, (oldValue, newValue, path) => {
92
+ diffSchema(oldValue.parameterSchema, newValue.parameterSchema, `${path}.parameterSchema`, changes);
93
+ diffSchema(oldValue.resultSchema, newValue.resultSchema, `${path}.resultSchema`, changes);
94
+ });
95
+ diffNamed(before.eventTypes, after.eventTypes, "eventTypes", "eventType", changes, (oldValue, newValue, path) => {
96
+ if (oldValue.schemaVersion > newValue.schemaVersion) changes.push({ severity: "breaking", path: `${path}.schemaVersion`, code: "event_version_decreased", message: "Event schema version decreased." });
97
+ else 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." });
98
+ });
99
+ const oldViews = new Map(before.views.map((view) => [`${view.name}@${view.version}`, view]));
100
+ const newViews = new Map(after.views.map((view) => [`${view.name}@${view.version}`, view]));
101
+ for (const [key, oldView] of oldViews) {
102
+ const newView = newViews.get(key);
103
+ if (!newView) changes.push({ severity: "breaking", path: `views.${key}`, code: "view_version_removed", message: `View contract "${key}" was removed.` });
104
+ else diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);
105
+ }
106
+ for (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.` });
107
+ diffNamed(before.stateMachines, after.stateMachines, "stateMachines", "entityType", changes, (oldValue, newValue, path) => {
108
+ const newStates = new Set(newValue.states.map((state) => state.id));
109
+ for (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.` });
110
+ const transitions = new Set(newValue.transitions.map((transition) => `${transition.from}->${transition.to}`));
111
+ for (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." });
112
+ });
113
+ return report(changes);
114
+ }
115
+ function diffNamed(before, after, path, key, changes, compare) {
116
+ const oldMap = new Map(before.map((value) => [String(value[key]), value]));
117
+ const newMap = new Map(after.map((value) => [String(value[key]), value]));
118
+ for (const [name, value] of oldMap) {
119
+ const next = newMap.get(name);
120
+ if (!next) changes.push({ severity: "breaking", path: `${path}.${name}`, code: `${String(key)}_removed`, message: `${String(key)} "${name}" was removed.` });
121
+ else compare(value, next, `${path}.${name}`);
122
+ }
123
+ for (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.` });
124
+ }
125
+ function diffSchema(before, after, path, changes) {
126
+ const changeCount = changes.length;
127
+ if (!before && after) {
128
+ changes.push({ severity: "potentially_breaking", path, code: "schema_added", message: "A schema was added to an existing contract." });
129
+ return;
130
+ }
131
+ if (before && !after) {
132
+ changes.push({ severity: "breaking", path, code: "schema_removed", message: "An existing schema was removed." });
133
+ return;
134
+ }
135
+ if (!before || !after) return;
136
+ const oldRequired = new Set(before.required ?? []);
137
+ for (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.` });
138
+ const oldProperties = before.properties ?? {};
139
+ const newProperties = after.properties ?? {};
140
+ for (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.` });
141
+ for (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.` });
142
+ for (const property of Object.keys(oldProperties)) {
143
+ if (newProperties[property]) diffSchema(oldProperties[property], newProperties[property], `${path}.properties.${property}`, changes);
144
+ }
145
+ if (before.additionalProperties !== false && after.additionalProperties === false) changes.push({ severity: "breaking", path: `${path}.additionalProperties`, code: "additional_properties_forbidden", message: "Schema now rejects undeclared properties." });
146
+ if (before.items && after.items && !Array.isArray(before.items) && !Array.isArray(after.items)) diffSchema(before.items, after.items, `${path}.items`, changes);
147
+ for (const keyword of ["minimum", "maximum", "minLength", "maxLength", "pattern"]) {
148
+ if (stableStringify(before[keyword]) !== stableStringify(after[keyword])) changes.push({ severity: "potentially_breaking", path: `${path}.${keyword}`, code: "schema_constraint_changed", message: `Schema constraint "${keyword}" changed.` });
149
+ }
150
+ if (stableStringify(before.type) !== stableStringify(after.type)) changes.push({ severity: "breaking", path: `${path}.type`, code: "schema_type_changed", message: "Schema type changed." });
151
+ if (before.enum && after.enum && before.enum.some((value) => !after.enum.some((newValue) => stableStringify(newValue) === stableStringify(value)))) {
152
+ changes.push({ severity: "breaking", path: `${path}.enum`, code: "schema_enum_narrowed", message: "Schema enum no longer accepts a previously valid value." });
153
+ }
154
+ if (stableStringify(before) !== stableStringify(after) && changes.length === changeCount) changes.push({ severity: "potentially_breaking", path, code: "schema_changed", message: "Schema changed and requires consumer review." });
155
+ }
156
+ function report(changes) {
157
+ const highestSeverity = changes.reduce((highest, change) => severityRank[change.severity] > severityRank[highest] ? change.severity : highest, "compatible");
158
+ return { compatible: highestSeverity === "compatible", highestSeverity, changes };
159
+ }
160
+ async function runGenerator(target, ir) {
161
+ const files = await target.generate(ir);
162
+ const paths = /* @__PURE__ */ new Set();
163
+ return [...files].sort((left, right) => compareCanonicalStrings(left.path, right.path)).map((file) => {
164
+ if (!file.path || file.path.startsWith("/") || file.path.split("/").includes("..")) throw new Error(`Generator "${target.name}" returned unsafe path "${file.path}".`);
165
+ if (paths.has(file.path)) throw new Error(`Generator "${target.name}" returned duplicate path "${file.path}".`);
166
+ paths.add(file.path);
167
+ return { path: file.path, content: file.content.endsWith("\n") ? file.content : `${file.content}
168
+ ` };
169
+ });
170
+ }
171
+ export {
172
+ FABRIC_COMPILER_VERSION,
173
+ compareCanonicalStrings,
174
+ compileManifestBundle,
175
+ diffModuleManifests,
176
+ runGenerator,
177
+ stableStringify
178
+ };
179
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n\tnormalizeModuleManifestBundle,\n\tassertPortableJsonSchema,\n\ttype ModuleManifest,\n\ttype ModuleManifestBundle,\n\ttype ModuleManifestBundleV1,\n\ttype PortableJsonSchema,\n} from \"@fabricorg/platform\";\n\nexport const FABRIC_COMPILER_VERSION = \"0.1.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 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[] } = {},\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);\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[]): void {\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\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}\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}\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\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\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});\n\tdiffNamed(before.eventTypes, after.eventTypes, \"eventTypes\", \"eventType\", changes, (oldValue, newValue, path) => {\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 diffSchema(oldView.shape, newView.shape, `views.${key}.shape`, changes);\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 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)) changes.push({ severity: \"breaking\", path: `${path}.type`, code: \"schema_type_changed\", message: \"Schema type changed.\" });\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 || file.path.startsWith(\"/\") || 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;AAAA,EACC;AAAA,EACA;AAAA,OAKM;AAEA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAqBhH,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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,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":[]}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@fabricorg/compiler",
3
+ "version": "0.2.0",
4
+ "description": "Deterministic compiler IR and semantic compatibility analysis for Fabric module manifests.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.cjs",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "CHANGELOG.md"
26
+ ],
27
+ "dependencies": {
28
+ "@fabricorg/platform": "^0.11.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^22.10.0",
32
+ "tsup": "^8.5.0",
33
+ "typescript": "^5.7.3",
34
+ "vitest": "^4.1.5"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
44
+ "build": "tsup",
45
+ "type-check": "tsc --noEmit",
46
+ "test": "vitest run"
47
+ }
48
+ }