@cratis/screenplay-language 5.2.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
  2. package/dist/bundles/action-subject-authoring.js.map +1 -1
  3. package/dist/bundles/bmp-word-characters.js.map +1 -1
  4. package/dist/bundles/case-authoring.js +1 -1
  5. package/dist/bundles/case-authoring.js.map +1 -1
  6. package/dist/bundles/code-actions.js.map +1 -1
  7. package/dist/bundles/command-read-completions.js.map +1 -1
  8. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
  9. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
  10. package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  12. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
  13. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
  14. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
  15. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
  16. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
  17. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
  18. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
  19. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
  20. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
  21. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
  22. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
  23. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
  24. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
  25. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
  26. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
  27. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  30. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
  32. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
  37. package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  39. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  40. package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
  41. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  42. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  43. package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
  44. package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
  45. package/dist/bundles/compiler/Files/PlayImports.js +1 -1
  46. package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
  47. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
  48. package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
  49. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
  50. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
  51. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
  52. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
  53. package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
  54. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
  55. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
  56. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
  57. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
  58. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
  59. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
  60. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
  61. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
  62. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
  63. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
  64. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
  65. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
  66. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +2 -0
  67. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -0
  68. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
  69. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
  70. package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
  71. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  72. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  73. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  74. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
  75. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
  76. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
  77. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  78. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  79. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  80. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
  81. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  82. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
  83. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
  84. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
  85. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  86. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
  87. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  88. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  89. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
  90. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
  91. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  92. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  93. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  94. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
  95. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
  96. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
  97. package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
  98. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  99. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  100. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  101. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  102. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
  103. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  104. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
  105. package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
  106. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
  107. package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
  108. package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
  109. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  110. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
  111. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  112. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
  113. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  114. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  115. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
  116. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
  117. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  118. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
  119. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  120. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
  121. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
  122. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
  123. package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
  124. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
  125. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
  126. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  127. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  128. package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
  129. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  130. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
  131. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
  132. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  133. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  134. package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
  135. package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
  136. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  137. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  138. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  139. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
  140. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
  141. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  142. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  143. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
  144. package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
  145. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
  146. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  147. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
  148. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  149. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
  150. package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
  151. package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
  152. package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
  153. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
  154. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
  155. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
  156. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
  157. package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
  158. package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
  159. package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
  160. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
  161. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
  162. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  163. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
  164. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
  165. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
  166. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
  167. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  168. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
  169. package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
  170. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
  171. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
  172. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
  173. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  174. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
  175. package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
  176. package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
  177. package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
  178. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
  179. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
  180. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  181. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  182. package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
  183. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
  184. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
  185. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  186. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
  187. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
  188. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
  189. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  190. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  191. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
  192. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
  193. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
  194. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
  195. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  196. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  197. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  198. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
  199. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
  200. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  201. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  202. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  203. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
  204. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  205. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  206. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
  207. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
  208. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
  209. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
  210. package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
  211. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
  212. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
  213. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
  214. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
  215. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
  216. package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
  217. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
  218. package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
  219. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
  220. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  221. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  222. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  223. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  224. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  225. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
  226. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  227. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
  228. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
  229. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
  230. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  231. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
  232. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  233. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
  234. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
  235. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
  236. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
  237. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
  238. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  239. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
  240. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  241. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  242. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
  243. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
  244. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  245. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
  246. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
  247. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
  248. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  249. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  250. package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
  251. package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
  252. package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
  253. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
  254. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
  255. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
  256. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
  257. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
  258. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  259. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  260. package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
  261. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
  262. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
  263. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
  264. package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
  265. package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
  266. package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
  267. package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
  268. package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
  269. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
  270. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  271. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  272. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
  273. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
  274. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
  275. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
  276. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
  277. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  278. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
  279. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
  280. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
  281. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
  282. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
  283. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
  284. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
  285. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
  286. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
  287. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  288. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  289. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
  290. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
  291. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
  292. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
  293. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  294. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  295. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  296. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  297. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  298. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  299. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  300. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
  301. package/dist/bundles/compiler/Syntax/index.js +1 -1
  302. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
  303. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
  304. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
  305. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
  306. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
  307. package/dist/bundles/compiler/Text/patterns.js.map +1 -1
  308. package/dist/bundles/compiler/index.js +1 -1
  309. package/dist/bundles/completion-items.js +18 -17
  310. package/dist/bundles/completion-items.js.map +1 -1
  311. package/dist/bundles/completion-planner.js +2 -2
  312. package/dist/bundles/completion-planner.js.map +1 -1
  313. package/dist/bundles/completions.js +1 -1
  314. package/dist/bundles/completions.js.map +1 -1
  315. package/dist/bundles/continuation-responses.js +1 -1
  316. package/dist/bundles/continuation-responses.js.map +1 -1
  317. package/dist/bundles/declarations.js.map +1 -1
  318. package/dist/bundles/dependency-completions.js.map +1 -1
  319. package/dist/bundles/dependency-target-analysis.js.map +1 -1
  320. package/dist/bundles/diagnostic-codes.js +1 -1
  321. package/dist/bundles/diagnostic-codes.js.map +1 -1
  322. package/dist/bundles/diagnostics.js +1 -1
  323. package/dist/bundles/diagnostics.js.map +1 -1
  324. package/dist/bundles/document-context.js.map +1 -1
  325. package/dist/bundles/documentation-item.js.map +1 -1
  326. package/dist/bundles/event-analysis-source.js.map +1 -1
  327. package/dist/bundles/event-context-catalog.js.map +1 -1
  328. package/dist/bundles/event-context.js.map +1 -1
  329. package/dist/bundles/event-source-authoring.js +11 -11
  330. package/dist/bundles/event-source-authoring.js.map +1 -1
  331. package/dist/bundles/example-analysis.js +2 -2
  332. package/dist/bundles/example-analysis.js.map +1 -1
  333. package/dist/bundles/example-authoring.js +2 -2
  334. package/dist/bundles/example-authoring.js.map +1 -1
  335. package/dist/bundles/example-declaration-items.js.map +1 -1
  336. package/dist/bundles/example-values.js.map +1 -1
  337. package/dist/bundles/file-imports.js.map +1 -1
  338. package/dist/bundles/file-references.js.map +1 -1
  339. package/dist/bundles/generation-completions.js.map +1 -1
  340. package/dist/bundles/hover-content.js +5 -5
  341. package/dist/bundles/hover-content.js.map +1 -1
  342. package/dist/bundles/hover.js.map +1 -1
  343. package/dist/bundles/index.js +1 -1
  344. package/dist/bundles/index.js.map +1 -1
  345. package/dist/bundles/inlay-hints.js.map +1 -1
  346. package/dist/bundles/inline-completions.js +1 -1
  347. package/dist/bundles/inline-completions.js.map +1 -1
  348. package/dist/bundles/inline-event-validation.js +1 -1
  349. package/dist/bundles/inline-event-validation.js.map +1 -1
  350. package/dist/bundles/keyword-docs.js +1 -1
  351. package/dist/bundles/keyword-docs.js.map +1 -1
  352. package/dist/bundles/language.js +1 -1
  353. package/dist/bundles/language.js.map +1 -1
  354. package/dist/bundles/named-rule-context.js.map +1 -1
  355. package/dist/bundles/operation-authoring.js +6 -6
  356. package/dist/bundles/operation-authoring.js.map +1 -1
  357. package/dist/bundles/persona-analysis.js +1 -1
  358. package/dist/bundles/persona-analysis.js.map +1 -1
  359. package/dist/bundles/production-destinations.js +1 -1
  360. package/dist/bundles/production-destinations.js.map +1 -1
  361. package/dist/bundles/purpose-items.js.map +1 -1
  362. package/dist/bundles/reaction-authoring.js +3 -3
  363. package/dist/bundles/reaction-authoring.js.map +1 -1
  364. package/dist/bundles/read-model-key-completions.js +1 -1
  365. package/dist/bundles/read-model-key-completions.js.map +1 -1
  366. package/dist/bundles/refusal-context.js.map +1 -1
  367. package/dist/bundles/response-analysis.js +1 -1
  368. package/dist/bundles/response-analysis.js.map +1 -1
  369. package/dist/bundles/response-completions.js +1 -1
  370. package/dist/bundles/response-completions.js.map +1 -1
  371. package/dist/bundles/response-tokens.js +2 -2
  372. package/dist/bundles/response-tokens.js.map +1 -1
  373. package/dist/bundles/scope-items.js +3 -3
  374. package/dist/bundles/scope-items.js.map +1 -1
  375. package/dist/bundles/structure-completions.js.map +1 -1
  376. package/dist/bundles/sub-language-registry.js.map +1 -1
  377. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
  378. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
  379. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
  380. package/dist/bundles/sub-languages/capture/index.js.map +1 -1
  381. package/dist/bundles/sub-languages/capture/language.js.map +1 -1
  382. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  383. package/dist/bundles/sub-languages/pdl.js.map +1 -1
  384. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
  385. package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
  386. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
  387. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
  388. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
  389. package/dist/bundles/sub-languages/projection/index.js.map +1 -1
  390. package/dist/bundles/sub-languages/projection/language.js.map +1 -1
  391. package/dist/bundles/symbols.js +2 -2
  392. package/dist/bundles/symbols.js.map +1 -1
  393. package/dist/bundles/themes/screenplay-dark.js.map +1 -1
  394. package/dist/bundles/themes/screenplay-light.js.map +1 -1
  395. package/dist/bundles/tokens.js +1 -1
  396. package/dist/bundles/tokens.js.map +1 -1
  397. package/dist/bundles/validation.js +2 -2
  398. package/dist/bundles/validation.js.map +1 -1
  399. package/dist/completion-items.d.ts +1 -0
  400. package/dist/completion-items.d.ts.map +1 -1
  401. package/dist/completion-planner.d.ts.map +1 -1
  402. package/dist/diagnostic-codes.d.ts +6 -0
  403. package/dist/diagnostic-codes.d.ts.map +1 -1
  404. package/dist/keyword-docs.d.ts.map +1 -1
  405. package/dist/language.d.ts.map +1 -1
  406. package/dist/scope-items.d.ts.map +1 -1
  407. package/dist/tokens.d.ts.map +1 -1
  408. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{dotNetWhitespace as r,nativePattern as i,pattern as a}from"../Text/patterns.js";import{sourceLocation as o}from"../Diagnostics/SourceLocation.js";import{locationOf as s}from"./SourceLine.js";import{diagnosticText as c}from"../Diagnostics/DiagnosticArgument.js";import{firstWord as l}from"./LineText.js";import{parseStructuredValue as u,tryParseStructuredMapping as d}from"./StructuredBlockParser.js";import{generatedFixturePattern as f,generatedFixturePrefix as p,parseConcrete as m,parseConcreteMapping as h,parseReturn as g,thenReturnsPrefix as _}from"./SpecificationResponseParser.js";import{containsCaseReference as v,parseCase as y,parseParameter as b,parseSpecificationValue as x,validateTable as S}from"./SpecificationCaseParser.js";import{parseDescription as C}from"./DescriptionParser.js";import{sourceStreamPattern as ee}from"../Text/SourceStreamNames.js";import{parseRouteParts as w}from"./EventSourceParser.js";import{isFileDirective as T}from"./FileReferences.js";import{rejectOperationChildren as E}from"./OperationParser.js";import{addFixtureValue as D,addInlineValue as O}from"./SpecificationExampleParser.js";const te=a(`^(?:given\\s+operation|then\\s+(?:operation|compensated))(?:\\s|$)`),ne=a(`^(given operation|then operation|then compensated)\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)(\\s+fails)?$`),k=a(`^specification\\s+([A-Za-z_]\\w*)$`),A=k,j=a(`^given caller as ([A-Za-z_]\\w*)$`),stepPattern=(e,t=``)=>i(`^${e}\\s+([A-Z]\\w*(?:\\.\\w+)*)${t}(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`.replaceAll(`\\s`,r)),M=stepPattern(`given`),N=stepPattern(`when\\s+append`),P=stepPattern(`when`),F=stepPattern(`then`),I=a(`^then\\s+query\\b`),L=a(`^(?:given|then)\\s+readmodel\\b`),R=stepPattern(`given\\s+readmodel`),z=stepPattern(`then\\s+readmodel`,`(?<exactly>\\s+exactly)?`),B=a(`^then\\s+no\\b`),V=a(`^then\\s+error\\s+"(${t})"$`),H=a(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),U=i(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),W=a(`^given\\s+time\\s+zone\\b`),G=a(`^given\\s+time\\s+zone\\s+"(${t})"$`),K=a(`^given\\s+clock\\b`),q=a(`^given\\s+capture\\b`),J=a(`^then\\s+invokes\\b`),Y=a(`^then\\s+invokes\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),re=a(`^given\\s+generated\\b`),X=a(`^given\\s+generated\\s+([A-Z]\\w*)\\.([a-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`),ie=a(`^given\\s+generated\\s+([A-Z]\\w*)\\.([a-z_]\\w*)(?:\\s+(none|empty))?$`),ae=a(`^when\\s+clock\\b`),oe=a(`^when\\s+trigger\\b`),se=a(`^when\\s+capture\\b`),ce=a(`^when\\s+query\\b`),le=a(`^then\\s+result\\b`),ue=a(`^then\\s+no\\s+result\\b`),de=i(`^when\\s+redelivered\\b`),fe=i(`^when\\s+redelivered\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+to\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),pe=a(`^then\\s+no\\s+events\\b`),me=a(`^(given|when)\\s+clock\\s+"(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))"$`),he=a(`^when\\s+trigger\\s+([A-Za-z_]\\w*)$`),ge=a(`^(?:given|when)\\s+capture\\s+([A-Za-z_]\\w*)$`),_e=a(`^when\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),ve=a(`^then\\s+result(\\s+exactly)?$`),Z=i(`^then\\s+no\\s+readmodel\\s+([A-Z]\\w*)\\s+for(?:\\s+(.+))?$`),ye=i(`^(?:"${t}"|'(?:[^'\\\\]|\\\\.)*')$`),be=i(`^then\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(\\s+exactly)?$`);function parseSpecification(t,n){let r=k.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidSpecificationDeclaration,`Invalid specification declaration '${n.content}' - expected 'specification <Name>'`,s(n));let i=null,a=[],o=[],c={givenOperationFailures:[],thenOperations:[],thenCompensated:[],thenAbsentReadModels:[],thenQueries:[],given:[],givenReadModels:[],when:null,whenAppended:null,whenRedelivered:null,whenDeclared:!1,thenEvents:[],thenEventsInAnyOrder:!1,thenNoEvents:!1,thenReadModels:[],thenErrors:[],givenClock:null,givenTimeZone:null,givenCaptures:[],whenClock:null,whenTrigger:null,whenCapture:null,whenQuery:null,thenResults:[],thenNoResult:null,thenDenied:null,givenCaller:null,thenReturns:null};for(let u=t.peekChild(n.indent);u!==void 0;u=t.peekChild(n.indent)){if(t.reader.takeSignificant(),T(u)||parseOperationStep(t,u,c))continue;let n=B.test(u.content)?`then`:l(u.content);if(n===`parameter`){let e=b(t,u);e!==null&&a.push(e)}else if(n===`case`){let e=y(t,u);e!==null&&o.push(e)}else n===`description`?i=C(t,u,i,`Specification '${r}'`):n===`given`?parseGiven(t,u,c):n===`when`?parseWhen(t,u,c,r):n===`then`?parseThen(t,u,c):(t.error(e.UnknownSpecificationDirective,`Unexpected '${l(u.content)}' in specification body`,s(u)),t.skipBlock(u.indent))}c.noEventsLine!==void 0&&(c.thenEvents.length>0||c.thenEventsInAnyOrder||c.thenErrors.length>0||c.thenDenied!==null)&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot accompany event, event-order, error or denial expectations.`,s(c.noEventsLine)),validateQueryRejection(t,n,c);let{whenDeclared:u,noEventsLine:d,...f}=c,p={kind:`SpecificationSyntax`,sourceOptions:t.sourceOptions,name:r,description:i,...f,...a.length===0?{}:{parameters:a},...o.length===0?{}:{cases:o},location:s(n)};return S(p,t),p}function validateQueryRejection(t,n,r){isQueryRejectionCandidate(r)&&!isWellFormedQueryRejection(r)&&t.error(e.MismatchedSpecificationQueryResult,`A query rejection requires exactly one query and one 'then error', no action, and no other outcomes`,s(n))}function isQueryRejectionCandidate(e){return e.thenErrors.length>0&&queriedCallCount(e)>0&&(e.whenQuery!==null||!hasAction(e))}function isWellFormedQueryRejection(e){return!hasAction(e)&&hasOneQueryAndOneError(e)&&!hasOtherOutcome(e)}function hasOneQueryAndOneError(e){return queriedCallCount(e)===1&&e.thenErrors.length===1}function hasAction(e){return[e.when,e.whenAppended,e.whenClock,e.whenTrigger,e.whenCapture,e.whenRedelivered].some(e=>e!==null)}function queriedCallCount(e){return e.thenQueries.length+(e.whenQuery===null?0:1)}function hasOtherOutcome(e){return[e.thenResults.length>0,e.thenNoResult!==null,e.thenDenied!==null,e.thenEvents.length>0,e.thenNoEvents,e.thenEventsInAnyOrder,e.thenReadModels.length>0,e.thenAbsentReadModels.length>0,e.thenReturns!==null,e.thenQueries.some(e=>e.results.length>0)].some(e=>e)}function parseOperationStep(t,n,r){if(!te.test(n.content))return!1;let i=ne.exec(n.content);if(i===null||i[1]===`given operation`!=(i[3]!==void 0))t.error(e.InvalidOperationSpecification,`Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.`,s(n)),skipBody(t,n.indent);else if(i[1]===`then operation`){let a=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=h(t,r,H,e.InvalidOperationSpecification);n!==null&&a.push(n)}r.thenOperations.push({kind:`SpecificationOperationSyntax`,operation:i[2],values:a,location:s(n)})}else E(t,n,e.InvalidOperationSpecification,`Failure and compensation assertions cannot have children.`),i[1]===`given operation`?r.givenOperationFailures.push({kind:`SpecificationOperationFailureSyntax`,operation:i[2],location:s(n)}):r.thenCompensated.push({kind:`SpecificationCompensatedSyntax`,operation:i[2],location:s(n)});return!0}function parseGiven(t,r,i){if(K.test(r.content))i.givenClock===null?i.givenClock=parseClock(t,r,`given`):(t.error(e.InvalidSpecificationClock,`A specification states its clock at most once.`,s(r)),skipBody(t,r.indent));else if(W.test(r.content)){let a=G.exec(r.content);skipBody(t,r.indent),i.givenTimeZone!==null||a===null?t.error(e.InvalidSpecificationTimeZone,`A specification states its time zone at most once, as 'given time zone "<id>"'.`,s(r)):i.givenTimeZone={kind:`SpecificationTimeZoneSyntax`,id:n(a[1]),location:s(r)}}else if(re.test(r.content)){let e=parseGivenGenerated(t,r);e!==null&&(i.givenGenerated??=[]).push(e)}else if(q.test(r.content)){let e=parseCapture(t,r,`given`);e!==null&&i.givenCaptures.push(e)}else if(r.content.startsWith(`given caller`)){if(i.givenCaller!==null||i.givenCallerPersona!==void 0)t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'given caller' block.`,s(r)),t.skipBlock(r.indent);else if(r.content.startsWith(`given caller as`)){let n=j.exec(r.content);n===null&&t.error(e.InvalidSpecificationCallerPersona,`Expected 'given caller as <Persona>'.`,s(r));let a=t.peekChild(r.indent);a!==void 0&&t.error(e.InvalidSpecificationCallerPersona,`'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.`,s(a)),skipBody(t,r.indent),n!==null&&(i.givenCallerPersona={kind:`SpecificationCallerPersonaSyntax`,name:n[1],location:s(r)})}else i.givenCaller=parseCaller(t,r)}else if(L.test(r.content)){let e=parseReadModelStep(t,r,R,`given`);e!==void 0&&i.givenReadModels.push(e)}else{let e=parseEventStep(t,r,M,`given`);e!==void 0&&i.given.push(e)}}const xe=a(`^role${r}+"(${t})"$`),Se=a(`^claim${r}+"(${t})"${r}*=${r}*"(${t})"$`);function parseCaller(t,r){if(r.content!==`given caller`)return t.error(e.InvalidSpecificationCaller,`Expected exactly 'given caller'.`,s(r)),t.skipBlock(r.indent),null;let i=!1,a=[],o=[];for(let c=t.peekChild(r.indent);c!==void 0;c=t.peekChild(r.indent)){t.reader.takeSignificant();let r=xe.exec(c.content),l=Se.exec(c.content);c.content===`authenticated`&&!i?i=!0:r===null?l===null?t.error(v(c.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationCaller,`Invalid caller fixture '${c.content}' - expected authenticated, role "...", or claim "..." = "...".`,s(c)):o.push({kind:`SpecificationCallerClaimSyntax`,type:n(l[1]),value:n(l[2]),location:s(c)}):a.push(n(r[1]))}return{kind:`SpecificationCallerSyntax`,authenticated:i,roles:a,claims:o,location:s(r)}}function parseWhen(t,n,r,i){let a=n.content.startsWith(`when append`);if(r.whenDeclared){let o=r.whenAppended!==null||a?e.ConflictingSpecificationActions:e.DuplicateSpecificationWhen;t.error(o,`Specification '${i}' already declares a 'when' - a specification can have at most one`,s(n)),skipBody(t,n.indent);return}if(r.whenDeclared=!0,a){r.whenAppended=parseEventStep(t,n,N,`when append`)??null;return}if(de.test(n.content)){let i=fe.exec(n.content);i===null?(t.error(e.UnmatchedRedeliveredOccurrence,`Expected 'when redelivered <Event> to <Reaction>'.`,s(n)),skipBody(t,n.indent)):r.whenRedelivered={kind:`SpecificationRedeliverySyntax`,eventType:i[1],reaction:i[2],...parseValuesWithEventSource(t,n,void 0,void 0,`when redelivered`),location:s(n)};return}if(ae.test(n.content)){r.whenClock=parseClock(t,n,`when`);return}if(oe.test(n.content)){r.whenTrigger=parseNamedStep(t,n,he,e.InvalidSpecificationTrigger,`when trigger`,`when trigger <Trigger>`,(e,t)=>({kind:`SpecificationTriggerSyntax`,trigger:e,values:t,location:s(n)}));return}if(se.test(n.content)){r.whenCapture=parseCapture(t,n,`when`);return}if(ce.test(n.content)){r.whenQuery=parseNamedStep(t,n,_e,e.InvalidSpecificationQueryAction,`when query`,`when query <Query>`,(e,t)=>({kind:`SpecificationWhenQuerySyntax`,query:e,arguments:t,location:s(n)}),!0);return}let o=P.exec(n.content);if(o===null){t.error(e.InvalidSpecificationWhen,`Invalid 'when' declaration '${n.content}' - expected 'when <CommandType>' or 'when append <EventType>'`,s(n)),skipBody(t,n.indent);return}let c=[],l=parseValuesWithEventSource(t,n,c,o);r.when={kind:`SpecificationCommandSyntax`,commandType:o[1],...l,generatedValues:c,inlineProperty:o.groups?.property??null,location:s(n)}}function parseThen(t,r,i){if(pe.test(r.content)){r.content!==`then no events`||i.thenNoEvents?t.error(e.InvalidNoEventsExpectation,`Expected one 'then no events' directive.`,s(r)):(i.thenNoEvents=!0,i.noEventsLine=r);let n=t.peekChild(r.indent);n!==void 0&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot have child mappings.`,s(n)),skipBody(t,r.indent);return}if(_.test(r.content)){let n=g(t,r);i.thenReturns===null?i.thenReturns=n:t.error(e.InvalidReturnExpectation,`A specification declares at most one return expectation.`,s(r));return}if(r.content.startsWith(`then events`)){r.content!==`then events in any order`||i.thenEventsInAnyOrder?t.error(e.InvalidSpecificationEventOrder,`Expected one 'then events in any order' directive.`,s(r)):i.thenEventsInAnyOrder=!0,skipBody(t,r.indent);return}if(le.test(r.content)){parseResult(t,r,i);return}if(ue.test(r.content)){r.content!==`then no result`||i.thenNoResult!==null?t.error(e.InvalidSpecificationQueryAction,`Expected one 'then no result' directive.`,s(r)):i.thenNoResult={kind:`SpecificationNoResultSyntax`,location:s(r)},skipBody(t,r.indent);return}if(J.test(r.content)){let n=parseNamedStep(t,r,Y,e.InvalidSpecificationInvocation,`then invokes`,`then invokes <Command>`,(e,t)=>({kind:`SpecificationInvocationSyntax`,command:e,values:t,location:s(r)}));n!==null&&(i.thenInvocations??=[]).push(n);return}if(r.content.startsWith(`then denied`)){r.content===`then denied`?i.thenDenied===null?i.thenDenied={kind:`SpecificationDeniedSyntax`,location:s(r)}:t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'then denied' outcome.`,s(r)):(t.error(e.InvalidSpecificationDenied,`Expected exactly 'then denied'.`,s(r)),skipBody(t,r.indent));return}if(r.content===`then error`){i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,location:s(r)});return}if(r.content.startsWith(`then error case.`)){let e=x(r.content.substring(11),{...s(r),column:s(r).column+11},t);e.kind===`CaseValueExpressionSyntax`&&i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,caseValue:e,location:s(r)});return}let a=V.exec(r.content);if(a!==null){i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:n(a[1]),location:s(r)});return}if(l(r.content.substring(4).trim())===`error`){t.error(e.InvalidThenError,`Invalid 'then error' declaration '${r.content}' - expected 'then error' or 'then error "<reason>"'`,s(r)),skipBody(t,r.indent);return}if(B.test(r.content)){if(t.sourceOptions.numericMode===`exact`){let e=parseAbsentReadModel(t,r);e!==null&&i.thenAbsentReadModels.push(e);return}let e=Z.exec(r.content);if(e!==null&&e[2]===void 0&&t.peekChild(r.indent)!==void 0){i.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:e[1],key:u(t.valueContext,r,void 0),location:s(r)});return}if(e!==null&&e[2]!==void 0&&!e[2].endsWith(` exactly`)){let n=x(e[2].trim(),s(r),t.valueContext);(n.kind===`LiteralExpressionSyntax`||n.kind===`ObjectExpressionSyntax`||n.kind===`CaseValueExpressionSyntax`)&&i.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:e[1],key:n,location:s(r)})}t.skipOpaqueBlock(r.indent);return}if(I.test(r.content)){let n=t.sourceOptions.numericMode===`exact`,reject=(e,r,i)=>{if(!n)return t.skipOpaqueBlock(i.indent);t.error(e,r,s(i)),t.skipBlock(i.indent)},a=be.exec(r.content);if(a===null)return reject(e.InvalidSpecificationQuery,`Invalid 'then query' declaration '${r.content}' - expected 'then query <Query> [exactly]'`,r);let o=[],c=[],u=!1;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent))t.reader.takeSignificant(),n.content===`arguments`&&!u?o.push(...parseValues(t.valueContext,n,!0,void 0,t)):n.content===`arguments`?reject(e.DuplicateSpecificationQueryArguments,`Query assertion '${a[1]}' already declares arguments`,n):n.content===`result`?c.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t.valueContext,n,!0),exactly:!1,location:s(n)}):reject(e.UnknownSpecificationQueryDirective,`Unexpected '${l(n.content)}' in 'then query' body - expected arguments or result`,n),u||=n.content===`arguments`;i.thenQueries.push({kind:`SpecificationQuerySyntax`,query:a[1],arguments:o,results:c,exactly:a[2]!==void 0,location:s(r)});return}if(L.test(r.content)){let e=parseReadModelStep(t,r,z,`then`);e!==void 0&&i.thenReadModels.push(e);return}let o=parseEventStep(t,r,F,`then`);o!==void 0&&i.thenEvents.push(o)}function parseAbsentReadModel(t,n){let r=Z.exec(n.content);if(r!==null&&r[2]===void 0&&t.peekChild(n.indent)!==void 0)return{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:u(t,n,void 0),location:s(n)};if(r===null||r[2]===void 0||r[2].endsWith(` exactly`))return t.error(e.InvalidAbsentReadModelStep,`Invalid absence assertion '${n.content}' - expected 'then no readmodel <ReadModelType> for <key>'`,s(n)),skipBody(t,n.indent),null;let i=r[2].trim(),a=!(i.startsWith(`"`)||i.startsWith(`'`))||ye.test(i)?x(i,s(n),t.valueContext):null,o=a!==null&&(a.kind===`LiteralExpressionSyntax`||a.kind===`ObjectExpressionSyntax`||a.kind===`CaseValueExpressionSyntax`);o||t.error(e.InvalidAbsentReadModelStep,`Invalid absence key '${i}' - expected exactly one concrete value.`,s(n));let c=!1;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),t.error(e.InvalidAbsentReadModelStep,`An absent read model assertion cannot have child mappings.`,s(r)),c=!0;return c||!o?null:{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:a,location:s(n)}}function skipBody(e,t){if(e.sourceOptions.numericMode!==`exact`)return e.skipBlock(t);e.skipOpaqueBlock(t)}function parseClock(t,n,r){let i=me.exec(n.content);return skipBody(t,n.indent),i===null||i[1]!==r?(t.error(v(n.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationClock,`Invalid '${r} clock' - expected '${r} clock "<ISO 8601 instant>"', such as '${r} clock "2026-10-05T08:00:00Z"'`,s(n)),null):{kind:`SpecificationClockSyntax`,instant:i[2],location:s(n)}}function parseGivenGenerated(t,n){let r=X.exec(n.content),i=r===null?ie.exec(n.content):null;if(i!==null)return{kind:`SpecificationGeneratedValueSyntax`,command:i[1],property:i[2],source:u(t,n,i[3]),location:s(n)};if(r===null)return t.error(e.InvalidGeneratedFixture,`Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.`,s(n)),t.skipBlock(n.indent),null;let a=s(n),o=m(t,r[3],{...a,column:a.column+n.content.indexOf(r[3],n.content.indexOf(`=`)+1)},e.InvalidGeneratedFixture),c=t.peekChild(n.indent);return c!==void 0&&(t.error(e.InvalidGeneratedFixture,`A pinned generated value cannot have child directives.`,s(c)),t.skipBlock(n.indent)),o===null?null:{kind:`SpecificationGeneratedValueSyntax`,command:r[1],property:r[2],source:o,location:a}}function parseCapture(t,n,r){return parseNamedStep(t,n,ge,e.InvalidSpecificationCapture,`${r} capture`,`${r} capture <Capture>`,(e,t)=>({kind:`SpecificationCaptureSyntax`,capture:e,record:t,location:s(n)}))}function parseNamedStep(e,t,n,r,i,a,o,c=!1){let l=n.exec(t.content);return l===null?(e.error(r,`Invalid '${i}' declaration '${t.content}' - expected '${a}'`,s(t)),skipBody(e,t.indent),null):o(l[1],parseValues(e,t,!1,void 0,c?e:void 0))}function parseResult(t,n,r){let i=ve.exec(n.content);i===null?(t.error(e.InvalidSpecificationQueryAction,`Invalid 'then result' declaration '${n.content}' - expected 'then result [exactly]'`,s(n)),skipBody(t,n.indent)):r.thenResults.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t,n),exactly:i[1]!==void 0,location:s(n)})}function parseReadModelStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidReadModelStep,`Invalid '${i} readmodel' declaration '${n.content}' - expected '${i} readmodel <ReadModelType>'`,s(n)),skipBody(t,n.indent);else return{kind:`SpecificationReadModelSyntax`,name:a[1],properties:parseValues(t,n,!1,a),exactly:i===`then`&&a.groups?.exactly!==void 0,inlineProperty:a.groups?.property??null,location:s(n)}}function parseEventStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidEventStep,`Invalid '${i}' declaration '${n.content}' - expected '${i} <EventType>'`,s(n)),skipBody(t,n.indent);else return{kind:`SpecificationEventSyntax`,eventType:a[1],...parseValuesWithEventSource(t,n,void 0,a,i),inlineProperty:a.groups?.property??null,location:s(n)}}const Q=ee(`^stream\\s+([A-Za-z_]\\w*)\\.([A-Za-z_]\\w*)$`),Ce=a(`^streamId\\s*=(?!=|>)\\s*(.+)$`);function parseValuesWithEventSource(t,n,r,i,a){let o=[];O(t,n,i,o);let u=null,m,g,_=!1;for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n;if(r!==void 0&&p.test(i.content)){let n=h(t,i,f,e.InvalidGeneratedFixture);n!==null&&r.push(n);continue}let v=H.exec(i.content);if(v!==null)D(t,o,mappingOf(t,i,v));else if(l(i.content)===`stream`||i.content.startsWith(`no stream`)){if(a===void 0){t.error(e.SpecificationStreamOnCommand,`A command occurrence cannot declare a route; assert it on a then event.`,s(i)),t.skipBlock(i.indent);continue}if(_){t.error(e.InvalidSpecificationStream,`An event occurrence declares at most one stream or no stream directive.`,s(i)),t.skipBlock(i.indent);continue}let n=Q.exec(i.content);i.content===`no stream`&&(a===`then`||a===`when redelivered`)?(g={kind:`SpecificationNoStreamSyntax`,location:s(i)},_=!0,rejectSpecificationRouteChildren(t,i)):n===null?(t.error(e.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on a then event.`,s(i)),t.skipBlock(i.indent)):(m=parseSpecificationStream(t,i,n),_=!0)}else if(l(i.content)===`for`){let n=i.content.substring(3).trim();n.length===0?t.error(e.InvalidSpecificationEventSource,`Invalid event-source assertion 'for' - expected 'for <value>'`,s(i)):u===null?u=x(n,s(i),t):t.error(e.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,s(i))}else(n=d(t,i))===void 0?t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i),c(`text`,i.content)):D(t,o,n)}return{values:o,for:u,...m===void 0?{}:{stream:m},...g===void 0?{}:{noStream:g}}}function parseSpecificationStream(t,n,r){let i=null,a=[],o=!1,c={};for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r.content===`streamId`){i!==null||o?(t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,s(r)),t.skipBlock(r.indent)):(o=!0,c.streamId=s(r),a=w(t,r,e.InvalidSpecificationStream).map(e=>e.source.kind===`PathExpressionSyntax`&&e.source.path.startsWith(`case.`)?{...e,source:x(e.source.path,e.source.location,t)}:e));continue}let n=Ce.exec(r.content);if(n===null||i!==null||o){t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,s(r)),t.skipBlock(r.indent);continue}let l={...s(r),column:r.indent+1+r.content.indexOf(n[1],r.content.indexOf(`=`)+1)};i={kind:`PropertyMappingSyntax`,property:`streamId`,source:x(n[1],l,t),location:s(r)},rejectSpecificationRouteChildren(t,r)}return{kind:`SpecificationStreamSyntax`,eventSource:r[1],stream:r[2],streamId:i,streamIdParts:a,directiveLocations:c,referenceLocation:{...s(n),column:n.indent+1+n.content.indexOf(r[1],6)},referenceLength:r[1].length+1+r[2].length,location:s(n)}}function rejectSpecificationRouteChildren(t,n){let r=t.peekChild(n.indent);r!==void 0&&(t.error(e.InvalidSpecificationStream,`This directive cannot have children.`,s(r)),t.skipBlock(n.indent))}function parseValues(t,n,r=!1,i,a){let o=[];O(t,n,i,o);for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n=(r||t.sourceOptions.numericMode===`exact`?U:H).exec(i.content),l=n===null?d(t,i):void 0;if(n===null&&l===void 0){t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i),c(`text`,i.content));continue}let u=l??mappingOf(t,i,n,r);a===void 0?D(t,o,u):(o.some(e=>e.property===u.property)&&a.error(e.UnknownSpecificationQueryArgument,`Query argument '${u.property}' is repeated.`,u.location,c(`argument`,u.property)),o.push(u))}return o}function mappingOf(e,t,n,r=!1){return{kind:`PropertyMappingSyntax`,property:n[1],source:x(n[2],s(t),e,r),location:s(t)}}const $=a(`^when\\s+start\\s+(.+)$`),we=a(`^outcome\\s+([A-Za-z_]\\w*)\\s+([A-Za-z_]\\w*)$`),Te=a(`^then\\s+(is|sends|starts|completes|fails\\s+at|waits\\s+at)(?:\\s+([A-Za-z_]\\w*))?$`);function lifecycleExpectation(e){let t=Te.exec(e.content);if(t===null)return;let n=t[1].replace(/\s+/g,` `),r=n===`is`?`State`:n===`sends`?`Sends`:n===`starts`?`Starts`:n===`completes`?`Completes`:n===`fails at`?`Fails`:`Waits`;if(t[2]!==void 0!=(r===`Completes`))return{kind:`LifecycleExpectationSyntax`,expectation:r,target:t[2]??null,location:s(e)}}function parseLifecycleSpecification(e,t,n){let r=A.exec(t.content);if(r===null)return e.error(n,`Invalid specification '${t.content}' - expected 'specification <Name>'.`,s(t)),skipBody(e,t.indent),{kind:`LifecycleSpecificationSyntax`,name:``,description:null,given:[],whenAppended:null,whenStarted:null,outcomes:[],then:[],location:s(t)};let i=r[1],a=null,c=[],u=null,d=null,f=!1,p=[],m=[],h={};for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent)){e.reader.takeSignificant();let t=l(r.content);if(t===`description`)a=C(e,r,a,`Specification '${i}'`),h.description??=s(r);else if(t===`given`){let t=parseEventStep(e,r,M,`given`);t!==void 0&&c.push(t)}else if(t===`when`){if(f){e.error(n,`Specification '${i}' already declares a 'when'.`,s(r)),skipBody(e,r.indent);continue}f=!0;let t=$.exec(r.content);if(t!==null){let n=r.content.indexOf(t[1],10);d=x(t[1].trim(),o(r.number,r.indent+(r.contentOffset??0)+1+n,r.path),e)}else r.content.startsWith(`when append`)?u=parseEventStep(e,r,N,`when append`)??null:(e.error(n,`Invalid '${r.content}' - expected 'when append <Event>' or 'when start <key>'.`,s(r)),skipBody(e,r.indent))}else if(t===`outcome`){let t=we.exec(r.content);t===null?e.error(n,`Invalid outcome '${r.content}' - expected 'outcome <Node> <outlet>'.`,s(r)):p.push({kind:`LifecycleOutcomeSyntax`,node:t[1],outlet:t[2],location:s(r)}),E(e,r,n,`An outcome cannot have children.`)}else if(t===`then`){let t=lifecycleExpectation(r);t===void 0?e.error(n,`Invalid '${r.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`,s(r)):m.push(t),E(e,r,n,`A then line cannot have children.`)}else e.error(n,`Unexpected '${r.content}' in specification '${i}' - expected description, given, when, outcome or then.`,s(r)),e.skipBlock(r.indent)}return{kind:`LifecycleSpecificationSyntax`,name:i,description:a,given:c,whenAppended:u,whenStarted:d,outcomes:p,then:m,location:s(t),directiveLocations:h}}export{parseLifecycleSpecification,parseSpecification,parseSpecificationStream,rejectSpecificationRouteChildren,Q as specificationStream};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{parseRouteParts as e}from"./EventSourceParser.js";import{diagnosticText as t}from"../Diagnostics/DiagnosticArgument.js";import{DiagnosticCodes as n}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as r,nativePattern as i,pattern as a}from"../Text/patterns.js";import{sourceStreamPattern as o}from"../Text/SourceStreamNames.js";import{stringBodyPattern as s,unescapeString as c}from"../Text/StringLiteral.js";import{containsCaseReference as l,parseCase as u,parseParameter as d,parseSpecificationValue as f,validateTable as p}from"./SpecificationCaseParser.js";import{parseDescription as m}from"./DescriptionParser.js";import{isFileDirective as ee}from"./FileReferences.js";import{firstWord as h}from"./LineText.js";import{addFixtureValue as g,addInlineValue as _}from"./SpecificationExampleParser.js";import{rejectOperationChildren as v}from"./OperationParser.js";import{generatedFixturePattern as y,generatedFixturePrefix as b,parseConcrete as te,parseConcreteMapping as x,parseReturn as S,thenReturnsPrefix as C}from"./SpecificationResponseParser.js";import{locationOf as w}from"./SourceLine.js";import{sourceLocation as T}from"../Diagnostics/SourceLocation.js";import{parseStructuredValue as E,tryParseStructuredMapping as D}from"./StructuredBlockParser.js";const ne=a(`^(?:given\\s+operation|then\\s+(?:operation|compensated))(?:\\s|$)`),re=a(`^(given operation|then operation|then compensated)\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)(\\s+fails)?$`),O=a(`^specification\\s+([A-Za-z_]\\w*)$`),k=O,A=a(`^given caller as ([A-Za-z_]\\w*)$`),stepPattern=(e,t=``)=>i(`^${e}\\s+([A-Z]\\w*(?:\\.\\w+)*)${t}(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`.replaceAll(`\\s`,r)),j=stepPattern(`given`),M=stepPattern(`when\\s+append`),N=stepPattern(`when`),P=stepPattern(`then`),F=a(`^then\\s+query\\b`),I=a(`^(?:given|then)\\s+readmodel\\b`),L=stepPattern(`given\\s+readmodel`),R=stepPattern(`then\\s+readmodel`,`(?<exactly>\\s+exactly)?`),z=a(`^then\\s+no\\b`),B=a(`^then\\s+error\\s+"(${s})"$`),V=a(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),H=i(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),U=a(`^given\\s+time\\s+zone\\b`),W=a(`^given\\s+time\\s+zone\\s+"(${s})"$`),G=a(`^given\\s+clock\\b`),K=a(`^given\\s+capture\\b`),q=a(`^then\\s+invokes\\b`),J=a(`^then\\s+invokes\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),Y=a(`^given\\s+generated\\b`),X=a(`^given\\s+generated\\s+([A-Z]\\w*)\\.([a-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`),ie=a(`^given\\s+generated\\s+([A-Z]\\w*)\\.([a-z_]\\w*)(?:\\s+(none|empty))?$`),ae=a(`^when\\s+clock\\b`),oe=a(`^when\\s+trigger\\b`),se=a(`^when\\s+capture\\b`),ce=a(`^when\\s+query\\b`),le=a(`^then\\s+result\\b`),ue=a(`^then\\s+no\\s+result\\b`),de=i(`^when\\s+redelivered\\b`),fe=i(`^when\\s+redelivered\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+to\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),pe=a(`^then\\s+no\\s+events\\b`),me=a(`^(given|when)\\s+clock\\s+"(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))"$`),he=a(`^when\\s+trigger\\s+([A-Za-z_]\\w*)$`),ge=a(`^(?:given|when)\\s+capture\\s+([A-Za-z_]\\w*)$`),_e=a(`^when\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),ve=a(`^then\\s+result(\\s+exactly)?$`),Z=i(`^then\\s+no\\s+readmodel\\s+([A-Z]\\w*)\\s+for(?:\\s+(.+))?$`),ye=i(`^(?:"${s}"|'(?:[^'\\\\]|\\\\.)*')$`),be=i(`^then\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(\\s+exactly)?$`);function parseSpecification(e,t){let r=O.exec(t.content)?.[1]??``;r===``&&e.error(n.InvalidSpecificationDeclaration,`Invalid specification declaration '${t.content}' - expected 'specification <Name>'`,w(t));let i=null,a=[],o=[],s={givenOperationFailures:[],thenOperations:[],thenCompensated:[],thenAbsentReadModels:[],thenQueries:[],given:[],givenReadModels:[],when:null,whenAppended:null,whenRedelivered:null,whenDeclared:!1,thenEvents:[],thenEventsInAnyOrder:!1,thenNoEvents:!1,thenReadModels:[],thenErrors:[],givenClock:null,givenTimeZone:null,givenCaptures:[],whenClock:null,whenTrigger:null,whenCapture:null,whenQuery:null,thenResults:[],thenNoResult:null,thenDenied:null,givenCaller:null,thenReturns:null};for(let c=e.peekChild(t.indent);c!==void 0;c=e.peekChild(t.indent)){if(e.reader.takeSignificant(),ee(c)||parseOperationStep(e,c,s))continue;let t=z.test(c.content)?`then`:h(c.content);if(t===`parameter`){let t=d(e,c);t!==null&&a.push(t)}else if(t===`case`){let t=u(e,c);t!==null&&o.push(t)}else t===`description`?i=m(e,c,i,`Specification '${r}'`):t===`given`?parseGiven(e,c,s):t===`when`?parseWhen(e,c,s,r):t===`then`?parseThen(e,c,s):(e.error(n.UnknownSpecificationDirective,`Unexpected '${h(c.content)}' in specification body`,w(c)),e.skipBlock(c.indent))}s.noEventsLine!==void 0&&(s.thenEvents.length>0||s.thenEventsInAnyOrder||s.thenErrors.length>0||s.thenDenied!==null)&&e.error(n.InvalidNoEventsExpectation,`'then no events' cannot accompany event, event-order, error or denial expectations.`,w(s.noEventsLine)),validateQueryRejection(e,t,s);let{whenDeclared:c,noEventsLine:l,...f}=s,g={kind:`SpecificationSyntax`,sourceOptions:e.sourceOptions,name:r,description:i,...f,...a.length===0?{}:{parameters:a},...o.length===0?{}:{cases:o},location:w(t)};return p(g,e),g}function validateQueryRejection(e,t,r){isQueryRejectionCandidate(r)&&!isWellFormedQueryRejection(r)&&e.error(n.MismatchedSpecificationQueryResult,`A query rejection requires exactly one query and one 'then error', no action, and no other outcomes`,w(t))}function isQueryRejectionCandidate(e){return e.thenErrors.length>0&&queriedCallCount(e)>0&&(e.whenQuery!==null||!hasAction(e))}function isWellFormedQueryRejection(e){return!hasAction(e)&&hasOneQueryAndOneError(e)&&!hasOtherOutcome(e)}function hasOneQueryAndOneError(e){return queriedCallCount(e)===1&&e.thenErrors.length===1}function hasAction(e){return[e.when,e.whenAppended,e.whenClock,e.whenTrigger,e.whenCapture,e.whenRedelivered].some(e=>e!==null)}function queriedCallCount(e){return e.thenQueries.length+(e.whenQuery===null?0:1)}function hasOtherOutcome(e){return[e.thenResults.length>0,e.thenNoResult!==null,e.thenDenied!==null,e.thenEvents.length>0,e.thenNoEvents,e.thenEventsInAnyOrder,e.thenReadModels.length>0,e.thenAbsentReadModels.length>0,e.thenReturns!==null,e.thenQueries.some(e=>e.results.length>0)].some(e=>e)}function parseOperationStep(e,t,r){if(!ne.test(t.content))return!1;let i=re.exec(t.content);if(i===null||i[1]===`given operation`!=(i[3]!==void 0))e.error(n.InvalidOperationSpecification,`Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.`,w(t)),skipBody(e,t.indent);else if(i[1]===`then operation`){let a=[];for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent)){e.reader.takeSignificant();let t=x(e,r,V,n.InvalidOperationSpecification);t!==null&&a.push(t)}r.thenOperations.push({kind:`SpecificationOperationSyntax`,operation:i[2],values:a,location:w(t)})}else v(e,t,n.InvalidOperationSpecification,`Failure and compensation assertions cannot have children.`),i[1]===`given operation`?r.givenOperationFailures.push({kind:`SpecificationOperationFailureSyntax`,operation:i[2],location:w(t)}):r.thenCompensated.push({kind:`SpecificationCompensatedSyntax`,operation:i[2],location:w(t)});return!0}function parseGiven(e,t,r){if(G.test(t.content))r.givenClock===null?r.givenClock=parseClock(e,t,`given`):(e.error(n.InvalidSpecificationClock,`A specification states its clock at most once.`,w(t)),skipBody(e,t.indent));else if(U.test(t.content)){let i=W.exec(t.content);skipBody(e,t.indent),r.givenTimeZone!==null||i===null?e.error(n.InvalidSpecificationTimeZone,`A specification states its time zone at most once, as 'given time zone "<id>"'.`,w(t)):r.givenTimeZone={kind:`SpecificationTimeZoneSyntax`,id:c(i[1]),location:w(t)}}else if(Y.test(t.content)){let n=parseGivenGenerated(e,t);n!==null&&(r.givenGenerated??=[]).push(n)}else if(K.test(t.content)){let n=parseCapture(e,t,`given`);n!==null&&r.givenCaptures.push(n)}else if(t.content.startsWith(`given caller`)){if(r.givenCaller!==null||r.givenCallerPersona!==void 0)e.error(n.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'given caller' block.`,w(t)),e.skipBlock(t.indent);else if(t.content.startsWith(`given caller as`)){let i=A.exec(t.content);i===null&&e.error(n.InvalidSpecificationCallerPersona,`Expected 'given caller as <Persona>'.`,w(t));let a=e.peekChild(t.indent);a!==void 0&&e.error(n.InvalidSpecificationCallerPersona,`'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.`,w(a)),skipBody(e,t.indent),i!==null&&(r.givenCallerPersona={kind:`SpecificationCallerPersonaSyntax`,name:i[1],location:w(t)})}else r.givenCaller=parseCaller(e,t)}else if(I.test(t.content)){let n=parseReadModelStep(e,t,L,`given`);n!==void 0&&r.givenReadModels.push(n)}else{let n=parseEventStep(e,t,j,`given`);n!==void 0&&r.given.push(n)}}const xe=a(`^role${r}+"(${s})"$`),Se=a(`^claim${r}+"(${s})"${r}*=${r}*"(${s})"$`);function parseCaller(e,t){if(t.content!==`given caller`)return e.error(n.InvalidSpecificationCaller,`Expected exactly 'given caller'.`,w(t)),e.skipBlock(t.indent),null;let r=!1,i=[],a=[];for(let o=e.peekChild(t.indent);o!==void 0;o=e.peekChild(t.indent)){e.reader.takeSignificant();let t=xe.exec(o.content),s=Se.exec(o.content);o.content===`authenticated`&&!r?r=!0:t===null?s===null?e.error(l(o.content)?n.InvalidSpecificationCaseReference:n.InvalidSpecificationCaller,`Invalid caller fixture '${o.content}' - expected authenticated, role "...", or claim "..." = "...".`,w(o)):a.push({kind:`SpecificationCallerClaimSyntax`,type:c(s[1]),value:c(s[2]),location:w(o)}):i.push(c(t[1]))}return{kind:`SpecificationCallerSyntax`,authenticated:r,roles:i,claims:a,location:w(t)}}function parseWhen(e,t,r,i){let a=t.content.startsWith(`when append`);if(r.whenDeclared){let o=r.whenAppended!==null||a?n.ConflictingSpecificationActions:n.DuplicateSpecificationWhen;e.error(o,`Specification '${i}' already declares a 'when' - a specification can have at most one`,w(t)),skipBody(e,t.indent);return}if(r.whenDeclared=!0,a){r.whenAppended=parseEventStep(e,t,M,`when append`)??null;return}if(de.test(t.content)){let i=fe.exec(t.content);i===null?(e.error(n.UnmatchedRedeliveredOccurrence,`Expected 'when redelivered <Event> to <Reaction>'.`,w(t)),skipBody(e,t.indent)):r.whenRedelivered={kind:`SpecificationRedeliverySyntax`,eventType:i[1],reaction:i[2],...parseValuesWithEventSource(e,t,void 0,void 0,`when redelivered`),location:w(t)};return}if(ae.test(t.content)){r.whenClock=parseClock(e,t,`when`);return}if(oe.test(t.content)){r.whenTrigger=parseNamedStep(e,t,he,n.InvalidSpecificationTrigger,`when trigger`,`when trigger <Trigger>`,(e,n)=>({kind:`SpecificationTriggerSyntax`,trigger:e,values:n,location:w(t)}));return}if(se.test(t.content)){r.whenCapture=parseCapture(e,t,`when`);return}if(ce.test(t.content)){r.whenQuery=parseNamedStep(e,t,_e,n.InvalidSpecificationQueryAction,`when query`,`when query <Query>`,(e,n)=>({kind:`SpecificationWhenQuerySyntax`,query:e,arguments:n,location:w(t)}),!0);return}let o=N.exec(t.content);if(o===null){e.error(n.InvalidSpecificationWhen,`Invalid 'when' declaration '${t.content}' - expected 'when <CommandType>' or 'when append <EventType>'`,w(t)),skipBody(e,t.indent);return}let s=[],c=parseValuesWithEventSource(e,t,s,o);r.when={kind:`SpecificationCommandSyntax`,commandType:o[1],...c,generatedValues:s,inlineProperty:o.groups?.property??null,location:w(t)}}function parseThen(e,t,r){if(pe.test(t.content)){t.content!==`then no events`||r.thenNoEvents?e.error(n.InvalidNoEventsExpectation,`Expected one 'then no events' directive.`,w(t)):(r.thenNoEvents=!0,r.noEventsLine=t);let i=e.peekChild(t.indent);i!==void 0&&e.error(n.InvalidNoEventsExpectation,`'then no events' cannot have child mappings.`,w(i)),skipBody(e,t.indent);return}if(C.test(t.content)){let i=S(e,t);r.thenReturns===null?r.thenReturns=i:e.error(n.InvalidReturnExpectation,`A specification declares at most one return expectation.`,w(t));return}if(t.content.startsWith(`then events`)){t.content!==`then events in any order`||r.thenEventsInAnyOrder?e.error(n.InvalidSpecificationEventOrder,`Expected one 'then events in any order' directive.`,w(t)):r.thenEventsInAnyOrder=!0,skipBody(e,t.indent);return}if(le.test(t.content)){parseResult(e,t,r);return}if(ue.test(t.content)){t.content!==`then no result`||r.thenNoResult!==null?e.error(n.InvalidSpecificationQueryAction,`Expected one 'then no result' directive.`,w(t)):r.thenNoResult={kind:`SpecificationNoResultSyntax`,location:w(t)},skipBody(e,t.indent);return}if(q.test(t.content)){let i=parseNamedStep(e,t,J,n.InvalidSpecificationInvocation,`then invokes`,`then invokes <Command>`,(e,n)=>({kind:`SpecificationInvocationSyntax`,command:e,values:n,location:w(t)}));i!==null&&(r.thenInvocations??=[]).push(i);return}if(t.content.startsWith(`then denied`)){t.content===`then denied`?r.thenDenied===null?r.thenDenied={kind:`SpecificationDeniedSyntax`,location:w(t)}:e.error(n.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'then denied' outcome.`,w(t)):(e.error(n.InvalidSpecificationDenied,`Expected exactly 'then denied'.`,w(t)),skipBody(e,t.indent));return}if(t.content===`then error`){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,location:w(t)});return}if(t.content.startsWith(`then error case.`)){let n=f(t.content.substring(11),{...w(t),column:w(t).column+11},e);n.kind===`CaseValueExpressionSyntax`&&r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,caseValue:n,location:w(t)});return}let i=B.exec(t.content);if(i!==null){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:c(i[1]),location:w(t)});return}if(h(t.content.substring(4).trim())===`error`){e.error(n.InvalidThenError,`Invalid 'then error' declaration '${t.content}' - expected 'then error' or 'then error "<reason>"'`,w(t)),skipBody(e,t.indent);return}if(z.test(t.content)){if(e.sourceOptions.numericMode===`exact`){let n=parseAbsentReadModel(e,t);n!==null&&r.thenAbsentReadModels.push(n);return}let n=Z.exec(t.content);if(n!==null&&n[2]===void 0&&e.peekChild(t.indent)!==void 0){r.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:n[1],key:E(e.valueContext,t,void 0),location:w(t)});return}if(n!==null&&n[2]!==void 0&&!n[2].endsWith(` exactly`)){let i=f(n[2].trim(),w(t),e.valueContext);(i.kind===`LiteralExpressionSyntax`||i.kind===`ObjectExpressionSyntax`||i.kind===`CaseValueExpressionSyntax`)&&r.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:n[1],key:i,location:w(t)})}e.skipOpaqueBlock(t.indent);return}if(F.test(t.content)){let i=e.sourceOptions.numericMode===`exact`,reject=(t,n,r)=>{if(!i)return e.skipOpaqueBlock(r.indent);e.error(t,n,w(r)),e.skipBlock(r.indent)},a=be.exec(t.content);if(a===null)return reject(n.InvalidSpecificationQuery,`Invalid 'then query' declaration '${t.content}' - expected 'then query <Query> [exactly]'`,t);let o=[],s=[],c=!1;for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),r.content===`arguments`&&!c?o.push(...parseValues(e.valueContext,r,!0,void 0,e)):r.content===`arguments`?reject(n.DuplicateSpecificationQueryArguments,`Query assertion '${a[1]}' already declares arguments`,r):r.content===`result`?s.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(e.valueContext,r,!0),exactly:!1,location:w(r)}):reject(n.UnknownSpecificationQueryDirective,`Unexpected '${h(r.content)}' in 'then query' body - expected arguments or result`,r),c||=r.content===`arguments`;r.thenQueries.push({kind:`SpecificationQuerySyntax`,query:a[1],arguments:o,results:s,exactly:a[2]!==void 0,location:w(t)});return}if(I.test(t.content)){let n=parseReadModelStep(e,t,R,`then`);n!==void 0&&r.thenReadModels.push(n);return}let a=parseEventStep(e,t,P,`then`);a!==void 0&&r.thenEvents.push(a)}function parseAbsentReadModel(e,t){let r=Z.exec(t.content);if(r!==null&&r[2]===void 0&&e.peekChild(t.indent)!==void 0)return{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:E(e,t,void 0),location:w(t)};if(r===null||r[2]===void 0||r[2].endsWith(` exactly`))return e.error(n.InvalidAbsentReadModelStep,`Invalid absence assertion '${t.content}' - expected 'then no readmodel <ReadModelType> for <key>'`,w(t)),skipBody(e,t.indent),null;let i=r[2].trim(),a=!(i.startsWith(`"`)||i.startsWith(`'`))||ye.test(i)?f(i,w(t),e.valueContext):null,o=a!==null&&(a.kind===`LiteralExpressionSyntax`||a.kind===`ObjectExpressionSyntax`||a.kind===`CaseValueExpressionSyntax`);o||e.error(n.InvalidAbsentReadModelStep,`Invalid absence key '${i}' - expected exactly one concrete value.`,w(t));let s=!1;for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),e.error(n.InvalidAbsentReadModelStep,`An absent read model assertion cannot have child mappings.`,w(r)),s=!0;return s||!o?null:{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:a,location:w(t)}}function skipBody(e,t){if(e.sourceOptions.numericMode!==`exact`)return e.skipBlock(t);e.skipOpaqueBlock(t)}function parseClock(e,t,r){let i=me.exec(t.content);return skipBody(e,t.indent),i===null||i[1]!==r?(e.error(l(t.content)?n.InvalidSpecificationCaseReference:n.InvalidSpecificationClock,`Invalid '${r} clock' - expected '${r} clock "<ISO 8601 instant>"', such as '${r} clock "2026-10-05T08:00:00Z"'`,w(t)),null):{kind:`SpecificationClockSyntax`,instant:i[2],location:w(t)}}function parseGivenGenerated(e,t){let r=X.exec(t.content),i=r===null?ie.exec(t.content):null;if(i!==null)return{kind:`SpecificationGeneratedValueSyntax`,command:i[1],property:i[2],source:E(e,t,i[3]),location:w(t)};if(r===null)return e.error(n.InvalidGeneratedFixture,`Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.`,w(t)),e.skipBlock(t.indent),null;let a=w(t),o=te(e,r[3],{...a,column:a.column+t.content.indexOf(r[3],t.content.indexOf(`=`)+1)},n.InvalidGeneratedFixture),s=e.peekChild(t.indent);return s!==void 0&&(e.error(n.InvalidGeneratedFixture,`A pinned generated value cannot have child directives.`,w(s)),e.skipBlock(t.indent)),o===null?null:{kind:`SpecificationGeneratedValueSyntax`,command:r[1],property:r[2],source:o,location:a}}function parseCapture(e,t,r){return parseNamedStep(e,t,ge,n.InvalidSpecificationCapture,`${r} capture`,`${r} capture <Capture>`,(e,n)=>({kind:`SpecificationCaptureSyntax`,capture:e,record:n,location:w(t)}))}function parseNamedStep(e,t,n,r,i,a,o,s=!1){let c=n.exec(t.content);return c===null?(e.error(r,`Invalid '${i}' declaration '${t.content}' - expected '${a}'`,w(t)),skipBody(e,t.indent),null):o(c[1],parseValues(e,t,!1,void 0,s?e:void 0))}function parseResult(e,t,r){let i=ve.exec(t.content);i===null?(e.error(n.InvalidSpecificationQueryAction,`Invalid 'then result' declaration '${t.content}' - expected 'then result [exactly]'`,w(t)),skipBody(e,t.indent)):r.thenResults.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(e,t),exactly:i[1]!==void 0,location:w(t)})}function parseReadModelStep(e,t,r,i){let a=r.exec(t.content);if(a===null)e.error(n.InvalidReadModelStep,`Invalid '${i} readmodel' declaration '${t.content}' - expected '${i} readmodel <ReadModelType>'`,w(t)),skipBody(e,t.indent);else return{kind:`SpecificationReadModelSyntax`,name:a[1],properties:parseValues(e,t,!1,a),exactly:i===`then`&&a.groups?.exactly!==void 0,inlineProperty:a.groups?.property??null,location:w(t)}}function parseEventStep(e,t,r,i){let a=r.exec(t.content);if(a===null)e.error(n.InvalidEventStep,`Invalid '${i}' declaration '${t.content}' - expected '${i} <EventType>'`,w(t)),skipBody(e,t.indent);else return{kind:`SpecificationEventSyntax`,eventType:a[1],...parseValuesWithEventSource(e,t,void 0,a,i),inlineProperty:a.groups?.property??null,location:w(t)}}const Q=o(`^stream\\s+([A-Za-z_]\\w*)\\.([A-Za-z_]\\w*)$`),Ce=a(`^streamId\\s*=(?!=|>)\\s*(.+)$`);function parseValuesWithEventSource(e,r,i,a,o){let s=[];_(e,r,a,s);let c=null,l,u,d=!1;for(let a=e.peekChild(r.indent);a!==void 0;a=e.peekChild(r.indent)){e.reader.takeSignificant();let r;if(i!==void 0&&b.test(a.content)){let t=x(e,a,y,n.InvalidGeneratedFixture);t!==null&&i.push(t);continue}let p=V.exec(a.content);if(p!==null)g(e,s,mappingOf(e,a,p));else if(h(a.content)===`stream`||a.content.startsWith(`no stream`)){if(o===void 0){e.error(n.SpecificationStreamOnCommand,`A command occurrence cannot declare a route; assert it on a then event.`,w(a)),e.skipBlock(a.indent);continue}if(d){e.error(n.InvalidSpecificationStream,`An event occurrence declares at most one stream or no stream directive.`,w(a)),e.skipBlock(a.indent);continue}let t=Q.exec(a.content);a.content===`no stream`&&(o===`then`||o===`when redelivered`)?(u={kind:`SpecificationNoStreamSyntax`,location:w(a)},d=!0,rejectSpecificationRouteChildren(e,a)):t===null?(e.error(n.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on a then event.`,w(a)),e.skipBlock(a.indent)):(l=parseSpecificationStream(e,a,t),d=!0)}else if(h(a.content)===`for`){let t=a.content.substring(3).trim();t.length===0?e.error(n.InvalidSpecificationEventSource,`Invalid event-source assertion 'for' - expected 'for <value>'`,w(a)):c===null?c=f(t,w(a),e):e.error(n.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,w(a))}else(r=D(e,a))===void 0?e.error(n.InvalidSpecificationValue,`Invalid property mapping '${a.content}' - expected '<property> = <value>'`,w(a),t(`text`,a.content)):g(e,s,r)}return{values:s,for:c,...l===void 0?{}:{stream:l},...u===void 0?{}:{noStream:u}}}function parseSpecificationStream(t,r,i){let a=null,o=[],s=!1,c={};for(let i=t.peekChild(r.indent);i!==void 0;i=t.peekChild(r.indent)){if(t.reader.takeSignificant(),i.content===`streamId`){a!==null||s?(t.error(n.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,w(i)),t.skipBlock(i.indent)):(s=!0,c.streamId=w(i),o=e(t,i,n.InvalidSpecificationStream).map(e=>e.source.kind===`PathExpressionSyntax`&&e.source.path.startsWith(`case.`)?{...e,source:f(e.source.path,e.source.location,t)}:e));continue}let r=Ce.exec(i.content);if(r===null||a!==null||s){t.error(n.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,w(i)),t.skipBlock(i.indent);continue}let l={...w(i),column:i.indent+1+i.content.indexOf(r[1],i.content.indexOf(`=`)+1)};a={kind:`PropertyMappingSyntax`,property:`streamId`,source:f(r[1],l,t),location:w(i)},rejectSpecificationRouteChildren(t,i)}return{kind:`SpecificationStreamSyntax`,eventSource:i[1],stream:i[2],streamId:a,streamIdParts:o,directiveLocations:c,referenceLocation:{...w(r),column:r.indent+1+r.content.indexOf(i[1],6)},referenceLength:i[1].length+1+i[2].length,location:w(r)}}function rejectSpecificationRouteChildren(e,t){let r=e.peekChild(t.indent);r!==void 0&&(e.error(n.InvalidSpecificationStream,`This directive cannot have children.`,w(r)),e.skipBlock(t.indent))}function parseValues(e,r,i=!1,a,o){let s=[];_(e,r,a,s);for(let a=e.peekChild(r.indent);a!==void 0;a=e.peekChild(r.indent)){e.reader.takeSignificant();let r=(i||e.sourceOptions.numericMode===`exact`?H:V).exec(a.content),c=r===null?D(e,a):void 0;if(r===null&&c===void 0){e.error(n.InvalidSpecificationValue,`Invalid property mapping '${a.content}' - expected '<property> = <value>'`,w(a),t(`text`,a.content));continue}let l=c??mappingOf(e,a,r,i);o===void 0?g(e,s,l):(s.some(e=>e.property===l.property)&&o.error(n.UnknownSpecificationQueryArgument,`Query argument '${l.property}' is repeated.`,l.location,t(`argument`,l.property)),s.push(l))}return s}function mappingOf(e,t,n,r=!1){return{kind:`PropertyMappingSyntax`,property:n[1],source:f(n[2],w(t),e,r),location:w(t)}}const $=a(`^when\\s+start\\s+(.+)$`),we=a(`^outcome\\s+([A-Za-z_]\\w*)\\s+([A-Za-z_]\\w*)$`),Te=a(`^then\\s+(is|sends|starts|completes|fails\\s+at|waits\\s+at)(?:\\s+([A-Za-z_]\\w*))?$`);function lifecycleExpectation(e){let t=Te.exec(e.content);if(t===null)return;let n=t[1].replace(/\s+/g,` `),r=n===`is`?`State`:n===`sends`?`Sends`:n===`starts`?`Starts`:n===`completes`?`Completes`:n===`fails at`?`Fails`:`Waits`;if(t[2]!==void 0!=(r===`Completes`))return{kind:`LifecycleExpectationSyntax`,expectation:r,target:t[2]??null,location:w(e)}}function parseLifecycleSpecification(e,t,n){let r=k.exec(t.content);if(r===null)return e.error(n,`Invalid specification '${t.content}' - expected 'specification <Name>'.`,w(t)),skipBody(e,t.indent),{kind:`LifecycleSpecificationSyntax`,name:``,description:null,given:[],whenAppended:null,whenStarted:null,outcomes:[],then:[],location:w(t)};let i=r[1],a=null,o=[],s=null,c=null,l=!1,u=[],d=[],p={};for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent)){e.reader.takeSignificant();let t=h(r.content);if(t===`description`)a=m(e,r,a,`Specification '${i}'`),p.description??=w(r);else if(t===`given`){let t=parseEventStep(e,r,j,`given`);t!==void 0&&o.push(t)}else if(t===`when`){if(l){e.error(n,`Specification '${i}' already declares a 'when'.`,w(r)),skipBody(e,r.indent);continue}l=!0;let t=$.exec(r.content);if(t!==null){let n=r.content.indexOf(t[1],10);c=f(t[1].trim(),T(r.number,r.indent+(r.contentOffset??0)+1+n,r.path),e)}else r.content.startsWith(`when append`)?s=parseEventStep(e,r,M,`when append`)??null:(e.error(n,`Invalid '${r.content}' - expected 'when append <Event>' or 'when start <key>'.`,w(r)),skipBody(e,r.indent))}else if(t===`outcome`){let t=we.exec(r.content);t===null?e.error(n,`Invalid outcome '${r.content}' - expected 'outcome <Node> <outlet>'.`,w(r)):u.push({kind:`LifecycleOutcomeSyntax`,node:t[1],outlet:t[2],location:w(r)}),v(e,r,n,`An outcome cannot have children.`)}else if(t===`then`){let t=lifecycleExpectation(r);t===void 0?e.error(n,`Invalid '${r.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`,w(r)):d.push(t),v(e,r,n,`A then line cannot have children.`)}else e.error(n,`Unexpected '${r.content}' in specification '${i}' - expected description, given, when, outcome or then.`,w(r)),e.skipBlock(r.indent)}return{kind:`LifecycleSpecificationSyntax`,name:i,description:a,given:o,whenAppended:s,whenStarted:c,outcomes:u,then:d,location:w(t),directiveLocations:p}}export{parseLifecycleSpecification,parseSpecification,parseSpecificationStream,rejectSpecificationRouteChildren,Q as specificationStream};
2
2
  //# sourceMappingURL=SpecificationParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","specificationHeader","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenTimeZonePrefix","givenTimeZonePattern","givenClockPrefix","givenCapturePrefix","thenInvokesPrefix","thenInvokesPattern","givenGeneratedPrefix","givenGeneratedPattern","givenGeneratedBlockPattern","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","action","query","outcome","match","values","value","parseConcreteMapping","rejectOperationChildren","unescapeString","pinned","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","invocation","caseValue","parseSpecificationValue","error","absent","parseStructuredValue","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","block","location","source","parseConcrete","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","structured","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","tryParseStructuredMapping","diagnosticText","streamId","streamIdParts","directiveLocations","parseRouteParts","part","nativeIdentifiers","queryArgumentsContext","existing","lifecycleWhenStart","lifecycleOutcome","lifecycleThen","word","given","whenAppended","whenStarted","whenDeclared","outcomes","then","fact","start","index","sourceLocation"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { parseRouteParts } from './EventSourceParser';\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationTimeZoneSyntax, SpecificationGeneratedValueSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { LifecycleExpectationKind, LifecycleExpectationSyntax, LifecycleOutcomeSyntax, LifecycleSpecificationSyntax } from '../Syntax/Lifecycles';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationInvocationSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\nimport { parseStructuredValue, StructuredMarker, tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst specificationHeader = header;\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenTimeZonePrefix = pattern('^given\\\\s+time\\\\s+zone\\\\b');\nconst givenTimeZonePattern = pattern(`^given\\\\s+time\\\\s+zone\\\\s+\"(${stringBodyPattern})\"$`);\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst thenInvokesPrefix = pattern('^then\\\\s+invokes\\\\b');\nconst thenInvokesPattern = pattern('^then\\\\s+invokes\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst givenGeneratedPrefix = pattern('^given\\\\s+generated\\\\b');\nconst givenGeneratedPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenGeneratedBlockPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)(?:\\\\s+(none|empty))?$');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for(?:\\\\s+(.+))?$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenTimeZone: SpecificationTimeZoneSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n givenGenerated?: SpecificationGeneratedValueSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n thenInvocations?: SpecificationInvocationSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenTimeZone: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n validateQueryRejection(context, line, body);\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction validateQueryRejection(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (!isQueryRejectionCandidate(body) || isWellFormedQueryRejection(body)) return;\n context.error(DiagnosticCodes.MismatchedSpecificationQueryResult,\n \"A query rejection requires exactly one query and one 'then error', no action, and no other outcomes\", locationOf(line));\n}\n\nfunction isQueryRejectionCandidate(body: SpecificationBody): boolean {\n return body.thenErrors.length > 0 && queriedCallCount(body) > 0 && (body.whenQuery !== null || !hasAction(body));\n}\n\nfunction isWellFormedQueryRejection(body: SpecificationBody): boolean {\n return !hasAction(body) && hasOneQueryAndOneError(body) && !hasOtherOutcome(body);\n}\n\nfunction hasOneQueryAndOneError(body: SpecificationBody): boolean {\n return queriedCallCount(body) === 1 && body.thenErrors.length === 1;\n}\n\nfunction hasAction(body: SpecificationBody): boolean {\n return [body.when, body.whenAppended, body.whenClock, body.whenTrigger, body.whenCapture, body.whenRedelivered].some(action => action !== null);\n}\n\nfunction queriedCallCount(body: SpecificationBody): number {\n return body.thenQueries.length + (body.whenQuery === null ? 0 : 1);\n}\n\nfunction hasOtherOutcome(body: SpecificationBody): boolean {\n return [\n body.thenResults.length > 0,\n body.thenNoResult !== null,\n body.thenDenied !== null,\n body.thenEvents.length > 0,\n body.thenNoEvents,\n body.thenEventsInAnyOrder,\n body.thenReadModels.length > 0,\n body.thenAbsentReadModels.length > 0,\n body.thenReturns !== null,\n body.thenQueries.some(query => query.results.length > 0)\n ].some(outcome => outcome);\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenTimeZonePrefix.test(line.content)) {\n const match = givenTimeZonePattern.exec(line.content);\n skipBody(context, line.indent);\n if (body.givenTimeZone !== null || match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationTimeZone, \"A specification states its time zone at most once, as 'given time zone \\\"<id>\\\"'.\", locationOf(line));\n } else {\n body.givenTimeZone = { kind: 'SpecificationTimeZoneSyntax', id: unescapeString(match[1]), location: locationOf(line) };\n }\n } else if (givenGeneratedPrefix.test(line.content)) {\n const pinned = parseGivenGenerated(context, line);\n if (pinned !== null) {\n (body.givenGenerated ??= []).push(pinned);\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenInvokesPrefix.test(line.content)) {\n const invocation = parseNamedStep(context, line, thenInvokesPattern, DiagnosticCodes.InvalidSpecificationInvocation, 'then invokes', 'then invokes <Command>',\n (command, values): SpecificationInvocationSyntax => ({ kind: 'SpecificationInvocationSyntax', command, values, location: locationOf(line) }));\n if (invocation !== null) (body.thenInvocations ??= []).push(invocation);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n // 'for' ending the line opens the key's members as an indented block.\n body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context.valueContext, line, undefined), location: locationOf(line) });\n return;\n }\n if (match !== null && match[2] !== undefined && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n return { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context, line, undefined), location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n }\n if (match === null || match[2] === undefined || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseGivenGenerated(context: ParserContext, line: SourceLine): SpecificationGeneratedValueSyntax | null {\n const match = givenGeneratedPattern.exec(line.content);\n const block = match === null ? givenGeneratedBlockPattern.exec(line.content) : null;\n if (block !== null) {\n return { kind: 'SpecificationGeneratedValueSyntax', command: block[1], property: block[2], source: parseStructuredValue(context, line, block[3] as StructuredMarker), location: locationOf(line) };\n }\n if (match === null) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n const location = locationOf(line);\n const source = parseConcrete(context, match[3], { ...location, column: location.column + line.content.indexOf(match[3], line.content.indexOf('=') + 1) }, DiagnosticCodes.InvalidGeneratedFixture);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A pinned generated value cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'SpecificationGeneratedValueSyntax', command: match[1], property: match[2], source, location };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n let structured: PropertyMappingSyntax | undefined;\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else if ((structured = tryParseStructuredMapping(context, child)) !== undefined) {\n addFixtureValue(context, values, structured);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n const structured = mapping === null ? tryParseStructuredMapping(context, child) : undefined;\n if (mapping === null && structured === undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n continue;\n }\n const value = structured ?? mappingOf(context, child, mapping!, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location, diagnosticText('argument', value.property));\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n\nconst lifecycleWhenStart = pattern('^when\\\\s+start\\\\s+(.+)$');\nconst lifecycleOutcome = pattern('^outcome\\\\s+([A-Za-z_]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst lifecycleThen = pattern('^then\\\\s+(is|sends|starts|completes|fails\\\\s+at|waits\\\\s+at)(?:\\\\s+([A-Za-z_]\\\\w*))?$');\n\nfunction lifecycleExpectation(line: SourceLine): LifecycleExpectationSyntax | undefined {\n const match = lifecycleThen.exec(line.content);\n if (match === null) return undefined;\n const word = match[1].replace(/\\s+/g, ' ');\n const expectation: LifecycleExpectationKind = word === 'is' ? 'State' : word === 'sends' ? 'Sends' : word === 'starts' ? 'Starts' : word === 'completes' ? 'Completes' : word === 'fails at' ? 'Fails' : 'Waits';\n if ((match[2] !== undefined) === (expectation === 'Completes')) return undefined;\n return { kind: 'LifecycleExpectationSyntax', expectation, target: match[2] ?? null, location: locationOf(line) };\n}\n\n// A specification written inside a statemachine or a workflow - the port of C# SpecificationParser.ParseLifecycle.\nexport function parseLifecycleSpecification(context: ParserContext, header: SourceLine, code: string): LifecycleSpecificationSyntax {\n const match = specificationHeader.exec(header.content);\n if (match === null) {\n context.error(code, `Invalid specification '${header.content}' - expected 'specification <Name>'.`, locationOf(header));\n skipBody(context, header.indent);\n return { kind: 'LifecycleSpecificationSyntax', name: '', description: null, given: [], whenAppended: null, whenStarted: null, outcomes: [], then: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n const given: SpecificationEventSyntax[] = [];\n let whenAppended: SpecificationEventSyntax | null = null;\n let whenStarted: ExpressionSyntax | null = null;\n let whenDeclared = false;\n const outcomes: LifecycleOutcomeSyntax[] = [];\n const then: LifecycleExpectationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Specification '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'given') {\n const fact = parseEventStep(context, line, givenPattern, 'given');\n if (fact !== undefined) given.push(fact);\n } else if (keyword === 'when') {\n if (whenDeclared) {\n context.error(code, `Specification '${name}' already declares a 'when'.`, locationOf(line));\n skipBody(context, line.indent);\n continue;\n }\n whenDeclared = true;\n const start = lifecycleWhenStart.exec(line.content);\n if (start !== null) {\n const index = line.content.indexOf(start[1], 'when start'.length);\n whenStarted = parseMappingSource(start[1].trim(), sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1 + index, line.path), context);\n } else if (line.content.startsWith('when append')) whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n else {\n context.error(code, `Invalid '${line.content}' - expected 'when append <Event>' or 'when start <key>'.`, locationOf(line));\n skipBody(context, line.indent);\n }\n } else if (keyword === 'outcome') {\n const outcome = lifecycleOutcome.exec(line.content);\n if (outcome !== null) outcomes.push({ kind: 'LifecycleOutcomeSyntax', node: outcome[1], outlet: outcome[2], location: locationOf(line) });\n else context.error(code, `Invalid outcome '${line.content}' - expected 'outcome <Node> <outlet>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'An outcome cannot have children.');\n } else if (keyword === 'then') {\n const expectation = lifecycleExpectation(line);\n if (expectation !== undefined) then.push(expectation);\n else context.error(code, `Invalid '${line.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'A then line cannot have children.');\n } else {\n context.error(code, `Unexpected '${line.content}' in specification '${name}' - expected description, given, when, outcome or then.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'LifecycleSpecificationSyntax', name, description, given, whenAppended, whenStarted, outcomes, then, location: locationOf(header), directiveLocations };\n}\n"],"mappings":"uzCA8BA,MAAMC,GAAsBC,EAAQ,oEAAoE,EAClGC,GAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAsBD,EACtBE,EAAuBJ,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeK,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,EAChDC,EAAc,YAAY,MAAM,EAChCC,EAAmB,YAAY,MAAM,EACrCC,EAAkBb,EAAQ,mBAAmB,EAC7Cc,EAAkBd,EAAQ,iCAAiC,EAC3De,EAAwB,YAAY,oBAAoB,EACxDC,EAAuB,YAAY,oBAAqB,0BAA0B,EAClFC,EAAejB,EAAQ,gBAAgB,EACvCkB,EAAmBlB,EAAQ,uBAAuBmB,EAAkB,IAAI,EACxEC,EAAiBpB,EAAQ,iCAAiC,EAC1DqB,EAAuBhB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AE,KAAM,+BAAgC,OAAM,cAAa,QAAO,eAAc,cAAa,WAAU,OAAM,SAAUG,EAAWlD,CAAM,EAAG,oBAAmB,CACzK"}
