@githolon/dsl 0.1.0 → 0.1.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.
@@ -0,0 +1,421 @@
1
+ # Generated by pub
2
+ # See https://dart.dev/tools/pub/glossary#lockfile
3
+ packages:
4
+ _fe_analyzer_shared:
5
+ dependency: transitive
6
+ description:
7
+ name: _fe_analyzer_shared
8
+ sha256: cd6add6f846f35fb79f3c315296703c1a24f3cfd7f4739d91a74961c1c7e9f1b
9
+ url: "https://pub.dev"
10
+ source: hosted
11
+ version: "100.0.0"
12
+ analyzer:
13
+ dependency: transitive
14
+ description:
15
+ name: analyzer
16
+ sha256: "6ba98576948803398b69e3a444df24eacdbe12ed699c7014e120ea38552debbf"
17
+ url: "https://pub.dev"
18
+ source: hosted
19
+ version: "13.0.0"
20
+ args:
21
+ dependency: transitive
22
+ description:
23
+ name: args
24
+ sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
25
+ url: "https://pub.dev"
26
+ source: hosted
27
+ version: "2.7.0"
28
+ async:
29
+ dependency: transitive
30
+ description:
31
+ name: async
32
+ sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37
33
+ url: "https://pub.dev"
34
+ source: hosted
35
+ version: "2.13.1"
36
+ boolean_selector:
37
+ dependency: transitive
38
+ description:
39
+ name: boolean_selector
40
+ sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
41
+ url: "https://pub.dev"
42
+ source: hosted
43
+ version: "2.1.2"
44
+ cli_config:
45
+ dependency: transitive
46
+ description:
47
+ name: cli_config
48
+ sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec
49
+ url: "https://pub.dev"
50
+ source: hosted
51
+ version: "0.2.0"
52
+ collection:
53
+ dependency: transitive
54
+ description:
55
+ name: collection
56
+ sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
57
+ url: "https://pub.dev"
58
+ source: hosted
59
+ version: "1.19.1"
60
+ convert:
61
+ dependency: transitive
62
+ description:
63
+ name: convert
64
+ sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
65
+ url: "https://pub.dev"
66
+ source: hosted
67
+ version: "3.1.2"
68
+ coverage:
69
+ dependency: transitive
70
+ description:
71
+ name: coverage
72
+ sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d"
73
+ url: "https://pub.dev"
74
+ source: hosted
75
+ version: "1.15.0"
76
+ crypto:
77
+ dependency: transitive
78
+ description:
79
+ name: crypto
80
+ sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
81
+ url: "https://pub.dev"
82
+ source: hosted
83
+ version: "3.0.7"
84
+ file:
85
+ dependency: transitive
86
+ description:
87
+ name: file
88
+ sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
89
+ url: "https://pub.dev"
90
+ source: hosted
91
+ version: "7.0.1"
92
+ frontend_server_client:
93
+ dependency: transitive
94
+ description:
95
+ name: frontend_server_client
96
+ sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
97
+ url: "https://pub.dev"
98
+ source: hosted
99
+ version: "4.0.0"
100
+ glob:
101
+ dependency: transitive
102
+ description:
103
+ name: glob
104
+ sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
105
+ url: "https://pub.dev"
106
+ source: hosted
107
+ version: "2.1.3"
108
+ http:
109
+ dependency: transitive
110
+ description:
111
+ name: http
112
+ sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
113
+ url: "https://pub.dev"
114
+ source: hosted
115
+ version: "1.6.0"
116
+ http_multi_server:
117
+ dependency: transitive
118
+ description:
119
+ name: http_multi_server
120
+ sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
121
+ url: "https://pub.dev"
122
+ source: hosted
123
+ version: "3.2.2"
124
+ http_parser:
125
+ dependency: transitive
126
+ description:
127
+ name: http_parser
128
+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
129
+ url: "https://pub.dev"
130
+ source: hosted
131
+ version: "4.1.2"
132
+ io:
133
+ dependency: transitive
134
+ description:
135
+ name: io
136
+ sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
137
+ url: "https://pub.dev"
138
+ source: hosted
139
+ version: "1.0.5"
140
+ json_schema:
141
+ dependency: "direct main"
142
+ description:
143
+ name: json_schema
144
+ sha256: f37d9c3fdfe8c9aae55fdfd5af815d24ce63c3a0f6a2c1f0982c30f43643fa1a
145
+ url: "https://pub.dev"
146
+ source: hosted
147
+ version: "5.2.2"
148
+ logging:
149
+ dependency: transitive
150
+ description:
151
+ name: logging
152
+ sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
153
+ url: "https://pub.dev"
154
+ source: hosted
155
+ version: "1.3.0"
156
+ matcher:
157
+ dependency: transitive
158
+ description:
159
+ name: matcher
160
+ sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
161
+ url: "https://pub.dev"
162
+ source: hosted
163
+ version: "0.12.20"
164
+ meta:
165
+ dependency: transitive
166
+ description:
167
+ name: meta
168
+ sha256: df0c643f44ad098eb37988027a8e2b2b5a031fd3977f06bbfd3a76637e8df739
169
+ url: "https://pub.dev"
170
+ source: hosted
171
+ version: "1.18.2"
172
+ mime:
173
+ dependency: transitive
174
+ description:
175
+ name: mime
176
+ sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
177
+ url: "https://pub.dev"
178
+ source: hosted
179
+ version: "2.0.0"
180
+ node_preamble:
181
+ dependency: transitive
182
+ description:
183
+ name: node_preamble
184
+ sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
185
+ url: "https://pub.dev"
186
+ source: hosted
187
+ version: "2.0.2"
188
+ package_config:
189
+ dependency: transitive
190
+ description:
191
+ name: package_config
192
+ sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
193
+ url: "https://pub.dev"
194
+ source: hosted
195
+ version: "2.2.0"
196
+ path:
197
+ dependency: transitive
198
+ description:
199
+ name: path
200
+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
201
+ url: "https://pub.dev"
202
+ source: hosted
203
+ version: "1.9.1"
204
+ pool:
205
+ dependency: transitive
206
+ description:
207
+ name: pool
208
+ sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
209
+ url: "https://pub.dev"
210
+ source: hosted
211
+ version: "1.5.2"
212
+ pub_semver:
213
+ dependency: transitive
214
+ description:
215
+ name: pub_semver
216
+ sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
217
+ url: "https://pub.dev"
218
+ source: hosted
219
+ version: "2.2.0"
220
+ quiver:
221
+ dependency: transitive
222
+ description:
223
+ name: quiver
224
+ sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2
225
+ url: "https://pub.dev"
226
+ source: hosted
227
+ version: "3.2.2"
228
+ rfc_6901:
229
+ dependency: transitive
230
+ description:
231
+ name: rfc_6901
232
+ sha256: "6a43b1858dca2febaf93e15639aa6b0c49ccdfd7647775f15a499f872b018154"
233
+ url: "https://pub.dev"
234
+ source: hosted
235
+ version: "0.2.1"
236
+ shelf:
237
+ dependency: transitive
238
+ description:
239
+ name: shelf
240
+ sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12
241
+ url: "https://pub.dev"
242
+ source: hosted
243
+ version: "1.4.2"
244
+ shelf_packages_handler:
245
+ dependency: transitive
246
+ description:
247
+ name: shelf_packages_handler
248
+ sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
249
+ url: "https://pub.dev"
250
+ source: hosted
251
+ version: "3.0.2"
252
+ shelf_static:
253
+ dependency: transitive
254
+ description:
255
+ name: shelf_static
256
+ sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3
257
+ url: "https://pub.dev"
258
+ source: hosted
259
+ version: "1.1.3"
260
+ shelf_web_socket:
261
+ dependency: transitive
262
+ description:
263
+ name: shelf_web_socket
264
+ sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
265
+ url: "https://pub.dev"
266
+ source: hosted
267
+ version: "3.0.0"
268
+ source_map_stack_trace:
269
+ dependency: transitive
270
+ description:
271
+ name: source_map_stack_trace
272
+ sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b
273
+ url: "https://pub.dev"
274
+ source: hosted
275
+ version: "2.1.2"
276
+ source_maps:
277
+ dependency: transitive
278
+ description:
279
+ name: source_maps
280
+ sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812"
281
+ url: "https://pub.dev"
282
+ source: hosted
283
+ version: "0.10.13"
284
+ source_span:
285
+ dependency: transitive
286
+ description:
287
+ name: source_span
288
+ sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
289
+ url: "https://pub.dev"
290
+ source: hosted
291
+ version: "1.10.2"
292
+ stack_trace:
293
+ dependency: transitive
294
+ description:
295
+ name: stack_trace
296
+ sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
297
+ url: "https://pub.dev"
298
+ source: hosted
299
+ version: "1.12.1"
300
+ stream_channel:
301
+ dependency: transitive
302
+ description:
303
+ name: stream_channel
304
+ sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
305
+ url: "https://pub.dev"
306
+ source: hosted
307
+ version: "2.1.4"
308
+ string_scanner:
309
+ dependency: transitive
310
+ description:
311
+ name: string_scanner
312
+ sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
313
+ url: "https://pub.dev"
314
+ source: hosted
315
+ version: "1.4.1"
316
+ term_glyph:
317
+ dependency: transitive
318
+ description:
319
+ name: term_glyph
320
+ sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
321
+ url: "https://pub.dev"
322
+ source: hosted
323
+ version: "1.2.2"
324
+ test:
325
+ dependency: "direct dev"
326
+ description:
327
+ name: test
328
+ sha256: ca578dc12bb8b2f40b67b7d3bd2fac4f31c01a6ff7130a14e2597b919934507f
329
+ url: "https://pub.dev"
330
+ source: hosted
331
+ version: "1.31.1"
332
+ test_api:
333
+ dependency: transitive
334
+ description:
335
+ name: test_api
336
+ sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
337
+ url: "https://pub.dev"
338
+ source: hosted
339
+ version: "0.7.12"
340
+ test_core:
341
+ dependency: transitive
342
+ description:
343
+ name: test_core
344
+ sha256: d2e98ec12998368dc59ddd47ab709f2cd55acd6b66dc7db764455a44082f4bc5
345
+ url: "https://pub.dev"
346
+ source: hosted
347
+ version: "0.6.18"
348
+ typed_data:
349
+ dependency: transitive
350
+ description:
351
+ name: typed_data
352
+ sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
353
+ url: "https://pub.dev"
354
+ source: hosted
355
+ version: "1.4.0"
356
+ uri:
357
+ dependency: transitive
358
+ description:
359
+ name: uri
360
+ sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a"
361
+ url: "https://pub.dev"
362
+ source: hosted
363
+ version: "1.0.0"
364
+ vm_service:
365
+ dependency: transitive
366
+ description:
367
+ name: vm_service
368
+ sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360"
369
+ url: "https://pub.dev"
370
+ source: hosted
371
+ version: "15.2.0"
372
+ watcher:
373
+ dependency: transitive
374
+ description:
375
+ name: watcher
376
+ sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635"
377
+ url: "https://pub.dev"
378
+ source: hosted
379
+ version: "1.2.1"
380
+ web:
381
+ dependency: transitive
382
+ description:
383
+ name: web
384
+ sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
385
+ url: "https://pub.dev"
386
+ source: hosted
387
+ version: "1.1.1"
388
+ web_socket:
389
+ dependency: transitive
390
+ description:
391
+ name: web_socket
392
+ sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
393
+ url: "https://pub.dev"
394
+ source: hosted
395
+ version: "1.0.1"
396
+ web_socket_channel:
397
+ dependency: transitive
398
+ description:
399
+ name: web_socket_channel
400
+ sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
401
+ url: "https://pub.dev"
402
+ source: hosted
403
+ version: "3.0.3"
404
+ webkit_inspection_protocol:
405
+ dependency: transitive
406
+ description:
407
+ name: webkit_inspection_protocol
408
+ sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
409
+ url: "https://pub.dev"
410
+ source: hosted
411
+ version: "1.2.1"
412
+ yaml:
413
+ dependency: transitive
414
+ description:
415
+ name: yaml
416
+ sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
417
+ url: "https://pub.dev"
418
+ source: hosted
419
+ version: "3.1.3"
420
+ sdks:
421
+ dart: ">=3.11.0 <4.0.0"
@@ -0,0 +1,23 @@
1
+ # NOMOS — Nomos Sovereign: participants act · verify · remember LOCALLY; hosted
2
+ # remotes are replaceable custody/transport, not truth. ⇒ ONE Nomos GitHolon
3
+ # wasm32-wasip1 artifact {kernel · projection · embedded
4
+ # QuickJS engine} on V8 + WASI-shim, byte-identical everywhere. V8 = portability; the one
5
+ # wasm = determinism. No native, no wasmtime, no 2nd artifact, no domain-JS on bare V8.
6
+ # If a file isn't this / hosting this / authoring for this / proving this — it's gone.
7
+
8
+ name: nomos_dsl
9
+ description: >-
10
+ Nomos 2 Dart frontend types — the hand-written kernel wire types plus the
11
+ code-generated per-domain aggregate + directive-payload types. (De)serializes
12
+ the EXACT serde JSON the Rust kernel + projection produce/consume.
13
+ version: 0.0.0
14
+ publish_to: none
15
+
16
+ environment:
17
+ sdk: ^3.5.0
18
+
19
+ dependencies:
20
+ json_schema: ^5.2.2
21
+
22
+ dev_dependencies:
23
+ test: ^1.25.0
@@ -0,0 +1,66 @@
1
+ // NOMOS — Nomos Sovereign: participants act · verify · remember LOCALLY; hosted
2
+ // remotes are replaceable custody/transport, not truth. ⇒ ONE Nomos GitHolon
3
+ // wasm32-wasip1 artifact {kernel · projection · embedded
4
+ // QuickJS engine} on V8 + WASI-shim, byte-identical everywhere. V8 = portability; the one
5
+ // wasm = determinism. No native, no wasmtime, no 2nd artifact, no domain-JS on bare V8.
6
+ // If a file isn't this / hosting this / authoring for this / proving this — it's gone.
7
+
8
+ import 'package:nomos_dsl/nomos_dsl.dart';
9
+ import 'package:test/test.dart';
10
+
11
+ void main() {
12
+ const profilePayloadSchema = <String, Object?>{
13
+ r'$schema': 'https://json-schema.org/draft/2020-12/schema',
14
+ 'type': 'object',
15
+ 'properties': <String, Object?>{
16
+ 'userId': <String, Object?>{'type': 'string'},
17
+ 'profile': <String, Object?>{
18
+ 'type': 'object',
19
+ 'propertyNames': <String, Object?>{'type': 'string'},
20
+ 'additionalProperties': <String, Object?>{
21
+ 'anyOf': <Object?>[
22
+ <String, Object?>{'type': 'string'},
23
+ <String, Object?>{'type': 'boolean'},
24
+ <String, Object?>{
25
+ 'type': 'object',
26
+ 'propertyNames': <String, Object?>{'type': 'string'},
27
+ 'additionalProperties': <String, Object?>{},
28
+ },
29
+ <String, Object?>{
30
+ 'type': 'array',
31
+ 'items': <String, Object?>{},
32
+ },
33
+ ],
34
+ },
35
+ },
36
+ },
37
+ 'required': <Object?>['userId', 'profile'],
38
+ 'additionalProperties': false,
39
+ };
40
+
41
+ test('validates a compiler-emitted record payload JSON Schema', () {
42
+ final ok = validateNomosJsonSchema(profilePayloadSchema, <String, Object?>{
43
+ 'userId': 'u-1',
44
+ 'profile': <String, Object?>{
45
+ 'firstName': 'Jack',
46
+ 'notifications': <String, Object?>{'emailEnabled': true},
47
+ 'preloadedThingIds': <String, Object?>{'thing-1': true},
48
+ },
49
+ });
50
+ expect(ok.isValid, isTrue);
51
+ });
52
+
53
+ test('throws a typed exception for invalid dynamic payload maps', () {
54
+ expect(
55
+ () => requireNomosJsonSchema(
56
+ profilePayloadSchema,
57
+ <String, Object?>{
58
+ 'userId': 'u-1',
59
+ 'profile': <String, Object?>{'bad': 42},
60
+ },
61
+ context: 'updateUserProfile payload',
62
+ ),
63
+ throwsA(isA<NomosJsonSchemaException>()),
64
+ );
65
+ });
66
+ }
@@ -0,0 +1,162 @@
1
+ // NOMOS — Nomos Sovereign: participants act · verify · remember LOCALLY; hosted
2
+ // remotes are replaceable custody/transport, not truth. ⇒ ONE Nomos GitHolon
3
+ // wasm32-wasip1 artifact {kernel · projection · embedded
4
+ // QuickJS engine} on V8 + WASI-shim, byte-identical everywhere. V8 = portability; the one
5
+ // wasm = determinism. No native, no wasmtime, no 2nd artifact, no domain-JS on bare V8.
6
+ // If a file isn't this / hosting this / authoring for this / proving this — it's gone.
7
+
8
+ import 'dart:convert';
9
+
10
+ import 'package:nomos_dsl/nomos_dsl.dart';
11
+ import 'package:test/test.dart';
12
+
13
+ /// Deep round-trip: a JSON string -> Dart fromJson -> toJson -> re-encoded
14
+ /// string must be byte-equal after canonical re-encoding of BOTH sides.
15
+ void roundTrips(String label, String json, Object Function(Map<String, dynamic>) fromJson) {
16
+ test('round-trips $label', () {
17
+ final decoded = jsonDecode(json) as Map<String, dynamic>;
18
+ final obj = fromJson(decoded);
19
+ final reJson = (obj as dynamic).toJson() as Map<String, dynamic>;
20
+ // Structural equality via canonical re-encode (key order independent since
21
+ // we compare decoded maps, but jsonEncode both for a tight value check).
22
+ expect(reJson, equals(decoded),
23
+ reason: 'toJson must structurally equal the kernel JSON');
24
+ });
25
+ }
26
+
27
+ void main() {
28
+ group('Hlc — replica is a bare int', () {
29
+ const json = '{"physical":1,"logical":0,"replica":7}';
30
+ roundTrips('Hlc', json, (m) => Hlc.fromJson(m));
31
+
32
+ test('replica deserializes to a bare int', () {
33
+ final h = Hlc.fromJson(jsonDecode(json) as Map<String, dynamic>);
34
+ expect(h.replica, 7);
35
+ expect(h.toJson()['replica'], 7); // NOT {"ReplicaId":7}
36
+ });
37
+ });
38
+
39
+ group('Value variants (externally tagged)', () {
40
+ roundTrips('Value::Str', '{"Str":"red"}', (m) => Value.fromJson(m));
41
+ roundTrips('Value::Int', '{"Int":10}', (m) => Value.fromJson(m));
42
+ roundTrips('Value::Set', '{"Set":["a","b"]}', (m) => Value.fromJson(m));
43
+ roundTrips(
44
+ 'Value::Map',
45
+ '{"Map":{"color":{"value":{"Str":"red"},"stamp":{"physical":5,"logical":2,"replica":1}}}}',
46
+ (m) => Value.fromJson(m),
47
+ );
48
+
49
+ test('Value::Int -> ValueInt', () {
50
+ expect(Value.fromJson({'Int': 10}), const ValueInt(10));
51
+ });
52
+ });
53
+
54
+ group('Op variants', () {
55
+ roundTrips('Op::Set(Int)', '{"Set":{"Int":10}}', (m) => Op.fromJson(m));
56
+ roundTrips('Op::Set(Str)', '{"Set":{"Str":"A"}}', (m) => Op.fromJson(m));
57
+ roundTrips('Op::AddToSet', '{"AddToSet":["x","y"]}', (m) => Op.fromJson(m));
58
+ roundTrips(
59
+ 'Op::SetEntry',
60
+ '{"SetEntry":{"key":"color","value":{"Str":"red"}}}',
61
+ (m) => Op.fromJson(m),
62
+ );
63
+ });
64
+
65
+ group('Event — one aggregate, marker + its field-ops (#56)', () {
66
+ // An Event is now {aggregate, marker, ops}.
67
+ const eventJson =
68
+ '{"aggregate":"asset-1","marker":"Create","ops":['
69
+ '{"field":"pos","op":{"Set":{"Int":10}}},'
70
+ '{"field":"tags","op":{"AddToSet":["x"]}},'
71
+ '{"field":"customFields","op":{"SetEntry":{"key":"size","value":{"Str":"L"}}}}'
72
+ ']}';
73
+ roundTrips('Event(aggregate, marker, Set/AddToSet/SetEntry)', eventJson,
74
+ (m) => Event.fromJson(m));
75
+
76
+ test('decodes the aggregate id + marker + all three op kinds', () {
77
+ final ev = Event.fromJson(jsonDecode(eventJson) as Map<String, dynamic>);
78
+ expect(ev.aggregate, 'asset-1');
79
+ expect(ev.marker, RefMode.create);
80
+ expect(ev.ops, hasLength(3));
81
+ expect(ev.ops[0].op, isA<OpSet>());
82
+ expect(ev.ops[1].op, isA<OpAddToSet>());
83
+ expect(ev.ops[2].op, isA<OpSetEntry>());
84
+ });
85
+
86
+ test('a missing marker defaults to Ensure (serde-default parity)', () {
87
+ const noMarker = '{"aggregate":"a","ops":[]}';
88
+ final ev = Event.fromJson(jsonDecode(noMarker) as Map<String, dynamic>);
89
+ expect(ev.marker, RefMode.ensure);
90
+ });
91
+
92
+ test('all four RefMode variants round-trip their bare-string wire', () {
93
+ for (final m in RefMode.values) {
94
+ expect(RefMode.fromWire(m.wire), m);
95
+ }
96
+ expect(RefMode.create.wire, 'Create');
97
+ expect(RefMode.archive.wire, 'Archive');
98
+ });
99
+ });
100
+
101
+ group('Intent — the headline wire shape (one commit, many events, #56)', () {
102
+ // The exact JSON the kernel/git_backend writes as intent.json: ONE intent
103
+ // (id + HLC + strikes + events), here a multi-aggregate event set.
104
+ const intentJson =
105
+ '{"id":"5.2.1","hlc":{"physical":5,"logical":2,"replica":1},"strikes":[],"events":['
106
+ '{"aggregate":"asset-1","marker":"Create","ops":[{"field":"pos","op":{"Set":{"Int":10}}}]},'
107
+ '{"aggregate":"asset-2","marker":"Create","ops":[{"field":"label","op":{"Set":{"Str":"A2"}}}]}'
108
+ ']}';
109
+ roundTrips('Intent(multi-aggregate)', intentJson, (m) => Intent.fromJson(m));
110
+
111
+ test('decodes the id + hlc + strikes + one event per aggregate', () {
112
+ final intent =
113
+ Intent.fromJson(jsonDecode(intentJson) as Map<String, dynamic>);
114
+ expect(intent.id, '5.2.1');
115
+ expect(intent.hlc.replica, 1);
116
+ expect(intent.strikes, isEmpty);
117
+ expect(intent.events, hasLength(2));
118
+ expect(intent.events[0].aggregate, 'asset-1');
119
+ expect(intent.events[0].marker, RefMode.create);
120
+ expect(intent.events[1].aggregate, 'asset-2');
121
+ expect(intent.events[1].ops.single.op, isA<OpSet>());
122
+ });
123
+
124
+ test('id derives from the HLC (physical.logical.replica)', () {
125
+ expect(Intent.idFromHlc(const Hlc(physical: 5, logical: 2, replica: 1)),
126
+ '5.2.1');
127
+ });
128
+
129
+ test('a strike-carrying intent (revert) round-trips its strikes', () {
130
+ const undoJson =
131
+ '{"id":"undo-1","hlc":{"physical":6,"logical":0,"replica":1},"strikes":["5.2.1"],"events":[]}';
132
+ final undo = Intent.fromJson(jsonDecode(undoJson) as Map<String, dynamic>);
133
+ expect(undo.strikes, ['5.2.1']);
134
+ expect(undo.events, isEmpty);
135
+ expect(undo.toJson(), jsonDecode(undoJson));
136
+ });
137
+ });
138
+
139
+ group('Driver + Schema', () {
140
+ test('unit drivers are bare strings', () {
141
+ expect(WireDriver.fromJson('Lww'), const DriverLww());
142
+ expect(WireDriver.fromJson('AddWins'), const DriverAddWins());
143
+ expect(WireDriver.fromJson('Conflict'), const DriverConflict());
144
+ expect(const DriverLww().toJson(), 'Lww');
145
+ });
146
+
147
+ test('MapOf nests', () {
148
+ final d = WireDriver.fromJson({'MapOf': 'Lww'});
149
+ expect(d, const DriverMapOf(DriverLww()));
150
+ expect(d.toJson(), {'MapOf': 'Lww'});
151
+ });
152
+
153
+ test('Schema round-trips the lowered trackable_asset schema', () {
154
+ const schemaJson =
155
+ '{"label":"Lww","pos":"Lww","status":"Lww","tags":"AddWins","customFields":{"MapOf":"Lww"}}';
156
+ final decoded = jsonDecode(schemaJson) as Map<String, dynamic>;
157
+ final schema = Schema.fromJson(decoded);
158
+ expect(schema.toJson(), equals(decoded));
159
+ expect(schema.drivers['customFields'], const DriverMapOf(DriverLww()));
160
+ });
161
+ });
162
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -37,6 +37,7 @@
37
37
  "files": [
38
38
  "src",
39
39
  "!src/**/*.test.ts",
40
+ "dart",
40
41
  "compile_package.mjs"
41
42
  ],
42
43
  "publishConfig": {