@cynodia/axiom-server 0.9.0-alpha.2 → 0.11.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.
Files changed (83) hide show
  1. package/README.md +44 -19
  2. package/conformance/migrations/add-optional-field.json +167 -0
  3. package/conformance/migrations/add-required-field-with-default.json +177 -0
  4. package/conformance/migrations/crash-and-resume.json +1945 -0
  5. package/conformance/migrations/destructive-removal-approved.json +142 -0
  6. package/conformance/migrations/destructive-removal-refused.json +126 -0
  7. package/conformance/migrations/idempotent-rerun.json +187 -0
  8. package/conformance/migrations/invalid-target-record.json +161 -0
  9. package/conformance/migrations/large-batched-transformation.json +18157 -0
  10. package/conformance/migrations/manifest.json +129 -0
  11. package/conformance/migrations/metadata-only-change.json +128 -0
  12. package/conformance/migrations/migration-lock.json +152 -0
  13. package/conformance/migrations/missing-migration-path.json +109 -0
  14. package/conformance/migrations/record-transformation.json +176 -0
  15. package/conformance/migrations/relationship-addition.json +258 -0
  16. package/conformance/migrations/remove-empty-field.json +139 -0
  17. package/conformance/migrations/schema-fingerprint-mismatch.json +155 -0
  18. package/conformance/migrations/transform-field.json +159 -0
  19. package/conformance/queries/aggregate-under-policy.json +769 -0
  20. package/conformance/queries/count-aggregate.json +768 -0
  21. package/conformance/queries/cursor-page-1.json +784 -0
  22. package/conformance/queries/cursor-page-2.json +809 -0
  23. package/conformance/queries/filter-compound.json +783 -0
  24. package/conformance/queries/filter-equality.json +776 -0
  25. package/conformance/queries/grouped-sum.json +791 -0
  26. package/conformance/queries/invalid-cursor.json +769 -0
  27. package/conformance/queries/manifest.json +114 -0
  28. package/conformance/queries/multi-key-sort.json +791 -0
  29. package/conformance/queries/null-ordering.json +772 -0
  30. package/conformance/queries/projection-shape.json +776 -0
  31. package/conformance/queries/query-inside-transaction.json +794 -0
  32. package/conformance/queries/relationship-under-policy.json +782 -0
  33. package/conformance/queries/row-read-policy.json +776 -0
  34. package/conformance/queries/stable-ordering.json +805 -0
  35. package/conformance/queries/to-one-relationship.json +772 -0
  36. package/dist/data-provider.d.ts +187 -0
  37. package/dist/data-provider.js +43 -0
  38. package/dist/deps.d.ts +3 -2
  39. package/dist/deps.js +2 -1
  40. package/dist/index.d.ts +19 -0
  41. package/dist/index.js +17 -0
  42. package/dist/memory-data-provider.d.ts +27 -0
  43. package/dist/memory-data-provider.js +348 -0
  44. package/dist/migration-conformance.d.ts +74 -0
  45. package/dist/migration-conformance.js +163 -0
  46. package/dist/migration-eval.d.ts +23 -0
  47. package/dist/migration-eval.js +261 -0
  48. package/dist/migration-execute.d.ts +104 -0
  49. package/dist/migration-execute.js +87 -0
  50. package/dist/migration-executor.d.ts +61 -0
  51. package/dist/migration-executor.js +291 -0
  52. package/dist/migration-gate.d.ts +68 -0
  53. package/dist/migration-gate.js +160 -0
  54. package/dist/migration-row-store.d.ts +36 -0
  55. package/dist/migration-row-store.js +73 -0
  56. package/dist/migration-store.d.ts +99 -0
  57. package/dist/migration-store.js +97 -0
  58. package/dist/migration.d.ts +191 -0
  59. package/dist/migration.js +355 -0
  60. package/dist/protocol.d.ts +47 -2
  61. package/dist/protocol.js +4 -1
  62. package/dist/provider-record-runtime.d.ts +43 -0
  63. package/dist/provider-record-runtime.js +185 -0
  64. package/dist/query-conformance.d.ts +77 -0
  65. package/dist/query-conformance.js +97 -0
  66. package/dist/query-cursor.d.ts +62 -0
  67. package/dist/query-cursor.js +110 -0
  68. package/dist/query-eval.d.ts +33 -0
  69. package/dist/query-eval.js +275 -0
  70. package/dist/query-runtime.d.ts +41 -0
  71. package/dist/query-runtime.js +138 -0
  72. package/dist/server.d.ts +86 -0
  73. package/dist/server.js +560 -9
  74. package/dist/sql-query.d.ts +36 -0
  75. package/dist/sql-query.js +137 -0
  76. package/dist/sqlite-data-provider.d.ts +14 -0
  77. package/dist/sqlite-data-provider.js +373 -0
  78. package/dist/sqlite-migration.d.ts +25 -0
  79. package/dist/sqlite-migration.js +307 -0
  80. package/package.json +4 -3
  81. package/schema/protocol.v1.schema.json +179 -1
  82. package/schema/server-ir.v6.schema.json +2462 -0
  83. package/schema/server-ir.v7.schema.json +2899 -0
