@coasys/ad4m 0.12.0-rc1-dev.2 → 0.12.0-rc1-dev.4

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.
Files changed (153) hide show
  1. package/jest.config.js +10 -3
  2. package/lib/index.cjs +6893 -5884
  3. package/lib/index.js +6889 -5872
  4. package/lib/src/Ad4mClient.d.ts +9 -16
  5. package/lib/src/Ad4mClient.js +46 -25
  6. package/lib/src/Literal.d.ts +1 -2
  7. package/lib/src/Literal.js +38 -35
  8. package/lib/src/SmartLiteral.d.ts +1 -2
  9. package/lib/src/SmartLiteral.js +30 -15
  10. package/lib/src/agent/AgentClient.d.ts +1 -4
  11. package/lib/src/agent/AgentClient.js +79 -99
  12. package/lib/src/ai/AIClient.d.ts +1 -2
  13. package/lib/src/ai/AIClient.js +224 -220
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +73 -86
  16. package/lib/src/index.d.ts +1 -1
  17. package/lib/src/index.js +1 -1
  18. package/lib/src/language/LanguageClient.d.ts +1 -1
  19. package/lib/src/language/LanguageClient.js +52 -52
  20. package/lib/src/model/Ad4mModel.d.ts +1351 -144
  21. package/lib/src/model/Ad4mModel.js +3760 -228
  22. package/lib/src/model/Ad4mModel.test.js +522 -979
  23. package/lib/src/model/Subject.d.ts +3 -3
  24. package/lib/src/model/Subject.js +25 -25
  25. package/lib/src/model/decorators.d.ts +444 -100
  26. package/lib/src/model/decorators.js +686 -321
  27. package/lib/src/model/util.d.ts +6 -6
  28. package/lib/src/model/util.js +24 -24
  29. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
  30. package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
  31. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
  32. package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
  33. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
  34. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  35. package/lib/src/perspectives/PerspectiveClient.js +240 -316
  36. package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
  37. package/lib/src/perspectives/PerspectiveProxy.js +485 -832
  38. package/lib/src/runtime/RuntimeClient.d.ts +1 -5
  39. package/lib/src/runtime/RuntimeClient.js +238 -412
  40. package/lib/src/shacl/SHACLFlow.test.js +105 -164
  41. package/lib/src/shacl/SHACLShape.d.ts +12 -17
  42. package/lib/src/shacl/SHACLShape.js +115 -128
  43. package/lib/src/shacl/SHACLShape.test.js +176 -244
  44. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  45. package/lib/src/shims/type-graphql.d.ts +32 -0
  46. package/lib/src/src/Ad4mClient.d.ts +28 -0
  47. package/lib/src/src/Address.d.ts +1 -0
  48. package/lib/src/src/DID.d.ts +1 -0
  49. package/lib/src/src/Exception.d.ts +7 -0
  50. package/lib/src/src/Literal.d.ts +7 -0
  51. package/lib/src/src/PubSub.d.ts +17 -0
  52. package/lib/src/src/SmartLiteral.d.ts +12 -0
  53. package/lib/src/src/agent/Agent.d.ts +110 -0
  54. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  55. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  56. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  57. package/lib/src/src/ai/AIClient.d.ts +32 -0
  58. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  59. package/lib/src/src/ai/Tasks.d.ts +37 -0
  60. package/lib/src/src/buildSchema.d.ts +1 -0
  61. package/lib/src/src/expression/Expression.d.ts +28 -0
  62. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  63. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  64. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  65. package/lib/src/src/index.d.ts +35 -0
  66. package/lib/src/src/jestSetup.d.ts +1 -0
  67. package/lib/src/src/language/Icon.d.ts +4 -0
  68. package/lib/src/src/language/Language.d.ts +206 -0
  69. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  70. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  71. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  72. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  73. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  74. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  75. package/lib/src/src/links/Links.d.ts +39 -0
  76. package/lib/src/src/links/Links.test.d.ts +1 -0
  77. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  78. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  79. package/lib/src/src/model/Subject.d.ts +25 -0
  80. package/lib/src/src/model/decorators.d.ts +545 -0
  81. package/lib/src/src/model/util.d.ts +12 -0
  82. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  83. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  84. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  85. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  86. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  87. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  88. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  89. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  90. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  91. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  92. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  93. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  94. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  95. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  96. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  97. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  98. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  99. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  100. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  101. package/lib/src/src/typeDefs.d.ts +1 -0
  102. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  103. package/lib/src/src/utils.d.ts +25 -0
  104. package/lib/src/utils.d.ts +0 -8
  105. package/lib/src/utils.js +7 -21
  106. package/package.json +15 -14
  107. package/src/Ad4mClient.test.ts +1315 -1564
  108. package/src/Ad4mClient.ts +54 -55
  109. package/src/Literal.test.ts +26 -45
  110. package/src/Literal.ts +66 -82
  111. package/src/SmartLiteral.ts +58 -74
  112. package/src/agent/AgentClient.ts +99 -144
  113. package/src/ai/AIClient.ts +359 -409
  114. package/src/expression/ExpressionClient.ts +96 -142
  115. package/src/index.ts +1 -1
  116. package/src/language/LanguageClient.ts +113 -137
  117. package/src/model/Ad4mModel.test.ts +616 -1114
  118. package/src/model/Ad4mModel.ts +4386 -451
  119. package/src/model/Subject.ts +159 -0
  120. package/src/model/decorators.ts +1168 -667
  121. package/src/model/util.ts +54 -53
  122. package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
  123. package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
  124. package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
  125. package/src/perspectives/PerspectiveClient.ts +540 -779
  126. package/src/perspectives/PerspectiveProxy.ts +2067 -2860
  127. package/src/runtime/RuntimeClient.ts +476 -775
  128. package/src/shacl/SHACLFlow.test.ts +129 -196
  129. package/src/shacl/SHACLShape.test.ts +190 -284
  130. package/src/shacl/SHACLShape.ts +200 -224
  131. package/src/utils.ts +17 -31
  132. package/tsconfig.json +10 -9
  133. package/src/model/IMPROVEMENTS.md +0 -482
  134. package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
  135. package/src/model/README.md +0 -317
  136. package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
  137. package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
  138. package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
  139. package/src/model/mutation.ts +0 -461
  140. package/src/model/parentUtils.ts +0 -91
  141. package/src/model/prolog/generatePrologFacts.ts +0 -176
  142. package/src/model/prolog/index.ts +0 -1
  143. package/src/model/query/ModelQueryBuilder.ts +0 -173
  144. package/src/model/query/fetchInstance.ts +0 -181
  145. package/src/model/query/hydration.ts +0 -273
  146. package/src/model/query/operations.ts +0 -510
  147. package/src/model/query/snapshot.ts +0 -126
  148. package/src/model/query/surrealCompiler.ts +0 -376
  149. package/src/model/schema/fromJSONSchema.ts +0 -411
  150. package/src/model/schema/metadata.ts +0 -148
  151. package/src/model/subscription.ts +0 -307
  152. package/src/model/transaction.ts +0 -60
  153. package/src/model/types.ts +0 -207
