@cynodia/axiom-compiler 0.3.1-alpha.1 → 0.4.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/normalize.js +17 -4
- package/package.json +3 -3
package/dist/normalize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inferLocationType, locationRootStateId, semanticContextFromGraph, validateGraph, } from '@cynodia/axiom-core';
|
|
1
|
+
import { actionGuards, inferLocationType, locationRootStateId, semanticContextFromGraph, validateGraph, } from '@cynodia/axiom-core';
|
|
2
2
|
import { isUINode } from '@cynodia/axiom-core';
|
|
3
3
|
export class GraphValidationError extends Error {
|
|
4
4
|
problems;
|
|
@@ -49,6 +49,7 @@ export function compileToIR(graph, options = {}) {
|
|
|
49
49
|
const entities = [];
|
|
50
50
|
const states = [];
|
|
51
51
|
const constraints = [];
|
|
52
|
+
const transitionConstraints = [];
|
|
52
53
|
const routes = [];
|
|
53
54
|
for (const node of graph.listNodes()) {
|
|
54
55
|
nodes[node.id] = node;
|
|
@@ -63,12 +64,23 @@ export function compileToIR(graph, options = {}) {
|
|
|
63
64
|
case 'state':
|
|
64
65
|
states.push(node);
|
|
65
66
|
break;
|
|
66
|
-
case 'action':
|
|
67
|
-
|
|
67
|
+
case 'action': {
|
|
68
|
+
// Guards are authoring sugar: the IR carries conditions and failures aligned.
|
|
69
|
+
const guards = actionGuards(node);
|
|
70
|
+
actions[node.id] = {
|
|
71
|
+
...node,
|
|
72
|
+
preconditions: guards.map((guard) => guard.condition),
|
|
73
|
+
failureModes: guards.map((guard) => guard.failureMode ?? { code: 'precondition-failed' }),
|
|
74
|
+
};
|
|
75
|
+
nodes[node.id] = actions[node.id];
|
|
68
76
|
break;
|
|
77
|
+
}
|
|
69
78
|
case 'constraint':
|
|
70
79
|
constraints.push(node);
|
|
71
80
|
break;
|
|
81
|
+
case 'transition-constraint':
|
|
82
|
+
transitionConstraints.push(node);
|
|
83
|
+
break;
|
|
72
84
|
case 'route':
|
|
73
85
|
routes.push(compileRoute(node));
|
|
74
86
|
break;
|
|
@@ -105,8 +117,9 @@ export function compileToIR(graph, options = {}) {
|
|
|
105
117
|
actions,
|
|
106
118
|
uiNodes,
|
|
107
119
|
constraints,
|
|
120
|
+
transitionConstraints,
|
|
108
121
|
routes,
|
|
109
|
-
edges: graph.
|
|
122
|
+
edges: graph.semanticEdges(),
|
|
110
123
|
locationTypes,
|
|
111
124
|
locationRoots,
|
|
112
125
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cynodia/axiom-compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1-alpha.1",
|
|
4
4
|
"description": "Normalizes an Axiom application graph and emits a self-contained page.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AskTech AS",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@cynodia/axiom-core": "0.
|
|
35
|
-
"@cynodia/axiom-runtime": "0.
|
|
34
|
+
"@cynodia/axiom-core": "0.4.1-alpha.1",
|
|
35
|
+
"@cynodia/axiom-runtime": "0.4.1-alpha.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -b tsconfig.json tsconfig.test.json",
|