@cratis/screenplay-language 4.123.0 → 4.124.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 (402) hide show
  1. package/README.md +50 -0
  2. package/dist/bundles/TypeReferenceSymbol.js +2 -0
  3. package/dist/bundles/TypeReferenceSymbol.js.map +1 -0
  4. package/dist/bundles/_virtual/_virtual/_rolldown/runtime.js +1 -0
  5. package/dist/bundles/bmp-word-characters.js +2 -0
  6. package/dist/bundles/bmp-word-characters.js.map +1 -0
  7. package/dist/bundles/case-authoring.js +3 -0
  8. package/dist/bundles/case-authoring.js.map +1 -0
  9. package/dist/bundles/code-actions.js +2 -0
  10. package/dist/bundles/code-actions.js.map +1 -0
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js +5 -0
  12. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -0
  13. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js +2 -0
  14. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -0
  15. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js +2 -0
  16. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -0
  17. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +2 -0
  18. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -0
  19. package/dist/bundles/compiler/Dependencies/DependencyKind.js +2 -0
  20. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -0
  21. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js +2 -0
  22. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -0
  23. package/dist/bundles/compiler/Dependencies/SliceReferences.js +2 -0
  24. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -0
  25. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js +2 -0
  26. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -0
  27. package/dist/bundles/compiler/Dependencies/index.js +1 -0
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +2 -0
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -0
  30. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +2 -0
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -0
  32. package/dist/bundles/compiler/Diagnostics/SourceLocation.js +2 -0
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -0
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +2 -0
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -0
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -0
  37. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +2 -0
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -0
  39. package/dist/bundles/compiler/Files/PlayFolderMerge.js +2 -0
  40. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -0
  41. package/dist/bundles/compiler/Files/PlayImports.js +1 -0
  42. package/dist/bundles/compiler/Files/PlayPlacement.js +2 -0
  43. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -0
  44. package/dist/bundles/compiler/Files/TimelineOrder.js +2 -0
  45. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -0
  46. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +2 -0
  47. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -0
  48. package/dist/bundles/compiler/Parsing/CaptureParser.js +2 -0
  49. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -0
  50. package/dist/bundles/compiler/Parsing/CodeBlockParser.js +3 -0
  51. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -0
  52. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js +2 -0
  53. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -0
  54. package/dist/bundles/compiler/Parsing/CommandParser.js +2 -0
  55. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -0
  56. package/dist/bundles/compiler/Parsing/CommandReadSources.js +2 -0
  57. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -0
  58. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +2 -0
  59. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -0
  60. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js +2 -0
  61. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -0
  62. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js +2 -0
  63. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -0
  64. package/dist/bundles/compiler/Parsing/CompositionParser.js +2 -0
  65. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -0
  66. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +2 -0
  67. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -0
  68. package/dist/bundles/compiler/Parsing/ConditionParser.js +2 -0
  69. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -0
  70. package/dist/bundles/compiler/Parsing/ConstraintParser.js +2 -0
  71. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -0
  72. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +2 -0
  73. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -0
  74. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +2 -0
  75. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -0
  76. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +2 -0
  77. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -0
  78. package/dist/bundles/compiler/Parsing/DependsOnParser.js +2 -0
  79. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -0
  80. package/dist/bundles/compiler/Parsing/DescriptionParser.js +2 -0
  81. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -0
  82. package/dist/bundles/compiler/Parsing/DocumentationParser.js +2 -0
  83. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -0
  84. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +2 -0
  85. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -0
  86. package/dist/bundles/compiler/Parsing/EventSourceParser.js +2 -0
  87. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -0
  88. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +2 -0
  89. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -0
  90. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +2 -0
  91. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -0
  92. package/dist/bundles/compiler/Parsing/ExpressionParser.js +2 -0
  93. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -0
  94. package/dist/bundles/compiler/Parsing/FeatureBody.js +2 -0
  95. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -0
  96. package/dist/bundles/compiler/Parsing/FileImportParser.js +2 -0
  97. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -0
  98. package/dist/bundles/compiler/Parsing/FileReferences.js +2 -0
  99. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -0
  100. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +2 -0
  101. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -0
  102. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js +2 -0
  103. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -0
  104. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +2 -0
  105. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -0
  106. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +2 -0
  107. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -0
  108. package/dist/bundles/compiler/Parsing/IdentityParser.js +2 -0
  109. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -0
  110. package/dist/bundles/compiler/Parsing/IdentityValidator.js +2 -0
  111. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -0
  112. package/dist/bundles/compiler/Parsing/ImplementationParser.js +3 -0
  113. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -0
  114. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -0
  115. package/dist/bundles/compiler/Parsing/InlineEventValidator.js +2 -0
  116. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -0
  117. package/dist/bundles/compiler/Parsing/InputUses.js +2 -0
  118. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -0
  119. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +2 -0
  120. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -0
  121. package/dist/bundles/compiler/Parsing/LineReader.js +2 -0
  122. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -0
  123. package/dist/bundles/compiler/Parsing/LineText.js +2 -0
  124. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -0
  125. package/dist/bundles/compiler/Parsing/ModuleBody.js +2 -0
  126. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -0
  127. package/dist/bundles/compiler/Parsing/OperationParser.js +2 -0
  128. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -0
  129. package/dist/bundles/compiler/Parsing/OperationValidator.js +2 -0
  130. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -0
  131. package/dist/bundles/compiler/Parsing/ParserContext.js +2 -0
  132. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -0
  133. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js +2 -0
  134. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -0
  135. package/dist/bundles/compiler/Parsing/PolicyParser.js +2 -0
  136. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -0
  137. package/dist/bundles/compiler/Parsing/ProducesParser.js +2 -0
  138. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -0
  139. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +2 -0
  140. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -0
  141. package/dist/bundles/compiler/Parsing/ProjectionParser.js +2 -0
  142. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -0
  143. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +2 -0
  144. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -0
  145. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +2 -0
  146. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -0
  147. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +2 -0
  148. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -0
  149. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +2 -0
  150. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -0
  151. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +2 -0
  152. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -0
  153. package/dist/bundles/compiler/Parsing/PurposeParser.js +2 -0
  154. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -0
  155. package/dist/bundles/compiler/Parsing/PurposeValidator.js +2 -0
  156. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -0
  157. package/dist/bundles/compiler/Parsing/QueryParser.js +2 -0
  158. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -0
  159. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +2 -0
  160. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -0
  161. package/dist/bundles/compiler/Parsing/ReactionParser.js +2 -0
  162. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -0
  163. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +2 -0
  164. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -0
  165. package/dist/bundles/compiler/Parsing/RedeliveryValues.js +2 -0
  166. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -0
  167. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +2 -0
  168. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -0
  169. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js +2 -0
  170. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -0
  171. package/dist/bundles/compiler/Parsing/ResponseDateValues.js +2 -0
  172. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -0
  173. package/dist/bundles/compiler/Parsing/ResponseValidator.js +2 -0
  174. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -0
  175. package/dist/bundles/compiler/Parsing/ScreenParser.js +2 -0
  176. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -0
  177. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +2 -0
  178. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -0
  179. package/dist/bundles/compiler/Parsing/SeedParser.js +2 -0
  180. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -0
  181. package/dist/bundles/compiler/Parsing/SliceParser.js +2 -0
  182. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -0
  183. package/dist/bundles/compiler/Parsing/SourceLine.js +2 -0
  184. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -0
  185. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js +3 -0
  186. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -0
  187. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +2 -0
  188. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -0
  189. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +2 -0
  190. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -0
  191. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +2 -0
  192. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -0
  193. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +2 -0
  194. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -0
  195. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +2 -0
  196. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -0
  197. package/dist/bundles/compiler/Parsing/SpecificationParser.js +2 -0
  198. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -0
  199. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +2 -0
  200. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -0
  201. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +2 -0
  202. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -0
  203. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +2 -0
  204. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -0
  205. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +2 -0
  206. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -0
  207. package/dist/bundles/compiler/Parsing/StructuredValueParser.js +3 -0
  208. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -0
  209. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +2 -0
  210. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -0
  211. package/dist/bundles/compiler/Parsing/UiBindingParser.js +2 -0
  212. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -0
  213. package/dist/bundles/compiler/ScreenplayCompiler.js +2 -0
  214. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -0
  215. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js +2 -0
  216. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -0
  217. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js +2 -0
  218. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -0
  219. package/dist/bundles/compiler/Syntax/DependencySources.js +2 -0
  220. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -0
  221. package/dist/bundles/compiler/Syntax/EventDeclarations.js +2 -0
  222. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -0
  223. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js +2 -0
  224. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -0
  225. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js +2 -0
  226. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -0
  227. package/dist/bundles/compiler/Syntax/ExactMathFacts.js +2 -0
  228. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -0
  229. package/dist/bundles/compiler/Syntax/ExactNumber.js +2 -0
  230. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -0
  231. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js +2 -0
  232. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -0
  233. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js +2 -0
  234. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -0
  235. package/dist/bundles/compiler/Syntax/Operations.js +2 -0
  236. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -0
  237. package/dist/bundles/compiler/Syntax/PersonaCallers.js +2 -0
  238. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -0
  239. package/dist/bundles/compiler/Syntax/ProductionDestinations.js +2 -0
  240. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -0
  241. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js +2 -0
  242. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -0
  243. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +2 -0
  244. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -0
  245. package/dist/bundles/compiler/Syntax/SourceOptions.js +2 -0
  246. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -0
  247. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js +2 -0
  248. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -0
  249. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js +2 -0
  250. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -0
  251. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -0
  252. package/dist/bundles/compiler/Syntax/Structure.js +2 -0
  253. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -0
  254. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +2 -0
  255. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -0
  256. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +2 -0
  257. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -0
  258. package/dist/bundles/compiler/Syntax/SyntaxJson.js +2 -0
  259. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -0
  260. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js +2 -0
  261. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -0
  262. package/dist/bundles/compiler/Syntax/index.js +1 -0
  263. package/dist/bundles/compiler/Text/ImplementationHintText.js +2 -0
  264. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -0
  265. package/dist/bundles/compiler/Text/ReservedWords.js +2 -0
  266. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -0
  267. package/dist/bundles/compiler/Text/SourceStreamNames.js +2 -0
  268. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -0
  269. package/dist/bundles/compiler/Text/StringLiteral.js +3 -0
  270. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -0
  271. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js +2 -0
  272. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -0
  273. package/dist/bundles/compiler/Text/patterns.js +2 -0
  274. package/dist/bundles/compiler/Text/patterns.js.map +1 -0
  275. package/dist/bundles/compiler/index.js +1 -0
  276. package/dist/bundles/completion-items.js +21 -0
  277. package/dist/bundles/completion-items.js.map +1 -0
  278. package/dist/bundles/completion-planner.js +5 -0
  279. package/dist/bundles/completion-planner.js.map +1 -0
  280. package/dist/bundles/completions.js +2 -0
  281. package/dist/bundles/completions.js.map +1 -0
  282. package/dist/bundles/dependency-completions.js +3 -0
  283. package/dist/bundles/dependency-completions.js.map +1 -0
  284. package/dist/bundles/dependency-target-analysis.js +2 -0
  285. package/dist/bundles/dependency-target-analysis.js.map +1 -0
  286. package/dist/bundles/diagnostic-codes.js +2 -0
  287. package/dist/bundles/diagnostic-codes.js.map +1 -0
  288. package/dist/bundles/diagnostics.js +2 -0
  289. package/dist/bundles/diagnostics.js.map +1 -0
  290. package/dist/bundles/document-context.js +2 -0
  291. package/dist/bundles/document-context.js.map +1 -0
  292. package/dist/bundles/documentation-item.js +2 -0
  293. package/dist/bundles/documentation-item.js.map +1 -0
  294. package/dist/bundles/event-analysis-source.js +2 -0
  295. package/dist/bundles/event-analysis-source.js.map +1 -0
  296. package/dist/bundles/event-context-catalog.js +2 -0
  297. package/dist/bundles/event-context-catalog.js.map +1 -0
  298. package/dist/bundles/event-context.js +4 -0
  299. package/dist/bundles/event-context.js.map +1 -0
  300. package/dist/bundles/event-source-authoring.js +13 -0
  301. package/dist/bundles/event-source-authoring.js.map +1 -0
  302. package/dist/bundles/example-analysis.js +3 -0
  303. package/dist/bundles/example-analysis.js.map +1 -0
  304. package/dist/bundles/example-authoring.js +3 -0
  305. package/dist/bundles/example-authoring.js.map +1 -0
  306. package/dist/bundles/example-declaration-items.js +2 -0
  307. package/dist/bundles/example-declaration-items.js.map +1 -0
  308. package/dist/bundles/example-values.js +2 -0
  309. package/dist/bundles/example-values.js.map +1 -0
  310. package/dist/bundles/file-imports.js +2 -0
  311. package/dist/bundles/file-imports.js.map +1 -0
  312. package/dist/bundles/file-references.js +2 -0
  313. package/dist/bundles/file-references.js.map +1 -0
  314. package/dist/bundles/hover-content.js +6 -0
  315. package/dist/bundles/hover-content.js.map +1 -0
  316. package/dist/bundles/hover.js +2 -0
  317. package/dist/bundles/hover.js.map +1 -0
  318. package/dist/bundles/index.js +2 -104
  319. package/dist/bundles/index.js.map +1 -7
  320. package/dist/bundles/inlay-hints.js +2 -0
  321. package/dist/bundles/inlay-hints.js.map +1 -0
  322. package/dist/bundles/inline-completions.js +2 -0
  323. package/dist/bundles/inline-completions.js.map +1 -0
  324. package/dist/bundles/inline-event-validation.js +2 -0
  325. package/dist/bundles/inline-event-validation.js.map +1 -0
  326. package/dist/bundles/keyword-docs.js +2 -0
  327. package/dist/bundles/keyword-docs.js.map +1 -0
  328. package/dist/bundles/language.js +2 -0
  329. package/dist/bundles/language.js.map +1 -0
  330. package/dist/bundles/named-rule-context.js +2 -0
  331. package/dist/bundles/named-rule-context.js.map +1 -0
  332. package/dist/bundles/operation-authoring.js +7 -0
  333. package/dist/bundles/operation-authoring.js.map +1 -0
  334. package/dist/bundles/persona-analysis.js +2 -0
  335. package/dist/bundles/persona-analysis.js.map +1 -0
  336. package/dist/bundles/production-destinations.js +2 -0
  337. package/dist/bundles/production-destinations.js.map +1 -0
  338. package/dist/bundles/purpose-items.js +2 -0
  339. package/dist/bundles/purpose-items.js.map +1 -0
  340. package/dist/bundles/reaction-authoring.js +5 -0
  341. package/dist/bundles/reaction-authoring.js.map +1 -0
  342. package/dist/bundles/refusal-context.js +2 -0
  343. package/dist/bundles/refusal-context.js.map +1 -0
  344. package/dist/bundles/response-analysis.js +7 -0
  345. package/dist/bundles/response-analysis.js.map +1 -0
  346. package/dist/bundles/response-completions.js +2 -0
  347. package/dist/bundles/response-completions.js.map +1 -0
  348. package/dist/bundles/response-tokens.js +3 -0
  349. package/dist/bundles/response-tokens.js.map +1 -0
  350. package/dist/bundles/scope-items.js +18 -0
  351. package/dist/bundles/scope-items.js.map +1 -0
  352. package/dist/bundles/structure-completions.js +7 -0
  353. package/dist/bundles/structure-completions.js.map +1 -0
  354. package/dist/bundles/sub-language-registry.js +2 -0
  355. package/dist/bundles/sub-language-registry.js.map +1 -0
  356. package/dist/bundles/sub-languages/capture/CompletionProvider.js +2 -0
  357. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -0
  358. package/dist/bundles/sub-languages/capture/HoverProvider.js +60 -0
  359. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -0
  360. package/dist/bundles/sub-languages/capture/Validator.js +2 -0
  361. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -0
  362. package/dist/bundles/sub-languages/capture/index.js +2 -40
  363. package/dist/bundles/sub-languages/capture/index.js.map +1 -7
  364. package/dist/bundles/sub-languages/capture/language.js +2 -0
  365. package/dist/bundles/sub-languages/capture/language.js.map +1 -0
  366. package/dist/bundles/sub-languages/cdl.js +2 -0
  367. package/dist/bundles/sub-languages/cdl.js.map +1 -0
  368. package/dist/bundles/sub-languages/pdl.js +2 -0
  369. package/dist/bundles/sub-languages/pdl.js.map +1 -0
  370. package/dist/bundles/sub-languages/projection/CodeActionProvider.js +2 -0
  371. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -0
  372. package/dist/bundles/sub-languages/projection/CompletionProvider.js +2 -0
  373. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -0
  374. package/dist/bundles/sub-languages/projection/HoverProvider.js +43 -0
  375. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -0
  376. package/dist/bundles/sub-languages/projection/Validator.js +5 -0
  377. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -0
  378. package/dist/bundles/sub-languages/projection/index.js +3 -75
  379. package/dist/bundles/sub-languages/projection/index.js.map +1 -7
  380. package/dist/bundles/sub-languages/projection/language.js +2 -0
  381. package/dist/bundles/sub-languages/projection/language.js.map +1 -0
  382. package/dist/bundles/symbols.js +3 -0
  383. package/dist/bundles/symbols.js.map +1 -0
  384. package/dist/bundles/themes/screenplay-dark.js +2 -0
  385. package/dist/bundles/themes/screenplay-dark.js.map +1 -0
  386. package/dist/bundles/themes/screenplay-light.js +2 -0
  387. package/dist/bundles/themes/screenplay-light.js.map +1 -0
  388. package/dist/bundles/tokens.js +2 -0
  389. package/dist/bundles/tokens.js.map +1 -0
  390. package/dist/bundles/validation.js +3 -0
  391. package/dist/bundles/validation.js.map +1 -0
  392. package/dist/completion-items.d.ts.map +1 -1
  393. package/dist/diagnostic-codes.d.ts +6 -0
  394. package/dist/diagnostic-codes.d.ts.map +1 -1
  395. package/dist/keyword-docs.d.ts.map +1 -1
  396. package/dist/language.d.ts.map +1 -1
  397. package/dist/tokens.d.ts.map +1 -1
  398. package/package.json +4 -3
  399. package/dist/bundles/chunk-4CLLEMBX.js +0 -42
  400. package/dist/bundles/chunk-4CLLEMBX.js.map +0 -7
  401. package/dist/bundles/chunk-AYDF3IFZ.js +0 -2
  402. package/dist/bundles/chunk-AYDF3IFZ.js.map +0 -7
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{eventDeclarations as e}from"../Syntax/EventDeclarations.js";import{dependencySources as t,dependencySourcesOf as n}from"../Syntax/DependencySources.js";import{synthesizePersonaCaller as r}from"../Syntax/PersonaCallers.js";import{specificationCaseOrigins as i}from"../Syntax/SpecificationCaseOrigin.js";import{substituteCase as a}from"./SpecificationCaseParser.js";function specificationExamples(t){let n=[],examples=(e,t)=>{for(let r of e??[])n.push({name:r.name,scope:t,example:r})},features=(t,r)=>{for(let i of t){let t=[...r,i.name];examples(i.examples,t);for(let t of i.slices){let a=[...r,i.name,t.name];examples(t.examples,a);for(let r of new Set(e(t).map(e=>e.name)))n.push({name:r,scope:a,kind:`event`});for(let e of t.commands)n.push({name:e.name,scope:a,kind:`command`});for(let e of t.readModels)n.push({name:e.name,scope:a,kind:`readmodel`})}features(i.features,t)}};examples(t.examples,[]);for(let e of[...t.concepts,...t.types])n.push({name:e.name,scope:[],kind:`type`});for(let e of t.modules)examples(e.examples,[e.name]),features(e.features,[e.name]);let resolve=(e,r)=>{let candidates=e=>{let t=e.split(`.`),i=n.filter(e=>e.name===t.at(-1)),a=t.slice(0,-1);if(a.length)return i.filter(e=>a.length<=e.scope.length&&a.every((t,n)=>e.scope[e.scope.length-a.length+n]===t));for(let e=r.length;e>=0;e--){let t=i.filter(t=>e<=t.scope.length&&r.slice(0,e).every((e,n)=>t.scope[n]===e));if(t.length)return t}return[]},i=candidates(e),a=t.imports.filter(t=>t.qualifiedName.split(`.`).at(-1)===e);return!i.length&&a.length===1&&(i=candidates(a[0].qualifiedName)),i.length===1?i[0]:void 0},fixture=(e,t,n)=>{let r=resolve(e,n),i=r?.example;if(!i)return null;let a=resolve(i.type,r.scope);return a?.kind===t?{example:i,name:[...a.scope,a.name].join(`.`)}:null},merge=(e,t)=>[...e.filter(e=>!t.some(t=>t.property===e.property)),...t];return{resolvedExamples:n.filter(e=>e.example!==void 0).flatMap(e=>{let t=resolve(e.example.type,e.scope);return t?.kind===void 0?[]:[{example:e.example,kind:t.kind,name:[...t.scope,t.name].join(`.`),scope:t.scope}]}),eventStep:(e,t,n)=>{let r=fixture(e.eventType,`event`,n),i=r?.example??null,a=i?.stream??i?.noStream??null,o=e.stream??e.noStream??null,s=o??a,c=r===null?e:{...e,eventType:r.name,values:merge(i.values,e.values),for:e.for??i.for,stream:s?.kind===`SpecificationStreamSyntax`?s:null,noStream:s?.kind===`SpecificationNoStreamSyntax`?s:null},l=c.values.map(t=>{let n=i?.values.find(e=>e.property===t.property),r=e.values.includes(t);return{property:t.property,value:t.source,origin:r?n===void 0?`authored`:`override`:`example`,overriddenValue:r?n?.source??null:null}});return c.for!==null&&l.push({property:`for`,value:c.for,origin:e.for===null?`example`:i?.for==null?`authored`:`override`,overriddenValue:e.for===null?null:i?.for??null}),{role:t,authored:e,effective:c,example:i,values:l,route:s===null?null:{value:s,origin:o===null?`example`:a===null?`authored`:`override`,overriddenValue:o===null?null:a}}},command:(e,t)=>{if(!e)return e;let n=fixture(e.commandType,`command`,t);if(!n)return e;let{example:r,name:i}=n;return{...e,commandType:i,values:merge(r.values,e.values),generatedValues:merge(r.generatedValues,e.generatedValues??[]),for:e.for??r.for}},readModel:(e,t)=>{let n=fixture(e.name,`readmodel`,t);return n?{...e,name:n.name,properties:merge(n.example.values,e.properties)}:e}}}function specificationCommandExamples(e){return specificationExamples(e).command}function expandSpecificationExamples(e){return expandEffectiveSpecificationExamples(e).application}function expandEffectiveSpecificationExamples(e){let o=specificationExamples(e),s=[],features=(c,l)=>c.map(c=>{let u=[...l,c.name];return{...c,features:features(c.features,u),slices:c.slices.map(u=>{let d=[...l,c.name,u.name],f={...u,specifications:u.specifications.flatMap(t=>{let n=[],event=(e,t)=>{let r=o.eventStep(e,t,d);return n.push(r),r.effective},c=e.personas.find(e=>e.name===t.givenCallerPersona?.name),l=c===void 0?null:r(c,e),u=l?.caller==null?null:{...l.caller,location:t.givenCallerPersona.location};u!==null&&n.push({role:`given caller`,authored:t.givenCallerPersona,effective:u,example:null,route:null,values:l.contributions.map(e=>({property:e.type??e.kind,value:{kind:`LiteralExpressionSyntax`,value:e.kind===`authenticated`||e.value,location:e.location},origin:`persona`,overriddenValue:null,persona:c.name,policy:e.policy}))});let f={...t,...u===null?{}:{givenCaller:u,givenCallerPersona:void 0},given:t.given.map(e=>event(e,`given`)),givenReadModels:t.givenReadModels.map(e=>o.readModel(e,d)),when:o.command(t.when,d),whenAppended:t.whenAppended===null?null:event(t.whenAppended,`when append`),thenEvents:t.thenEvents.map(e=>event(e,`then`)),thenReadModels:t.thenReadModels.map(e=>o.readModel(e,d))};return(t.cases?.length??0)===0?(s.push({authored:t,effective:f,steps:n}),[f]):t.cases.map(e=>{let r=/* @__PURE__ */ new WeakMap,o={...a(f,e,r),name:`${t.name}_${e.name}`,parameters:[],cases:[]};return i.set(o,{table:t.name,case:e.name}),s.push({authored:t,effective:o,table:t.name,case:e.name,steps:n.map(t=>({...t,effective:a(t.effective,e,r),values:t.values.map(t=>t.value.kind===`CaseValueExpressionSyntax`?{...t,value:a(t.value,e,r),origin:`case`,caseParameter:t.value.parameter}:t),route:t.route===null?null:{...t.route,value:a(t.route.value,e,r)}}))}),o})})};return t.set(f,n(u)),f})}});return{application:{...e,modules:e.modules.map(e=>({...e,features:features(e.features,[e.name])}))},specifications:s}}export{expandEffectiveSpecificationExamples,expandSpecificationExamples,specificationCommandExamples,specificationExamples};
2
+ //# sourceMappingURL=SpecificationCommandExamples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationCommandExamples.js","names":["entries","example","nodes","feature","scope","parent","slice","name","eventDeclarations","event","command","model","application","node","module","parts","reference","named","entry","qualifiers","index","part","depth","visible","matches","imported","declaration","type","kind","inherited","authored","replacement","value","resolved","step","route","effective","values","prior","action","specifications","expanded","steps","pair","role","persona","specification","caller","synthesizePersonaCaller","synthesizedCaller","atom","result","copies","substituteCase","row","specificationCaseOrigins","dependencySources","dependencySourcesOf"],"sources":["../../../../../../Compiler/Parsing/SpecificationCommandExamples.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 { synthesizePersonaCaller } from '../Syntax/PersonaCallers';\nimport { specificationCaseOrigins } from '../Syntax/SpecificationCaseOrigin';\nimport { substituteCase } from './SpecificationCaseParser';\nimport { dependencySources, dependencySourcesOf } from '../Syntax/DependencySources';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { EffectiveSpecification, EffectiveSpecificationStep, EffectiveSpecificationValue, EffectiveSpecificationApplication } from '../Syntax/EffectiveSpecification';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationCommandSyntax, SpecificationEventSyntax, SpecificationReadModelSyntax } from '../Syntax/Specifications';\nimport { SpecificationExampleSyntax } from '../Syntax/SpecificationExampleSyntax';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\n\n// Validators consume effective fixtures without changing the authored syntax.\n// Resolve the example at its use site, then its type at the declaration site.\nexport function specificationExamples(application: ApplicationSyntax) {\n const entries: { name: string; scope: readonly string[]; example?: SpecificationExampleSyntax; kind?: string }[] = [];\n const examples = (nodes: readonly SpecificationExampleSyntax[] | undefined, scope: readonly string[]) => {\n for (const example of nodes ?? []) entries.push({ name: example.name, scope, example });\n };\n const features = (nodes: readonly FeatureSyntax[], parent: readonly string[]) => {\n for (const feature of nodes) {\n const scope = [...parent, feature.name];\n examples(feature.examples, scope);\n for (const slice of feature.slices) {\n const scope = [...parent, feature.name, slice.name];\n examples(slice.examples, scope);\n for (const name of new Set(eventDeclarations(slice).map(event => event.name))) entries.push({ name, scope, kind: 'event' });\n for (const command of slice.commands) entries.push({ name: command.name, scope, kind: 'command' });\n for (const model of slice.readModels) entries.push({ name: model.name, scope, kind: 'readmodel' });\n }\n features(feature.features, scope);\n }\n };\n examples(application.examples, []);\n for (const node of [...application.concepts, ...application.types]) entries.push({ name: node.name, scope: [], kind: 'type' });\n for (const module of application.modules) { examples(module.examples, [module.name]); features(module.features, [module.name]); }\n const resolve = (reference: string, scope: readonly string[]) => {\n const candidates = (reference: string) => {\n const parts = reference.split('.');\n const named = entries.filter(entry => entry.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((part, index) => entry.scope[entry.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((part, index) => entry.scope[index] === part));\n if (visible.length) return visible;\n }\n return [];\n };\n let matches = candidates(reference);\n const imported = application.imports.filter(entry => entry.qualifiedName.split('.').at(-1) === reference);\n if (!matches.length && imported.length === 1) matches = candidates(imported[0].qualifiedName);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const fixture = (reference: string, kind: string, scope: readonly string[]) => {\n const declaration = resolve(reference, scope);\n const example = declaration?.example;\n if (!example) return null;\n const type = resolve(example.type, declaration.scope);\n return type?.kind === kind ? { example, name: [...type.scope, type.name].join('.') } : null;\n };\n const merge = (inherited: readonly PropertyMappingSyntax[], authored: readonly PropertyMappingSyntax[]) => [...inherited.filter(value => !authored.some(replacement => replacement.property === value.property)), ...authored];\n return {\n resolvedExamples: entries.filter(entry => entry.example !== undefined).flatMap(entry => {\n const type = resolve(entry.example!.type, entry.scope);\n return type?.kind === undefined ? [] : [{ example: entry.example!, kind: type.kind, name: [...type.scope, type.name].join('.'), scope: type.scope }];\n }),\n eventStep: (step: SpecificationEventSyntax, role: string, scope: readonly string[]): EffectiveSpecificationStep => {\n const resolved = fixture(step.eventType, 'event', scope);\n const example = resolved?.example ?? null;\n const inherited = example?.stream ?? example?.noStream ?? null;\n const authored = step.stream ?? step.noStream ?? null;\n const route = authored ?? inherited;\n const effective = resolved === null ? step : { ...step, eventType: resolved.name, values: merge(example!.values, step.values), for: step.for ?? example!.for, stream: route?.kind === 'SpecificationStreamSyntax' ? route : null, noStream: route?.kind === 'SpecificationNoStreamSyntax' ? route : null };\n const values: EffectiveSpecificationValue[] = effective.values.map(value => {\n const prior = example?.values.find(prior => prior.property === value.property);\n const replacement = step.values.includes(value);\n return { property: value.property, value: value.source, origin: replacement ? prior === undefined ? 'authored' : 'override' : 'example', overriddenValue: replacement ? prior?.source ?? null : null };\n });\n if (effective.for !== null) values.push({ property: 'for', value: effective.for, origin: step.for === null ? 'example' : example?.for == null ? 'authored' : 'override', overriddenValue: step.for === null ? null : example?.for ?? null });\n return { role, authored: step, effective, example, values, route: route === null ? null : { value: route, origin: authored === null ? 'example' : inherited === null ? 'authored' : 'override', overriddenValue: authored === null ? null : inherited } };\n },\n command: (action: SpecificationCommandSyntax | null, scope: readonly string[]): SpecificationCommandSyntax | null => {\n if (!action) return action;\n const effective = fixture(action.commandType, 'command', scope);\n if (!effective) return action;\n const { example, name } = effective;\n return { ...action, commandType: name, values: merge(example.values, action.values), generatedValues: merge(example.generatedValues, action.generatedValues ?? []), for: action.for ?? example.for };\n },\n readModel: (step: SpecificationReadModelSyntax, scope: readonly string[]): SpecificationReadModelSyntax => {\n const effective = fixture(step.name, 'readmodel', scope);\n if (!effective) return step;\n return { ...step, name: effective.name, properties: merge(effective.example.values, step.properties) };\n },\n };\n}\n\nexport function specificationCommandExamples(application: ApplicationSyntax): (action: SpecificationCommandSyntax | null, scope: readonly string[]) => SpecificationCommandSyntax | null {\n return specificationExamples(application).command;\n}\n\nexport function expandSpecificationExamples(application: ApplicationSyntax): ApplicationSyntax {\n return expandEffectiveSpecificationExamples(application).application;\n}\n\nexport function expandEffectiveSpecificationExamples(application: ApplicationSyntax): EffectiveSpecificationApplication {\n const effective = specificationExamples(application);\n const specifications: EffectiveSpecification[] = [];\n const features = (nodes: readonly FeatureSyntax[], parent: readonly string[]): FeatureSyntax[] => nodes.map(feature => {\n const scope = [...parent, feature.name];\n return {\n ...feature,\n features: features(feature.features, scope),\n slices: feature.slices.map(slice => {\n const scope = [...parent, feature.name, slice.name];\n const expanded = { ...slice, specifications: slice.specifications.flatMap(specification => {\n const steps: EffectiveSpecificationStep[] = [];\n const event = (step: SpecificationEventSyntax, role: string): SpecificationEventSyntax => {\n const pair = effective.eventStep(step, role, scope);\n steps.push(pair);\n return pair.effective as SpecificationEventSyntax;\n };\n const persona = application.personas.find(persona => persona.name === specification.givenCallerPersona?.name);\n const caller = persona === undefined ? null : synthesizePersonaCaller(persona, application);\n const synthesizedCaller = caller?.caller == null ? null : { ...caller.caller, location: specification.givenCallerPersona!.location };\n if (synthesizedCaller !== null) {\n steps.push({ role: 'given caller', authored: specification.givenCallerPersona!, effective: synthesizedCaller, example: null, route: null,\n values: caller!.contributions.map(atom => ({ property: atom.type ?? atom.kind, value: { kind: 'LiteralExpressionSyntax', value: atom.kind === 'authenticated' ? true : atom.value, location: atom.location }, origin: 'persona', overriddenValue: null, persona: persona!.name, policy: atom.policy })) });\n }\n const result = {\n ...specification,\n ...(synthesizedCaller === null ? {} : { givenCaller: synthesizedCaller, givenCallerPersona: undefined }),\n given: specification.given.map(step => event(step, 'given')),\n givenReadModels: specification.givenReadModels.map(step => effective.readModel(step, scope)),\n when: effective.command(specification.when, scope),\n whenAppended: specification.whenAppended === null ? null : event(specification.whenAppended, 'when append'),\n thenEvents: specification.thenEvents.map(step => event(step, 'then')),\n thenReadModels: specification.thenReadModels.map(step => effective.readModel(step, scope)),\n };\n if ((specification.cases?.length ?? 0) === 0) {\n specifications.push({ authored: specification, effective: result, steps });\n return [result];\n }\n return specification.cases!.map(row => {\n const copies = new WeakMap<object, unknown>();\n const expanded = { ...substituteCase(result, row, copies), name: `${specification.name}_${row.name}`, parameters: [], cases: [] };\n specificationCaseOrigins.set(expanded, { table: specification.name, case: row.name });\n specifications.push({ authored: specification, effective: expanded, table: specification.name, case: row.name,\n steps: steps.map(step => ({ ...step, effective: substituteCase(step.effective, row, copies),\n values: step.values.map(value => value.value.kind === 'CaseValueExpressionSyntax'\n ? { ...value, value: substituteCase(value.value, row, copies), origin: 'case', caseParameter: value.value.parameter } : value),\n route: step.route === null ? null : { ...step.route, value: substituteCase(step.route.value, row, copies) } })) });\n return expanded;\n });\n }) };\n dependencySources.set(expanded, dependencySourcesOf(slice));\n return expanded;\n }),\n };\n });\n return { application: { ...application, modules: application.modules.map(module => ({ ...module, features: features(module.features, [module.name]) })) }, specifications };\n}\n"],"mappings":"waAgBA,SAAgB,sBAAsB,EAAgC,CAClE,IAAMA,EAA6G,CAAC,EAC9G,UAAY,EAA0D,IAA6B,CACrG,IAAK,IAAMC,KAAWC,GAAS,CAAC,EAAGF,EAAQ,KAAK,CAAE,KAAMC,EAAQ,KAAM,QAAO,SAAQ,CAAC,CAC1F,EACM,UAAY,EAAiC,IAA8B,CAC7E,IAAK,IAAME,KAAWD,EAAO,CACzB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G7B,EAAa,QAASA,EAAY,QAAQ,IAAI,IAAW,CAAE,GAAGE,EAAQ,SAAU,SAASA,EAAO,SAAU,CAACA,EAAO,IAAI,CAAC,CAAE,EAAE,CAAE,EAAG,gBAAe,CAC9K"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{firstWord as r}from"./LineText.js";import{locationOf as i}from"./SourceLine.js";import{generatedFixturePattern as a,generatedFixturePrefix as o,parseConcrete as s,parseConcreteMapping as c}from"./SpecificationResponseParser.js";import{caseReferences as l,parseSpecificationValue as u}from"./SpecificationCaseParser.js";import{parseDescription as d}from"./DescriptionParser.js";import{parseSpecificationStream as f,rejectSpecificationRouteChildren as p,specificationStream as m}from"./SpecificationParser.js";const h=n(`^example\\s+([A-Z]\\w*)\\s*:\\s*([A-Z]\\w*(?:\\.\\w+)*)$`.replaceAll(`\\s`,t)),g=n(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`.replaceAll(`\\s`,t));function parseExample(t,n){let r=h.exec(n.content);if(r===null)return t.error(e.InvalidSpecificationExample,`Invalid example declaration '${n.content}' - expected 'example <Name> : <EventOrCommandOrReadModel>'`,i(n)),t.skipOpaqueBlock(n.indent),{kind:`SpecificationExampleSyntax`,name:``,type:``,values:[],generatedValues:[],for:null,description:null,location:i(n)};let a=parseFixtureBody(t,n,void 0,!0,r[1]);for(let n of l(a))t.error(e.InvalidSpecificationCaseReference,`Case references are not permitted in example bodies.`,n.location);return{kind:`SpecificationExampleSyntax`,name:r[1],type:r[2],...a,location:i(n)}}function addInlineValue(t,n,r,a){if(r?.groups?.property===void 0)return;let o=r.groups.property,c=r.groups.value,l=n.content.length-c.length,u=i(n),d=s(t,c,{...u,column:u.column+l},e.InvalidSpecificationValue);d!==null&&a.push({kind:`PropertyMappingSyntax`,property:o,source:d,location:{...u,column:u.column+n.content.lastIndexOf(o,n.content.indexOf(`=`))}})}function addFixtureValue(t,n,r,i=[]){[...n,...i].some(e=>e.property===r.property)?t.error(e.DuplicateSpecificationAssignment,`Property '${r.property}' is assigned more than once in this fixture - assign it only once, inline or indented`,r.location):n.push(r)}function parseFixtureBody(t,n,s,l=!1,h){let _=[],v=[],y=null,b=null,x,S;addInlineValue(t,n,s,_);for(let s=t.peekChild(n.indent);s!==void 0;s=t.peekChild(n.indent)){if(t.reader.takeSignificant(),h!==void 0&&r(s.content)===`description`){b=d(t,s,b,`Example '${h}'`);continue}if(l&&o.test(s.content)){let n=c(t,s,a,e.InvalidGeneratedFixture);n!==null&&(h===void 0?v.push(n):addFixtureValue(t,v,n,_));continue}let n=g.exec(s.content);if(h!==void 0&&n===null&&(r(s.content)===`stream`||s.content.startsWith(`no stream`))){let n=m.exec(s.content);x!==void 0||S!==void 0?(t.error(e.InvalidSpecificationStream,`An event occurrence declares at most one stream or no stream directive.`,i(s)),t.skipOpaqueBlock(s.indent)):s.content===`no stream`?(S={kind:`SpecificationNoStreamSyntax`,location:i(s)},p(t,s)):n===null?(t.error(e.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on an event example.`,i(s)),t.skipOpaqueBlock(s.indent)):x=f(t,s,n)}else if(n!==null)addFixtureValue(t,_,{kind:`PropertyMappingSyntax`,property:n[1],source:u(n[2],i(s),t),location:i(s)},v);else if(r(s.content)===`for`){let n=s.content.substring(3).trim();n.length===0?t.error(e.InvalidSpecificationEventSource,`Invalid event-source assertion 'for' - expected 'for <value>'`,i(s)):y===null?y=u(n,i(s),t):t.error(e.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,i(s))}else t.error(e.InvalidSpecificationValue,`Invalid property mapping '${s.content}' - expected '<property> = <value>'`,i(s))}return{values:_,for:y,generatedValues:v,description:b,...x===void 0?{}:{stream:x},...S===void 0?{}:{noStream:S}}}export{addFixtureValue,addInlineValue,parseExample,parseFixtureBody};
2
+ //# sourceMappingURL=SpecificationExampleParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationExampleParser.js","names":["parseMappingSource","header","nativePattern","dotNetWhitespace","mapping","match","line","context","DiagnosticCodes","locationOf","body","reference","caseReferences","property","text","offset","location","source","parseConcrete","values","other","existing","value","generatedValues","eventSource","description","stream","noStream","parent","inline","child","example","firstWord","parseDescription","allowGenerated","generatedFixturePrefix","fixture","parseConcreteMapping","generatedFixturePattern","route","specificationStream","rejectSpecificationRouteChildren","parseSpecificationStream","parseSpecificationValue"],"sources":["../../../../../../Compiler/Parsing/SpecificationExampleParser.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 { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationNoStreamSyntax, SpecificationStreamSyntax, SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseSpecificationStream, rejectSpecificationRouteChildren, specificationStream } from './SpecificationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { caseReferences, parseSpecificationValue as parseMappingSource } from './SpecificationCaseParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping } from './SpecificationResponseParser';\n\nconst header = nativePattern('^example\\\\s+([A-Z]\\\\w*)\\\\s*:\\\\s*([A-Z]\\\\w*(?:\\\\.\\\\w+)*)$'.replaceAll('\\\\s', dotNetWhitespace));\nconst mapping = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$'.replaceAll('\\\\s', dotNetWhitespace));\n\nexport function parseExample(context: ParserContext, line: SourceLine): SpecificationExampleSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationExample, `Invalid example declaration '${line.content}' - expected 'example <Name> : <EventOrCommandOrReadModel>'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return { kind: 'SpecificationExampleSyntax', name: '', type: '', values: [], generatedValues: [], for: null, description: null, location: locationOf(line) };\n }\n const body = parseFixtureBody(context, line, undefined, true, match[1]);\n for (const reference of caseReferences(body)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'Case references are not permitted in example bodies.', reference.location);\n return { kind: 'SpecificationExampleSyntax', name: match[1], type: match[2], ...body, location: locationOf(line) };\n}\n\nexport function addInlineValue(context: ParserContext, line: SourceLine, match: RegExpExecArray | undefined, values: PropertyMappingSyntax[]): void {\n if (match?.groups?.property === undefined) return;\n const property = match.groups.property;\n const text = match.groups.value;\n const offset = line.content.length - text.length;\n const location = locationOf(line);\n const source = parseConcrete(context, text, { ...location, column: location.column + offset }, DiagnosticCodes.InvalidSpecificationValue);\n if (source !== null) values.push({ kind: 'PropertyMappingSyntax', property, source, location: { ...location, column: location.column + line.content.lastIndexOf(property, line.content.indexOf('=')) } });\n}\n\nexport function addFixtureValue(context: ParserContext, values: PropertyMappingSyntax[], value: PropertyMappingSyntax, other: readonly PropertyMappingSyntax[] = []): void {\n if ([...values, ...other].some(existing => existing.property === value.property)) {\n context.error(DiagnosticCodes.DuplicateSpecificationAssignment, `Property '${value.property}' is assigned more than once in this fixture - assign it only once, inline or indented`, value.location);\n return;\n }\n values.push(value);\n}\n\nexport function parseFixtureBody(context: ParserContext, parent: SourceLine, inline?: RegExpExecArray, allowGenerated = false, example?: string): {\n values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; generatedValues: PropertyMappingSyntax[]; description: string | null;\n stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax;\n} {\n const values: PropertyMappingSyntax[] = [];\n const generatedValues: PropertyMappingSyntax[] = [];\n let eventSource: ExpressionSyntax | null = null;\n let description: string | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\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 if (example !== undefined && firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Example '${example}'`);\n continue;\n }\n if (allowGenerated && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) {\n // Preserve validator-owned PLAY0490 for existing generated step fixtures.\n if (example === undefined) generatedValues.push(fixture);\n else addFixtureValue(context, generatedValues, fixture, values);\n }\n continue;\n }\n const match = mapping.exec(child.content);\n if (example !== undefined && match === null && (firstWord(child.content) === 'stream' || child.content.startsWith('no stream'))) {\n const route = specificationStream.exec(child.content);\n if (stream !== undefined || noStream !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipOpaqueBlock(child.indent);\n } else if (child.content === 'no stream') {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on an event example.\", locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n continue;\n }\n if (match !== null) {\n addFixtureValue(context, values, { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(child), context), location: locationOf(child) }, generatedValues);\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) context.error(DiagnosticCodes.InvalidSpecificationEventSource, \"Invalid event-source assertion 'for' - expected 'for <value>'\", locationOf(child));\n else if (eventSource !== null) context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n else eventSource = parseMappingSource(source, locationOf(child), context);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n }\n }\n return { values, for: eventSource, generatedValues, description, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n"],"mappings":"ssBAeA,MAAMC,EAASC,EAAc,2DAA2D,WAAW,MAAOC,CAAgB,CAAC,EACrHC,EAAUF,EAAc,kCAAkC,WAAW,MAAOC,CAAgB,CAAC,EAEnG,SAAgB,aAAa,EAAwB,EAA8C,CAC/F,IAAME,EAAQJ,EAAO,KAAKK,EAAK,OAAO,EACtC,GAAID,IAAU,KAGV,OAFAE,EAAQ,MAAMC,EAAgB,4BAA6B,gCAAgCF,EAAK,QAAQ,6DAA8DG,EAAWH,CAAI,CAAC,EACtLC,EAAQ,gBAAgBD,EAAK,MAAM,EAC5B,CAAE,KAAM,6BAA8B,KAAM,GAAI,KAAM,GAAI,OAAQ,CAAC,EAAG,gBAAiB,CAAC,EAAG,IAAK,KAAM,YAAa,KAAM,SAAUG,EAAWH,CAAI,CAAE,EAE/J,IAAMI,EAAO,iBAAiBH,EAASD,EAAM,IAAA,GAAW,GAAMD,EAAM,EAAE,EACtE,IAAK,IAAMM,KAAaC,EAAeF,CAAI,EAAGH,EAAQ,MAAMC,EAAgB,kCAAmC,uDAAwDG,EAAU,QAAQ,EACzL,MAAO,CAAE,KAAM,6BAA8B,KAAMN,EAAM,GAAI,KAAMA,EAAM,GAAI,GAAGK,EAAM,SAAUD,EAAWH,CAAI,CAAE,CACrH,CAEA,SAAgB,eAAe,EAAwB,EAAkB,EAAoC,EAAuC,CAChJ,GAAID,GAAO,QAAQ,WAAa,IAAA,GAAW,OAC3C,IAAMQ,EAAWR,EAAM,OAAO,SACxBS,EAAOT,EAAM,OAAO,MACpBU,EAAST,EAAK,QAAQ,OAASQ,EAAK,OACpCE,EAAWP,EAAWH,CAAI,EAC1BW,EAASC,EAAcX,EAASO,EAAM,CAAE,GAAGE,E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BsB,EAAM,QAAQ,qCAAsCrB,EAAWqB,CAAK,CAAC,CAEnK,CACA,MAAO,CAAE,SAAQ,IAAKN,EAAa,kBAAiB,cAAa,GAAIE,IAAW,IAAA,GAAY,CAAC,EAAI,CAAE,QAAO,EAAI,GAAIC,IAAa,IAAA,GAAY,CAAC,EAAI,CAAE,UAAS,CAAG,CAClK"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n,pattern as r}from"../Text/patterns.js";import{stringBodyPattern as i,unescapeString as a}from"../Text/StringLiteral.js";import{firstWord as o}from"./LineText.js";import{locationOf as s}from"./SourceLine.js";import{generatedFixturePattern as c,generatedFixturePrefix as l,parseConcreteMapping as u,parseReturn as d,thenReturnsPrefix as f}from"./SpecificationResponseParser.js";import{containsCaseReference as p,parseCase as m,parseParameter as h,parseSpecificationValue as g,validateTable as ee}from"./SpecificationCaseParser.js";import{parseDescription as te}from"./DescriptionParser.js";import{sourceStreamPattern as _}from"../Text/SourceStreamNames.js";import{parseRouteParts as v}from"./EventSourceParser.js";import{isFileDirective as y}from"./FileReferences.js";import{rejectOperationChildren as ne}from"./OperationParser.js";import{addFixtureValue as b,addInlineValue as x}from"./SpecificationExampleParser.js";const S=r(`^(?:given\\s+operation|then\\s+(?:operation|compensated))(?:\\s|$)`),C=r(`^(given operation|then operation|then compensated)\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)(\\s+fails)?$`),w=r(`^specification\\s+([A-Za-z_]\\w*)$`),T=r(`^given caller as ([A-Za-z_]\\w*)$`),stepPattern=(e,r=``)=>n(`^${e}\\s+([A-Z]\\w*(?:\\.\\w+)*)${r}(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`.replaceAll(`\\s`,t)),E=stepPattern(`given`),D=stepPattern(`when\\s+append`),O=stepPattern(`when`),k=stepPattern(`then`),A=r(`^then\\s+query\\b`),j=r(`^(?:given|then)\\s+readmodel\\b`),M=stepPattern(`given\\s+readmodel`),N=stepPattern(`then\\s+readmodel`,`(?<exactly>\\s+exactly)?`),P=r(`^then\\s+no\\b`),F=r(`^then\\s+error\\s+"(${i})"$`),I=r(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),L=n(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),re=r(`^given\\s+clock\\b`),R=r(`^given\\s+capture\\b`),z=r(`^when\\s+clock\\b`),B=r(`^when\\s+trigger\\b`),V=r(`^when\\s+capture\\b`),H=r(`^when\\s+query\\b`),U=r(`^then\\s+result\\b`),W=r(`^then\\s+no\\s+result\\b`),G=n(`^when\\s+redelivered\\b`),K=n(`^when\\s+redelivered\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+to\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),q=r(`^then\\s+no\\s+events\\b`),J=r(`^(given|when)\\s+clock\\s+"(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))"$`),Y=r(`^when\\s+trigger\\s+([A-Za-z_]\\w*)$`),X=r(`^(?:given|when)\\s+capture\\s+([A-Za-z_]\\w*)$`),ie=r(`^when\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),ae=r(`^then\\s+result(\\s+exactly)?$`),Z=n(`^then\\s+no\\s+readmodel\\s+([A-Z]\\w*)\\s+for\\s+(.+)$`),oe=n(`^(?:"${i}"|'(?:[^'\\\\]|\\\\.)*')$`),se=n(`^then\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(\\s+exactly)?$`);function parseSpecification(t,n){let r=w.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidSpecificationDeclaration,`Invalid specification declaration '${n.content}' - expected 'specification <Name>'`,s(n));let i=null,a=[],c=[],l={givenOperationFailures:[],thenOperations:[],thenCompensated:[],thenAbsentReadModels:[],thenQueries:[],given:[],givenReadModels:[],when:null,whenAppended:null,whenRedelivered:null,whenDeclared:!1,thenEvents:[],thenEventsInAnyOrder:!1,thenNoEvents:!1,thenReadModels:[],thenErrors:[],givenClock: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(),y(u)||parseOperationStep(t,u,l))continue;let n=P.test(u.content)?`then`:o(u.content);if(n===`parameter`){let e=h(t,u);e!==null&&a.push(e)}else if(n===`case`){let e=m(t,u);e!==null&&c.push(e)}else n===`description`?i=te(t,u,i,`Specification '${r}'`):n===`given`?parseGiven(t,u,l):n===`when`?parseWhen(t,u,l,r):n===`then`?parseThen(t,u,l):(t.error(e.UnknownSpecificationDirective,`Unexpected '${o(u.content)}' in specification body`,s(u)),t.skipBlock(u.indent))}l.noEventsLine!==void 0&&(l.whenAppended!==null||l.thenEvents.length>0||l.thenEventsInAnyOrder||l.thenErrors.length>0||l.thenDenied!==null)&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot follow 'when append' or accompany event, event-order, error or denial expectations.`,s(l.noEventsLine));let{whenDeclared:u,noEventsLine:d,...f}=l,p={kind:`SpecificationSyntax`,sourceOptions:t.sourceOptions,name:r,description:i,...f,...a.length===0?{}:{parameters:a},...c.length===0?{}:{cases:c},location:s(n)};return ee(p,t),p}function parseOperationStep(t,n,r){if(!S.test(n.content))return!1;let i=C.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=u(t,r,I,e.InvalidOperationSpecification);n!==null&&a.push(n)}r.thenOperations.push({kind:`SpecificationOperationSyntax`,operation:i[2],values:a,location:s(n)})}else ne(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,n,r){if(re.test(n.content))r.givenClock===null?r.givenClock=parseClock(t,n,`given`):(t.error(e.InvalidSpecificationClock,`A specification states its clock at most once.`,s(n)),skipBody(t,n.indent));else if(R.test(n.content)){let e=parseCapture(t,n,`given`);e!==null&&r.givenCaptures.push(e)}else if(n.content.startsWith(`given caller`)){if(r.givenCaller!==null||r.givenCallerPersona!==void 0)t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'given caller' block.`,s(n)),t.skipBlock(n.indent);else if(n.content.startsWith(`given caller as`)){let i=T.exec(n.content);i===null&&t.error(e.InvalidSpecificationCallerPersona,`Expected 'given caller as <Persona>'.`,s(n));let a=t.peekChild(n.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,n.indent),i!==null&&(r.givenCallerPersona={kind:`SpecificationCallerPersonaSyntax`,name:i[1],location:s(n)})}else r.givenCaller=parseCaller(t,n)}else if(j.test(n.content)){let e=parseReadModelStep(t,n,M,`given`);e!==void 0&&r.givenReadModels.push(e)}else{let e=parseEventStep(t,n,E,`given`);e!==void 0&&r.given.push(e)}}const Q=r(`^role${t}+"(${i})"$`),ce=r(`^claim${t}+"(${i})"${t}*=${t}*"(${i})"$`);function parseCaller(t,n){if(n.content!==`given caller`)return t.error(e.InvalidSpecificationCaller,`Expected exactly 'given caller'.`,s(n)),t.skipBlock(n.indent),null;let r=!1,i=[],o=[];for(let c=t.peekChild(n.indent);c!==void 0;c=t.peekChild(n.indent)){t.reader.takeSignificant();let n=Q.exec(c.content),l=ce.exec(c.content);c.content===`authenticated`&&!r?r=!0:n===null?l===null?t.error(p(c.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationCaller,`Invalid caller fixture '${c.content}' - expected authenticated, role "...", or claim "..." = "...".`,s(c)):o.push({kind:`SpecificationCallerClaimSyntax`,type:a(l[1]),value:a(l[2]),location:s(c)}):i.push(a(n[1]))}return{kind:`SpecificationCallerSyntax`,authenticated:r,roles:i,claims:o,location:s(n)}}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,D,`when append`)??null;return}if(G.test(n.content)){let i=K.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(z.test(n.content)){r.whenClock=parseClock(t,n,`when`);return}if(B.test(n.content)){r.whenTrigger=parseNamedStep(t,n,Y,e.InvalidSpecificationTrigger,`when trigger`,`when trigger <Trigger>`,(e,t)=>({kind:`SpecificationTriggerSyntax`,trigger:e,values:t,location:s(n)}));return}if(V.test(n.content)){r.whenCapture=parseCapture(t,n,`when`);return}if(H.test(n.content)){r.whenQuery=parseNamedStep(t,n,ie,e.InvalidSpecificationQueryAction,`when query`,`when query <Query>`,(e,t)=>({kind:`SpecificationWhenQuerySyntax`,query:e,arguments:t,location:s(n)}));return}let o=O.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,n,r){if(q.test(n.content)){n.content!==`then no events`||r.thenNoEvents?t.error(e.InvalidNoEventsExpectation,`Expected one 'then no events' directive.`,s(n)):(r.thenNoEvents=!0,r.noEventsLine=n);let i=t.peekChild(n.indent);i!==void 0&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot have child mappings.`,s(i)),skipBody(t,n.indent);return}if(f.test(n.content)){let i=d(t,n);r.thenReturns===null?r.thenReturns=i:t.error(e.InvalidReturnExpectation,`A specification declares at most one return expectation.`,s(n));return}if(n.content.startsWith(`then events`)){n.content!==`then events in any order`||r.thenEventsInAnyOrder?t.error(e.InvalidSpecificationEventOrder,`Expected one 'then events in any order' directive.`,s(n)):r.thenEventsInAnyOrder=!0,skipBody(t,n.indent);return}if(U.test(n.content)){parseResult(t,n,r);return}if(W.test(n.content)){n.content!==`then no result`||r.thenNoResult!==null?t.error(e.InvalidSpecificationQueryAction,`Expected one 'then no result' directive.`,s(n)):r.thenNoResult={kind:`SpecificationNoResultSyntax`,location:s(n)},skipBody(t,n.indent);return}if(n.content.startsWith(`then denied`)){n.content===`then denied`?r.thenDenied===null?r.thenDenied={kind:`SpecificationDeniedSyntax`,location:s(n)}:t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'then denied' outcome.`,s(n)):(t.error(e.InvalidSpecificationDenied,`Expected exactly 'then denied'.`,s(n)),skipBody(t,n.indent));return}if(n.content===`then error`){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,location:s(n)});return}if(n.content.startsWith(`then error case.`)){let e=g(n.content.substring(11),{...s(n),column:s(n).column+11},t);e.kind===`CaseValueExpressionSyntax`&&r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,caseValue:e,location:s(n)});return}let i=F.exec(n.content);if(i!==null){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:a(i[1]),location:s(n)});return}if(o(n.content.substring(4).trim())===`error`){t.error(e.InvalidThenError,`Invalid 'then error' declaration '${n.content}' - expected 'then error' or 'then error "<reason>"'`,s(n)),skipBody(t,n.indent);return}if(P.test(n.content)){if(t.sourceOptions.numericMode===`exact`){let e=parseAbsentReadModel(t,n);e!==null&&r.thenAbsentReadModels.push(e);return}let e=Z.exec(n.content);if(e!==null&&!e[2].endsWith(` exactly`)){let i=g(e[2].trim(),s(n),t.valueContext);(i.kind===`LiteralExpressionSyntax`||i.kind===`ObjectExpressionSyntax`||i.kind===`CaseValueExpressionSyntax`)&&r.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:e[1],key:i,location:s(n)})}t.skipOpaqueBlock(n.indent);return}if(A.test(n.content)){let i=t.sourceOptions.numericMode===`exact`,reject=(e,n,r)=>{if(!i)return t.skipOpaqueBlock(r.indent);t.error(e,n,s(r)),t.skipBlock(r.indent)},a=se.exec(n.content);if(a===null)return reject(e.InvalidSpecificationQuery,`Invalid 'then query' declaration '${n.content}' - expected 'then query <Query> [exactly]'`,n);let c=[],l=[],u=!1;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),r.content===`arguments`&&!u?c.push(...parseValues(t.valueContext,r,!0)):r.content===`arguments`?reject(e.DuplicateSpecificationQueryArguments,`Query assertion '${a[1]}' already declares arguments`,r):r.content===`result`?l.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t.valueContext,r,!0),exactly:!1,location:s(r)}):reject(e.UnknownSpecificationQueryDirective,`Unexpected '${o(r.content)}' in 'then query' body - expected arguments or result`,r),u||=r.content===`arguments`;r.thenQueries.push({kind:`SpecificationQuerySyntax`,query:a[1],arguments:c,results:l,exactly:a[2]!==void 0,location:s(n)});return}if(j.test(n.content)){let e=parseReadModelStep(t,n,N,`then`);e!==void 0&&r.thenReadModels.push(e);return}let c=parseEventStep(t,n,k,`then`);c!==void 0&&r.thenEvents.push(c)}function parseAbsentReadModel(t,n){let r=Z.exec(n.content);if(r===null||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(`'`))||oe.test(i)?g(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=J.exec(n.content);return skipBody(t,n.indent),i===null||i[1]!==r?(t.error(p(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 parseCapture(t,n,r){return parseNamedStep(t,n,X,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){let c=n.exec(t.content);return c===null?(e.error(r,`Invalid '${i}' declaration '${t.content}' - expected '${a}'`,s(t)),skipBody(e,t.indent),null):o(c[1],parseValues(e,t))}function parseResult(t,n,r){let i=ae.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 $=_(`^stream\\s+([A-Za-z_]\\w*)\\.([A-Za-z_]\\w*)$`),le=r(`^streamId\\s*=(?!=|>)\\s*(.+)$`);function parseValuesWithEventSource(t,n,r,i,a){let d=[];x(t,n,i,d);let f=null,p,m,h=!1;for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r!==void 0&&l.test(i.content)){let n=u(t,i,c,e.InvalidGeneratedFixture);n!==null&&r.push(n);continue}let n=I.exec(i.content);if(n!==null)b(t,d,mappingOf(t,i,n));else if(o(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(h){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=$.exec(i.content);i.content===`no stream`&&(a===`then`||a===`when redelivered`)?(m={kind:`SpecificationNoStreamSyntax`,location:s(i)},h=!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)):(p=parseSpecificationStream(t,i,n),h=!0)}else if(o(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)):f===null?f=g(n,s(i),t):t.error(e.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,s(i))}else t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i))}return{values:d,for:f,...p===void 0?{}:{stream:p},...m===void 0?{}:{noStream:m}}}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=v(t,r,e.InvalidSpecificationStream).map(e=>e.source.kind===`PathExpressionSyntax`&&e.source.path.startsWith(`case.`)?{...e,source:g(e.source.path,e.source.location,t)}:e));continue}let n=le.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:g(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){let a=[];x(t,n,i,a);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`?L:I).exec(i.content);n===null?t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i)):b(t,a,mappingOf(t,i,n,r))}return a}function mappingOf(e,t,n,r=!1){return{kind:`PropertyMappingSyntax`,property:n[1],source:g(n[2],s(t),e,r),location:s(t)}}export{parseSpecification,parseSpecificationStream,rejectSpecificationRouteChildren,$ as specificationStream};
2
+ //# sourceMappingURL=SpecificationParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenClockPrefix","givenCapturePrefix","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","match","values","value","parseConcreteMapping","rejectOperationChildren","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","unescapeString","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","caseValue","parseSpecificationValue","error","absent","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","regex","expected","create","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","source","streamId","streamIdParts","block","directiveLocations","parseRouteParts","part","location","nativeIdentifiers"],"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 { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, 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, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\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 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 givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\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 givenCaptures: SpecificationCaptureSyntax[];\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}\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, 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.whenAppended !== null || body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot follow 'when append' or accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\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 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 (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) }));\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 (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].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));\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].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 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): 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));\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 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 {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\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): 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 if (mapping === null) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n continue;\n }\n addFixtureValue(context, values, mappingOf(context, child, mapping, nativeIdentifiers));\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"],"mappings":"6jCA0BA,MAAMC,EAAsBC,EAAQ,oEAAoE,EAClGC,EAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAuBH,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeI,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,EAAkBZ,EAAQ,mBAAmB,EAC7Ca,EAAkBb,EAAQ,iCAAiC,EAC3Dc,EAAwB,YAAY,oBAAoB,EACxDC,EAAuB,YAAY,oBAAqB,0BAA0B,EAClFC,EAAehB,EAAQ,gBAAgB,EACvCiB,EAAmBjB,EAAQ,uBAAuBkB,EAAkB,IAAI,EACxEC,EAAiBnB,EAAQ,iCAAiC,EAC1DoB,EAAuBhB,EAAc,iCAAiC,EACtEiB,GAAmBrB,EAAQ,oBAAoB,EAC/CsB,EAAqBtB,EAAQ,sBAAsB,EACnDuB,EAAkBvB,EAAQ,mBAAmB,EAC7CwB,EAAoBxB,EAAQ,qBAAqB,EACjDyB,EAAoBzB,EAAQ,qBAAqB,EACjD0B,EAAkB1B,EAAQ,mBAAmB,EAC7C2B,EAAmB3B,EAAQ,oBAAoB,EAC/C4B,EAAiB5B,EAAQ,0BAA0B,EACnD6B,EAAwBzB,EAAc,yBAAyB,EAC/D0B,EAAyB1B,EAAc,2FAA2F,EAClI2B,EAAiB/B,E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Q,UAAUD,EAAK,MAAM,EACvCQ,IAAU,IAAA,KACVP,EAAQ,MAAMC,EAAgB,2BAA4B,uCAAwCC,EAAWK,CAAK,CAAC,EACnHP,EAAQ,UAAUD,EAAK,MAAM,EAErC,CAEA,SAAS,YAAY,EAAwB,EAAoB,EAAoB,GAAO,EAAmD,CAC3I,IAAMuB,EAAkC,CAAC,EACzC2C,EAAejE,EAASkE,EAAQC,EAAQ7C,CAAM,EAC9C,IAAK,IAAIf,EAAQP,EAAQ,UAAUkE,EAAO,MAAM,EAAG3D,IAAU,IAAA,GAAW,EAAQP,EAAQ,UAAUkE,EAAO,MAAM,EAAG,CAC9GlE,EAAQ,OAAO,gBAAgB,EAC/B,IAAM4E,GAAWY,GAAqBxF,EAAQ,cAAc,cAAgB,QAAUtB,EAAuBD,EAAA,CAAgB,KAAK8B,EAAM,OAAO,EAC3IqE,IAAY,KACZ5E,EAAQ,MAAMC,EAAgB,0BAA2B,6BAA6BM,EAAM,QAAQ,qCAAsCL,EAAWK,CAAK,CAAC,EAG/JsE,EAAgB7E,EAASsB,EAAQ,UAAUtB,EAASO,EAAOqE,EAASY,CAAiB,CAAC,CAC1F,CACA,OAAOlE,CACX,CAEA,SAAS,UAAU,EAAwB,EAAkB,EAAwB,EAAoB,GAA8B,CACnI,MAAO,CAAE,KAAM,wBAAyB,SAAUD,EAAM,GAAI,OAAQjE,EAAmBiE,EAAM,GAAInB,EAAWH,CAAI,EAAGC,EAASwF,CAAiB,EAAG,SAAUtF,EAAWH,CAAI,CAAE,CAC/K"}
@@ -0,0 +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};
2
+ //# sourceMappingURL=SpecificationRedeliveryValidator.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n}from"../Text/StringLiteral.js";import{parseMappingSource as r}from"./ExpressionParser.js";import{locationOf as i}from"./SourceLine.js";import{containsCaseReference as a,parseSpecificationValue as o}from"./SpecificationCaseParser.js";const s=t(`^then\\s+returns\\b`),c=t(`^generated\\s+(?=\\S)(?![=])`),l=t(`^generated\\s+([a-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`),u=t(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),d=t(`^(?:"${n}"|'(?:[^'\\\\]|\\\\.)*')$`);function parseConcrete(t,n,i,s){if(n.startsWith(`case.`))return o(n,i,t);if(a(n)&&t.error(e.InvalidSpecificationCaseReference,`A case reference fills a whole value position; it cannot occur inside a structured value or expression.`,i),(n.startsWith(`"`)||n.startsWith(`'`))&&!d.test(n))return t.error(s,`Expected exactly one concrete value.`,i),null;let c=r(n,i,t);return![`LiteralExpressionSyntax`,`ObjectExpressionSyntax`,`ListExpressionSyntax`].includes(c.kind)||c.kind===`LiteralExpressionSyntax`&&typeof c.value==`number`&&!Number.isFinite(c.value)?(t.error(s,`Expected exactly one concrete literal or structured value, not an expression.`,i),null):c}function parseConcreteMapping(e,t,n,r){let a=n.exec(t.content);if(a===null)return e.error(r,`Expected a named fixture or assertion with exactly one concrete value.`,i(t)),e.skipBlock(t.indent),null;let o=i(t),s=parseConcrete(e,a[2],{...o,column:o.column+t.content.indexOf(a[2],t.content.indexOf(`=`)+1)},r),c=e.peekChild(t.indent);return c!==void 0&&(e.error(r,`A fixture or return field cannot have child directives.`,i(c)),e.skipBlock(t.indent)),s===null?null:{kind:`PropertyMappingSyntax`,property:a[1],source:s,location:o}}function parseReturn(t,n){let r=s.exec(n.content)[0].length,a=n.content.substring(r).trim(),o=i(n);if(a.length>0){let s=parseConcrete(t,a,{...o,column:o.column+n.content.indexOf(a,r)},e.InvalidReturnExpectation),c=t.peekChild(n.indent);return c!==void 0&&(t.error(e.InvalidReturnExpectation,`A scalar return expectation cannot have child assertions.`,i(c)),t.skipBlock(n.indent)),s===null?null:{kind:`ScalarSpecificationReturnSyntax`,value:s,location:o}}let c=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseConcreteMapping(t,r,u,e.InvalidReturnExpectation);n!==null&&c.push(n)}return{kind:`RecordSpecificationReturnSyntax`,fields:c,location:o}}export{l as generatedFixturePattern,c as generatedFixturePrefix,parseConcrete,parseConcreteMapping,parseReturn,s as thenReturnsPrefix};
2
+ //# sourceMappingURL=SpecificationResponseParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationResponseParser.js","names":["thenReturnsPrefix","pattern","generatedFixturePrefix","generatedFixturePattern","fieldPattern","quotedValue","stringBodyPattern","text","parseSpecificationValue","location","context","containsCaseReference","DiagnosticCodes","code","expression","parseMappingSource","match","regex","line","locationOf","source","child","prefix","value","concrete","fields","field"],"sources":["../../../../../../Compiler/Parsing/SpecificationResponseParser.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 { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { parseMappingSource } from './ExpressionParser';\nimport { containsCaseReference, parseSpecificationValue } from './SpecificationCaseParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const thenReturnsPrefix = pattern('^then\\\\s+returns\\\\b');\nexport const generatedFixturePrefix = pattern('^generated\\\\s+(?=\\\\S)(?![=])');\nexport const generatedFixturePattern = pattern('^generated\\\\s+([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst fieldPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst quotedValue = pattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\n\nexport function parseConcrete(context: ParserContext, text: string, location: SourceLocation, code: string): ExpressionSyntax | null {\n if (text.startsWith('case.')) return parseSpecificationValue(text, location, context);\n if (containsCaseReference(text)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'A case reference fills a whole value position; it cannot occur inside a structured value or expression.', location);\n if ((text.startsWith('\"') || text.startsWith(\"'\")) && !quotedValue.test(text)) {\n context.error(code, 'Expected exactly one concrete value.', location);\n return null;\n }\n const expression = parseMappingSource(text, location, context);\n if (!['LiteralExpressionSyntax', 'ObjectExpressionSyntax', 'ListExpressionSyntax'].includes(expression.kind) || (expression.kind === 'LiteralExpressionSyntax' && typeof expression.value === 'number' && !Number.isFinite(expression.value))) {\n context.error(code, 'Expected exactly one concrete literal or structured value, not an expression.', location);\n return null;\n }\n return expression;\n}\n\nexport function parseConcreteMapping(context: ParserContext, line: SourceLine, regex: RegExp, code: string): PropertyMappingSyntax | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, 'Expected a named fixture or assertion 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[2], { ...location, column: location.column + line.content.indexOf(match[2], line.content.indexOf('=') + 1) }, code);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(code, 'A fixture or return field cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'PropertyMappingSyntax', property: match[1], source, location };\n}\n\nexport function parseReturn(context: ParserContext, line: SourceLine): SpecificationReturnSyntax | null {\n const prefix = thenReturnsPrefix.exec(line.content)![0].length;\n const value = line.content.substring(prefix).trim();\n const location = locationOf(line);\n if (value.length > 0) {\n const concrete = parseConcrete(context, value, { ...location, column: location.column + line.content.indexOf(value, prefix) }, DiagnosticCodes.InvalidReturnExpectation);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A scalar return expectation cannot have child assertions.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return concrete === null ? null : { kind: 'ScalarSpecificationReturnSyntax', value: concrete, location };\n }\n const fields: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const field = parseConcreteMapping(context, child, fieldPattern, Diagnos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ACA,MAAO,CAAE,KAAM,kCAAmC,SAAQ,UAAS,CACvE"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{EventSourceCatalog as e}from"../Syntax/EventSourceCatalog.js";import{compatibleValue as t,uniqueByName as n}from"./ResponseValidator.js";import{formatStreamIdLiteral as r}from"./EventSourceValidator.js";function formatSpecificationStreamId(e,i,a){let o=n(a.concepts),s=n(a.types),c=new Map([...s].map(([e,t])=>[e,n(t.properties)]));if(e?.kind!==`LiteralExpressionSyntax`||!t(e,i,o,c))return null;let l=o.get(i.name)?.type??i.name;return[`String`,`Uuid`,`Int`].includes(l)?r(e,i,a)?.value??null:null}function matchesSpecificationRoute(t,n,r,i){if(r!=null)return t==null;if(n==null)return!0;if(t==null)return!1;let a=new e(i),o=a.resolve(t.eventSource,t.stream),s=a.resolve(n.eventSource,n.stream);if(o.kind!==`unique`||s.kind!==`unique`)return null;if(o.sources[0]!==s.sources[0]||o.streams[0]!==s.streams[0])return!1;let c=s.streams[0],compare=(e,t,n)=>{let r=formatSpecificationStreamId(e,n,i),a=formatSpecificationStreamId(t,n,i);return r===null||a===null?null:r===a};if(c.streamIdParts.length>0){if(t.streamId!==null||n.streamId!==null||t.streamIdParts.length!==c.streamIdParts.length||n.streamIdParts.length!==c.streamIdParts.length)return null;let e=c.streamIdParts.map(e=>{let r=t.streamIdParts.filter(t=>t.property===e.name),i=n.streamIdParts.filter(t=>t.property===e.name);return r.length===1&&i.length===1?compare(r[0].source,i[0].source,e.type):null});return e.includes(!1)?!1:!e.includes(null)||null}return t.streamIdParts.length>0||n.streamIdParts.length>0?null:c.streamId===null?t.streamId===null&&n.streamId===null||null:compare(t.streamId?.source,n.streamId?.source,c.streamId)}export{formatSpecificationStreamId,matchesSpecificationRoute};
2
+ //# sourceMappingURL=SpecificationRouteComparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationRouteComparison.js","names":["concepts","uniqueByName","application","composites","properties","name","type","expression","compatibleValue","primitive","formatStreamIdLiteral","noStream","given","expected","catalog","EventSourceCatalog","actual","target","stream","first","left","second","right","comparisons","mapping","part"],"sources":["../../../../../../Compiler/Parsing/SpecificationRouteComparison.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 { TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { formatStreamIdLiteral } from './EventSourceValidator';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { SpecificationStreamSyntax, SpecificationNoStreamSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\n\nexport function formatSpecificationStreamId(expression: ExpressionSyntax | null | undefined, type: TypeRefSyntax, application: ApplicationSyntax): string | null {\n const concepts = uniqueByName(application.concepts);\n const composites = uniqueByName(application.types);\n const properties = new Map([...composites].map(([name, type]) => [name, uniqueByName(type.properties)]));\n if (expression?.kind !== 'LiteralExpressionSyntax' || !compatibleValue(expression, type, concepts, properties)) return null;\n const primitive = concepts.get(type.name)?.type ?? type.name;\n return ['String', 'Uuid', 'Int'].includes(primitive) ? formatStreamIdLiteral(expression, type, application)?.value ?? null : null;\n}\n\nexport function matchesSpecificationRoute(given: SpecificationStreamSyntax | null | undefined, expected: SpecificationStreamSyntax | null | undefined, noStream: SpecificationNoStreamSyntax | null | undefined, application: ApplicationSyntax): boolean | null {\n if (noStream != null) return given == null;\n if (expected == null) return true;\n if (given == null) return false;\n const catalog = new EventSourceCatalog(application);\n const actual = catalog.resolve(given.eventSource, given.stream);\n const target = catalog.resolve(expected.eventSource, expected.stream);\n if (actual.kind !== EventSourceResolutionKind.Unique || target.kind !== EventSourceResolutionKind.Unique) return null;\n if (actual.sources[0] !== target.sources[0] || actual.streams[0] !== target.streams[0]) return false;\n const stream = target.streams[0];\n const compare = (left: ExpressionSyntax | null | undefined, right: ExpressionSyntax | null | undefined, type: TypeRefSyntax): boolean | null => {\n const first = formatSpecificationStreamId(left, type, application);\n const second = formatSpecificationStreamId(right, type, application);\n return first === null || second === null ? null : first === second;\n };\n if (stream.streamIdParts.length > 0) {\n if (given.streamId !== null || expected.streamId !== null || given.streamIdParts.length !== stream.streamIdParts.length || expected.streamIdParts.length !== stream.streamIdParts.length) return null;\n const comparisons = stream.streamIdParts.map(part => {\n const left = given.streamIdParts.filter(mapping => mapping.property === part.name);\n const right = expected.streamIdParts.filter(mapping => mapping.property === part.name);\n return left.length === 1 && right.length === 1 ? compare(left[0].source, right[0].source, part.type) : null;\n });\n return comparisons.includes(false) ? false : comparisons.includes(null) ? null : true;\n }\n if (given.streamIdParts.length > 0 || expected.streamIdParts.length > 0) return null;\n if (stream.streamId === null) return given.streamId === null && expected.streamId === null ? true : null;\n return compare(given.streamId?.source, expected.streamId?.source, stream.streamId);\n}\n"],"mappings":"uQAYA,SAAgB,4BAA4B,EAAiD,EAAqB,EAA+C,CAC7J,IAAMA,EAAWC,EAAaC,EAAY,QAAQ,EAC5CC,EAAaF,EAAaC,EAAY,KAAK,EAC3CE,EAAa,IAAI,IAAI,CAAC,GAAGD,CAAU,CAAC,CAAC,KAAK,CAACE,EAAMC,KAAU,CAACD,EAAMJ,EAAaK,EAAK,UAAU,CAAC,CAAC,CAAC,EACvG,GAAIC,GAAY,OAAS,2BAA6B,CAACC,EAAgBD,EAAYD,EAAMN,EAAUI,CAAU,EAAG,OAAO,KACvH,IAAMK,EAAYT,EAAS,IAAIM,EAAK,IAAI,CAAC,EAAE,MAAQA,EAAK,KACxD,MAAO,CAAC,SAAU,OAAQ,KAAK,CAAC,CAAC,SAASG,CAAS,EAAIC,EAAsBH,EAAYD,EAAMJ,CAAW,CAAC,EAAE,OAAS,KAAO,IACjI,CAEA,SAAgB,0BAA0B,EAAqD,EAAwD,EAA0D,EAAgD,CAC7P,GAAIS,GAAY,KA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,OAAS,EAAU,KAC5EK,EAAO,WAAa,KAAaN,EAAM,WAAa,MAAQC,EAAS,WAAa,MAAc,KAC7F,QAAQD,EAAM,UAAU,OAAQC,EAAS,UAAU,OAAQK,EAAO,QAAQ,CACrF"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{AuthoringProductionResolver as t}from"../Syntax/AuthoringProductionResolver.js";import{EventSourceCatalog as n}from"../Syntax/EventSourceCatalog.js";import{expandEffectiveSpecificationExamples as r,specificationExamples as i}from"./SpecificationCommandExamples.js";import{compatibleValue as a,uniqueByName as o}from"./ResponseValidator.js";import{commandDestinationType as s}from"./CommandDestinationTypes.js";import{LineReader as c}from"./LineReader.js";import{ParserContext as l}from"./ParserContext.js";import{streamIdFailureMessage as u}from"../Syntax/StreamIdFormatter.js";import{validateStreamIdParts as d}from"./CompositeStreamIdValidator.js";import{formatSpecificationStreamId as f}from"./SpecificationRouteComparison.js";import{formatStreamIdLiteral as p}from"./EventSourceValidator.js";function validateSpecificationStreams(n,r){let i=new t(n).slices.flatMap(({slice:e})=>e.specifications.flatMap(e=>e.cases??[]));if(i.length===0)return validateRoutes(n,r);let a=new l(new c([]));validateRoutes(n,a);let o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set;for(let t of a.diagnostics){let n=JSON.stringify([t.code,t.location.path,t.location.line,t.location.column,t.message]);if(s.has(n))continue;s.add(n);let a=t.code===e.InvalidSpecificationStreamRoute?i.find(e=>e.values.some(e=>e.source.location.line===t.location.line&&e.source.location.column===t.location.column&&e.source.location.path===t.location.path)):void 0;if(a===void 0)r.error(t.code,t.message,t.location);else{let e=JSON.stringify(t.location);o.has(e)||r.error(t.code,`Case '${a.name}': ${t.message}`,t.location),o.add(e)}}}function validateRoutes(c,l){let m=i(c).resolvedExamples,h=r(c);c=h.application;let g=new t(c),_=/* @__PURE__ */ new Set,v=m.flatMap(t=>{if(t.kind!==`event`)return(t.kind===`command`||t.kind===`readmodel`)&&(t.example.stream!=null||t.example.noStream!=null)&&l.error(e.InvalidSpecificationExampleBody,`only event examples carry routes; a command's route comes from its declaration, and read models have none`,(t.example.stream??t.example.noStream).location),[];let n={kind:`SpecificationEventSyntax`,eventType:t.name,values:t.example.values,for:t.example.for,stream:t.example.stream,noStream:t.example.noStream,location:t.example.location};return _.add(n),[{scope:t.scope,specification:{when:null,given:[],whenAppended:null,thenEvents:[n],whenRedelivered:null}}]}),y=new n(c),b=o(c.concepts),x=o(c.types),S=new Map([...x].map(([e,t])=>[e,o(t.properties)])),compatible=(e,t)=>a(e,t,b,S),C=/* @__PURE__ */ new Set([`String`,`Uuid`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`,...b.keys(),...x.keys()]),nominallyCompatible=(e,t)=>C.has(e.name)&&C.has(t.name)?e.name===t.name&&e.isCollection===t.isCollection&&(!e.isOptional||t.isOptional):null,formatStreamId=(e,t)=>f(e,t,c),eventOf=(e,t)=>{let n=g.resolve(e,t).declaration;return n?.node.kind===`EventSyntax`?n.node:null},w=[];for(let{slice:e}of g.slices){for(let t of e.commands)for(let n of t.produces){if(!g.isEventProduction(n,e))continue;let r=eventOf(n.event,e);if(r===null)continue;let i=s(t,n,c,{resolver:g,slice:e});w.push({event:r,command:t,type:i})}for(let t of e.reactions.flatMap(e=>e.triggers).flatMap(e=>e.produces)){let n=eventOf(t.event,e);n!==null&&w.push({event:n,command:null,type:null})}for(let t of e.captures)for(let n of[...t.appends,...t.children.flatMap(e=>e.appends),...t.nested.flatMap(e=>e.appends)]){let t=eventOf(n.event,e);t!==null&&w.push({event:t,command:null,type:null})}}let T=[...v.flatMap(e=>g.slices.filter(t=>t.scope.join(`.`)===e.scope.join(`.`)).map(({slice:t,scope:n})=>({slice:t,scope:n,specification:e.specification}))),...g.slices.flatMap(({slice:e,scope:t})=>e.specifications.map(n=>({slice:e,scope:t,specification:n})))];for(let{slice:t,scope:n,specification:r}of T){let i=g.slices.flatMap(e=>e.slice.commands.map(t=>({command:t,scope:e.scope}))),a=r.when?.commandType.split(`.`)??[],o=a.slice(0,-1),s=i.filter(e=>e.command.name===a.at(-1)&&o.every((t,n)=>e.scope[e.scope.length-o.length+n]===t)),f=o.length>0&&s.length===1?s[0].command:null;for(let e=n.length;o.length===0&&e>=0&&f===null;e--){let t=s.filter(t=>n.slice(0,e).every((e,n)=>t.scope[n]===e));if(t.length>0){f=t.length===1?t[0].command:null;break}}let m=[...r.given.map(e=>({node:e,required:!0,expected:!1})),...r.whenAppended===null?[]:[{node:r.whenAppended,required:!0,expected:!1}],...r.thenEvents.map(e=>({node:e,required:!1,expected:!_.has(e)})),...r.whenRedelivered==null?[]:[{node:{...r.whenRedelivered,kind:`SpecificationEventSyntax`},required:!1,expected:!1}]];for(let{node:n,required:r,expected:i}of m){let a=h.specifications.flatMap(e=>e.steps).find(e=>e.effective===n),o=a?.route?.origin!==`example`,s=o||n.for!==a?.example?.for,contextualError=(e,t,n)=>{l.error(e,a?.example==null?t:`${t} Example '${a.example.name}' is used here.`,a?.example==null?n:a.authored.location)};if(n.stream==null&&n.noStream==null)continue;r&&n.noStream!=null&&contextualError(e.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on a then event.`,n.noStream.location);let m=null,g=eventOf(n.eventType,t),_=w.filter(e=>e.event===g);if(n.stream!=null){let t=n.stream,i=y.resolve(t.eventSource,t.stream);if(i.kind!==`unique`){let n={ambiguous:`Ambiguous`,notFound:`NotFound`,wrongKind:`WrongKind`}[i.kind];o&&l.error(e.InvalidSpecificationStreamRoute,`Stream '${t.eventSource}.${t.stream}' is ${n}; routing requires one physical source and stream.`,t.location);continue}let f=i.sources[0],h=i.streams[0],validateLiteral=(t,n)=>{let r=t.source,i=p(r,n,c);i?.failure==null?(r.kind!==`LiteralExpressionSyntax`||r.value===null||n!==null&&!compatible(r,n))&&l.error(e.InvalidSpecificationStreamRoute,`A specification stream id needs a nonempty concrete scalar literal compatible with the stream's declared type.`,r.location):l.error(e.InvalidSpecificationStreamRoute,u(i.failure),r.location)};if(o&&(h.streamIdParts.length>0?d(h,t.streamIdParts,t.streamId!==null,t.location,e.InvalidSpecificationStreamRoute,l,validateLiteral):t.streamIdParts.length>0?l.error(e.InvalidSpecificationStreamRoute,`A streamId part block requires a composite stream.`,t.location):(h.streamId===null!=(t.streamId===null)&&l.error(e.InvalidSpecificationStreamRoute,h.streamId===null?`An unkeyed stream cannot take a streamId mapping.`:`This keyed stream requires a streamId mapping.`,t.location),t.streamId!==null&&validateLiteral(t.streamId,h.streamId))),m=f.identifier,m===null){let n=_.map(e=>e.type),r=new Set(n.filter(e=>e!==null).map(e=>`${e.name}:${e.isOptional}:${e.isCollection}`));n.length===0||n.some(e=>e===null)||r.size!==1?o&&l.error(e.InvalidSpecificationStreamEventSource,`Declare an identifier on source '${f.name}'; the event's producers do not supply one unambiguous destination type.`,t.location):m=n[0]}let g=!1;if(a?.example?.stream!=null&&n.for!==null&&n.for===a.example.for){let e=y.resolve(a.example.stream.eventSource,a.example.stream.stream);if(e.kind===`unique`){let t=_.map(e=>e.type),r=new Set(t.filter(e=>e!==null).map(e=>`${e.name}:${e.isOptional}:${e.isCollection}`)),i=e.sources[0].identifier??(t.length>0&&!t.some(e=>e===null)&&r.size===1?t[0]:null);i!==null&&(g=n.for.kind!==`LiteralExpressionSyntax`||n.for.value===null||i.isCollection||i.isOptional||!compatible(n.for,i))}}r&&n.for===null?contextualError(e.InvalidSpecificationStreamEventSource,`A routed given or when append event requires 'for <literal>'.`,t.location):s&&!g&&n.for!==null&&(n.for.kind!==`LiteralExpressionSyntax`||n.for.value===null||m!==null&&(m.isCollection||m.isOptional||!compatible(n.for,m)))&&contextualError(e.InvalidSpecificationStreamEventSource,`A routed event's for value must be a concrete literal compatible with the source's identifier type.`,n.for.location)}if(!i||f===null||_.length===0||_.some(e=>e.command!==f))continue;let v=f.stream?.propertyCandidate===null?f.stream:null,b=n.noStream==null?v==null||v.eventSource!==n.stream.eventSource||v.stream!==n.stream.stream:v!=null;if(!b&&n.stream!=null&&v!=null){let e=y.resolve(n.stream.eventSource,n.stream.stream),t=e.kind===`unique`?e.streams[0]:null;if(t!==null&&t.streamIdParts.length>0){if(v.streamId===null&&n.stream.streamId===null&&v.streamIdParts.length>0&&n.stream.streamIdParts.length>0)for(let e of t.streamIdParts){let t=v.streamIdParts.filter(t=>t.property===e.name),r=n.stream.streamIdParts.filter(t=>t.property===e.name);if(t.length!==1||r.length!==1)continue;let i=formatStreamId(t[0].source,e.type),a=formatStreamId(r[0].source,e.type);i!==null&&a!==null&&i!==a&&(b=!0)}}else if(t?.streamId!=null&&v.streamIdParts.length===0&&n.stream.streamIdParts.length===0){let e=formatStreamId(v.streamId?.source,t.streamId),r=formatStreamId(n.stream.streamId?.source,t.streamId);e!==null&&r!==null&&e!==r&&(b=!0)}}n.for?.kind===`LiteralExpressionSyntax`&&_.every(e=>e.type!==null&&(m===null?!compatible(n.for,e.type):nominallyCompatible(e.type,m)===!1))&&(b=!0),b&&contextualError(e.SpecificationStreamContradictsCommand,`The expected event route contradicts its only producer, the command under test.`,(n.stream??n.noStream).location)}}}export{validateSpecificationStreams};
2
+ //# sourceMappingURL=SpecificationStreamValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationStreamValidator.js","names":["rows","AuthoringProductionResolver","application","slice","specification","context","sink","ParserContext","LineReader","reported","distinct","diagnostic","key","row","DiagnosticCodes","value","examples","specificationExamples","expansion","expandEffectiveSpecificationExamples","resolver","declarationSteps","exampleSpecifications","entry","node","catalog","EventSourceCatalog","concepts","uniqueByName","composites","properties","name","type","compatibleValue","known","source","target","formatSpecificationStreamId","expression","declared","reference","producers","command","produced","event","commandDestinationType","reaction","trigger","capture","appended","child","nested","validationSpecifications","owner","commands","parts","qualifiers","candidates","index","segment","depth","scope","visible","occurrences","step","pair","validateRoute","validateFor","code","message","location","required","identifier","eventProducers","producer","route","resolution","state","stream","mapping","formatted","formatStreamIdLiteral","streamIdFailureMessage","validateStreamIdParts","types","inheritedIdentityIsInvalid","prior","priorIdentifier","expected","commandRoute","contradicts","part","actual","actualId","expectedId"],"sources":["../../../../../../Compiler/Parsing/SpecificationStreamValidator.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 { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { EventSyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { formatSpecificationStreamId } from './SpecificationRouteComparison';\nimport { streamIdFailureMessage } from '../Syntax/StreamIdFormatter';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { commandDestinationType } from './CommandDestinationTypes';\nimport { formatStreamIdLiteral } from './EventSourceValidator';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { validateStreamIdParts } from './CompositeStreamIdValidator';\nimport { ParserContext } from './ParserContext';\nimport { LineReader } from './LineReader';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\nimport { expandEffectiveSpecificationExamples, specificationExamples } from './SpecificationCommandExamples';\nimport { SpecificationEventSyntax } from '../Syntax/Specifications';\n\ninterface Producer { event: EventSyntax; command: CommandSyntax | null; type: TypeRefSyntax | null }\n\nexport function validateSpecificationStreams(application: ApplicationSyntax, context: ParserContext): void {\n const rows = new AuthoringProductionResolver(application).slices.flatMap(({ slice }) => slice.specifications.flatMap(specification => specification.cases ?? []));\n if (rows.length === 0) return validateRoutes(application, context);\n const sink = new ParserContext(new LineReader([]));\n validateRoutes(application, sink);\n const reported = new Set<string>();\n const distinct = new Set<string>();\n for (const diagnostic of sink.diagnostics) {\n const key = JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column, diagnostic.message]);\n if (distinct.has(key)) continue;\n distinct.add(key);\n const row = diagnostic.code === DiagnosticCodes.InvalidSpecificationStreamRoute ? rows.find(row => row.values.some(value => value.source.location.line === diagnostic.location.line && value.source.location.column === diagnostic.location.column && value.source.location.path === diagnostic.location.path)) : undefined;\n if (row === undefined) context.error(diagnostic.code, diagnostic.message, diagnostic.location);\n else {\n const key = JSON.stringify(diagnostic.location);\n if (!reported.has(key)) context.error(diagnostic.code, `Case '${row.name}': ${diagnostic.message}`, diagnostic.location);\n reported.add(key);\n }\n }\n}\n\nfunction validateRoutes(application: ApplicationSyntax, context: ParserContext): void {\n const examples = specificationExamples(application).resolvedExamples;\n const expansion = expandEffectiveSpecificationExamples(application);\n application = expansion.application;\n const resolver = new AuthoringProductionResolver(application);\n const declarationSteps = new Set<SpecificationEventSyntax>();\n const exampleSpecifications = examples.flatMap(entry => {\n if (entry.kind !== 'event') {\n if ((entry.kind === 'command' || entry.kind === 'readmodel') && (entry.example.stream != null || entry.example.noStream != null))\n context.error(DiagnosticCodes.InvalidSpecificationExampleBody, \"only event examples carry routes; a command's route comes from its declaration, and read models have none\", (entry.example.stream ?? entry.example.noStream)!.location);\n return [];\n }\n const node: SpecificationEventSyntax = { kind: 'SpecificationEventSyntax', eventType: entry.name, values: entry.example.values, for: entry.example.for, stream: entry.example.stream, noStream: entry.example.noStream, location: entry.example.location };\n declarationSteps.add(node);\n return [{ scope: entry.scope, specification: { when: null, given: [], whenAppended: null, thenEvents: [node], whenRedelivered: null } }];\n });\n const catalog = new EventSourceCatalog(application);\n const concepts = uniqueByName(application.concepts);\n const composites = uniqueByName(application.types);\n const properties = new Map([...composites].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const compatible = (value: Parameters<typeof compatibleValue>[0], type: TypeRefSyntax): boolean => compatibleValue(value, type, concepts, properties);\n const known = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime', ...concepts.keys(), ...composites.keys()]);\n const nominallyCompatible = (source: TypeRefSyntax, target: TypeRefSyntax): boolean | null => known.has(source.name) && known.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n const formatStreamId = (expression: ExpressionSyntax | null | undefined, type: TypeRefSyntax): string | null => formatSpecificationStreamId(expression, type, application);\n const eventOf = (reference: string, slice: typeof resolver.slices[number]['slice']): EventSyntax | null => {\n const declared = resolver.resolve(reference, slice).declaration;\n return declared?.node.kind === 'EventSyntax' ? declared.node : null;\n };\n const producers: Producer[] = [];\n for (const { slice } of resolver.slices) {\n for (const command of slice.commands) for (const produced of command.produces) {\n if (!resolver.isEventProduction(produced, slice)) continue;\n const event = eventOf(produced.event, slice);\n if (event === null) continue;\n const type = commandDestinationType(command, produced, application, { resolver, slice });\n producers.push({ event, command, type });\n }\n for (const produced of slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)) {\n const event = eventOf(produced.event, slice);\n if (event !== null) producers.push({ event, command: null, type: null });\n }\n for (const capture of slice.captures) for (const appended of [...capture.appends, ...capture.children.flatMap(child => child.appends), ...capture.nested.flatMap(nested => nested.appends)]) {\n const event = eventOf(appended.event, slice);\n if (event !== null) producers.push({ event, command: null, type: null });\n }\n }\n const validationSpecifications = [\n ...exampleSpecifications.flatMap(entry => resolver.slices.filter(owner => owner.scope.join('.') === entry.scope.join('.')).map(({ slice, scope }) => ({ slice, scope, specification: entry.specification }))),\n ...resolver.slices.flatMap(({ slice, scope }) => slice.specifications.map(specification => ({ slice, scope, specification })))\n ];\n for (const { slice, scope, specification } of validationSpecifications) {\n const commands = resolver.slices.flatMap(entry => entry.slice.commands.map(command => ({ command, scope: entry.scope })));\n const parts = specification.when?.commandType.split('.') ?? [];\n const qualifiers = parts.slice(0, -1);\n const candidates = commands.filter(entry => entry.command.name === parts.at(-1) && qualifiers.every((segment, index) => entry.scope[entry.scope.length - qualifiers.length + index] === segment));\n let command: CommandSyntax | null = qualifiers.length > 0 && candidates.length === 1 ? candidates[0].command : null;\n for (let depth = scope.length; qualifiers.length === 0 && depth >= 0 && command === null; depth--) {\n const visible = candidates.filter(entry => scope.slice(0, depth).every((segment, index) => entry.scope[index] === segment));\n if (visible.length > 0) { command = visible.length === 1 ? visible[0].command : null; break; }\n }\n const occurrences = [...specification.given.map(node => ({ node, required: true, expected: false })),\n ...(specification.whenAppended === null ? [] : [{ node: specification.whenAppended, required: true, expected: false }]),\n ...specification.thenEvents.map(node => ({ node, required: false, expected: !declarationSteps.has(node) })),\n ...(specification.whenRedelivered == null ? [] : [{ node: { ...specification.whenRedelivered, kind: 'SpecificationEventSyntax' as const }, required: false, expected: false }])];\n for (const { node, required, expected } of occurrences) {\n const step = expansion.specifications.flatMap(pair => pair.steps).find(step => step.effective === node);\n const validateRoute = step?.route?.origin !== 'example';\n const validateFor = validateRoute || node.for !== step?.example?.for;\n const contextualError = (code: string, message: string, location: typeof node.location): void => {\n context.error(code, step?.example == null ? message : `${message} Example '${step.example.name}' is used here.`, step?.example == null ? location : step.authored.location);\n };\n if (node.stream == null && node.noStream == null) continue;\n if (required && node.noStream != null)\n contextualError(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", node.noStream.location);\n let identifier: TypeRefSyntax | null = null;\n const event = eventOf(node.eventType, slice);\n const eventProducers = producers.filter(producer => producer.event === event);\n if (node.stream != null) {\n const route = node.stream;\n const resolution = catalog.resolve(route.eventSource, route.stream);\n if (resolution.kind !== EventSourceResolutionKind.Unique) {\n const state = { ambiguous: 'Ambiguous', notFound: 'NotFound', wrongKind: 'WrongKind' }[resolution.kind];\n if (validateRoute) context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, `Stream '${route.eventSource}.${route.stream}' is ${state}; routing requires one physical source and stream.`, route.location);\n continue;\n }\n const source = resolution.sources[0];\n const stream = resolution.streams[0];\n const validateLiteral = (mapping: PropertyMappingSyntax, target: TypeRefSyntax | null): void => {\n const value = mapping.source;\n const formatted = formatStreamIdLiteral(value, target, application);\n if (formatted?.failure != null) context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, streamIdFailureMessage(formatted.failure), value.location);\n else if (value.kind !== 'LiteralExpressionSyntax' || value.value === null || target !== null && !compatible(value, target))\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, \"A specification stream id needs a nonempty concrete scalar literal compatible with the stream's declared type.\", value.location);\n };\n if (!validateRoute) { /* The authored example's route is checked once at its declaration. */ }\n else if (stream.streamIdParts.length > 0)\n validateStreamIdParts(stream, route.streamIdParts, route.streamId !== null, route.location, DiagnosticCodes.InvalidSpecificationStreamRoute, context, validateLiteral);\n else if (route.streamIdParts.length > 0)\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, 'A streamId part block requires a composite stream.', route.location);\n else {\n if ((stream.streamId === null) !== (route.streamId === null))\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, stream.streamId === null ? 'An unkeyed stream cannot take a streamId mapping.' : 'This keyed stream requires a streamId mapping.', route.location);\n if (route.streamId !== null) validateLiteral(route.streamId, stream.streamId);\n }\n identifier = source.identifier;\n if (identifier === null) {\n const types = eventProducers.map(producer => producer.type);\n const distinct = new Set(types.filter(type => type !== null).map(type => `${type.name}:${type.isOptional}:${type.isCollection}`));\n if (types.length === 0 || types.some(type => type === null) || distinct.size !== 1) {\n if (validateRoute) context.error(DiagnosticCodes.InvalidSpecificationStreamEventSource, `Declare an identifier on source '${source.name}'; the event's producers do not supply one unambiguous destination type.`, route.location);\n } else identifier = types[0];\n }\n let inheritedIdentityIsInvalid = false;\n if (step?.example?.stream != null && node.for !== null && node.for === step.example.for) {\n const prior = catalog.resolve(step.example.stream.eventSource, step.example.stream.stream);\n if (prior.kind === EventSourceResolutionKind.Unique) {\n const types = eventProducers.map(producer => producer.type);\n const distinct = new Set(types.filter(type => type !== null).map(type => `${type.name}:${type.isOptional}:${type.isCollection}`));\n const priorIdentifier = prior.sources[0].identifier ?? (types.length > 0 && !types.some(type => type === null) && distinct.size === 1 ? types[0] : null);\n if (priorIdentifier !== null)\n inheritedIdentityIsInvalid = node.for.kind !== 'LiteralExpressionSyntax' || node.for.value === null || priorIdentifier.isCollection || priorIdentifier.isOptional || !compatible(node.for, priorIdentifier);\n }\n }\n if (required && node.for === null)\n contextualError(DiagnosticCodes.InvalidSpecificationStreamEventSource, \"A routed given or when append event requires 'for <literal>'.\", route.location);\n else if (validateFor && !inheritedIdentityIsInvalid && node.for !== null && (node.for.kind !== 'LiteralExpressionSyntax' || node.for.value === null || identifier !== null && (identifier.isCollection || identifier.isOptional || !compatible(node.for, identifier))))\n contextualError(DiagnosticCodes.InvalidSpecificationStreamEventSource, \"A routed event's for value must be a concrete literal compatible with the source's identifier type.\", node.for.location);\n }\n if (!expected || command === null || eventProducers.length === 0 || eventProducers.some(producer => producer.command !== command)) continue;\n const commandRoute = command.stream?.propertyCandidate === null ? command.stream : null;\n let contradicts = node.noStream != null ? commandRoute != null : commandRoute == null || commandRoute.eventSource !== node.stream!.eventSource || commandRoute.stream !== node.stream!.stream;\n if (!contradicts && node.stream != null && commandRoute != null) {\n const resolution = catalog.resolve(node.stream.eventSource, node.stream.stream);\n const stream = resolution.kind === EventSourceResolutionKind.Unique ? resolution.streams[0] : null;\n if (stream !== null && stream.streamIdParts.length > 0) {\n if (commandRoute.streamId === null && node.stream.streamId === null && commandRoute.streamIdParts.length > 0 && node.stream.streamIdParts.length > 0) {\n for (const part of stream.streamIdParts) {\n const actual = commandRoute.streamIdParts.filter(mapping => mapping.property === part.name);\n const expected = node.stream.streamIdParts.filter(mapping => mapping.property === part.name);\n if (actual.length !== 1 || expected.length !== 1) continue;\n const actualId = formatStreamId(actual[0].source, part.type);\n const expectedId = formatStreamId(expected[0].source, part.type);\n if (actualId !== null && expectedId !== null && actualId !== expectedId) contradicts = true;\n }\n }\n } else if (stream?.streamId != null && commandRoute.streamIdParts.length === 0 && node.stream.streamIdParts.length === 0) {\n const actualId = formatStreamId(commandRoute.streamId?.source, stream.streamId);\n const expectedId = formatStreamId(node.stream.streamId?.source, stream.streamId);\n if (actualId !== null && expectedId !== null && actualId !== expectedId) contradicts = true;\n }\n }\n if (node.for?.kind === 'LiteralExpressionSyntax' && eventProducers.every(producer => producer.type !== null &&\n (identifier !== null ? nominallyCompatible(producer.type, identifier) === false : !compatible(node.for!, producer.type)))) contradicts = true;\n if (contradicts) contextualError(DiagnosticCodes.SpecificationStreamContradictsCommand, 'The expected event route contradicts its only producer, the command under test.', (node.stream ?? node.noStream)!.location);\n }\n }\n}\n"],"mappings":"45BAyBA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,EAAO,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,SAAS,CAAE,WAAYC,EAAM,eAAe,QAAQ,GAAiBC,EAAc,OAAS,CAAC,CAAC,CAAC,EAChK,GAAIJ,EAAK,SAAW,EAAG,OAAO,eAAeE,EAAaG,CAAO,EACjE,IAAMC,EAAO,IAAIC,EAAc,IAAIC,EAAW,CAAC,CAAC,CAAC,EACjD,eAAeN,EAAaI,CAAI,EAChC,IAAMG,kBAAW,IAAI,IACfC,kBAAW,IAAI,IACrB,IAAK,IAAMC,KAAcL,EAAK,YAAa,CACvC,IAAMM,EAAM,KAAK,UAAU,CAACD,EAAW,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,OAAQA,EAAW,OAAO,CAAC,EAChJ,GAAID,EAAS,IAAIE,CAAG,EAAG,SACvBF,EAAS,IAAIE,CAAG,EAChB,IAAMC,EAAMF,EAAW,OAASG,EAAgB,gCAAkCd,EAAK,KAAK,GAAOa,EAAI,OAAO,KAAK,GAASE,EAAM,OAAO,SAAS,OAASJ,EAAW,SAAS,MAAQI,EAAM,OAAO,SAAS,SAAWJ,EAAW,SAAS,QAAUI,EAAM,OAAO,SAAS,OAASJ,EAAW,SAAS,IAAI,CAAC,EAAI,IAAA,GAClT,GAAIE,IAAQ,IAAA,GAAWR,EAAQ,MAAMM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AK,OAAO,WAAa,MAAQiE,EAAa,cAAc,OAAS,GAAKjE,EAAK,OAAO,cAAc,OAAS,EAC/I,IAAK,IAAMmE,KAAQb,EAAO,cAAe,CACrC,IAAMc,EAASH,EAAa,cAAc,OAAO,GAAWV,EAAQ,WAAaY,EAAK,IAAI,EACpFH,EAAWhE,EAAK,OAAO,cAAc,OAAO,GAAWuD,EAAQ,WAAaY,EAAK,IAAI,EAC3F,GAAIC,EAAO,SAAW,GAAKJ,EAAS,SAAW,EAAG,SAClD,IAAMK,EAAW,eAAeD,EAAO,EAAE,CAAC,OAAQD,EAAK,IAAI,EACrDG,EAAa,eAAeN,EAAS,EAAE,CAAC,OAAQG,EAAK,IAAI,EAC3DE,IAAa,MAAQC,IAAe,MAAQD,IAAaC,IAAY,EAAc,GAC3F,OAED,GAAIhB,GAAQ,UAAY,MAAQW,EAAa,cAAc,SAAW,GAAKjE,EAAK,OAAO,cAAc,SAAW,EAAG,CACtH,IAAMqE,EAAW,eAAeJ,EAAa,UAAU,OAAQX,EAAO,QAAQ,EACxEgB,EAAa,eAAetE,EAAK,OAAO,UAAU,OAAQsD,EAAO,QAAQ,EAC3Ee,IAAa,MAAQC,IAAe,MAAQD,IAAaC,IAAY,EAAc,GAC3F,CACJ,CACItE,EAAK,KAAK,OAAS,2BAA6BiD,EAAe,MAAM,GAAYC,EAAS,OAAS,OAClGF,IAAe,KAAkE,CAAC,WAAWhD,EAAK,IAAMkD,EAAS,IAAI,EAA/F,oBAAoBA,EAAS,KAAMF,CAAU,IAAM,GAA8C,IAAG,EAAc,IACzIkB,GAAa,gBAAgB5E,EAAgB,sCAAuC,mFAAoFU,EAAK,QAAUA,EAAK,SAAA,CAAW,QAAQ,CACvN,CACJ,CACJ"}
@@ -0,0 +1,3 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{parseExactNumber as t}from"../Syntax/ExactNumber.js";var InvalidStructuredValue=class extends Error{},StructuredValueParser=class{text;start;context;#e=0;constructor(e,t,n){this.text=e,this.start=t,this.context=n}parse(){let e=this.#t(0);if(this.#c(),this.#e<this.text.length)throw new InvalidStructuredValue(`'${this.text[this.#e]}' is invalid after a single JSON value.`);return e}#t(e){this.#c();let t=this.#s(),n=this.text[this.#e];if(n===`[`||n===`{`){if(e>=64)throw new InvalidStructuredValue(`The value nests deeper than 64 levels.`);return n===`[`?this.#n(e,t):this.#r(e,t)}if(n===`"`)return{kind:`LiteralExpressionSyntax`,value:this.#i(),location:t};for(let[e,n]of[[`true`,!0],[`false`,!1],[`null`,null]])if(this.text.startsWith(e,this.#e))return this.#e+=e.length,{kind:`LiteralExpressionSyntax`,value:n,location:t};return this.#o(t)}#n(e,t){this.#e++;let n=[];if(this.#c(),this.#l(`]`))return{kind:`ListExpressionSyntax`,items:n,location:t};for(;;){if(n.push(this.#t(e+1)),this.#c(),this.#l(`]`))return{kind:`ListExpressionSyntax`,items:n,location:t};this.#u(`,`)}}#r(t,n){this.#e++;let r=[],i=/* @__PURE__ */ new Set;if(this.#c(),this.#l(`}`))return{kind:`ObjectExpressionSyntax`,members:r,location:n};for(;;){this.#c();let a=this.#s();if(this.text[this.#e]!==`"`)throw new InvalidStructuredValue(`Expected a property name in double quotes.`);let o=this.#i();this.#c(),this.#u(`:`);let s=this.#t(t+1);if(i.has(o)?this.context?.error(e.DuplicateStructuredValueMember,`Duplicate property '${o}' in structured value`,a):(i.add(o),r.push({kind:`ObjectMemberSyntax`,name:o,value:s,location:a})),this.#c(),this.#l(`}`))return{kind:`ObjectExpressionSyntax`,members:r,location:n};this.#u(`,`)}}#i(){let e=this.#a(this.#e),t=this.text.substring(this.#e,e);this.#e=e;try{return JSON.parse(t)}catch{throw new InvalidStructuredValue(`${t} is not a valid JSON string.`)}}#a(e){for(let t=e+1;t<this.text.length;t++)if(this.text[t]===`\\`)t++;else if(this.text[t]===`"`)return t+1;throw new InvalidStructuredValue(`A string is not closed.`)}#o(n){let r=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(this.text.substring(this.#e));if(r===null)throw new InvalidStructuredValue(`'${this.text[this.#e]??``}' is an invalid start of a value.`);if(this.#e+=r[0].length,this.context?.sourceOptions.numericMode===`exact`){let i=t(r[0]);return i===void 0?(this.context.error(e.InexactNumericLiteral,`Numeric literal is not exactly representable in the bounded Decimal domain.`,n),{kind:`RawExpressionSyntax`,text:r[0],location:n}):{kind:`LiteralExpressionSyntax`,value:i,location:n}}let i=Number(r[0]);if(!Number.isFinite(i))throw new InvalidStructuredValue(`JSON number is outside the finite Double range.`);return{kind:`LiteralExpressionSyntax`,value:i,location:n}}#s(){return{...this.start,column:this.start.column+this.#e}}#c(){for(;this.#e<this.text.length&&`
2
+ \r`.includes(this.text[this.#e]);)this.#e++}#l(e){return this.text[this.#e]===e&&(this.#e++,!0)}#u(e){if(!this.#l(e))throw new InvalidStructuredValue(`Expected '${e}' at position ${this.#e}.`)}};export{InvalidStructuredValue,StructuredValueParser};
3
+ //# sourceMappingURL=StructuredValueParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructuredValueParser.js","names":["text","start","context","value","#value","#whitespace","#position","location","#at","current","depth","#list","#object","#string","word","#number","items","#take","#expect","members","names","keyLocation","name","DiagnosticCodes","end","#stringEnd","raw","index","from","match","number","parseExactNumber","character"],"sources":["../../../../../../Compiler/Parsing/StructuredValueParser.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 { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax } from '../Syntax/Expressions';\nimport { parseExactNumber } from '../Syntax/ExactNumber';\nimport { ParserContext } from './ParserContext';\n\n// How deeply a structured value may nest - the C# compiler's JsonDocument limit.\nconst maximumDepth = 64;\n\n// A structured value that is not valid JSON. The message says why; the caller reports it.\nexport class InvalidStructuredValue extends Error {}\n\n// Reads an inline '{...}' or '[...]' value - the port of the C# StructuredValueParser. It is strict JSON, as\n// System.Text.Json reads it, and it keeps the first of two members with the same name and reports the\n// second, which JSON.parse would silently keep instead.\nexport class StructuredValueParser {\n #position = 0;\n\n constructor(private readonly text: string, private readonly start: SourceLocation, private readonly context?: ParserContext) {}\n\n parse(): ExpressionSyntax {\n const value = this.#value(0);\n this.#whitespace();\n if (this.#position < this.text.length) {\n throw new InvalidStructuredValue(`'${this.text[this.#position]}' is invalid after a single JSON value.`);\n }\n return value;\n }\n\n #value(depth: number): ExpressionSyntax {\n this.#whitespace();\n const location = this.#at();\n const current = this.text[this.#position];\n if (current === '[' || current === '{') {\n if (depth >= maximumDepth) {\n throw new InvalidStructuredValue(`The value nests deeper than ${maximumDepth} levels.`);\n }\n return current === '[' ? this.#list(depth, location) : this.#object(depth, location);\n }\n if (current === '\"') {\n return { kind: 'LiteralExpressionSyntax', value: this.#string(), location };\n }\n for (const [word, value] of [['true', true], ['false', false], ['null', null]] as const) {\n if (this.text.startsWith(word, this.#position)) {\n this.#position += word.length;\n return { kind: 'LiteralExpressionSyntax', value, location };\n }\n }\n return this.#number(location);\n }\n\n #list(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const items: ExpressionSyntax[] = [];\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n for (;;) {\n items.push(this.#value(depth + 1));\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n this.#expect(',');\n }\n }\n\n #object(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n for (;;) {\n this.#whitespace();\n const keyLocation = this.#at();\n if (this.text[this.#position] !== '\"') {\n throw new InvalidStructuredValue('Expected a property name in double quotes.');\n }\n const name = this.#string();\n this.#whitespace();\n this.#expect(':');\n const value = this.#value(depth + 1);\n if (names.has(name)) {\n this.context?.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${name}' in structured value`, keyLocation);\n } else {\n names.add(name);\n members.push({ kind: 'ObjectMemberSyntax', name, value, location: keyLocation });\n }\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n this.#expect(',');\n }\n }\n\n #string(): string {\n const end = this.#stringEnd(this.#position);\n const raw = this.text.substring(this.#position, end);\n this.#position = end;\n try {\n return JSON.parse(raw) as string;\n } catch {\n throw new InvalidStructuredValue(`${raw} is not a valid JSON string.`);\n }\n }\n\n #stringEnd(from: number): number {\n for (let index = from + 1; index < this.text.length; index++) {\n if (this.text[index] === '\\\\') {\n index++;\n } else if (this.text[index] === '\"') {\n return index + 1;\n }\n }\n throw new InvalidStructuredValue('A string is not closed.');\n }\n\n #number(location: SourceLocation): ExpressionSyntax {\n const match = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(this.text.substring(this.#position));\n if (match === null) {\n throw new InvalidStructuredValue(`'${this.text[this.#position] ?? ''}' is an invalid start of a value.`);\n }\n this.#position += match[0].length;\n if (this.context?.sourceOptions.numericMode === 'exact') {\n const number = parseExactNumber(match[0]);\n if (number === undefined) {\n this.context.error(DiagnosticCodes.InexactNumericLiteral, 'Numeric literal is not exactly representable in the bounded Decimal domain.', location);\n return { kind: 'RawExpressionSyntax', text: match[0], location };\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n const number = Number(match[0]);\n if (!Number.isFinite(number)) {\n throw new InvalidStructuredValue('JSON number is outside the finite Double range.');\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n\n #at(): SourceLocation {\n return { ...this.start, column: this.start.column + this.#position };\n }\n\n #whitespace(): void {\n while (this.#position < this.text.length && ' \\t\\n\\r'.includes(this.text[this.#position])) {\n this.#position++;\n }\n }\n\n #take(character: string): boolean {\n if (this.text[this.#position] !== character) {\n return false;\n }\n this.#position++;\n return true;\n }\n\n #expect(character: string): void {\n if (!this.#take(character)) {\n throw new InvalidStructuredValue(`Expected '${character}' at position ${this.#position}.`);\n }\n }\n}\n"],"mappings":"qLAaA,IAAa,uBAAb,cAA4C,KAAM,CAAC,EAKtC,sBAAb,KAAmC,CAGF,KAA+B,MAAwC,QAFpG,GAAY,EAEZ,YAAY,EAA+B,EAAwC,EAA0C,CAAhG,KAAA,KAAAA,EAA+B,KAAA,MAAAC,EAAwC,KAAA,QAAAC,CAA0B,CAE9H,OAA0B,CACtB,IAAMC,EAAQ,KAAKC,GAAO,CAAC,EAE3B,GADA,KAAKC,GAAY,EACb,KAAKC,GAAY,KAAK,KAAK,OAC3B,MAAM,IAAI,uBAAuB,IAAI,KAAK,KAAK,KAAKA,IAAW,wCAAwC,EAE3G,OAAOH,CACX,CAEA,GAAO,EAAiC,CACpC,KAAKE,GAAY,EACjB,IAAME,EAAW,KAAKC,GAAI,EACpBC,EAAU,KAAK,KAAK,KAAKH,IAC/B,GAAIG,IAAY,KAAOA,IAAY,IAAK,CACpC,GAAIC,GAAS,GACT,MAAM,IAAI,uBAAuB,wCAAqD,EAE1F,OAAOD,IAAY,IAAM,KAAKE,GAAMD,EAAOH,CAAQ,EAAI,KAAKK,GAAQF,EAAOH,CAAQ,CACvF,CACA,GAAIE,IAAY,IACZ,MAAO,CAAE,KAAM,0BAA2B,MAAO,KAAKI,GAAQ,EAAG,UAAS,EAE9E,IAAK,GAAM,CAACC,EAAMX,IAAU,CAAC,CAAC,OAAQ,EAAI,EAAG,CAAC,QAAS,EAAK,EAAG,CAAC,OAAQ,IAAI,CAAC,EACzE,GAAI,KAAK,KAAK,WAAWW,EAAM,KAAKR,EAAS,EAEzC,MADA,MAAKA,IAAaQ,EAAK,OAChB,CAAE,KAAM,0BAA2B,QAAO,UAAS,EAGlE,OAAO,KAAKC,GAAQR,CAAQ,CAChC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,GAAU,GACpF,KAAKA,IAEb,CAEA,GAAM,EAA4B,CAK9B,OAJI,KAAK,KAAK,KAAKA,MAAe0B,IAGlC,KAAK1B,KACE,GACX,CAEA,GAAQ,EAAyB,CAC7B,GAAI,CAAC,KAAKW,GAAMe,CAAS,EACrB,MAAM,IAAI,uBAAuB,aAAaA,EAAU,gBAAgB,KAAK1B,GAAU,EAAE,CAEjG,CACJ"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{firstWord as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";import{parseProperty as i}from"./PropertyLineParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{isFileDirective as o}from"./FileReferences.js";const s=t(`^@?[a-z_]\\w*\\s+[\\w.]+`);function parseTriggerData(t,n){let a=i(t,n);a===void 0?(s.test(n.content)&&/\?|\boptional\b/.test(n.content)&&t.error(e.InvalidTriggerData,`Invalid trigger value '${n.content}' - expected '<name>' or '<name> <Type>'`,r(n)),t.skipOpaqueBlock(n.indent)):(a.isGenerated&&t.error(e.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,a.location),a.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).`,a.location),t.triggerData.push(a))}function parseTriggerDeclaration(e,t){let r=e.triggerData.length;for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),n(r.content)===`description`?a(e,r,null,`Trigger '${t.content}'`):o(r)||parseTriggerData(e,r);return e.triggerData.slice(r)}export{parseTriggerData,parseTriggerDeclaration};
2
+ //# sourceMappingURL=TriggerDataParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerDataParser.js","names":["typedValue","pattern","property","parseProperty","context","line","DiagnosticCodes","locationOf","start","header","firstWord","parseDescription","isFileDirective"],"sources":["../../../../../../Compiler/Parsing/TriggerDataParser.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 { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typedValue = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+');\n\n// Trigger values are kept as parser-owned diagnostic metadata, outside the syntax wire projection. Recognize their type spelling in\n// exactly the C# data positions, without scanning descriptions, attachments, code or mapping expressions.\nexport function parseTriggerData(context: ParserContext, line: SourceLine): void {\n const property = parseProperty(context, line);\n if (property !== undefined) {\n if (property.isGenerated) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).', property.location);\n context.triggerData.push(property);\n return;\n }\n // Keep the existing opaque projection for other trigger values and implementation bodies.\n // Only optionality-shaped failures belong to this spelling change.\n if (typedValue.test(line.content) && /\\?|\\boptional\\b/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidTriggerData, `Invalid trigger value '${line.content}' - expected '<name>' or '<name> <Type>'`, locationOf(line));\n }\n context.skipOpaqueBlock(line.indent);\n}\n\nexport function parseTriggerDeclaration(context: ParserContext, header: SourceLine): readonly PropertySyntax[] {\n const start = context.triggerData.length;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n parseDescription(context, line, null, `Trigger '${header.content}'`);\n } else if (!isFileDirective(line)) {\n parseTriggerData(context, line);\n }\n }\n return context.triggerData.slice(start);\n}\n"],"mappings":"saAaA,MAAMA,EAAaC,EAAQ,0BAA0B,EAIrD,SAAgB,iBAAiB,EAAwB,EAAwB,CAC7E,IAAMC,EAAWC,EAAcC,EAASC,CAAI,EACxCH,IAAa,IAAA,IAQbF,EAAW,KAAKK,EAAK,OAAO,GAAK,kBAAkB,KAAKA,EAAK,OAAO,GACpED,EAAQ,MAAME,EAAgB,mBAAoB,0BAA0BD,EAAK,QAAQ,0CAA2CE,EAAWF,CAAI,CAAC,EAExJD,EAAQ,gBAAgBC,EAAK,MAAM,IAV3BH,EAAS,aAAaE,EAAQ,MAAME,EAAgB,gCAAiC,yDAA0DJ,EAAS,QAAQ,EAChKA,EAAS,WAAWE,EAAQ,MAAME,EAAgB,oBAAqB,+IAAgJJ,EAAS,QAAQ,EAC5OE,EAAQ,YAAY,KAAKF,CAAQ,EASzC,CAEA,SAAgB,wBAAwB,EAAwB,EAA+C,CAC3G,IAAMM,EAAQJ,EAAQ,YAAY,OAClC,IAAK,IAAIC,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EAAGJ,IAAS,IAAA,GAAW,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EACxGL,EAAQ,OAAO,gBAAgB,EAC3BM,EAAUL,EAAK,OAAO,IAAM,cAC5BM,EAAiBP,EAASC,EAAM,KAAM,YAAYI,EAAO,QAAQ,EAAE,EAC3DG,EAAgBP,CAAI,GAC5B,iBAAiBD,EAASC,CAAI,EAGtC,OAAOD,EAAQ,YAAY,MAAMI,CAAK,CAC1C"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{parseMappingSource as n}from"./ExpressionParser.js";const r=t(`^(data|query|component)\\s+(\\S+)(.*)$`),i=t(`^literal\\s+(.+?)(?:\\s+(mode\\s+.+|null\\s+.+|expected\\s+.+))?$`),a=t(`^([A-Za-z_]\\w*)(?:\\.(.+))?$`),o=t(`^(?:([A-Za-z_]\\w*)|"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)")\\.(.+)$`),s=t(`^mode\\s+(oneWay|twoWay)\\b(.*)$`),c=t(`^null\\s+(propagate|clear|preserve)\\b(.*)$`),l=t(`^expected\\s+(\\w+(?:\\.\\w+)*)(.*)$`);function parseFromClause(e,t,n){let r=t.trim(),i=r.split(/\s+/,1)[0];return i===`data`||i===`query`||i===`component`||i===`literal`?parseUiBinding(e,`from ${r}`,n):parseUiBinding(e,r,n)}function parseUiBinding(t,a,o){let s=a.trim();if(!s.startsWith(`from `))return withModifiers(t,create(`DataContext`,s,o),``,o);let c=s.substring(5).trim();if(c.startsWith(`literal `)){let r=i.exec(c);return r===null?(t.error(e.UnknownScreenDirective,`Invalid UI binding '${s}' - expected 'from literal <value>'`,o),{...create(`Invalid`,c,o),rawText:s}):withModifiers(t,{...create(`Literal`,``,o),literal:n(r[1],o,t)},r[2]??``,o)}let l=r.exec(c);return l===null?(t.error(e.UnknownScreenDirective,`Invalid UI binding '${s}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`,o),{...create(`Invalid`,c,o),rawText:s}):withModifiers(t,parseBindingSource(t,l[1],l[2],s,o),l[3],o)}function parseBindingSource(e,t,n,r,i){return t===`data`?create(`DataContext`,n,i):t===`query`?queryBinding(e,n,r,i):componentBinding(e,n,r,i)}function queryBinding(t,n,r,i){let o=a.exec(n);return o===null?(t.error(e.UnknownScreenDirective,`Invalid query binding '${r}' - expected 'from query <Query>[.<path>]'.`,i),{...create(`Invalid`,n,i),rawText:r}):{...create(`QueryResult`,o[2]??``,i),query:o[1]}}function componentBinding(t,n,r,i){let a=o.exec(n);if(a===null)return t.error(e.UnknownScreenDirective,`Invalid component binding '${r}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component "<stableInstanceId>".<outputPath>'.`,i),{...create(`Invalid`,n,i),rawText:r};let s=a[1]??a[2],c=a[3];return{...create(`ComponentProperty`,c,i),componentId:s,componentPropertyPath:c}}function withModifiers(t,n,r,i){let a=n,o=r.trim();for(;o.length>0;){let n=s.exec(o);if(n!==null){a={...a,mode:n[1]===`twoWay`?`TwoWay`:`OneWay`},o=n[2].trim();continue}let r=c.exec(o);if(r!==null){a={...a,nullBehavior:r[1]===`clear`?`Clear`:r[1]===`preserve`?`Preserve`:`Propagate`},o=r[2].trim();continue}let u=l.exec(o);if(u!==null)a={...a,expectedValueType:u[1]},o=u[2].trim();else return t.error(e.UnknownScreenDirective,`Unsupported UI binding modifier '${o}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`,i),{...a,rawText:a.rawText??o}}return a}function create(e,t,n){return{kind:`UiBindingSyntax`,bindingKind:e,path:t,query:null,componentId:null,componentPropertyPath:null,mode:null,nullBehavior:null,expectedValueType:null,literal:null,rawText:null,location:n}}export{parseFromClause,parseUiBinding};
2
+ //# sourceMappingURL=UiBindingParser.js.map