@mmmnt/cli 0.6.2 → 0.7.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/moment.mjs CHANGED
@@ -55234,6 +55234,7 @@ var Classification = {
55234
55234
  };
55235
55235
  var CommandDeclaration = {
55236
55236
  $type: "CommandDeclaration",
55237
+ causes: "causes",
55237
55238
  emits: "emits",
55238
55239
  inputs: "inputs",
55239
55240
  name: "name",
@@ -55367,6 +55368,7 @@ var MomentDeclaration = {
55367
55368
  isBranch: "isBranch",
55368
55369
  label: "label",
55369
55370
  nodes: "nodes",
55371
+ notes: "notes",
55370
55372
  whenBlocks: "whenBlocks"
55371
55373
  };
55372
55374
  function isMomentDeclaration(item) {
@@ -55389,6 +55391,7 @@ var NodeModifier = {
55389
55391
  };
55390
55392
  var NodePlacement = {
55391
55393
  $type: "NodePlacement",
55394
+ cause: "cause",
55392
55395
  connections: "connections",
55393
55396
  crossing: "crossing",
55394
55397
  laneId: "laneId",
@@ -55396,8 +55399,14 @@ var NodePlacement = {
55396
55399
  multiplicity: "multiplicity",
55397
55400
  nodeName: "nodeName"
55398
55401
  };
55402
+ var NoteStatement = {
55403
+ $type: "NoteStatement",
55404
+ laneId: "laneId",
55405
+ text: "text"
55406
+ };
55399
55407
  var OrchestrationCommand = {
55400
55408
  $type: "OrchestrationCommand",
55409
+ causes: "causes",
55401
55410
  emits: "emits",
55402
55411
  inputs: "inputs",
55403
55412
  name: "name",
@@ -55416,6 +55425,7 @@ function isPolicyDeclaration(item) {
55416
55425
  }
55417
55426
  var Precondition = {
55418
55427
  $type: "Precondition",
55428
+ causes: "causes",
55419
55429
  description: "description",
55420
55430
  name: "name"
55421
55431
  };
@@ -55461,6 +55471,7 @@ var SagaDeclaration = {
55461
55471
  $type: "SagaDeclaration",
55462
55472
  commands: "commands",
55463
55473
  compensations: "compensations",
55474
+ events: "events",
55464
55475
  gateways: "gateways",
55465
55476
  initialState: "initialState",
55466
55477
  invokedBy: "invokedBy",
@@ -55604,6 +55615,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
55604
55615
  CommandDeclaration: {
55605
55616
  name: CommandDeclaration.$type,
55606
55617
  properties: {
55618
+ causes: {
55619
+ name: CommandDeclaration.causes,
55620
+ defaultValue: [],
55621
+ optional: true
55622
+ },
55607
55623
  emits: {
55608
55624
  name: CommandDeclaration.emits
55609
55625
  },
@@ -55927,6 +55943,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
55927
55943
  defaultValue: [],
55928
55944
  optional: true
55929
55945
  },
55946
+ notes: {
55947
+ name: MomentDeclaration.notes,
55948
+ defaultValue: [],
55949
+ optional: true
55950
+ },
55930
55951
  whenBlocks: {
55931
55952
  name: MomentDeclaration.whenBlocks,
55932
55953
  defaultValue: [],
@@ -55982,6 +56003,10 @@ var MomentAstReflection = class extends AbstractAstReflection {
55982
56003
  NodePlacement: {
55983
56004
  name: NodePlacement.$type,
55984
56005
  properties: {
56006
+ cause: {
56007
+ name: NodePlacement.cause,
56008
+ optional: true
56009
+ },
55985
56010
  connections: {
55986
56011
  name: NodePlacement.connections,
55987
56012
  defaultValue: [],
@@ -56008,9 +56033,27 @@ var MomentAstReflection = class extends AbstractAstReflection {
56008
56033
  },
56009
56034
  superTypes: []
56010
56035
  },
56036
+ NoteStatement: {
56037
+ name: NoteStatement.$type,
56038
+ properties: {
56039
+ laneId: {
56040
+ name: NoteStatement.laneId,
56041
+ optional: true
56042
+ },
56043
+ text: {
56044
+ name: NoteStatement.text
56045
+ }
56046
+ },
56047
+ superTypes: []
56048
+ },
56011
56049
  OrchestrationCommand: {
56012
56050
  name: OrchestrationCommand.$type,
56013
56051
  properties: {
56052
+ causes: {
56053
+ name: OrchestrationCommand.causes,
56054
+ defaultValue: [],
56055
+ optional: true
56056
+ },
56014
56057
  emits: {
56015
56058
  name: OrchestrationCommand.emits,
56016
56059
  optional: true
@@ -56057,6 +56100,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
56057
56100
  Precondition: {
56058
56101
  name: Precondition.$type,
56059
56102
  properties: {
56103
+ causes: {
56104
+ name: Precondition.causes,
56105
+ defaultValue: [],
56106
+ optional: true
56107
+ },
56060
56108
  description: {
56061
56109
  name: Precondition.description
56062
56110
  },
@@ -56156,6 +56204,11 @@ var MomentAstReflection = class extends AbstractAstReflection {
56156
56204
  name: SagaDeclaration.compensations,
56157
56205
  defaultValue: []
56158
56206
  },
56207
+ events: {
56208
+ name: SagaDeclaration.events,
56209
+ defaultValue: [],
56210
+ optional: true
56211
+ },
56159
56212
  gateways: {
56160
56213
  name: SagaDeclaration.gateways,
56161
56214
  defaultValue: [],
@@ -56368,7 +56421,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56368
56421
  "terminal": {
56369
56422
  "$type": "RuleCall",
56370
56423
  "rule": {
56371
- "$ref": "#/rules@52"
56424
+ "$ref": "#/rules@54"
56372
56425
  },
56373
56426
  "arguments": []
56374
56427
  }
@@ -56380,7 +56433,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56380
56433
  "terminal": {
56381
56434
  "$type": "RuleCall",
56382
56435
  "rule": {
56383
- "$ref": "#/rules@53"
56436
+ "$ref": "#/rules@55"
56384
56437
  },
56385
56438
  "arguments": []
56386
56439
  }
@@ -56421,7 +56474,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56421
56474
  "terminal": {
56422
56475
  "$type": "RuleCall",
56423
56476
  "rule": {
56424
- "$ref": "#/rules@52"
56477
+ "$ref": "#/rules@54"
56425
56478
  },
56426
56479
  "arguments": []
56427
56480
  }
@@ -56437,7 +56490,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56437
56490
  "terminal": {
56438
56491
  "$type": "RuleCall",
56439
56492
  "rule": {
56440
- "$ref": "#/rules@52"
56493
+ "$ref": "#/rules@54"
56441
56494
  },
56442
56495
  "arguments": []
56443
56496
  }
@@ -56453,7 +56506,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56453
56506
  "terminal": {
56454
56507
  "$type": "RuleCall",
56455
56508
  "rule": {
56456
- "$ref": "#/rules@52"
56509
+ "$ref": "#/rules@54"
56457
56510
  },
56458
56511
  "arguments": []
56459
56512
  }
@@ -56472,7 +56525,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56472
56525
  "terminal": {
56473
56526
  "$type": "RuleCall",
56474
56527
  "rule": {
56475
- "$ref": "#/rules@53"
56528
+ "$ref": "#/rules@55"
56476
56529
  },
56477
56530
  "arguments": []
56478
56531
  }
@@ -56503,7 +56556,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56503
56556
  "terminal": {
56504
56557
  "$type": "RuleCall",
56505
56558
  "rule": {
56506
- "$ref": "#/rules@53"
56559
+ "$ref": "#/rules@55"
56507
56560
  },
56508
56561
  "arguments": []
56509
56562
  }
@@ -56515,7 +56568,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56515
56568
  "terminal": {
56516
56569
  "$type": "RuleCall",
56517
56570
  "rule": {
56518
- "$ref": "#/rules@49"
56571
+ "$ref": "#/rules@51"
56519
56572
  },
56520
56573
  "arguments": []
56521
56574
  },
@@ -56535,7 +56588,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56535
56588
  "terminal": {
56536
56589
  "$type": "RuleCall",
56537
56590
  "rule": {
56538
- "$ref": "#/rules@53"
56591
+ "$ref": "#/rules@55"
56539
56592
  },
56540
56593
  "arguments": []
56541
56594
  }
@@ -56668,7 +56721,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56668
56721
  "terminal": {
56669
56722
  "$type": "RuleCall",
56670
56723
  "rule": {
56671
- "$ref": "#/rules@52"
56724
+ "$ref": "#/rules@54"
56672
56725
  },
56673
56726
  "arguments": []
56674
56727
  }
@@ -56684,7 +56737,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56684
56737
  "terminal": {
56685
56738
  "$type": "RuleCall",
56686
56739
  "rule": {
56687
- "$ref": "#/rules@52"
56740
+ "$ref": "#/rules@54"
56688
56741
  },
56689
56742
  "arguments": []
56690
56743
  }
@@ -56703,7 +56756,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56703
56756
  "terminal": {
56704
56757
  "$type": "RuleCall",
56705
56758
  "rule": {
56706
- "$ref": "#/rules@52"
56759
+ "$ref": "#/rules@54"
56707
56760
  },
56708
56761
  "arguments": []
56709
56762
  }
@@ -56725,7 +56778,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56725
56778
  "terminal": {
56726
56779
  "$type": "RuleCall",
56727
56780
  "rule": {
56728
- "$ref": "#/rules@53"
56781
+ "$ref": "#/rules@55"
56729
56782
  },
56730
56783
  "arguments": []
56731
56784
  }
@@ -56747,7 +56800,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56747
56800
  "terminal": {
56748
56801
  "$type": "RuleCall",
56749
56802
  "rule": {
56750
- "$ref": "#/rules@43"
56803
+ "$ref": "#/rules@45"
56751
56804
  },
56752
56805
  "arguments": []
56753
56806
  }
@@ -56791,7 +56844,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56791
56844
  "terminal": {
56792
56845
  "$type": "RuleCall",
56793
56846
  "rule": {
56794
- "$ref": "#/rules@52"
56847
+ "$ref": "#/rules@54"
56795
56848
  },
56796
56849
  "arguments": []
56797
56850
  }
@@ -56803,7 +56856,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56803
56856
  "terminal": {
56804
56857
  "$type": "RuleCall",
56805
56858
  "rule": {
56806
- "$ref": "#/rules@53"
56859
+ "$ref": "#/rules@55"
56807
56860
  },
56808
56861
  "arguments": []
56809
56862
  }
@@ -56822,7 +56875,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56822
56875
  "terminal": {
56823
56876
  "$type": "RuleCall",
56824
56877
  "rule": {
56825
- "$ref": "#/rules@52"
56878
+ "$ref": "#/rules@54"
56826
56879
  },
56827
56880
  "arguments": []
56828
56881
  }
@@ -56834,7 +56887,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56834
56887
  "terminal": {
56835
56888
  "$type": "RuleCall",
56836
56889
  "rule": {
56837
- "$ref": "#/rules@53"
56890
+ "$ref": "#/rules@55"
56838
56891
  },
56839
56892
  "arguments": []
56840
56893
  }
@@ -56864,7 +56917,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56864
56917
  "terminal": {
56865
56918
  "$type": "RuleCall",
56866
56919
  "rule": {
56867
- "$ref": "#/rules@53"
56920
+ "$ref": "#/rules@55"
56868
56921
  },
56869
56922
  "arguments": []
56870
56923
  }
@@ -56876,7 +56929,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56876
56929
  "terminal": {
56877
56930
  "$type": "RuleCall",
56878
56931
  "rule": {
56879
- "$ref": "#/rules@53"
56932
+ "$ref": "#/rules@55"
56880
56933
  },
56881
56934
  "arguments": []
56882
56935
  }
@@ -56904,7 +56957,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56904
56957
  "terminal": {
56905
56958
  "$type": "RuleCall",
56906
56959
  "rule": {
56907
- "$ref": "#/rules@52"
56960
+ "$ref": "#/rules@54"
56908
56961
  },
56909
56962
  "arguments": []
56910
56963
  }
@@ -56920,7 +56973,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56920
56973
  "terminal": {
56921
56974
  "$type": "RuleCall",
56922
56975
  "rule": {
56923
- "$ref": "#/rules@52"
56976
+ "$ref": "#/rules@54"
56924
56977
  },
56925
56978
  "arguments": []
56926
56979
  }
@@ -56939,7 +56992,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
56939
56992
  "terminal": {
56940
56993
  "$type": "RuleCall",
56941
56994
  "rule": {
56942
- "$ref": "#/rules@52"
56995
+ "$ref": "#/rules@54"
56943
56996
  },
56944
56997
  "arguments": []
56945
56998
  }
@@ -57005,7 +57058,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57005
57058
  "terminal": {
57006
57059
  "$type": "RuleCall",
57007
57060
  "rule": {
57008
- "$ref": "#/rules@53"
57061
+ "$ref": "#/rules@55"
57009
57062
  },
57010
57063
  "arguments": []
57011
57064
  }
@@ -57036,7 +57089,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57036
57089
  "terminal": {
57037
57090
  "$type": "RuleCall",
57038
57091
  "rule": {
57039
- "$ref": "#/rules@52"
57092
+ "$ref": "#/rules@54"
57040
57093
  },
57041
57094
  "arguments": []
57042
57095
  }
@@ -57077,14 +57130,14 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57077
57130
  {
57078
57131
  "$type": "RuleCall",
57079
57132
  "rule": {
57080
- "$ref": "#/rules@52"
57133
+ "$ref": "#/rules@54"
57081
57134
  },
57082
57135
  "arguments": []
57083
57136
  },
57084
57137
  {
57085
57138
  "$type": "RuleCall",
57086
57139
  "rule": {
57087
- "$ref": "#/rules@53"
57140
+ "$ref": "#/rules@55"
57088
57141
  },
57089
57142
  "arguments": []
57090
57143
  }
@@ -57111,7 +57164,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57111
57164
  "terminal": {
57112
57165
  "$type": "RuleCall",
57113
57166
  "rule": {
57114
- "$ref": "#/rules@53"
57167
+ "$ref": "#/rules@55"
57115
57168
  },
57116
57169
  "arguments": []
57117
57170
  }
@@ -57127,7 +57180,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57127
57180
  "terminal": {
57128
57181
  "$type": "RuleCall",
57129
57182
  "rule": {
57130
- "$ref": "#/rules@43"
57183
+ "$ref": "#/rules@45"
57131
57184
  },
57132
57185
  "arguments": []
57133
57186
  }
@@ -57243,7 +57296,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57243
57296
  "terminal": {
57244
57297
  "$type": "RuleCall",
57245
57298
  "rule": {
57246
- "$ref": "#/rules@52"
57299
+ "$ref": "#/rules@54"
57247
57300
  },
57248
57301
  "arguments": []
57249
57302
  }
@@ -57260,7 +57313,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57260
57313
  "terminal": {
57261
57314
  "$type": "RuleCall",
57262
57315
  "rule": {
57263
- "$ref": "#/rules@52"
57316
+ "$ref": "#/rules@54"
57264
57317
  },
57265
57318
  "arguments": []
57266
57319
  }
@@ -57276,7 +57329,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57276
57329
  "terminal": {
57277
57330
  "$type": "RuleCall",
57278
57331
  "rule": {
57279
- "$ref": "#/rules@52"
57332
+ "$ref": "#/rules@54"
57280
57333
  },
57281
57334
  "arguments": []
57282
57335
  }
@@ -57292,7 +57345,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57292
57345
  "terminal": {
57293
57346
  "$type": "RuleCall",
57294
57347
  "rule": {
57295
- "$ref": "#/rules@52"
57348
+ "$ref": "#/rules@54"
57296
57349
  },
57297
57350
  "arguments": []
57298
57351
  }
@@ -57324,7 +57377,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57324
57377
  "terminal": {
57325
57378
  "$type": "RuleCall",
57326
57379
  "rule": {
57327
- "$ref": "#/rules@52"
57380
+ "$ref": "#/rules@54"
57328
57381
  },
57329
57382
  "arguments": []
57330
57383
  }
@@ -57373,6 +57426,50 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57373
57426
  ],
57374
57427
  "cardinality": "?"
57375
57428
  },
57429
+ {
57430
+ "$type": "Group",
57431
+ "elements": [
57432
+ {
57433
+ "$type": "Keyword",
57434
+ "value": "causes"
57435
+ },
57436
+ {
57437
+ "$type": "Assignment",
57438
+ "feature": "causes",
57439
+ "operator": "+=",
57440
+ "terminal": {
57441
+ "$type": "RuleCall",
57442
+ "rule": {
57443
+ "$ref": "#/rules@54"
57444
+ },
57445
+ "arguments": []
57446
+ }
57447
+ },
57448
+ {
57449
+ "$type": "Group",
57450
+ "elements": [
57451
+ {
57452
+ "$type": "Keyword",
57453
+ "value": ","
57454
+ },
57455
+ {
57456
+ "$type": "Assignment",
57457
+ "feature": "causes",
57458
+ "operator": "+=",
57459
+ "terminal": {
57460
+ "$type": "RuleCall",
57461
+ "rule": {
57462
+ "$ref": "#/rules@54"
57463
+ },
57464
+ "arguments": []
57465
+ }
57466
+ }
57467
+ ],
57468
+ "cardinality": "*"
57469
+ }
57470
+ ],
57471
+ "cardinality": "?"
57472
+ },
57376
57473
  {
57377
57474
  "$type": "Assignment",
57378
57475
  "feature": "preconditions",
@@ -57397,7 +57494,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57397
57494
  "terminal": {
57398
57495
  "$type": "RuleCall",
57399
57496
  "rule": {
57400
- "$ref": "#/rules@52"
57497
+ "$ref": "#/rules@54"
57401
57498
  },
57402
57499
  "arguments": []
57403
57500
  }
@@ -57421,7 +57518,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57421
57518
  "terminal": {
57422
57519
  "$type": "RuleCall",
57423
57520
  "rule": {
57424
- "$ref": "#/rules@45"
57521
+ "$ref": "#/rules@47"
57425
57522
  },
57426
57523
  "arguments": []
57427
57524
  }
@@ -57437,7 +57534,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57437
57534
  "terminal": {
57438
57535
  "$type": "RuleCall",
57439
57536
  "rule": {
57440
- "$ref": "#/rules@47"
57537
+ "$ref": "#/rules@49"
57441
57538
  },
57442
57539
  "arguments": []
57443
57540
  }
@@ -57449,7 +57546,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57449
57546
  "terminal": {
57450
57547
  "$type": "RuleCall",
57451
57548
  "rule": {
57452
- "$ref": "#/rules@44"
57549
+ "$ref": "#/rules@46"
57453
57550
  },
57454
57551
  "arguments": []
57455
57552
  },
@@ -57478,11 +57575,55 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57478
57575
  "terminal": {
57479
57576
  "$type": "RuleCall",
57480
57577
  "rule": {
57481
- "$ref": "#/rules@52"
57578
+ "$ref": "#/rules@54"
57482
57579
  },
57483
57580
  "arguments": []
57484
57581
  }
57485
57582
  },
57583
+ {
57584
+ "$type": "Group",
57585
+ "elements": [
57586
+ {
57587
+ "$type": "Keyword",
57588
+ "value": "cause"
57589
+ },
57590
+ {
57591
+ "$type": "Assignment",
57592
+ "feature": "causes",
57593
+ "operator": "+=",
57594
+ "terminal": {
57595
+ "$type": "RuleCall",
57596
+ "rule": {
57597
+ "$ref": "#/rules@54"
57598
+ },
57599
+ "arguments": []
57600
+ }
57601
+ },
57602
+ {
57603
+ "$type": "Group",
57604
+ "elements": [
57605
+ {
57606
+ "$type": "Keyword",
57607
+ "value": ","
57608
+ },
57609
+ {
57610
+ "$type": "Assignment",
57611
+ "feature": "causes",
57612
+ "operator": "+=",
57613
+ "terminal": {
57614
+ "$type": "RuleCall",
57615
+ "rule": {
57616
+ "$ref": "#/rules@54"
57617
+ },
57618
+ "arguments": []
57619
+ }
57620
+ }
57621
+ ],
57622
+ "cardinality": "*"
57623
+ }
57624
+ ],
57625
+ "cardinality": "?"
57626
+ },
57486
57627
  {
57487
57628
  "$type": "Keyword",
57488
57629
  "value": ":"
@@ -57494,7 +57635,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57494
57635
  "terminal": {
57495
57636
  "$type": "RuleCall",
57496
57637
  "rule": {
57497
- "$ref": "#/rules@53"
57638
+ "$ref": "#/rules@55"
57498
57639
  },
57499
57640
  "arguments": []
57500
57641
  }
@@ -57522,7 +57663,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57522
57663
  "terminal": {
57523
57664
  "$type": "RuleCall",
57524
57665
  "rule": {
57525
- "$ref": "#/rules@52"
57666
+ "$ref": "#/rules@54"
57526
57667
  },
57527
57668
  "arguments": []
57528
57669
  }
@@ -57534,7 +57675,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57534
57675
  "terminal": {
57535
57676
  "$type": "RuleCall",
57536
57677
  "rule": {
57537
- "$ref": "#/rules@43"
57678
+ "$ref": "#/rules@45"
57538
57679
  },
57539
57680
  "arguments": []
57540
57681
  },
@@ -57563,7 +57704,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57563
57704
  "terminal": {
57564
57705
  "$type": "RuleCall",
57565
57706
  "rule": {
57566
- "$ref": "#/rules@52"
57707
+ "$ref": "#/rules@54"
57567
57708
  },
57568
57709
  "arguments": []
57569
57710
  }
@@ -57575,7 +57716,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57575
57716
  "terminal": {
57576
57717
  "$type": "RuleCall",
57577
57718
  "rule": {
57578
- "$ref": "#/rules@43"
57719
+ "$ref": "#/rules@45"
57579
57720
  },
57580
57721
  "arguments": []
57581
57722
  },
@@ -57604,7 +57745,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57604
57745
  "terminal": {
57605
57746
  "$type": "RuleCall",
57606
57747
  "rule": {
57607
- "$ref": "#/rules@52"
57748
+ "$ref": "#/rules@54"
57608
57749
  },
57609
57750
  "arguments": []
57610
57751
  }
@@ -57616,7 +57757,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57616
57757
  "terminal": {
57617
57758
  "$type": "RuleCall",
57618
57759
  "rule": {
57619
- "$ref": "#/rules@53"
57760
+ "$ref": "#/rules@55"
57620
57761
  },
57621
57762
  "arguments": []
57622
57763
  }
@@ -57632,7 +57773,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57632
57773
  "terminal": {
57633
57774
  "$type": "RuleCall",
57634
57775
  "rule": {
57635
- "$ref": "#/rules@52"
57776
+ "$ref": "#/rules@54"
57636
57777
  },
57637
57778
  "arguments": []
57638
57779
  }
@@ -57660,7 +57801,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57660
57801
  "terminal": {
57661
57802
  "$type": "RuleCall",
57662
57803
  "rule": {
57663
- "$ref": "#/rules@52"
57804
+ "$ref": "#/rules@54"
57664
57805
  },
57665
57806
  "arguments": []
57666
57807
  }
@@ -57676,7 +57817,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57676
57817
  "terminal": {
57677
57818
  "$type": "RuleCall",
57678
57819
  "rule": {
57679
- "$ref": "#/rules@52"
57820
+ "$ref": "#/rules@54"
57680
57821
  },
57681
57822
  "arguments": []
57682
57823
  }
@@ -57692,7 +57833,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57692
57833
  "terminal": {
57693
57834
  "$type": "RuleCall",
57694
57835
  "rule": {
57695
- "$ref": "#/rules@52"
57836
+ "$ref": "#/rules@54"
57696
57837
  },
57697
57838
  "arguments": []
57698
57839
  }
@@ -57708,7 +57849,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57708
57849
  "terminal": {
57709
57850
  "$type": "RuleCall",
57710
57851
  "rule": {
57711
- "$ref": "#/rules@53"
57852
+ "$ref": "#/rules@55"
57712
57853
  },
57713
57854
  "arguments": []
57714
57855
  }
@@ -57736,7 +57877,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57736
57877
  "terminal": {
57737
57878
  "$type": "RuleCall",
57738
57879
  "rule": {
57739
- "$ref": "#/rules@52"
57880
+ "$ref": "#/rules@54"
57740
57881
  },
57741
57882
  "arguments": []
57742
57883
  }
@@ -57752,7 +57893,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57752
57893
  "terminal": {
57753
57894
  "$type": "RuleCall",
57754
57895
  "rule": {
57755
- "$ref": "#/rules@52"
57896
+ "$ref": "#/rules@54"
57756
57897
  },
57757
57898
  "arguments": []
57758
57899
  }
@@ -57768,7 +57909,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57768
57909
  "terminal": {
57769
57910
  "$type": "RuleCall",
57770
57911
  "rule": {
57771
- "$ref": "#/rules@53"
57912
+ "$ref": "#/rules@55"
57772
57913
  },
57773
57914
  "arguments": []
57774
57915
  }
@@ -57784,7 +57925,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57784
57925
  "terminal": {
57785
57926
  "$type": "RuleCall",
57786
57927
  "rule": {
57787
- "$ref": "#/rules@52"
57928
+ "$ref": "#/rules@54"
57788
57929
  },
57789
57930
  "arguments": []
57790
57931
  }
@@ -57839,7 +57980,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57839
57980
  "terminal": {
57840
57981
  "$type": "RuleCall",
57841
57982
  "rule": {
57842
- "$ref": "#/rules@52"
57983
+ "$ref": "#/rules@54"
57843
57984
  },
57844
57985
  "arguments": []
57845
57986
  }
@@ -57857,6 +57998,19 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57857
57998
  },
57858
57999
  "cardinality": "*"
57859
58000
  },
58001
+ {
58002
+ "$type": "Assignment",
58003
+ "feature": "events",
58004
+ "operator": "+=",
58005
+ "terminal": {
58006
+ "$type": "RuleCall",
58007
+ "rule": {
58008
+ "$ref": "#/rules@17"
58009
+ },
58010
+ "arguments": []
58011
+ },
58012
+ "cardinality": "*"
58013
+ },
57860
58014
  {
57861
58015
  "$type": "Keyword",
57862
58016
  "value": "invoked-by"
@@ -57868,7 +58022,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57868
58022
  "terminal": {
57869
58023
  "$type": "RuleCall",
57870
58024
  "rule": {
57871
- "$ref": "#/rules@52"
58025
+ "$ref": "#/rules@54"
57872
58026
  },
57873
58027
  "arguments": []
57874
58028
  }
@@ -57922,7 +58076,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
57922
58076
  "terminal": {
57923
58077
  "$type": "RuleCall",
57924
58078
  "rule": {
57925
- "$ref": "#/rules@52"
58079
+ "$ref": "#/rules@54"
57926
58080
  },
57927
58081
  "arguments": []
57928
58082
  }
@@ -58005,7 +58159,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58005
58159
  "terminal": {
58006
58160
  "$type": "RuleCall",
58007
58161
  "rule": {
58008
- "$ref": "#/rules@52"
58162
+ "$ref": "#/rules@54"
58009
58163
  },
58010
58164
  "arguments": []
58011
58165
  }
@@ -58054,6 +58208,50 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58054
58208
  ],
58055
58209
  "cardinality": "?"
58056
58210
  },
58211
+ {
58212
+ "$type": "Group",
58213
+ "elements": [
58214
+ {
58215
+ "$type": "Keyword",
58216
+ "value": "causes"
58217
+ },
58218
+ {
58219
+ "$type": "Assignment",
58220
+ "feature": "causes",
58221
+ "operator": "+=",
58222
+ "terminal": {
58223
+ "$type": "RuleCall",
58224
+ "rule": {
58225
+ "$ref": "#/rules@54"
58226
+ },
58227
+ "arguments": []
58228
+ }
58229
+ },
58230
+ {
58231
+ "$type": "Group",
58232
+ "elements": [
58233
+ {
58234
+ "$type": "Keyword",
58235
+ "value": ","
58236
+ },
58237
+ {
58238
+ "$type": "Assignment",
58239
+ "feature": "causes",
58240
+ "operator": "+=",
58241
+ "terminal": {
58242
+ "$type": "RuleCall",
58243
+ "rule": {
58244
+ "$ref": "#/rules@54"
58245
+ },
58246
+ "arguments": []
58247
+ }
58248
+ }
58249
+ ],
58250
+ "cardinality": "*"
58251
+ }
58252
+ ],
58253
+ "cardinality": "?"
58254
+ },
58057
58255
  {
58058
58256
  "$type": "Assignment",
58059
58257
  "feature": "preconditions",
@@ -58081,7 +58279,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58081
58279
  "terminal": {
58082
58280
  "$type": "RuleCall",
58083
58281
  "rule": {
58084
- "$ref": "#/rules@52"
58282
+ "$ref": "#/rules@54"
58085
58283
  },
58086
58284
  "arguments": []
58087
58285
  }
@@ -58108,7 +58306,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58108
58306
  "terminal": {
58109
58307
  "$type": "RuleCall",
58110
58308
  "rule": {
58111
- "$ref": "#/rules@52"
58309
+ "$ref": "#/rules@54"
58112
58310
  },
58113
58311
  "arguments": []
58114
58312
  }
@@ -58127,7 +58325,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58127
58325
  "terminal": {
58128
58326
  "$type": "RuleCall",
58129
58327
  "rule": {
58130
- "$ref": "#/rules@52"
58328
+ "$ref": "#/rules@54"
58131
58329
  },
58132
58330
  "arguments": []
58133
58331
  }
@@ -58158,7 +58356,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58158
58356
  "terminal": {
58159
58357
  "$type": "RuleCall",
58160
58358
  "rule": {
58161
- "$ref": "#/rules@52"
58359
+ "$ref": "#/rules@54"
58162
58360
  },
58163
58361
  "arguments": []
58164
58362
  }
@@ -58177,7 +58375,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58177
58375
  "terminal": {
58178
58376
  "$type": "RuleCall",
58179
58377
  "rule": {
58180
- "$ref": "#/rules@52"
58378
+ "$ref": "#/rules@54"
58181
58379
  },
58182
58380
  "arguments": []
58183
58381
  }
@@ -58227,7 +58425,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58227
58425
  "terminal": {
58228
58426
  "$type": "RuleCall",
58229
58427
  "rule": {
58230
- "$ref": "#/rules@52"
58428
+ "$ref": "#/rules@54"
58231
58429
  },
58232
58430
  "arguments": []
58233
58431
  }
@@ -58293,7 +58491,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58293
58491
  "terminal": {
58294
58492
  "$type": "RuleCall",
58295
58493
  "rule": {
58296
- "$ref": "#/rules@52"
58494
+ "$ref": "#/rules@54"
58297
58495
  },
58298
58496
  "arguments": []
58299
58497
  }
@@ -58330,7 +58528,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58330
58528
  "terminal": {
58331
58529
  "$type": "RuleCall",
58332
58530
  "rule": {
58333
- "$ref": "#/rules@52"
58531
+ "$ref": "#/rules@54"
58334
58532
  },
58335
58533
  "arguments": []
58336
58534
  }
@@ -58346,7 +58544,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58346
58544
  "terminal": {
58347
58545
  "$type": "RuleCall",
58348
58546
  "rule": {
58349
- "$ref": "#/rules@52"
58547
+ "$ref": "#/rules@54"
58350
58548
  },
58351
58549
  "arguments": []
58352
58550
  }
@@ -58362,7 +58560,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58362
58560
  "terminal": {
58363
58561
  "$type": "RuleCall",
58364
58562
  "rule": {
58365
- "$ref": "#/rules@51"
58563
+ "$ref": "#/rules@53"
58366
58564
  },
58367
58565
  "arguments": []
58368
58566
  }
@@ -58378,7 +58576,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58378
58576
  "terminal": {
58379
58577
  "$type": "RuleCall",
58380
58578
  "rule": {
58381
- "$ref": "#/rules@53"
58579
+ "$ref": "#/rules@55"
58382
58580
  },
58383
58581
  "arguments": []
58384
58582
  }
@@ -58406,7 +58604,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58406
58604
  "terminal": {
58407
58605
  "$type": "RuleCall",
58408
58606
  "rule": {
58409
- "$ref": "#/rules@53"
58607
+ "$ref": "#/rules@55"
58410
58608
  },
58411
58609
  "arguments": []
58412
58610
  }
@@ -58425,7 +58623,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58425
58623
  "terminal": {
58426
58624
  "$type": "RuleCall",
58427
58625
  "rule": {
58428
- "$ref": "#/rules@53"
58626
+ "$ref": "#/rules@55"
58429
58627
  },
58430
58628
  "arguments": []
58431
58629
  }
@@ -58496,7 +58694,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58496
58694
  "terminal": {
58497
58695
  "$type": "RuleCall",
58498
58696
  "rule": {
58499
- "$ref": "#/rules@52"
58697
+ "$ref": "#/rules@35"
58500
58698
  },
58501
58699
  "arguments": []
58502
58700
  }
@@ -58508,7 +58706,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58508
58706
  "terminal": {
58509
58707
  "$type": "RuleCall",
58510
58708
  "rule": {
58511
- "$ref": "#/rules@53"
58709
+ "$ref": "#/rules@55"
58512
58710
  },
58513
58711
  "arguments": []
58514
58712
  }
@@ -58520,7 +58718,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58520
58718
  "terminal": {
58521
58719
  "$type": "RuleCall",
58522
58720
  "rule": {
58523
- "$ref": "#/rules@49"
58721
+ "$ref": "#/rules@51"
58524
58722
  },
58525
58723
  "arguments": []
58526
58724
  },
@@ -58549,7 +58747,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58549
58747
  "terminal": {
58550
58748
  "$type": "RuleCall",
58551
58749
  "rule": {
58552
- "$ref": "#/rules@53"
58750
+ "$ref": "#/rules@55"
58553
58751
  },
58554
58752
  "arguments": []
58555
58753
  }
@@ -58574,7 +58772,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58574
58772
  "terminal": {
58575
58773
  "$type": "RuleCall",
58576
58774
  "rule": {
58577
- "$ref": "#/rules@33"
58775
+ "$ref": "#/rules@34"
58578
58776
  },
58579
58777
  "arguments": []
58580
58778
  }
@@ -58583,6 +58781,18 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58583
58781
  "$type": "Assignment",
58584
58782
  "feature": "whenBlocks",
58585
58783
  "operator": "+=",
58784
+ "terminal": {
58785
+ "$type": "RuleCall",
58786
+ "rule": {
58787
+ "$ref": "#/rules@33"
58788
+ },
58789
+ "arguments": []
58790
+ }
58791
+ },
58792
+ {
58793
+ "$type": "Assignment",
58794
+ "feature": "notes",
58795
+ "operator": "+=",
58586
58796
  "terminal": {
58587
58797
  "$type": "RuleCall",
58588
58798
  "rule": {
@@ -58592,7 +58802,57 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58592
58802
  }
58593
58803
  }
58594
58804
  ],
58595
- "cardinality": "*"
58805
+ "cardinality": "*"
58806
+ }
58807
+ ]
58808
+ },
58809
+ "entry": false,
58810
+ "fragment": false,
58811
+ "parameters": []
58812
+ },
58813
+ {
58814
+ "$type": "ParserRule",
58815
+ "name": "NoteStatement",
58816
+ "definition": {
58817
+ "$type": "Group",
58818
+ "elements": [
58819
+ {
58820
+ "$type": "Keyword",
58821
+ "value": "note"
58822
+ },
58823
+ {
58824
+ "$type": "Group",
58825
+ "elements": [
58826
+ {
58827
+ "$type": "Assignment",
58828
+ "feature": "laneId",
58829
+ "operator": "=",
58830
+ "terminal": {
58831
+ "$type": "RuleCall",
58832
+ "rule": {
58833
+ "$ref": "#/rules@35"
58834
+ },
58835
+ "arguments": []
58836
+ }
58837
+ },
58838
+ {
58839
+ "$type": "Keyword",
58840
+ "value": ":"
58841
+ }
58842
+ ],
58843
+ "cardinality": "?"
58844
+ },
58845
+ {
58846
+ "$type": "Assignment",
58847
+ "feature": "text",
58848
+ "operator": "=",
58849
+ "terminal": {
58850
+ "$type": "RuleCall",
58851
+ "rule": {
58852
+ "$ref": "#/rules@55"
58853
+ },
58854
+ "arguments": []
58855
+ }
58596
58856
  }
58597
58857
  ]
58598
58858
  },
@@ -58617,7 +58877,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58617
58877
  "terminal": {
58618
58878
  "$type": "RuleCall",
58619
58879
  "rule": {
58620
- "$ref": "#/rules@52"
58880
+ "$ref": "#/rules@54"
58621
58881
  },
58622
58882
  "arguments": []
58623
58883
  }
@@ -58636,7 +58896,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58636
58896
  "terminal": {
58637
58897
  "$type": "RuleCall",
58638
58898
  "rule": {
58639
- "$ref": "#/rules@52"
58899
+ "$ref": "#/rules@35"
58640
58900
  },
58641
58901
  "arguments": []
58642
58902
  }
@@ -58655,7 +58915,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58655
58915
  "terminal": {
58656
58916
  "$type": "RuleCall",
58657
58917
  "rule": {
58658
- "$ref": "#/rules@33"
58918
+ "$ref": "#/rules@34"
58659
58919
  },
58660
58920
  "arguments": []
58661
58921
  },
@@ -58680,7 +58940,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58680
58940
  "terminal": {
58681
58941
  "$type": "RuleCall",
58682
58942
  "rule": {
58683
- "$ref": "#/rules@52"
58943
+ "$ref": "#/rules@35"
58684
58944
  },
58685
58945
  "arguments": []
58686
58946
  }
@@ -58696,7 +58956,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58696
58956
  "terminal": {
58697
58957
  "$type": "RuleCall",
58698
58958
  "rule": {
58699
- "$ref": "#/rules@52"
58959
+ "$ref": "#/rules@54"
58700
58960
  },
58701
58961
  "arguments": []
58702
58962
  }
@@ -58708,7 +58968,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58708
58968
  "terminal": {
58709
58969
  "$type": "RuleCall",
58710
58970
  "rule": {
58711
- "$ref": "#/rules@34"
58971
+ "$ref": "#/rules@36"
58712
58972
  },
58713
58973
  "arguments": []
58714
58974
  },
@@ -58721,12 +58981,34 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58721
58981
  "terminal": {
58722
58982
  "$type": "RuleCall",
58723
58983
  "rule": {
58724
- "$ref": "#/rules@35"
58984
+ "$ref": "#/rules@37"
58725
58985
  },
58726
58986
  "arguments": []
58727
58987
  },
58728
58988
  "cardinality": "?"
58729
58989
  },
58990
+ {
58991
+ "$type": "Group",
58992
+ "elements": [
58993
+ {
58994
+ "$type": "Keyword",
58995
+ "value": "cause"
58996
+ },
58997
+ {
58998
+ "$type": "Assignment",
58999
+ "feature": "cause",
59000
+ "operator": "=",
59001
+ "terminal": {
59002
+ "$type": "RuleCall",
59003
+ "rule": {
59004
+ "$ref": "#/rules@54"
59005
+ },
59006
+ "arguments": []
59007
+ }
59008
+ }
59009
+ ],
59010
+ "cardinality": "?"
59011
+ },
58730
59012
  {
58731
59013
  "$type": "Assignment",
58732
59014
  "feature": "crossing",
@@ -58734,7 +59016,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58734
59016
  "terminal": {
58735
59017
  "$type": "RuleCall",
58736
59018
  "rule": {
58737
- "$ref": "#/rules@38"
59019
+ "$ref": "#/rules@40"
58738
59020
  },
58739
59021
  "arguments": []
58740
59022
  },
@@ -58747,7 +59029,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58747
59029
  "terminal": {
58748
59030
  "$type": "RuleCall",
58749
59031
  "rule": {
58750
- "$ref": "#/rules@37"
59032
+ "$ref": "#/rules@39"
58751
59033
  },
58752
59034
  "arguments": []
58753
59035
  },
@@ -58759,6 +59041,38 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58759
59041
  "fragment": false,
58760
59042
  "parameters": []
58761
59043
  },
59044
+ {
59045
+ "$type": "ParserRule",
59046
+ "name": "LaneName",
59047
+ "dataType": "string",
59048
+ "definition": {
59049
+ "$type": "Alternatives",
59050
+ "elements": [
59051
+ {
59052
+ "$type": "RuleCall",
59053
+ "rule": {
59054
+ "$ref": "#/rules@54"
59055
+ },
59056
+ "arguments": []
59057
+ },
59058
+ {
59059
+ "$type": "Keyword",
59060
+ "value": "cause"
59061
+ },
59062
+ {
59063
+ "$type": "Keyword",
59064
+ "value": "causes"
59065
+ },
59066
+ {
59067
+ "$type": "Keyword",
59068
+ "value": "note"
59069
+ }
59070
+ ]
59071
+ },
59072
+ "entry": false,
59073
+ "fragment": false,
59074
+ "parameters": []
59075
+ },
58762
59076
  {
58763
59077
  "$type": "ParserRule",
58764
59078
  "name": "Multiplicity",
@@ -58783,7 +59097,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58783
59097
  "terminal": {
58784
59098
  "$type": "RuleCall",
58785
59099
  "rule": {
58786
- "$ref": "#/rules@54"
59100
+ "$ref": "#/rules@56"
58787
59101
  },
58788
59102
  "arguments": []
58789
59103
  }
@@ -58795,7 +59109,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58795
59109
  "terminal": {
58796
59110
  "$type": "RuleCall",
58797
59111
  "rule": {
58798
- "$ref": "#/rules@52"
59112
+ "$ref": "#/rules@54"
58799
59113
  },
58800
59114
  "arguments": []
58801
59115
  }
@@ -58829,7 +59143,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58829
59143
  "terminal": {
58830
59144
  "$type": "RuleCall",
58831
59145
  "rule": {
58832
- "$ref": "#/rules@36"
59146
+ "$ref": "#/rules@38"
58833
59147
  },
58834
59148
  "arguments": []
58835
59149
  }
@@ -58874,21 +59188,21 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58874
59188
  {
58875
59189
  "$type": "RuleCall",
58876
59190
  "rule": {
58877
- "$ref": "#/rules@40"
59191
+ "$ref": "#/rules@42"
58878
59192
  },
58879
59193
  "arguments": []
58880
59194
  },
58881
59195
  {
58882
59196
  "$type": "RuleCall",
58883
59197
  "rule": {
58884
- "$ref": "#/rules@41"
59198
+ "$ref": "#/rules@43"
58885
59199
  },
58886
59200
  "arguments": []
58887
59201
  },
58888
59202
  {
58889
59203
  "$type": "RuleCall",
58890
59204
  "rule": {
58891
- "$ref": "#/rules@42"
59205
+ "$ref": "#/rules@44"
58892
59206
  },
58893
59207
  "arguments": []
58894
59208
  }
@@ -58915,7 +59229,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58915
59229
  "terminal": {
58916
59230
  "$type": "RuleCall",
58917
59231
  "rule": {
58918
- "$ref": "#/rules@52"
59232
+ "$ref": "#/rules@35"
58919
59233
  },
58920
59234
  "arguments": []
58921
59235
  }
@@ -58931,7 +59245,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58931
59245
  "terminal": {
58932
59246
  "$type": "RuleCall",
58933
59247
  "rule": {
58934
- "$ref": "#/rules@51"
59248
+ "$ref": "#/rules@53"
58935
59249
  },
58936
59250
  "arguments": []
58937
59251
  }
@@ -58947,7 +59261,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58947
59261
  "terminal": {
58948
59262
  "$type": "RuleCall",
58949
59263
  "rule": {
58950
- "$ref": "#/rules@39"
59264
+ "$ref": "#/rules@41"
58951
59265
  },
58952
59266
  "arguments": []
58953
59267
  },
@@ -58972,7 +59286,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58972
59286
  "terminal": {
58973
59287
  "$type": "RuleCall",
58974
59288
  "rule": {
58975
- "$ref": "#/rules@52"
59289
+ "$ref": "#/rules@54"
58976
59290
  },
58977
59291
  "arguments": []
58978
59292
  }
@@ -58988,7 +59302,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
58988
59302
  "terminal": {
58989
59303
  "$type": "RuleCall",
58990
59304
  "rule": {
58991
- "$ref": "#/rules@47"
59305
+ "$ref": "#/rules@49"
58992
59306
  },
58993
59307
  "arguments": []
58994
59308
  }
@@ -59026,7 +59340,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59026
59340
  "terminal": {
59027
59341
  "$type": "RuleCall",
59028
59342
  "rule": {
59029
- "$ref": "#/rules@52"
59343
+ "$ref": "#/rules@54"
59030
59344
  },
59031
59345
  "arguments": []
59032
59346
  }
@@ -59054,7 +59368,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59054
59368
  "terminal": {
59055
59369
  "$type": "RuleCall",
59056
59370
  "rule": {
59057
- "$ref": "#/rules@52"
59371
+ "$ref": "#/rules@54"
59058
59372
  },
59059
59373
  "arguments": []
59060
59374
  }
@@ -59082,7 +59396,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59082
59396
  "terminal": {
59083
59397
  "$type": "RuleCall",
59084
59398
  "rule": {
59085
- "$ref": "#/rules@53"
59399
+ "$ref": "#/rules@55"
59086
59400
  },
59087
59401
  "arguments": []
59088
59402
  }
@@ -59106,7 +59420,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59106
59420
  "terminal": {
59107
59421
  "$type": "RuleCall",
59108
59422
  "rule": {
59109
- "$ref": "#/rules@46"
59423
+ "$ref": "#/rules@48"
59110
59424
  },
59111
59425
  "arguments": []
59112
59426
  }
@@ -59122,7 +59436,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59122
59436
  "terminal": {
59123
59437
  "$type": "RuleCall",
59124
59438
  "rule": {
59125
- "$ref": "#/rules@47"
59439
+ "$ref": "#/rules@49"
59126
59440
  },
59127
59441
  "arguments": []
59128
59442
  }
@@ -59134,7 +59448,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59134
59448
  "terminal": {
59135
59449
  "$type": "RuleCall",
59136
59450
  "rule": {
59137
- "$ref": "#/rules@44"
59451
+ "$ref": "#/rules@46"
59138
59452
  },
59139
59453
  "arguments": []
59140
59454
  },
@@ -59167,7 +59481,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59167
59481
  "terminal": {
59168
59482
  "$type": "RuleCall",
59169
59483
  "rule": {
59170
- "$ref": "#/rules@53"
59484
+ "$ref": "#/rules@55"
59171
59485
  },
59172
59486
  "arguments": []
59173
59487
  }
@@ -59183,7 +59497,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59183
59497
  "terminal": {
59184
59498
  "$type": "RuleCall",
59185
59499
  "rule": {
59186
- "$ref": "#/rules@53"
59500
+ "$ref": "#/rules@55"
59187
59501
  },
59188
59502
  "arguments": []
59189
59503
  }
@@ -59208,7 +59522,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59208
59522
  {
59209
59523
  "$type": "RuleCall",
59210
59524
  "rule": {
59211
- "$ref": "#/rules@46"
59525
+ "$ref": "#/rules@48"
59212
59526
  },
59213
59527
  "arguments": []
59214
59528
  },
@@ -59244,7 +59558,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59244
59558
  {
59245
59559
  "$type": "RuleCall",
59246
59560
  "rule": {
59247
- "$ref": "#/rules@52"
59561
+ "$ref": "#/rules@54"
59248
59562
  },
59249
59563
  "arguments": []
59250
59564
  },
@@ -59287,6 +59601,18 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59287
59601
  {
59288
59602
  "$type": "Keyword",
59289
59603
  "value": "invoked-by"
59604
+ },
59605
+ {
59606
+ "$type": "Keyword",
59607
+ "value": "cause"
59608
+ },
59609
+ {
59610
+ "$type": "Keyword",
59611
+ "value": "causes"
59612
+ },
59613
+ {
59614
+ "$type": "Keyword",
59615
+ "value": "note"
59290
59616
  }
59291
59617
  ]
59292
59618
  },
@@ -59307,7 +59633,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59307
59633
  "terminal": {
59308
59634
  "$type": "RuleCall",
59309
59635
  "rule": {
59310
- "$ref": "#/rules@48"
59636
+ "$ref": "#/rules@50"
59311
59637
  },
59312
59638
  "arguments": []
59313
59639
  }
@@ -59366,7 +59692,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59366
59692
  {
59367
59693
  "$type": "RuleCall",
59368
59694
  "rule": {
59369
- "$ref": "#/rules@52"
59695
+ "$ref": "#/rules@54"
59370
59696
  },
59371
59697
  "arguments": []
59372
59698
  }
@@ -59393,7 +59719,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59393
59719
  "terminal": {
59394
59720
  "$type": "RuleCall",
59395
59721
  "rule": {
59396
- "$ref": "#/rules@50"
59722
+ "$ref": "#/rules@52"
59397
59723
  },
59398
59724
  "arguments": []
59399
59725
  }
@@ -59479,7 +59805,7 @@ var MomentGrammar = () => loadedMomentGrammar ?? (loadedMomentGrammar = loadGram
59479
59805
  {
59480
59806
  "$type": "RuleCall",
59481
59807
  "rule": {
59482
- "$ref": "#/rules@52"
59808
+ "$ref": "#/rules@54"
59483
59809
  },
59484
59810
  "arguments": []
59485
59811
  }
@@ -59590,6 +59916,9 @@ function buildMomentSequence(moment) {
59590
59916
  moment.whenBlocks.forEach((block2, index) => {
59591
59917
  positioned.push({ item: { kind: "branch", index }, offset: block2.$cstNode?.offset });
59592
59918
  });
59919
+ (moment.notes ?? []).forEach((note, index) => {
59920
+ positioned.push({ item: { kind: "note", index }, offset: note.$cstNode?.offset });
59921
+ });
59593
59922
  const fromCst = positioned.every((p) => p.offset !== void 0);
59594
59923
  if (!fromCst) {
59595
59924
  return { sequence: positioned.map((p) => p.item), fromCst: false };
@@ -59613,6 +59942,15 @@ function aggregateBlocks(agg, events) {
59613
59942
  }
59614
59943
  return blocks;
59615
59944
  }
59945
+ function sagaBlocks(saga, events) {
59946
+ return [
59947
+ ...saga.commands.map((c) => ({ name: c.name, kind: "command" })),
59948
+ ...saga.events.map((e) => {
59949
+ events.push(e.name);
59950
+ return { name: e.name, kind: "event" };
59951
+ })
59952
+ ];
59953
+ }
59616
59954
  function contextMemberBlock(member) {
59617
59955
  if (isPolicyDeclaration(member))
59618
59956
  return { name: member.name, kind: "policy" };
@@ -59646,6 +59984,8 @@ function buildCrossFileContext(file) {
59646
59984
  blocks.push(block2);
59647
59985
  if (block2?.kind === "saga")
59648
59986
  declaredSagas.push(block2.name);
59987
+ if (isSagaDeclaration(member))
59988
+ blocks.push(...sagaBlocks(member, events));
59649
59989
  }
59650
59990
  declaredEvents.set(contextName, events);
59651
59991
  declaredBuildingBlocks.set(contextName, blocks);
@@ -59662,6 +60002,7 @@ function registerMomentValidationChecks(services) {
59662
60002
  AnnotationDeclaration: validator.checkAnnotationName,
59663
60003
  ContextDeclaration: validator.checkTrailingAnnotation,
59664
60004
  AggregateDeclaration: validator.checkTrailingAnnotation,
60005
+ NoteStatement: validator.checkNoteLane,
59665
60006
  NodePlacement: [
59666
60007
  validator.checkNodePlacement,
59667
60008
  validator.checkOptionalWithCrossing,
@@ -59837,11 +60178,25 @@ var MomentValidator = class {
59837
60178
  }
59838
60179
  }
59839
60180
  // =========================================================================
59840
- // V10: Moment with zero nodes AND zero whenBlocks -> error
60181
+ // V13 for notes: a lane named by `note <lane>: "text"` must be a declared lane (ADR-040 D3)
60182
+ // =========================================================================
60183
+ checkNoteLane(note, accept) {
60184
+ const flow = getFlowFromNode(note);
60185
+ if (note.laneId === void 0 || !flow)
60186
+ return;
60187
+ if (!flow.lanes.some((l) => l.id === note.laneId)) {
60188
+ accept("error", "V13: Lane ID does not match any declared lane.", {
60189
+ node: note,
60190
+ property: "laneId"
60191
+ });
60192
+ }
60193
+ }
60194
+ // =========================================================================
60195
+ // V10: Moment with zero nodes, zero whenBlocks AND zero notes -> error (ADR-040 D3)
59841
60196
  // =========================================================================
59842
60197
  checkMoment(moment, accept) {
59843
- if (moment.nodes.length === 0 && moment.whenBlocks.length === 0) {
59844
- accept("error", "V10: Moment must contain at least one node or when block.", {
60198
+ if (moment.nodes.length === 0 && moment.whenBlocks.length === 0 && (moment.notes ?? []).length === 0) {
60199
+ accept("error", "V10: Moment must contain at least one node, when block or note.", {
59845
60200
  node: moment,
59846
60201
  property: "label"
59847
60202
  });
@@ -60026,23 +60381,10 @@ var MomentValidator = class {
60026
60381
  });
60027
60382
  }
60028
60383
  }
60029
- // V5: triggered-by must reference a node that appeared earlier in the flow
60384
+ // V5: triggered-by must reference a node that appears earlier in the flow in source order:
60385
+ // in a prior moment, or earlier in the same moment (ADR-040 D4). V43 checks a same-moment hop.
60030
60386
  checkV5(node, accept) {
60031
- const flow = getFlowFromNode(node);
60032
- const moment = getMomentFromNode(node);
60033
- if (!flow || !moment)
60034
- return;
60035
- for (const conn of node.connections) {
60036
- if (!isTriggeredBy(conn))
60037
- continue;
60038
- const priorNames = this.collectPriorNodeNames(flow, moment);
60039
- if (!priorNames.has(conn.nodeName)) {
60040
- accept("error", "V5: triggered-by must reference a node from a prior frame.", {
60041
- node: conn,
60042
- property: "nodeName"
60043
- });
60044
- }
60045
- }
60387
+ this.checkTriggeredByPrior(node, accept);
60046
60388
  }
60047
60389
  // V9: crosses-to only valid on event kinds
60048
60390
  checkV9(node, accept, ctx) {
@@ -60135,15 +60477,24 @@ var MomentValidator = class {
60135
60477
  for (const conn of node.connections) {
60136
60478
  if (!isTriggeredBy(conn))
60137
60479
  continue;
60138
- const priorNames = this.collectPriorNodeNames(flow, moment);
60139
- if (!priorNames.has(conn.nodeName)) {
60140
- accept("error", "V5: triggered-by must reference a node from a prior frame.", {
60141
- node: conn,
60142
- property: "nodeName"
60143
- });
60480
+ const earlierNames = this.collectPriorNodeNames(flow, moment);
60481
+ for (const n of this.nodesBefore(moment, node))
60482
+ earlierNames.add(n.nodeName);
60483
+ if (!earlierNames.has(conn.nodeName)) {
60484
+ accept("error", "V5: triggered-by must reference a node placed earlier in the flow, in a prior moment or earlier in the same moment.", { node: conn, property: "nodeName" });
60144
60485
  }
60145
60486
  }
60146
60487
  }
60488
+ /**
60489
+ * The nodes of `moment` (its own and its `when` blocks') that come before `node` in source order.
60490
+ * CST offsets give the order; a hand-built AST without them falls back to own nodes then `when` nodes.
60491
+ */
60492
+ nodesBefore(moment, node) {
60493
+ const all = [...moment.nodes, ...moment.whenBlocks.flatMap((wb) => wb.nodes)];
60494
+ const hasCst = all.every((n) => n.$cstNode !== void 0);
60495
+ const inOrder = hasCst ? all.slice().sort((a, b) => a.$cstNode.offset - b.$cstNode.offset) : all;
60496
+ return inOrder.slice(0, inOrder.indexOf(node));
60497
+ }
60147
60498
  checkCrossFileNodeRules(node, accept) {
60148
60499
  if (!this.crossFileContext)
60149
60500
  return;
@@ -60423,11 +60774,12 @@ function orchestrationFindings(saga, known) {
60423
60774
  if (saga.commands === void 0)
60424
60775
  return [];
60425
60776
  const own = new Set(saga.commands.map((c) => c.name));
60777
+ const ownEvents = new Set((saga.events ?? []).map((e) => e.name));
60426
60778
  const compensations = saga.compensations ?? [];
60427
60779
  return [
60428
- ...saga.commands.filter((c) => c.emitsEvent !== void 0).map((c) => ({
60780
+ ...saga.commands.filter((c) => c.emitsEvent !== void 0 && !ownEvents.has(c.emitsEvent)).map((c) => ({
60429
60781
  ruleId: "V31",
60430
- message: `Orchestration '${saga.name}' command '${c.name}' emits '${c.emitsEvent ?? ""}'; an orchestration generates no domain event.`
60782
+ message: `Orchestration '${saga.name}' command '${c.name}' emits '${c.emitsEvent ?? ""}', which the orchestration does not declare; it emits only its own events.`
60431
60783
  })),
60432
60784
  ...own.has(saga.trigger) ? [] : [
60433
60785
  {
@@ -60523,15 +60875,109 @@ function v37(ctx, known) {
60523
60875
  ...ctx.sagas.flatMap((s) => gatewayFindings(`orchestration '${s.name}'`, s.gateways ?? [], known))
60524
60876
  ];
60525
60877
  }
60878
+ function v40(ctx) {
60879
+ const owners = /* @__PURE__ */ new Map();
60880
+ const add2 = (event, owner) => {
60881
+ owners.set(event, [...owners.get(event) ?? [], owner]);
60882
+ };
60883
+ for (const agg of ctx.aggregates)
60884
+ for (const e of agg.events ?? [])
60885
+ add2(e.name, `aggregate '${agg.name}'`);
60886
+ const processNames = /* @__PURE__ */ new Set();
60887
+ for (const saga of ctx.sagas)
60888
+ for (const e of saga.events ?? []) {
60889
+ add2(e.name, `orchestration '${saga.name}'`);
60890
+ processNames.add(e.name);
60891
+ }
60892
+ return [...owners].filter(([name, who]) => processNames.has(name) && who.length > 1).map(([name, who]) => ({
60893
+ ruleId: "V40",
60894
+ message: `Event '${name}' is declared by ${who.join(" and ")}; an event has one owner.`
60895
+ }));
60896
+ }
60897
+ function allCommands(ir) {
60898
+ return ir.contexts.flatMap((c) => [...c.commands, ...c.sagas.flatMap((s) => s.commands ?? [])]);
60899
+ }
60900
+ function v41Declarations(commands) {
60901
+ return commands.flatMap((cmd) => (cmd.preconditions ?? []).flatMap((pre) => (pre.causes ?? []).filter((cause) => !(cmd.causes ?? []).includes(cause)).map((cause) => ({
60902
+ ruleId: "V41",
60903
+ message: `Precondition '${pre.name}' of command '${cmd.name}' names cause '${cause}', which the command does not declare.`
60904
+ }))));
60905
+ }
60906
+ function placementCauseFindings(flowName, entry, cmd) {
60907
+ if (entry.cause !== void 0) {
60908
+ return (cmd.causes ?? []).includes(entry.cause) ? [] : [
60909
+ {
60910
+ ruleId: "V41",
60911
+ message: `Flow '${flowName}' places '${cmd.name}' for cause '${entry.cause}', which the command does not declare.`
60912
+ }
60913
+ ];
60914
+ }
60915
+ const scoped = (cmd.preconditions ?? []).some((p) => (p.causes ?? []).length > 0);
60916
+ return (cmd.causes ?? []).length > 0 && scoped ? [
60917
+ {
60918
+ ruleId: "V42",
60919
+ message: `Flow '${flowName}' places '${cmd.name}' without a cause, but the command has cause-scoped preconditions.`
60920
+ }
60921
+ ] : [];
60922
+ }
60923
+ function v41v42Placements(ir, commands) {
60924
+ const byName = new Map(commands.map((c) => [c.name, c]));
60925
+ return (ir.flows ?? []).flatMap((flow) => flow.moments.flatMap((moment) => [...moment.contextEntries, ...(moment.branches ?? []).flatMap((b) => b.entries)].flatMap((entry) => {
60926
+ const cmd = byName.get(entry.nodeName);
60927
+ return cmd === void 0 ? [] : placementCauseFindings(flow.name, entry, cmd);
60928
+ })));
60929
+ }
60930
+ function sameMomentTrigger(conn, sameMoment, known) {
60931
+ const { sourceNodeName: cause, targetNodeName: node } = conn;
60932
+ if (conn.connectionType !== "triggered-by" || cause === void 0 || node === void 0)
60933
+ return [];
60934
+ if (!known.has(node) || !sameMoment.get(conn.sourceMomentId)?.has(cause))
60935
+ return [];
60936
+ return [{ cause, node, momentId: conn.sourceMomentId }];
60937
+ }
60938
+ function v43(ir) {
60939
+ const policies = ir.contexts.flatMap((c) => c.policies);
60940
+ const known = /* @__PURE__ */ new Set([
60941
+ ...policies.map((p) => p.name),
60942
+ ...ir.contexts.flatMap((c) => [
60943
+ ...c.commands.map((m) => m.name),
60944
+ ...c.events.map((e) => e.name),
60945
+ ...c.sagas.flatMap((s) => (s.commands ?? []).map((m) => m.name))
60946
+ ])
60947
+ ]);
60948
+ const declared = (t) => policies.some((p) => p.name === t.node && p.trigger === t.cause || p.name === t.cause && p.chainsTo === t.node || p.trigger === t.cause && p.chainsTo === t.node);
60949
+ return (ir.flows ?? []).flatMap((flow) => {
60950
+ const earlier = /* @__PURE__ */ new Set();
60951
+ const sameMoment = /* @__PURE__ */ new Map();
60952
+ for (const moment of flow.moments) {
60953
+ const names = [
60954
+ ...moment.contextEntries,
60955
+ ...(moment.branches ?? []).flatMap((b) => b.entries)
60956
+ ].map((e) => e.nodeName);
60957
+ sameMoment.set(moment.id, new Set(names.filter((n) => !earlier.has(n))));
60958
+ names.forEach((n) => earlier.add(n));
60959
+ }
60960
+ const momentNames = new Map(flow.moments.map((m) => [m.id, m.name]));
60961
+ return flow.connections.flatMap((conn) => sameMomentTrigger(conn, sameMoment, known)).filter((t) => !declared(t)).map((t) => ({
60962
+ ruleId: "V43",
60963
+ message: `Flow '${flow.name}' moment '${momentNames.get(t.momentId)}': '${t.node}' is triggered-by '${t.cause}' in the same moment, but no policy declares that hop.`
60964
+ }));
60965
+ });
60966
+ }
60526
60967
  function validatePaletteConformance(ir) {
60527
60968
  const known = namesOf2(ir);
60969
+ const commands = allCommands(ir);
60528
60970
  return [
60529
60971
  ...ir.contexts.flatMap((ctx) => [
60530
60972
  ...v29v30(ctx, known),
60531
60973
  ...ctx.sagas.flatMap((saga) => orchestrationFindings(saga, known)),
60532
60974
  ...v36(ctx),
60533
- ...v37(ctx, known)
60975
+ ...v37(ctx, known),
60976
+ ...v40(ctx)
60534
60977
  ]),
60978
+ ...v41Declarations(commands),
60979
+ ...v41v42Placements(ir, commands),
60980
+ ...v43(ir),
60535
60981
  ...(ir.externals ?? []).flatMap((e) => gatewayFindings(`external '${e.name}'`, e.gateways ?? [], known))
60536
60982
  ];
60537
60983
  }
@@ -60612,7 +61058,9 @@ function collectContextMember(member, annotations, out) {
60612
61058
  } else if (isPolicyDeclaration(member)) {
60613
61059
  out.policies.push(transformPolicy(member, annotations));
60614
61060
  } else if (isSagaDeclaration(member)) {
60615
- out.sagas.push(transformSaga(member, annotations));
61061
+ const sagaDef = transformSaga(member, annotations);
61062
+ out.sagas.push(sagaDef);
61063
+ out.events.push(...sagaDef.events ?? []);
60616
61064
  } else if (isProjectionDeclaration(member)) {
60617
61065
  out.projections.push(transformProjection(member));
60618
61066
  } else if (isQueryDeclaration(member)) {
@@ -60724,7 +61172,7 @@ function transformAggregate(agg, annotations) {
60724
61172
  if (isCommandDeclaration(member)) {
60725
61173
  commands.push(transformCommand(member, memberAnnotations));
60726
61174
  } else if (isDomainEventDeclaration(member)) {
60727
- events.push(transformEvent(member, memberAnnotations));
61175
+ events.push(transformEvent(member, memberAnnotations, { kind: "aggregate", name }));
60728
61176
  } else if (isValueObjectDeclaration(member)) {
60729
61177
  valueObjects.push(transformValueObject(member, memberAnnotations));
60730
61178
  } else if (isInvariantDeclaration(member)) {
@@ -60760,6 +61208,7 @@ function transformCommand(cmd, annotations) {
60760
61208
  name: cmd.name,
60761
61209
  ...annotations ? { annotations } : {},
60762
61210
  inputs: cmd.inputs.map(transformFieldDeclaration),
61211
+ ...cmd.causes.length > 0 ? { causes: [...cmd.causes] } : {},
60763
61212
  preconditions: cmd.preconditions.map(transformPrecondition),
60764
61213
  emitsEvent: cmd.emits
60765
61214
  };
@@ -60767,13 +61216,15 @@ function transformCommand(cmd, annotations) {
60767
61216
  function transformPrecondition(pre) {
60768
61217
  return {
60769
61218
  name: pre.name,
60770
- description: pre.description
61219
+ description: pre.description,
61220
+ ...pre.causes.length > 0 ? { causes: [...pre.causes] } : {}
60771
61221
  };
60772
61222
  }
60773
- function transformEvent(evt, annotations) {
61223
+ function transformEvent(evt, annotations, owner) {
60774
61224
  return {
60775
61225
  id: `evt-${evt.name}`,
60776
61226
  name: evt.name,
61227
+ owner,
60777
61228
  ...annotations ? { annotations } : {},
60778
61229
  fields: evt.fields.map(transformFieldDeclaration)
60779
61230
  };
@@ -60839,6 +61290,7 @@ function transformOrchestrationCommand(cmd) {
60839
61290
  id: `cmd-${cmd.name}`,
60840
61291
  name: cmd.name,
60841
61292
  inputs: cmd.inputs.map(transformFieldDeclaration),
61293
+ ...cmd.causes.length > 0 ? { causes: [...cmd.causes] } : {},
60842
61294
  preconditions: cmd.preconditions.map(transformPrecondition),
60843
61295
  ...cmd.emits ? { emitsEvent: cmd.emits } : {}
60844
61296
  };
@@ -60870,6 +61322,9 @@ function transformSaga(saga, annotations) {
60870
61322
  compensation: compensationText(compensations),
60871
61323
  timeout,
60872
61324
  commands: saga.commands.map(transformOrchestrationCommand),
61325
+ ...saga.events.length > 0 ? {
61326
+ events: saga.events.map((e) => transformEvent(e, void 0, { kind: "orchestration", name: saga.name }))
61327
+ } : {},
60873
61328
  issues: saga.issues.map(transformIssued),
60874
61329
  compensations,
60875
61330
  ...gatewaysOf(saga.gateways)
@@ -60953,11 +61408,19 @@ function transformMoment(moment, index, laneContextMap, nodeKindMap) {
60953
61408
  branches,
60954
61409
  terminal: hasTerminal || void 0,
60955
61410
  isBranch: moment.isBranch || void 0,
61411
+ ...momentNotes(moment),
60956
61412
  // Textual order of entries/branches from CST offsets (M-P13); falls back
60957
61413
  // to entries-then-branches when the AST carries no CST.
60958
61414
  sequence: buildMomentSequence(moment).sequence
60959
61415
  };
60960
61416
  }
61417
+ function momentNotes(moment) {
61418
+ const notes = (moment.notes ?? []).map((n) => ({
61419
+ text: n.text,
61420
+ ...n.laneId !== void 0 ? { laneId: n.laneId } : {}
61421
+ }));
61422
+ return notes.length > 0 ? { notes } : {};
61423
+ }
60961
61424
  function transformWhenBlock(when, laneContextMap, nodeKindMap) {
60962
61425
  return {
60963
61426
  condition: when.condition,
@@ -60983,6 +61446,9 @@ function transformNodeToEntry(node, laneContextMap, nodeKindMap) {
60983
61446
  if (multiplicity !== void 0) {
60984
61447
  entry.multiplicity = multiplicity;
60985
61448
  }
61449
+ if (node.cause !== void 0) {
61450
+ entry.cause = node.cause;
61451
+ }
60986
61452
  const modifierType = node.modifier?.type;
60987
61453
  if (modifierType === "optional") {
60988
61454
  entry.optional = true;
@@ -63190,7 +63656,10 @@ function resolveAcrossFiles(ir) {
63190
63656
  ...(ctx.commands ?? []).map((c) => [c.name, "command"]),
63191
63657
  ...(ctx.events ?? []).map((e) => [e.name, "event"]),
63192
63658
  ...(ctx.policies ?? []).map((p) => [p.name, "policy"]),
63193
- ...(ctx.sagas ?? []).map((g) => [g.name, "saga"]),
63659
+ ...(ctx.sagas ?? []).flatMap((g) => [
63660
+ [g.name, "saga"],
63661
+ ...(g.commands ?? []).map((c) => [c.name, "command"])
63662
+ ]),
63194
63663
  ...(ctx.projections ?? []).map((p) => [p.name, "projection"]),
63195
63664
  ...(ctx.queries ?? []).map((q) => [q.name, "query"])
63196
63665
  ]));
@@ -63400,7 +63869,7 @@ function validateCrossFileReferences(ir) {
63400
63869
  }
63401
63870
 
63402
63871
  // ../core/dist/project/project-loader.js
63403
- var isCompletenessRule = (d) => /^V(2[2-9]|3[0-9])$/.test(d.ruleId ?? "");
63872
+ var isCompletenessRule = (d) => /^V(2[2-9]|3[0-9]|4[0-3])$/.test(d.ruleId ?? "");
63404
63873
  var ProjectLoader = class {
63405
63874
  parser;
63406
63875
  constructor(parser) {
@@ -63939,8 +64408,9 @@ function orderedMomentChildren(moment, fallback) {
63939
64408
  const entries = moment.contextEntries;
63940
64409
  const branches = moment.branches ?? [];
63941
64410
  const seq = moment.sequence;
63942
- if (seq && isUsableSequence(seq, entries.length, branches.length)) {
63943
- return seq.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index], entryIndex: item.index } : { kind: "branch", branch: branches[item.index], branchIndex: item.index });
64411
+ const walked = seq?.filter((item) => item.kind !== "note");
64412
+ if (walked && isUsableSequence(walked, entries.length, branches.length)) {
64413
+ return walked.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index], entryIndex: item.index } : { kind: "branch", branch: branches[item.index], branchIndex: item.index });
63944
64414
  }
63945
64415
  const entryChildren = entries.map((entry, i) => ({
63946
64416
  kind: "entry",
@@ -64227,7 +64697,8 @@ function entryToNode(entry, moment, momentIndex, laneIndex, scope, outcome) {
64227
64697
  momentName: moment.name,
64228
64698
  momentId: moment.id,
64229
64699
  momentIndex,
64230
- ...outcome !== void 0 ? { outcome } : {}
64700
+ ...outcome !== void 0 ? { outcome } : {},
64701
+ ...entry.cause !== void 0 ? { cause: entry.cause } : {}
64231
64702
  };
64232
64703
  }
64233
64704
  function generateEvents(nodes, flow, contextMap, sessionId, correlationId, baseTime) {
@@ -64439,7 +64910,7 @@ function findPreconditions(node, contextMap) {
64439
64910
  if (!ctx)
64440
64911
  return [];
64441
64912
  const cmd = findCommand(ctx, node.nodeName);
64442
- return cmd?.preconditions ?? [];
64913
+ return (cmd?.preconditions ?? []).filter((pre) => pre.causes === void 0 || pre.causes.length === 0 || node.cause !== void 0 && pre.causes.includes(node.cause));
64443
64914
  }
64444
64915
  function buildNegativeScenario(ir, flow, walk, failIndex, precondition, contextMap, opts, scenarioId) {
64445
64916
  const allNodes = walk.nodes;
@@ -64472,7 +64943,7 @@ function buildNegativeScenario(ir, flow, walk, failIndex, precondition, contextM
64472
64943
  kind: "negative",
64473
64944
  description: `Negative scenario: ${precondition.description} precondition violation at ${failNode.nodeName}`,
64474
64945
  given: `A ${(flow.moments[0]?.name ?? "").toLowerCase()} scenario is initiated`,
64475
- when: `${failNode.nodeName} is invoked without satisfying ${precondition.name}`,
64946
+ when: `${failNode.nodeName} is invoked${failNode.cause !== void 0 ? ` for ${failNode.cause}` : ""} without satisfying ${precondition.name}`,
64476
64947
  then: `The command ${failNode.nodeName} is rejected`,
64477
64948
  expectedPath: precedingNodes.map((n) => n.nodeId),
64478
64949
  activeBranches,
@@ -64494,7 +64965,8 @@ function buildFailureEvent(failNode, precondition, precedingEvents, opts) {
64494
64965
  payload: {
64495
64966
  nodeId: failNode.nodeId,
64496
64967
  failedPrecondition: precondition.name,
64497
- description: precondition.description
64968
+ description: precondition.description,
64969
+ ...failNode.cause !== void 0 ? { cause: failNode.cause } : {}
64498
64970
  }
64499
64971
  };
64500
64972
  }
@@ -64622,6 +65094,11 @@ function findCommand(ctx, name) {
64622
65094
  if (cmd)
64623
65095
  return cmd;
64624
65096
  }
65097
+ for (const saga of ctx.sagas) {
65098
+ const cmd = (saga.commands ?? []).find((c) => c.name === name);
65099
+ if (cmd)
65100
+ return cmd;
65101
+ }
64625
65102
  return void 0;
64626
65103
  }
64627
65104
  function findEvent(ctx, name) {
@@ -64698,6 +65175,13 @@ function generateEventCatalog(ir) {
64698
65175
  }
64699
65176
  }
64700
65177
  }
65178
+ for (const context of ir.contexts) {
65179
+ for (const saga of context.sagas) {
65180
+ for (const event of saga.events ?? []) {
65181
+ entries.push(buildProcessCatalogEntry(event, saga, context, ir));
65182
+ }
65183
+ }
65184
+ }
64701
65185
  addFlowFallbackEntries(ir, entries);
64702
65186
  return {
64703
65187
  events: entries,
@@ -64808,6 +65292,29 @@ function buildCatalogEntry(event, aggregate, context, ir) {
64808
65292
  temporalLocation
64809
65293
  };
64810
65294
  }
65295
+ function buildProcessCatalogEntry(event, saga, context, ir) {
65296
+ const command2 = (saga.commands ?? []).find((c) => c.emitsEvent === event.name);
65297
+ return {
65298
+ eventName: event.name,
65299
+ kind: "event",
65300
+ schema: {
65301
+ fields: event.fields.map((f) => ({
65302
+ name: f.name,
65303
+ type: f.type,
65304
+ isArray: f.isArray,
65305
+ deprecated: f.deprecated
65306
+ }))
65307
+ },
65308
+ producer: {
65309
+ context: context.name,
65310
+ aggregate: "",
65311
+ process: saga.name,
65312
+ command: command2?.name ?? ""
65313
+ },
65314
+ consumers: findConsumers(event, ir),
65315
+ temporalLocation: findTemporalLocation(event, ir)
65316
+ };
65317
+ }
64811
65318
  function findProducerCommand(event, aggregate, context) {
64812
65319
  const command2 = aggregate.commands.find((c) => c.emitsEvent === event.name);
64813
65320
  return {
@@ -64880,7 +65387,8 @@ function generateImpactAnalysis(ir) {
64880
65387
  name: n.name,
64881
65388
  context: n.context,
64882
65389
  dependsOn: [...n.dependsOn],
64883
- triggers: [...n.triggers]
65390
+ triggers: [...n.triggers],
65391
+ ...n.owner !== void 0 ? { owner: n.owner } : {}
64884
65392
  }));
64885
65393
  return {
64886
65394
  nodes,
@@ -64910,6 +65418,16 @@ function addCommandNodes(context, nodeMap) {
64910
65418
  }
64911
65419
  }
64912
65420
  }
65421
+ for (const saga of context.sagas) {
65422
+ for (const cmd of saga.commands ?? []) {
65423
+ if (!cmd.emitsEvent)
65424
+ continue;
65425
+ const cmdNode = getOrCreate(nodeMap, "command", cmd.name, context.name);
65426
+ const evtNode = getOrCreate(nodeMap, "event", cmd.emitsEvent, context.name);
65427
+ cmdNode.triggers.push(nodeKey("event", cmd.emitsEvent, context.name));
65428
+ evtNode.dependsOn.push(nodeKey("command", cmd.name, context.name));
65429
+ }
65430
+ }
64913
65431
  }
64914
65432
  function addEventNodes(context, nodeMap) {
64915
65433
  for (const agg of context.aggregates) {
@@ -64917,6 +65435,11 @@ function addEventNodes(context, nodeMap) {
64917
65435
  getOrCreate(nodeMap, "event", event.name, context.name);
64918
65436
  }
64919
65437
  }
65438
+ for (const saga of context.sagas) {
65439
+ for (const event of saga.events ?? []) {
65440
+ getOrCreate(nodeMap, "event", event.name, context.name).owner = saga.name;
65441
+ }
65442
+ }
64920
65443
  }
64921
65444
  function findDeclaringContextForEvent(eventName, ir) {
64922
65445
  for (const ctx of ir.contexts) {
@@ -65230,7 +65753,13 @@ function buildFrames(flow, ctxMap, laneIndex) {
65230
65753
  id: moment.id,
65231
65754
  moment: moment.name,
65232
65755
  isBranch: (moment.branches ?? []).length > 0,
65233
- nodes: buildFrameNodes(moment, ctxMap, laneIndex)
65756
+ nodes: buildFrameNodes(moment, ctxMap, laneIndex),
65757
+ ...(moment.notes ?? []).length > 0 ? {
65758
+ notes: (moment.notes ?? []).map((n) => ({
65759
+ text: n.text,
65760
+ ...n.laneId !== void 0 ? { lane: n.laneId } : {}
65761
+ }))
65762
+ } : {}
65234
65763
  }));
65235
65764
  }
65236
65765
  function buildFrameNodes(moment, ctxMap, laneIndex) {
@@ -65258,6 +65787,8 @@ function entryToNode2(entry, moment, ctxMap, laneIndex, scope) {
65258
65787
  label: entry.nodeName,
65259
65788
  type: nodeKind,
65260
65789
  aggregate: aggregate ?? void 0,
65790
+ process: aggregate === null ? findProcess(entry.nodeName, ctx) ?? void 0 : void 0,
65791
+ cause: entry.cause,
65261
65792
  optional: entry.optional ?? void 0,
65262
65793
  terminal: entry.terminal ?? void 0,
65263
65794
  multiplicity: entry.multiplicity != null ? String(entry.multiplicity) : void 0,
@@ -65267,7 +65798,7 @@ function entryToNode2(entry, moment, ctxMap, laneIndex, scope) {
65267
65798
  function resolveNodeKind2(entry, ctx) {
65268
65799
  if (!ctx)
65269
65800
  return entry.nodeKind;
65270
- const isCmd = ctx.commands.some((c) => c.name === entry.nodeName) || ctx.aggregates.some((a) => a.commands.some((c) => c.name === entry.nodeName));
65801
+ const isCmd = ctx.commands.some((c) => c.name === entry.nodeName) || ctx.aggregates.some((a) => a.commands.some((c) => c.name === entry.nodeName)) || (ctx.sagas ?? []).some((g) => (g.commands ?? []).some((c) => c.name === entry.nodeName));
65271
65802
  if (isCmd)
65272
65803
  return "command";
65273
65804
  const isEvt = ctx.events.some((e) => e.name === entry.nodeName) || ctx.aggregates.some((a) => a.events.some((e) => e.name === entry.nodeName));
@@ -65286,6 +65817,15 @@ function findAggregate(nodeName, ctx) {
65286
65817
  }
65287
65818
  return null;
65288
65819
  }
65820
+ function findProcess(nodeName, ctx) {
65821
+ for (const saga of ctx?.sagas ?? []) {
65822
+ if ((saga.events ?? []).some((e) => e.name === nodeName))
65823
+ return saga.name;
65824
+ if ((saga.commands ?? []).some((c) => c.name === nodeName))
65825
+ return saga.name;
65826
+ }
65827
+ return null;
65828
+ }
65289
65829
  function buildConnections(flow) {
65290
65830
  return flow.connections.map((conn) => {
65291
65831
  const eventType = conn.eventId.replace(/^evt-/, "");
@@ -65365,6 +65905,11 @@ function buildEventRouting(flow, ctxMap, laneIndex) {
65365
65905
  existing.add(nodeId);
65366
65906
  routing[entry.nodeName] = existing;
65367
65907
  }
65908
+ if (kind === "policy") {
65909
+ const existing = routing[entry.nodeName] ?? /* @__PURE__ */ new Set();
65910
+ existing.add(nodeId);
65911
+ routing[entry.nodeName] = existing;
65912
+ }
65368
65913
  if (kind === "command") {
65369
65914
  const key = `SimProcess.${entry.nodeName}`;
65370
65915
  const existing = routing[key] ?? /* @__PURE__ */ new Set();
@@ -65506,24 +66051,32 @@ function renderMomentsByContext(lines, flow, ir, ctxMap) {
65506
66051
  const sharedPreconditions = extractSharedPreconditions(moments, ctxMap);
65507
66052
  renderBackgroundBlock(lines, sharedPreconditions);
65508
66053
  for (const moment of moments) {
65509
- if (moment.branches && moment.branches.length > 0) {
65510
- for (const branch of moment.branches) {
65511
- renderBranchScenario(lines, moment, branch.condition, branch.entries, flow, ctxMap, ir, sharedPreconditions);
65512
- }
65513
- } else {
65514
- renderScenario(lines, moment, moment.contextEntries, flow, ctxMap, ir, void 0, sharedPreconditions);
65515
- }
66054
+ renderMoment(lines, moment, flow, ctxMap, ir, sharedPreconditions);
65516
66055
  }
65517
66056
  renderSagaScenarios(lines, ctxId, ir, ownedSagaIds);
65518
66057
  }
65519
66058
  renderOrphanOwnedSagas(lines, ir, contextGroups, ownedSagaIds);
65520
66059
  }
66060
+ function renderMoment(lines, moment, flow, ctxMap, ir, sharedPreconditions) {
66061
+ if (isNoteOnly(moment)) {
66062
+ renderNoteOnlyMoment(lines, moment, flow);
66063
+ return;
66064
+ }
66065
+ if (moment.branches && moment.branches.length > 0) {
66066
+ for (const branch of moment.branches) {
66067
+ renderBranchScenario(lines, moment, branch.condition, branch.entries, flow, ctxMap, ir, sharedPreconditions);
66068
+ }
66069
+ return;
66070
+ }
66071
+ renderScenario(lines, moment, moment.contextEntries, flow, ctxMap, ir, void 0, sharedPreconditions);
66072
+ }
65521
66073
  function renderScenario(lines, moment, entries, flow, ctxMap, ir, variant, sharedPreconditions = /* @__PURE__ */ new Set()) {
65522
66074
  const label = variant ? `${moment.name} [${variant}]` : moment.name;
65523
66075
  const tags = buildScenarioTags(entries, moment, void 0, flow, ctxMap, ir);
65524
66076
  if (tags.length > 0)
65525
66077
  lines.push(` ${tags.join(" ")}`);
65526
66078
  lines.push(` Scenario: ${label}`);
66079
+ lines.push(...noteComments(moment, flow, " "));
65527
66080
  const steps = [];
65528
66081
  const usedConnections = /* @__PURE__ */ new Set();
65529
66082
  for (const entry of orderedMainEntries(moment)) {
@@ -65547,6 +66100,7 @@ function renderBranchScenario(lines, moment, condition, branchEntries, flow, ctx
65547
66100
  if (tags.length > 0)
65548
66101
  lines.push(` ${tags.join(" ")}`);
65549
66102
  lines.push(` Scenario: ${moment.name} [${condition}]`);
66103
+ lines.push(...noteComments(moment, flow, " "));
65550
66104
  const steps = buildBranchScenarioSteps(moment, condition, branchEntries, flow, ctxMap, sharedPreconditions);
65551
66105
  if (returnsTo) {
65552
66106
  const targetLabel = resolveReturnsToLabel(returnsTo, flow);
@@ -65571,10 +66125,25 @@ function buildBranchScenarioSteps(moment, condition, branchEntries, flow, ctxMap
65571
66125
  }
65572
66126
  return steps;
65573
66127
  }
66128
+ function isNoteOnly(moment) {
66129
+ return moment.contextEntries.length === 0 && (moment.branches ?? []).length === 0 && (moment.notes ?? []).length > 0;
66130
+ }
66131
+ function noteComments(moment, flow, indent) {
66132
+ return (moment.notes ?? []).map((note) => {
66133
+ const label = flow.lanes.find((l) => l.id === note.laneId)?.label ?? note.laneId;
66134
+ return `${indent}# note${label !== void 0 ? ` (${label})` : ""}: ${note.text}`;
66135
+ });
66136
+ }
66137
+ function renderNoteOnlyMoment(lines, moment, flow) {
66138
+ lines.push(` # moment: ${moment.name}`);
66139
+ lines.push(...noteComments(moment, flow, " "));
66140
+ lines.push("");
66141
+ }
65574
66142
  function renderTerminalBranchScenario(lines, moment, condition, branchEntries, flow, ctxMap, ir) {
65575
66143
  const tags = ["@terminal", "@failure-path"];
65576
66144
  lines.push(` ${tags.join(" ")}`);
65577
66145
  lines.push(` Scenario: ${moment.name} [${condition}]`);
66146
+ lines.push(...noteComments(moment, flow, " "));
65578
66147
  const failedPrecondition = findFailedPrecondition(moment, ctxMap);
65579
66148
  lines.push(` Given the ${moment.name.toLowerCase()} is evaluated`);
65580
66149
  if (failedPrecondition) {
@@ -65869,8 +66438,9 @@ function orderedMomentChildren2(moment) {
65869
66438
  const entries = moment.contextEntries;
65870
66439
  const branches = moment.branches ?? [];
65871
66440
  const seq = moment.sequence;
65872
- if (seq && isUsableSequence2(seq, entries.length, branches.length)) {
65873
- return seq.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index] } : { kind: "branch", branch: branches[item.index] });
66441
+ const walked = seq?.filter((item) => item.kind !== "note");
66442
+ if (walked && isUsableSequence2(walked, entries.length, branches.length)) {
66443
+ return walked.map((item) => item.kind === "entry" ? { kind: "entry", entry: entries[item.index] } : { kind: "branch", branch: branches[item.index] });
65874
66444
  }
65875
66445
  return [
65876
66446
  ...entries.map((entry) => ({ kind: "entry", entry })),
@@ -65988,10 +66558,20 @@ function collectFlowContextIds(flow) {
65988
66558
  }
65989
66559
  return [...ids];
65990
66560
  }
66561
+ function primaryContextOf(moment, flow, previous) {
66562
+ const firstNode = moment.contextEntries[0] ?? moment.branches?.[0]?.entries[0];
66563
+ return firstNode?.contextId ?? noteLaneContext(moment, flow) ?? previous ?? "unknown";
66564
+ }
66565
+ function noteLaneContext(moment, flow) {
66566
+ const laneId = (moment.notes ?? []).find((n) => n.laneId !== void 0)?.laneId;
66567
+ return flow.lanes.find((l) => l.id === laneId)?.contextId;
66568
+ }
65991
66569
  function groupMomentsByContext(flow) {
65992
66570
  const groups = /* @__PURE__ */ new Map();
66571
+ let previous;
65993
66572
  for (const moment of flow.moments) {
65994
- const primaryCtx = moment.contextEntries[0]?.contextId ?? moment.branches?.[0]?.entries?.[0]?.contextId ?? "unknown";
66573
+ const primaryCtx = primaryContextOf(moment, flow, previous);
66574
+ previous = primaryCtx;
65995
66575
  const existing = groups.get(primaryCtx) ?? [];
65996
66576
  existing.push(moment);
65997
66577
  groups.set(primaryCtx, existing);
@@ -66149,10 +66729,18 @@ var SpecificationDocumentGenerator = class {
66149
66729
  for (const entry of moment.contextEntries) {
66150
66730
  this.renderEntryNarrative(lines, entry, moment, void 0, flow, ir, " ", usedConnections);
66151
66731
  }
66732
+ this.renderMomentNotes(lines, moment, flow);
66152
66733
  this.renderMomentBranches(lines, moment, flow, ir);
66153
66734
  this.renderMomentPoliciesAndRules(lines, moment, ir);
66154
66735
  lines.push("");
66155
66736
  }
66737
+ /** Notes (ADR-040 D3) are narrated as steps of their moment; they are not nodes. */
66738
+ renderMomentNotes(lines, moment, flow) {
66739
+ for (const note of moment.notes ?? []) {
66740
+ const label = flow.lanes.find((l) => l.id === note.laneId)?.label ?? note.laneId;
66741
+ lines.push(` - *note${label !== void 0 ? ` (${label})` : ""}:* ${note.text}`);
66742
+ }
66743
+ }
66156
66744
  renderMomentHeader(lines, moment, step, flow, ir) {
66157
66745
  const ctxLabel = this.buildContextLabel(moment, ir);
66158
66746
  const sagaLabel = this.findSagaStateForMoment(moment, step, flow, ir);
@@ -67165,6 +67753,19 @@ function generateAggregateFile(aggregate) {
67165
67753
  parts.push("");
67166
67754
  return parts.join("\n");
67167
67755
  }
67756
+ function processSagas(context) {
67757
+ return context.sagas.filter((s) => (s.events ?? []).length > 0);
67758
+ }
67759
+ function generateProcessTypesFile(saga) {
67760
+ const parts = [
67761
+ generateJsDoc(`Events the ${saga.name} process records.`, "").trimEnd(),
67762
+ ""
67763
+ ];
67764
+ for (const event of saga.events ?? []) {
67765
+ parts.push(generateEventInterface(event));
67766
+ }
67767
+ return parts.join("\n");
67768
+ }
67168
67769
  function generateEventUnionType(context) {
67169
67770
  const eventNames = [];
67170
67771
  for (const aggregate of context.aggregates) {
@@ -67172,6 +67773,11 @@ function generateEventUnionType(context) {
67172
67773
  eventNames.push(toPascalCase(event.name));
67173
67774
  }
67174
67775
  }
67776
+ for (const saga of processSagas(context)) {
67777
+ for (const event of saga.events ?? []) {
67778
+ eventNames.push(toPascalCase(event.name));
67779
+ }
67780
+ }
67175
67781
  if (eventNames.length === 0) {
67176
67782
  return "";
67177
67783
  }
@@ -67222,6 +67828,9 @@ function generateContextIndexFile(context) {
67222
67828
  parts.push(`export * from './${kebabName}.types.js';`);
67223
67829
  parts.push(`export * from './${kebabName}.aggregate.js';`);
67224
67830
  }
67831
+ for (const saga of processSagas(context)) {
67832
+ parts.push(`export * from './${toKebabCase2(saga.name)}.process.types.js';`);
67833
+ }
67225
67834
  if (eventImports.length > 0) {
67226
67835
  parts.push("");
67227
67836
  for (const imp of eventImports) {
@@ -67243,6 +67852,10 @@ function collectEventImports(context) {
67243
67852
  imports.push({ module: `${toKebabCase2(aggregate.name)}.types.js`, names });
67244
67853
  }
67245
67854
  }
67855
+ for (const saga of processSagas(context)) {
67856
+ const names = (saga.events ?? []).map((e) => toPascalCase(e.name));
67857
+ imports.push({ module: `${toKebabCase2(saga.name)}.process.types.js`, names });
67858
+ }
67246
67859
  return imports;
67247
67860
  }
67248
67861
  function shouldIncludeContext(context, scope) {
@@ -67279,9 +67892,13 @@ function emitContext(context, scope, files, filesWritten) {
67279
67892
  const readSide = scope.level !== "aggregate" && hasReadSide(context);
67280
67893
  if (readSide)
67281
67894
  write(`${contextDir}/read-model.types.ts`, generateReadModelFile(context));
67282
- if (aggregates.length === 0 && !readSide)
67895
+ const sagas = scope.level !== "aggregate" ? processSagas(context) : [];
67896
+ for (const saga of sagas) {
67897
+ write(`${contextDir}/${toKebabCase2(saga.name)}.process.types.ts`, generateProcessTypesFile(saga));
67898
+ }
67899
+ if (aggregates.length === 0 && !readSide && sagas.length === 0)
67283
67900
  return void 0;
67284
- write(`${contextDir}/index.ts`, generateContextIndexFile({ ...context, aggregates }));
67901
+ write(`${contextDir}/index.ts`, generateContextIndexFile({ ...context, aggregates, sagas }));
67285
67902
  return dir;
67286
67903
  }
67287
67904
  var TypeScriptEmitter = class {
@@ -67775,7 +68392,12 @@ function buildPayloads(ir, includeAll) {
67775
68392
  const flowSlug = kebab2(flow.name);
67776
68393
  const topoKey = `topology-${flowSlug}.json`;
67777
68394
  topologies[topoKey] = topoEmitter.emit(ir, flow);
67778
- const flowScenarios = includeAll ? [...generateAllScenarios(ir, flow), ...deriveNegativeScenarios(ir, flow)] : [generateSimulationScenario(ir, flow)];
68395
+ const flowScenarios = includeAll ? [
68396
+ ...generateAllScenarios(ir, flow),
68397
+ ...deriveNegativeScenarios(ir, flow),
68398
+ // Saga-timeout scenarios, as `moment simulate --all` writes them.
68399
+ ...deriveTimeoutScenarios(ir, flow)
68400
+ ] : [generateSimulationScenario(ir, flow)];
67779
68401
  for (const s of flowScenarios) {
67780
68402
  scenarios[`${s.scenarioId}.json`] = s;
67781
68403
  }
@@ -67793,7 +68415,8 @@ function buildPayloads(ir, includeAll) {
67793
68415
  artifacts: {
67794
68416
  eventCatalog: "event-catalog.json",
67795
68417
  impactAnalysis: "impact-analysis.json",
67796
- sagaStateMachines: "saga-state-machines.json"
68418
+ sagaStateMachines: "saga-state-machines.json",
68419
+ policyDefinitions: "policy-definitions.json"
67797
68420
  }
67798
68421
  },
67799
68422
  topologies,
@@ -67801,7 +68424,9 @@ function buildPayloads(ir, includeAll) {
67801
68424
  artifacts: {
67802
68425
  eventCatalog: generateEventCatalog(ir),
67803
68426
  impactAnalysis: generateImpactAnalysis(ir),
67804
- sagaStateMachines: generateSagaStateMachines(ir)
68427
+ sagaStateMachines: generateSagaStateMachines(ir),
68428
+ // The generator `simulate --out-dir` writes policy-definitions.json with.
68429
+ policyDefinitions: generatePolicyDefinitions(ir)
67805
68430
  }
67806
68431
  };
67807
68432
  }
@@ -67883,7 +68508,8 @@ function normalizeArtifactFilenames(raw) {
67883
68508
  return {
67884
68509
  eventCatalog: raw.eventCatalog ?? "event-catalog.json",
67885
68510
  impactAnalysis: raw.impactAnalysis ?? "impact-analysis.json",
67886
- sagaStateMachines: raw.sagaStateMachines ?? "saga-state-machines.json"
68511
+ sagaStateMachines: raw.sagaStateMachines ?? "saga-state-machines.json",
68512
+ policyDefinitions: raw.policyDefinitions ?? "policy-definitions.json"
67887
68513
  };
67888
68514
  }
67889
68515
  function loadFlowAssets(dir, flow, includeAll, topologies, scenarios) {
@@ -67932,7 +68558,8 @@ function runFacetDirPipeline(dir, includeAll) {
67932
68558
  artifacts: {
67933
68559
  eventCatalog: loadArtifact(dir, artifactNames.eventCatalog),
67934
68560
  impactAnalysis: loadArtifact(dir, artifactNames.impactAnalysis),
67935
- sagaStateMachines: loadArtifact(dir, artifactNames.sagaStateMachines)
68561
+ sagaStateMachines: loadArtifact(dir, artifactNames.sagaStateMachines),
68562
+ policyDefinitions: loadArtifact(dir, artifactNames.policyDefinitions)
67936
68563
  }
67937
68564
  };
67938
68565
  }
@@ -68658,23 +69285,56 @@ function renderTimeline(ir) {
68658
69285
  dimensions: computeDimensions(entries, lanes)
68659
69286
  };
68660
69287
  }
69288
+ function laneOfMoment(moment, flow, laneIndex, previous) {
69289
+ const first2 = moment.contextEntries[0];
69290
+ if (first2)
69291
+ return laneIndex.get(first2.contextId);
69292
+ const noteLaneId = (moment.notes ?? []).find((n) => n.laneId !== void 0)?.laneId;
69293
+ const noteLane = flow.lanes.find((l) => l.id === noteLaneId);
69294
+ return (noteLane ? laneIndex.get(noteLane.contextId) : void 0) ?? previous;
69295
+ }
69296
+ function namesOfMoment(moment) {
69297
+ return [
69298
+ ...moment.contextEntries.map((e) => e.nodeName),
69299
+ ...(moment.branches ?? []).flatMap((b) => b.entries.map((e) => e.nodeName))
69300
+ ];
69301
+ }
69302
+ function momentDetails(moment, flow, earlier) {
69303
+ const here = new Set(namesOfMoment(moment).filter((n) => !earlier.has(n)));
69304
+ const hops = flow.connections.filter((c) => c.connectionType === "triggered-by" && c.sourceMomentId === moment.id && c.sourceNodeName !== void 0 && c.targetNodeName !== void 0 && here.has(c.sourceNodeName)).map((c) => ({ from: c.sourceNodeName ?? "", to: c.targetNodeName ?? "" }));
69305
+ const causes = [
69306
+ ...moment.contextEntries,
69307
+ ...(moment.branches ?? []).flatMap((b) => b.entries)
69308
+ ].flatMap((e) => e.cause !== void 0 ? [{ nodeName: e.nodeName, cause: e.cause }] : []);
69309
+ const notes = (moment.notes ?? []).map((n) => ({
69310
+ text: n.text,
69311
+ ...n.laneId !== void 0 ? { laneId: n.laneId } : {}
69312
+ }));
69313
+ return {
69314
+ ...notes.length > 0 ? { notes } : {},
69315
+ ...hops.length > 0 ? { hops } : {},
69316
+ ...causes.length > 0 ? { causes } : {}
69317
+ };
69318
+ }
68661
69319
  function processFlow(flow, ir, laneIndex, entries, connections, xOffset) {
69320
+ const earlier = /* @__PURE__ */ new Set();
69321
+ let previous;
68662
69322
  for (const moment of flow.moments) {
68663
- const firstEntry = moment.contextEntries[0];
68664
- if (firstEntry) {
68665
- const lane = laneIndex.get(firstEntry.contextId);
68666
- if (lane) {
68667
- entries.push({
68668
- momentId: moment.id,
68669
- momentName: moment.name,
68670
- contextId: firstEntry.contextId,
68671
- x: xOffset,
68672
- y: lane.y + LANE_PADDING,
68673
- width: ENTRY_WIDTH,
68674
- height: ENTRY_HEIGHT
68675
- });
68676
- }
69323
+ const lane = laneOfMoment(moment, flow, laneIndex, previous);
69324
+ if (lane) {
69325
+ previous = lane;
69326
+ entries.push({
69327
+ momentId: moment.id,
69328
+ momentName: moment.name,
69329
+ contextId: lane.contextId,
69330
+ x: xOffset,
69331
+ y: lane.y + LANE_PADDING,
69332
+ width: ENTRY_WIDTH,
69333
+ height: ENTRY_HEIGHT,
69334
+ ...momentDetails(moment, flow, earlier)
69335
+ });
68677
69336
  }
69337
+ namesOfMoment(moment).forEach((n) => earlier.add(n));
68678
69338
  xOffset += ENTRY_SPACING;
68679
69339
  }
68680
69340
  for (const conn of flow.connections) {