@@ -1,300 +1,233 @@
1
- import { SHACLFlow } from "./SHACLFlow";
2
-
3
- describe("SHACLFlow", () => {
4
- describe("basic construction", () => {
5
- it("creates a flow with name and namespace", () => {
6
- const flow = new SHACLFlow("TODO", "todo://");
7
- expect(flow.name).toBe("TODO");
8
- expect(flow.namespace).toBe("todo://");
9
- expect(flow.flowUri).toBe("todo://TODOFlow");
1
+ import { SHACLFlow, FlowState, FlowTransition, AD4MAction } from './SHACLFlow';
2
+
3
+ describe('SHACLFlow', () => {
4
+ describe('basic construction', () => {
5
+ it('creates a flow with name and namespace', () => {
6
+ const flow = new SHACLFlow('TODO', 'todo://');
7
+ expect(flow.name).toBe('TODO');
8
+ expect(flow.namespace).toBe('todo://');
9
+ expect(flow.flowUri).toBe('todo://TODOFlow');
10
10
  });
11
11
 
12
- it("generates correct state URIs", () => {
13
- const flow = new SHACLFlow("TODO", "todo://");
14
- expect(flow.stateUri("ready")).toBe("todo://TODO.ready");
15
- expect(flow.stateUri("done")).toBe("todo://TODO.done");
12
+ it('generates correct state URIs', () => {
13
+ const flow = new SHACLFlow('TODO', 'todo://');
14
+ expect(flow.stateUri('ready')).toBe('todo://TODO.ready');
15
+ expect(flow.stateUri('done')).toBe('todo://TODO.done');
16
16
  });
17
17
 
18
- it("generates correct transition URIs", () => {
19
- const flow = new SHACLFlow("TODO", "todo://");
20
- expect(flow.transitionUri("ready", "doing")).toBe(
21
- "todo://TODO.readyTodoing",
22
- );
18
+ it('generates correct transition URIs', () => {
19
+ const flow = new SHACLFlow('TODO', 'todo://');
20
+ expect(flow.transitionUri('ready', 'doing')).toBe('todo://TODO.readyTodoing');
23
21
  });
24
22
  });
25
23
 
26
- describe("state management", () => {
27
- it("adds and retrieves states", () => {
28
- const flow = new SHACLFlow("TODO", "todo://");
29
-
24
+ describe('state management', () => {
25
+ it('adds and retrieves states', () => {
26
+ const flow = new SHACLFlow('TODO', 'todo://');
27
+
30
28
  flow.addState({
31
- name: "ready",
29
+ name: 'ready',
32
30
  value: 0,
33
- stateCheck: { predicate: "todo://state", target: "todo://ready" },
31
+ stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
34
32
  });
35
-
33
+
36
34
  flow.addState({
37
- name: "done",
35
+ name: 'done',
38
36
  value: 1,
39
- stateCheck: { predicate: "todo://state", target: "todo://done" },
37
+ stateCheck: { predicate: 'todo://state', target: 'todo://done' }
40
38
  });
41
-
39
+
42
40
  expect(flow.states.length).toBe(2);
43
- expect(flow.states[0].name).toBe("ready");
44
- expect(flow.states[1].name).toBe("done");
41
+ expect(flow.states[0].name).toBe('ready');
42
+ expect(flow.states[1].name).toBe('done');
45
43
  });
46
44
  });
47
45
 
48
- describe("transition management", () => {
49
- it("adds and retrieves transitions", () => {
50
- const flow = new SHACLFlow("TODO", "todo://");
51
-
46
+ describe('transition management', () => {
47
+ it('adds and retrieves transitions', () => {
48
+ const flow = new SHACLFlow('TODO', 'todo://');
49
+
52
50
  flow.addTransition({
53
- actionName: "Complete",
54
- fromState: "ready",
55
- toState: "done",
51
+ actionName: 'Complete',
52
+ fromState: 'ready',
53
+ toState: 'done',
56
54
  actions: [
57
- {
58
- action: "addLink",
59
- source: "this",
60
- predicate: "todo://state",
61
- target: "todo://done",
62
- },
63
- {
64
- action: "removeLink",
65
- source: "this",
66
- predicate: "todo://state",
67
- target: "todo://ready",
68
- },
69
- ],
55
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://done' },
56
+ { action: 'removeLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
57
+ ]
70
58
  });
71
-
59
+
72
60
  expect(flow.transitions.length).toBe(1);
73
- expect(flow.transitions[0].actionName).toBe("Complete");
61
+ expect(flow.transitions[0].actionName).toBe('Complete');
74
62
  expect(flow.transitions[0].actions.length).toBe(2);
75
63
  });
76
64
  });
77
65
 
78
- describe("toLinks()", () => {
79
- it("serializes flow to links", () => {
80
- const flow = new SHACLFlow("TODO", "todo://");
81
- flow.flowable = "any";
66
+ describe('toLinks()', () => {
67
+ it('serializes flow to links', () => {
68
+ const flow = new SHACLFlow('TODO', 'todo://');
69
+ flow.flowable = 'any';
82
70
  flow.startAction = [
83
- {
84
- action: "addLink",
85
- source: "this",
86
- predicate: "todo://state",
87
- target: "todo://ready",
88
- },
71
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
89
72
  ];
90
-
73
+
91
74
  flow.addState({
92
- name: "ready",
75
+ name: 'ready',
93
76
  value: 0,
94
- stateCheck: { predicate: "todo://state", target: "todo://ready" },
77
+ stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
95
78
  });
96
-
79
+
97
80
  flow.addTransition({
98
- actionName: "Start",
99
- fromState: "ready",
100
- toState: "doing",
101
- actions: [
102
- {
103
- action: "addLink",
104
- source: "this",
105
- predicate: "todo://state",
106
- target: "todo://doing",
107
- },
108
- ],
81
+ actionName: 'Start',
82
+ fromState: 'ready',
83
+ toState: 'doing',
84
+ actions: [{ action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://doing' }]
109
85
  });
110
-
86
+
111
87
  const links = flow.toLinks();
112
-
88
+
113
89
  // Check flow type link
114
- const typeLink = links.find(
115
- (l) => l.predicate === "rdf://type" && l.target === "ad4m://Flow",
116
- );
90
+ const typeLink = links.find(l => l.predicate === 'rdf://type' && l.target === 'ad4m://Flow');
117
91
  expect(typeLink).toBeDefined();
118
- expect(typeLink!.source).toBe("todo://TODOFlow");
119
-
92
+ expect(typeLink!.source).toBe('todo://TODOFlow');
93
+
120
94
  // Check flowable link
121
- const flowableLink = links.find((l) => l.predicate === "ad4m://flowable");
95
+ const flowableLink = links.find(l => l.predicate === 'ad4m://flowable');
122
96
  expect(flowableLink).toBeDefined();
123
- expect(flowableLink!.target).toBe("ad4m://any");
124
-
97
+ expect(flowableLink!.target).toBe('ad4m://any');
98
+
125
99
  // Check start action link
126
- const startActionLink = links.find(
127
- (l) => l.predicate === "ad4m://startAction",
128
- );
100
+ const startActionLink = links.find(l => l.predicate === 'ad4m://startAction');
129
101
  expect(startActionLink).toBeDefined();
130
- expect(startActionLink!.target).toContain("addLink");
131
-
102
+ expect(startActionLink!.target).toContain('addLink');
103
+
132
104
  // Check state link
133
- const stateLink = links.find((l) => l.predicate === "ad4m://hasState");
105
+ const stateLink = links.find(l => l.predicate === 'ad4m://hasState');
134
106
  expect(stateLink).toBeDefined();
135
- expect(stateLink!.target).toBe("todo://TODO.ready");
136
-
107
+ expect(stateLink!.target).toBe('todo://TODO.ready');
108
+
137
109
  // Check transition link
138
- const transitionLink = links.find(
139
- (l) => l.predicate === "ad4m://hasTransition",
140
- );
110
+ const transitionLink = links.find(l => l.predicate === 'ad4m://hasTransition');
141
111
  expect(transitionLink).toBeDefined();
142
112
  });
143
113
  });
144
114
 
145
- describe("fromLinks()", () => {
146
- it("reconstructs flow from links", () => {
147
- const original = new SHACLFlow("TODO", "todo://");
148
- original.flowable = "any";
115
+ describe('fromLinks()', () => {
116
+ it('reconstructs flow from links', () => {
117
+ const original = new SHACLFlow('TODO', 'todo://');
118
+ original.flowable = 'any';
149
119
  original.startAction = [
150
- {
151
- action: "addLink",
152
- source: "this",
153
- predicate: "todo://state",
154
- target: "todo://ready",
155
- },
120
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
156
121
  ];
157
122
  original.addState({
158
- name: "ready",
123
+ name: 'ready',
159
124
  value: 0,
160
- stateCheck: { predicate: "todo://state", target: "todo://ready" },
125
+ stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
161
126
  });
162
127
  original.addState({
163
- name: "done",
128
+ name: 'done',
164
129
  value: 1,
165
- stateCheck: { predicate: "todo://state", target: "todo://done" },
130
+ stateCheck: { predicate: 'todo://state', target: 'todo://done' }
166
131
  });
167
132
  original.addTransition({
168
- actionName: "Complete",
169
- fromState: "ready",
170
- toState: "done",
171
- actions: [
172
- {
173
- action: "addLink",
174
- source: "this",
175
- predicate: "todo://state",
176
- target: "todo://done",
177
- },
178
- ],
133
+ actionName: 'Complete',
134
+ fromState: 'ready',
135
+ toState: 'done',
136
+ actions: [{ action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://done' }]
179
137
  });
180
-
138
+
181
139
  const links = original.toLinks();
182
- const reconstructed = SHACLFlow.fromLinks(links, "todo://TODOFlow");
183
-
184
- expect(reconstructed.name).toBe("TODO");
185
- expect(reconstructed.namespace).toBe("todo://");
186
- expect(reconstructed.flowable).toBe("any");
140
+ const reconstructed = SHACLFlow.fromLinks(links, 'todo://TODOFlow');
141
+
142
+ expect(reconstructed.name).toBe('TODO');
143
+ expect(reconstructed.namespace).toBe('todo://');
144
+ expect(reconstructed.flowable).toBe('any');
187
145
  expect(reconstructed.startAction.length).toBe(1);
188
146
  expect(reconstructed.states.length).toBe(2);
189
147
  expect(reconstructed.transitions.length).toBe(1);
190
- expect(reconstructed.transitions[0].actionName).toBe("Complete");
148
+ expect(reconstructed.transitions[0].actionName).toBe('Complete');
191
149
  });
192
150
  });
193
151
 
194
- describe("JSON serialization", () => {
195
- it("converts to and from JSON", () => {
196
- const original = new SHACLFlow("TODO", "todo://");
152
+ describe('JSON serialization', () => {
153
+ it('converts to and from JSON', () => {
154
+ const original = new SHACLFlow('TODO', 'todo://');
197
155
  original.addState({
198
- name: "ready",
156
+ name: 'ready',
199
157
  value: 0,
200
- stateCheck: { predicate: "todo://state", target: "todo://ready" },
158
+ stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
201
159
  });
202
160
  original.addTransition({
203
- actionName: "Start",
204
- fromState: "ready",
205
- toState: "doing",
206
- actions: [],
161
+ actionName: 'Start',
162
+ fromState: 'ready',
163
+ toState: 'doing',
164
+ actions: []
207
165
  });
208
-
166
+
209
167
  const json = original.toJSON();
210
168
  const reconstructed = SHACLFlow.fromJSON(json);
211
-
212
- expect(reconstructed.name).toBe("TODO");
169
+
170
+ expect(reconstructed.name).toBe('TODO');
213
171
  expect(reconstructed.states.length).toBe(1);
214
172
  expect(reconstructed.transitions.length).toBe(1);
215
173
  });
216
174
  });
217
175
 
218
- describe("full TODO example", () => {
219
- it("creates complete TODO flow matching Prolog example", () => {
220
- const flow = new SHACLFlow("TODO", "todo://");
221
- flow.flowable = "any";
222
-
176
+ describe('full TODO example', () => {
177
+ it('creates complete TODO flow matching Prolog example', () => {
178
+ const flow = new SHACLFlow('TODO', 'todo://');
179
+ flow.flowable = 'any';
180
+
223
181
  // Start action - renders expression as TODO in 'ready' state
224
182
  flow.startAction = [
225
- {
226
- action: "addLink",
227
- source: "this",
228
- predicate: "todo://state",
229
- target: "todo://ready",
230
- },
183
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
231
184
  ];
232
-
185
+
233
186
  // Three states
234
187
  flow.addState({
235
- name: "ready",
188
+ name: 'ready',
236
189
  value: 0,
237
- stateCheck: { predicate: "todo://state", target: "todo://ready" },
190
+ stateCheck: { predicate: 'todo://state', target: 'todo://ready' }
238
191
  });
239
192
  flow.addState({
240
- name: "doing",
193
+ name: 'doing',
241
194
  value: 0.5,
242
- stateCheck: { predicate: "todo://state", target: "todo://doing" },
195
+ stateCheck: { predicate: 'todo://state', target: 'todo://doing' }
243
196
  });
244
197
  flow.addState({
245
- name: "done",
198
+ name: 'done',
246
199
  value: 1,
247
- stateCheck: { predicate: "todo://state", target: "todo://done" },
200
+ stateCheck: { predicate: 'todo://state', target: 'todo://done' }
248
201
  });
249
-
202
+
250
203
  // Transitions
251
204
  flow.addTransition({
252
- actionName: "Start",
253
- fromState: "ready",
254
- toState: "doing",
205
+ actionName: 'Start',
206
+ fromState: 'ready',
207
+ toState: 'doing',
255
208
  actions: [
256
- {
257
- action: "addLink",
258
- source: "this",
259
- predicate: "todo://state",
260
- target: "todo://doing",
261
- },
262
- {
263
- action: "removeLink",
264
- source: "this",
265
- predicate: "todo://state",
266
- target: "todo://ready",
267
- },
268
- ],
209
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://doing' },
210
+ { action: 'removeLink', source: 'this', predicate: 'todo://state', target: 'todo://ready' }
211
+ ]
269
212
  });
270
213
  flow.addTransition({
271
- actionName: "Finish",
272
- fromState: "doing",
273
- toState: "done",
214
+ actionName: 'Finish',
215
+ fromState: 'doing',
216
+ toState: 'done',
274
217
  actions: [
275
- {
276
- action: "addLink",
277
- source: "this",
278
- predicate: "todo://state",
279
- target: "todo://done",
280
- },
281
- {
282
- action: "removeLink",
283
- source: "this",
284
- predicate: "todo://state",
285
- target: "todo://doing",
286
- },
287
- ],
218
+ { action: 'addLink', source: 'this', predicate: 'todo://state', target: 'todo://done' },
219
+ { action: 'removeLink', source: 'this', predicate: 'todo://state', target: 'todo://doing' }
220
+ ]
288
221
  });
289
-
222
+
290
223
  // Verify structure
291
224
  expect(flow.states.length).toBe(3);
292
225
  expect(flow.transitions.length).toBe(2);
293
-
226
+
294
227
  // Verify links generation
295
228
  const links = flow.toLinks();
296
229
  expect(links.length).toBeGreaterThan(15); // Flow + 3 states + 2 transitions = many links
297
-
230
+
298
231
  // Verify round-trip
299
232
  const reconstructed = SHACLFlow.fromLinks(links, flow.flowUri);
300
233
  expect(reconstructed.states.length).toBe(3);