1
+ {"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","specificationHeader","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenTimeZonePrefix","givenTimeZonePattern","givenClockPrefix","givenCapturePrefix","thenInvokesPrefix","thenInvokesPattern","givenGeneratedPrefix","givenGeneratedPattern","givenGeneratedBlockPattern","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","action","query","outcome","match","values","value","parseConcreteMapping","rejectOperationChildren","unescapeString","pinned","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","invocation","caseValue","parseSpecificationValue","error","absent","parseStructuredValue","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","block","location","source","parseConcrete","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","structured","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","tryParseStructuredMapping","diagnosticText","streamId","streamIdParts","directiveLocations","parseRouteParts","part","nativeIdentifiers","queryArgumentsContext","existing","lifecycleWhenStart","lifecycleOutcome","lifecycleThen","word","given","whenAppended","whenStarted","whenDeclared","outcomes","then","fact","start","index","sourceLocation"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { parseRouteParts } from './EventSourceParser';\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationTimeZoneSyntax, SpecificationGeneratedValueSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { LifecycleExpectationKind, LifecycleExpectationSyntax, LifecycleOutcomeSyntax, LifecycleSpecificationSyntax } from '../Syntax/Lifecycles';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationInvocationSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\nimport { parseStructuredValue, StructuredMarker, tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst specificationHeader = header;\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenTimeZonePrefix = pattern('^given\\\\s+time\\\\s+zone\\\\b');\nconst givenTimeZonePattern = pattern(`^given\\\\s+time\\\\s+zone\\\\s+\"(${stringBodyPattern})\"$`);\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst thenInvokesPrefix = pattern('^then\\\\s+invokes\\\\b');\nconst thenInvokesPattern = pattern('^then\\\\s+invokes\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst givenGeneratedPrefix = pattern('^given\\\\s+generated\\\\b');\nconst givenGeneratedPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenGeneratedBlockPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)(?:\\\\s+(none|empty))?$');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for(?:\\\\s+(.+))?$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenTimeZone: SpecificationTimeZoneSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n givenGenerated?: SpecificationGeneratedValueSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n thenInvocations?: SpecificationInvocationSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenTimeZone: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n validateQueryRejection(context, line, body);\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction validateQueryRejection(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (!isQueryRejectionCandidate(body) || isWellFormedQueryRejection(body)) return;\n context.error(DiagnosticCodes.MismatchedSpecificationQueryResult,\n \"A query rejection requires exactly one query and one 'then error', no action, and no other outcomes\", locationOf(line));\n}\n\nfunction isQueryRejectionCandidate(body: SpecificationBody): boolean {\n return body.thenErrors.length > 0 && queriedCallCount(body) > 0 && (body.whenQuery !== null || !hasAction(body));\n}\n\nfunction isWellFormedQueryRejection(body: SpecificationBody): boolean {\n return !hasAction(body) && hasOneQueryAndOneError(body) && !hasOtherOutcome(body);\n}\n\nfunction hasOneQueryAndOneError(body: SpecificationBody): boolean {\n return queriedCallCount(body) === 1 && body.thenErrors.length === 1;\n}\n\nfunction hasAction(body: SpecificationBody): boolean {\n return [body.when, body.whenAppended, body.whenClock, body.whenTrigger, body.whenCapture, body.whenRedelivered].some(action => action !== null);\n}\n\nfunction queriedCallCount(body: SpecificationBody): number {\n return body.thenQueries.length + (body.whenQuery === null ? 0 : 1);\n}\n\nfunction hasOtherOutcome(body: SpecificationBody): boolean {\n return [\n body.thenResults.length > 0,\n body.thenNoResult !== null,\n body.thenDenied !== null,\n body.thenEvents.length > 0,\n body.thenNoEvents,\n body.thenEventsInAnyOrder,\n body.thenReadModels.length > 0,\n body.thenAbsentReadModels.length > 0,\n body.thenReturns !== null,\n body.thenQueries.some(query => query.results.length > 0)\n ].some(outcome => outcome);\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenTimeZonePrefix.test(line.content)) {\n const match = givenTimeZonePattern.exec(line.content);\n skipBody(context, line.indent);\n if (body.givenTimeZone !== null || match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationTimeZone, \"A specification states its time zone at most once, as 'given time zone \\\"<id>\\\"'.\", locationOf(line));\n } else {\n body.givenTimeZone = { kind: 'SpecificationTimeZoneSyntax', id: unescapeString(match[1]), location: locationOf(line) };\n }\n } else if (givenGeneratedPrefix.test(line.content)) {\n const pinned = parseGivenGenerated(context, line);\n if (pinned !== null) {\n (body.givenGenerated ??= []).push(pinned);\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenInvokesPrefix.test(line.content)) {\n const invocation = parseNamedStep(context, line, thenInvokesPattern, DiagnosticCodes.InvalidSpecificationInvocation, 'then invokes', 'then invokes <Command>',\n (command, values): SpecificationInvocationSyntax => ({ kind: 'SpecificationInvocationSyntax', command, values, location: locationOf(line) }));\n if (invocation !== null) (body.thenInvocations ??= []).push(invocation);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n // 'for' ending the line opens the key's members as an indented block.\n body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context.valueContext, line, undefined), location: locationOf(line) });\n return;\n }\n if (match !== null && match[2] !== undefined && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n return { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context, line, undefined), location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n }\n if (match === null || match[2] === undefined || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseGivenGenerated(context: ParserContext, line: SourceLine): SpecificationGeneratedValueSyntax | null {\n const match = givenGeneratedPattern.exec(line.content);\n const block = match === null ? givenGeneratedBlockPattern.exec(line.content) : null;\n if (block !== null) {\n return { kind: 'SpecificationGeneratedValueSyntax', command: block[1], property: block[2], source: parseStructuredValue(context, line, block[3] as StructuredMarker), location: locationOf(line) };\n }\n if (match === null) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n const location = locationOf(line);\n const source = parseConcrete(context, match[3], { ...location, column: location.column + line.content.indexOf(match[3], line.content.indexOf('=') + 1) }, DiagnosticCodes.InvalidGeneratedFixture);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A pinned generated value cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'SpecificationGeneratedValueSyntax', command: match[1], property: match[2], source, location };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n let structured: PropertyMappingSyntax | undefined;\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else if ((structured = tryParseStructuredMapping(context, child)) !== undefined) {\n addFixtureValue(context, values, structured);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n const structured = mapping === null ? tryParseStructuredMapping(context, child) : undefined;\n if (mapping === null && structured === undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n continue;\n }\n const value = structured ?? mappingOf(context, child, mapping!, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location, diagnosticText('argument', value.property));\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n\nconst lifecycleWhenStart = pattern('^when\\\\s+start\\\\s+(.+)$');\nconst lifecycleOutcome = pattern('^outcome\\\\s+([A-Za-z_]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst lifecycleThen = pattern('^then\\\\s+(is|sends|starts|completes|fails\\\\s+at|waits\\\\s+at)(?:\\\\s+([A-Za-z_]\\\\w*))?$');\n\nfunction lifecycleExpectation(line: SourceLine): LifecycleExpectationSyntax | undefined {\n const match = lifecycleThen.exec(line.content);\n if (match === null) return undefined;\n const word = match[1].replace(/\\s+/g, ' ');\n const expectation: LifecycleExpectationKind = word === 'is' ? 'State' : word === 'sends' ? 'Sends' : word === 'starts' ? 'Starts' : word === 'completes' ? 'Completes' : word === 'fails at' ? 'Fails' : 'Waits';\n if ((match[2] !== undefined) === (expectation === 'Completes')) return undefined;\n return { kind: 'LifecycleExpectationSyntax', expectation, target: match[2] ?? null, location: locationOf(line) };\n}\n\n// A specification written inside a statemachine or a workflow - the port of C# SpecificationParser.ParseLifecycle.\nexport function parseLifecycleSpecification(context: ParserContext, header: SourceLine, code: string): LifecycleSpecificationSyntax {\n const match = specificationHeader.exec(header.content);\n if (match === null) {\n context.error(code, `Invalid specification '${header.content}' - expected 'specification <Name>'.`, locationOf(header));\n skipBody(context, header.indent);\n return { kind: 'LifecycleSpecificationSyntax', name: '', description: null, given: [], whenAppended: null, whenStarted: null, outcomes: [], then: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n const given: SpecificationEventSyntax[] = [];\n let whenAppended: SpecificationEventSyntax | null = null;\n let whenStarted: ExpressionSyntax | null = null;\n let whenDeclared = false;\n const outcomes: LifecycleOutcomeSyntax[] = [];\n const then: LifecycleExpectationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Specification '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'given') {\n const fact = parseEventStep(context, line, givenPattern, 'given');\n if (fact !== undefined) given.push(fact);\n } else if (keyword === 'when') {\n if (whenDeclared) {\n context.error(code, `Specification '${name}' already declares a 'when'.`, locationOf(line));\n skipBody(context, line.indent);\n continue;\n }\n whenDeclared = true;\n const start = lifecycleWhenStart.exec(line.content);\n if (start !== null) {\n const index = line.content.indexOf(start[1], 'when start'.length);\n whenStarted = parseMappingSource(start[1].trim(), sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1 + index, line.path), context);\n } else if (line.content.startsWith('when append')) whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n else {\n context.error(code, `Invalid '${line.content}' - expected 'when append <Event>' or 'when start <key>'.`, locationOf(line));\n skipBody(context, line.indent);\n }\n } else if (keyword === 'outcome') {\n const outcome = lifecycleOutcome.exec(line.content);\n if (outcome !== null) outcomes.push({ kind: 'LifecycleOutcomeSyntax', node: outcome[1], outlet: outcome[2], location: locationOf(line) });\n else context.error(code, `Invalid outcome '${line.content}' - expected 'outcome <Node> <outlet>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'An outcome cannot have children.');\n } else if (keyword === 'then') {\n const expectation = lifecycleExpectation(line);\n if (expectation !== undefined) then.push(expectation);\n else context.error(code, `Invalid '${line.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'A then line cannot have children.');\n } else {\n context.error(code, `Unexpected '${line.content}' in specification '${name}' - expected description, given, when, outcome or then.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'LifecycleSpecificationSyntax', name, description, given, whenAppended, whenStarted, outcomes, then, location: locationOf(header), directiveLocations };\n}\n"],"mappings":"A,wzCA8BA,MAAMC,GAAsBC,EAAQ,oEAAoE,EAClGC,GAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAsBD,EACtBE,EAAuBJ,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeK,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,EAChDC,EAAc,YAAY,MAAM,EAChCC,EAAmB,YAAY,MAAM,EACrCC,EAAkBb,EAAQ,mBAAmB,EAC7Cc,EAAkBd,EAAQ,iCAAiC,EAC3De,EAAwB,YAAY,oBAAoB,EACxDC,EAAuB,YAAY,oBAAqB,0BAA0B,EAClFC,EAAejB,EAAQ,gBAAgB,EACvCkB,EAAmBlB,EAAQ,uBAAuBmB,EAAkB,IAAI,EACxEC,EAAiBpB,EAAQ,iCAAiC,EAC1DqB,EAAuBhB,EAAc,iCAAiC,EACtEiB,EAAsBtB,EAAQ,2BAA2B,EACzDuB,EAAuBvB,EAAQ,+BAA+BmB,EAAkB,IAAI,EACpFK,EAAmBxB,EAAQ,oBAAoB,EAC/CyB,EAAqBzB,EAAQ,sBAAsB,EACnD0B,EAAoB1B,EAAQ,qBAAqB,EACjD2B,EAAqB3B,EAAQ,2DAA2D,EACxF4B,EAAuB5B,EAAQ,wBAAwB,EACvD6B,EAAwB7B,EAAQ,wEAAwE,EACxG8B,GAA6B9B,EAAQ,yEAAyE,EAC9G+B,GAAkB/B,EAAQ,mBAAmB,EAC7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jIwC,EAAQ,MAAM2C,EAAM,YAAY5C,EAAK,QAAQ,2DAA4DG,EAAWH,CAAI,CAAC,EACzH,SAASC,EAASD,EAAK,MAAM,EAErC,MAAO,GAAIU,IAAY,UAAW,CAC9B,IAAMc,EAAUgF,GAAiB,KAAKxG,EAAK,OAAO,EAC9CwB,IAAY,KACXvB,EAAQ,MAAM2C,EAAM,oBAAoB5C,EAAK,QAAQ,yCAA0CG,EAAWH,CAAI,CAAC,EAD9F+G,EAAS,KAAK,CAAE,KAAM,yBAA0B,KAAMvF,EAAQ,GAAI,OAAQA,EAAQ,GAAI,SAAUrB,EAAWH,CAAI,CAAE,CAAC,EAExI6B,EAAwB5B,EAASD,EAAM4C,EAAM,kCAAkC,CACnF,MAAO,GAAIlC,IAAY,OAAQ,CAC3B,IAAMqC,EAAc,qBAAqB/C,CAAI,EACzC+C,IAAgB,IAAA,GACf9C,EAAQ,MAAM2C,EAAM,YAAY5C,EAAK,QAAQ,uJAAwJG,EAAWH,CAAI,CAAC,EAD3LgH,EAAK,KAAKjE,CAAW,EAEpDlB,EAAwB5B,EAASD,EAAM4C,EAAM,mCAAmC,CACpF,MACI3C,EAAQ,MAAM2C,EAAM,eAAe5C,EAAK,QAAQ,sBAAsBD,EAAK,yDAA0DI,EAAWH,CAAI,CAAC,EACrJC,EAAQ,UAAUD,EAAK,MAAM,CAErC,CACA,MAAO,CAAE,KAAM,+BAAgC,OAAM,cAAa,QAAO,eAAc,cAAa,WAAU,OAAM,SAAUG,EAAWlD,CAAM,EAAG,oBAAmB,CACzK,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{expandSpecificationExamples as t}from"./SpecificationCommandExamples.js";import{RefusalDeclarations as n}from"./RefusalDeclarations.js";import{matchesSpecificationRoute as r}from"./SpecificationRouteComparison.js";import{sameRedeliveryValue as i}from"./RedeliveryValues.js";function validateSpecificationRedelivery(r,i){r=t(r);let a=new n(r);for(let{slice:t}of a.slices)for(let n of t.specifications){let o=n.whenRedelivered;if(o==null)continue;let s=a.event(o.eventType,t),c=a.resolve(o.reaction,t,e=>e.reactions);if(c===null||s===null||!c.node.triggers.some(e=>e.source.kind===`NamedTriggerSourceSyntax`&&a.event(e.source.name,c.slice)===s)){i.error(e.UnknownRedeliveryReaction,`Reaction '${o.reaction}' must resolve unambiguously and observe event '${o.eventType}'.`,o.location);continue}let l=n.given.filter(e=>a.event(e.eventType,t)===s).map(e=>matches(e,o,s,a,r)),u=l.filter(e=>e===!0).length;l.some(e=>e===null)?i.error(e.UnmatchedRedeliveredOccurrence,`Cannot locate redelivery of '${o.eventType}' uniquely: a given source or locator value is not decidable; use 'for', values, 'stream' or 'no stream'.`,o.location):u!==1&&i.error(e.UnmatchedRedeliveredOccurrence,`Redelivery of '${o.eventType}' matches ${u} given occurrences; use 'for', values, 'stream' or 'no stream' to identify exactly one.`,o.location)}}function matches(e,t,n,a,o){let s=[];t.for!==null&&s.push(e.for===null?null:i(t.for,e.for,null,a));for(let r of t.values){let t=e.values.filter(e=>e.property===r.property);s.push(t.length===1?i(r.source,t[0].source,a.property(n.properties,r.property)?.type??null,a):null)}return s.push(r(e.stream,t.stream,t.noStream,o)),s.includes(!1)?!1:!s.includes(null)||null}export{validateSpecificationRedelivery};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{RefusalDeclarations as t}from"./RefusalDeclarations.js";import{sameRedeliveryValue as n}from"./RedeliveryValues.js";import{matchesSpecificationRoute as r}from"./SpecificationRouteComparison.js";import{expandSpecificationExamples as i}from"./SpecificationCommandExamples.js";function validateSpecificationRedelivery(n,r){n=i(n);let a=new t(n);for(let{slice:t}of a.slices)for(let i of t.specifications){let o=i.whenRedelivered;if(o==null)continue;let s=a.event(o.eventType,t),c=a.resolve(o.reaction,t,e=>e.reactions);if(c===null||s===null||!c.node.triggers.some(e=>e.source.kind===`NamedTriggerSourceSyntax`&&a.event(e.source.name,c.slice)===s)){r.error(e.UnknownRedeliveryReaction,`Reaction '${o.reaction}' must resolve unambiguously and observe event '${o.eventType}'.`,o.location);continue}let l=i.given.filter(e=>a.event(e.eventType,t)===s).map(e=>matches(e,o,s,a,n)),u=l.filter(e=>e===!0).length;l.some(e=>e===null)?r.error(e.UnmatchedRedeliveredOccurrence,`Cannot locate redelivery of '${o.eventType}' uniquely: a given source or locator value is not decidable; use 'for', values, 'stream' or 'no stream'.`,o.location):u!==1&&r.error(e.UnmatchedRedeliveredOccurrence,`Redelivery of '${o.eventType}' matches ${u} given occurrences; use 'for', values, 'stream' or 'no stream' to identify exactly one.`,o.location)}}function matches(e,t,i,a,o){let s=[];t.for!==null&&s.push(e.for===null?null:n(t.for,e.for,null,a));for(let r of t.values){let t=e.values.filter(e=>e.property===r.property);s.push(t.length===1?n(r.source,t[0].source,a.property(i.properties,r.property)?.type??null,a):null)}return s.push(r(e.stream,t.stream,t.noStream,o)),s.includes(!1)?!1:!s.includes(null)||null}export{validateSpecificationRedelivery};
2
2
  //# sourceMappingURL=SpecificationRedeliveryValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpecificationRedeliveryValidator.js","names":["expandSpecificationExamples","application","declarations","RefusalDeclarations","specification","slice","action","event","reaction","owner","trigger","context","DiagnosticCodes","candidates","given","count","match","comparisons","sameRedeliveryValue","locator","values","value","matchesSpecificationRoute"],"sources":["../../../../../../Compiler/Parsing/SpecificationRedeliveryValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SpecificationRedeliverySyntax } from '../Syntax/SpecificationRedeliverySyntax';\nimport { SpecificationEventSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { sameRedeliveryValue } from './RedeliveryValues';\nimport { matchesSpecificationRoute } from './SpecificationRouteComparison';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\nexport function validateSpecificationRedelivery(application: ApplicationSyntax, context: ParserContext): void {\n application = expandSpecificationExamples(application);\n const declarations = new RefusalDeclarations(application);\n for (const { slice } of declarations.slices) for (const specification of slice.specifications) {\n const action = specification.whenRedelivered;\n if (action == null) continue;\n const event = declarations.event(action.eventType, slice);\n const reaction = declarations.resolve(action.reaction, slice, owner => owner.reactions);\n if (reaction === null || event === null || !reaction.node.triggers.some(trigger => trigger.source.kind === 'NamedTriggerSourceSyntax' && declarations.event(trigger.source.name, reaction.slice) === event)) {\n context.error(DiagnosticCodes.UnknownRedeliveryReaction, `Reaction '${action.reaction}' must resolve unambiguously and observe event '${action.eventType}'.`, action.location);\n continue;\n }\n const candidates = specification.given.filter(given => declarations.event(given.eventType, slice) === event).map(given => matches(given, action, event, declarations, application));\n const count = candidates.filter(match => match === true).length;\n if (candidates.some(match => match === null))\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Cannot locate redelivery of '${action.eventType}' uniquely: a given source or locator value is not decidable; use 'for', values, 'stream' or 'no stream'.`, action.location);\n else if (count !== 1)\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Redelivery of '${action.eventType}' matches ${count} given occurrences; use 'for', values, 'stream' or 'no stream' to identify exactly one.`, action.location);\n }\n}\n\nfunction matches(given: SpecificationEventSyntax, action: SpecificationRedeliverySyntax, event: EventSyntax, declarations: RefusalDeclarations, application: ApplicationSyntax): boolean | null {\n const comparisons: (boolean | null)[] = [];\n if (action.for !== null) comparisons.push(given.for === null ? null : sameRedeliveryValue(action.for, given.for, null, declarations));\n for (const locator of action.values) {\n const values = given.values.filter(value => value.property === locator.property);\n comparisons.push(values.length === 1 ? sameRedeliveryValue(locator.source, values[0].source, declarations.property(event.properties, locator.property)?.type ?? null, declarations) : null);\n }\n comparisons.push(matchesSpecificationRoute(given.stream, action.stream, action.noStream, application));\n return comparisons.includes(false) ? false : comparisons.includes(null) ? null : true;\n}\n"],"mappings":"kZAcA,SAAgB,gCAAgC,EAAgC,EAA8B,CAC1G,EAAcA,EAA4BC,CAAW,EACrD,IAAMC,EAAe,IAAIC,EAAoBF,CAAW,EACxD,IAAK,GAAM,CAAE,WAAWC,EAAa,OAAQ,IAAK,IAAME,KAAiBC,EAAM,eAAgB,CAC3F,IAAMC,EAASF,EAAc,gBAC7B,GAAIE,GAAU,KAAM,SACpB,IAAMC,EAAQL,EAAa,MAAMI,EAAO,UAAWD,CAAK,EAClDG,EAAWN,EAAa,QAAQI,EAAO,SAAUD,EAAO,GAASI,EAAM,SAAS,EACtF,GAAID,IAAa,MAAQD,IAAU,MAAQ,CAACC,EAAS,KAAK,SAAS,KAAK,GAAWE,EAAQ,OAAO,OAAS,4BAA8BR,EAAa,MAAMQ,EAAQ,OAAO,KAAMF,EAAS,KAAK,IAAMD,CAAK,EAAG,CACzMI,EAAQ,MAAMC,EAAgB,0BAA2B,aAAaN,EAAO,SAAS,kDAAkDA,EAAO,UAAU,IAAKA,EAAO,QAAQ,EAC7K,QACJ,CACA,IAAMO,EAAaT,EAAc,MAAM,OAAO,GAASF,EAAa,MAAMY,EAAM,UAAWT,CAAK,IAAME,CAAK,CAAC,CAAC,IAAI,GAAS,QAAQO,EAAOR,EAAQC,EAAOL,EAAcD,CAAW,CAAC,EAC5Kc,EAAQF,EAAW,OAAO,GAASG,IAAU,EAAI,CAAC,CAAC,OACrDH,EAAW,KAAK,GAASG,IAAU,IAAI,EACvCL,EAAQ,MAAMC,EAAgB,+BAAgC,gCAAgCN,EAAO,UAAU,2GAA4GA,EAAO,QAAQ,EACrOS,IAAU,GACfJ,EAAQ,MAAMC,EAAgB,+BAAgC,kBAAkBN,EAAO,UAAU,YAAYS,EAAM,yFAA0FT,EAAO,QAAQ,CACpO,CACJ,CAEA,SAAS,QAAQ,EAAiC,EAAuC,EAAoB,EAAmC,EAAgD,CAC5L,IAAMW,EAAkC,CAAC,EACrCX,EAAO,MAAQ,MAAMW,EAAY,KAAKH,EAAM,MAAQ,KAAO,KAAOI,EAAoBZ,EAAO,IAAKQ,EAAM,IAAK,KAAMZ,CAAY,CAAC,EACpI,IAAK,IAAMiB,KAAWb,EAAO,OAAQ,CACjC,IAAMc,EAASN,EAAM,OAAO,OAAO,GAASO,EAAM,WAAaF,EAAQ,QAAQ,EAC/EF,EAAY,KAAKG,EAAO,SAAW,EAAIF,EAAoBC,EAAQ,OAAQC,EAAO,EAAE,CAAC,OAAQlB,EAAa,SAASK,EAAM,WAAYY,EAAQ,QAAQ,CAAC,EAAE,MAAQ,KAAMjB,CAAY,EAAI,IAAI,CAC9L,CAEA,OADAe,EAAY,KAAKK,EAA0BR,EAAM,OAAQR,EAAO,OAAQA,EAAO,SAAUL,CAAW,CAAC,EAC9FgB,EAAY,SAAS,EAAK,EAAI,GAAQ,GAAY,SAAS,IAAI,GAAI,IAC9E"}
1
+ {"version":3,"file":"SpecificationRedeliveryValidator.js","names":["expandSpecificationExamples","application","declarations","RefusalDeclarations","specification","slice","action","event","reaction","owner","trigger","context","DiagnosticCodes","candidates","given","count","match","comparisons","sameRedeliveryValue","locator","values","value","matchesSpecificationRoute"],"sources":["../../../../../../Compiler/Parsing/SpecificationRedeliveryValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SpecificationRedeliverySyntax } from '../Syntax/SpecificationRedeliverySyntax';\nimport { SpecificationEventSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { sameRedeliveryValue } from './RedeliveryValues';\nimport { matchesSpecificationRoute } from './SpecificationRouteComparison';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\nexport function validateSpecificationRedelivery(application: ApplicationSyntax, context: ParserContext): void {\n application = expandSpecificationExamples(application);\n const declarations = new RefusalDeclarations(application);\n for (const { slice } of declarations.slices) for (const specification of slice.specifications) {\n const action = specification.whenRedelivered;\n if (action == null) continue;\n const event = declarations.event(action.eventType, slice);\n const reaction = declarations.resolve(action.reaction, slice, owner => owner.reactions);\n if (reaction === null || event === null || !reaction.node.triggers.some(trigger => trigger.source.kind === 'NamedTriggerSourceSyntax' && declarations.event(trigger.source.name, reaction.slice) === event)) {\n context.error(DiagnosticCodes.UnknownRedeliveryReaction, `Reaction '${action.reaction}' must resolve unambiguously and observe event '${action.eventType}'.`, action.location);\n continue;\n }\n const candidates = specification.given.filter(given => declarations.event(given.eventType, slice) === event).map(given => matches(given, action, event, declarations, application));\n const count = candidates.filter(match => match === true).length;\n if (candidates.some(match => match === null))\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Cannot locate redelivery of '${action.eventType}' uniquely: a given source or locator value is not decidable; use 'for', values, 'stream' or 'no stream'.`, action.location);\n else if (count !== 1)\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Redelivery of '${action.eventType}' matches ${count} given occurrences; use 'for', values, 'stream' or 'no stream' to identify exactly one.`, action.location);\n }\n}\n\nfunction matches(given: SpecificationEventSyntax, action: SpecificationRedeliverySyntax, event: EventSyntax, declarations: RefusalDeclarations, application: ApplicationSyntax): boolean | null {\n const comparisons: (boolean | null)[] = [];\n if (action.for !== null) comparisons.push(given.for === null ? null : sameRedeliveryValue(action.for, given.for, null, declarations));\n for (const locator of action.values) {\n const values = given.values.filter(value => value.property === locator.property);\n comparisons.push(values.length === 1 ? sameRedeliveryValue(locator.source, values[0].source, declarations.property(event.properties, locator.property)?.type ?? null, declarations) : null);\n }\n comparisons.push(matchesSpecificationRoute(given.stream, action.stream, action.noStream, application));\n return comparisons.includes(false) ? false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