@cratis/screenplay-language 4.124.0 → 4.125.0

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 (396) 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/package.json +4 -3
  393. package/dist/bundles/chunk-7GSRLVHB.js +0 -42
  394. package/dist/bundles/chunk-7GSRLVHB.js.map +0 -7
  395. package/dist/bundles/chunk-AYDF3IFZ.js +0 -2
  396. package/dist/bundles/chunk-AYDF3IFZ.js.map +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponseValidator.js","names":["primitiveTypes","context","effectiveCommand","specificationCommandExamples","application","slices","scope","parent","feature","slice","child","module","commands","properties","responseFields","command","entries","imports","imported","name","resolved","key","from","segments","candidates","qualifiers","entry","index","value","depth","visible","concepts","conceptNames","concept","composites","type","readModels","model","commandProperties","property","declared","DiagnosticCodes","production","event","reaction","trigger","source","explicit","response","names","field","action","specification","input","identifiers","fixture","expectation","fields","asserted","contract","inputs","result","duplicates","item","items","member","primitive","exactIsIntegral","responseDateValue","uuidValuePattern","text"],"sources":["../../../../../../Compiler/Parsing/ResponseValidator.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 { exactIsIntegral } from '../Syntax/ExactMathFacts';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConceptSyntax, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { PropertyResponseSourceSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { InputUse } from './InputUses';\nimport { ParserContext } from './ParserContext';\nimport { responseDateValue } from './ResponseDateValues';\nimport { specificationCommandExamples } from './SpecificationCommandExamples';\n\nconst primitiveTypes = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\ninterface ScopedCommand { command: CommandSyntax; scope: readonly string[] }\n\nexport function validateResponses(application: ApplicationSyntax, context: ParserContext, inputs: readonly InputUse[] = context.inputUses): void {\n const effectiveCommand = specificationCommandExamples(application);\n const slices: { slice: SliceSyntax; scope: readonly string[] }[] = [];\n const collect = (feature: FeatureSyntax, parent: readonly string[]): void => {\n const scope = [...parent, feature.name];\n feature.slices.forEach(slice => slices.push({ slice, scope: [...scope, slice.name] }));\n feature.features.forEach(child => collect(child, scope));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, [module.name])));\n const commands = new Map<string, ScopedCommand[]>();\n const properties = new Map<CommandSyntax, Map<string, PropertySyntax>>();\n const responseFields = new Map<CommandSyntax, Map<string, ResponseFieldSyntax>>();\n for (const { slice, scope } of slices) {\n for (const command of slice.commands) {\n const entries = commands.get(command.name) ?? [];\n entries.push({ command, scope });\n commands.set(command.name, entries);\n properties.set(command, uniqueByName(command.properties));\n if (command.response?.kind === 'RecordCommandResponseSyntax') responseFields.set(command, uniqueByName(command.response.fields));\n }\n }\n const imports = new Map<string, string[]>();\n for (const imported of application.imports) {\n const name = imported.qualifiedName.split('.').at(-1)!;\n imports.set(name, [...(imports.get(name) ?? []), imported.qualifiedName]);\n }\n const resolved = new Map<string, CommandSyntax | null>();\n const resolve = (name: string, from: readonly string[]): CommandSyntax | null => {\n const key = `${from.join('.')}|${name}`;\n if (resolved.has(key)) return resolved.get(key)!;\n const imported = imports.get(name) ?? [];\n const local = commands.get(name.split('.').at(-1)!) ?? [];\n const reference = local.length === 0 && imported.length === 1 ? imported[0] : name;\n const segments = reference.split('.');\n let candidates = commands.get(segments.at(-1)!) ?? [];\n if (segments.length > 1) {\n const qualifiers = segments.slice(0, -1);\n candidates = candidates.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n } else {\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = candidates.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) { candidates = visible; break; }\n }\n }\n const command = candidates.length === 1 ? candidates[0].command : null;\n resolved.set(key, command);\n return command;\n };\n const concepts = uniqueByName(application.concepts);\n const conceptNames = new Set(application.concepts.map(concept => concept.name));\n const composites = new Map([...uniqueByName(application.types)].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const readModels = new Set(slices.flatMap(entry => entry.slice.readModels.map(model => model.name)));\n const commandProperties = new Set([...properties.keys()].flatMap(command => [...command.properties]));\n const checkDeclarations = (declared: readonly PropertySyntax[]): void => {\n for (const property of declared) {\n if (property.isGenerated && !commandProperties.has(property)) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n }\n };\n // Only these typed declarations carry PropertySyntax. Do not pull the complete extensible walker\n // into every browser parser just to inspect their generated flags.\n const checkFeature = (feature: FeatureSyntax): void => {\n feature.features.forEach(checkFeature);\n for (const slice of feature.slices) {\n for (const command of slice.commands) {\n for (const production of command.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n slice.events.forEach(event => checkDeclarations(event.properties));\n slice.readModels.forEach(model => checkDeclarations(model.properties));\n for (const reaction of slice.reactions) {\n for (const trigger of reaction.triggers) {\n for (const production of trigger.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n }\n }\n };\n application.types.forEach(type => checkDeclarations(type.properties));\n application.modules.forEach(module => module.features.forEach(checkFeature));\n const validateSource = (source: PropertyResponseSourceSyntax, explicit: TypeRefSyntax | null, command: CommandSyntax): void => {\n const property = properties.get(command)!.get(source.property);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidResponseSource, `Response source '${source.property}' must reference one direct command property.`, source.location);\n return;\n }\n const type = property.type;\n if (type.isCollection || readModels.has(type.name)) context.error(DiagnosticCodes.InvalidResponseShape, 'Collection and whole-read-model responses are not supported.', source.location);\n if (explicit !== null && (explicit.name !== type.name || explicit.isCollection !== type.isCollection || explicit.isOptional !== type.isOptional)) context.error(DiagnosticCodes.InvalidResponseShape, \"An explicit response field type must match its source's declared type, collection shape and optionality.\", explicit.location);\n };\n for (const command of properties.keys()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const concept = concepts.get(property.type.name);\n if (property.type.isOptional || property.type.isCollection || (concept === undefined ? primitiveTypes.has(property.type.name) || composites.has(property.type.name) || conceptNames.has(property.type.name) || readModels.has(property.type.name) : concept.type !== 'Uuid')) context.error(DiagnosticCodes.InvalidGeneratedType, 'A generated property must be a required, noncollection concept backed by Uuid.', property.location);\n }\n const response = command.response;\n if (response?.kind === 'ScalarCommandResponseSyntax') validateSource(response.source, null, command);\n else if (response?.kind === 'RecordCommandResponseSyntax') {\n if (response.fields.length === 0) context.error(DiagnosticCodes.InvalidCommandResponse, 'A response block requires at least one field.', response.location);\n const names = new Set<string>();\n for (const field of response.fields) {\n if (names.has(field.name)) context.error(DiagnosticCodes.DuplicateResponseField, `Duplicate response field '${field.name}'.`, field.location);\n names.add(field.name);\n validateSource(field.source, field.type, command);\n }\n }\n }\n const validateSpecification = (specification: SpecificationSyntax, scope: readonly string[]): void => {\n const action = effectiveCommand(specification.when, scope);\n const command = action === null ? null : resolve(action.commandType, scope);\n if (action !== null && command !== null) {\n const declared = properties.get(command)!;\n for (const input of action.values) {\n if (declared.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n const identifiers = [...declared.values()].filter(property => property.isIdentifier);\n if (action.for !== null && identifiers.length === 1 && identifiers[0].isGenerated) {\n const type = identifiers[0].type;\n const known = primitiveTypes.has(type.name) || concepts.has(type.name) || composites.has(type.name);\n if (known && (type.isOptional || type.isCollection || concepts.get(type.name)?.type !== 'Uuid' || action.for.kind !== 'LiteralExpressionSyntax' || typeof action.for.value !== 'string' || !uuidValue(action.for.value))) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"A generated identifier fixture must supply one compatible concrete UUID value through 'for'.\", action.for.location);\n }\n }\n const names = new Set<string>();\n for (const fixture of action.generatedValues ?? []) {\n const property = declared.get(fixture.property);\n if (names.has(fixture.property) || property === undefined || !property.isGenerated || property.isIdentifier || !compatibleValue(fixture.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A generated fixture must uniquely supply a compatible value for a nonidentifier generated command property.', fixture.location);\n names.add(fixture.property);\n }\n }\n const expectation = specification.thenReturns;\n if (expectation == null) return;\n if (action === null || specification.thenErrors.length > 0 || specification.thenDenied != null) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return expectation requires a command action and cannot accompany an error or denial.', expectation.location);\n if (command === null) return;\n const response = command.response;\n const declared = properties.get(command)!;\n if (expectation.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax' && declared.has(response.source.property)) {\n if (!compatibleValue(expectation.value, declared.get(response.source.property)!.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, \"The expected return value must match the response source's type.\", expectation.location);\n } else if (expectation.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n if (expectation.fields.length === 0) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A record return expectation requires at least one field.', expectation.location);\n const fields = responseFields.get(command)!;\n const asserted = new Set<string>();\n for (const field of expectation.fields) {\n const contract = fields.get(field.property);\n const property = contract === undefined ? undefined : declared.get(contract.source.property);\n if (asserted.has(field.property) || property === undefined || !compatibleValue(field.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return assertion must uniquely name a response field and supply a compatible concrete value.', field.location);\n asserted.add(field.property);\n }\n } else {\n context.error(DiagnosticCodes.InvalidReturnExpectation, \"The return expectation must match the command's scalar or record response shape.\", expectation.location);\n }\n };\n for (const { slice, scope } of slices) slice.specifications.forEach(specification => validateSpecification(specification, scope));\n for (const input of inputs) {\n if (input.isParameter === true) continue;\n const command = resolve(input.command, input.scope);\n if (command !== null && properties.get(command)!.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n}\n\nexport function uniqueByName<T extends { readonly name: string }>(items: readonly T[]): Map<string, T> {\n const result = new Map<string, T>();\n const duplicates = new Set<string>();\n for (const item of items) {\n if (result.has(item.name)) duplicates.add(item.name);\n result.set(item.name, item);\n }\n duplicates.forEach(name => result.delete(name));\n return result;\n}\n\nexport function compatibleValue(value: ExpressionSyntax, type: TypeRefSyntax, concepts: ReadonlyMap<string, ConceptSyntax>, composites: ReadonlyMap<string, ReadonlyMap<string, PropertySyntax>>): boolean {\n if (value.kind === 'LiteralExpressionSyntax' && value.value === null) return type.isOptional;\n if (type.isCollection) return value.kind === 'ListExpressionSyntax' && value.items.every(item => compatibleValue(item, { ...type, isCollection: false, isOptional: false }, concepts, composites));\n const properties = composites.get(type.name);\n if (properties !== undefined) return value.kind === 'ObjectExpressionSyntax' && value.members.every(member => {\n const property = properties.get(member.name);\n return property !== undefined && compatibleValue(member.value, property.type, concepts, composites);\n });\n const concept = concepts.get(type.name);\n const primitive = concept?.type ?? type.name;\n if (concept?.type === 'Enum') return value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' && concept.values.includes(value.value);\n if (value.kind === 'LiteralExpressionSyntax') {\n switch (primitive) {\n case 'Uuid': return typeof value.value === 'string' && uuidValue(value.value);\n case 'String': return typeof value.value === 'string';\n case 'Bool': return typeof value.value === 'boolean';\n case 'Int': return typeof value.value === 'number' ? Number.isFinite(value.value) && Number.isInteger(value.value) : typeof value.value === 'object' && value.value !== null && exactIsIntegral(value.value);\n case 'Decimal': return typeof value.value === 'number' ? Number.isFinite(value.value) : typeof value.value === 'object' && value.value !== null && value.value.literalType === 'ExactNumber';\n case 'Date': return typeof value.value === 'string' && responseDateValue(value.value, false);\n case 'DateTime': return typeof value.value === 'string' && responseDateValue(value.value, true);\n default: return !primitiveTypes.has(primitive);\n }\n }\n return !primitiveTypes.has(primitive) && concept === undefined;\n}\n\n// Shared with ResponseValueTypes.cs: 32 hex digits (N), hyphenated UUIDs (D), or D wrapped in\n// braces (B) / parentheses (P). Hex is case-insensitive; whitespace and X initializer notation\n// are not admitted in response/fixture values. The lookahead requires the true end, even after a newline.\nconst uuidValuePattern = /^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\}|\\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\))(?![\\s\\S])/i;\n\nfunction uuidValue(text: string): boolean {\n return uuidValuePattern.test(text);\n}\n"],"mappings":"oUAgBA,MAAMA,kBAAiB,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG/F,SAAgB,kBAAkB,EAAgC,EAAwB,EAA8BC,EAAQ,UAAiB,CAC7I,IAAMC,EAAmBC,EAA6BC,CAAW,EAC3DC,EAA6D,CAAC,EAC9D,SAAW,EAAwB,IAAoC,CACzE,IAAMC,EAAQ,CAAC,GAAGC,EAAQC,EAAQ,IAAI,EACtCA,EAAQ,OAAO,QAAQ,GAASH,EAAO,KAAK,CAAE,QAAO,MAAO,CAAC,GAAGC,EAAOG,EAAM,IAAI,CAAE,CAAC,CAAC,EACrFD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,EAChC+B,EAAYjC,GAAS,MAAQE,EAAK,KACxC,GAAIF,GAAS,OAAS,OAAQ,OAAOL,EAAM,OAAS,2BAA6B,OAAOA,EAAM,OAAU,UAAYK,EAAQ,OAAO,SAASL,EAAM,KAAK,EACvJ,GAAIA,EAAM,OAAS,0BACf,OAAQsC,EAAR,CACI,IAAK,OAAQ,OAAO,OAAOtC,EAAM,OAAU,UAAY,UAAUA,EAAM,KAAK,EAC5E,IAAK,SAAU,OAAO,OAAOA,EAAM,OAAU,SAC7C,IAAK,OAAQ,OAAO,OAAOA,EAAM,OAAU,UAC3C,IAAK,MAAO,OAAO,OAAOA,EAAM,OAAU,SAAW,OAAO,SAASA,EAAM,KAAK,GAAK,OAAO,UAAUA,EAAM,KAAK,EAAI,OAAOA,EAAM,OAAU,UAAYA,EAAM,QAAU,MAAQuC,EAAgBvC,EAAM,KAAK,EAC3M,IAAK,UAAW,OAAO,OAAOA,EAAM,OAAU,SAAW,OAAO,SAASA,EAAM,KAAK,EAAI,OAAOA,EAAM,OAAU,UAAYA,EAAM,QAAU,MAAQA,EAAM,MAAM,cAAgB,cAC/K,IAAK,OAAQ,OAAO,OAAOA,EAAM,OAAU,UAAYwC,EAAkBxC,EAAM,MAAO,EAAK,EAC3F,IAAK,WAAY,OAAO,OAAOA,EAAM,OAAU,UAAYwC,EAAkBxC,EAAM,MAAO,EAAI,EAC9F,QAAS,MAAO,CAAC5B,EAAe,IAAIkE,CAAS,CACjD,CAEJ,MAAO,CAAClE,EAAe,IAAIkE,CAAS,GAAKjC,IAAY,IAAA,EACzD,CAKA,MAAMoC,EAAmB,2KAEzB,SAAS,UAAU,EAAuB,CACtC,OAAOA,EAAiB,KAAKC,CAAI,CACrC"}
@@ -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,unescapeString as r}from"../Text/StringLiteral.js";import{parseMappingSource as i}from"./ExpressionParser.js";import{firstWord as a}from"./LineText.js";import{locationOf as o}from"./SourceLine.js";import{parseTypeRef as s}from"./PropertyLineParser.js";import{parseFencedText as c}from"./CodeBlockParser.js";import{parseDescription as l}from"./DescriptionParser.js";import{parseGuardedAction as u}from"./GuardedActionParser.js";import{collectInputUses as d}from"./InputUses.js";import{isFileDirective as f}from"./FileReferences.js";import{parseFromClause as p}from"./UiBindingParser.js";const m=`(?:"(${n})"|(\\$strings\\.\\w+(?:\\.\\w+)*))`,h=t(`^screen\\s+([A-Za-z_]\\w*)$`),g=t(`^data\\s+([\\w.]+(?:\\[\\])?)\\s+via\\s+query\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),_=t(`^action\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),v=t(`^label\\s+${m}$`),y=t(`^action\\s+${m}$`),b=t(`^navigate\\s+to\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),x=t(`^route\\s+${m}$`),S=t(`^outlet\\s+([A-Za-z_]\\w*)$`),C=t(`^contribute\\s+to\\s+([A-Za-z_]\\w*)(?:\\s+order\\s+(-?\\d+))?$`),w=t(`^parameter\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),T=t(`^component\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)\\s+([A-Za-z_]\\w*)$`),E=t(`^id\\s+(?:"(${n})"|(\\S+))$`),D=t(`^property\\s+([\\w.]+)\\s+from\\s+(.+)$`),O=t(`^property\\s+([\\w.]+)\\s*=\\s+(.+)$`),k=t(`^exposes\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),A=t(`^presentation\\s+([A-Za-z_]\\w*)\\s+${m}$`),j=t(`^item\\s+([A-Za-z_]\\w*)\\s+(action|navigate|dialog)(?:\\s+to)?\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),M=t(`^[a-z_]\\w*$`),N=t(`^title\\s+${m}$`),P=t(`^column\\s+([\\w.]+)(?:\\s+label\\s+${m})?$`),F=t(`^on\\s+row-click\\s+(navigate\\s+to\\s+.+)$`),I=t(`^field\\s+([\\w.]+)\\s+label\\s+${m}$`),operandText=(e,t)=>e[t]===void 0?e[t+1]:r(e[t]),isInteraction=e=>[`on`,`uses`].includes(a(e.content)),isCodeLine=(e,t)=>t.content.startsWith("```")||e.languages.has(t.content);function parseScreen(t,n){let r=h.exec(n.content);r===null&&t.error(e.InvalidScreenDeclaration,`Invalid screen declaration '${n.content}' - expected 'screen <Name>'`,o(n));let i=[],s=[],c=null;for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),a(e.content)===`contribute`){let n=parseScreenContribution(t,e);n!==void 0&&s.push(n)}else a(e.content)===`description`?c=l(t,e,c,`Screen '${r?.[1]??``}'`):f(e)||pushDirective(t,e,i);return{kind:`ScreenSyntax`,name:r?.[1]??``,directives:i,description:c,...s.length>0?{contributions:s}:{},location:o(n)}}function parseScreenContribution(t,n){let r=C.exec(n.content);if(r===null)t.error(e.UnknownScreenDirective,`Invalid screen contribution '${n.content}' - expected 'contribute to <Point> [order <n>]'`,o(n)),t.skipBlock(n.indent);else return{kind:`ScreenContributionSyntax`,contributionPoint:r[1],order:r[2]===void 0?null:Number(r[2]),directives:parseDirectives(t,n),location:o(n)}}function pushDirective(e,t,n){let r=parseDirective(e,t);r!==void 0&&n.push(r)}function parseDirectives(e,t){let n=[];for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),pushDirective(e,r,n);return n}function parseDirective(t,n){switch(a(n.content)){case`data`:return parseData(t,n);case`action`:return parseAction(t,n);case`template`:return parseTemplateReference(t,n);case`section`:return parseSection(t,n);case`title`:return parseTitle(t,n);case`table`:return parseTable(t,n);case`summary`:return parseSummary(t,n);case`component`:return parseComponent(t,n);case`toolbar`:return parseToolbar(t,n);case`navigate`:return parseNavigate(t,n.content,n);case`on`:return d(t,n),{kind:`ScreenBehaviorSyntax`,location:o(n)};case`uses`:return t.skipOpaqueBlock(n.indent),{kind:`ScreenUsesBehaviorSyntax`,location:o(n)};default:if(isCodeLine(t,n))return parseCode(t,n);t.error(e.UnknownScreenDirective,`Unexpected '${n.content}' in screen body`,o(n)),t.skipBlock(n.indent);return}}function parseData(t,n){let r=g.exec(n.content);if(r===null)t.error(e.InvalidDataDirective,`Invalid data directive '${n.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`,o(n));else return{kind:`ScreenDataSyntax`,type:s(r[1],o(n)),query:r[2],by:r[3]??null,location:o(n)}}function parseAction(t,n){let r=y.exec(n.content);if(r!==null)return u(t,n,operandText(r,1),parseNavigate);let i=_.exec(n.content);if(i===null){t.error(e.InvalidActionDirective,`Invalid action directive '${n.content}' - expected 'action <Command>'`,o(n)),t.skipBlock(n.indent);return}let s=null,c=null;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=v.exec(r.content);n===null?a(r.content)===`navigate`?c=parseNavigate(t,r.content,r)??null:t.error(e.UnknownActionDirective,`Unexpected '${r.content}' in action - expected 'label "..."' or 'navigate to ...'`,o(r)):s=operandText(n,1)}return{kind:`ScreenActionSyntax`,command:i[1],label:s,navigate:c,location:o(n)}}function parseNavigate(t,n,r){let i=b.exec(n);if(i===null){t.error(e.InvalidNavigation,`Invalid navigation '${n}' - expected 'navigate to <Screen> [by <param>]'`,o(r));return}let a=[],s=null,c=null;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){t.reader.takeSignificant();let r=w.exec(n.content);if(r!==null){a.push({kind:`ScreenNavigationParameterSyntax`,name:r[1],binding:p(t,r[2],o(n)),location:o(n)});continue}let i=x.exec(n.content);if(i!==null){s=operandText(i,1);continue}let l=S.exec(n.content);l===null?t.error(e.InvalidNavigation,`Unexpected '${n.content}' in navigation - expected 'route "..."', 'outlet <name>' or 'parameter <name> from <binding>'`,o(n)):c=l[1]}return{kind:`ScreenNavigateSyntax`,screen:i[1],by:i[2]??null,route:s,...c===null?{}:{outlet:c},parameters:a,location:o(r)}}function parseTemplateReference(t,n){let r=n.content.substring(8).trim(),i=[];for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent))t.reader.takeSignificant(),M.test(a.content)?i.push({kind:`ScreenSlotSyntax`,name:a.content,directives:parseDirectives(t,a),location:o(a)}):(t.error(e.InvalidScreenLayoutSlot,`Expected a slot name in template '${r}', got '${a.content}'`,o(a)),t.skipBlock(a.indent));return{kind:`ScreenTemplateReferenceSyntax`,name:r,slots:i,location:o(n)}}function parseSection(e,t){return{kind:`ScreenSectionSyntax`,name:t.content.substring(7).trim(),directives:parseDirectives(e,t),location:o(t)}}function parseTitle(t,n){let r=N.exec(n.content);return r===null?(t.error(e.InvalidTitleDirective,`Invalid title directive '${n.content}' - expected 'title "..."'`,o(n)),{kind:`ScreenTitleSyntax`,text:``,location:o(n)}):{kind:`ScreenTitleSyntax`,text:operandText(r,1),location:o(n)}}function parseTable(t,n){let r=n.content.substring(5).trim(),i=[],s=null;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=P.exec(r.content),c=F.exec(r.content);if(n!==null){let e=n[2]!==void 0||n[3]!==void 0;i.push({kind:`ScreenColumnSyntax`,property:n[1],label:e?operandText(n,2):null,location:o(r)})}else c===null?a(r.content)===`on`?d(t,r):isInteraction(r)?t.skipOpaqueBlock(r.indent):t.error(e.UnknownTableDirective,`Unexpected '${r.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`,o(r)):s=parseNavigate(t,c[1],r)??null}return{kind:`ScreenTableSyntax`,target:r,columns:i,rowClick:s,location:o(n)}}function parseSummary(t,n){let r=n.content.substring(7).trim(),i=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=I.exec(r.content);n===null?t.error(e.UnknownSummaryDirective,`Unexpected '${r.content}' in summary - expected 'field <property> label "..."'`,o(r)):i.push({kind:`ScreenFieldSyntax`,property:n[1],label:operandText(n,2),location:o(r)})}return{kind:`ScreenSummarySyntax`,target:r,fields:i,location:o(n)}}function parseComponent(t,n){let r=T.exec(n.content);if(r===null){t.error(e.UnknownScreenDirective,`Invalid component directive '${n.content}' - expected 'component <Package.Component> <name>'`,o(n)),t.skipBlock(n.indent);return}let i=null,s=null,c=null,l=[],u=[],f=[],p=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))switch(t.reader.takeSignificant(),a(r.content)){case`context`:i=parseUiContext(t,r);break;case`id`:s=parseStableId(t,r);break;case`property`:parseComponentProperty(t,r,l);break;case`icon`:c=r.content.substring(4).trim();break;case`presentation`:parsePresentationValue(t,r,f);break;case`exposes`:parseExposedValue(t,r,u);break;case`outlet`:p.push({kind:`ComponentOutletSyntax`,name:r.content.substring(6).trim(),directives:parseDirectives(t,r),location:o(r)});break;case`on`:d(t,r);break;case`uses`:t.skipOpaqueBlock(r.indent);break;default:t.error(e.UnknownScreenDirective,`Unexpected '${r.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`,o(r)),t.skipBlock(r.indent)}return{kind:`ScreenComponentSyntax`,component:r[1],name:r[2],stableId:s,context:i,properties:l,exposes:u,presentation:f,icon:c,outlets:p,location:o(n)}}function parseUiContext(e,t){return parseUiBindingValue(e,t.content.substring(7).trim(),t)}function parseComponentProperty(t,n,r){let a=D.exec(n.content);if(a!==null){r.push({kind:`ComponentPropertySyntax`,property:a[1],binding:p(t,a[2],o(n)),value:null,location:o(n)});return}let s=O.exec(n.content);s===null?t.error(e.UnknownScreenDirective,`Invalid component property '${n.content}' - expected 'property <path> from <binding>' or 'property <path> = <literal|object|array|null>'`,o(n)):r.push({kind:`ComponentPropertySyntax`,property:s[1],binding:null,value:i(s[2],o(n),t),location:o(n)})}function parseStableId(t,n){let r=E.exec(n.content);return r===null?(t.error(e.UnknownScreenDirective,`Invalid component id '${n.content}' - expected 'id "stable-id"'`,o(n)),null):operandText(r,1)}function parseExposedValue(t,n,r){let i=k.exec(n.content);i===null?t.error(e.UnknownScreenDirective,`Invalid exposed value '${n.content}' - expected 'exposes <name> from <binding>'`,o(n)):r.push({kind:`ComponentExposedValueSyntax`,name:i[1],binding:p(t,i[2],o(n)),location:o(n)})}function parsePresentationValue(t,n,r){let i=A.exec(n.content);i===null?t.error(e.UnknownScreenDirective,`Invalid presentation value '${n.content}' - expected 'presentation <key> "value"'`,o(n)):r.push({kind:`PresentationValueSyntax`,name:i[1],value:operandText(i,2),location:o(n)})}function parseToolbar(e,t){let n=t.content.substring(7).trim(),r=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){e.reader.takeSignificant();let t=parseToolbarItem(e,n);t!==void 0&&r.push(t)}return{kind:`ScreenToolbarSyntax`,name:n,items:r,location:o(t)}}function parseToolbarItem(t,n){let r=j.exec(n.content);if(r===null){t.error(e.UnknownScreenDirective,`Invalid toolbar item '${n.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>' or 'item <name> dialog <DialogTemplate>'`,o(n)),t.skipBlock(n.indent);return}let i=null,s=null,c=[],l=[];for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent)){t.reader.takeSignificant();let n=v.exec(e.content);if(n!==null){i=operandText(n,1);continue}let r=w.exec(e.content);r===null?a(e.content)===`icon`?s=e.content.substring(4).trim():parsePresentationValue(t,e,l):c.push({kind:`ScreenNavigationParameterSyntax`,name:r[1],binding:p(t,r[2],o(e)),location:o(e)})}let u=r[2]===`navigate`?`Navigate`:r[2]===`dialog`?`Dialog`:`Action`;return{kind:`ToolbarItemSyntax`,name:r[1],syntaxKind:u,target:r[3],label:i,icon:s,parameters:c,presentation:l,location:o(n)}}function parseUiBindingValue(e,t,n){return p(e,t,o(n))}function parseCode(t,n){let r=n.content.startsWith("```")?n.content.substring(3):n.content;if(!t.languages.has(r)){t.error(e.ExpectedCodeFence,`Expected a registered language on the opening fence, not '${n.content}'`,o(n));return}n.content.startsWith("```")||t.warning(e.LegacyInlineCodeFence,`'${r}' on its own line is deprecated - use '\`\`\`${r}' instead`,o(n));let i=c(t,r,n);return i===null?void 0:{kind:`ScreenCodeSyntax`,code:{kind:`CodeBlockSyntax`,language:r,code:i,location:o(n)},location:o(n)}}export{parseScreen};
2
+ //# sourceMappingURL=ScreenParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScreenParser.js","names":["operand","stringBodyPattern","header","pattern","data","action","label","guardedAction","navigate","route","outletPattern","contributionPattern","parameter","component","stableId","componentPropertyBinding","componentPropertyLiteral","exposes","presentation","toolbarItem","slot","title","column","rowClick","field","match","quotedGroup","unescapeString","firstWord","line","context","DiagnosticCodes","locationOf","directives","contributions","description","child","parsed","parseDescription","isFileDirective","directive","parent","collectInputUses","parseTypeRef","guarded","parseGuardedAction","text","target","labelMatch","parameters","routeValue","outletValue","parameterMatch","parseFromClause","routeMatch","outletMatch","name","slots","columns","click","columnMatch","clickMatch","labelled","fields","dataContext","componentStableId","icon","properties","exposedValues","presentationValues","outlets","bound","literal","parseMappingSource","values","items","item","itemLabel","syntaxKind","language","code","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/ScreenParser.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 {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction ('on' and 'uses') is recognized but not modeled.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n context.skipOpaqueBlock(line.indent);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(line.content);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = null;\n let target: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, location: locationOf(line) };\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n const name = line.content.substring('template'.length).trim();\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n context.skipOpaqueBlock(child.indent);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n context.skipOpaqueBlock(child.indent);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClause(context, bound[2], locationOf(line)), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>' or 'property <path> = <literal|object|array|null>'`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClause(context, match[2], locationOf(line)), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nfunction parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, location: locationOf(line) };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const match = toolbarItem.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>' or 'item <name> dialog <DialogTemplate>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel = null;\n let icon = null;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n"],"mappings":"+wBA4BA,MAAMA,EAAU,QAAQC,EAAkB,qCACpCC,EAASC,EAAQ,6BAA6B,EAC9CC,EAAOD,EAAQ,2FAA2F,EAC1GE,EAASF,EAAQ,yCAAyC,EAC1DG,EAAQH,EAAQ,aAAaH,EAAQ,EAAE,EACvCO,EAAgBJ,EAAQ,cAAcH,EAAQ,EAAE,EAChDQ,EAAWL,EAAQ,6DAA6D,EAChFM,EAAQN,EAAQ,aAAaH,EAAQ,EAAE,EACvCU,EAAgBP,EAAQ,6BAA6B,EACrDQ,EAAsBR,EAAQ,iEAAiE,EAC/FS,EAAYT,EAAQ,gDAAgD,EACpEU,EAAYV,EAAQ,wEAAwE,EAC5FW,EAAWX,EAAQ,eAAeF,EAAkB,YAAY,EAChEc,EAA2BZ,EAAQ,yCAAyC,EAC5Ea,EAA2Bb,EAAQ,sCAAsC,EACzEc,EAAUd,EAAQ,8CAA8C,EAChEe,EAAef,EAAQ,uCAAuCH,EAAQ,EAAE,EACxEmB,EAAchB,EAAQ,iGAAiG,EACvHi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,+CAA+CA,EAAS,WAAY/C,EAAWH,CAAI,CAAC,EAE5J,IAAMmD,EAAOC,EAAgBnD,EAASiD,EAAUlD,CAAI,EACpD,OAAOmD,IAAS,KAAO,IAAA,GAAY,CAC/B,KAAM,mBACN,KAAM,CAAE,KAAM,kBAAmB,WAAU,OAAM,SAAUhD,EAAWH,CAAI,CAAE,EAC5E,SAAUG,EAAWH,CAAI,CAC7B,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{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{firstWord as i,unescapeIdentifier as a}from"./LineText.js";import{locationOf as o,startOf as s}from"./SourceLine.js";import{describePlacement as c,documentPlacement as l,isDocumentPlacement as u}from"../Files/PlayPlacement.js";import{parseDescription as d}from"./DescriptionParser.js";import{parsePurpose as f}from"./PurposeParser.js";import{isFileImport as p,parseFileImport as m}from"./FileImportParser.js";import{recordAuthoredDocument as h}from"../Syntax/SourceOptions.js";import{collectInputUses as g}from"./InputUses.js";import{misplacedReactionIdentity as _}from"./ReactionIdentityParser.js";import{parseEventSource as v}from"./EventSourceParser.js";import{isFileDirective as y}from"./FileReferences.js";import{parseSystem as b}from"./OperationParser.js";import{parseExample as x}from"./SpecificationExampleParser.js";import{isBlankPublicEventOrigin as S}from"../Syntax/PublicEventInvariants.js";import{parseType as C}from"./DeclarationParsers.js";import{parseValidate as w}from"./CommandParser.js";import{parseTriggerDeclaration as T}from"./TriggerDataParser.js";import{FeatureBody as E,featureBodyExpected as D}from"./FeatureBody.js";import{ModuleBody as O,moduleBodyExpected as k,modulePattern as A,parseModule as j}from"./ModuleBody.js";import{parseIdentity as M}from"./IdentityParser.js";import{parseComplianceDirective as N,parseComplianceMarkers as P}from"./ConceptComplianceParser.js";import{parsePolicy as F}from"./PolicyParser.js";import{parseSeed as I}from"./SeedParser.js";import{parseExposure as L,parseInstance as R}from"./CompositionParser.js";const z=t(`^domain\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),B=t(`^import\\s+([\\w.]+)(?:\\s+from\\s+"(?<origin>${n})")?$`),V=t(`^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@?\\w+)*)$`),H=t(`^@?[a-z_]\\w*$`),U=t(`^persona\\s+([A-Za-z_]\\w*)$`),W=t(`^policy\\s+([A-Za-z_]\\w*)$`),G=/^[ ]*\t/,K=[`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`],q=/* @__PURE__ */ new Set([`policy`,`authentication`,`seed`,`ui`,`theme`,`trigger`,`layout`,`behavior`]),J=/* @__PURE__ */ new Set([`slice`,`feature`,`description`,`documentation`,`authorize`,`screen`,`dialog`,`form`,`contribute`,`on`,`uses`]);function parseApplication(t,n,a=l){t.deferIdentityValidation=!0,warnOnTabIndentation(t,n);let s=a.length===1?new O(a[0]):void 0,c=a.length>1?new E(a[a.length-1]):void 0,d=s??c,y=null,w=null,D=[],k=[],A=[],N=[],P=[],z=[],V=[],H=[],U=[],W=[],G=[],K=[],J=[],Y=[],X=[],Z=!1;for(let n=t.reader.peekSignificant();n!==void 0;n=t.reader.peekSignificant()){t.reader.takeSignificant();let c=i(n.content);if(c===`runs`)_(t,n);else if(c===`domain`)t.authoredDeclarations=!0,w=parseDomain(t,n,w,Z);else if(Z||=declaresConstruct(c,n,a),t.authoredDeclarations||=c!==`import`&&declaresConstruct(c,n,a),c===`import`&&p(n.content))d===void 0?m(t,n,k):d.tryParse(t,n);else if(c===`import`){let i=B.exec(n.content);if(i===null)t.error(e.InvalidImportDeclaration,`Invalid import '${n.content}' - expected 'import <Qualified.Name> [from "<origin>"]'`,o(n));else{let a=i.groups?.origin===void 0?null:r(i.groups.origin);a!==null&&S(a)&&t.error(e.InvalidImportDeclaration,`An import origin must be a nonblank quoted string`,o(n)),D.push({kind:`ImportSyntax`,qualifiedName:i[1],origin:a,visibility:a===null?`Private`:`Public`,location:o(n)})}}else if(c===`example`)d===void 0?K.push(x(t,n)):d.tryParse(t,n);else if(c===`eventsource`)z.push(v(t,n));else if(c===`system`)P.push(b(t,n));else if(c===`concept`)A.push(parseConcept(t,n));else if(c===`type`)N.push(C(t,n));else if(c===`module`&&!u(a))parseModuleInPlacedFile(t,n,a,s);else if(c===`module`)V.push(j(t,n));else if(c===`persona`)H.push(parsePersona(t,n));else if(c===`seed`)G.push(I(t.valueContext,n));else if(c===`purpose`&&d!==void 0)d.tryParse(t,n);else if(c===`purpose`)W.push(f(t,n));else if(c===`identity`)y=M(t,n,y);else if(c===`policy`)U.push(F(t,n));else if(c===`exposure`)Y.push(L(t,n));else if(c===`instance`)X.push(R(t,n));else if(c===`trigger`){let e=T(t,n),r=/^trigger\s+([A-Za-z_]\w*)$/.exec(n.content)?.[1];r!==void 0&&J.push({name:r,data:e})}else q.has(c)?c===`behavior`||c===`layout`?g(t,n):t.skipOpaqueBlock(n.indent):d?.tryParse(t,n)!==!0&&reportUnexpectedTopLevel(t,n,a)}s===void 0?c!==void 0&&V.unshift(place(a,c.build(t.start,!0),t.start)):V.unshift(s.build(t.start,!0));let Q={kind:`ApplicationSyntax`,...y===null?{}:{identity:y},sourceOptions:t.sourceOptions,domain:w,imports:D,concepts:A,types:N,systems:P,eventSources:z,examples:K,modules:V,personas:H,policies:U,purposes:W,seeds:G,declaredTriggers:J,fileImports:k,...Y.length>0?{exposures:Y}:{},...X.length>0?{instanceContributions:X}:{},location:t.start};return t.authoredDeclarations&&h(Q),Q}function declaresConstruct(e,t,n){return e===`import`?B.test(t.content):e===`module`?u(n):e===`identity`?t.content===`identity`:e===`purpose`||e===`example`||e===`exposure`||e===`instance`||e===`eventsource`||e===`system`||e===`concept`||e===`type`||e===`persona`||q.has(e)}function parseModuleInPlacedFile(t,n,r,i){let a=A.exec(n.content)?.[1]??``;i!==void 0&&a===r[0]?(t.authoredDeclarations=!0,i.parseChildren(t,n)):(t.error(e.ModuleInPlacedFile,`This file is imported into ${c(r)}, so it cannot declare module '${a}' - import it at the top level of a document instead`,o(n)),t.skipBlock(n.indent))}function reportUnexpectedTopLevel(t,n,r){let a=i(n.content);if(u(r)){let r=J.has(a)?` - '${a}' belongs in a module or feature; wrap it in one, or import this file from inside one`:` - expected domain, import, concept, type, policy, persona, authentication, identity, module, seed, trigger, behavior, ui profile, theme or layout`;t.error(e.UnknownTopLevelConstruct,`Unexpected '${a}' at the top level${r}`,o(n))}else{let i=r.length===1?k:D;t.error(e.UnexpectedInPlacedFile,`Unexpected '${a}' in a file imported into ${c(r)} - expected an application declaration or ${i}`,o(n))}t.skipBlock(n.indent)}function place(e,t,n){let r=t;for(let t=e.length-2;t>=1;t--)r={kind:`FeatureSyntax`,name:e[t],description:null,authorize:null,features:[r],slices:[],fileImports:[],isPlacement:!0,location:n};return{kind:`ModuleSyntax`,name:e[0],description:null,authorize:null,features:[r],fileImports:[],isPlacement:!0,location:n}}function parseDomain(t,n,r,i){let a=z.exec(n.content);return a===null?(t.error(e.InvalidDomainDeclaration,`Invalid domain declaration '${n.content}' - expected 'domain <Qualified.Name>'`,o(n)),r):r===null?(i&&t.error(e.DomainNotFirst,`'domain' must be declared before any other construct`,o(n)),{kind:`DomainSyntax`,name:a[1],location:o(n)}):(t.error(e.DuplicateDomain,`The document already declares a domain - a document can have at most one`,o(n)),r)}function warnOnTabIndentation(t,n){let r=!1;for(let i of n)i.raw.trimStart().startsWith("```")?r=!r:!r&&G.test(i.raw)&&t.warning(e.TabIndentation,`Screenplay is indentation based - use spaces, not tabs`,s(i))}function parseConcept(t,n){let r=V.exec(n.content);if(r===null)return t.error(e.InvalidConceptDeclaration,`Invalid concept declaration '${n.content}' - expected 'concept <Name> : <Type>'`,o(n)),t.skipBlock(n.indent),{kind:`ConceptSyntax`,name:i(n.content),type:``,attributes:[],values:[],location:o(n)};let[,s,c,l]=r,u=P(t,n,l);c!==`Enum`&&!K.includes(c)&&t.error(e.UnknownPrimitiveType,`Unknown primitive type '${c}' - expected ${K.join(`, `)} or Enum`,o(n));let f=[],p=null,m=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))if(t.reader.takeSignificant(),i(r.content)===`description`&&(c!==`Enum`||r.content!==`description`||t.peekChild(r.indent)?.content.startsWith("```")===!0))p=d(t,r,p,`Concept '${s}'`);else if(y(r))continue;else if(i(r.content)===`validate`){c===`Enum`&&r.content===`validate`&&t.peekChild(r.indent)===void 0&&t.warning(e.ValidateReadAsEnumerationBlock,`'validate' in enumeration concept '${s}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,o(r));let n=w(t,r,`concept`);n!==void 0&&m.push(n)}else N(t,r,s,u)||(c===`Enum`&&H.test(r.content)?f.push(a(r.content)):c===`Enum`?t.error(e.InvalidEnumerationValue,`Invalid enum value '${r.content}' - expected an identifier`,o(r)):(t.error(e.UnknownConceptDirective,`Unexpected '${r.content}' in concept body - expected validate, 'file <path>' or '<attribute> reason "<text>"'`,o(r)),t.skipBlock(r.indent)));return{kind:`ConceptSyntax`,name:s,type:c,attributes:u,values:f,validations:m,description:p,location:o(n)}}function parsePersona(t,n){let r=U.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidPersonaDeclaration,`Invalid persona declaration '${n.content}' - expected 'persona <Name>'`,o(n));let a=null,s=[];for(let c=t.peekChild(n.indent);c!==void 0;c=t.peekChild(n.indent)){t.reader.takeSignificant();let n=i(c.content);if(n===`description`)a=d(t,c,a,`Persona '${r}'`);else if(n===`policy`){let n=W.exec(c.content);n===null?t.error(e.InvalidPersonaPolicyReference,`Invalid policy reference '${c.content}' - expected 'policy <Name>'`,o(c)):s.push(n[1])}else t.error(e.UnknownPersonaDirective,`Unexpected '${n}' in persona body - expected description or policy`,o(c)),t.skipBlock(c.indent)}return{kind:`PersonaSyntax`,name:r,description:a,policies:s,location:o(n)}}export{parseApplication};
2
+ //# sourceMappingURL=ScreenplayParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScreenplayParser.js","names":["domainPattern","pattern","importPattern","stringBodyPattern","conceptPattern","enumValuePattern","personaPattern","personaPolicyPattern","tabIndentPattern","primitiveTypes","opaqueTopLevel","bodyKeywords","documentPlacement","context","lines","moduleBody","placement","ModuleBody","featureBody","FeatureBody","placedBody","identity","domain","imports","fileImports","concepts","types","systems","eventSources","modules","personas","policies","purposes","seeds","examples","declaredTriggers","exposures","instanceContributions","sawOtherConstruct","line","keyword","firstWord","misplacedReactionIdentity","isFileImport","parseFileImport","match","DiagnosticCodes","locationOf","origin","unescapeString","isBlankPublicEventOrigin","parseExample","parseEventSource","parseSystem","parseType","isDocumentPlacement","parseModule","parseSeed","parsePurpose","parseIdentity","parsePolicy","parseExposure","parseInstance","data","parseTriggerDeclaration","name","collectInputUses","root","recordAuthoredDocument","modulePattern","describePlacement","word","hint","expected","moduleBodyExpected","featureBodyExpected","feature","innermost","index","start","existing","inFence","startOf","type","attributeText","attributes","parseComplianceMarkers","values","description","validations","child","parseDescription","isFileDirective","parsed","parseValidate","parseComplianceDirective","unescapeIdentifier","policy"],"sources":["../../../../../../Compiler/Parsing/ScreenplayParser.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 { IdentitySyntax } from '../Syntax/IdentitySyntax';\nimport { parseIdentity } from './IdentityParser';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { recordAuthoredDocument } from '../Syntax/SourceOptions';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { describePlacement, documentPlacement, isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, DomainSyntax, ImportSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { parseTriggerDeclaration } from './TriggerDataParser';\nimport { pattern } from '../Text/patterns';\nimport { parseComplianceDirective, parseComplianceMarkers } from './ConceptComplianceParser';\nimport { parseType } from './DeclarationParsers';\nimport { ValidateSyntax } from '../Syntax/Commands';\nimport { parseValidate } from './CommandParser';\nimport { parseDescription } from './DescriptionParser';\nimport { FeatureBody, featureBodyExpected } from './FeatureBody';\nimport { isFileImport, parseFileImport } from './FileImportParser';\nimport { isFileDirective } from './FileReferences';\nimport { collectInputUses } from './InputUses';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ModuleBody, moduleBodyExpected, modulePattern, parseModule } from './ModuleBody';\nimport { ParserContext } from './ParserContext';\nimport { PolicySyntax } from '../Syntax/Policies';\nimport { parsePolicy } from './PolicyParser';\nimport { PurposeSyntax } from '../Syntax/Purposes';\nimport { parsePurpose } from './PurposeParser';\nimport { SeedSyntax } from '../Syntax/Seeds';\nimport { parseSeed } from './SeedParser';\nimport { parseSystem } from './OperationParser';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { SystemSyntax } from '../Syntax/Operations';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { parseEventSource } from './EventSourceParser';\nimport { parseExposure, parseInstance } from './CompositionParser';\nimport { ExposureSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { parseExample } from './SpecificationExampleParser';\nimport { locationOf, SourceLine, startOf } from './SourceLine';\n\nconst domainPattern = pattern('^domain\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst importPattern = pattern(`^import\\\\s+([\\\\w.]+)(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst conceptPattern = pattern('^concept\\\\s+(\\\\w+)\\\\s*:\\\\s*(\\\\w+)((?:\\\\s+@?\\\\w+)*)$');\nconst enumValuePattern = pattern('^@?[a-z_]\\\\w*$');\nconst personaPattern = pattern('^persona\\\\s+([A-Za-z_]\\\\w*)$');\nconst personaPolicyPattern = pattern('^policy\\\\s+([A-Za-z_]\\\\w*)$');\nconst tabIndentPattern = /^[ ]*\\t/;\nconst primitiveTypes = ['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'];\n\n// Top-level, module and feature constructs the C# compiler knows that this compiler does not model. They\n// are skipped whole, not reported.\nconst opaqueTopLevel = new Set(['policy', 'authentication', 'seed', 'ui', 'theme', 'trigger', 'layout', 'behavior']);\n\n// What belongs in a module or feature body; at the top level of a whole document it gets a hint saying so.\nconst bodyKeywords = new Set(['slice', 'feature', 'description', 'documentation', 'authorize', 'screen', 'dialog', 'form', 'contribute', 'on', 'uses']);\n\n// Parses one document into its application syntax - the port of the C# ScreenplayParser. The placement says\n// where the document's top level belongs: the application, unless an import placed it in a module or feature.\nexport function parseApplication(context: ParserContext, lines: readonly SourceLine[], placement: PlayPlacement = documentPlacement): ApplicationSyntax {\n context.deferIdentityValidation = true;\n warnOnTabIndentation(context, lines);\n const moduleBody = placement.length === 1 ? new ModuleBody(placement[0]) : undefined;\n const featureBody = placement.length > 1 ? new FeatureBody(placement[placement.length - 1]) : undefined;\n const placedBody = moduleBody ?? featureBody;\n let identity: IdentitySyntax | null = null;\n let domain: DomainSyntax | null = null;\n const imports: ImportSyntax[] = [];\n const fileImports: FileImportSyntax[] = [];\n const concepts: ConceptSyntax[] = [];\n const types: TypeSyntax[] = [];\n const systems: SystemSyntax[] = [];\n const eventSources: EventSourceSyntax[] = [];\n const modules: ModuleSyntax[] = [];\n const personas: PersonaSyntax[] = [];\n const policies: PolicySyntax[] = [];\n const purposes: PurposeSyntax[] = [];\n const seeds: SeedSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const declaredTriggers: NonNullable<ApplicationSyntax['declaredTriggers']>[number][] = [];\n const exposures: ExposureSyntax[] = [];\n const instanceContributions: InstanceContributionsSyntax[] = [];\n let sawOtherConstruct = false;\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'runs') {\n misplacedReactionIdentity(context, line);\n continue;\n }\n if (keyword === 'domain') {\n context.authoredDeclarations = true;\n domain = parseDomain(context, line, domain, sawOtherConstruct);\n continue;\n }\n // The C# parser asks whether anything was declared before the domain, so an import it rejected,\n // a file import and an unknown construct do not count.\n sawOtherConstruct ||= declaresConstruct(keyword, line, placement);\n context.authoredDeclarations ||= keyword !== 'import' && declaresConstruct(keyword, line, placement);\n if (keyword === 'import' && isFileImport(line.content)) {\n // A top level import belongs to whatever the document's top level is - the application, or the\n // module or feature the document was itself imported into.\n if (placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else {\n parseFileImport(context, line, fileImports);\n }\n } else if (keyword === 'import') {\n const match = importPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, `Invalid import '${line.content}' - expected 'import <Qualified.Name> [from \"<origin>\"]'`, locationOf(line));\n } else {\n const origin = match.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, 'An import origin must be a nonblank quoted string', locationOf(line));\n }\n imports.push({ kind: 'ImportSyntax', qualifiedName: match[1], origin, visibility: origin === null ? EventVisibility.Private : EventVisibility.Public, location: locationOf(line) });\n }\n } else if (keyword === 'example') {\n if (placedBody !== undefined) placedBody.tryParse(context, line);\n else examples.push(parseExample(context, line));\n } else if (keyword === 'eventsource') {\n eventSources.push(parseEventSource(context, line));\n } else if (keyword === 'system') {\n systems.push(parseSystem(context, line));\n } else if (keyword === 'concept') {\n concepts.push(parseConcept(context, line));\n } else if (keyword === 'type') {\n types.push(parseType(context, line));\n } else if (keyword === 'module' && !isDocumentPlacement(placement)) {\n parseModuleInPlacedFile(context, line, placement, moduleBody);\n } else if (keyword === 'module') {\n modules.push(parseModule(context, line));\n } else if (keyword === 'persona') {\n personas.push(parsePersona(context, line));\n } else if (keyword === 'seed') {\n seeds.push(parseSeed(context.valueContext, line));\n } else if (keyword === 'purpose' && placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else if (keyword === 'purpose') {\n purposes.push(parsePurpose(context, line));\n } else if (keyword === 'identity') {\n identity = parseIdentity(context, line, identity);\n } else if (keyword === 'policy') {\n // Legacy policies were opaque: enrich their structure without adding diagnostics.\n policies.push(parsePolicy(context, line));\n } else if (keyword === 'exposure') {\n exposures.push(parseExposure(context, line));\n } else if (keyword === 'instance') {\n instanceContributions.push(parseInstance(context, line));\n } else if (keyword === 'trigger') {\n const data = parseTriggerDeclaration(context, line);\n const name = /^trigger\\s+([A-Za-z_]\\w*)$/.exec(line.content)?.[1];\n if (name !== undefined) declaredTriggers.push({ name, data });\n } else if (opaqueTopLevel.has(keyword)) {\n if (keyword === 'behavior' || keyword === 'layout') collectInputUses(context, line);\n else context.skipOpaqueBlock(line.indent);\n } else if (placedBody?.tryParse(context, line) !== true) {\n reportUnexpectedTopLevel(context, line, placement);\n }\n }\n if (moduleBody !== undefined) {\n modules.unshift(moduleBody.build(context.start, true));\n } else if (featureBody !== undefined) {\n modules.unshift(place(placement, featureBody.build(context.start, true), context.start));\n }\n const root: ApplicationSyntax = { kind: 'ApplicationSyntax', ...(identity === null ? {} : { identity }), sourceOptions: context.sourceOptions, domain, imports, concepts, types, systems, eventSources, examples, modules, personas, policies, purposes, seeds, declaredTriggers, fileImports, ...(exposures.length > 0 ? { exposures } : {}), ...(instanceContributions.length > 0 ? { instanceContributions } : {}), location: context.start };\n if (context.authoredDeclarations) recordAuthoredDocument(root);\n return root;\n}\n\nfunction declaresConstruct(keyword: string, line: SourceLine, placement: PlayPlacement): boolean {\n if (keyword === 'import') {\n return importPattern.test(line.content);\n }\n if (keyword === 'module') {\n return isDocumentPlacement(placement);\n }\n if (keyword === 'identity') return line.content === 'identity';\n return keyword === 'purpose' || keyword === 'example' || keyword === 'exposure' || keyword === 'instance' || keyword === 'eventsource' || keyword === 'system' || keyword === 'concept' || keyword === 'type' || keyword === 'persona' || opaqueTopLevel.has(keyword);\n}\n\nfunction parseModuleInPlacedFile(context: ParserContext, line: SourceLine, placement: PlayPlacement, moduleBody: ModuleBody | undefined): void {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n\n // Restating the module a file is placed in says nothing new, so its body simply joins the placement.\n if (moduleBody !== undefined && name === placement[0]) {\n context.authoredDeclarations = true;\n moduleBody.parseChildren(context, line);\n return;\n }\n context.error(DiagnosticCodes.ModuleInPlacedFile,\n `This file is imported into ${describePlacement(placement)}, so it cannot declare module '${name}' - import it at the top level of a document instead`, locationOf(line));\n context.skipBlock(line.indent);\n}\n\nfunction reportUnexpectedTopLevel(context: ParserContext, line: SourceLine, placement: PlayPlacement): void {\n const word = firstWord(line.content);\n if (!isDocumentPlacement(placement)) {\n const expected = placement.length === 1 ? moduleBodyExpected : featureBodyExpected;\n context.error(DiagnosticCodes.UnexpectedInPlacedFile,\n `Unexpected '${word}' in a file imported into ${describePlacement(placement)} - expected an application declaration or ${expected}`, locationOf(line));\n } else {\n const hint = bodyKeywords.has(word)\n ? ` - '${word}' belongs in a module or feature; wrap it in one, or import this file from inside one`\n : ' - expected domain, import, concept, type, policy, persona, authentication, identity, module, seed, trigger, behavior, ui profile, theme or layout';\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Unexpected '${word}' at the top level${hint}`, locationOf(line));\n }\n context.skipBlock(line.indent);\n}\n\n// Wraps the feature a file is placed in in the features and module around it, each marked as a placement.\nfunction place(placement: PlayPlacement, innermost: FeatureSyntax, start: SourceLocation): ModuleSyntax {\n let feature = innermost;\n for (let index = placement.length - 2; index >= 1; index--) {\n feature = {\n kind: 'FeatureSyntax', name: placement[index], description: null, authorize: null,\n features: [feature], slices: [], fileImports: [], isPlacement: true, location: start,\n };\n }\n return {\n kind: 'ModuleSyntax', name: placement[0], description: null, authorize: null,\n features: [feature], fileImports: [], isPlacement: true, location: start,\n };\n}\n\nfunction parseDomain(context: ParserContext, line: SourceLine, existing: DomainSyntax | null, sawOtherConstruct: boolean): DomainSyntax | null {\n const match = domainPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDomainDeclaration, `Invalid domain declaration '${line.content}' - expected 'domain <Qualified.Name>'`, locationOf(line));\n return existing;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDomain, 'The document already declares a domain - a document can have at most one', locationOf(line));\n return existing;\n }\n if (sawOtherConstruct) {\n context.error(DiagnosticCodes.DomainNotFirst, '\\'domain\\' must be declared before any other construct', locationOf(line));\n }\n return { kind: 'DomainSyntax', name: match[1], location: locationOf(line) };\n}\n\nfunction warnOnTabIndentation(context: ParserContext, lines: readonly SourceLine[]): void {\n let inFence = false;\n for (const line of lines) {\n if (line.raw.trimStart().startsWith('```')) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && tabIndentPattern.test(line.raw)) {\n context.warning(DiagnosticCodes.TabIndentation, 'Screenplay is indentation based - use spaces, not tabs', startOf(line));\n }\n }\n}\n\nfunction parseConcept(context: ParserContext, line: SourceLine): ConceptSyntax {\n const match = conceptPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidConceptDeclaration, `Invalid concept declaration '${line.content}' - expected 'concept <Name> : <Type>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ConceptSyntax', name: firstWord(line.content), type: '', attributes: [], values: [], location: locationOf(line) };\n }\n const [, name, type, attributeText] = match;\n const attributes = parseComplianceMarkers(context, line, attributeText);\n if (type !== 'Enum' && !primitiveTypes.includes(type)) {\n context.error(DiagnosticCodes.UnknownPrimitiveType, `Unknown primitive type '${type}' - expected ${primitiveTypes.join(', ')} or Enum`, locationOf(line));\n }\n const values: string[] = [];\n let description: string | null = null;\n const validations: ValidateSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description' && (type !== 'Enum' || child.content !== 'description' || context.peekChild(child.indent)?.content.startsWith('```') === true)) {\n description = parseDescription(context, child, description, `Concept '${name}'`);\n } else if (isFileDirective(child)) {\n continue;\n } else if (firstWord(child.content) === 'validate') {\n if (type === 'Enum' && child.content === 'validate' && context.peekChild(child.indent) === undefined) {\n context.warning(DiagnosticCodes.ValidateReadAsEnumerationBlock,\n `'validate' in enumeration concept '${name}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,\n locationOf(child));\n }\n const parsed = parseValidate(context, child, 'concept');\n if (parsed !== undefined) validations.push(parsed);\n } else if (parseComplianceDirective(context, child, name, attributes)) {\n // Compliance directives are modeled by their original concept marker.\n } else if (type === 'Enum' && enumValuePattern.test(child.content)) {\n values.push(unescapeIdentifier(child.content));\n } else if (type === 'Enum') {\n context.error(DiagnosticCodes.InvalidEnumerationValue, `Invalid enum value '${child.content}' - expected an identifier`, locationOf(child));\n } else {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Unexpected '${child.content}' in concept body - expected validate, 'file <path>' or '<attribute> reason \"<text>\"'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'ConceptSyntax', name, type, attributes, values, validations, description, location: locationOf(line) };\n}\n\n// 'persona <Name>' with an optional description and the policies it holds - the port of the C# ParsePersona.\nfunction parsePersona(context: ParserContext, line: SourceLine): PersonaSyntax {\n const name = personaPattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid persona declaration '${line.content}' - expected 'persona <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const policies: string[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Persona '${name}'`);\n } else if (keyword === 'policy') {\n const policy = personaPolicyPattern.exec(child.content);\n if (policy === null) {\n context.error(DiagnosticCodes.InvalidPersonaPolicyReference, `Invalid policy reference '${child.content}' - expected 'policy <Name>'`, locationOf(child));\n } else {\n policies.push(policy[1]);\n }\n } else {\n context.error(DiagnosticCodes.UnknownPersonaDirective, `Unexpected '${keyword}' in persona body - expected description or policy`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'PersonaSyntax', name, description, policies, location: locationOf(line) };\n}\n"],"mappings":"6xDA8CA,MAAMA,EAAgBC,EAAQ,kDAAkD,EAC1EC,EAAgBD,EAAQ,iDAAiDE,EAAkB,MAAM,EACjGC,EAAiBH,EAAQ,qDAAqD,EAC9EI,EAAmBJ,EAAQ,gBAAgB,EAC3CK,EAAiBL,EAAQ,8BAA8B,EACvDM,EAAuBN,EAAQ,6BAA6B,EAC5DO,EAAmB,UACnBC,EAAiB,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,EAIhFC,kBAAiB,IAAI,IAAI,CAAC,SAAU,iBAAkB,OAAQ,KAAM,QAAS,UAAW,SAAU,UAAU,CAAC,EAG7GC,kBAAe,IAAI,IAAI,CAAC,QAAS,UAAW,cAAe,gBAAiB,YAAa,SAAU,SAAU,OAAQ,aAAc,KAAM,MAAM,CAAC,EAItJ,SAAgB,iBAAiB,EAAwB,EAA8B,EAA2BC,EAAsC,CACpJ,EAAQ,wBAA0B,GAClC,qBAAqBC,EAASC,CAAK,EACnC,IAAMC,EAAaC,EAAU,SAAW,EAAI,IAAIC,EAAWD,EAAU,EAAE,EAAI,IAAA,GACrEE,EAAcF,EAAU,OAAS,EAAI,IAAIG,EAAYH,EAAUA,EAAU,OAAS,EAAE,EAAI,IAAA,GACxFI,EAAaL,GAAcG,EAC7BG,EAAkC,KAClCC,EAA8B,KAC5BC,EAA0B,CAAC,EAC3BC,EAAkC,CAAC,EACnCC,EAA4B,CAAC,EAC7BC,EAAsB,CAAC,EACvBC,EAA0B,CAAC,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eAAeN,EAAQ,oDAAqDO,EAAW2C,CAAK,CAAC,EACpJ7E,EAAQ,UAAU6E,EAAM,MAAM,CAEtC,CACA,MAAO,CAAE,KAAM,gBAAiB,OAAM,cAAa,WAAU,SAAU3C,EAAWR,CAAI,CAAE,CAC5F"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{nativePattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseModeledMappingSource as i}from"./ExpressionParser.js";import{locationOf as a}from"./SourceLine.js";const o=RegExp(`^for\\s+"(${n})"$`,`u`),s=t(`^[A-Z]\\w*$`),c=t(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`);function parseSeed(t,n){let l=[];if(t=t.valueContext,n.content!==`seed`)return t.error(e.InvalidSeedDeclaration,`Invalid seed declaration '${n.content}' - expected 'seed'`,a(n)),t.skipOpaqueBlock(n.indent),{kind:`SeedSyntax`,groups:l,location:a(n)};for(let u=t.peekChild(n.indent);u!==void 0;u=t.peekChild(n.indent)){t.reader.takeSignificant();let n=o.exec(u.content);if(n===null){t.error(e.InvalidSeedGroup,`Invalid seed group '${u.content}' - expected 'for "<event source id>"'`,a(u)),t.skipOpaqueBlock(u.indent);continue}let d=[];for(let n=t.peekChild(u.indent);n!==void 0;n=t.peekChild(u.indent)){if(t.reader.takeSignificant(),!s.test(n.content)){t.error(e.InvalidSeedEvent,`Invalid seed event '${n.content}' - expected an event type name`,a(n)),t.skipOpaqueBlock(n.indent);continue}let r=[];for(let o=t.peekChild(n.indent);o!==void 0;o=t.peekChild(n.indent)){t.reader.takeSignificant();let n=c.exec(o.content);n===null?t.error(e.InvalidSeedPropertyAssignment,`Invalid property assignment '${o.content}' - expected '<property> = <value>'`,a(o)):r.push({kind:`PropertyMappingSyntax`,property:n[1],source:i(n[2],a(o),t),location:a(o)})}d.push({kind:`SeedEventSyntax`,event:n.content,properties:r,location:a(n)})}l.push({kind:`SeedGroupSyntax`,eventSourceId:r(n[1]),events:d,location:a(u)})}return{kind:`SeedSyntax`,groups:l,location:a(n)}}export{parseSeed};
2
+ //# sourceMappingURL=SeedParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeedParser.js","names":["pattern","parseMappingSource","forPattern","stringBodyPattern","eventPattern","nativePattern","mappingPattern","groups","context","header","DiagnosticCodes","locationOf","group","match","events","event","properties","property","mapped","parseModeledMappingSource","unescapeString"],"sources":["../../../../../../Compiler/Parsing/SeedParser.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 { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SeedEventSyntax, SeedGroupSyntax, SeedSyntax } from '../Syntax/Seeds';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { nativePattern as pattern } from '../Text/patterns';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst forPattern = new RegExp(`^for\\\\s+\"(${stringBodyPattern})\"$`, 'u');\nconst eventPattern = pattern('^[A-Z]\\\\w*$');\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nexport function parseSeed(context: ParserContext, header: SourceLine): SeedSyntax {\n const groups: SeedGroupSyntax[] = [];\n context = context.valueContext;\n if (header.content !== 'seed') {\n context.error(DiagnosticCodes.InvalidSeedDeclaration, `Invalid seed declaration '${header.content}' - expected 'seed'`, locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return { kind: 'SeedSyntax', groups, location: locationOf(header) };\n }\n for (let group = context.peekChild(header.indent); group !== undefined; group = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = forPattern.exec(group.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSeedGroup, `Invalid seed group '${group.content}' - expected 'for \"<event source id>\"'`, locationOf(group));\n context.skipOpaqueBlock(group.indent);\n continue;\n }\n const events: SeedEventSyntax[] = [];\n for (let event = context.peekChild(group.indent); event !== undefined; event = context.peekChild(group.indent)) {\n context.reader.takeSignificant();\n if (!eventPattern.test(event.content)) {\n context.error(DiagnosticCodes.InvalidSeedEvent, `Invalid seed event '${event.content}' - expected an event type name`, locationOf(event));\n context.skipOpaqueBlock(event.indent);\n continue;\n }\n const properties: PropertyMappingSyntax[] = [];\n for (let property = context.peekChild(event.indent); property !== undefined; property = context.peekChild(event.indent)) {\n context.reader.takeSignificant();\n const mapped = mappingPattern.exec(property.content);\n if (mapped !== null) properties.push({ kind: 'PropertyMappingSyntax', property: mapped[1], source: parseMappingSource(mapped[2], locationOf(property), context), location: locationOf(property) });\n else context.error(DiagnosticCodes.InvalidSeedPropertyAssignment, `Invalid property assignment '${property.content}' - expected '<property> = <value>'`, locationOf(property));\n }\n events.push({ kind: 'SeedEventSyntax', event: event.content, properties, location: locationOf(event) });\n }\n groups.push({ kind: 'SeedGroupSyntax', eventSourceId: unescapeString(match[1]), events, location: locationOf(group) });\n }\n return { kind: 'SeedSyntax', groups, location: locationOf(header) };\n}\n"],"mappings":"6WAYA,MAAME,EAAiB,OAAO,aAAaC,EAAkB,KAAM,GAAG,EAChEC,EAAeJ,EAAQ,aAAa,EACpCM,EAAiBN,EAAQ,iCAAiC,EAEhE,SAAgB,UAAU,EAAwB,EAAgC,CAC9E,IAAMO,EAA4B,CAAC,EAEnC,GADA,EAAUC,EAAQ,aACdC,EAAO,UAAY,OAGnB,OAFAD,EAAQ,MAAME,EAAgB,uBAAwB,6BAA6BD,EAAO,QAAQ,qBAAsBE,EAAWF,CAAM,CAAC,EAC1ID,EAAQ,gBAAgBC,EAAO,MAAM,EAC9B,CAAE,KAAM,aAAc,SAAQ,SAAUE,EAAWF,CAAM,CAAE,EAEtE,IAAK,IAAIG,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OC,EAAM,QAAS,aAAY,SAAUJ,EAAWI,CAAK,CAAE,CAAC,CAC1G,CACAR,EAAO,KAAK,CAAE,KAAM,kBAAmB,cAAea,EAAeP,EAAM,EAAE,EAAG,SAAQ,SAAUF,EAAWC,CAAK,CAAE,CAAC,CACzH,CACA,MAAO,CAAE,KAAM,aAAc,SAAQ,SAAUD,EAAWF,CAAM,CAAE,CACtE"}
@@ -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{dependencySources as n}from"../Syntax/DependencySources.js";import{firstWord as r}from"./LineText.js";import{locationOf as i}from"./SourceLine.js";import{parseDescription as a}from"./DescriptionParser.js";import{parsePurposeReference as o}from"./PurposeParser.js";import{parseDocumentation as s}from"./DocumentationParser.js";import{misplacedReactionIdentity as c}from"./ReactionIdentityParser.js";import{isFileDirective as l}from"./FileReferences.js";import{parseOperation as u}from"./OperationParser.js";import{parseSpecification as d}from"./SpecificationParser.js";import{parseExample as f}from"./SpecificationExampleParser.js";import{sliceTypes as p}from"../Syntax/Structure.js";import{parseEvent as m,parseReadModel as h}from"./DeclarationParsers.js";import{parseCapture as g}from"./CaptureParser.js";import{captureReducer as _}from"./DependencySourceParser.js";import{parseCommand as v}from"./CommandParser.js";import{parseConstraint as y}from"./ConstraintParser.js";import{parseProjection as b}from"./ProjectionParser.js";import{parseQuery as x}from"./QueryParser.js";import{parseReaction as S}from"./ReactionParser.js";import{parseScreen as C}from"./ScreenParser.js";const w=t(`^slice\\s+([A-Za-z]\\w*)\\s+([A-Za-z_]\\w*)$`),T=/* @__PURE__ */ new Set([`reducer`]);function parseSlice(t,E){let D=w.exec(E.content),O=`StateChange`,k=``;D===null?t.error(e.InvalidSliceDeclaration,`Invalid slice declaration '${E.content}' - expected 'slice <Type> <Name>'`,i(E)):(k=D[2],p.includes(D[1])?O=D[1]:t.error(e.UnknownSliceType,`Unknown slice type '${D[1]}' - expected StateChange, StateView, Automation or Translate`,i(E)));let A=t.scope;t.scope=[...A,k];let j=null,M=!1,N=null,P=null,F=[],I=[],L=[],R=[],z=[],B=[],V=[],H=[],U=[],W=[],G=[],K=[],q=[],J=[];for(let n=t.peekChild(E.indent);n!==void 0;n=t.peekChild(E.indent)){if(t.reader.takeSignificant(),l(n))continue;let p=n.content.split(/[ \t]/,1)[0],w=p===`public`||p===`direction`?p:r(n.content);if(w===`description`)N=a(t,n,N,`Slice '${k}'`);else if(w===`documentation`)P=s(t,n,P,`Slice '${k}'`);else if(w===`purpose`)o(t,n,G);else if(w===`operation`)I.push(u(t,n).operation);else if(w===`direction`){let r=/^direction\s+(inbound|outbound)$/.exec(n.content);M||O!==`Translate`||r===null?t.error(e.InvalidSliceDeclaration,`Declare direction inbound or direction outbound once, inside a Translate slice only`,i(n)):j=r[1]===`inbound`?`Inbound`:`Outbound`,M=!0}else w===`event`||w===`public`?F.push(m(t,n)):w===`command`?L.push(v(t,n)):w===`query`?R.push(x(t,n)):w===`projection`?z.push(b(t,n)):w===`capture`?V.push(g(t,n)):w===`runs`?c(t,n):w===`reaction`?B.push(S(t,n)):w===`constraint`?H.push(y(t,n)):w===`example`?W.push(f(t,n)):w===`specification`?U.push(d(t,n)):w===`readmodel`?K.push(h(t,n)):w===`screen`?q.push(C(t,n)):T.has(w)?(J.push(_(t,n)),t.skipOpaqueBlock(n.indent)):(t.warning(e.UnknownSliceDirective,`Unknown construct '${w}' in slice '${k}'`,i(n)),t.skipBlock(n.indent))}t.scope=A;let Y={kind:`SliceSyntax`,type:O,name:k,direction:j,description:N,documentation:P,examples:W,purposes:G,events:F,operations:I,commands:L,queries:R,projections:z,captures:V,reactions:B,constraints:H,specifications:U,readModels:K,screens:q,location:i(E)};return n.set(Y,{reducers:J}),Y}export{parseSlice};
2
+ //# sourceMappingURL=SliceParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceParser.js","names":["header","pattern","opaqueMembers","match","line","type","name","context","DiagnosticCodes","locationOf","sliceTypes","previous","direction","hasDirection","description","documentation","events","operations","commands","queries","projections","reactions","captures","constraints","specifications","examples","purposes","readModels","screens","reducers","child","isFileDirective","metadataWord","keyword","firstWord","parseDescription","parseDocumentation","parsePurposeReference","parseOperation","directionMatch","parseEvent","parseCommand","parseQuery","parseProjection","parseCapture","misplacedReactionIdentity","parseReaction","parseConstraint","parseExample","parseSpecification","parseReadModel","parseScreen","captureReducer","syntax","dependencySources"],"sources":["../../../../../../Compiler/Parsing/SliceParser.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 { CaptureSyntax } from '../Syntax/Captures';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConstraintSyntax } from '../Syntax/Constraints';\nimport { EventSyntax, ReadModelSyntax } from '../Syntax/Declarations';\nimport { ProjectionSyntax } from '../Syntax/Projections';\nimport { QuerySyntax } from '../Syntax/Queries';\nimport { ReactionSyntax } from '../Syntax/Reactions';\nimport { ScreenSyntax } from '../Syntax/Screens';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from '../Syntax/Specifications';\nimport { SliceSyntax, SliceType, sliceTypes } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { parseCapture } from './CaptureParser';\nimport { parseCommand } from './CommandParser';\nimport { dependencySources, ReducerSyntax } from '../Syntax/DependencySources';\nimport { captureReducer } from './DependencySourceParser';\nimport { parseConstraint } from './ConstraintParser';\nimport { parseEvent, parseReadModel } from './DeclarationParsers';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseOperation } from './OperationParser';\nimport { OperationSyntax } from '../Syntax/Operations';\nimport { parseProjection } from './ProjectionParser';\nimport { parseQuery } from './QueryParser';\nimport { parseReaction } from './ReactionParser';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { parseScreen } from './ScreenParser';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseSpecification } from './SpecificationParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^slice\\\\s+([A-Za-z]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Slice members the C# compiler knows that this compiler does not model yet. They are skipped whole rather\n// than reported - the C# compiler and the editor diagnostics remain the authority on whether they are valid.\nconst opaqueMembers = new Set(['reducer']);\n\nexport function parseSlice(context: ParserContext, line: SourceLine): SliceSyntax {\n const match = header.exec(line.content);\n let type: SliceType = 'StateChange';\n let name = '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSliceDeclaration, `Invalid slice declaration '${line.content}' - expected 'slice <Type> <Name>'`, locationOf(line));\n } else {\n name = match[2];\n if ((sliceTypes as readonly string[]).includes(match[1])) {\n type = match[1] as SliceType;\n } else {\n context.error(DiagnosticCodes.UnknownSliceType, `Unknown slice type '${match[1]}' - expected StateChange, StateView, Automation or Translate`, locationOf(line));\n }\n }\n const previous = context.scope;\n context.scope = [...previous, name];\n let direction: TranslationDirection | null = null;\n let hasDirection = false;\n let description: string | null = null;\n let documentation: string | null = null;\n const events: EventSyntax[] = [];\n const operations: OperationSyntax[] = [];\n const commands: CommandSyntax[] = [];\n const queries: QuerySyntax[] = [];\n const projections: ProjectionSyntax[] = [];\n const reactions: ReactionSyntax[] = [];\n const captures: CaptureSyntax[] = [];\n const constraints: ConstraintSyntax[] = [];\n const specifications: SpecificationSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const purposes: PurposeReferenceSyntax[] = [];\n const readModels: ReadModelSyntax[] = [];\n const screens: ScreenSyntax[] = [];\n const reducers: ReducerSyntax[] = [];\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 const metadataWord = child.content.split(/[ \\t]/, 1)[0];\n const keyword = metadataWord === 'public' || metadataWord === 'direction' ? metadataWord : firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Slice '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Slice '${name}'`);\n } else if (keyword === 'purpose') {\n parsePurposeReference(context, child, purposes);\n } else if (keyword === 'operation') {\n operations.push(parseOperation(context, child).operation);\n } else if (keyword === 'direction') {\n const directionMatch = /^direction\\s+(inbound|outbound)$/.exec(child.content);\n if (hasDirection || type !== 'Translate' || directionMatch === null) {\n context.error(DiagnosticCodes.InvalidSliceDeclaration, 'Declare direction inbound or direction outbound once, inside a Translate slice only', locationOf(child));\n } else {\n direction = directionMatch[1] === 'inbound' ? TranslationDirection.Inbound : TranslationDirection.Outbound;\n }\n hasDirection = true;\n } else if (keyword === 'event' || keyword === 'public') {\n events.push(parseEvent(context, child));\n } else if (keyword === 'command') {\n commands.push(parseCommand(context, child));\n } else if (keyword === 'query') {\n queries.push(parseQuery(context, child));\n } else if (keyword === 'projection') {\n projections.push(parseProjection(context, child));\n } else if (keyword === 'capture') {\n captures.push(parseCapture(context, child));\n } else if (keyword === 'runs') {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'reaction') {\n reactions.push(parseReaction(context, child));\n } else if (keyword === 'constraint') {\n constraints.push(parseConstraint(context, child));\n } else if (keyword === 'example') {\n examples.push(parseExample(context, child));\n } else if (keyword === 'specification') {\n specifications.push(parseSpecification(context, child));\n } else if (keyword === 'readmodel') {\n readModels.push(parseReadModel(context, child));\n } else if (keyword === 'screen') {\n screens.push(parseScreen(context, child));\n } else if (opaqueMembers.has(keyword)) {\n reducers.push(captureReducer(context, child));\n context.skipOpaqueBlock(child.indent);\n } else {\n context.warning(DiagnosticCodes.UnknownSliceDirective, `Unknown construct '${keyword}' in slice '${name}'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n context.scope = previous;\n const syntax: SliceSyntax = {\n kind: 'SliceSyntax', type, name, direction, description, documentation, examples, purposes, events, operations, commands, queries, projections, captures, reactions, constraints, specifications, readModels, screens,\n location: locationOf(line),\n };\n dependencySources.set(syntax, { reducers });\n return syntax;\n}\n"],"mappings":"q0CAwCA,MAAMA,EAASC,EAAQ,8CAA8C,EAI/DC,kBAAgB,IAAI,IAAI,CAAC,SAAS,CAAC,EAEzC,SAAgB,WAAW,EAAwB,EAA+B,CAC9E,IAAMC,EAAQH,EAAO,KAAKI,EAAK,OAAO,EAClCC,EAAkB,cAClBC,EAAO,GACPH,IAAU,KACVI,EAAQ,MAAMC,EAAgB,wBAAyB,8BAA8BJ,EAAK,QAAQ,oCAAqCK,EAAWL,CAAI,CAAC,GAEvJ,EAAOD,EAAM,GACRO,EAAiC,SAASP,EAAM,EAAE,EACnD,EAAOA,EAAM,GAEbI,EAAQ,MAAMC,EAAgB,iBAAkB,uBAAuBL,EAAM,GAAG,8DAA+DM,EAAWL,CAAI,CAAC,GAGvK,IAAMO,EAAWJ,EAAQ,MACzB,EAAQ,MAAQ,CAAC,GAAGI,EAAUL,CAAI,EAClC,IAAIM,EAAyC,KACzCC,EAAe,GACfC,EAA6B,KAC7BC,EAA+B,KAC7BC,EAAwB,CAAC,EACzBC,EAAgC,CAAC,EACjCC,EAA4B,CAAC,EAC7BC,EAAyB,CAAC,EAC1BC,EAAkC,CAAC,EACnCC,EAA8B,CAAC,EAC/BC,EAA4B,CAAC,EAC7BC,EAAkC,CAAC,EACnCC,EAAwC,CAAC,EACzCC,EAAyC,CAAC,EAC1CC,EAAqC,CAAC,EACtCC,EAAgC,CAAC,EACjCC,EAA0B,CAAC,EAC3BC,EAA4B,CAAC,EACnC,IAAK,IAAIC,EAAQvB,EAAQ,UAAUH,EAAK,MAAM,EAAG0B,IAAU,IAAA,GAAW,EAAQvB,EAAQ,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V,EAAY,KAAKwB,EAAgBxC,EAASuB,CAAK,CAAC,EACzCG,IAAY,UACnBR,EAAS,KAAKuB,EAAazC,EAASuB,CAAK,CAAC,EACnCG,IAAY,gBACnBT,EAAe,KAAKyB,EAAmB1C,EAASuB,CAAK,CAAC,EAC/CG,IAAY,YACnBN,EAAW,KAAKuB,EAAe3C,EAASuB,CAAK,CAAC,EACvCG,IAAY,SACnBL,EAAQ,KAAKuB,EAAY5C,EAASuB,CAAK,CAAC,EACjC5B,EAAc,IAAI+B,CAAO,GAChCJ,EAAS,KAAKuB,EAAe7C,EAASuB,CAAK,CAAC,EAC5CvB,EAAQ,gBAAgBuB,EAAM,MAAM,IAEpCvB,EAAQ,QAAQC,EAAgB,sBAAuB,sBAAsByB,EAAQ,cAAc3B,EAAK,GAAIG,EAAWqB,CAAK,CAAC,EAC7HvB,EAAQ,UAAUuB,EAAM,MAAM,EAEtC,CACA,EAAQ,MAAQnB,EAChB,IAAM0C,EAAsB,CACxB,KAAM,cAAe,OAAM,OAAM,YAAW,cAAa,gBAAe,WAAU,WAAU,SAAQ,aAAY,WAAU,UAAS,cAAa,WAAU,YAAW,cAAa,iBAAgB,aAAY,UAC9M,SAAU5C,EAAWL,CAAI,CAC7B,EAEA,OADAkD,EAAkB,IAAID,EAAQ,CAAE,UAAS,CAAC,EACnCA,CACX"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{sourceLocation as e}from"../Diagnostics/SourceLocation.js";const isBlank=e=>e.content.length===0,locationOf=t=>e(t.number,t.indent+(t.contentOffset??0)+1,t.path),startOf=t=>e(t.number,1,t.path);export{isBlank,locationOf,startOf};
2
+ //# sourceMappingURL=SourceLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceLine.js","names":["line","sourceLocation"],"sources":["../../../../../../Compiler/Parsing/SourceLine.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 { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\n\n// One physical line of a document: its raw text, how far it is indented and what is left once comments and\n// trailing whitespace are gone. The offside rule reads nesting from the indent alone.\nexport interface SourceLine {\n readonly number: number;\n readonly raw: string;\n readonly indent: number;\n readonly content: string;\n readonly contentOffset?: number;\n readonly path?: string;\n readonly startOffset: number;\n}\n\nexport const isBlank = (line: SourceLine): boolean => line.content.length === 0;\n\n// The location of the line's first significant character.\nexport const locationOf = (line: SourceLine): SourceLocation => sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1, line.path);\n\n// The location of the line's first column, whatever its indent.\nexport const startOf = (line: SourceLine): SourceLocation => sourceLocation(line.number, 1, line.path);\n"],"mappings":"uHAiBA,MAAa,QAAW,GAA8BA,EAAK,QAAQ,SAAW,EAGjE,WAAc,GAAqCC,EAAeD,EAAK,OAAQA,EAAK,QAAUA,EAAK,eAAiB,GAAK,EAAGA,EAAK,IAAI,EAGrI,QAAW,GAAqCC,EAAeD,EAAK,OAAQ,EAAGA,EAAK,IAAI"}
@@ -0,0 +1,3 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{dotNetWhitespace as e}from"../Text/patterns.js";const t=RegExp(`^depends${e}+on(?:${e}|$)`,`u`),n=RegExp(`${e}+$`,`u`);function splitLines(e,r=!1,i){let a=[],o=0,s=0;for(let c of e.split(`
2
+ `)){o++;let e=c.endsWith(`\r`)?c.replace(/\r+$/,``):c,l=e.length-e.trimStart().length,u=stripComment(e.substring(l),r),d=t.test(u)?u.replace(n,``):u.trimEnd();a.push(i===void 0?{number:o,raw:e,indent:l,content:d,startOffset:s}:{number:o,raw:e,indent:l,content:d,path:i,startOffset:s}),s+=c.length+1}return a}function commentStart(e,t=!1){let n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`&&n&&i+1<e.length)i++;else if(a===`"`&&!r)n=!n;else if(a==="`"&&!n)r=!r;else if(!n&&!r&&(a===`/`&&i+1<e.length&&e[i+1]===`/`||t&&a===`#`))return i}return-1}function stripComment(e,t){let n=commentStart(e,t);return n<0?e:e.substring(0,n)}export{commentStart,splitLines};
3
+ //# sourceMappingURL=SourceLineSplitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceLineSplitter.js","names":["dependencyPrefix","dotNetWhitespace","dependencyTrailingWhitespace","result","number","offset","raw","source","line","indent","body","hashComments","content","path","inString","inTemplate","index","text","current","comment"],"sources":["../../../../../../Compiler/Parsing/SourceLineSplitter.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 { dotNetWhitespace } from '../Text/patterns';\nimport { SourceLine } from './SourceLine';\n\nconst dependencyPrefix = new RegExp(`^depends${dotNetWhitespace}+on(?:${dotNetWhitespace}|$)`, 'u');\nconst dependencyTrailingWhitespace = new RegExp(`${dotNetWhitespace}+$`, 'u');\n\n// Splits a document into lines the way the C# SourceLineSplitter does: a line's indent is its leading\n// whitespace, and its content is what follows with any comment and trailing whitespace removed. A comment\n// starts at '//' (or '#' in the sub-languages that use it) outside a string or a template literal.\nexport function splitLines(source: string, hashComments = false, path?: string): SourceLine[] {\n const result: SourceLine[] = [];\n let number = 0;\n let offset = 0;\n for (const raw of source.split('\\n')) {\n number++;\n const line = raw.endsWith('\\r') ? raw.replace(/\\r+$/, '') : raw;\n const indent = line.length - line.trimStart().length;\n const body = stripComment(line.substring(indent), hashComments);\n // Dependency grammar follows .NET's whitespace exactly, including NEL but not FEFF.\n const content = dependencyPrefix.test(body) ? body.replace(dependencyTrailingWhitespace, '') : body.trimEnd();\n result.push(path === undefined\n ? { number, raw: line, indent, content, startOffset: offset }\n : { number, raw: line, indent, content, path, startOffset: offset });\n offset += raw.length + 1;\n }\n return result;\n}\n\n// The index a comment starts at in the text, or -1 when it has none.\nexport function commentStart(text: string, hashComments = false): number {\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < text.length; index++) {\n const current = text[index];\n if (current === '\\\\' && inString && index + 1 < text.length) {\n index++;\n } else if (current === '\"' && !inTemplate) {\n inString = !inString;\n } else if (current === '`' && !inString) {\n inTemplate = !inTemplate;\n } else if (!inString && !inTemplate) {\n if (current === '/' && index + 1 < text.length && text[index + 1] === '/') {\n return index;\n }\n if (hashComments && current === '#') {\n return index;\n }\n }\n }\n return -1;\n}\n\nfunction stripComment(text: string, hashComments: boolean): string {\n const comment = commentStart(text, hashComments);\n return comment < 0 ? text : text.substring(0, comment);\n}\n"],"mappings":"4GAMA,MAAMA,EAAuB,OAAO,WAAWC,EAAiB,QAAQA,EAAiB,KAAM,GAAG,EAC5FC,EAAmC,OAAO,GAAGD,EAAiB,IAAK,GAAG,EAK5E,SAAgB,WAAW,EAAgB,EAAe,GAAO,EAA6B,CAC1F,IAAME,EAAuB,CAAC,EAC1BC,EAAS,EACTC,EAAS,EACb,IAAK,IAAMC,KAAOC,EAAO,MAAM;CAAI,EAAG,CAClC,IACA,IAAMC,EAAOF,EAAI,SAAS,IAAI,EAAIA,EAAI,QAAQ,OAAQ,EAAE,EAAIA,EACtDG,EAASD,EAAK,OAASA,EAAK,UAAU,CAAC,CAAC,OACxCE,EAAO,aAAaF,EAAK,UAAUC,CAAM,EAAGE,CAAY,EAExDC,EAAUZ,EAAiB,KAAKU,CAAI,EAAIA,EAAK,QAAQR,EAA8B,EAAE,EAAIQ,EAAK,QAAQ,EAC5GP,EAAO,KAAKU,IAAS,IAAA,GACf,CAAE,SAAQ,IAAKL,EAAM,SAAQ,UAAS,YAAaH,CAAO,EAC1D,CAAE,SAAQ,IAAKG,EAAM,SAAQ,UAAS,OAAM,YAAaH,CAAO,CAAC,EACvE,GAAUC,EAAI,OAAS,CAC3B,CACA,OAAOH,CACX,CAGA,SAAgB,aAAa,EAAc,EAAe,GAAe,CACrE,IAAIW,EAAW,GACXC,EAAa,GACjB,IAAK,IAAIC,EAAQ,EAAGA,EAAQC,EAAK,OAAQ,IAAS,CAC9C,IAAMC,EAAUD,EAAKD,GACrB,GAAIE,IAAY,MAAQJ,GAAYE,EAAQ,EAAIC,EAAK,OACjD,SACG,GAAIC,IAAY,KAAO,CAACH,EAC3B,EAAW,CAACD,OACT,GAAII,IAAY,KAAO,CAACJ,EAC3B,EAAa,CAACC,OACX,GAAI,CAACD,GAAY,CAACC,IACjBG,IAAY,KAAOF,EAAQ,EAAIC,EAAK,QAAUA,EAAKD,EAAQ,KAAO,KAGlEL,GAAgBO,IAAY,KAC5B,OAAOF,CAGnB,CACA,MAAO,EACX,CAEA,SAAS,aAAa,EAAc,EAA+B,CAC/D,IAAMG,EAAU,aAAaF,EAAMN,CAAY,EAC/C,OAAOQ,EAAU,EAAIF,EAAOA,EAAK,UAAU,EAAGE,CAAO,CACzD"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{commentStart as t}from"./SourceLineSplitter.js";import{firstWord as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";import{LineReader as i}from"./LineReader.js";import{exactSourceOptions as a,legacySourceOptions as o}from"../Syntax/SourceOptions.js";import{ParserContext as s}from"./ParserContext.js";import{isClosingCodeFence as c}from"./ImplementationParser.js";function sourceContext(l,u,d,f=!1){let p=[],m=[],h=o,g=!1,_=!1,v=!1,y=/* @__PURE__ */ new Map,b=new s(new i([]),u,d).languages;for(let i of l){let o=i;if(o.number===1&&o.raw.startsWith(``)){let e=o.raw.substring(1),n=e.length-e.trimStart().length,r=t(e.substring(n),f);o={...o,indent:n,contentOffset:1,content:(r<0?e.substring(n):e.substring(n,n+r)).trimEnd()}}if(v)c(o)&&(v=!1),p.push(o);else if(o.content.startsWith("```")&&(["```","```text","```markdown"].includes(o.content)||b.has(o.content.substring(3)))&&(v=!0),!v&&o.indent===0&&n(o.content)===`numbers`){let t=o.content===`numbers exact`?g?e.DuplicateNumericDirective:_?e.LateNumericDirective:void 0:e.InvalidNumericDirective;t===void 0?h=a:(m.push({severity:`error`,code:t,message:`Expected one 'numbers exact' preamble before domain, imports and declarations.`,location:r(o)}),h=Object.freeze({numericMode:`invalid`})),g=!0,p.push({...o,content:``})}else!v&&o.indent>0&&/^numbers(\s+(exact|legacy))?$/.test(o.content)&&y.set(o.number,{severity:`error`,code:e.InvalidNumericDirective,message:`Expected 'numbers exact' only as the document preamble, not inside a body.`,location:r(o)}),_||=o.content.trim().length>0,p.push(o)}let x=new s(new i(g?p:l),u,d);return x.sourceOptions=h,x.nestedNumericDirectives=y,m.forEach(e=>x.error(e.code,e.message,e.location)),x}export{sourceContext};
2
+ //# sourceMappingURL=SourceOptionsParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceOptionsParser.js","names":["prepared","diagnostics","options","legacySourceOptions","seen","contentSeen","inFence","nested","registry","ParserContext","LineReader","path","languages","original","lines","line","raw","indent","comment","commentStart","hashComments","isClosingCodeFence","firstWord","code","DiagnosticCodes","exactSourceOptions","locationOf","context","diagnostic"],"sources":["../../../../../../Compiler/Parsing/SourceOptionsParser.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 { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { exactSourceOptions, legacySourceOptions, NumericMode, SourceOptions } from '../Syntax/SourceOptions';\nimport { LineReader } from './LineReader';\nimport { isClosingCodeFence } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { commentStart } from './SourceLineSplitter';\n\n// Establishes options before entering any value grammar. This mirrors the C# physical-file prepass;\n// fences and property owners are not reinterpreted as numeric directives.\nexport function sourceContext(lines: readonly SourceLine[], path?: string, languages?: ReadonlySet<string>, hashComments = false): ParserContext {\n const prepared: SourceLine[] = [];\n const diagnostics: Diagnostic[] = [];\n let options: SourceOptions = legacySourceOptions;\n let seen = false;\n let contentSeen = false;\n let inFence = false;\n const nested = new Map<number, Diagnostic>();\n const registry = new ParserContext(new LineReader([]), path, languages).languages;\n for (const original of lines) {\n let line = original;\n if (line.number === 1 && line.raw.startsWith('\\uFEFF')) {\n const raw = line.raw.substring(1);\n const indent = raw.length - raw.trimStart().length;\n const comment = commentStart(raw.substring(indent), hashComments);\n line = { ...line, indent, contentOffset: 1, content: (comment < 0 ? raw.substring(indent) : raw.substring(indent, indent + comment)).trimEnd() };\n }\n if (inFence) {\n if (isClosingCodeFence(line)) inFence = false;\n prepared.push(line);\n continue;\n }\n if (line.content.startsWith('```') && (['```', '```text', '```markdown'].includes(line.content) || registry.has(line.content.substring(3)))) inFence = true;\n if (!inFence && line.indent === 0 && firstWord(line.content) === 'numbers') {\n const code = line.content !== 'numbers exact' ? DiagnosticCodes.InvalidNumericDirective : seen ? DiagnosticCodes.DuplicateNumericDirective : contentSeen ? DiagnosticCodes.LateNumericDirective : undefined;\n if (code !== undefined) {\n diagnostics.push({ severity: 'error', code, message: \"Expected one 'numbers exact' preamble before domain, imports and declarations.\", location: locationOf(line) });\n options = Object.freeze({ numericMode: 'invalid' as NumericMode });\n } else options = exactSourceOptions;\n seen = true;\n prepared.push({ ...line, content: '' });\n continue;\n }\n // A directive-shaped line below the top level is never a valid option, whichever construct owns the block.\n if (!inFence && line.indent > 0 && /^numbers(\\s+(exact|legacy))?$/.test(line.content)) nested.set(line.number, { severity: 'error', code: DiagnosticCodes.InvalidNumericDirective, message: \"Expected 'numbers exact' only as the document preamble, not inside a body.\", location: locationOf(line) });\n contentSeen ||= line.content.trim().length > 0;\n prepared.push(line);\n }\n const context = new ParserContext(new LineReader(seen ? prepared : lines), path, languages);\n context.sourceOptions = options;\n // Reported when reading ends, once every property owner has claimed the lines it models as fields.\n context.nestedNumericDirectives = nested;\n diagnostics.forEach(diagnostic => context.error(diagnostic.code, diagnostic.message, diagnostic.location));\n return context;\n}\n"],"mappings":"+fAeA,SAAgB,cAAc,EAA8B,EAAe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YAAa,SAAyB,CAAC,GAErE,EAAO,GACPf,EAAS,KAAK,CAAE,GAAGe,EAAM,QAAS,EAAG,CAAC,CAE1C,KAEI,CAACT,GAAWS,EAAK,OAAS,GAAK,gCAAgC,KAAKA,EAAK,OAAO,GAAGR,EAAO,IAAIQ,EAAK,OAAQ,CAAE,SAAU,QAAS,KAAMS,EAAgB,wBAAyB,QAAS,6EAA8E,SAAUE,EAAWX,CAAI,CAAE,CAAC,EACtS,IAAgBA,EAAK,QAAQ,KAAK,CAAC,CAAC,OAAS,EAC7Cf,EAAS,KAAKe,CAAI,CACtB,CACA,IAAMY,EAAU,IAAIlB,EAAc,IAAIC,EAAWN,EAAOJ,EAAWc,CAAK,EAAGH,EAAMC,CAAS,EAK1F,MAJA,GAAQ,cAAgBV,EAExB,EAAQ,wBAA0BK,EAClCN,EAAY,QAAQ,GAAc0B,EAAQ,MAAMC,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,CAAC,EAClGD,CACX"}
@@ -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";import{locationOf as r}from"./SourceLine.js";import{parseProperty as i}from"./PropertyLineParser.js";import{parseConcrete as a}from"./SpecificationResponseParser.js";const o=new RegExp(t(`^case\\s+([A-Za-z_]\\w*)(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`).source,`du`),s=t(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),c=t(`^case\\.([a-z_]\\w*)$`);function containsCaseReference(e){return/\bcase\.[a-z_]\w*/.test(e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,``))}function parseSpecificationValue(t,r,i,a=!1){if(!t.startsWith(`case.`))return containsCaseReference(t)&&i.error(e.InvalidSpecificationCaseReference,`A case reference fills a whole value position; it cannot occur inside a structured value or expression.`,r),n(t,r,i,a);let o=c.exec(t);return o===null&&i.error(e.InvalidSpecificationCaseReference,`A case reference fills a whole value position: 'case.<parameter>'.`,r),{kind:`CaseValueExpressionSyntax`,parameter:o?.[1]??t.substring(5),location:r}}function parseParameter(t,n){let a=n.content.indexOf(` `)+1,o=a>0?i(t,{...n,content:n.content.substring(a),indent:n.indent+a}):void 0;if(o===void 0||o.isGenerated||o.isIdentifier)return t.error(e.InvalidSpecificationParameter,`Expected 'parameter <name> <Type>', with optional collection and optional modifiers.`,r(n)),t.skipOpaqueBlock(n.indent),null;let s=t.peekChild(n.indent);return s!==void 0&&(t.error(e.InvalidSpecificationParameter,`A parameter has no body or default.`,r(s)),t.skipOpaqueBlock(n.indent)),{kind:`SpecificationParameterSyntax`,name:o.name,type:o.type,location:r(n)}}function parseCase(t,n){let i=o.exec(n.content);if(i===null)return t.error(e.InvalidSpecificationCase,`Expected 'case <Name>' with at most one inline parameter assignment.`,r(n)),t.skipOpaqueBlock(n.indent),null;let c=[],add=(o,s,l)=>{let u=r(l),d={...u,column:u.column+l.content.indexOf(s,l.content.indexOf(`=`)+1)};if(s.startsWith(`case.`)){t.error(e.InvalidSpecificationCaseValue,`A case assigns concrete values, not case references.`,d);return}let f=a(t,s,d,e.InvalidSpecificationCaseValue);f!==null&&c.push({kind:`PropertyMappingSyntax`,property:o,source:f,location:l===n?{...u,column:u.column+i.indices.groups.property[0]}:u})};i.groups?.property!==void 0&&add(i.groups.property,i.groups.value,n);for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n=s.exec(i.content);if(n===null){t.error(e.InvalidSpecificationCaseAssignment,`Expected '<parameter> = <concrete value>' in a case.`,r(i)),t.skipOpaqueBlock(i.indent);continue}add(n[1],n[2],i);let a=t.peekChild(i.indent);a!==void 0&&(t.error(e.InvalidSpecificationCaseValue,`A case value must fit on one line.`,r(a)),t.skipOpaqueBlock(i.indent))}return{kind:`SpecificationCaseSyntax`,name:i[1],values:c,location:r(n)}}function caseReferences(e){return Array.isArray(e)?e.flatMap(caseReferences):typeof e!=`object`||!e?[]:`kind`in e&&e.kind===`CaseValueExpressionSyntax`?[e]:Object.values(e).flatMap(caseReferences)}function validateTable(t,n){let r=t.parameters??[],i=t.cases??[];r.length===0!=(i.length===0)&&n.error(e.IncompleteSpecificationTable,`A specification table requires parameters and at least one case.`,t.location),r.forEach((t,i)=>{r.slice(0,i).some(e=>e.name===t.name)&&n.error(e.DuplicateSpecificationParameter,`Parameter '${t.name}' is declared more than once.`,t.location)}),i.forEach((t,a)=>{i.slice(0,a).some(e=>e.name===t.name)&&n.error(e.DuplicateSpecificationCase,`Case '${t.name}' is declared more than once.`,t.location);for(let i of t.values.filter(e=>!r.some(t=>t.name===e.property)))n.error(e.InvalidSpecificationCaseAssignment,`Case '${t.name}' assigns undeclared parameter '${i.property}'.`,i.location);for(let i of r.filter(e=>t.values.filter(t=>t.property===e.name).length!==1))n.error(e.InvalidSpecificationCaseAssignment,`Case '${t.name}' must assign parameter '${i.name}' exactly once.`,t.location)});let a=caseReferences(t);for(let t of a)(i.length===0||!r.some(e=>e.name===t.parameter))&&n.error(e.InvalidSpecificationCaseReference,`Case reference '${t.parameter}' requires a declared parameter in a specification table.`,t.location);for(let t of r.filter(e=>!a.some(t=>t.parameter===e.name)))n.warning(e.UnusedSpecificationParameter,`Parameter '${t.name}' is never referenced.`,t.location);for(let r of caseReferences(t.whenRedelivered))n.error(e.InvalidSpecificationCaseReference,`Case references are not permitted in redelivery locators.`,r.location)}function substituteCase(e,t,n=/* @__PURE__ */ new WeakMap){if(typeof e==`object`&&e&&n.has(e))return n.get(e);if(Array.isArray(e)){let r=e.map(e=>substituteCase(e,t,n));return n.set(e,r),r}if(typeof e!=`object`||!e||!(`kind`in e))return e;if(e.kind===`CaseValueExpressionSyntax`){let n=e.parameter;return t.values.find(e=>e.property===n)?.source??e}let r=Object.fromEntries(Object.entries(e).map(([e,r])=>[e,substituteCase(r,t,n)]));if(e.kind===`SpecificationErrorSyntax`&&`caseValue`in e&&e.caseValue!==void 0){let e=r.caseValue;r.name=e.kind===`LiteralExpressionSyntax`?e.value:null,delete r.caseValue}return n.set(e,r),r}export{caseReferences,containsCaseReference,parseCase,parseParameter,parseSpecificationValue,substituteCase,validateTable};
2
+ //# sourceMappingURL=SpecificationCaseParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationCaseParser.js","names":["caseHeader","pattern","assignment","reference","text","context","DiagnosticCodes","location","parseMappingSource","nativeIdentifiers","match","offset","line","property","parseProperty","locationOf","child","values","owner","valueLocation","source","parseConcrete","value","nested","parameters","specification","cases","index","prior","parameter","row","references","copies","result","item","key"],"sources":["../../../../../../Compiler/Parsing/SpecificationCaseParser.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 { CaseValueExpressionSyntax, ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationCaseSyntax, SpecificationParameterSyntax, SpecificationSyntax } from '../Syntax/Specifications';\nimport { pattern } from '../Text/patterns';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseConcrete } from './SpecificationResponseParser';\n\nconst caseHeader = new RegExp(pattern('^case\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?$').source, 'du');\nconst assignment = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst reference = pattern('^case\\\\.([a-z_]\\\\w*)$');\n\nexport function containsCaseReference(text: string): boolean {\n return /\\bcase\\.[a-z_]\\w*/.test(text.replace(/\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'/g, ''));\n}\n\nexport function parseSpecificationValue(text: string, location: SourceLocation, context: ParserContext, nativeIdentifiers = false): ExpressionSyntax {\n if (!text.startsWith('case.')) {\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 return parseMappingSource(text, location, context, nativeIdentifiers);\n }\n const match = reference.exec(text);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, \"A case reference fills a whole value position: 'case.<parameter>'.\", location);\n return { kind: 'CaseValueExpressionSyntax', parameter: match?.[1] ?? text.substring(5), location };\n}\n\nexport function parseParameter(context: ParserContext, line: SourceLine): SpecificationParameterSyntax | null {\n const offset = line.content.indexOf(' ') + 1;\n const property = offset > 0 ? parseProperty(context, { ...line, content: line.content.substring(offset), indent: line.indent + offset }) : undefined;\n if (property === undefined || property.isGenerated || property.isIdentifier) {\n context.error(DiagnosticCodes.InvalidSpecificationParameter, \"Expected 'parameter <name> <Type>', with optional collection and optional modifiers.\", locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return null;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationParameter, 'A parameter has no body or default.', locationOf(child));\n context.skipOpaqueBlock(line.indent);\n }\n return { kind: 'SpecificationParameterSyntax', name: property.name, type: property.type, location: locationOf(line) };\n}\n\nexport function parseCase(context: ParserContext, line: SourceLine): SpecificationCaseSyntax | null {\n const match = caseHeader.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationCase, \"Expected 'case <Name>' with at most one inline parameter assignment.\", locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return null;\n }\n const values: PropertyMappingSyntax[] = [];\n const add = (property: string, text: string, owner: SourceLine) => {\n const location = locationOf(owner);\n const valueLocation = { ...location, column: location.column + owner.content.indexOf(text, owner.content.indexOf('=') + 1) };\n if (text.startsWith('case.')) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseValue, 'A case assigns concrete values, not case references.', valueLocation);\n return;\n }\n const source = parseConcrete(context, text, valueLocation, DiagnosticCodes.InvalidSpecificationCaseValue);\n if (source !== null) values.push({ kind: 'PropertyMappingSyntax', property, source, location: owner === line ? { ...location, column: location.column + match.indices!.groups!.property[0] } : location });\n };\n if (match.groups?.property !== undefined) add(match.groups.property, match.groups.value, line);\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = assignment.exec(child.content);\n if (value === null) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, \"Expected '<parameter> = <concrete value>' in a case.\", locationOf(child));\n context.skipOpaqueBlock(child.indent);\n continue;\n }\n add(value[1], value[2], child);\n const nested = context.peekChild(child.indent);\n if (nested !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseValue, 'A case value must fit on one line.', locationOf(nested));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'SpecificationCaseSyntax', name: match[1], values, location: locationOf(line) };\n}\n\nexport function caseReferences(value: unknown): CaseValueExpressionSyntax[] {\n if (Array.isArray(value)) return value.flatMap(caseReferences);\n if (value === null || typeof value !== 'object') return [];\n if ('kind' in value && value.kind === 'CaseValueExpressionSyntax') return [value as CaseValueExpressionSyntax];\n return Object.values(value).flatMap(caseReferences);\n}\n\nexport function validateTable(specification: SpecificationSyntax, context: ParserContext): void {\n const parameters = specification.parameters ?? [];\n const cases = specification.cases ?? [];\n if ((parameters.length === 0) !== (cases.length === 0)) context.error(DiagnosticCodes.IncompleteSpecificationTable, 'A specification table requires parameters and at least one case.', specification.location);\n parameters.forEach((parameter, index) => {\n if (parameters.slice(0, index).some(prior => prior.name === parameter.name)) context.error(DiagnosticCodes.DuplicateSpecificationParameter, `Parameter '${parameter.name}' is declared more than once.`, parameter.location);\n });\n cases.forEach((row, index) => {\n if (cases.slice(0, index).some(prior => prior.name === row.name)) context.error(DiagnosticCodes.DuplicateSpecificationCase, `Case '${row.name}' is declared more than once.`, row.location);\n for (const value of row.values.filter(value => !parameters.some(parameter => parameter.name === value.property))) context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, `Case '${row.name}' assigns undeclared parameter '${value.property}'.`, value.location);\n for (const parameter of parameters.filter(parameter => row.values.filter(value => value.property === parameter.name).length !== 1)) context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, `Case '${row.name}' must assign parameter '${parameter.name}' exactly once.`, row.location);\n });\n const references = caseReferences(specification);\n for (const value of references) {\n if (cases.length === 0 || !parameters.some(parameter => parameter.name === value.parameter)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, `Case reference '${value.parameter}' requires a declared parameter in a specification table.`, value.location);\n }\n for (const parameter of parameters.filter(parameter => !references.some(value => value.parameter === parameter.name))) context.warning(DiagnosticCodes.UnusedSpecificationParameter, `Parameter '${parameter.name}' is never referenced.`, parameter.location);\n for (const value of caseReferences(specification.whenRedelivered)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'Case references are not permitted in redelivery locators.', value.location);\n}\n\nexport function substituteCase<T>(value: T, row: SpecificationCaseSyntax, copies = new WeakMap<object, unknown>()): T {\n if (value !== null && typeof value === 'object' && copies.has(value)) return copies.get(value) as T;\n if (Array.isArray(value)) {\n const result = value.map(item => substituteCase(item, row, copies));\n copies.set(value, result);\n return result as T;\n }\n if (value === null || typeof value !== 'object' || !('kind' in value)) return value;\n if (value.kind === 'CaseValueExpressionSyntax') {\n const parameter = (value as unknown as CaseValueExpressionSyntax).parameter;\n return (row.values.find(value => value.property === parameter)?.source ?? value) as T;\n }\n const result = Object.fromEntries(Object.entries(value).map(([key, item]) => [key, substituteCase(item, row, copies)]));\n if (value.kind === 'SpecificationErrorSyntax' && 'caseValue' in value && value.caseValue !== undefined) {\n const source = result.caseValue as ExpressionSyntax;\n result.name = source.kind === 'LiteralExpressionSyntax' ? source.value : null;\n delete result.caseValue;\n }\n copies.set(value, result);\n return result as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EAElE,OADAA,EAAO,IAAIV,EAAOW,CAAM,EACjBA,CACX,CACA,GAAsB,OAAOX,GAAU,WAAnCA,GAA+C,EAAE,SAAUA,GAAQ,OAAOA,EAC9E,GAAIA,EAAM,OAAS,4BAA6B,CAC5C,IAAMO,EAAaP,EAA+C,UAClE,OAAQQ,EAAI,OAAO,KAAK,GAASR,EAAM,WAAaO,CAAS,CAAC,EAAE,QAAUP,CAC9E,CACA,IAAMW,EAAS,OAAO,YAAY,OAAO,QAAQX,CAAK,CAAC,CAAC,KAAK,CAACa,EAAKD,KAAU,CAACC,EAAK,eAAeD,EAAMJ,EAAKE,CAAM,CAAC,CAAC,CAAC,EACtH,GAAIV,EAAM,OAAS,4BAA8B,cAAeA,GAASA,EAAM,YAAc,IAAA,GAAW,CACpG,IAAMF,EAASa,EAAO,UACtB,EAAO,KAAOb,EAAO,OAAS,0BAA4BA,EAAO,MAAQ,KACzE,OAAOa,EAAO,SAClB,CAEA,OADAD,EAAO,IAAIV,EAAOW,CAAM,EACjBA,CACX"}
@@ -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{specificationExamples as r}from"./SpecificationCommandExamples.js";import{compatibleValue as i}from"./ResponseValidator.js";import{commandDestinationType as a}from"./CommandDestinationTypes.js";import{RefusalDeclarations as o}from"./RefusalDeclarations.js";const s=/* @__PURE__ */ new Set([`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`]);function validateSpecificationCases(t,a,c){let l=new o(t),u=r(t),knownType=e=>s.has(e)||l.concepts.has(e)||l.types.has(e),d=new Map([...l.types].map(([e,t])=>[e,new Map(t.properties.map(e=>[e.name,e]))])),f=c===void 0?l.slices:[{scope:[],slice:{kind:`SliceSyntax`,type:`StateChange`,name:``,description:null,location:t.location,events:[],commands:[],queries:[],projections:[],captures:[],reactions:[],constraints:[],readModels:[],screens:[],specifications:c}}];for(let{slice:r,scope:o}of f){let s=/* @__PURE__ */ new Map;for(let e of r.specifications){let t=(e.cases?.length??0)===0?[e.name]:e.cases.map(t=>`${e.name}_${t.name}`);for(let e of t)s.set(e,(s.get(e)??0)+1);(e.cases?.length??0)>0&&s.set(e.name,(s.get(e.name)??0)+1)}for(let f of r.specifications){for(let t of f.cases??[])(s.get(`${f.name}_${t.name}`)??0)>1&&a.error(e.SpecificationCaseNameCollision,`Case '${t.name}' derives specification '${f.name}_${t.name}', which collides in this ${c===void 0?`slice`:`document`}.`,t.location);for(let t of f.parameters??[]){c===void 0&&!knownType(t.type.name)&&a.error(e.IncompatibleSpecificationParameterType,`Parameter '${t.name}' has unknown type '${t.type.name}'.`,t.type.location);for(let n of f.cases??[])for(let r of n.values.filter(e=>e.property===t.name))i(r.source,t.type,l.concepts,d)||a.error(e.InvalidSpecificationCaseValue,`Case '${n.name}' parameter '${t.name}' requires a concrete value of type '${t.type.name}'.`,r.source.location)}let check=(t,n,r)=>{if(t?.kind!==`CaseValueExpressionSyntax`||n===void 0)return;let i=f.parameters?.find(e=>e.name===t.parameter);if(i===void 0||(i.type.isOptional&&!n.isOptional&&a.error(e.OptionalSpecificationParameterTarget,`Optional parameter '${i.name}' cannot supply required target '${r}'.`,t.location),c!==void 0&&(!knownType(i.type.name)||!knownType(n.name))))return;let o=l.concepts.get(i.type.name),s=l.concepts.get(n.name);(!(i.type.name===n.name||o?.type!==`Enum`&&o?.type===n.name||s?.type!==`Enum`&&s?.type===i.type.name)||i.type.isCollection!==n.isCollection)&&a.error(e.IncompatibleSpecificationParameterType,`Parameter '${i.name}' type '${i.type.name}' is incompatible with target '${r}' type '${n.name}'.`,t.location)},assignments=(e,t)=>{for(let n of e)check(n.source,l.property(t,n.property)?.type,n.property)},p=u.command(f.when,o);if(p!==null){let e=l.resolve(p.commandType,r,e=>e.commands)?.node.properties??null;assignments(p.values,e),assignments(p.generatedValues??[],e),check(p.for,e?.find(e=>e.isIdentifier)?.type,`for`)}if(p!==null&&f.thenReturns!=null){let e=l.resolve(p.commandType,r,e=>e.commands)?.node,t=e?.response;if(f.thenReturns.kind===`ScalarSpecificationReturnSyntax`&&t?.kind===`ScalarCommandResponseSyntax`&&check(f.thenReturns.value,e?.properties.find(e=>e.name===t.source.property)?.type,`value`),f.thenReturns.kind===`RecordSpecificationReturnSyntax`&&t?.kind===`RecordCommandResponseSyntax`)for(let n of f.thenReturns.fields){let r=t.fields.find(e=>e.name===n.property);check(n.source,r?.type??e?.properties.find(e=>e.name===r?.source.property)?.type,n.property)}}for(let e of[...f.given,...f.thenEvents,...f.whenAppended===null?[]:[f.whenAppended]]){let i=u.eventStep(e,`given`,o).effective;assignments(i.values,l.event(i.eventType,r)?.properties??null);let a=i.stream==null?null:new n(t).resolve(i.stream.eventSource,i.stream.stream),s=a?.kind===`unique`?a.sources[0]:void 0,c=a?.kind===`unique`?a.streams[0]:void 0;check(i.for,i.stream!=null&&s===void 0?void 0:s?.identifier??eventDestinationType(i.eventType,r,t,l),`for`),i.stream?.streamId!=null&&check(i.stream.streamId.source,c?.streamId??void 0,`streamId`);for(let e of i.stream?.streamIdParts??[])check(e.source,c?.streamIdParts.find(t=>t.name===e.property)?.type,e.property)}for(let e of[...f.givenReadModels,...f.thenReadModels]){let t=u.readModel(e,o);assignments(t.properties,l.resolve(t.name,r,e=>e.readModels)?.node.properties??null)}if(f.whenTrigger!=null){let e=(t.declaredTriggers??[]).find(e=>e.name===f.whenTrigger.trigger);for(let t of f.whenTrigger.values)check(t.source,e?.data.find(e=>e.name===t.property)?.type,t.property)}for(let e of f.thenErrors)check(e.caseValue??null,{kind:`TypeRefSyntax`,name:`String`,isOptional:!1,isCollection:!1,location:e.location},`message`);for(let e of f.thenAbsentReadModels??[]){let t=l.resolve(e.name,r,e=>e.readModels)?.node,n=l.slices.flatMap(({slice:e})=>e.queries.filter(n=>n.by!==null&&l.resolve(n.returnType.name,e,e=>e.readModels)?.node===t));check(e.key,t!==void 0&&n.length===1?n[0].by.type:void 0,`for`)}for(let e of[...f.thenQueries??[],...f.whenQuery===null?[]:[f.whenQuery]]){let t=l.resolve(e.query,r,e=>e.queries),n=t===null?[]:[...t.node.by===null?[]:[t.node.by],...t.node.filters].map(e=>({...e,kind:`PropertySyntax`,isIdentifier:!1}));assignments(e.arguments,n);let i=t===null?null:l.resolve(t.node.returnType.name,t.slice,e=>e.readModels)?.node.properties??null,a=e.kind===`SpecificationQuerySyntax`?e.results:f.thenResults;for(let e of a)assignments(e.properties,i)}}}}function uniqueDestinationType(e){let t=new Map(e.map(e=>[JSON.stringify([e.name,e.isOptional,e.isCollection]),e]));return t.size===1?[...t.values()][0]:void 0}function eventDestinationType(e,n,r,i){let o=new t(r),s=i.event(e,n);if(s===null)return;let commandTypes=(e,t=i.slices)=>t.flatMap(({slice:t})=>t.commands.flatMap(n=>n.produces.filter(n=>o.isEventProduction(n,t)&&i.event(n.event,t)===e).map(e=>a(n,e,r,{resolver:o,slice:t})).filter(e=>e!==null))),producerTypes=(e,t)=>{if(t.has(e))return[];t.add(e);let n=commandTypes(e);for(let{slice:a}of i.slices){for(let o of a.reactions.flatMap(e=>e.triggers)){let s=o.source.kind===`NamedTriggerSourceSyntax`?o.source.name:void 0,c=s===void 0?null:i.event(s,a);for(let l of o.produces.filter(t=>i.event(t.event,a)===e))if(l.for?.kind===`PathExpressionSyntax`){let e=l.for.path,t=i.property(c?.properties??null,e)?.type??(s===void 0?void 0:(r.declaredTriggers??[]).find(e=>e.name===s)?.data.find(t=>t.name===e)?.type);t!==void 0&&n.push(t)}else l.for?.kind===`LiteralExpressionSyntax`?n.push({kind:`TypeRefSyntax`,name:`String`,isOptional:!1,isCollection:!1,location:l.location}):l.for===null&&c!==null&&n.push(...producerTypes(c,t))}a.captures.flatMap(e=>[...e.appends,...e.children.flatMap(e=>e.appends),...e.nested.flatMap(e=>e.appends)]).some(t=>i.event(t.event,a)===e)&&n.push(uniqueDestinationType(commandTypes(e))??{kind:`TypeRefSyntax`,name:`String`,isOptional:!1,isCollection:!1,location:e.location})}return n};return uniqueDestinationType(commandTypes(s,i.slices.filter(e=>e.slice===n)))??uniqueDestinationType(commandTypes(s))??uniqueDestinationType(producerTypes(s,/* @__PURE__ */ new Set))}export{validateSpecificationCases};
2
+ //# sourceMappingURL=SpecificationCaseValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecificationCaseValidator.js","names":["primitives","declarations","RefusalDeclarations","application","examples","specificationExamples","name","composites","type","property","owners","standaloneSpecifications","names","specification","slice","expandedNames","row","context","DiagnosticCodes","parameter","assignment","value","compatibleValue","expression","target","sourceConcept","targetConcept","values","properties","command","scope","declaration","response","field","authored","event","route","EventSourceCatalog","source","stream","part","model","trigger","error","absent","keyed","owner","query","parameters","results","result","distinct","types","resolver","AuthoringProductionResolver","reference","local","produced","commandDestinationType","visited","reaction","sourceName","path","declared","capture","child","nested","append"],"sources":["../../../../../../Compiler/Parsing/SpecificationCaseValidator.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, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { commandDestinationType } from './CommandDestinationTypes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { compatibleValue } from './ResponseValidator';\nimport { specificationExamples } from './SpecificationCommandExamples';\n\nconst primitives = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\nexport function validateSpecificationCases(application: ApplicationSyntax, context: ParserContext, standaloneSpecifications?: readonly SpecificationSyntax[]): void {\n const declarations = new RefusalDeclarations(application);\n const examples = specificationExamples(application);\n const knownType = (name: string) => primitives.has(name) || declarations.concepts.has(name) || declarations.types.has(name);\n const composites = new Map([...declarations.types].map(([name, type]) => [name, new Map(type.properties.map(property => [property.name, property]))]));\n const owners = standaloneSpecifications === undefined ? declarations.slices : [{ scope: [], slice: {\n kind: 'SliceSyntax' as const, type: 'StateChange' as const, name: '', description: null, location: application.location,\n events: [], commands: [], queries: [], projections: [], captures: [], reactions: [], constraints: [], readModels: [], screens: [], specifications: standaloneSpecifications,\n } }];\n for (const { slice, scope } of owners) {\n const names = new Map<string, number>();\n for (const specification of slice.specifications) {\n const expandedNames = (specification.cases?.length ?? 0) === 0 ? [specification.name] : specification.cases!.map(row => `${specification.name}_${row.name}`);\n for (const name of expandedNames) names.set(name, (names.get(name) ?? 0) + 1);\n if ((specification.cases?.length ?? 0) > 0) names.set(specification.name, (names.get(specification.name) ?? 0) + 1);\n }\n for (const specification of slice.specifications) {\n for (const row of specification.cases ?? []) {\n if ((names.get(`${specification.name}_${row.name}`) ?? 0) > 1) context.error(DiagnosticCodes.SpecificationCaseNameCollision, `Case '${row.name}' derives specification '${specification.name}_${row.name}', which collides in this ${standaloneSpecifications === undefined ? 'slice' : 'document'}.`, row.location);\n }\n for (const parameter of specification.parameters ?? []) {\n if (standaloneSpecifications === undefined && !knownType(parameter.type.name)) context.error(DiagnosticCodes.IncompatibleSpecificationParameterType, `Parameter '${parameter.name}' has unknown type '${parameter.type.name}'.`, parameter.type.location);\n for (const row of specification.cases ?? []) {\n for (const assignment of row.values.filter(value => value.property === parameter.name)) {\n if (!compatibleValue(assignment.source, parameter.type, declarations.concepts, composites)) context.error(DiagnosticCodes.InvalidSpecificationCaseValue, `Case '${row.name}' parameter '${parameter.name}' requires a concrete value of type '${parameter.type.name}'.`, assignment.source.location);\n }\n }\n }\n const check = (expression: ExpressionSyntax | null, target: TypeRefSyntax | undefined, property: string) => {\n if (expression?.kind !== 'CaseValueExpressionSyntax' || target === undefined) return;\n const parameter = specification.parameters?.find(parameter => parameter.name === expression.parameter);\n if (parameter === undefined) return;\n if (parameter.type.isOptional && !target.isOptional) context.error(DiagnosticCodes.OptionalSpecificationParameterTarget, `Optional parameter '${parameter.name}' cannot supply required target '${property}'.`, expression.location);\n if (standaloneSpecifications !== undefined && (!knownType(parameter.type.name) || !knownType(target.name))) return;\n const sourceConcept = declarations.concepts.get(parameter.type.name);\n const targetConcept = declarations.concepts.get(target.name);\n const compatible = parameter.type.name === target.name || sourceConcept?.type !== 'Enum' && sourceConcept?.type === target.name || targetConcept?.type !== 'Enum' && targetConcept?.type === parameter.type.name;\n if (!compatible || parameter.type.isCollection !== target.isCollection) context.error(DiagnosticCodes.IncompatibleSpecificationParameterType, `Parameter '${parameter.name}' type '${parameter.type.name}' is incompatible with target '${property}' type '${target.name}'.`, expression.location);\n };\n const assignments = (values: readonly PropertyMappingSyntax[], properties: readonly PropertySyntax[] | null) => {\n for (const value of values) check(value.source, declarations.property(properties, value.property)?.type, value.property);\n };\n const command = examples.command(specification.when, scope);\n if (command !== null) {\n const properties = declarations.resolve(command.commandType, slice, slice => slice.commands)?.node.properties ?? null;\n assignments(command.values, properties);\n assignments(command.generatedValues ?? [], properties);\n check(command.for, properties?.find(property => property.isIdentifier)?.type, 'for');\n }\n if (command !== null && specification.thenReturns != null) {\n const declaration = declarations.resolve(command.commandType, slice, slice => slice.commands)?.node;\n const response = declaration?.response;\n if (specification.thenReturns.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax') check(specification.thenReturns.value, declaration?.properties.find(property => property.name === response.source.property)?.type, 'value');\n if (specification.thenReturns.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n for (const value of specification.thenReturns.fields) {\n const field = response.fields.find(field => field.name === value.property);\n check(value.source, field?.type ?? declaration?.properties.find(property => property.name === field?.source.property)?.type, value.property);\n }\n }\n }\n for (const authored of [...specification.given, ...specification.thenEvents, ...(specification.whenAppended === null ? [] : [specification.whenAppended])]) {\n const event = examples.eventStep(authored, 'given', scope).effective as typeof authored;\n assignments(event.values, declarations.event(event.eventType, slice)?.properties ?? null);\n const route = event.stream == null ? null : new EventSourceCatalog(application).resolve(event.stream.eventSource, event.stream.stream);\n const source = route?.kind === EventSourceResolutionKind.Unique ? route.sources[0] : undefined;\n const stream = route?.kind === EventSourceResolutionKind.Unique ? route.streams[0] : undefined;\n check(event.for, event.stream != null && source === undefined ? undefined : source?.identifier ?? eventDestinationType(event.eventType, slice, application, declarations), 'for');\n if (event.stream?.streamId != null) check(event.stream.streamId.source, stream?.streamId ?? undefined, 'streamId');\n for (const part of event.stream?.streamIdParts ?? []) check(part.source, stream?.streamIdParts.find(declaration => declaration.name === part.property)?.type, part.property);\n }\n for (const authored of [...specification.givenReadModels, ...specification.thenReadModels]) {\n const model = examples.readModel(authored, scope);\n assignments(model.properties, declarations.resolve(model.name, slice, slice => slice.readModels)?.node.properties ?? null);\n }\n if (specification.whenTrigger != null) {\n const trigger = (application.declaredTriggers ?? []).find(trigger => trigger.name === specification.whenTrigger!.trigger);\n for (const value of specification.whenTrigger.values) check(value.source, trigger?.data.find(property => property.name === value.property)?.type, value.property);\n }\n for (const error of specification.thenErrors) check(error.caseValue ?? null, { kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: error.location }, 'message');\n for (const absent of specification.thenAbsentReadModels ?? []) {\n const model = declarations.resolve(absent.name, slice, slice => slice.readModels)?.node;\n const keyed = declarations.slices.flatMap(({ slice: owner }) => owner.queries.filter(query => query.by !== null && declarations.resolve(query.returnType.name, owner, slice => slice.readModels)?.node === model));\n check(absent.key, model !== undefined && keyed.length === 1 ? keyed[0].by!.type : undefined, 'for');\n }\n for (const query of [...(specification.thenQueries ?? []), ...(specification.whenQuery === null ? [] : [specification.whenQuery])]) {\n const declaration = declarations.resolve(query.query, slice, slice => slice.queries);\n const parameters = declaration === null ? [] : [...(declaration.node.by === null ? [] : [declaration.node.by]), ...declaration.node.filters].map(parameter => ({ ...parameter, kind: 'PropertySyntax' as const, isIdentifier: false }));\n assignments(query.arguments, parameters);\n const properties = declaration === null ? null : declarations.resolve(declaration.node.returnType.name, declaration.slice, slice => slice.readModels)?.node.properties ?? null;\n const results = query.kind === 'SpecificationQuerySyntax' ? query.results : specification.thenResults;\n for (const result of results) assignments(result.properties, properties);\n }\n }\n }\n}\n\nfunction uniqueDestinationType(types: readonly TypeRefSyntax[]): TypeRefSyntax | undefined {\n const distinct = new Map(types.map(type => [JSON.stringify([type.name, type.isOptional, type.isCollection]), type]));\n return distinct.size === 1 ? [...distinct.values()][0] : undefined;\n}\n\nfunction eventDestinationType(reference: string, local: SliceSyntax, application: ApplicationSyntax, declarations: RefusalDeclarations): TypeRefSyntax | undefined {\n const resolver = new AuthoringProductionResolver(application);\n const event = declarations.event(reference, local);\n if (event === null) return undefined;\n const commandTypes = (event: EventSyntax, owners = declarations.slices): TypeRefSyntax[] => owners.flatMap(({ slice }) => slice.commands.flatMap(command => command.produces\n .filter(produced => resolver.isEventProduction(produced, slice) && declarations.event(produced.event, slice) === event)\n .map(produced => commandDestinationType(command, produced, application, { resolver, slice })).filter((type): type is TypeRefSyntax => type !== null)));\n const producerTypes = (event: EventSyntax, visited: Set<EventSyntax>): TypeRefSyntax[] => {\n if (visited.has(event)) return [];\n visited.add(event);\n const types = commandTypes(event);\n for (const { slice } of declarations.slices) {\n for (const trigger of slice.reactions.flatMap(reaction => reaction.triggers)) {\n const sourceName = trigger.source.kind === 'NamedTriggerSourceSyntax' ? trigger.source.name : undefined;\n const source = sourceName === undefined ? null : declarations.event(sourceName, slice);\n for (const produced of trigger.produces.filter(produced => declarations.event(produced.event, slice) === event)) {\n if (produced.for?.kind === 'PathExpressionSyntax') {\n const path = produced.for.path;\n const type = declarations.property(source?.properties ?? null, path)?.type ?? (sourceName === undefined ? undefined\n : (application.declaredTriggers ?? []).find(declared => declared.name === sourceName)?.data.find(property => property.name === path)?.type);\n if (type !== undefined) types.push(type);\n } else if (produced.for?.kind === 'LiteralExpressionSyntax') types.push({ kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: produced.location });\n else if (produced.for === null && source !== null) types.push(...producerTypes(source, visited));\n }\n }\n if (slice.captures.flatMap(capture => [...capture.appends, ...capture.children.flatMap(child => child.appends), ...capture.nested.flatMap(nested => nested.appends)]).some(append => declarations.event(append.event, slice) === event))\n types.push(uniqueDestinationType(commandTypes(event)) ?? { kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: event.location });\n }\n return types;\n };\n return uniqueDestinationType(commandTypes(event, declarations.slices.filter(owner => owner.slice === local))) ?? uniqueDestinationType(commandTypes(event)) ?? uniqueDestinationType(producerTypes(event, new Set()));\n}\n"],"mappings":"6hBAiBA,MAAMA,kBAAa,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAE3F,SAAgB,2BAA2B,EAAgC,EAAwB,EAAiE,CAChK,IAAMC,EAAe,IAAIC,EAAoBC,CAAW,EAClDC,EAAWC,EAAsBF,CAAW,EAC5C,UAAa,GAAiBH,EAAW,IAAIM,CAAI,GAAKL,EAAa,SAAS,IAAIK,CAAI,GAAKL,EAAa,MAAM,IAAIK,CAAI,EACpHC,EAAa,IAAI,IAAI,CAAC,GAAGN,EAAa,KAAK,CAAC,CAAC,KAAK,CAACK,EAAME,KAAU,CAACF,EAAM,IAAI,IAAIE,EAAK,WAAW,IAAI,GAAY,CAACC,EAAS,KAAMA,CAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/IC,EAASC,IAA6B,IAAA,GAAYV,EAAa,OAAS,CAAC,CAAE,MAAO,CAAC,EAAG,MAAO,CAC/F,KAAM,cAAwB,KAAM,cAAwB,KAAM,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