@cynodia/axiom-server 0.7.0-alpha.2 → 0.8.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/README.md +17 -4
- package/conformance/effect-success-event.json +425 -0
- package/conformance/integration-query-success.json +426 -0
- package/conformance/integration-query-timeout.json +428 -0
- package/conformance/manifest.json +97 -2
- package/conformance/system-only-action-rejects-client.json +420 -0
- package/conformance/timed-trigger-polling.json +421 -0
- package/dist/deps.d.ts +2 -2
- package/dist/effects.d.ts +31 -0
- package/dist/effects.js +83 -0
- package/dist/host.d.ts +40 -3
- package/dist/host.js +52 -22
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/integration.d.ts +59 -0
- package/dist/integration.js +83 -0
- package/dist/node-host.d.ts +55 -1
- package/dist/node-host.js +89 -4
- package/dist/persistence.d.ts +37 -1
- package/dist/persistence.js +18 -1
- package/dist/protocol.d.ts +23 -2
- package/dist/protocol.js +1 -1
- package/dist/server.d.ts +34 -1
- package/dist/server.js +310 -28
- package/dist/sqlite-persistence.js +28 -2
- package/dist/triggers.d.ts +60 -0
- package/dist/triggers.js +112 -0
- package/package.json +3 -3
- package/schema/protocol.v1.schema.json +103 -1
- package/schema/server-ir.v1.schema.json +1 -1
- package/schema/server-ir.v2.schema.json +16 -1
- package/schema/server-ir.v3.schema.json +1819 -0
- package/schema/server-ir.v4.schema.json +1819 -0
package/README.md
CHANGED
|
@@ -14,13 +14,24 @@ A client requests semantic actions; it never sends operations. Authorization, gu
|
|
|
14
14
|
argument validation are evaluated here and nowhere else.
|
|
15
15
|
|
|
16
16
|
Adapters keep the semantics free of infrastructure: `PersistenceAdapter` (in-memory and
|
|
17
|
-
SQLite), `TransportAdapter` (in-process and HTTP),
|
|
18
|
-
and authentication
|
|
17
|
+
SQLite), `TransportAdapter` (in-process and HTTP), `ServerHost` for time, identifiers,
|
|
18
|
+
scheduling and authentication, and `IntegrationAdapter` for external systems. Nothing in
|
|
19
|
+
an ApplicationGraph mentions HTTP, SQL, a route or an SDK.
|
|
20
|
+
|
|
21
|
+
As of 0.8 this package also owns timed and event-driven execution: it schedules and
|
|
22
|
+
dispatches `TriggerDef`s, records `integration-effect` intent atomically with the state
|
|
23
|
+
write that requested it (the transactional outbox), dispatches an effect's committed
|
|
24
|
+
intents to its `IntegrationAdapter` post-commit with retry, and translates verified
|
|
25
|
+
webhook deliveries into semantic events. See
|
|
26
|
+
[`docs/INTEGRATIONS.md`](https://github.com/cynodia/axiom/blob/main/docs/INTEGRATIONS.md),
|
|
27
|
+
[`docs/EFFECTS.md`](https://github.com/cynodia/axiom/blob/main/docs/EFFECTS.md) and
|
|
28
|
+
[`docs/TRIGGERS.md`](https://github.com/cynodia/axiom/blob/main/docs/TRIGGERS.md).
|
|
19
29
|
|
|
20
30
|
Main exports: `createAxiomServer`, `createMemoryPersistence`, `createSqlitePersistence`,
|
|
21
31
|
`createServerHost`, `createDeterministicServerHost`, `createDirectTransport`,
|
|
22
32
|
`createHttpTransport`, `createRemoteGateway`, `serveOverHttp`, `serveAxiomApplication`,
|
|
23
|
-
`
|
|
33
|
+
`createFakeIntegrationAdapter`, `createHttpIntegrationAdapter`, `createTriggerRuntime`,
|
|
34
|
+
`createEffectRunner`, `SERVER_DIAGNOSTIC_CODES`.
|
|
24
35
|
|
|
25
36
|
`serveAxiomApplication` is the whole deployment story: it serves the generated page at `GET /`
|
|
26
37
|
and the semantic endpoint at `POST /axiom`, from one process, for any Axiom application. No
|
|
@@ -34,7 +45,9 @@ implementation in another language needs to conform to it:
|
|
|
34
45
|
```
|
|
35
46
|
@cynodia/axiom-server/conformance the fixture manifest
|
|
36
47
|
@cynodia/axiom-server/conformance/<name>.json one fixture: IR, state, invocations, expectations
|
|
37
|
-
@cynodia/axiom-server/schema/server-ir.v1.schema.json JSON Schema for the IR
|
|
48
|
+
@cynodia/axiom-server/schema/server-ir.v1.schema.json JSON Schema for the frozen v1 IR
|
|
49
|
+
@cynodia/axiom-server/schema/server-ir.v2.schema.json JSON Schema for v2 (+ group, expression-ref)
|
|
50
|
+
@cynodia/axiom-server/schema/server-ir.v3.schema.json JSON Schema for v3 (+ integrations, effects, triggers, events)
|
|
38
51
|
@cynodia/axiom-server/schema/protocol.v1.schema.json JSON Schema for the protocol
|
|
39
52
|
```
|
|
40
53
|
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
{
|
|
2
|
+
"conformance": "axiom.conformance.v2",
|
|
3
|
+
"name": "effect-success-event",
|
|
4
|
+
"covers": [
|
|
5
|
+
"effects",
|
|
6
|
+
"events",
|
|
7
|
+
"invocation source"
|
|
8
|
+
],
|
|
9
|
+
"description": "A succeeded effect dispatches its structured outcome to a system-only follow-up action — never reachable by a client directly.",
|
|
10
|
+
"principals": {},
|
|
11
|
+
"serverIR": {
|
|
12
|
+
"contract": "axiom.server.v4",
|
|
13
|
+
"id": "conformance-integrations",
|
|
14
|
+
"name": "Conformance integrations",
|
|
15
|
+
"version": "0.8.0",
|
|
16
|
+
"entities": [
|
|
17
|
+
{
|
|
18
|
+
"id": "entity_effect_outcome",
|
|
19
|
+
"kind": "entity",
|
|
20
|
+
"fields": [
|
|
21
|
+
{
|
|
22
|
+
"id": "field_effect_id",
|
|
23
|
+
"valueType": {
|
|
24
|
+
"kind": "primitive",
|
|
25
|
+
"primitive": "string"
|
|
26
|
+
},
|
|
27
|
+
"required": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "field_effect_integration_id",
|
|
31
|
+
"valueType": {
|
|
32
|
+
"kind": "primitive",
|
|
33
|
+
"primitive": "string"
|
|
34
|
+
},
|
|
35
|
+
"required": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "field_effect_operation_id",
|
|
39
|
+
"valueType": {
|
|
40
|
+
"kind": "primitive",
|
|
41
|
+
"primitive": "string"
|
|
42
|
+
},
|
|
43
|
+
"required": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "field_effect_result",
|
|
47
|
+
"valueType": {
|
|
48
|
+
"kind": "primitive",
|
|
49
|
+
"primitive": "string"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "field_effect_code",
|
|
54
|
+
"valueType": {
|
|
55
|
+
"kind": "primitive",
|
|
56
|
+
"primitive": "string"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "field_effect_message",
|
|
61
|
+
"valueType": {
|
|
62
|
+
"kind": "primitive",
|
|
63
|
+
"primitive": "string"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "field_effect_retryable",
|
|
68
|
+
"valueType": {
|
|
69
|
+
"kind": "primitive",
|
|
70
|
+
"primitive": "boolean"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "field_effect_idempotency_key",
|
|
75
|
+
"valueType": {
|
|
76
|
+
"kind": "primitive",
|
|
77
|
+
"primitive": "string"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "field_effect_correlation_id",
|
|
82
|
+
"valueType": {
|
|
83
|
+
"kind": "primitive",
|
|
84
|
+
"primitive": "string"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"fields": {
|
|
91
|
+
"field_effect_id": {
|
|
92
|
+
"entityId": "entity_effect_outcome",
|
|
93
|
+
"field": {
|
|
94
|
+
"id": "field_effect_id",
|
|
95
|
+
"valueType": {
|
|
96
|
+
"kind": "primitive",
|
|
97
|
+
"primitive": "string"
|
|
98
|
+
},
|
|
99
|
+
"required": true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"field_effect_integration_id": {
|
|
103
|
+
"entityId": "entity_effect_outcome",
|
|
104
|
+
"field": {
|
|
105
|
+
"id": "field_effect_integration_id",
|
|
106
|
+
"valueType": {
|
|
107
|
+
"kind": "primitive",
|
|
108
|
+
"primitive": "string"
|
|
109
|
+
},
|
|
110
|
+
"required": true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"field_effect_operation_id": {
|
|
114
|
+
"entityId": "entity_effect_outcome",
|
|
115
|
+
"field": {
|
|
116
|
+
"id": "field_effect_operation_id",
|
|
117
|
+
"valueType": {
|
|
118
|
+
"kind": "primitive",
|
|
119
|
+
"primitive": "string"
|
|
120
|
+
},
|
|
121
|
+
"required": true
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"field_effect_result": {
|
|
125
|
+
"entityId": "entity_effect_outcome",
|
|
126
|
+
"field": {
|
|
127
|
+
"id": "field_effect_result",
|
|
128
|
+
"valueType": {
|
|
129
|
+
"kind": "primitive",
|
|
130
|
+
"primitive": "string"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"field_effect_code": {
|
|
135
|
+
"entityId": "entity_effect_outcome",
|
|
136
|
+
"field": {
|
|
137
|
+
"id": "field_effect_code",
|
|
138
|
+
"valueType": {
|
|
139
|
+
"kind": "primitive",
|
|
140
|
+
"primitive": "string"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"field_effect_message": {
|
|
145
|
+
"entityId": "entity_effect_outcome",
|
|
146
|
+
"field": {
|
|
147
|
+
"id": "field_effect_message",
|
|
148
|
+
"valueType": {
|
|
149
|
+
"kind": "primitive",
|
|
150
|
+
"primitive": "string"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"field_effect_retryable": {
|
|
155
|
+
"entityId": "entity_effect_outcome",
|
|
156
|
+
"field": {
|
|
157
|
+
"id": "field_effect_retryable",
|
|
158
|
+
"valueType": {
|
|
159
|
+
"kind": "primitive",
|
|
160
|
+
"primitive": "boolean"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"field_effect_idempotency_key": {
|
|
165
|
+
"entityId": "entity_effect_outcome",
|
|
166
|
+
"field": {
|
|
167
|
+
"id": "field_effect_idempotency_key",
|
|
168
|
+
"valueType": {
|
|
169
|
+
"kind": "primitive",
|
|
170
|
+
"primitive": "string"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"field_effect_correlation_id": {
|
|
175
|
+
"entityId": "entity_effect_outcome",
|
|
176
|
+
"field": {
|
|
177
|
+
"id": "field_effect_correlation_id",
|
|
178
|
+
"valueType": {
|
|
179
|
+
"kind": "primitive",
|
|
180
|
+
"primitive": "string"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"states": [
|
|
186
|
+
{
|
|
187
|
+
"id": "state_status",
|
|
188
|
+
"kind": "state",
|
|
189
|
+
"name": "status",
|
|
190
|
+
"authority": "server",
|
|
191
|
+
"valueType": {
|
|
192
|
+
"kind": "primitive",
|
|
193
|
+
"primitive": "string"
|
|
194
|
+
},
|
|
195
|
+
"initialValue": "unknown"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"id": "state_message",
|
|
199
|
+
"kind": "state",
|
|
200
|
+
"name": "message",
|
|
201
|
+
"authority": "server",
|
|
202
|
+
"valueType": {
|
|
203
|
+
"kind": "primitive",
|
|
204
|
+
"primitive": "string"
|
|
205
|
+
},
|
|
206
|
+
"initialValue": ""
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"actions": {
|
|
210
|
+
"action_refresh": {
|
|
211
|
+
"id": "action_refresh",
|
|
212
|
+
"kind": "action",
|
|
213
|
+
"name": "refresh",
|
|
214
|
+
"operations": [
|
|
215
|
+
{
|
|
216
|
+
"kind": "integration-query",
|
|
217
|
+
"operationId": "integration_operation_fetch",
|
|
218
|
+
"bindAs": "scope_query",
|
|
219
|
+
"timeoutMs": 500
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "set",
|
|
223
|
+
"target": {
|
|
224
|
+
"kind": "state",
|
|
225
|
+
"stateId": "state_status"
|
|
226
|
+
},
|
|
227
|
+
"value": {
|
|
228
|
+
"kind": "ref",
|
|
229
|
+
"targetId": "scope_query"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"preconditions": [],
|
|
234
|
+
"failureModes": []
|
|
235
|
+
},
|
|
236
|
+
"action_reboot": {
|
|
237
|
+
"id": "action_reboot",
|
|
238
|
+
"kind": "action",
|
|
239
|
+
"name": "reboot",
|
|
240
|
+
"operations": [
|
|
241
|
+
{
|
|
242
|
+
"kind": "integration-effect",
|
|
243
|
+
"operationId": "integration_operation_reboot",
|
|
244
|
+
"succeededEventId": "event_succeeded",
|
|
245
|
+
"failedEventId": "event_failed"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"preconditions": [],
|
|
249
|
+
"failureModes": []
|
|
250
|
+
},
|
|
251
|
+
"action_apply_message": {
|
|
252
|
+
"id": "action_apply_message",
|
|
253
|
+
"kind": "action",
|
|
254
|
+
"name": "apply message",
|
|
255
|
+
"invocation": {
|
|
256
|
+
"allowedSources": [
|
|
257
|
+
"system"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
"parameters": [
|
|
261
|
+
{
|
|
262
|
+
"id": "param_message",
|
|
263
|
+
"valueType": {
|
|
264
|
+
"kind": "primitive",
|
|
265
|
+
"primitive": "string"
|
|
266
|
+
},
|
|
267
|
+
"required": true
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"operations": [
|
|
271
|
+
{
|
|
272
|
+
"kind": "set",
|
|
273
|
+
"target": {
|
|
274
|
+
"kind": "state",
|
|
275
|
+
"stateId": "state_message"
|
|
276
|
+
},
|
|
277
|
+
"value": {
|
|
278
|
+
"kind": "ref",
|
|
279
|
+
"targetId": "param_message"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"preconditions": [],
|
|
284
|
+
"failureModes": []
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"constraints": [],
|
|
288
|
+
"transitionConstraints": [],
|
|
289
|
+
"observableStateIds": [
|
|
290
|
+
"state_status",
|
|
291
|
+
"state_message"
|
|
292
|
+
],
|
|
293
|
+
"integrations": [
|
|
294
|
+
{
|
|
295
|
+
"id": "integration_provider",
|
|
296
|
+
"kind": "integration",
|
|
297
|
+
"name": "Provider"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"integrationOperations": {
|
|
301
|
+
"integration_operation_fetch": {
|
|
302
|
+
"id": "integration_operation_fetch",
|
|
303
|
+
"kind": "integration-operation",
|
|
304
|
+
"integrationId": "integration_provider",
|
|
305
|
+
"name": "fetchStatus",
|
|
306
|
+
"mode": "query",
|
|
307
|
+
"resultType": {
|
|
308
|
+
"kind": "primitive",
|
|
309
|
+
"primitive": "string"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"integration_operation_reboot": {
|
|
313
|
+
"id": "integration_operation_reboot",
|
|
314
|
+
"kind": "integration-operation",
|
|
315
|
+
"integrationId": "integration_provider",
|
|
316
|
+
"name": "reboot",
|
|
317
|
+
"mode": "effect",
|
|
318
|
+
"idempotent": true,
|
|
319
|
+
"resultType": {
|
|
320
|
+
"kind": "primitive",
|
|
321
|
+
"primitive": "string"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"events": [
|
|
326
|
+
{
|
|
327
|
+
"id": "event_succeeded",
|
|
328
|
+
"kind": "event",
|
|
329
|
+
"payloadType": {
|
|
330
|
+
"kind": "entity",
|
|
331
|
+
"entityId": "entity_effect_outcome"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"id": "event_failed",
|
|
336
|
+
"kind": "event",
|
|
337
|
+
"payloadType": {
|
|
338
|
+
"kind": "entity",
|
|
339
|
+
"entityId": "entity_effect_outcome"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"triggers": [
|
|
344
|
+
{
|
|
345
|
+
"id": "trigger_poll",
|
|
346
|
+
"kind": "trigger",
|
|
347
|
+
"actionId": "action_refresh",
|
|
348
|
+
"when": {
|
|
349
|
+
"kind": "interval",
|
|
350
|
+
"everyMs": 1000,
|
|
351
|
+
"overlap": "skip"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"id": "trigger_succeeded",
|
|
356
|
+
"kind": "trigger",
|
|
357
|
+
"actionId": "action_apply_message",
|
|
358
|
+
"when": {
|
|
359
|
+
"kind": "event",
|
|
360
|
+
"eventId": "event_succeeded"
|
|
361
|
+
},
|
|
362
|
+
"arguments": {
|
|
363
|
+
"param_message": {
|
|
364
|
+
"kind": "field",
|
|
365
|
+
"source": {
|
|
366
|
+
"kind": "ref",
|
|
367
|
+
"targetId": "trigger_succeeded"
|
|
368
|
+
},
|
|
369
|
+
"fieldId": "field_effect_result"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"id": "trigger_failed",
|
|
375
|
+
"kind": "trigger",
|
|
376
|
+
"actionId": "action_apply_message",
|
|
377
|
+
"when": {
|
|
378
|
+
"kind": "event",
|
|
379
|
+
"eventId": "event_failed"
|
|
380
|
+
},
|
|
381
|
+
"arguments": {
|
|
382
|
+
"param_message": {
|
|
383
|
+
"kind": "field",
|
|
384
|
+
"source": {
|
|
385
|
+
"kind": "ref",
|
|
386
|
+
"targetId": "trigger_failed"
|
|
387
|
+
},
|
|
388
|
+
"fieldId": "field_effect_message"
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
"initialState": [
|
|
395
|
+
{
|
|
396
|
+
"stateId": "state_message",
|
|
397
|
+
"value": "",
|
|
398
|
+
"revision": 1
|
|
399
|
+
}
|
|
400
|
+
],
|
|
401
|
+
"externalAdapters": {
|
|
402
|
+
"integration_provider": {
|
|
403
|
+
"effect": [
|
|
404
|
+
{
|
|
405
|
+
"result": {
|
|
406
|
+
"ok": true,
|
|
407
|
+
"value": "rebooted"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
"steps": [
|
|
414
|
+
{
|
|
415
|
+
"kind": "invoke",
|
|
416
|
+
"actionId": "action_reboot",
|
|
417
|
+
"expect": {
|
|
418
|
+
"ok": true
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"expectedState": {
|
|
423
|
+
"state_message": "rebooted"
|
|
424
|
+
}
|
|
425
|
+
}
|