package/README.md CHANGED
@@ -22,21 +22,37 @@ SQLite), `TransportAdapter` (in-process and HTTP), `ServerHost` for time, identi
22
22
  scheduling and authentication, and `IntegrationAdapter` for external systems. Nothing in
23
23
  an ApplicationGraph mentions HTTP, SQL, a route or an SDK.
24
24
 
25
- As of 0.8 this package also owns timed and event-driven execution: it schedules and
26
- dispatches `TriggerDef`s, records `integration-effect` intent atomically with the state
27
- write that requested it (the transactional outbox), dispatches an effect's committed
28
- intents to its `IntegrationAdapter` post-commit with retry, and translates verified
29
- webhook deliveries into semantic events. See
30
- [`docs/INTEGRATIONS.md`](https://github.com/cynodia/axiom/blob/main/docs/INTEGRATIONS.md),
31
- [`docs/EFFECTS.md`](https://github.com/cynodia/axiom/blob/main/docs/EFFECTS.md) and
32
- [`docs/TRIGGERS.md`](https://github.com/cynodia/axiom/blob/main/docs/TRIGGERS.md).
25
+ This package also owns the parts of an application that only the authority can run:
26
+
27
+ - **Timed and event-driven execution** (0.8) — scheduling and dispatching `TriggerDef`s,
28
+ the transactional outbox for `integration-effect` intent, post-commit effect delivery
29
+ with retry, and verified-webhook → semantic-event translation. See
30
+ [`docs/INTEGRATIONS.md`](https://github.com/cynodia/axiom/blob/main/docs/INTEGRATIONS.md),
31
+ [`docs/EFFECTS.md`](https://github.com/cynodia/axiom/blob/main/docs/EFFECTS.md),
32
+ [`docs/TRIGGERS.md`](https://github.com/cynodia/axiom/blob/main/docs/TRIGGERS.md).
33
+ - **Inbound streams and binary storage** (0.9) — long-lived `SubscriptionDef` sources
34
+ feeding the event pipeline, and `StorageDef` object stores behind host blob transports.
35
+ See [`docs/SUBSCRIPTIONS.md`](https://github.com/cynodia/axiom/blob/main/docs/SUBSCRIPTIONS.md),
36
+ [`docs/STORAGE.md`](https://github.com/cynodia/axiom/blob/main/docs/STORAGE.md).
37
+ - **The query layer** (0.10) — demand-driven `QueryDef` reads over authoritative data too
38
+ large to materialize, `DataProvider`s (`createMemoryDataProvider` / `createSqliteDataProvider`),
39
+ fingerprinted keyset cursors, and a principal/policy-scoped result cache. See
40
+ [`docs/QUERIES.md`](https://github.com/cynodia/axiom/blob/main/docs/QUERIES.md).
41
+ - **Schema evolution** (0.11) — `planMigration` / `explainMigration`, the host-controlled
42
+ `executeMigration`, the durable `MigrationMetadataStore` and lease lock, keyset-batched
43
+ crash-resumable migration, memory and SQLite `MigrationRowStore`s, and the
44
+ `createAxiomServer` startup gate. See
45
+ [`docs/MIGRATIONS.md`](https://github.com/cynodia/axiom/blob/main/docs/MIGRATIONS.md).
33
46
 
34
47
  Main exports: `createAxiomServer`, `createMemoryPersistence`, `createSqlitePersistence`,
35
48
  `createServerHost`, `createDeterministicServerHost`, `createDirectTransport`,
36
49
  `createHttpTransport`, `createRemoteGateway`, `serveOverHttp`, `serveAxiomApplication`,
37
50
  `createFakeIntegrationAdapter`, `createHttpIntegrationAdapter`, `createTriggerRuntime`,
38
- `createEffectRunner`, `runConformanceFixture`, `runConformanceSuite`,
39
- `SERVER_DIAGNOSTIC_CODES`.
51
+ `createEffectRunner`, `createMemoryDataProvider`, `createSqliteDataProvider`,
52
+ `createMemoryMigrationStore`, `createSqliteMigrationStore`, `createMemoryRowStore`,
53
+ `createSqliteRowStore`, `planMigration`, `explainMigration`, `executeMigration`,
54
+ `getMigrationStatus`, `migrationAuthority`, `runConformanceFixture`, `runConformanceSuite`,
55
+ `runQueryConformanceFixture`, `runMigrationConformanceFixture`, `SERVER_DIAGNOSTIC_CODES`.
40
56
 
41
57
  `serveAxiomApplication` is the whole deployment story: it serves the generated page at `GET /`
42
58
  and the semantic endpoint at `POST /axiom`, from one process, for any Axiom application. No
@@ -44,17 +60,26 @@ route, controller, handler or SQL statement is written by an application author.
44
60
 
45
61
  ### Portable artifacts
46
62
 
47
- `axiom.server.v1` is a frozen, language-independent contract, and this package ships what an
48
- implementation in another language needs to conform to it:
63
+ The Server IR contract is versioned. **`axiom.server.v1` is frozen** — its bytes and
64
+ semantics never change — but it is **not the current contract**: a document declares the
65
+ oldest contract that can carry its vocabulary, computed from the document. The current
66
+ contract is **`axiom.server.v7`** (0.11 schema-evolution vocabulary); `v1`–`v6` are frozen
67
+ and shipped for compatibility. This package ships what an implementation in another language
68
+ needs to conform:
49
69
 
50
70
  ```
51
- @cynodia/axiom-server/conformance the fixture manifest
52
- @cynodia/axiom-server/conformance/<name>.json one fixture: IR, state, invocations, expectations
53
- @cynodia/axiom-server/schema/server-ir.v1.schema.json JSON Schema for the frozen v1 IR
54
- @cynodia/axiom-server/schema/server-ir.v2.schema.json JSON Schema for v2 (+ group, expression-ref)
55
- @cynodia/axiom-server/schema/server-ir.v3.schema.json JSON Schema for v3 (+ integrations, effects, triggers, events)
56
- @cynodia/axiom-server/schema/server-ir.v4.schema.json JSON Schema for v4 (+ invocation source, structured effect outcome)
57
- @cynodia/axiom-server/schema/protocol.v1.schema.json JSON Schema for the protocol
71
+ @cynodia/axiom-server/conformance the base fixture manifest
72
+ @cynodia/axiom-server/conformance/<name>.json one base fixture: IR, state, invocations, expectations
73
+ @cynodia/axiom-server/conformance/queries/<name>.json one query conformance fixture (axiom.conformance.v4)
74
+ @cynodia/axiom-server/conformance/migrations/<name>.json one migration conformance fixture (axiom.conformance.v5)
75
+ @cynodia/axiom-server/schema/server-ir.v1.schema.json JSON Schema for the frozen v1 IR
76
+ @cynodia/axiom-server/schema/server-ir.v2.schema.json v2 (+ group, expression-ref)
77
+ @cynodia/axiom-server/schema/server-ir.v3.schema.json v3 (+ integrations, effects, triggers, events)
78
+ @cynodia/axiom-server/schema/server-ir.v4.schema.json v4 (+ invocation source, structured effect outcome)
79
+ @cynodia/axiom-server/schema/server-ir.v5.schema.json v5 (+ subscriptions, storage, blob operations)
80
+ @cynodia/axiom-server/schema/server-ir.v6.schema.json v6 (+ queries, relationships, read policies)
81
+ @cynodia/axiom-server/schema/server-ir.v7.schema.json v7 (+ migrations, schema version + fingerprint) — current
82
+ @cynodia/axiom-server/schema/protocol.v1.schema.json JSON Schema for the protocol
58
83
  ```
59
84
 
60
85
  The fixtures are pure data. Running them requires no part of this implementation — which is
@@ -0,0 +1,167 @@
1
+ {
2
+ "conformance": "axiom.conformance.v5",
3
+ "name": "add-optional-field",
4
+ "covers": [
5
+ "spec11 §17",
6
+ "add optional field"
7
+ ],
8
+ "description": "Order.note is added as optional; existing rows stay valid without a rewrite.",
9
+ "serverIR": {
10
+ "contract": "axiom.server.v7",
11
+ "id": "migration-conformance",
12
+ "name": "Migration Conformance",
13
+ "version": "0.11.1-alpha.1",
14
+ "schemaVersion": 2,
15
+ "schemaFingerprint": "7e4d24d95c273ff084e7758508a02e35015d5db2ceda46ca61e7ee8a2c2a4929",
16
+ "migrations": [
17
+ {
18
+ "kind": "migration",
19
+ "id": "m_1_2",
20
+ "fromSchema": 1,
21
+ "toSchema": 2,
22
+ "operations": [
23
+ {
24
+ "id": "op_add_note",
25
+ "kind": "add-field",
26
+ "entityId": "entity_order",
27
+ "field": {
28
+ "id": "field_order_note",
29
+ "valueType": {
30
+ "kind": "optional",
31
+ "valueType": {
32
+ "kind": "primitive",
33
+ "primitive": "string"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ ],
41
+ "entities": [
42
+ {
43
+ "kind": "entity",
44
+ "id": "entity_order",
45
+ "identityFieldId": "field_order_id",
46
+ "fields": [
47
+ {
48
+ "id": "field_order_id",
49
+ "valueType": {
50
+ "kind": "primitive",
51
+ "primitive": "string"
52
+ }
53
+ },
54
+ {
55
+ "id": "field_order_total",
56
+ "valueType": {
57
+ "kind": "primitive",
58
+ "primitive": "number"
59
+ }
60
+ },
61
+ {
62
+ "id": "field_order_note",
63
+ "valueType": {
64
+ "kind": "optional",
65
+ "valueType": {
66
+ "kind": "primitive",
67
+ "primitive": "string"
68
+ }
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ "fields": {
75
+ "field_order_id": {
76
+ "entityId": "entity_order",
77
+ "field": {
78
+ "id": "field_order_id",
79
+ "valueType": {
80
+ "kind": "primitive",
81
+ "primitive": "string"
82
+ }
83
+ }
84
+ },
85
+ "field_order_total": {
86
+ "entityId": "entity_order",
87
+ "field": {
88
+ "id": "field_order_total",
89
+ "valueType": {
90
+ "kind": "primitive",
91
+ "primitive": "number"
92
+ }
93
+ }
94
+ },
95
+ "field_order_note": {
96
+ "entityId": "entity_order",
97
+ "field": {
98
+ "id": "field_order_note",
99
+ "valueType": {
100
+ "kind": "optional",
101
+ "valueType": {
102
+ "kind": "primitive",
103
+ "primitive": "string"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ },
109
+ "states": [
110
+ {
111
+ "id": "state_entity_order",
112
+ "kind": "state",
113
+ "valueType": {
114
+ "kind": "collection",
115
+ "itemType": {
116
+ "kind": "entity",
117
+ "entityId": "entity_order"
118
+ }
119
+ },
120
+ "authority": "server"
121
+ }
122
+ ],
123
+ "actions": {},
124
+ "constraints": [],
125
+ "transitionConstraints": [],
126
+ "observableStateIds": [
127
+ "state_entity_order"
128
+ ]
129
+ },
130
+ "fromVersion": 1,
131
+ "sourceData": {
132
+ "entity_order": [
133
+ {
134
+ "field_order_id": "order-0000",
135
+ "field_order_total": 0
136
+ },
137
+ {
138
+ "field_order_id": "order-0001",
139
+ "field_order_total": 1
140
+ },
141
+ {
142
+ "field_order_id": "order-0002",
143
+ "field_order_total": 2
144
+ }
145
+ ]
146
+ },
147
+ "expect": {
148
+ "ok": true,
149
+ "status": "completed",
150
+ "targetData": {
151
+ "entity_order": [
152
+ {
153
+ "field_order_id": "order-0000",
154
+ "field_order_total": 0
155
+ },
156
+ {
157
+ "field_order_id": "order-0001",
158
+ "field_order_total": 1
159
+ },
160
+ {
161
+ "field_order_id": "order-0002",
162
+ "field_order_total": 2
163
+ }
164
+ ]
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,177 @@
1
+ {
2
+ "conformance": "axiom.conformance.v5",
3
+ "name": "add-required-field-with-default",
4
+ "covers": [
5
+ "spec11 §18",
6
+ "add required field + default"
7
+ ],
8
+ "description": "Order.status is added as required; every existing row is populated with \"draft\".",
9
+ "serverIR": {
10
+ "contract": "axiom.server.v7",
11
+ "id": "migration-conformance",
12
+ "name": "Migration Conformance",
13
+ "version": "0.11.1-alpha.1",
14
+ "schemaVersion": 2,
15
+ "schemaFingerprint": "2c478dc5301786b76c6990e38e1659d621d7712fdfa785bf115b1275b9804877",
16
+ "migrations": [
17
+ {
18
+ "kind": "migration",
19
+ "id": "m_1_2",
20
+ "fromSchema": 1,
21
+ "toSchema": 2,
22
+ "operations": [
23
+ {
24
+ "id": "op_add_status",
25
+ "kind": "add-field",
26
+ "entityId": "entity_order",
27
+ "field": {
28
+ "id": "field_order_status",
29
+ "valueType": {
30
+ "kind": "primitive",
31
+ "primitive": "string"
32
+ },
33
+ "required": true
34
+ },
35
+ "populate": {
36
+ "kind": "literal",
37
+ "value": "draft"
38
+ }
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "entities": [
44
+ {
45
+ "kind": "entity",
46
+ "id": "entity_order",
47
+ "identityFieldId": "field_order_id",
48
+ "fields": [
49
+ {
50
+ "id": "field_order_id",
51
+ "valueType": {
52
+ "kind": "primitive",
53
+ "primitive": "string"
54
+ }
55
+ },
56
+ {
57
+ "id": "field_order_total",
58
+ "valueType": {
59
+ "kind": "primitive",
60
+ "primitive": "number"
61
+ }
62
+ },
63
+ {
64
+ "id": "field_order_status",
65
+ "valueType": {
66
+ "kind": "primitive",
67
+ "primitive": "string"
68
+ },
69
+ "required": true
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ "fields": {
75
+ "field_order_id": {
76
+ "entityId": "entity_order",
77
+ "field": {
78
+ "id": "field_order_id",
79
+ "valueType": {
80
+ "kind": "primitive",
81
+ "primitive": "string"
82
+ }
83
+ }
84
+ },
85
+ "field_order_total": {
86
+ "entityId": "entity_order",
87
+ "field": {
88
+ "id": "field_order_total",
89
+ "valueType": {
90
+ "kind": "primitive",
91
+ "primitive": "number"
92
+ }
93
+ }
94
+ },
95
+ "field_order_status": {
96
+ "entityId": "entity_order",
97
+ "field": {
98
+ "id": "field_order_status",
99
+ "valueType": {
100
+ "kind": "primitive",
101
+ "primitive": "string"
102
+ },
103
+ "required": true
104
+ }
105
+ }
106
+ },
107
+ "states": [
108
+ {
109
+ "id": "state_entity_order",
110
+ "kind": "state",
111
+ "valueType": {
112
+ "kind": "collection",
113
+ "itemType": {
114
+ "kind": "entity",
115
+ "entityId": "entity_order"
116
+ }
117
+ },
118
+ "authority": "server"
119
+ }
120
+ ],
121
+ "actions": {},
122
+ "constraints": [],
123
+ "transitionConstraints": [],
124
+ "observableStateIds": [
125
+ "state_entity_order"
126
+ ]
127
+ },
128
+ "fromVersion": 1,
129
+ "sourceData": {
130
+ "entity_order": [
131
+ {
132
+ "field_order_id": "order-0000",
133
+ "field_order_total": 0
134
+ },
135
+ {
136
+ "field_order_id": "order-0001",
137
+ "field_order_total": 1
138
+ },
139
+ {
140
+ "field_order_id": "order-0002",
141
+ "field_order_total": 2
142
+ },
143
+ {
144
+ "field_order_id": "order-0003",
145
+ "field_order_total": 3
146
+ }
147
+ ]
148
+ },
149
+ "expect": {
150
+ "ok": true,
151
+ "status": "completed",
152
+ "targetData": {
153
+ "entity_order": [
154
+ {
155
+ "field_order_id": "order-0000",
156
+ "field_order_total": 0,
157
+ "field_order_status": "draft"
158
+ },
159
+ {
160
+ "field_order_id": "order-0001",
161
+ "field_order_total": 1,
162
+ "field_order_status": "draft"
163
+ },
164
+ {
165
+ "field_order_id": "order-0002",
166
+ "field_order_total": 2,
167
+ "field_order_status": "draft"
168
+ },
169
+ {
170
+ "field_order_id": "order-0003",
171
+ "field_order_total": 3,
172
+ "field_order_status": "draft"
173
+ }
174
+ ]
175
+ }
176
+ }
177
+ }