@cratis/screenplay-language 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
  2. package/dist/bundles/action-subject-authoring.js.map +1 -1
  3. package/dist/bundles/bmp-word-characters.js.map +1 -1
  4. package/dist/bundles/case-authoring.js +1 -1
  5. package/dist/bundles/case-authoring.js.map +1 -1
  6. package/dist/bundles/code-actions.js.map +1 -1
  7. package/dist/bundles/command-read-completions.js.map +1 -1
  8. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
  9. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
  10. package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  12. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
  13. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
  14. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
  15. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
  16. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
  17. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
  18. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
  19. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
  20. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
  21. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
  22. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
  23. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
  24. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
  25. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
  26. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
  27. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  30. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
  32. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
  37. package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  39. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  40. package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
  41. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  42. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  43. package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
  44. package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
  45. package/dist/bundles/compiler/Files/PlayImports.js +1 -1
  46. package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
  47. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
  48. package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
  49. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
  50. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
  51. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
  52. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
  53. package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
  54. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
  55. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
  56. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
  57. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
  58. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
  59. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
  60. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
  61. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
  62. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
  63. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
  64. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
  65. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
  66. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +1 -1
  67. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -1
  68. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
  69. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
  70. package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
  71. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  72. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  73. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  74. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
  75. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
  76. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
  77. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  78. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  79. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  80. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
  81. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  82. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
  83. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
  84. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
  85. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  86. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
  87. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  88. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  89. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
  90. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
  91. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  92. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  93. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  94. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
  95. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
  96. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
  97. package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
  98. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  99. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  100. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  101. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  102. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
  103. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  104. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
  105. package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
  106. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
  107. package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
  108. package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
  109. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  110. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
  111. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  112. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
  113. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  114. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  115. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
  116. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
  117. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  118. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
  119. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  120. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
  121. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
  122. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
  123. package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
  124. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
  125. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
  126. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  127. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  128. package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
  129. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  130. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
  131. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
  132. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  133. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  134. package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
  135. package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
  136. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  137. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  138. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  139. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
  140. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
  141. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  142. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  143. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
  144. package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
  145. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
  146. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  147. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
  148. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  149. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
  150. package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
  151. package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
  152. package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
  153. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
  154. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
  155. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
  156. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
  157. package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
  158. package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
  159. package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
  160. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
  161. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
  162. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  163. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
  164. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
  165. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
  166. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
  167. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  168. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
  169. package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
  170. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
  171. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
  172. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
  173. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  174. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
  175. package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
  176. package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
  177. package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
  178. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
  179. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
  180. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  181. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  182. package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
  183. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
  184. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
  185. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  186. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
  187. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
  188. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
  189. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  190. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  191. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
  192. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
  193. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
  194. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
  195. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  196. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  197. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  198. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
  199. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
  200. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  201. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  202. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  203. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
  204. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  205. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  206. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
  207. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
  208. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
  209. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
  210. package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
  211. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
  212. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
  213. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
  214. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
  215. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
  216. package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
  217. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
  218. package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
  219. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
  220. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  221. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  222. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  223. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  224. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  225. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
  226. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  227. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
  228. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
  229. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
  230. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  231. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
  232. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  233. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
  234. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
  235. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
  236. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
  237. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
  238. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  239. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
  240. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  241. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  242. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
  243. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
  244. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  245. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
  246. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
  247. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
  248. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  249. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  250. package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
  251. package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
  252. package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
  253. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
  254. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
  255. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
  256. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
  257. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
  258. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  259. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  260. package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
  261. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
  262. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
  263. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
  264. package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
  265. package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
  266. package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
  267. package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
  268. package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
  269. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
  270. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  271. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  272. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
  273. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
  274. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
  275. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
  276. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
  277. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  278. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
  279. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
  280. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
  281. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
  282. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
  283. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
  284. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
  285. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
  286. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
  287. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  288. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
  289. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
  290. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
  291. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
  292. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  293. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  294. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  295. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  296. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  297. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  298. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
  299. package/dist/bundles/compiler/Syntax/index.js +1 -1
  300. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
  301. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
  302. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
  303. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
  304. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
  305. package/dist/bundles/compiler/Text/patterns.js.map +1 -1
  306. package/dist/bundles/compiler/index.js +1 -1
  307. package/dist/bundles/completion-items.js +4 -4
  308. package/dist/bundles/completion-items.js.map +1 -1
  309. package/dist/bundles/completion-planner.js +2 -2
  310. package/dist/bundles/completion-planner.js.map +1 -1
  311. package/dist/bundles/completions.js +1 -1
  312. package/dist/bundles/completions.js.map +1 -1
  313. package/dist/bundles/continuation-responses.js +1 -1
  314. package/dist/bundles/continuation-responses.js.map +1 -1
  315. package/dist/bundles/declarations.js.map +1 -1
  316. package/dist/bundles/dependency-completions.js.map +1 -1
  317. package/dist/bundles/dependency-target-analysis.js.map +1 -1
  318. package/dist/bundles/diagnostic-codes.js +1 -1
  319. package/dist/bundles/diagnostic-codes.js.map +1 -1
  320. package/dist/bundles/diagnostics.js +1 -1
  321. package/dist/bundles/diagnostics.js.map +1 -1
  322. package/dist/bundles/document-context.js.map +1 -1
  323. package/dist/bundles/documentation-item.js.map +1 -1
  324. package/dist/bundles/event-analysis-source.js.map +1 -1
  325. package/dist/bundles/event-context-catalog.js.map +1 -1
  326. package/dist/bundles/event-context.js.map +1 -1
  327. package/dist/bundles/event-source-authoring.js +11 -11
  328. package/dist/bundles/event-source-authoring.js.map +1 -1
  329. package/dist/bundles/example-analysis.js +2 -2
  330. package/dist/bundles/example-analysis.js.map +1 -1
  331. package/dist/bundles/example-authoring.js +2 -2
  332. package/dist/bundles/example-authoring.js.map +1 -1
  333. package/dist/bundles/example-declaration-items.js.map +1 -1
  334. package/dist/bundles/example-values.js.map +1 -1
  335. package/dist/bundles/file-imports.js.map +1 -1
  336. package/dist/bundles/file-references.js.map +1 -1
  337. package/dist/bundles/generation-completions.js.map +1 -1
  338. package/dist/bundles/hover-content.js +5 -5
  339. package/dist/bundles/hover-content.js.map +1 -1
  340. package/dist/bundles/hover.js.map +1 -1
  341. package/dist/bundles/index.js +1 -1
  342. package/dist/bundles/index.js.map +1 -1
  343. package/dist/bundles/inlay-hints.js.map +1 -1
  344. package/dist/bundles/inline-completions.js +1 -1
  345. package/dist/bundles/inline-completions.js.map +1 -1
  346. package/dist/bundles/inline-event-validation.js +1 -1
  347. package/dist/bundles/inline-event-validation.js.map +1 -1
  348. package/dist/bundles/keyword-docs.js.map +1 -1
  349. package/dist/bundles/language.js.map +1 -1
  350. package/dist/bundles/named-rule-context.js.map +1 -1
  351. package/dist/bundles/operation-authoring.js +6 -6
  352. package/dist/bundles/operation-authoring.js.map +1 -1
  353. package/dist/bundles/persona-analysis.js +1 -1
  354. package/dist/bundles/persona-analysis.js.map +1 -1
  355. package/dist/bundles/production-destinations.js +1 -1
  356. package/dist/bundles/production-destinations.js.map +1 -1
  357. package/dist/bundles/purpose-items.js.map +1 -1
  358. package/dist/bundles/reaction-authoring.js +3 -3
  359. package/dist/bundles/reaction-authoring.js.map +1 -1
  360. package/dist/bundles/read-model-key-completions.js +1 -1
  361. package/dist/bundles/read-model-key-completions.js.map +1 -1
  362. package/dist/bundles/refusal-context.js.map +1 -1
  363. package/dist/bundles/response-analysis.js.map +1 -1
  364. package/dist/bundles/response-completions.js +1 -1
  365. package/dist/bundles/response-completions.js.map +1 -1
  366. package/dist/bundles/response-tokens.js +2 -2
  367. package/dist/bundles/response-tokens.js.map +1 -1
  368. package/dist/bundles/scope-items.js +3 -3
  369. package/dist/bundles/scope-items.js.map +1 -1
  370. package/dist/bundles/structure-completions.js.map +1 -1
  371. package/dist/bundles/sub-language-registry.js.map +1 -1
  372. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
  373. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
  374. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
  375. package/dist/bundles/sub-languages/capture/index.js.map +1 -1
  376. package/dist/bundles/sub-languages/capture/language.js.map +1 -1
  377. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  378. package/dist/bundles/sub-languages/pdl.js.map +1 -1
  379. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
  380. package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
  381. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
  382. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
  383. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
  384. package/dist/bundles/sub-languages/projection/index.js.map +1 -1
  385. package/dist/bundles/sub-languages/projection/language.js.map +1 -1
  386. package/dist/bundles/symbols.js +2 -2
  387. package/dist/bundles/symbols.js.map +1 -1
  388. package/dist/bundles/themes/screenplay-dark.js.map +1 -1
  389. package/dist/bundles/themes/screenplay-light.js.map +1 -1
  390. package/dist/bundles/tokens.js.map +1 -1
  391. package/dist/bundles/validation.js +2 -2
  392. package/dist/bundles/validation.js.map +1 -1
  393. package/dist/diagnostic-codes.d.ts +1 -0
  394. package/dist/diagnostic-codes.d.ts.map +1 -1
  395. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ActionSubjectResolution.js","names":["diagnostics","resolver","ActionSubjectInputs","RefusalDeclarations","application","context","message","guarded","DiagnosticCodes","item","subject","parameter","authored","additions","parameters","input","effective","observe","action","fallback","alternative","node","inputs","local","directives","scope","inherited","slot","outlet","contribution","slice","module","diagnostic"],"sources":["../../../../../../Compiler/Parsing/ActionSubjectResolution.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 type { CompilationResult } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ScreenActionSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax, ScreenSyntax, ToolbarItemSyntax } from '../Syntax/Screens';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { ActionSubjectContext, ActionSubjectInputs } from './ActionSubjectInputs';\n\nexport interface ActionSubjectEvidence {\n readonly authored: ScreenActionSyntax | ToolbarItemSyntax;\n readonly effective: ScreenActionSyntax | ToolbarItemSyntax;\n readonly command: string;\n readonly context: ActionSubjectContext;\n}\n\nexport function resolveActionSubjectApplication(application: ApplicationSyntax, observe?: (evidence: ActionSubjectEvidence) => void): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const resolver = new ActionSubjectInputs(new RefusalDeclarations(application), diagnostics);\n const hasSubject = (context: ActionSubjectContext, guarded: boolean): boolean => {\n if (context.data.length === 1) return true;\n const message = guarded ? \"A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved\" : \"Action 'for item' requires one resolvable data subject - no item binding is inferred\";\n diagnostics.push({ severity: 'warning', code: DiagnosticCodes.UnresolvedActionSubject, message, location: context.location });\n return false;\n };\n const toolbar = (item: ToolbarItemSyntax, context: ActionSubjectContext): ToolbarItemSyntax => {\n if (item.syntaxKind !== 'Action') return item;\n const subject = resolver.subject(item.subject, item.target, item.parameters.map(parameter => parameter.name), context);\n const authored = item.parameters.map(parameter => ({ kind: 'InteractionArgumentSyntax' as const, name: parameter.name, binding: parameter.binding.path, location: parameter.location }));\n const additions = subject === 'Item' && hasSubject(context, false) ? resolver.inputs(item.target, authored, context).slice(authored.length) : [];\n const parameters = [...item.parameters, ...additions.map(input => ({ kind: 'ScreenNavigationParameterSyntax' as const, name: input.name, binding: { kind: 'UiBindingSyntax' as const, bindingKind: 'DataContext' as const, path: input.binding, query: null, componentId: null, componentPropertyPath: null, mode: null, nullBehavior: null, expectedValueType: null, literal: null, rawText: null, location: input.location }, location: input.location }))];\n const effective = subject == null && additions.length === 0 ? item : { ...item, subject, parameters };\n observe?.({ authored: item, effective, command: item.target, context });\n return effective;\n };\n const guarded = (action: ScreenGuardedActionSyntax, context: ActionSubjectContext): ScreenGuardedActionSyntax => {\n if (!hasSubject(context, true)) return action;\n if (action.subject === 'Screen' && context.data[0].type.isCollection) {\n diagnostics.push({ severity: 'warning', code: DiagnosticCodes.UnsupportedActionSubjectContext, message: \"A guarded action 'for screen' cannot use a collection as 'item' - use a single-record data context or 'for item'\", location: action.location });\n return action;\n }\n const fallback = action.otherwise;\n return { ...action,\n alternatives: action.alternatives.map(alternative => ({ ...alternative, arguments: resolver.inputs(alternative.command, alternative.arguments, { ...context, location: alternative.location }) })),\n otherwise: fallback !== null && fallback.command !== null ? { ...fallback, arguments: resolver.inputs(fallback.command, fallback.arguments, { ...context, location: fallback.location }) } : fallback,\n };\n };\n const plain = (node: ScreenActionSyntax, context: ActionSubjectContext): ScreenActionSyntax => {\n const subject = resolver.subject(node.subject, node.command, (node.inputs ?? []).map(input => input.name), context);\n const inputs = subject === 'Item' && hasSubject(context, false) ? resolver.inputs(node.command, node.inputs ?? [], context) : node.inputs;\n const effective = subject == null && inputs === node.inputs ? node : { ...node, subject, ...(inputs === undefined ? {} : { inputs }) };\n observe?.({ authored: node, effective, command: node.command, context });\n return effective;\n };\n const body = (directives: readonly ScreenDirectiveSyntax[], inherited: ActionSubjectContext): readonly ScreenDirectiveSyntax[] => {\n const local = directives.filter((node): node is Extract<ScreenDirectiveSyntax, { kind: 'ScreenDataSyntax' }> => node.kind === 'ScreenDataSyntax');\n const scope = { ...inherited, data: local.length > 0 ? local : inherited.data };\n return directives.map(node => {\n const context = { ...scope, location: node.location };\n switch (node.kind) {\n case 'ScreenActionSyntax': return plain(node, context);\n case 'ScreenGuardedActionSyntax': return guarded(node, context);\n case 'ScreenToolbarSyntax': return { ...node, items: node.items.map(item => toolbar(item, { ...context, location: item.location })) };\n case 'ScreenSectionSyntax': return { ...node, directives: body(node.directives, scope) };\n case 'ScreenTemplateReferenceSyntax': return { ...node, slots: node.slots.map(slot => ({ ...slot, directives: body(slot.directives, scope) })) };\n case 'ScreenComponentSyntax': return { ...node, outlets: node.outlets.map(outlet => ({ ...outlet, directives: body(outlet.directives, scope) })) };\n default: return node;\n }\n });\n };\n const screen = (node: ScreenSyntax, slice: SliceSyntax): ScreenSyntax => {\n const context = { data: [], slice, location: node.location };\n return { ...node, directives: body(node.directives, context), ...(node.contributions === undefined ? {} : { contributions: node.contributions.map(contribution => ({ ...contribution, directives: body(contribution.directives, context) })) }) };\n };\n const feature = (node: FeatureSyntax): FeatureSyntax => ({ ...node, features: node.features.map(feature), slices: node.slices.map(slice => ({ ...slice, screens: slice.screens.map(node => screen(node, slice)) })) });\n const value = { ...application, modules: application.modules.map(module => ({ ...module, features: module.features.map(feature) })) };\n return { value, diagnostics, success: !diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"uPAkBA,SAAgB,gCAAgC,EAAgC,EAA2F,CACvK,IAAMA,EAA4B,CAAC,EAC7BC,EAAW,IAAIC,EAAoB,IAAIC,EAAoBC,CAAW,EAAGJ,CAAW,EACpF,YAAc,EAA+B,IAA8B,CAC7E,GAAIK,EAAQ,KAAK,SAAW,EAAG,MAAO,GACtC,IAAMC,EAAUC,EAAU,8HAAgI,uFAE1J,OADAP,E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AEpN,MAAO,CAAE,MAAA,CADO,GAAG1B,EAAa,QAASA,EAAY,QAAQ,IAAI,IAAW,CAAE,GAAG2B,EAAQ,SAAUA,EAAO,SAAS,IAAI,OAAO,CAAE,EAAE,CACrH,EAAG,cAAa,QAAS,CAAC/B,EAAY,KAAK,GAAcgC,EAAW,WAAa,OAAO,CAAE,CAC3G"}
1
+ {"version":3,"file":"ActionSubjectResolution.js","names":["diagnostics","resolver","ActionSubjectInputs","RefusalDeclarations","application","context","message","guarded","DiagnosticCodes","item","subject","parameter","authored","additions","parameters","input","effective","observe","action","fallback","alternative","node","inputs","local","directives","scope","inherited","slot","outlet","contribution","slice","module","diagnostic"],"sources":["../../../../../../Compiler/Parsing/ActionSubjectResolution.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 type { CompilationResult } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ScreenActionSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax, ScreenSyntax, ToolbarItemSyntax } from '../Syntax/Screens';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { ActionSubjectContext, ActionSubjectInputs } from './ActionSubjectInputs';\n\nexport interface ActionSubjectEvidence {\n readonly authored: ScreenActionSyntax | ToolbarItemSyntax;\n readonly effective: ScreenActionSyntax | ToolbarItemSyntax;\n readonly command: string;\n readonly context: ActionSubjectContext;\n}\n\nexport function resolveActionSubjectApplication(application: ApplicationSyntax, observe?: (evidence: ActionSubjectEvidence) => void): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const resolver = new ActionSubjectInputs(new RefusalDeclarations(application), diagnostics);\n const hasSubject = (context: ActionSubjectContext, guarded: boolean): boolean => {\n if (context.data.length === 1) return true;\n const message = guarded ? \"A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved\" : \"Action 'for item' requires one resolvable data subject - no item binding is inferred\";\n diagnostics.push({ severity: 'warning', code: DiagnosticCodes.UnresolvedActionSubject, message, location: context.location });\n return false;\n };\n const toolbar = (item: ToolbarItemSyntax, context: ActionSubjectContext): ToolbarItemSyntax => {\n if (item.syntaxKind !== 'Action') return item;\n const subject = resolver.subject(item.subject, item.target, item.parameters.map(parameter => parameter.name), context);\n const authored = item.parameters.map(parameter => ({ kind: 'InteractionArgumentSyntax' as const, name: parameter.name, binding: parameter.binding.path, location: parameter.location }));\n const additions = subject === 'Item' && hasSubject(context, false) ? resolver.inputs(item.target, authored, context).slice(authored.length) : [];\n const parameters = [...item.parameters, ...additions.map(input => ({ kind: 'ScreenNavigationParameterSyntax' as const, name: input.name, binding: { kind: 'UiBindingSyntax' as const, bindingKind: 'DataContext' as const, path: input.binding, query: null, componentId: null, componentPropertyPath: null, mode: null, nullBehavior: null, expectedValueType: null, literal: null, rawText: null, location: input.location }, location: input.location }))];\n const effective = subject == null && additions.length === 0 ? item : { ...item, subject, parameters };\n observe?.({ authored: item, effective, command: item.target, context });\n return effective;\n };\n const guarded = (action: ScreenGuardedActionSyntax, context: ActionSubjectContext): ScreenGuardedActionSyntax => {\n if (!hasSubject(context, true)) return action;\n if (action.subject === 'Screen' && context.data[0].type.isCollection) {\n diagnostics.push({ severity: 'warning', code: DiagnosticCodes.UnsupportedActionSubjectContext, message: \"A guarded action 'for screen' cannot use a collection as 'item' - use a single-record data context or 'for item'\", location: action.location });\n return action;\n }\n const fallback = action.otherwise;\n return { ...action,\n alternatives: action.alternatives.map(alternative => ({ ...alternative, arguments: resolver.inputs(alternative.command, alternative.arguments, { ...context, location: alternative.location }) })),\n otherwise: fallback !== null && fallback.command !== null ? { ...fallback, arguments: resolver.inputs(fallback.command, fallback.arguments, { ...context, location: fallback.location }) } : fallback,\n };\n };\n const plain = (node: ScreenActionSyntax, context: ActionSubjectContext): ScreenActionSyntax => {\n const subject = resolver.subject(node.subject, node.command, (node.inputs ?? []).map(input => input.name), context);\n const inputs = subject === 'Item' && hasSubject(context, false) ? resolver.inputs(node.command, node.inputs ?? [], context) : node.inputs;\n const effective = subject == null && inputs === node.inputs ? node : { ...node, subject, ...(inputs === undefined ? {} : { inputs }) };\n observe?.({ authored: node, effective, command: node.command, context });\n return effective;\n };\n const body = (directives: readonly ScreenDirectiveSyntax[], inherited: ActionSubjectContext): readonly ScreenDirectiveSyntax[] => {\n const local = directives.filter((node): node is Extract<ScreenDirectiveSyntax, { kind: 'ScreenDataSyntax' }> => node.kind === 'ScreenDataSyntax');\n const scope = { ...inherited, data: local.length > 0 ? local : inherited.data };\n return directives.map(node => {\n const context = { ...scope, location: node.location };\n switch (node.kind) {\n case 'ScreenActionSyntax': return plain(node, context);\n case 'ScreenGuardedActionSyntax': return guarded(node, context);\n case 'ScreenToolbarSyntax': return { ...node, items: node.items.map(item => toolbar(item, { ...context, location: item.location })) };\n case 'ScreenSectionSyntax': return { ...node, directives: body(node.directives, scope) };\n case 'ScreenTemplateReferenceSyntax': return { ...node, slots: node.slots.map(slot => ({ ...slot, directives: body(slot.directives, scope) })) };\n case 'ScreenComponentSyntax': return { ...node, outlets: node.outlets.map(outlet => ({ ...outlet, directives: body(outlet.directives, scope) })) };\n default: return node;\n }\n });\n };\n const screen = (node: ScreenSyntax, slice: SliceSyntax): ScreenSyntax => {\n const context = { data: [], slice, location: node.location };\n return { ...node, directives: body(node.directives, context), ...(node.contributions === undefined ? {} : { contributions: node.contributions.map(contribution => ({ ...contribution, directives: body(contribution.directives, context) })) }) };\n };\n const feature = (node: FeatureSyntax): FeatureSyntax => ({ ...node, features: node.features.map(feature), slices: node.slices.map(slice => ({ ...slice, screens: slice.screens.map(node => screen(node, slice)) })) });\n const value = { ...application, modules: application.modules.map(module => ({ ...module, features: module.features.map(feature) })) };\n return { value, diagnostics, success: !diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}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AAY,KAAKA,EAAa,WAAYxB,CAAO,CAAE,EAAE,CAAE,CAAG,CACpP,EACM,QAAW,IAAwC,CAAE,GAAGgB,EAAM,SAAUA,EAAK,SAAS,IAAI,OAAO,EAAG,OAAQA,EAAK,OAAO,IAAI,IAAU,CAAE,GAAGS,EAAO,QAASA,EAAM,QAAQ,IAAI,GAAQ,OAAOT,EAAMS,CAAK,CAAC,CAAE,EAAE,CAAE,GAEpN,MAAO,CAAE,MAAA,CADO,GAAG1B,EAAa,QAASA,EAAY,QAAQ,IAAI,IAAW,CAAE,GAAG2B,EAAQ,SAAUA,EAAO,SAAS,IAAI,OAAO,CAAE,EAAE,CACrH,EAAG,cAAa,QAAS,CAAC/B,EAAY,KAAK,GAAcgC,EAAW,WAAa,OAAO,CAAE,CAC3G,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{contextRoots as i}from"./ExpressionParser.js";import{firstWord as a,unescapeIdentifier as o}from"./LineText.js";import{isDocumentPlacement as s}from"../Files/PlayPlacement.js";import{parseDescription as c}from"./DescriptionParser.js";const l=n(`^(@?[a-z_]\\w*)${t}+(.+)$`),u=n(`^time${t}+zone$`);function parseApplicationContext(t,n,i,o){if(n.content!==`context`||!s(o)||i!==null)return t.error(e.InvalidContextDeclaration,`Declare 'context' once at the application root.`,r(n)),t.skipBlock(n.indent),i;let l=[],u=/* @__PURE__ */ new Set,d={},f=null;for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),a(e.content)===`description`){let n=f;f=c(t,e,f,`Context`),n===null&&f!==null&&(d.description=r(e))}else parseMember(t,e,l,u);return{kind:`ApplicationContextSyntax`,members:l,description:f,directiveLocations:d,location:r(n)}}function parseMember(t,n,a,s){if(t.peekChild(n.indent)!==void 0){t.error(e.InvalidContextDeclaration,`A context member cannot have a body.`,r(n)),t.skipBlock(n.indent);return}let c=l.exec(n.content);if(c===null){t.error(e.InvalidContextDeclaration,`Invalid context member '${n.content}' - expected '<name> time zone'.`,r(n));return}if(!u.test(c[2])){t.error(e.UnknownContextMemberType,`Unknown context member type '${c[2]}' - expected 'time zone'.`,r(n));return}let d=o(c[1]);d===`timeZone`||i.includes(d)?t.error(e.ReservedContextMemberName,`The context member name '${d}' is reserved.`,r(n)):s.has(d)?t.error(e.DuplicateContextMember,`The context member '${d}' is already declared.`,r(n)):(s.add(d),a.push({kind:`ContextMemberSyntax`,name:d,location:r(n)}))}export{parseApplicationContext};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{isDocumentPlacement as t}from"../Files/PlayPlacement.js";import{dotNetWhitespace as n,nativePattern as r}from"../Text/patterns.js";import{parseDescription as i}from"./DescriptionParser.js";import{contextRoots as a}from"./ExpressionParser.js";import{firstWord as o,unescapeIdentifier as s}from"./LineText.js";import{locationOf as c}from"./SourceLine.js";const l=r(`^(@?[a-z_]\\w*)${n}+(.+)$`),u=r(`^time${n}+zone$`);function parseApplicationContext(n,r,a,s){if(r.content!==`context`||!t(s)||a!==null)return n.error(e.InvalidContextDeclaration,`Declare 'context' once at the application root.`,c(r)),n.skipBlock(r.indent),a;let l=[],u=/* @__PURE__ */ new Set,d={},f=null;for(let e=n.peekChild(r.indent);e!==void 0;e=n.peekChild(r.indent))if(n.reader.takeSignificant(),o(e.content)===`description`){let t=f;f=i(n,e,f,`Context`),t===null&&f!==null&&(d.description=c(e))}else parseMember(n,e,l,u);return{kind:`ApplicationContextSyntax`,members:l,description:f,directiveLocations:d,location:c(r)}}function parseMember(t,n,r,i){if(t.peekChild(n.indent)!==void 0){t.error(e.InvalidContextDeclaration,`A context member cannot have a body.`,c(n)),t.skipBlock(n.indent);return}let o=l.exec(n.content);if(o===null){t.error(e.InvalidContextDeclaration,`Invalid context member '${n.content}' - expected '<name> time zone'.`,c(n));return}if(!u.test(o[2])){t.error(e.UnknownContextMemberType,`Unknown context member type '${o[2]}' - expected 'time zone'.`,c(n));return}let d=s(o[1]);d===`timeZone`||a.includes(d)?t.error(e.ReservedContextMemberName,`The context member name '${d}' is reserved.`,c(n)):i.has(d)?t.error(e.DuplicateContextMember,`The context member '${d}' is already declared.`,c(n)):(i.add(d),r.push({kind:`ContextMemberSyntax`,name:d,location:c(n)}))}export{parseApplicationContext};
2
2
  //# sourceMappingURL=ApplicationContextParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationContextParser.js","names":["memberPattern","nativePattern","dotNetWhitespace","memberTypePattern","header","isDocumentPlacement","placement","existing","context","DiagnosticCodes","locationOf","members","names","directiveLocations","description","line","firstWord","previous","parseDescription","match","name","unescapeIdentifier","contextRoots"],"sources":["../../../../../../Compiler/Parsing/ApplicationContextParser.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 { isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { ApplicationContextSyntax, ContextMemberSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { contextRoots } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst memberPattern = nativePattern(`^(@?[a-z_]\\\\w*)${dotNetWhitespace}+(.+)$`);\nconst memberTypePattern = nativePattern(`^time${dotNetWhitespace}+zone$`);\n\nexport function parseApplicationContext(context: ParserContext, header: SourceLine, existing: ApplicationContextSyntax | null, placement: PlayPlacement): ApplicationContextSyntax | null {\n if (header.content !== 'context' || !isDocumentPlacement(placement) || existing !== null) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, \"Declare 'context' once at the application root.\", locationOf(header));\n context.skipBlock(header.indent);\n return existing;\n }\n const members: ContextMemberSyntax[] = [];\n const names = new Set<string>();\n const directiveLocations: Record<string, SourceLocation> = {};\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n const previous = description;\n description = parseDescription(context, line, description, 'Context');\n if (previous === null && description !== null) directiveLocations.description = locationOf(line);\n continue;\n }\n parseMember(context, line, members, names);\n }\n return { kind: 'ApplicationContextSyntax', members, description, directiveLocations, location: locationOf(header) };\n}\n\nfunction parseMember(context: ParserContext, line: SourceLine, members: ContextMemberSyntax[], names: Set<string>): void {\n if (context.peekChild(line.indent) !== undefined) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, 'A context member cannot have a body.', locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n const match = memberPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, `Invalid context member '${line.content}' - expected '<name> time zone'.`, locationOf(line));\n return;\n }\n if (!memberTypePattern.test(match[2])) {\n context.error(DiagnosticCodes.UnknownContextMemberType, `Unknown context member type '${match[2]}' - expected 'time zone'.`, locationOf(line));\n return;\n }\n const name = unescapeIdentifier(match[1]);\n if (name === 'timeZone' || contextRoots.includes(name)) {\n context.error(DiagnosticCodes.ReservedContextMemberName, `The context member name '${name}' is reserved.`, locationOf(line));\n return;\n }\n if (names.has(name)) {\n context.error(DiagnosticCodes.DuplicateContextMember, `The context member '${name}' is already declared.`, locationOf(line));\n return;\n }\n names.add(name);\n members.push({ kind: 'ContextMemberSyntax', name, location: locationOf(line) });\n}\n"],"mappings":"ieAcA,MAAMA,EAAgBC,EAAc,kBAAkBC,EAAiB,OAAO,EACxEC,EAAoBF,EAAc,QAAQC,EAAiB,OAAO,EAExE,SAAgB,wBAAwB,EAAwB,EAAoB,EA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A4BT,EAAWK,CAAI,CAAC,EAC7I,MACJ,CACA,IAAMK,EAAOC,EAAmBF,EAAM,EAAE,EACpCC,IAAS,YAAcE,EAAa,SAASF,CAAI,EACjDZ,EAAQ,MAAMC,EAAgB,0BAA2B,4BAA4BW,EAAK,gBAAiBV,EAAWK,CAAI,CAAC,EAG3HH,EAAM,IAAIQ,CAAI,EACdZ,EAAQ,MAAMC,EAAgB,uBAAwB,uBAAuBW,EAAK,wBAAyBV,EAAWK,CAAI,CAAC,GAG/HH,EAAM,IAAIQ,CAAI,EACdT,EAAQ,KAAK,CAAE,KAAM,sBAAuB,OAAM,SAAUD,EAAWK,CAAI,CAAE,CAAC,EAClF"}
1
+ {"version":3,"file":"ApplicationContextParser.js","names":["memberPattern","nativePattern","dotNetWhitespace","memberTypePattern","header","isDocumentPlacement","placement","existing","context","DiagnosticCodes","locationOf","members","names","directiveLocations","description","line","firstWord","previous","parseDescription","match","name","unescapeIdentifier","contextRoots"],"sources":["../../../../../../Compiler/Parsing/ApplicationContextParser.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 { isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { ApplicationContextSyntax, ContextMemberSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { contextRoots } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst memberPattern = nativePattern(`^(@?[a-z_]\\\\w*)${dotNetWhitespace}+(.+)$`);\nconst memberTypePattern = nativePattern(`^time${dotNetWhitespace}+zone$`);\n\nexport function parseApplicationContext(context: ParserContext, header: SourceLine, existing: ApplicationContextSyntax | null, placement: PlayPlacement): ApplicationContextSyntax | null {\n if (header.content !== 'context' || !isDocumentPlacement(placement) || existing !== null) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, \"Declare 'context' once at the application root.\", locationOf(header));\n context.skipBlock(header.indent);\n return existing;\n }\n const members: ContextMemberSyntax[] = [];\n const names = new Set<string>();\n const directiveLocations: Record<string, SourceLocation> = {};\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n const previous = description;\n description = parseDescription(context, line, description, 'Context');\n if (previous === null && description !== null) directiveLocations.description = locationOf(line);\n continue;\n }\n parseMember(context, line, members, names);\n }\n return { kind: 'ApplicationContextSyntax', members, description, directiveLocations, location: locationOf(header) };\n}\n\nfunction parseMember(context: ParserContext, line: SourceLine, members: ContextMemberSyntax[], names: Set<string>): void {\n if (context.peekChild(line.indent) !== undefined) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, 'A context member cannot have a body.', locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n const match = memberPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidContextDeclaration, `Invalid context member '${line.content}' - expected '<name> time zone'.`, locationOf(line));\n return;\n }\n if (!memberTypePattern.test(match[2])) {\n context.error(DiagnosticCodes.UnknownContextMemberType, `Unknown context member type '${match[2]}' - expected 'time zone'.`, locationOf(line));\n return;\n }\n const name = unescapeIdentifier(match[1]);\n if (name === 'timeZone' || contextRoots.includes(name)) {\n context.error(DiagnosticCodes.ReservedContextMemberName, `The context member name '${name}' is reserved.`, locationOf(line));\n return;\n }\n if (names.has(name)) {\n context.error(DiagnosticCodes.DuplicateContextMember, `The context member '${name}' is already declared.`, locationOf(line));\n return;\n }\n names.add(name);\n members.push({ kind: 'ContextMemberSyntax', name, location: locationOf(line) });\n}\n"],"mappings":"A,ieAcA,MAAMA,EAAgBC,EAAc,kBAAkBC,EAAiB,OAAO,EACxEC,EAAoBF,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G,CACnCX,EAAQ,MAAMC,EAAgB,yBAA0B,gCAAgCU,EAAM,GAAG,2BAA4BT,EAAWK,CAAI,CAAC,EAC7I,MACJ,CACA,IAAMK,EAAOC,EAAmBF,EAAM,EAAE,EACpCC,IAAS,YAAcE,EAAa,SAASF,CAAI,EACjDZ,EAAQ,MAAMC,EAAgB,0BAA2B,4BAA4BW,EAAK,gBAAiBV,EAAWK,CAAI,CAAC,EAG3HH,EAAM,IAAIQ,CAAI,EACdZ,EAAQ,MAAMC,EAAgB,uBAAwB,uBAAuBW,EAAK,wBAAyBV,EAAWK,CAAI,CAAC,GAG/HH,EAAM,IAAIQ,CAAI,EACdT,EAAQ,KAAK,CAAE,KAAM,sBAAuB,OAAM,SAAUD,EAAWK,CAAI,CAAE,CAAC,EAClF,C"}
@@ -1,2 +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{locationOf as n}from"./SourceLine.js";const r=t(`^(?:(?:or|and)\\s+)?[A-Za-z_(][\\w\\s()]*$`),i=new RegExp(t(`\\(|\\)|[A-Za-z_]\\w*`).source,`gu`),a=t(`^[A-Z]\\w*$`);function parseAuthorize(t,i){let a=i.content.substring(9);for(let e=t.peekChild(i.indent);e!==void 0&&r.test(e.content);e=t.peekChild(i.indent))t.reader.takeSignificant(),a+=` ${e.content}`;let o=tokenize(a),s=n(i);if(o.length===0)return t.error(e.AuthorizeWithoutPolicy,`Expected at least one policy after 'authorize'`,s),null;hasImplicitConjunction(a)&&t.information(e.ImplicitAuthorizationConjunction,`Write 'and' between adjacent policies in 'authorize'.`,s);let c=new RequirementParser(t,o,s).parse();return c===null?null:{kind:`AuthorizeSyntax`,requirement:c,location:s}}function combineAuthorize(e,t){return e===null?t:t===null?e:{kind:`AuthorizeSyntax`,requirement:{kind:`LogicalPolicyRequirementSyntax`,left:e.requirement,operator:`And`,right:t.requirement,location:e.location},location:e.location}}function tokenize(e){let t=[];for(let n of e.match(i)??[])t.length>0&&isOperandEnd(t[t.length-1])&&isOperandStart(n)&&t.push(`and`),t.push(n);return t}function isAuthorizeContinuation(e){return r.test(e)}function implicitConjunctionTokens(e,t){let n=[];for(let r of e.matchAll(i))t!==void 0&&isOperandEnd(t)&&isOperandStart(r[0])&&n.push({index:r.index,length:r[0].length}),t=r[0];return{tokens:n,previous:t}}function hasImplicitConjunction(e){return implicitConjunctionTokens(e,void 0).tokens.length>0}const isName=e=>e!==`(`&&e!==`)`&&e!==`and`&&e!==`or`,isOperandEnd=e=>e===`)`||isName(e),isOperandStart=e=>e===`(`||isName(e);var RequirementParser=class{context;tokens;location;#e=0;constructor(e,t,n){this.context=e,this.tokens=t,this.location=n}parse(){let t=this.#t();return t!==null&&this.#e<this.tokens.length&&this.context.error(e.UnexpectedTokenInAuthorize,`Unexpected '${this.tokens[this.#e]}' in authorize`,this.location),t}#t(){return this.#r(`or`,`Or`,()=>this.#n())}#n(){return this.#r(`and`,`And`,()=>this.#i())}#r(e,t,n){let r=n();for(;r!==null&&this.tokens[this.#e]===e;){this.#e++;let e=n();if(e===null)return null;r={kind:`LogicalPolicyRequirementSyntax`,left:r,operator:t,right:e,location:this.location}}return r}#i(){if(this.tokens[this.#e]!==`(`)return this.#a();this.#e++;let t=this.#t();return this.tokens[this.#e]===`)`?this.#e++:this.context.error(e.UnclosedAuthorizeGroup,`Expected ')' in authorize`,this.location),t}#a(){if(this.#e>=this.tokens.length)return this.context.error(e.AuthorizeWithoutPolicy,`Expected a policy name`,this.location),null;let t=this.tokens[this.#e++];return a.test(t)?{kind:`PolicyReferenceSyntax`,name:t,location:this.location}:(this.context.error(e.InvalidPolicyReference,`Invalid policy reference '${t}' - policy names are PascalCase identifiers`,this.location),null)}};export{combineAuthorize,implicitConjunctionTokens,isAuthorizeContinuation,parseAuthorize};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{ConditionDepthBudget as n}from"./ConditionDepthBudget.js";import{locationOf as r}from"./SourceLine.js";const i=t(`^(?:(?:or|and)\\s+)?[A-Za-z_(][\\w\\s()]*$`),a=new RegExp(t(`\\(|\\)|[A-Za-z_]\\w*`).source,`gu`),o=t(`^[A-Z]\\w*$`),s=/* @__PURE__ */ new WeakSet;function recordAuthorizationRefusal(e){s.add(e)}function authorizationWasRefused(e){return s.has(e)}function parseAuthorize(t,n){let a=n.content.substring(9);for(let e=t.peekChild(n.indent);e!==void 0&&i.test(e.content);e=t.peekChild(n.indent))t.reader.takeSignificant(),a+=` ${e.content}`;let o=tokenize(a),s=r(n);if(o.length===0)return t.error(e.AuthorizeWithoutPolicy,`Expected at least one policy after 'authorize'`,s),null;hasImplicitConjunction(a)&&t.information(e.ImplicitAuthorizationConjunction,`Write 'and' between adjacent policies in 'authorize'.`,s);let c=new RequirementParser(t,o,s).parse();return c===null?null:{kind:`AuthorizeSyntax`,requirement:c,location:s}}function combineAuthorize(e,t,r){if(e===null)return t;if(t===null)return e;let i=1+Math.max(requirementDepth(e.requirement),requirementDepth(t.requirement));return new n(r,t.location).allowsDepth(i)?{kind:`AuthorizeSyntax`,requirement:{kind:`LogicalPolicyRequirementSyntax`,left:e.requirement,operator:`And`,right:t.requirement,location:e.location},location:e.location}:null}function requirementDepth(e){let t=[{requirement:e,depth:1}],n=1;for(;t.length>0;){let e=t.pop();n=Math.max(n,e.depth),e.requirement.kind===`LogicalPolicyRequirementSyntax`&&t.push({requirement:e.requirement.left,depth:e.depth+1},{requirement:e.requirement.right,depth:e.depth+1})}return n}function tokenize(e){let t=[];for(let n of e.match(a)??[])t.length>0&&isOperandEnd(t[t.length-1])&&isOperandStart(n)&&t.push(`and`),t.push(n);return t}function isAuthorizeContinuation(e){return i.test(e)}function implicitConjunctionTokens(e,t){let n=[];for(let r of e.matchAll(a))t!==void 0&&isOperandEnd(t)&&isOperandStart(r[0])&&n.push({index:r.index,length:r[0].length}),t=r[0];return{tokens:n,previous:t}}function hasImplicitConjunction(e){return implicitConjunctionTokens(e,void 0).tokens.length>0}const isName=e=>e!==`(`&&e!==`)`&&e!==`and`&&e!==`or`,isOperandEnd=e=>e===`)`||isName(e),isOperandStart=e=>e===`(`||isName(e);var RequirementParser=class{context;tokens;location;#e=0;#t;constructor(e,t,r){this.context=e,this.tokens=t,this.location=r,this.#t=new n(e,r)}parse(){let t=this.#n();return t!==null&&this.#e<this.tokens.length&&this.context.error(e.UnexpectedTokenInAuthorize,`Unexpected '${this.tokens[this.#e]}' in authorize`,this.location),t}#n(){return this.#i(`or`,`Or`,()=>this.#r())}#r(){return this.#i(`and`,`And`,()=>this.#a())}#i(e,t,n){let r=n();for(;r!==null&&this.tokens[this.#e]===e;){this.#e++;let e=n();if(e===null)return null;let i=r;r=this.#t.build([i,e],()=>({kind:`LogicalPolicyRequirementSyntax`,left:i,operator:t,right:e,location:this.location}))}return r}#a(){if(this.tokens[this.#e]!==`(`)return this.#o();if(!this.#t.enter())return null;this.#e++;try{let t=this.#n();return this.#t.exceeded?null:(this.tokens[this.#e]===`)`?this.#e++:this.context.error(e.UnclosedAuthorizeGroup,`Expected ')' in authorize`,this.location),t)}finally{this.#t.leave()}}#o(){if(this.#e>=this.tokens.length)return this.context.error(e.AuthorizeWithoutPolicy,`Expected a policy name`,this.location),null;let t=this.tokens[this.#e++];return o.test(t)?{kind:`PolicyReferenceSyntax`,name:t,location:this.location}:(this.context.error(e.InvalidPolicyReference,`Invalid policy reference '${t}' - policy names are PascalCase identifiers`,this.location),null)}};export{authorizationWasRefused,combineAuthorize,implicitConjunctionTokens,isAuthorizeContinuation,parseAuthorize,recordAuthorizationRefusal};
2
2
  //# sourceMappingURL=AuthorizeParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizeParser.js","names":["continuationPattern","pattern","tokenPattern","namePattern","text","line","child","context","tokens","location","locationOf","DiagnosticCodes","requirement","first","next","token","content","match","previous","#or","#position","#chain","#and","#groupOrReference","left","operand","right","#reference"],"sources":["../../../../../../Compiler/Parsing/AuthorizeParser.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 { AuthorizeSyntax, LogicalOperator, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst continuationPattern = pattern('^(?:(?:or|and)\\\\s+)?[A-Za-z_(][\\\\w\\\\s()]*$');\nconst tokenPattern = new RegExp(pattern('\\\\(|\\\\)|[A-Za-z_]\\\\w*').source, 'gu');\nconst namePattern = pattern('^[A-Z]\\\\w*$');\n\n// The port of the C# AuthorizeParser: the requirement may continue on the lines below the 'authorize', and\n// two operands written side by side are joined by an implicit 'and'.\nexport function parseAuthorize(context: ParserContext, line: SourceLine): AuthorizeSyntax | null {\n let text = line.content.substring('authorize'.length);\n for (let child = context.peekChild(line.indent); child !== undefined && continuationPattern.test(child.content); child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n text += ` ${child.content}`;\n }\n const tokens = tokenize(text);\n const location = locationOf(line);\n if (tokens.length === 0) {\n context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected at least one policy after \\'authorize\\'', location);\n return null;\n }\n if (hasImplicitConjunction(text)) context.information(DiagnosticCodes.ImplicitAuthorizationConjunction, 'Write \\'and\\' between adjacent policies in \\'authorize\\'.', location);\n const parser = new RequirementParser(context, tokens, location);\n const requirement = parser.parse();\n return requirement === null ? null : { kind: 'AuthorizeSyntax', requirement, location };\n}\n\n// Several 'authorize' lines on one construct all have to hold, so they combine with 'and'.\nexport function combineAuthorize(first: AuthorizeSyntax | null, next: AuthorizeSyntax | null): AuthorizeSyntax | null {\n if (first === null) return next;\n if (next === null) return first;\n return {\n kind: 'AuthorizeSyntax',\n requirement: { kind: 'LogicalPolicyRequirementSyntax', left: first.requirement, operator: 'And', right: next.requirement, location: first.location },\n location: first.location,\n };\n}\n\nfunction tokenize(text: string): string[] {\n const tokens: string[] = [];\n for (const token of text.match(tokenPattern) ?? []) {\n if (tokens.length > 0 && isOperandEnd(tokens[tokens.length - 1]) && isOperandStart(token)) {\n tokens.push('and');\n }\n tokens.push(token);\n }\n return tokens;\n}\n\nexport function isAuthorizeContinuation(content: string): boolean {\n return continuationPattern.test(content);\n}\n\n/** Finds each operand of one authorize line that sits directly after another operand, so an 'and' belongs before it. */\nexport function implicitConjunctionTokens(text: string, previous: string | undefined): { readonly tokens: readonly { readonly index: number; readonly length: number }[]; readonly previous: string | undefined } {\n const tokens: { index: number; length: number }[] = [];\n for (const match of text.matchAll(tokenPattern)) {\n if (previous !== undefined && isOperandEnd(previous) && isOperandStart(match[0])) tokens.push({ index: match.index, length: match[0].length });\n previous = match[0];\n }\n return { tokens, previous };\n}\n\nfunction hasImplicitConjunction(text: string): boolean {\n return implicitConjunctionTokens(text, undefined).tokens.length > 0;\n}\n\nconst isName = (token: string): boolean => token !== '(' && token !== ')' && token !== 'and' && token !== 'or';\nconst isOperandEnd = (token: string): boolean => token === ')' || isName(token);\nconst isOperandStart = (token: string): boolean => token === '(' || isName(token);\n\n// The port of the C# LogicalConditionParser: 'or' over 'and' over a group or a policy name.\nclass RequirementParser {\n #position = 0;\n\n constructor(private readonly context: ParserContext, private readonly tokens: readonly string[], private readonly location: SourceLocation) {}\n\n parse(): PolicyRequirementSyntax | null {\n const requirement = this.#or();\n if (requirement !== null && this.#position < this.tokens.length) {\n this.context.error(DiagnosticCodes.UnexpectedTokenInAuthorize, `Unexpected '${this.tokens[this.#position]}' in authorize`, this.location);\n }\n return requirement;\n }\n\n #or(): PolicyRequirementSyntax | null {\n return this.#chain('or', 'Or', () => this.#and());\n }\n\n #and(): PolicyRequirementSyntax | null {\n return this.#chain('and', 'And', () => this.#groupOrReference());\n }\n\n #chain(token: string, operator: LogicalOperator, operand: () => PolicyRequirementSyntax | null): PolicyRequirementSyntax | null {\n let left = operand();\n while (left !== null && this.tokens[this.#position] === token) {\n this.#position++;\n const right = operand();\n if (right === null) {\n return null;\n }\n left = { kind: 'LogicalPolicyRequirementSyntax', left, operator, right, location: this.location };\n }\n return left;\n }\n\n #groupOrReference(): PolicyRequirementSyntax | null {\n if (this.tokens[this.#position] !== '(') {\n return this.#reference();\n }\n this.#position++;\n const requirement = this.#or();\n if (this.tokens[this.#position] === ')') {\n this.#position++;\n } else {\n this.context.error(DiagnosticCodes.UnclosedAuthorizeGroup, 'Expected \\')\\' in authorize', this.location);\n }\n return requirement;\n }\n\n #reference(): PolicyRequirementSyntax | null {\n if (this.#position >= this.tokens.length) {\n this.context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected a policy name', this.location);\n return null;\n }\n const token = this.tokens[this.#position++];\n if (!namePattern.test(token)) {\n this.context.error(DiagnosticCodes.InvalidPolicyReference, `Invalid policy reference '${token}' - policy names are PascalCase identifiers`, this.location);\n return null;\n }\n return { kind: 'PolicyReferenceSyntax', name: token, location: this.location };\n }\n}\n"],"mappings":"oNAUA,MAAMA,EAAsBC,EAAQ,4CAA4C,EAC1EC,EAAe,IAAI,OAAOD,EAAQ,uBAAuB,CAAC,CAAC,OAAQ,IAAI,EACvEE,EAAcF,EAAQ,aAAa,EAIzC,SAAgB,eAAe,EAAwB,EAA0C,CAC7F,IAAIG,EAAOC,EAAK,QAAQ,UAAU,CAAkB,EACpD,IAAK,IAAIC,EAAQC,EAAQ,UAAUF,EAAK,MAAM,EAAGC,IAAU,IAAA,IAAaN,EAAoB,KAAKM,EAAM,OAAO,EAAG,EAAQC,EAAQ,UAAUF,EAAK,MAAM,EAClJE,EAAQ,OAAO,gBAAgB,EAC/B,GAAQ,IAAID,EAAM,UAEtB,IAAME,EAAS,SAASJ,CAAI,EACtBK,EAAWC,EAAWL,CAAI,EAChC,GAAIG,EAAO,SA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,KAAK,QAAQ,EAEpGC,CACX,CAEA,IAA6C,CACzC,GAAI,KAAKQ,IAAa,KAAK,OAAO,OAE9B,OADA,KAAK,QAAQ,MAAMT,EAAgB,uBAAwB,yBAA0B,KAAK,QAAQ,EAC3F,KAEX,IAAMI,EAAQ,KAAK,OAAO,KAAKK,MAK/B,OAJKjB,EAAY,KAAKY,CAAK,EAIpB,CAAE,KAAM,wBAAyB,KAAMA,EAAO,SAAU,KAAK,QAAS,GAHzE,KAAK,QAAQ,MAAMJ,EAAgB,uBAAwB,6BAA6BI,EAAM,6CAA8C,KAAK,QAAQ,EAClJ,KAGf,CACJ"}
1
+ {"version":3,"file":"AuthorizeParser.js","names":["continuationPattern","pattern","tokenPattern","namePattern","refusedOwners","imports","text","line","child","context","tokens","location","locationOf","DiagnosticCodes","requirement","first","next","depth","ConditionDepthBudget","pending","maximum","current","token","content","match","previous","#budget","#or","#position","#chain","#and","#groupOrReference","left","operand","right","#reference"],"sources":["../../../../../../Compiler/Parsing/AuthorizeParser.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 { AuthorizeSyntax, LogicalOperator, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { FileImportSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { ConditionDepthBudget } from './ConditionDepthBudget';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst continuationPattern = pattern('^(?:(?:or|and)\\\\s+)?[A-Za-z_(][\\\\w\\\\s()]*$');\nconst tokenPattern = new RegExp(pattern('\\\\(|\\\\)|[A-Za-z_]\\\\w*').source, 'gu');\nconst namePattern = pattern('^[A-Z]\\\\w*$');\n\n// Each owner's import list retains its identity through syntax copies without adding public metadata.\nconst refusedOwners = new WeakSet<readonly FileImportSyntax[]>();\n\nexport function recordAuthorizationRefusal(imports: readonly FileImportSyntax[]): void { refusedOwners.add(imports); }\n\nexport function authorizationWasRefused(imports: readonly FileImportSyntax[]): boolean { return refusedOwners.has(imports); }\n\n// The port of the C# AuthorizeParser: the requirement may continue on the lines below the 'authorize', and\n// two operands written side by side are joined by an implicit 'and'.\nexport function parseAuthorize(context: ParserContext, line: SourceLine): AuthorizeSyntax | null {\n let text = line.content.substring('authorize'.length);\n for (let child = context.peekChild(line.indent); child !== undefined && continuationPattern.test(child.content); child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n text += ` ${child.content}`;\n }\n const tokens = tokenize(text);\n const location = locationOf(line);\n if (tokens.length === 0) {\n context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected at least one policy after \\'authorize\\'', location);\n return null;\n }\n if (hasImplicitConjunction(text)) context.information(DiagnosticCodes.ImplicitAuthorizationConjunction, 'Write \\'and\\' between adjacent policies in \\'authorize\\'.', location);\n const parser = new RequirementParser(context, tokens, location);\n const requirement = parser.parse();\n return requirement === null ? null : { kind: 'AuthorizeSyntax', requirement, location };\n}\n\n// Several 'authorize' lines on one construct all have to hold, so they combine with 'and'.\nexport function combineAuthorize(first: AuthorizeSyntax | null, next: AuthorizeSyntax | null, context: ParserContext): AuthorizeSyntax | null {\n if (first === null) return next;\n if (next === null) return first;\n const depth = 1 + Math.max(requirementDepth(first.requirement), requirementDepth(next.requirement));\n if (!new ConditionDepthBudget(context, next.location).allowsDepth(depth)) return null;\n return {\n kind: 'AuthorizeSyntax',\n requirement: { kind: 'LogicalPolicyRequirementSyntax', left: first.requirement, operator: 'And', right: next.requirement, location: first.location },\n location: first.location,\n };\n}\n\nfunction requirementDepth(requirement: PolicyRequirementSyntax): number {\n const pending = [{ requirement, depth: 1 }];\n let maximum = 1;\n while (pending.length > 0) {\n const current = pending.pop()!;\n maximum = Math.max(maximum, current.depth);\n if (current.requirement.kind === 'LogicalPolicyRequirementSyntax') {\n pending.push({ requirement: current.requirement.left, depth: current.depth + 1 }, { requirement: current.requirement.right, depth: current.depth + 1 });\n }\n }\n return maximum;\n}\n\nfunction tokenize(text: string): string[] {\n const tokens: string[] = [];\n for (const token of text.match(tokenPattern) ?? []) {\n if (tokens.length > 0 && isOperandEnd(tokens[tokens.length - 1]) && isOperandStart(token)) {\n tokens.push('and');\n }\n tokens.push(token);\n }\n return tokens;\n}\n\nexport function isAuthorizeContinuation(content: string): boolean {\n return continuationPattern.test(content);\n}\n\n/** Finds each operand of one authorize line that sits directly after another operand, so an 'and' belongs before it. */\nexport function implicitConjunctionTokens(text: string, previous: string | undefined): { readonly tokens: readonly { readonly index: number; readonly length: number }[]; readonly previous: string | undefined } {\n const tokens: { index: number; length: number }[] = [];\n for (const match of text.matchAll(tokenPattern)) {\n if (previous !== undefined && isOperandEnd(previous) && isOperandStart(match[0])) tokens.push({ index: match.index, length: match[0].length });\n previous = match[0];\n }\n return { tokens, previous };\n}\n\nfunction hasImplicitConjunction(text: string): boolean {\n return implicitConjunctionTokens(text, undefined).tokens.length > 0;\n}\n\nconst isName = (token: string): boolean => token !== '(' && token !== ')' && token !== 'and' && token !== 'or';\nconst isOperandEnd = (token: string): boolean => token === ')' || isName(token);\nconst isOperandStart = (token: string): boolean => token === '(' || isName(token);\n\n// The port of the C# LogicalConditionParser: 'or' over 'and' over a group or a policy name.\nclass RequirementParser {\n #position = 0;\n readonly #budget: ConditionDepthBudget;\n\n constructor(private readonly context: ParserContext, private readonly tokens: readonly string[], private readonly location: SourceLocation) {\n this.#budget = new ConditionDepthBudget(context, location);\n }\n\n parse(): PolicyRequirementSyntax | null {\n const requirement = this.#or();\n if (requirement !== null && this.#position < this.tokens.length) {\n this.context.error(DiagnosticCodes.UnexpectedTokenInAuthorize, `Unexpected '${this.tokens[this.#position]}' in authorize`, this.location);\n }\n return requirement;\n }\n\n #or(): PolicyRequirementSyntax | null {\n return this.#chain('or', 'Or', () => this.#and());\n }\n\n #and(): PolicyRequirementSyntax | null {\n return this.#chain('and', 'And', () => this.#groupOrReference());\n }\n\n #chain(token: string, operator: LogicalOperator, operand: () => PolicyRequirementSyntax | null): PolicyRequirementSyntax | null {\n let left = operand();\n while (left !== null && this.tokens[this.#position] === token) {\n this.#position++;\n const right = operand();\n if (right === null) {\n return null;\n }\n const previous: PolicyRequirementSyntax = left;\n left = this.#budget.build<PolicyRequirementSyntax>([previous, right], () => ({ kind: 'LogicalPolicyRequirementSyntax', left: previous, operator, right, location: this.location }));\n }\n return left;\n }\n\n #groupOrReference(): PolicyRequirementSyntax | null {\n if (this.tokens[this.#position] !== '(') {\n return this.#reference();\n }\n if (!this.#budget.enter()) return null;\n this.#position++;\n try {\n const requirement = this.#or();\n if (this.#budget.exceeded) return null;\n if (this.tokens[this.#position] === ')') {\n this.#position++;\n } else {\n this.context.error(DiagnosticCodes.UnclosedAuthorizeGroup, 'Expected \\')\\' in authorize', this.location);\n }\n return requirement;\n } finally { this.#budget.leave(); }\n }\n\n #reference(): PolicyRequirementSyntax | null {\n if (this.#position >= this.tokens.length) {\n this.context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected a policy name', this.location);\n return null;\n }\n const token = this.tokens[this.#position++];\n if (!namePattern.test(token)) {\n this.context.error(DiagnosticCodes.InvalidPolicyReference, `Invalid policy reference '${token}' - policy names are PascalCase identifiers`, this.location);\n return null;\n }\n return { kind: 'PolicyReferenceSyntax', name: token, location: this.location };\n }\n}\n"],"mappings":"A,qRAYA,MAAMA,EAAsBC,EAAQ,4CAA4C,EAC1EC,EAAe,IAAI,OAAOD,EAAQ,uBAAuB,CAAC,CAAC,OAAQ,IAAI,EACvEE,EAAcF,EAAQ,aAAa,EAGnCG,kBAAgB,IAAI,QAE1B,SAAgB,2BAA2B,EAA4C,CAAEA,EAAc,IAAIC,CAAO,CAAG,CAErH,SAAgB,wBAAwB,EAA+C,CAAE,OAAOD,EAAc,IAAIC,CAAO,CAAG,CAI5H,SAAgB,eAAe,EAAwB,EAA0C,CAC7F,IAAIC,EA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CAEA,IAA6C,CACzC,GAAI,KAAKE,IAAa,KAAK,OAAO,OAE9B,OADA,KAAK,QAAQ,MAAMf,EAAgB,uBAAwB,yBAA0B,KAAK,QAAQ,EAC3F,KAEX,IAAMS,EAAQ,KAAK,OAAO,KAAKM,MAK/B,OAJKzB,EAAY,KAAKmB,CAAK,EAIpB,CAAE,KAAM,wBAAyB,KAAMA,EAAO,SAAU,KAAK,QAAS,GAHzE,KAAK,QAAQ,MAAMT,EAAgB,uBAAwB,6BAA6BS,EAAM,6CAA8C,KAAK,QAAQ,EAClJ,KAGf,CACJ,E"}
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasPlacement.js","names":["canvasPairPattern","pattern","match","line","firstValue","secondValue","keyword","allowNegative","existing","context","DiagnosticCodes","locationOf","first","second"],"sources":["../../../../../../Compiler/Parsing/CanvasPlacement.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 { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst canvasPairPattern = pattern('^(position|size)\\\\s+(-?\\\\d+)\\\\s+(-?\\\\d+)$');\n\n// 'position <x> <y>' or 'size <width> <height>' - two whole numbers in canvas units; a second line is a mistake.\nexport function parseCanvasPair(context: ParserContext, line: SourceLine, keyword: string, first: string, second: string, existing: readonly [number, number] | null, allowNegative: boolean): readonly [number, number] | null {\n const match = canvasPairPattern.exec(line.content);\n const firstValue = match === null ? Number.NaN : Number.parseInt(match[2], 10);\n const secondValue = match === null ? Number.NaN : Number.parseInt(match[3], 10);\n const valid = match !== null && match[1] === keyword && Number.isSafeInteger(firstValue) && Number.isSafeInteger(secondValue)\n && firstValue >= -2147483648 && firstValue <= 2147483647 && secondValue >= -2147483648 && secondValue <= 2147483647\n && (allowNegative || (firstValue >= 0 && secondValue >= 0));\n if (!valid) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid ${keyword} '${line.content}' - expected '${keyword} <${first}> <${second}>' with whole numbers${allowNegative ? '' : ' that are not negative'}`, locationOf(line));\n return null;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `The ${keyword} is already declared - at most one is allowed`, locationOf(line));\n return null;\n }\n return [firstValue, secondValue];\n}\n"],"mappings":"oNAQA,MAAMA,EAAoBC,EAAQ,2CAA2C,EAG7E,SAAgB,gBAAgB,EAAwB,EAAkB,EAAiB,EAAe,EAAgB,EAA4C,EAA0D,CAC5N,IAAMC,EAAQF,EAAkB,KAAKG,EAAK,OAAO,EAC3CC,EAAaF,IAAU,KAAO,IAAa,OAAO,SAASA,EAAM,GAAI,EAAE,EACvEG,EAAcH,IAAU,KAAO,IAAa,OAAO,SAASA,EAAM,GAAI,EAAE,EAY9E,OAXcA,IAAU,MAAQA,EAAM,KAAOI,GAAW,OAAO,cAAcF,CAAU,GAAK,OAAO,cAAcC,CAAW,GACrHD,GAAc,aAAeA,GAAc,YAAcC,GAAe,aAAeA,GAAe,aACrGE,GAAkBH,GAAc,GAAKC,GAAe,GAKxDG,IAAa,KAIV,CAACJ,EAAYC,CAAW,GAH3BI,EAAQ,MAAMC,EAAgB,0BAA2B,OAAOJ,EAAQ,+CAAgDK,EAAWR,CAAI,CAAC,EACjI,OALPM,EAAQ,MAAMC,EAAgB,0BAA2B,WAAWJ,EAAQ,IAAIH,EAAK,QAAQ,gBAAgBG,EAAQ,IAAIM,EAAM,KAAKC,EAAO,uBAAuBN,EAAgB,GAAK,2BAA4BI,EAAWR,CAAI,CAAC,EAC5N,KAOf"}
1
+ {"version":3,"file":"CanvasPlacement.js","names":["canvasPairPattern","pattern","match","line","firstValue","secondValue","keyword","allowNegative","existing","context","DiagnosticCodes","locationOf","first","second"],"sources":["../../../../../../Compiler/Parsing/CanvasPlacement.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 { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst canvasPairPattern = pattern('^(position|size)\\\\s+(-?\\\\d+)\\\\s+(-?\\\\d+)$');\n\n// 'position <x> <y>' or 'size <width> <height>' - two whole numbers in canvas units; a second line is a mistake.\nexport function parseCanvasPair(context: ParserContext, line: SourceLine, keyword: string, first: string, second: string, existing: readonly [number, number] | null, allowNegative: boolean): readonly [number, number] | null {\n const match = canvasPairPattern.exec(line.content);\n const firstValue = match === null ? Number.NaN : Number.parseInt(match[2], 10);\n const secondValue = match === null ? Number.NaN : Number.parseInt(match[3], 10);\n const valid = match !== null && match[1] === keyword && Number.isSafeInteger(firstValue) && Number.isSafeInteger(secondValue)\n && firstValue >= -2147483648 && firstValue <= 2147483647 && secondValue >= -2147483648 && secondValue <= 2147483647\n && (allowNegative || (firstValue >= 0 && secondValue >= 0));\n if (!valid) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid ${keyword} '${line.content}' - expected '${keyword} <${first}> <${second}>' with whole numbers${allowNegative ? '' : ' that are not negative'}`, locationOf(line));\n return null;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `The ${keyword} is already declared - at most one is allowed`, locationOf(line));\n return null;\n }\n return [firstValue, secondValue];\n}\n"],"mappings":"A,oNAQA,MAAMA,EAAoBC,EAAQ,2CAA2C,EAG7E,SAAgB,gBAAgB,EAAwB,EAAkB,EAAiB,EAAe,EAAgB,EAA4C,EAA0D,CAC5N,IAAMC,EAAQF,EAAkB,KAAKG,EAAK,OAAO,EAC3CC,EAAaF,IAAU,KAAO,IAAa,OAAO,SAASA,EAAM,GAAI,EAAE,EACvEG,EAAcH,IAAU,KAAO,IAAa,OAAO,SAASA,EAAM,GAAI,EAAE,EAY9E,OAXcA,IAAU,MAAQA,EAAM,KAAOI,GAAW,OAAO,cAAcF,CAAU,GAAK,OAAO,cAAcC,CAAW,GACrHD,GAAc,aAAeA,GAAc,YAAcC,GAAe,aAAeA,GAAe,aACrGE,GAAkBH,GAAc,GAAKC,GAAe,GAKxDG,IAAa,KAIV,CAACJ,EAAYC,CAAW,GAH3BI,EAAQ,MAAMC,EAAgB,0BAA2B,OAAOJ,EAAQ,+CAAgDK,EAAWR,CAAI,CAAC,EACjI,OALPM,EAAQ,MAAMC,EAAgB,0BAA2B,WAAWJ,EAAQ,IAAIH,EAAK,QAAQ,gBAAgBG,EAAQ,IAAIM,EAAM,KAAKC,EAAO,uBAAuBN,EAAgB,GAAK,2BAA4BI,EAAWR,CAAI,CAAC,EAC5N,KAOf,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CaptureEventFixturesValidator.js","names":["capture","slice","context","DiagnosticCodes","isEventsSource","key","captures","setting","consumedEvents","resolved","events","scope","contract","property","declarations","item","specification","records","record","matches"],"sources":["../../../../../../Compiler/Parsing/CaptureEventFixturesValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { consumedEvents, isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { CaptureSyntax } from '../Syntax/Captures';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validateEventSourceKeys(slice: SliceSyntax, context: ParserContext): void {\n for (const capture of slice.captures.filter(isMisplacedEventSourceKey)) {\n context.error(DiagnosticCodes.CaptureEventSourceKeyOutsideEvents, `Capture '${capture.name}' declares 'is event source' on its key; only a 'source events' capture with a single property key can.`, capture.location);\n }\n}\n\nfunction isMisplacedEventSourceKey(capture: CaptureSyntax): boolean {\n return capture.keyIsEventSource === true && !isSingleKeyEventsCapture(capture);\n}\n\nfunction isSingleKeyEventsCapture(capture: CaptureSyntax): boolean {\n return capture.source != null && isEventsSource(capture.source) && isPropertyKey(capture.key);\n}\n\nfunction isPropertyKey(key: string | null): boolean {\n return key != null && key !== '' && !key.startsWith('$') && !key.includes('.');\n}\n\nexport function validateCaptureEventFixtures(slice: SliceSyntax, scope: readonly string[], events: AuthoringProductionResolver, context: ParserContext): void {\n const captures = slice.captures.filter(capture => capture.source != null && isEventsSource(capture.source));\n for (const capture of captures) {\n if (capture.key?.startsWith('$')) {\n context.error(DiagnosticCodes.CaptureEventsKeyNotRequired, `Capture '${capture.name}' key '${capture.key}' must be a required property of every source event; context keys are not supported for captures over events.`, capture.location);\n continue;\n }\n for (const setting of consumedEvents(capture.source!)) {\n const resolved = events.resolveFromScope(setting.value, scope).declaration?.node;\n if (resolved?.kind !== 'EventSyntax') continue;\n const contract = resolved as EventSyntax;\n if (contract.visibility !== EventVisibility.Public || contract.origin == null) continue;\n if (contract.properties.some(property => property.name === capture.key && !property.type.isOptional)) continue;\n context.error(DiagnosticCodes.CaptureEventsKeyNotRequired, `Capture '${capture.name}' key '${capture.key}' must be a required property of every source event; '${contract.name}' does not declare it as required.`, capture.location);\n break;\n }\n }\n const declarations = events.slices.flatMap(item => item.slice.captures);\n for (const specification of slice.specifications) {\n const records = [...specification.givenCaptures, ...(specification.whenCapture == null ? [] : [specification.whenCapture])];\n for (const record of records) {\n const matches = declarations.filter(capture => capture.name === record.capture.split('.').at(-1));\n if (matches.length !== 1 || matches[0].source == null || !isEventsSource(matches[0].source)) continue;\n context.error(DiagnosticCodes.CaptureEventsRecordFixture, `Capture '${record.capture}' consumes events; use 'given <Event>' or 'when append <Event>' rather than a capture record.`, record.location);\n }\n }\n}\n"],"mappings":"+MAYA,SAAgB,wBAAwB,EAAoB,EAA8B,CACtF,IAAK,IAAMA,KAAWC,EAAM,SAAS,OAAO,yBAAyB,EACjEC,EAAQ,MA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AQ,EACtE,IAAK,IAAMC,KAAiBf,EAAM,eAAgB,CAC9C,IAAMgB,EAAU,CAAC,GAAGD,EAAc,cAAe,GAAIA,EAAc,aAAe,KAAO,CAAC,EAAI,CAACA,EAAc,WAAW,CAAE,EAC1H,IAAK,IAAME,KAAUD,EAAS,CAC1B,IAAME,EAAUL,EAAa,OAAO,GAAWd,EAAQ,OAASkB,EAAO,QAAQ,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAC5FC,EAAQ,SAAW,GAAKA,EAAQ,EAAE,CAAC,QAAU,MAASf,EAAee,EAAQ,EAAE,CAAC,MAAM,GAC1FjB,EAAQ,MAAMC,EAAgB,2BAA4B,YAAYe,EAAO,QAAQ,+FAAgGA,EAAO,QAAQ,CACxM,CACJ,CACJ"}
1
+ {"version":3,"file":"CaptureEventFixturesValidator.js","names":["capture","slice","context","DiagnosticCodes","isEventsSource","key","captures","setting","consumedEvents","resolved","events","scope","contract","property","declarations","item","specification","records","record","matches"],"sources":["../../../../../../Compiler/Parsing/CaptureEventFixturesValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { consumedEvents, isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { CaptureSyntax } from '../Syntax/Captures';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validateEventSourceKeys(slice: SliceSyntax, context: ParserContext): void {\n for (const capture of slice.captures.filter(isMisplacedEventSourceKey)) {\n context.error(DiagnosticCodes.CaptureEventSourceKeyOutsideEvents, `Capture '${capture.name}' declares 'is event source' on its key; only a 'source events' capture with a single property key can.`, capture.location);\n }\n}\n\nfunction isMisplacedEventSourceKey(capture: CaptureSyntax): boolean {\n return capture.keyIsEventSource === true && !isSingleKeyEventsCapture(capture);\n}\n\nfunction isSingleKeyEventsCapture(capture: CaptureSyntax): boolean {\n return capture.source != null && isEventsSource(capture.source) && isPropertyKey(capture.key);\n}\n\nfunction isPropertyKey(key: string | null): boolean {\n return key != null && key !== '' && !key.startsWith('$') && !key.includes('.');\n}\n\nexport function validateCaptureEventFixtures(slice: SliceSyntax, scope: readonly string[], events: AuthoringProductionResolver, context: ParserContext): void {\n const captures = slice.captures.filter(capture => capture.source != null && isEventsSource(capture.source));\n for (const capture of captures) {\n if (capture.key?.startsWith('$')) {\n context.error(DiagnosticCodes.CaptureEventsKeyNotRequired, `Capture '${capture.name}' key '${capture.key}' must be a required property of every source event; context keys are not supported for captures over events.`, capture.location);\n continue;\n }\n for (const setting of consumedEvents(capture.source!)) {\n const resolved = events.resolveFromScope(setting.value, scope).declaration?.node;\n if (resolved?.kind !== 'EventSyntax') continue;\n const contract = resolved as EventSyntax;\n if (contract.visibility !== EventVisibility.Public || contract.origin == null) continue;\n if (contract.properties.some(property => property.name === capture.key && !property.type.isOptional)) continue;\n context.error(DiagnosticCodes.CaptureEventsKeyNotRequired, `Capture '${capture.name}' key '${capture.key}' must be a required property of every source event; '${contract.name}' does not declare it as required.`, capture.location);\n break;\n }\n }\n const declarations = events.slices.flatMap(item => item.slice.captures);\n for (const specification of slice.specifications) {\n const records = [...specification.givenCaptures, ...(specification.whenCapture == null ? [] : [specification.whenCapture])];\n for (const record of records) {\n const matches = declarations.filter(capture => capture.name === record.capture.split('.').at(-1));\n if (matches.length !== 1 || matches[0].source == null || !isEventsSource(matches[0].source)) continue;\n context.error(DiagnosticCodes.CaptureEventsRecordFixture, `Capture '${record.capture}' consumes events; use 'given <Event>' or 'when append <Event>' rather than a capture record.`, record.location);\n }\n }\n}\n"],"mappings":"A,+MAYA,SAAgB,wBAAwB,EAAoB,EAA8B,CACtF,IAAK,IAAMA,KAAWC,EAAM,SAAS,OAAO,yB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,GAAQK,EAAK,MAAM,QAAQ,EACtE,IAAK,IAAMC,KAAiBf,EAAM,eAAgB,CAC9C,IAAMgB,EAAU,CAAC,GAAGD,EAAc,cAAe,GAAIA,EAAc,aAAe,KAAO,CAAC,EAAI,CAACA,EAAc,WAAW,CAAE,EAC1H,IAAK,IAAME,KAAUD,EAAS,CAC1B,IAAME,EAAUL,EAAa,OAAO,GAAWd,EAAQ,OAASkB,EAAO,QAAQ,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAC5FC,EAAQ,SAAW,GAAKA,EAAQ,EAAE,CAAC,QAAU,MAASf,EAAee,EAAQ,EAAE,CAAC,MAAM,GAC1FjB,EAAQ,MAAMC,EAAgB,2BAA4B,YAAYe,EAAO,QAAQ,+FAAgGA,EAAO,QAAQ,CACxM,CACJ,CACJ,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{nativePattern as r,pattern as i}from"../Text/patterns.js";import{locationOf as a}from"./SourceLine.js";import{parseModeledMappingSource as o}from"./ExpressionParser.js";import{diagnosticText as s}from"../Diagnostics/DiagnosticArgument.js";import{firstWord as c,unescapeIdentifier as l}from"./LineText.js";import{tryParseStructuredMapping as u}from"./StructuredBlockParser.js";import{parseTag as d}from"./DeclarationParsers.js";import"../Syntax/CaptureEventsSource.js";import{parseProjectionExpression as f}from"./ProjectionExpressionParser.js";const grammar=e=>({legacy:i(e),native:r(e)}),p=grammar(`^capture\\s+([A-Za-z_]\\w*)$`),m=/^[A-Za-z_][\w.]*$/,h=/\s+is\s+event\s+source$/,g=grammar(`^append\\s+([A-Z]\\w*)$`),_=grammar(`^children\\s+([a-z_]\\w*)\\s+identified\\s+by\\s+([\\w.]+)$`),v=grammar(`^nested\\s+([\\w.]+)$`),select=(e,t)=>e.sourceOptions.numericMode===`exact`?t.native:t.legacy,y=r(`^(@?[\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),b=r(`^([a-z_]\\w*)\\s*=\\s*(.+)$`),x=r(`^"(${t})"\\s*=>\\s*(\\w+)$`),S=r(`^split\\s+(\\S+)\\s+by\\s+"(${t})"$`),C=new RegExp(r(`"${t}"|[\\w.]+`).source,`gu`),w=r(`^[\\w.]+$`);function parseCapture(t,n){let r=t;t=t.valueContext;let i=select(t,p).exec(n.content)?.[1]??``;i===``&&t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidCaptureDeclaration,`Invalid capture declaration '${n.content}' - expected 'capture <Name>'`,a(n));let o=null,s=null,l=!1,u=[],d=[],f=[],m=[];for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent))switch(t.reader.takeSignificant(),c(i.content)){case`source`:o=parseSource(t,i,r);break;case`key`:[s,l]=parseKey(i.content.substring(3).trim(),l);break;case`map`:u.push(...parseMap(t,i));break;case`append`:pushAppend(t,i,d);break;case`children`:{let n=select(t,_).exec(i.content);if(n===null){t.error(e.InvalidChildrenDeclaration,`Invalid children declaration '${i.content}' - expected 'children <collection> identified by <key>'`,a(i)),t.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(t,i);n!==null&&f.push({kind:`CaptureChildrenSyntax`,property:n[1],identifiedBy:n[2],...r,location:a(i)});break}case`nested`:{let n=select(t,v).exec(i.content);if(n===null){t.error(e.InvalidNestedDeclaration,`Invalid nested declaration '${i.content}' - expected 'nested <Property>'`,a(i)),t.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(t,i);n!==null&&m.push({kind:`CaptureNestedSyntax`,property:n[1],...r,location:a(i)});break}default:t.error(e.UnknownCaptureDirective,`Unexpected '${i.content}' in capture body`,a(i)),t.skipOpaqueBlock(i.indent)}return{kind:`CaptureSyntax`,sourceOptions:t.sourceOptions,name:i,source:o,key:s,...eventSourceKeyMarker(l),map:u,appends:d,children:f,nested:m,location:a(n)}}function parseKey(e,t){let n=h.exec(e);return n===null?[e,t]:[e.substring(0,n.index),!0]}function eventSourceKeyMarker(e){return e?{keyIsEventSource:e}:{}}function parseSource(e,t,n){let r=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){e.reader.takeSignificant();let t=c(n.content);r.push({kind:`CaptureSourceSettingSyntax`,name:t,value:n.content.substring(t.length).trim(),location:a(n)})}let i=t.content.substring(6).trim();return i===`events`&&validateEventsSource(n,t,r),{kind:`CaptureSourceSyntax`,syntaxKind:i,settings:r,location:a(t)}}function validateEventsSource(t,n,r){r.length===0&&t.error(e.InvalidCaptureEventsSource,`'source events' needs at least one 'from <Event>' line naming a public event to consume`,a(n));let i=/* @__PURE__ */ new Set;for(let n of r)n.name===`from`?m.test(n.value)?i.has(n.value)?t.error(e.InvalidCaptureEventsSource,`Event '${n.value}' is already consumed by this 'source events'`,n.location):i.add(n.value):t.error(e.InvalidCaptureEventsSource,`Invalid event '${n.value}' - expected 'from <Event>', optionally qualified with dots`,n.location):t.error(e.InvalidCaptureEventsSource,`'source events' accepts only 'from <Event>' lines, got '${n.name}'`,n.location)}function parseMap(t,r){let i=[];for(let o=t.peekChild(r.indent);o!==void 0;o=t.peekChild(r.indent)){t.reader.takeSignificant();let r=a(o);if(c(o.content)===`split`){let s=S.exec(o.content);if(s===null){t.error(e.InvalidSplitDeclaration,`Invalid split operation '${o.content}' - expected 'split <property> by "<separator>"'`,r),t.skipOpaqueBlock(o.indent);continue}let c=[];for(let n=t.peekChild(o.indent);n!==void 0;n=t.peekChild(o.indent))t.reader.takeSignificant(),w.test(n.content)?c.push(n.content):t.error(e.InvalidSplitTarget,`Invalid split target '${n.content}' - expected a property path`,a(n));s!==null&&i.push({kind:`CaptureSplitSyntax`,source:f(s[1],r,t),separator:n(s[2]),targets:c,location:r});continue}let s=b.exec(o.content);if(s===null){t.error(e.InvalidMapEntry,`Invalid map entry '${o.content}' - expected '<property> = <source> [translate]'`,r),t.skipOpaqueBlock(o.indent);continue}let l=s[2].trim(),u=l.startsWith("`")?l.indexOf("`",1):-1,d=l.startsWith("`")?u>=0&&l.substring(u+1).trim()===`translate`:l.endsWith(` translate`),p=l.startsWith("`")&&u>=0&&(t.sourceOptions.numericMode!==`exact`||d||l.substring(u+1).trim()===``)?l.substring(0,u+1):d?l.substring(0,l.length-10).trimEnd():l,m=[];if(d)for(let r=t.peekChild(o.indent);r!==void 0;r=t.peekChild(o.indent)){t.reader.takeSignificant();let i=x.exec(r.content);i===null?t.error(e.InvalidTranslation,`Invalid translation '${r.content}' - expected '"<source>" => <target>'`,a(r)):m.push({kind:`CaptureTranslationSyntax`,from:n(i[1]),to:i[2],location:a(r)})}i.push({kind:`CaptureMapEntrySyntax`,property:s[1],source:f(p,r,t),translations:m,location:r})}return i}function mapAndAppends(t,n){let r=[],i=[];for(let o=t.peekChild(n.indent);o!==void 0;o=t.peekChild(n.indent))t.reader.takeSignificant(),c(o.content)===`map`?r=parseMap(t,o):c(o.content)===`append`?pushAppend(t,o,i):(t.error(e.UnknownCaptureBlockDirective,`Unexpected '${o.content}' in ${c(n.content)} block - expected 'map' or 'append <EventType>'`,a(o)),t.skipOpaqueBlock(o.indent));return{map:r,appends:i}}function pushAppend(t,n,r){let i=select(t,g).exec(n.content);if(i===null){t.error(e.InvalidAppendDeclaration,`Invalid append declaration '${n.content}' - expected 'append <EventType>'`,a(n)),t.skipOpaqueBlock(n.indent);return}let f=[],p=[],m=null,mapping=(n,r=!1)=>{let i=a(n);if(c(n.content)===`tag`){let e=d(t.valueContext,n,!1);e!==void 0&&p.push(e);return}let m=y.exec(n.content),h=m===null?u(t.valueContext,n):void 0;m===null?h===void 0?t.error(r?e.InvalidPropertyMapping:e.UnknownAppendDirective,`Unexpected '${n.content}' in append body`,i,r?s(`text`,n.content):{}):f.push(h):f.push({kind:`PropertyMappingSyntax`,property:l(m[1]),source:o(m[2],i,t.valueContext),location:i})};for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),c(e.content)===`when`){m=parseWhen(t,e);for(let n=t.peekChild(e.indent);n!==void 0;n=t.peekChild(e.indent))t.reader.takeSignificant(),mapping(n,!0)}else mapping(e);r.push({kind:`CaptureAppendSyntax`,event:i[1],when:m,mappings:f,tags:p,location:a(n)})}function parseWhen(t,r){let i=r.content.substring(4).trim(),o=a(r),value=(e,t=[],n=null,r=null,i=null)=>({kind:`CaptureWhenSyntax`,syntaxKind:e,properties:t,fromValue:n,toValue:r,expression:i,location:o});if(i===`added`)return value(`Added`);if(i===`removed`)return value(`Removed`);if(i.startsWith("`"))return(!i.endsWith("`")||i.length<2)&&t.error(e.UnterminatedTemplateExpression,`Unterminated template expression in 'when' - expected a closing backtick`,o),value(`Expression`,[],null,null,i);if(i.length===0)return t.error(e.WhenWithoutTrigger,`Expected a trigger after 'when'`,o),null;let s=[...i.match(t.sourceOptions.numericMode===`exact`?/* @__PURE__ */ RegExp(`"(?:[^"\\\\]|\\\\.)*"|[^\\s]+`,`gu`):C)??[]],unquote=e=>e.startsWith(`"`)&&e.endsWith(`"`)?n(e.substring(1,e.length-1)):e;if(s.length===0)return t.error(e.InvalidWhenClause,`Invalid 'when' clause '${r.content}'`,o),null;if(s.length===1)return value(`PropertyChanged`,[unquote(s[0])]);if(s[1]===`from`)return s.length===5&&s[3]===`to`?value(`ValueTransition`,[unquote(s[0])],unquote(s[2]),unquote(s[4])):(t.error(e.InvalidWhenTransitionClause,`Invalid 'when ... from ... to ...' clause '${r.content}'`,o),null);if(s[1]!==`or`&&s[1]!==`and`)return t.error(e.InvalidWhenClause,`Invalid 'when' clause '${r.content}'`,o),null;if(s.length%2==0)return t.error(e.WhenCombinatorWithoutProperty,`Expected a property after '${s[1]}'`,o),null;let c=[unquote(s[0])];for(let n=1;n<s.length-1;n+=2){if(s[n]!==s[1])return t.error(e.MixedWhenCombinators,`Cannot mix 'and' and 'or' in a single 'when' clause '${r.content}'`,o),null;c.push(unquote(s[n+1]))}return value(s[1]===`or`?`LogicalOr`:`LogicalAnd`,c)}export{parseCapture};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{diagnosticText as e}from"../Diagnostics/DiagnosticArgument.js";import{DiagnosticCodes as t}from"../Diagnostics/DiagnosticCodes.js";import"../Syntax/CaptureEventsSource.js";import{nativePattern as n,pattern as r}from"../Text/patterns.js";import{stringBodyPattern as i,unescapeString as a}from"../Text/StringLiteral.js";import{parseTag as o}from"./DeclarationParsers.js";import{parseModeledMappingSource as s}from"./ExpressionParser.js";import{firstWord as c,unescapeIdentifier as l}from"./LineText.js";import{parseProjectionExpression as u}from"./ProjectionExpressionParser.js";import{locationOf as d}from"./SourceLine.js";import{tryParseStructuredMapping as f}from"./StructuredBlockParser.js";const grammar=e=>({legacy:r(e),native:n(e)}),p=grammar(`^capture\\s+([A-Za-z_]\\w*)$`),m=/^[A-Za-z_][\w.]*$/,h=/\s+is\s+event\s+source$/,g=grammar(`^append\\s+([A-Z]\\w*)$`),_=grammar(`^children\\s+([a-z_]\\w*)\\s+identified\\s+by\\s+([\\w.]+)$`),v=grammar(`^nested\\s+([\\w.]+)$`),select=(e,t)=>e.sourceOptions.numericMode===`exact`?t.native:t.legacy,y=n(`^(@?[\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),b=n(`^([a-z_]\\w*)\\s*=\\s*(.+)$`),x=n(`^"(${i})"\\s*=>\\s*(\\w+)$`),S=n(`^split\\s+(\\S+)\\s+by\\s+"(${i})"$`),C=new RegExp(n(`"${i}"|[\\w.]+`).source,`gu`),w=n(`^[\\w.]+$`);function parseCapture(e,n){let r=e;e=e.valueContext;let i=select(e,p).exec(n.content)?.[1]??``;i===``&&e.sourceOptions.numericMode===`exact`&&e.error(t.InvalidCaptureDeclaration,`Invalid capture declaration '${n.content}' - expected 'capture <Name>'`,d(n));let a=null,o=null,s=!1,l=[],u=[],f=[],m=[];for(let i=e.peekChild(n.indent);i!==void 0;i=e.peekChild(n.indent))switch(e.reader.takeSignificant(),c(i.content)){case`source`:a=parseSource(e,i,r);break;case`key`:[o,s]=parseKey(i.content.substring(3).trim(),s);break;case`map`:l.push(...parseMap(e,i));break;case`append`:pushAppend(e,i,u);break;case`children`:{let n=select(e,_).exec(i.content);if(n===null){e.error(t.InvalidChildrenDeclaration,`Invalid children declaration '${i.content}' - expected 'children <collection> identified by <key>'`,d(i)),e.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(e,i);n!==null&&f.push({kind:`CaptureChildrenSyntax`,property:n[1],identifiedBy:n[2],...r,location:d(i)});break}case`nested`:{let n=select(e,v).exec(i.content);if(n===null){e.error(t.InvalidNestedDeclaration,`Invalid nested declaration '${i.content}' - expected 'nested <Property>'`,d(i)),e.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(e,i);n!==null&&m.push({kind:`CaptureNestedSyntax`,property:n[1],...r,location:d(i)});break}default:e.error(t.UnknownCaptureDirective,`Unexpected '${i.content}' in capture body`,d(i)),e.skipOpaqueBlock(i.indent)}return{kind:`CaptureSyntax`,sourceOptions:e.sourceOptions,name:i,source:a,key:o,...eventSourceKeyMarker(s),map:l,appends:u,children:f,nested:m,location:d(n)}}function parseKey(e,t){let n=h.exec(e);return n===null?[e,t]:[e.substring(0,n.index),!0]}function eventSourceKeyMarker(e){return e?{keyIsEventSource:e}:{}}function parseSource(e,t,n){let r=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){e.reader.takeSignificant();let t=c(n.content);r.push({kind:`CaptureSourceSettingSyntax`,name:t,value:n.content.substring(t.length).trim(),location:d(n)})}let i=t.content.substring(6).trim();return i===`events`&&validateEventsSource(n,t,r),{kind:`CaptureSourceSyntax`,syntaxKind:i,settings:r,location:d(t)}}function validateEventsSource(e,n,r){r.length===0&&e.error(t.InvalidCaptureEventsSource,`'source events' needs at least one 'from <Event>' line naming a public event to consume`,d(n));let i=/* @__PURE__ */ new Set;for(let n of r)n.name===`from`?m.test(n.value)?i.has(n.value)?e.error(t.InvalidCaptureEventsSource,`Event '${n.value}' is already consumed by this 'source events'`,n.location):i.add(n.value):e.error(t.InvalidCaptureEventsSource,`Invalid event '${n.value}' - expected 'from <Event>', optionally qualified with dots`,n.location):e.error(t.InvalidCaptureEventsSource,`'source events' accepts only 'from <Event>' lines, got '${n.name}'`,n.location)}function parseMap(e,n){let r=[];for(let i=e.peekChild(n.indent);i!==void 0;i=e.peekChild(n.indent)){e.reader.takeSignificant();let n=d(i);if(c(i.content)===`split`){let o=S.exec(i.content);if(o===null){e.error(t.InvalidSplitDeclaration,`Invalid split operation '${i.content}' - expected 'split <property> by "<separator>"'`,n),e.skipOpaqueBlock(i.indent);continue}let s=[];for(let n=e.peekChild(i.indent);n!==void 0;n=e.peekChild(i.indent))e.reader.takeSignificant(),w.test(n.content)?s.push(n.content):e.error(t.InvalidSplitTarget,`Invalid split target '${n.content}' - expected a property path`,d(n));o!==null&&r.push({kind:`CaptureSplitSyntax`,source:u(o[1],n,e),separator:a(o[2]),targets:s,location:n});continue}let o=b.exec(i.content);if(o===null){e.error(t.InvalidMapEntry,`Invalid map entry '${i.content}' - expected '<property> = <source> [translate]'`,n),e.skipOpaqueBlock(i.indent);continue}let s=o[2].trim(),l=s.startsWith("`")?s.indexOf("`",1):-1,f=s.startsWith("`")?l>=0&&s.substring(l+1).trim()===`translate`:s.endsWith(` translate`),p=s.startsWith("`")&&l>=0&&(e.sourceOptions.numericMode!==`exact`||f||s.substring(l+1).trim()===``)?s.substring(0,l+1):f?s.substring(0,s.length-10).trimEnd():s,m=[];if(f)for(let n=e.peekChild(i.indent);n!==void 0;n=e.peekChild(i.indent)){e.reader.takeSignificant();let r=x.exec(n.content);r===null?e.error(t.InvalidTranslation,`Invalid translation '${n.content}' - expected '"<source>" => <target>'`,d(n)):m.push({kind:`CaptureTranslationSyntax`,from:a(r[1]),to:r[2],location:d(n)})}r.push({kind:`CaptureMapEntrySyntax`,property:o[1],source:u(p,n,e),translations:m,location:n})}return r}function mapAndAppends(e,n){let r=[],i=[];for(let a=e.peekChild(n.indent);a!==void 0;a=e.peekChild(n.indent))e.reader.takeSignificant(),c(a.content)===`map`?r=parseMap(e,a):c(a.content)===`append`?pushAppend(e,a,i):(e.error(t.UnknownCaptureBlockDirective,`Unexpected '${a.content}' in ${c(n.content)} block - expected 'map' or 'append <EventType>'`,d(a)),e.skipOpaqueBlock(a.indent));return{map:r,appends:i}}function pushAppend(n,r,i){let a=select(n,g).exec(r.content);if(a===null){n.error(t.InvalidAppendDeclaration,`Invalid append declaration '${r.content}' - expected 'append <EventType>'`,d(r)),n.skipOpaqueBlock(r.indent);return}let u=[],p=[],m=null,mapping=(r,i=!1)=>{let a=d(r);if(c(r.content)===`tag`){let e=o(n.valueContext,r,!1);e!==void 0&&p.push(e);return}let m=y.exec(r.content),h=m===null?f(n.valueContext,r):void 0;m===null?h===void 0?n.error(i?t.InvalidPropertyMapping:t.UnknownAppendDirective,`Unexpected '${r.content}' in append body`,a,i?e(`text`,r.content):{}):u.push(h):u.push({kind:`PropertyMappingSyntax`,property:l(m[1]),source:s(m[2],a,n.valueContext),location:a})};for(let e=n.peekChild(r.indent);e!==void 0;e=n.peekChild(r.indent))if(n.reader.takeSignificant(),c(e.content)===`when`){m=parseWhen(n,e);for(let t=n.peekChild(e.indent);t!==void 0;t=n.peekChild(e.indent))n.reader.takeSignificant(),mapping(t,!0)}else mapping(e);i.push({kind:`CaptureAppendSyntax`,event:a[1],when:m,mappings:u,tags:p,location:d(r)})}function parseWhen(e,n){let r=n.content.substring(4).trim(),i=d(n),value=(e,t=[],n=null,r=null,a=null)=>({kind:`CaptureWhenSyntax`,syntaxKind:e,properties:t,fromValue:n,toValue:r,expression:a,location:i});if(r===`added`)return value(`Added`);if(r===`removed`)return value(`Removed`);if(r.startsWith("`"))return(!r.endsWith("`")||r.length<2)&&e.error(t.UnterminatedTemplateExpression,`Unterminated template expression in 'when' - expected a closing backtick`,i),value(`Expression`,[],null,null,r);if(r.length===0)return e.error(t.WhenWithoutTrigger,`Expected a trigger after 'when'`,i),null;let o=[...r.match(e.sourceOptions.numericMode===`exact`?/* @__PURE__ */ RegExp(`"(?:[^"\\\\]|\\\\.)*"|[^\\s]+`,`gu`):C)??[]],unquote=e=>e.startsWith(`"`)&&e.endsWith(`"`)?a(e.substring(1,e.length-1)):e;if(o.length===0)return e.error(t.InvalidWhenClause,`Invalid 'when' clause '${n.content}'`,i),null;if(o.length===1)return value(`PropertyChanged`,[unquote(o[0])]);if(o[1]===`from`)return o.length===5&&o[3]===`to`?value(`ValueTransition`,[unquote(o[0])],unquote(o[2]),unquote(o[4])):(e.error(t.InvalidWhenTransitionClause,`Invalid 'when ... from ... to ...' clause '${n.content}'`,i),null);if(o[1]!==`or`&&o[1]!==`and`)return e.error(t.InvalidWhenClause,`Invalid 'when' clause '${n.content}'`,i),null;if(o.length%2==0)return e.error(t.WhenCombinatorWithoutProperty,`Expected a property after '${o[1]}'`,i),null;let s=[unquote(o[0])];for(let r=1;r<o.length-1;r+=2){if(o[r]!==o[1])return e.error(t.MixedWhenCombinators,`Cannot mix 'and' and 'or' in a single 'when' clause '${n.content}'`,i),null;s.push(unquote(o[r+1]))}return value(o[1]===`or`?`LogicalOr`:`LogicalAnd`,s)}export{parseCapture};
2
2
  //# sourceMappingURL=CaptureParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CaptureParser.js","names":["legacyPattern","pattern","parseMappingSource","pattern","source","nativePattern","headerRules","eventNameRules","eventSourceKeyRules","appendRules","childrenRules","nestedRules","context","rules","mappingPattern","mapEntryPattern","translationPattern","stringBodyPattern","splitPattern","whenTokens","splitTarget","owner","name","line","DiagnosticCodes","locationOf","key","keyIsEventSource","map","appends","children","nested","child","firstWord","match","body","marker","settings","settingName","syntaxKind","seen","setting","location","targets","target","parseProjectionExpression","unescapeString","raw","closing","translate","text","translations","entry","translated","mappings","tags","when","tag","parseTag","mapped","structured","tryParseStructuredMapping","diagnosticText","unescapeIdentifier","parseModeledMappingSource","value","trigger","from","to","tokens","properties","index"],"sources":["../../../../../../Compiler/Parsing/CaptureParser.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CaptureAppendSyntax, CaptureChildrenSyntax, CaptureMapOperationSyntax, CaptureNestedSyntax, CaptureSourceSettingSyntax, CaptureSourceSyntax, CaptureSyntax, CaptureTranslationSyntax, CaptureWhenSyntax } from '../Syntax/Captures';\nimport { eventsSourceKind, fromSetting } from '../Syntax/CaptureEventsSource';\nimport { TagSyntax } from '../Syntax/Declarations';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { nativePattern as pattern, pattern as legacyPattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseTag } from './DeclarationParsers';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { tryParseStructuredMapping } from './StructuredBlockParser';\n\n// The grammar Legacy already modeled keeps its original patterns; native patterns apply to Exact documents.\nconst grammar = (source: string): { legacy: RegExp; native: RegExp } => ({ legacy: legacyPattern(source), native: pattern(source) });\nconst headerRules = grammar('^capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventNameRules = /^[A-Za-z_][\\w.]*$/;\nconst eventSourceKeyRules = /\\s+is\\s+event\\s+source$/;\nconst appendRules = grammar('^append\\\\s+([A-Z]\\\\w*)$');\nconst childrenRules = grammar('^children\\\\s+([a-z_]\\\\w*)\\\\s+identified\\\\s+by\\\\s+([\\\\w.]+)$');\nconst nestedRules = grammar('^nested\\\\s+([\\\\w.]+)$');\nconst select = (context: ParserContext, rules: { legacy: RegExp; native: RegExp }): RegExp => context.sourceOptions.numericMode === 'exact' ? rules.native : rules.legacy;\nconst mappingPattern = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst mapEntryPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst translationPattern = pattern(`^\"(${stringBodyPattern})\"\\\\s*=>\\\\s*(\\\\w+)$`);\nconst splitPattern = pattern(`^split\\\\s+(\\\\S+)\\\\s+by\\\\s+\"(${stringBodyPattern})\"$`);\nconst whenTokens = new RegExp(pattern(`\"${stringBodyPattern}\"|[\\\\w.]+`).source, 'gu');\nconst splitTarget = pattern('^[\\\\w.]+$');\n\n// A structural port of the existing capture grammar. Transition operands remain authored strings, as\n// C# models them; exact numeric mode is not admitted by any supported executable model (ESM) version yet (#285).\nexport function parseCapture(context: ParserContext, line: SourceLine): CaptureSyntax {\n // The events source is new grammar, so its violations reach the owning context rather than the quiet value context.\n const owner = context;\n context = context.valueContext;\n const name = select(context, headerRules).exec(line.content)?.[1] ?? '';\n if (name === '' && context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCaptureDeclaration, `Invalid capture declaration '${line.content}' - expected 'capture <Name>'`, locationOf(line));\n let source: CaptureSourceSyntax | null = null;\n let key: string | null = null;\n let keyIsEventSource = false;\n const map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n const children: CaptureChildrenSyntax[] = [];\n const nested: CaptureNestedSyntax[] = [];\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 'source': source = parseSource(context, child, owner); break;\n case 'key': [key, keyIsEventSource] = parseKey(child.content.substring('key'.length).trim(), keyIsEventSource); break;\n case 'map': map.push(...parseMap(context, child)); break;\n case 'append': pushAppend(context, child, appends); break;\n case 'children': {\n const match = select(context, childrenRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${child.content}' - expected 'children <collection> identified by <key>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) children.push({ kind: 'CaptureChildrenSyntax', property: match[1], identifiedBy: match[2], ...body, location: locationOf(child) });\n break;\n }\n case 'nested': {\n const match = select(context, nestedRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${child.content}' - expected 'nested <Property>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) nested.push({ kind: 'CaptureNestedSyntax', property: match[1], ...body, location: locationOf(child) });\n break;\n }\n default:\n context.error(DiagnosticCodes.UnknownCaptureDirective, `Unexpected '${child.content}' in capture body`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'CaptureSyntax', sourceOptions: context.sourceOptions, name, source, key, ...eventSourceKeyMarker(keyIsEventSource), map, appends, children, nested, location: locationOf(line) };\n}\n\nfunction parseKey(key: string, keyIsEventSource: boolean): [string, boolean] {\n const marker = eventSourceKeyRules.exec(key);\n return marker !== null ? [key.substring(0, marker.index), true] : [key, keyIsEventSource];\n}\n\nfunction eventSourceKeyMarker(keyIsEventSource: boolean): { keyIsEventSource?: boolean } {\n return keyIsEventSource ? { keyIsEventSource } : {};\n}\n\nfunction parseSource(context: ParserContext, line: SourceLine, owner: ParserContext): CaptureSourceSyntax {\n const settings: CaptureSourceSettingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const settingName = firstWord(child.content);\n settings.push({ kind: 'CaptureSourceSettingSyntax', name: settingName, value: child.content.substring(settingName.length).trim(), location: locationOf(child) });\n }\n const syntaxKind = line.content.substring('source'.length).trim();\n if (syntaxKind === eventsSourceKind) validateEventsSource(owner, line, settings);\n return { kind: 'CaptureSourceSyntax', syntaxKind, settings, location: locationOf(line) };\n}\n\nfunction validateEventsSource(context: ParserContext, line: SourceLine, settings: readonly CaptureSourceSettingSyntax[]): void {\n if (settings.length === 0) context.error(DiagnosticCodes.InvalidCaptureEventsSource, \"'source events' needs at least one 'from <Event>' line naming a public event to consume\", locationOf(line));\n const seen = new Set<string>();\n for (const setting of settings) {\n if (setting.name !== fromSetting) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `'source events' accepts only 'from <Event>' lines, got '${setting.name}'`, setting.location);\n else if (!eventNameRules.test(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Invalid event '${setting.value}' - expected 'from <Event>', optionally qualified with dots`, setting.location);\n else if (seen.has(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Event '${setting.value}' is already consumed by this 'source events'`, setting.location);\n else seen.add(setting.value);\n }\n}\n\nfunction parseMap(context: ParserContext, line: SourceLine): CaptureMapOperationSyntax[] {\n const map: CaptureMapOperationSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const location = locationOf(child);\n if (firstWord(child.content) === 'split') {\n const match = splitPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidSplitDeclaration, `Invalid split operation '${child.content}' - expected 'split <property> by \"<separator>\"'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const targets: string[] = [];\n for (let target = context.peekChild(child.indent); target !== undefined; target = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (splitTarget.test(target.content)) targets.push(target.content);\n else context.error(DiagnosticCodes.InvalidSplitTarget, `Invalid split target '${target.content}' - expected a property path`, locationOf(target));\n }\n if (match !== null) map.push({ kind: 'CaptureSplitSyntax', source: parseProjectionExpression(match[1], location, context), separator: unescapeString(match[2]), targets, location });\n continue;\n }\n const match = mapEntryPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidMapEntry, `Invalid map entry '${child.content}' - expected '<property> = <source> [translate]'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const raw = match[2].trim();\n const closing = raw.startsWith('`') ? raw.indexOf('`', 1) : -1;\n const translate = raw.startsWith('`') ? closing >= 0 && raw.substring(closing + 1).trim() === 'translate' : raw.endsWith(' translate');\n const text = raw.startsWith('`') && closing >= 0 && (context.sourceOptions.numericMode !== 'exact' || translate || raw.substring(closing + 1).trim() === '') ? raw.substring(0, closing + 1) : translate ? raw.substring(0, raw.length - ' translate'.length).trimEnd() : raw;\n const translations: CaptureTranslationSyntax[] = [];\n if (translate) {\n for (let entry = context.peekChild(child.indent); entry !== undefined; entry = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const translated = translationPattern.exec(entry.content);\n if (translated !== null) translations.push({ kind: 'CaptureTranslationSyntax', from: unescapeString(translated[1]), to: translated[2], location: locationOf(entry) });\n else context.error(DiagnosticCodes.InvalidTranslation, `Invalid translation '${entry.content}' - expected '\"<source>\" => <target>'`, locationOf(entry));\n }\n }\n map.push({ kind: 'CaptureMapEntrySyntax', property: match[1], source: parseProjectionExpression(text, location, context), translations, location });\n }\n return map;\n}\n\nfunction mapAndAppends(context: ParserContext, line: SourceLine): { map: CaptureMapOperationSyntax[]; appends: CaptureAppendSyntax[] } {\n let map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'map') map = parseMap(context, child);\n else if (firstWord(child.content) === 'append') pushAppend(context, child, appends);\n else {\n context.error(DiagnosticCodes.UnknownCaptureBlockDirective, `Unexpected '${child.content}' in ${firstWord(line.content)} block - expected 'map' or 'append <EventType>'`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { map, appends };\n}\n\nfunction pushAppend(context: ParserContext, line: SourceLine, appends: CaptureAppendSyntax[]): void {\n const match = select(context, appendRules).exec(line.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidAppendDeclaration, `Invalid append declaration '${line.content}' - expected 'append <EventType>'`, locationOf(line)); context.skipOpaqueBlock(line.indent); return; }\n const mappings: PropertyMappingSyntax[] = [];\n const tags: TagSyntax[] = [];\n let when: CaptureWhenSyntax | null = null;\n const mapping = (child: SourceLine, nested = false): void => {\n const location = locationOf(child);\n if (firstWord(child.content) === 'tag') {\n const tag = parseTag(context.valueContext, child, false);\n if (tag !== undefined) tags.push(tag);\n return;\n }\n const mapped = mappingPattern.exec(child.content);\n const structured = mapped === null ? tryParseStructuredMapping(context.valueContext, child) : undefined;\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: unescapeIdentifier(mapped[1]), source: parseMappingSource(mapped[2], location, context.valueContext), location });\n else if (structured !== undefined) mappings.push(structured);\n else context.error(nested ? DiagnosticCodes.InvalidPropertyMapping : DiagnosticCodes.UnknownAppendDirective, `Unexpected '${child.content}' in append body`, location, nested ? diagnosticText('text', child.content) : {});\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'when') {\n when = parseWhen(context, child);\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n mapping(value, true);\n }\n } else mapping(child);\n }\n appends.push({ kind: 'CaptureAppendSyntax', event: match[1], when, mappings, tags, location: locationOf(line) });\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine): CaptureWhenSyntax | null {\n const trigger = line.content.substring('when'.length).trim();\n const location = locationOf(line);\n const value = (syntaxKind: CaptureWhenSyntax['syntaxKind'], properties: string[] = [], from: string | null = null, to: string | null = null, expression: string | null = null): CaptureWhenSyntax => ({ kind: 'CaptureWhenSyntax', syntaxKind, properties, fromValue: from, toValue: to, expression, location });\n if (trigger === 'added') return value('Added');\n if (trigger === 'removed') return value('Removed');\n if (trigger.startsWith('`')) {\n if (!trigger.endsWith('`') || trigger.length < 2) context.error(DiagnosticCodes.UnterminatedTemplateExpression, \"Unterminated template expression in 'when' - expected a closing backtick\", location);\n return value('Expression', [], null, null, trigger);\n }\n if (trigger.length === 0) { context.error(DiagnosticCodes.WhenWithoutTrigger, \"Expected a trigger after 'when'\", location); return null; }\n const tokens: string[] = [...(trigger.match(context.sourceOptions.numericMode === 'exact' ? new RegExp(`\"${stringBodyPattern}\"|[^\\\\s]+`, 'gu') : whenTokens) ?? [])];\n const unquote = (text: string): string => text.startsWith('\"') && text.endsWith('\"') ? unescapeString(text.substring(1, text.length - 1)) : text;\n if (tokens.length === 0) { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length === 1) return value('PropertyChanged', [unquote(tokens[0])]);\n if (tokens[1] === 'from') {\n if (tokens.length === 5 && tokens[3] === 'to') return value('ValueTransition', [unquote(tokens[0])], unquote(tokens[2]), unquote(tokens[4]));\n context.error(DiagnosticCodes.InvalidWhenTransitionClause, `Invalid 'when ... from ... to ...' clause '${line.content}'`, location); return null;\n }\n if (tokens[1] !== 'or' && tokens[1] !== 'and') { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length % 2 === 0) { context.error(DiagnosticCodes.WhenCombinatorWithoutProperty, `Expected a property after '${tokens[1]}'`, location); return null; }\n const properties = [unquote(tokens[0])];\n for (let index = 1; index < tokens.length - 1; index += 2) {\n if (tokens[index] !== tokens[1]) { context.error(DiagnosticCodes.MixedWhenCombinators, `Cannot mix 'and' and 'or' in a single 'when' clause '${line.content}'`, location); return null; }\n properties.push(unquote(tokens[index + 1]));\n }\n return value(tokens[1] === 'or' ? 'LogicalOr' : 'LogicalAnd', properties);\n}\n"],"mappings":"ivBAoBA,MAAM,QAAW,IAAwD,CAAE,OAAQA,EAAcI,CAAM,EAAG,OAAQH,EAAQG,CAAM,CAAE,GAC5HE,EAAc,QAAQ,8BAA8B,EACpDC,EAAiB,oBACjBC,EAAsB,0BACtBC,EAAc,QAAQ,yBAAyB,EAC/CC,EAAgB,QAAQ,6DAA6D,EACrFC,EAAc,QAAQ,uBAAuB,EAC7C,QAAU,EAAwB,IAAsDC,EAAQ,cAAc,cA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AQ,EAAU,KAC/J,GAAI2B,EAAO,OAAS,GAAM,EAAyH,OAApHzD,EAAQ,MAAMY,EAAgB,8BAA+B,8BAA8B6C,EAAO,GAAG,GAAI3B,CAAQ,EAAU,KAC1J,IAAM4B,EAAa,CAAC,QAAQD,EAAO,EAAE,CAAC,EACtC,IAAK,IAAIE,EAAQ,EAAGA,EAAQF,EAAO,OAAS,EAAG,GAAS,EAAG,CACvD,GAAIA,EAAOE,KAAWF,EAAO,GAA8I,OAAxIzD,EAAQ,MAAMY,EAAgB,qBAAsB,wDAAwDD,EAAK,QAAQ,GAAImB,CAAQ,EAAU,KAClL4B,EAAW,KAAK,QAAQD,EAAOE,EAAQ,EAAE,CAAC,CAC9C,CACA,OAAO,MAAMF,EAAO,KAAO,KAAO,YAAc,aAAcC,CAAU,CAC5E"}
1
+ {"version":3,"file":"CaptureParser.js","names":["legacyPattern","pattern","parseMappingSource","pattern","source","nativePattern","headerRules","eventNameRules","eventSourceKeyRules","appendRules","childrenRules","nestedRules","context","rules","mappingPattern","mapEntryPattern","translationPattern","stringBodyPattern","splitPattern","whenTokens","splitTarget","owner","name","line","DiagnosticCodes","locationOf","key","keyIsEventSource","map","appends","children","nested","child","firstWord","match","body","marker","settings","settingName","syntaxKind","seen","setting","location","targets","target","parseProjectionExpression","unescapeString","raw","closing","translate","text","translations","entry","translated","mappings","tags","when","tag","parseTag","mapped","structured","tryParseStructuredMapping","diagnosticText","unescapeIdentifier","parseModeledMappingSource","value","trigger","from","to","tokens","properties","index"],"sources":["../../../../../../Compiler/Parsing/CaptureParser.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CaptureAppendSyntax, CaptureChildrenSyntax, CaptureMapOperationSyntax, CaptureNestedSyntax, CaptureSourceSettingSyntax, CaptureSourceSyntax, CaptureSyntax, CaptureTranslationSyntax, CaptureWhenSyntax } from '../Syntax/Captures';\nimport { eventsSourceKind, fromSetting } from '../Syntax/CaptureEventsSource';\nimport { TagSyntax } from '../Syntax/Declarations';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { nativePattern as pattern, pattern as legacyPattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseTag } from './DeclarationParsers';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { tryParseStructuredMapping } from './StructuredBlockParser';\n\n// The grammar Legacy already modeled keeps its original patterns; native patterns apply to Exact documents.\nconst grammar = (source: string): { legacy: RegExp; native: RegExp } => ({ legacy: legacyPattern(source), native: pattern(source) });\nconst headerRules = grammar('^capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventNameRules = /^[A-Za-z_][\\w.]*$/;\nconst eventSourceKeyRules = /\\s+is\\s+event\\s+source$/;\nconst appendRules = grammar('^append\\\\s+([A-Z]\\\\w*)$');\nconst childrenRules = grammar('^children\\\\s+([a-z_]\\\\w*)\\\\s+identified\\\\s+by\\\\s+([\\\\w.]+)$');\nconst nestedRules = grammar('^nested\\\\s+([\\\\w.]+)$');\nconst select = (context: ParserContext, rules: { legacy: RegExp; native: RegExp }): RegExp => context.sourceOptions.numericMode === 'exact' ? rules.native : rules.legacy;\nconst mappingPattern = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst mapEntryPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst translationPattern = pattern(`^\"(${stringBodyPattern})\"\\\\s*=>\\\\s*(\\\\w+)$`);\nconst splitPattern = pattern(`^split\\\\s+(\\\\S+)\\\\s+by\\\\s+\"(${stringBodyPattern})\"$`);\nconst whenTokens = new RegExp(pattern(`\"${stringBodyPattern}\"|[\\\\w.]+`).source, 'gu');\nconst splitTarget = pattern('^[\\\\w.]+$');\n\n// A structural port of the existing capture grammar. Transition operands remain authored strings, as\n// C# models them; exact numeric mode is not admitted by any supported executable model (ESM) version yet (#285).\nexport function parseCapture(context: ParserContext, line: SourceLine): CaptureSyntax {\n // The events source is new grammar, so its violations reach the owning context rather than the quiet value context.\n const owner = context;\n context = context.valueContext;\n const name = select(context, headerRules).exec(line.content)?.[1] ?? '';\n if (name === '' && context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCaptureDeclaration, `Invalid capture declaration '${line.content}' - expected 'capture <Name>'`, locationOf(line));\n let source: CaptureSourceSyntax | null = null;\n let key: string | null = null;\n let keyIsEventSource = false;\n const map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n const children: CaptureChildrenSyntax[] = [];\n const nested: CaptureNestedSyntax[] = [];\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 'source': source = parseSource(context, child, owner); break;\n case 'key': [key, keyIsEventSource] = parseKey(child.content.substring('key'.length).trim(), keyIsEventSource); break;\n case 'map': map.push(...parseMap(context, child)); break;\n case 'append': pushAppend(context, child, appends); break;\n case 'children': {\n const match = select(context, childrenRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${child.content}' - expected 'children <collection> identified by <key>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) children.push({ kind: 'CaptureChildrenSyntax', property: match[1], identifiedBy: match[2], ...body, location: locationOf(child) });\n break;\n }\n case 'nested': {\n const match = select(context, nestedRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${child.content}' - expected 'nested <Property>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) nested.push({ kind: 'CaptureNestedSyntax', property: match[1], ...body, location: locationOf(child) });\n break;\n }\n default:\n context.error(DiagnosticCodes.UnknownCaptureDirective, `Unexpected '${child.content}' in capture body`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'CaptureSyntax', sourceOptions: context.sourceOptions, name, source, key, ...eventSourceKeyMarker(keyIsEventSource), map, appends, children, nested, location: locationOf(line) };\n}\n\nfunction parseKey(key: string, keyIsEventSource: boolean): [string, boolean] {\n const marker = eventSourceKeyRules.exec(key);\n return marker !== null ? [key.substring(0, marker.index), true] : [key, keyIsEventSource];\n}\n\nfunction eventSourceKeyMarker(keyIsEventSource: boolean): { keyIsEventSource?: boolean } {\n return keyIsEventSource ? { keyIsEventSource } : {};\n}\n\nfunction parseSource(context: ParserContext, line: SourceLine, owner: ParserContext): CaptureSourceSyntax {\n const settings: CaptureSourceSettingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const settingName = firstWord(child.content);\n settings.push({ kind: 'CaptureSourceSettingSyntax', name: settingName, value: child.content.substring(settingName.length).trim(), location: locationOf(child) });\n }\n const syntaxKind = line.content.substring('source'.length).trim();\n if (syntaxKind === eventsSourceKind) validateEventsSource(owner, line, settings);\n return { kind: 'CaptureSourceSyntax', syntaxKind, settings, location: locationOf(line) };\n}\n\nfunction validateEventsSource(context: ParserContext, line: SourceLine, settings: readonly CaptureSourceSettingSyntax[]): void {\n if (settings.length === 0) context.error(DiagnosticCodes.InvalidCaptureEventsSource, \"'source events' needs at least one 'from <Event>' line naming a public event to consume\", locationOf(line));\n const seen = new Set<string>();\n for (const setting of settings) {\n if (setting.name !== fromSetting) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `'source events' accepts only 'from <Event>' lines, got '${setting.name}'`, setting.location);\n else if (!eventNameRules.test(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Invalid event '${setting.value}' - expected 'from <Event>', optionally qualified with dots`, setting.location);\n else if (seen.has(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Event '${setting.value}' is already consumed by this 'source events'`, setting.location);\n else seen.add(setting.value);\n }\n}\n\nfunction parseMap(context: ParserContext, line: SourceLine): CaptureMapOperationSyntax[] {\n const map: CaptureMapOperationSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const location = locationOf(child);\n if (firstWord(child.content) === 'split') {\n const match = splitPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidSplitDeclaration, `Invalid split operation '${child.content}' - expected 'split <property> by \"<separator>\"'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const targets: string[] = [];\n for (let target = context.peekChild(child.indent); target !== undefined; target = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (splitTarget.test(target.content)) targets.push(target.content);\n else context.error(DiagnosticCodes.InvalidSplitTarget, `Invalid split target '${target.content}' - expected a property path`, locationOf(target));\n }\n if (match !== null) map.push({ kind: 'CaptureSplitSyntax', source: parseProjectionExpression(match[1], location, context), separator: unescapeString(match[2]), targets, location });\n continue;\n }\n const match = mapEntryPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidMapEntry, `Invalid map entry '${child.content}' - expected '<property> = <source> [translate]'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const raw = match[2].trim();\n const closing = raw.startsWith('`') ? raw.indexOf('`', 1) : -1;\n const translate = raw.startsWith('`') ? closing >= 0 && raw.substring(closing + 1).trim() === 'translate' : raw.endsWith(' translate');\n const text = raw.startsWith('`') && closing >= 0 && (context.sourceOptions.numericMode !== 'exact' || translate || raw.substring(closing + 1).trim() === '') ? raw.substring(0, closing + 1) : translate ? raw.substring(0, raw.length - ' translate'.length).trimEnd() : raw;\n const translations: CaptureTranslationSyntax[] = [];\n if (translate) {\n for (let entry = context.peekChild(child.indent); entry !== undefined; entry = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const translated = translationPattern.exec(entry.content);\n if (translated !== null) translations.push({ kind: 'CaptureTranslationSyntax', from: unescapeString(translated[1]), to: translated[2], location: locationOf(entry) });\n else context.error(DiagnosticCodes.InvalidTranslation, `Invalid translation '${entry.content}' - expected '\"<source>\" => <target>'`, locationOf(entry));\n }\n }\n map.push({ kind: 'CaptureMapEntrySyntax', property: match[1], source: parseProjectionExpression(text, location, context), translations, location });\n }\n return map;\n}\n\nfunction mapAndAppends(context: ParserContext, line: SourceLine): { map: CaptureMapOperationSyntax[]; appends: CaptureAppendSyntax[] } {\n let map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'map') map = parseMap(context, child);\n else if (firstWord(child.content) === 'append') pushAppend(context, child, appends);\n else {\n context.error(DiagnosticCodes.UnknownCaptureBlockDirective, `Unexpected '${child.content}' in ${firstWord(line.content)} block - expected 'map' or 'append <EventType>'`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { map, appends };\n}\n\nfunction pushAppend(context: ParserContext, line: SourceLine, appends: CaptureAppendSyntax[]): void {\n const match = select(context, appendRules).exec(line.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidAppendDeclaration, `Invalid append declaration '${line.content}' - expected 'append <EventType>'`, locationOf(line)); context.skipOpaqueBlock(line.indent); return; }\n const mappings: PropertyMappingSyntax[] = [];\n const tags: TagSyntax[] = [];\n let when: CaptureWhenSyntax | null = null;\n const mapping = (child: SourceLine, nested = false): void => {\n const location = locationOf(child);\n if (firstWord(child.content) === 'tag') {\n const tag = parseTag(context.valueContext, child, false);\n if (tag !== undefined) tags.push(tag);\n return;\n }\n const mapped = mappingPattern.exec(child.content);\n const structured = mapped === null ? tryParseStructuredMapping(context.valueContext, child) : undefined;\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: unescapeIdentifier(mapped[1]), source: parseMappingSource(mapped[2], location, context.valueContext), location });\n else if (structured !== undefined) mappings.push(structured);\n else context.error(nested ? DiagnosticCodes.InvalidPropertyMapping : DiagnosticCodes.UnknownAppendDirective, `Unexpected '${child.content}' in append body`, location, nested ? diagnosticText('text', child.content) : {});\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'when') {\n when = parseWhen(context, child);\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n mapping(value, true);\n }\n } else mapping(child);\n }\n appends.push({ kind: 'CaptureAppendSyntax', event: match[1], when, mappings, tags, location: locationOf(line) });\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine): CaptureWhenSyntax | null {\n const trigger = line.content.substring('when'.length).trim();\n const location = locationOf(line);\n const value = (syntaxKind: CaptureWhenSyntax['syntaxKind'], properties: string[] = [], from: string | null = null, to: string | null = null, expression: string | null = null): CaptureWhenSyntax => ({ kind: 'CaptureWhenSyntax', syntaxKind, properties, fromValue: from, toValue: to, expression, location });\n if (trigger === 'added') return value('Added');\n if (trigger === 'removed') return value('Removed');\n if (trigger.startsWith('`')) {\n if (!trigger.endsWith('`') || trigger.length < 2) context.error(DiagnosticCodes.UnterminatedTemplateExpression, \"Unterminated template expression in 'when' - expected a closing backtick\", location);\n return value('Expression', [], null, null, trigger);\n }\n if (trigger.length === 0) { context.error(DiagnosticCodes.WhenWithoutTrigger, \"Expected a trigger after 'when'\", location); return null; }\n const tokens: string[] = [...(trigger.match(context.sourceOptions.numericMode === 'exact' ? new RegExp(`\"${stringBodyPattern}\"|[^\\\\s]+`, 'gu') : whenTokens) ?? [])];\n const unquote = (text: string): string => text.startsWith('\"') && text.endsWith('\"') ? unescapeString(text.substring(1, text.length - 1)) : text;\n if (tokens.length === 0) { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length === 1) return value('PropertyChanged', [unquote(tokens[0])]);\n if (tokens[1] === 'from') {\n if (tokens.length === 5 && tokens[3] === 'to') return value('ValueTransition', [unquote(tokens[0])], unquote(tokens[2]), unquote(tokens[4]));\n context.error(DiagnosticCodes.InvalidWhenTransitionClause, `Invalid 'when ... from ... to ...' clause '${line.content}'`, location); return null;\n }\n if (tokens[1] !== 'or' && tokens[1] !== 'and') { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length % 2 === 0) { context.error(DiagnosticCodes.WhenCombinatorWithoutProperty, `Expected a property after '${tokens[1]}'`, location); return null; }\n const properties = [unquote(tokens[0])];\n for (let index = 1; index < tokens.length - 1; index += 2) {\n if (tokens[index] !== tokens[1]) { context.error(DiagnosticCodes.MixedWhenCombinators, `Cannot mix 'and' and 'or' in a single 'when' clause '${line.content}'`, location); return null; }\n properties.push(unquote(tokens[index + 1]));\n }\n return value(tokens[1] === 'or' ? 'LogicalOr' : 'LogicalAnd', properties);\n}\n"],"mappings":"A,ivBAoBA,MAAM,QAAW,IAAwD,CAAE,OAAQA,EAAcI,CAAM,EAAG,OAAQH,EAAQG,CAAM,CAAE,GAC5HE,EAAc,QAAQ,8BAA8B,EACpDC,EAAiB,oBACjBC,EAAsB,0BACtBC,EAAc,QAAQ,yBAAyB,EAC/CC,EAAgB,QAAQ,6DAA6D,EACrFC,EAAc,QAAQ,uBAAuB,EAC7C,QAAU,EAAwB,IAAsDC,EAAQ,cAAc,cAAgB,QAAUC,EAAM,OAASA,EAAM,OAC7JC,EAAiBb,EAAQ,mCAAmC,EAC5Dc,EAAkBd,EAAQ,6BAA6B,EACvDe,EAAqBf,EAAQ,MAAMgB,EAAkB,oBAAoB,EACzEC,EAAejB,EAAQ,+BAA+BgB,EAAkB,IAAI,EAC5EE,EAAa,IAAI,OAAOlB,EAAQ,IAAIgB,EAA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AS,EAAG,GAAS,EAAG,CACvD,GAAIA,EAAOE,KAAWF,EAAO,GAA8I,OAAxIzD,EAAQ,MAAMY,EAAgB,qBAAsB,wDAAwDD,EAAK,QAAQ,GAAImB,CAAQ,EAAU,KAClL4B,EAAW,KAAK,QAAQD,EAAOE,EAAQ,EAAE,CAAC,CAC9C,CACA,OAAO,MAAMF,EAAO,KAAO,KAAO,YAAc,aAAcC,CAAU,CAC5E,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ClockOperandParser.js","names":["units","token","tokens","position","amount","unit","context","location","DiagnosticCodes","operand","parseModeledMappingSource","sign","clock","amountToken","amountText","negative"],"sources":["../../../../../../Compiler/Parsing/ClockOperandParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { parseModeledMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\n\ninterface Operand {\n expression: ExpressionSyntax | null;\n text: string;\n position: number;\n}\n\nconst units = new Set(['day', 'days', 'hour', 'hours', 'minute', 'minutes']);\nconst isClock = (token: string | undefined): boolean => token === 'today' || token === 'now';\nconst isSign = (token: string | undefined): boolean => token !== undefined && /^[+-](?:[0-9]+)?$/.test(token);\nconst startsOffset = (tokens: readonly string[], position: number): boolean => isClock(tokens[position]) && isSign(tokens[position + 1]);\nconst isAmount = (amount: number): boolean => Number.isSafeInteger(amount) && amount <= 2147483647;\nconst isUnit = (unit: string | undefined): boolean => unit !== undefined && units.has(unit);\n\n// Decisions 0106/0107. Bare today/now stay ordinary names; only an offset or 'date of' gets a new node.\n// null means no clock operand; a null expression means a malformed clock operand, already diagnosed.\nexport function parseClockOperand(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand | null {\n if (tokens[position] === 'date' && tokens[position + 1] === 'of') return parseDateOf(context, tokens, position + 2, location);\n return startsOffset(tokens, position) ? parseOffset(context, tokens, position, location) : null;\n}\n\nfunction parseDateOf(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand {\n if (position >= tokens.length) {\n context.error(DiagnosticCodes.ExpectedComparisonValue, \"Expected an operand after 'date of'\", location);\n return { expression: null, text: '', position };\n }\n const operand = startsOffset(tokens, position)\n ? parseOffset(context, tokens, position, location)\n : { expression: parseModeledMappingSource(tokens[position], location, context), text: tokens[position], position: position + 1 };\n return { expression: operand.expression === null ? null : { kind: 'DateOfExpressionSyntax', operand: operand.expression, location }, text: `date of ${operand.text}`, position: operand.position };\n}\n\nfunction readAmount(tokens: readonly string[], position: number, sign: string): { text: string; position: number } {\n if (sign.length > 1) return { text: sign.slice(1), position };\n return position < tokens.length ? { text: tokens[position], position: position + 1 } : { text: '', position };\n}\n\nfunction parseOffset(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand {\n const clock = tokens[position++];\n const sign = tokens[position++];\n const amountToken = readAmount(tokens, position, sign);\n const amountText = amountToken.text;\n position = amountToken.position;\n const amount = /^[0-9]+$/.test(amountText) ? Number(amountText) : Number.NaN;\n if (!isAmount(amount)) {\n context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Expected a whole number of days, hours or minutes after '${clock} ${sign[0]}', got '${amountText}'`, location);\n return { expression: null, text: '', position };\n }\n const unit = tokens[position];\n if (!isUnit(unit)) {\n context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Expected a unit (day, hour or minute) after '${clock} ${sign[0]} ${amountText}'`, location);\n return { expression: null, text: '', position };\n }\n const negative = sign[0] === '-' && amount !== 0;\n return {\n expression: { kind: 'ClockOffsetExpressionSyntax', clock, amount: negative ? -amount : amount, unit, location },\n text: `${clock} ${negative ? '-' : '+'} ${amount} ${unit}`, position: position + 1\n };\n}\n"],"mappings":"2LAeA,MAAMA,kBAAQ,IAAI,IAAI,CAAC,MAAO,OAAQ,OAAQ,QAAS,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AAUA,EAAW,CAAE,EAAI,CAAE,KAAM,GAAI,UAAS,CAChH,CAEA,SAAS,YAAY,EAAwB,EAA2B,EAAkB,EAAmC,CACzH,IAAMS,EAAQV,EAAO,KACfS,EAAOT,EAAO,KACdW,EAAc,WAAWX,EAAQC,EAAUQ,CAAI,EAC/CG,EAAaD,EAAY,KAC/B,EAAWA,EAAY,SACvB,IAAMT,EAAS,WAAW,KAAKU,CAAU,EAAI,OAAOA,CAAU,EAAI,IAClE,GAAI,CAAC,SAASV,CAAM,EAEhB,OADAE,EAAQ,MAAME,EAAgB,2BAA4B,4DAA4DI,EAAM,GAAGD,EAAK,GAAG,UAAUG,EAAW,GAAIP,CAAQ,EACjK,CAAE,WAAY,KAAM,KAAM,GAAI,UAAS,EAElD,IAAMF,EAAOH,EAAOC,GACpB,GAAI,CAAC,OAAOE,CAAI,EAEZ,OADAC,EAAQ,MAAME,EAAgB,2BAA4B,gDAAgDI,EAAM,GAAGD,EAAK,GAAG,GAAGG,EAAW,GAAIP,CAAQ,EAC9I,CAAE,WAAY,KAAM,KAAM,GAAI,UAAS,EAElD,IAAMQ,EAAWJ,EAAK,KAAO,KAAOP,IAAW,EAC/C,MAAO,CACH,WAAY,CAAE,KAAM,8BAA+B,QAAO,OAAQW,EAAW,CAACX,EAASA,EAAQ,OAAM,UAAS,EAC9G,KAAM,GAAGQ,EAAM,GAAGG,EAAW,IAAM,IAAI,GAAGX,EAAO,GAAGC,IAAQ,SAAUF,EAAW,CACrF,CACJ"}
1
+ {"version":3,"file":"ClockOperandParser.js","names":["units","token","tokens","position","amount","unit","context","location","DiagnosticCodes","operand","parseModeledMappingSource","sign","clock","amountToken","amountText","negative"],"sources":["../../../../../../Compiler/Parsing/ClockOperandParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { parseModeledMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\n\ninterface Operand {\n expression: ExpressionSyntax | null;\n text: string;\n position: number;\n}\n\nconst units = new Set(['day', 'days', 'hour', 'hours', 'minute', 'minutes']);\nconst isClock = (token: string | undefined): boolean => token === 'today' || token === 'now';\nconst isSign = (token: string | undefined): boolean => token !== undefined && /^[+-](?:[0-9]+)?$/.test(token);\nconst startsOffset = (tokens: readonly string[], position: number): boolean => isClock(tokens[position]) && isSign(tokens[position + 1]);\nconst isAmount = (amount: number): boolean => Number.isSafeInteger(amount) && amount <= 2147483647;\nconst isUnit = (unit: string | undefined): boolean => unit !== undefined && units.has(unit);\n\n// Decisions 0106/0107. Bare today/now stay ordinary names; only an offset or 'date of' gets a new node.\n// null means no clock operand; a null expression means a malformed clock operand, already diagnosed.\nexport function parseClockOperand(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand | null {\n if (tokens[position] === 'date' && tokens[position + 1] === 'of') return parseDateOf(context, tokens, position + 2, location);\n return startsOffset(tokens, position) ? parseOffset(context, tokens, position, location) : null;\n}\n\nfunction parseDateOf(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand {\n if (position >= tokens.length) {\n context.error(DiagnosticCodes.ExpectedComparisonValue, \"Expected an operand after 'date of'\", location);\n return { expression: null, text: '', position };\n }\n const operand = startsOffset(tokens, position)\n ? parseOffset(context, tokens, position, location)\n : { expression: parseModeledMappingSource(tokens[position], location, context), text: tokens[position], position: position + 1 };\n return { expression: operand.expression === null ? null : { kind: 'DateOfExpressionSyntax', operand: operand.expression, location }, text: `date of ${operand.text}`, position: operand.position };\n}\n\nfunction readAmount(tokens: readonly string[], position: number, sign: string): { text: string; position: number } {\n if (sign.length > 1) return { text: sign.slice(1), position };\n return position < tokens.length ? { text: tokens[position], position: position + 1 } : { text: '', position };\n}\n\nfunction parseOffset(context: ParserContext, tokens: readonly string[], position: number, location: SourceLocation): Operand {\n const clock = tokens[position++];\n const sign = tokens[position++];\n const amountToken = readAmount(tokens, position, sign);\n const amountText = amountToken.text;\n position = amountToken.position;\n const amount = /^[0-9]+$/.test(amountText) ? Number(amountText) : Number.NaN;\n if (!isAmount(amount)) {\n context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Expected a whole number of days, hours or minutes after '${clock} ${sign[0]}', got '${amountText}'`, location);\n return { expression: null, text: '', position };\n }\n const unit = tokens[position];\n if (!isUnit(unit)) {\n context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Expected a unit (day, hour or minute) after '${clock} ${sign[0]} ${amountText}'`, location);\n return { expression: null, text: '', position };\n }\n const negative = sign[0] === '-' && amount !== 0;\n return {\n expression: { kind: 'ClockOffsetExpressionSyntax', clock, amount: negative ? -amount : amount, unit, location },\n text: `${clock} ${negative ? '-' : '+'} ${amount} ${unit}`, position: position + 1\n };\n}\n"],"mappings":"A,2LAeA,MAAMA,kBAAQ,IAAI,IAAI,CAAC,MAAO,OAAQ,OAAQ,QAAS,SAAU,SAAS,CAAC,EACrE,QAAW,GAAuCC,IAAU,SAAWA,IAAU,MACjF,OAAU,GAAuCA,IAAU,IAAA,IAAa,oBAAoB,KAAKA,CAAK,EACtG,cAAgB,EAA2B,IAA8B,QAAQC,EAAOC,EAAS,GAAK,OAAOD,EAAOC,EAAW,EAAE,EACjI,SAAY,GAA4B,OAAO,cAAcC,CAAM,GAAKA,GAAU,WAClF,OAAU,GAAsCC,IAAS,IAAA,IAAaL,EAAM,IAAIK,CAAI,EAI1F,SAAgB,kBAAkB,EAAwB,EAA2B,EAAkB,EAA0C,CAE7I,OADIH,EAAOC,KAAc,QAAUD,EAAOC,EAAW,KAAO,KAAa,YAAYG,EAASJ,EAAQC,EAAW,EAAGI,CAAQ,EACrH,aAAaL,EAAQC,CAAQ,EAAI,YAAYG,EAASJ,EAAQC,EAAUI,CAAQ,EAAI,IAC/F,CAEA,SAAS,YAAY,EAAwB,EAA2B,EAAkB,EAA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AAGD,EAAK,GAAG,GAAGG,EAAW,GAAIP,CAAQ,EAC9I,CAAE,WAAY,KAAM,KAAM,GAAI,UAAS,EAElD,IAAMQ,EAAWJ,EAAK,KAAO,KAAOP,IAAW,EAC/C,MAAO,CACH,WAAY,CAAE,KAAM,8BAA+B,QAAO,OAAQW,EAAW,CAACX,EAASA,EAAQ,OAAM,UAAS,EAC9G,KAAM,GAAGQ,EAAM,GAAGG,EAAW,IAAM,IAAI,GAAGX,EAAO,GAAGC,IAAQ,SAAUF,EAAW,CACrF,CACJ,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlockParser.js","names":["open","tagLine","context","expectedFence","opener","allowMarkdown","DiagnosticCodes","locationOf","code","line","strip"],"sources":["../../../../../../Compiler/Parsing/CodeBlockParser.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 { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads the body of a fenced block that follows a directive, the way the C# CodeBlockParser does: the\n// opening fence is either on the directive's own line or the next deeper line, and the body runs to a line\n// holding only the closing fence. Body lines lose up to the opening fence's indent.\nexport function parseFencedText(context: ParserContext, opener: string, tagLine: SourceLine, allowMarkdown = false): string | null {\n const onTagLine = tagLine.content.startsWith('```');\n const open = onTagLine ? tagLine : context.reader.peekSignificant();\n const expectedFence = opener === 'description' ? '```text' : `\\`\\`\\`${opener}`;\n if (open === undefined || (open !== tagLine && open.indent <= tagLine.indent) ||\n (open.content !== expectedFence && !(allowMarkdown && opener === 'description' && open.content === '```markdown') && !(open.content === '```' && open !== tagLine))) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected an opening \\`\\`\\`${opener === 'description' ? 'text' : opener} fence after '${opener}'`, locationOf(tagLine));\n return null;\n }\n if (open !== tagLine) {\n context.reader.takeSignificant();\n }\n if (opener === 'description' && open.content === '```') {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, 'A bare description fence is deprecated - use \\'```text\\' instead', locationOf(open));\n }\n const code: string[] = [];\n for (;;) {\n const line = context.reader.takeRaw();\n if (line === undefined) {\n context.error(DiagnosticCodes.UnclosedCodeBlock, 'Unclosed inline code block - expected a closing ``` line', locationOf(open));\n break;\n }\n if (line.raw.trim() === '```') {\n break;\n }\n let strip = 0;\n while (strip < open.indent && strip < line.raw.length && line.raw[strip] === ' ') {\n strip++;\n }\n code.push(line.raw.substring(strip));\n }\n return code.join('\\n');\n}\n"],"mappings":"sKAUA,SAAgB,gBAAgB,EAAwB,EAAgB,EAAqB,EAAgB,GAAsB,CAE/H,IAAMA,EADYC,EAAQ,QAAQ,WAAW,KACxB,EAAIA,EAAUC,EAAQ,OAAO,gBAAgB,EAC5DC,EAAgBC,IAAW,cAAgB,UAAY,SAASA,IACtE,GAAIJ,IAAS,IAAA,IAAcA,IAASC,GAAWD,EAAK,QAAUC,EAAQ,QACjED,EAAK,UAAYG,GAAiB,EAAEE,GAAiBD,IAAW,eAAiBJ,EAAK,UAAY,iBAAoBA,EAAK,UAAY,OAASA,IAASC,GAE1J,OADAC,EAAQ,MAAMI,EAAgB,kBAAmB,6BAA6BF,IAAW,cAAgB,OAASA,EAAO,gBAAgBA,EAAO,GAAIG,EAAWN,CAAO,CAAC,EAChK,KAEPD,IAASC,GACTC,EAAQ,OAAO,gBAAgB,EAE/BE,IAAW,eAAiBJ,EAAK,UAAY,OAC7CE,EAAQ,QAAQI,EAAgB,sBAAuB,iEAAoEC,EAAWP,CAAI,CAAC,EAE/I,IAAMQ,EAAiB,CAAC,EACxB,OAAS,CACL,IAAMC,EAAOP,EAAQ,OAAO,QAAQ,EACpC,GAAIO,IAAS,IAAA,GAAW,CACpBP,EAAQ,MAAMI,EAAgB,kBAAmB,2DAA4DC,EAAWP,CAAI,CAAC,EAC7H,KACJ,CACA,GAAIS,EAAK,IAAI,KAAK,IAAM,MACpB,MAEJ,IAAIC,EAAQ,EACZ,KAAOA,EAAQV,EAAK,QAAUU,EAAQD,EAAK,IAAI,QAAUA,EAAK,IAAIC,KAAW,KACzE,IAEJF,EAAK,KAAKC,EAAK,IAAI,UAAUC,CAAK,CAAC,CACvC,CACA,OAAOF,EAAK,KAAK;CAAI,CACzB"}
1
+ {"version":3,"file":"CodeBlockParser.js","names":["open","tagLine","context","expectedFence","opener","allowMarkdown","DiagnosticCodes","locationOf","code","line","strip"],"sources":["../../../../../../Compiler/Parsing/CodeBlockParser.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 { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads the body of a fenced block that follows a directive, the way the C# CodeBlockParser does: the\n// opening fence is either on the directive's own line or the next deeper line, and the body runs to a line\n// holding only the closing fence. Body lines lose up to the opening fence's indent.\nexport function parseFencedText(context: ParserContext, opener: string, tagLine: SourceLine, allowMarkdown = false): string | null {\n const onTagLine = tagLine.content.startsWith('```');\n const open = onTagLine ? tagLine : context.reader.peekSignificant();\n const expectedFence = opener === 'description' ? '```text' : `\\`\\`\\`${opener}`;\n if (open === undefined || (open !== tagLine && open.indent <= tagLine.indent) ||\n (open.content !== expectedFence && !(allowMarkdown && opener === 'description' && open.content === '```markdown') && !(open.content === '```' && open !== tagLine))) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected an opening \\`\\`\\`${opener === 'description' ? 'text' : opener} fence after '${opener}'`, locationOf(tagLine));\n return null;\n }\n if (open !== tagLine) {\n context.reader.takeSignificant();\n }\n if (opener === 'description' && open.content === '```') {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, 'A bare description fence is deprecated - use \\'```text\\' instead', locationOf(open));\n }\n const code: string[] = [];\n for (;;) {\n const line = context.reader.takeRaw();\n if (line === undefined) {\n context.error(DiagnosticCodes.UnclosedCodeBlock, 'Unclosed inline code block - expected a closing ``` line', locationOf(open));\n break;\n }\n if (line.raw.trim() === '```') {\n break;\n }\n let strip = 0;\n while (strip < open.indent && strip < line.raw.length && line.raw[strip] === ' ') {\n strip++;\n }\n code.push(line.raw.substring(strip));\n }\n return code.join('\\n');\n}\n"],"mappings":"A,sKAUA,SAAgB,gBAAgB,EAAwB,EAAgB,EAAqB,EAAgB,GAAsB,CAE/H,IAAMA,EADYC,EAAQ,QAAQ,WAAW,KACxB,EAAIA,EAAUC,EAAQ,OAAO,gBAAgB,EAC5DC,EAAgBC,IAAW,cAAgB,UAAY,SAASA,IACtE,GAAIJ,IAAS,IAAA,IAAcA,IAASC,GAAWD,EAAK,QAAUC,EAAQ,QACjED,EAAK,UAAYG,GAAiB,EAAEE,GAAiBD,IAAW,eAAiBJ,EAAK,UAAY,iBAAoBA,EAAK,UAAY,OAASA,IAASC,GAE1J,OADAC,EAAQ,MAAMI,EAAgB,kBAAmB,6BAA6BF,IAAW,cAAgB,OAASA,EAAO,gBAAgBA,EAAO,GAAIG,EAAWN,CAAO,CAAC,EAChK,KAEPD,IAASC,GACTC,EAAQ,OAAO,gBAAgB,EAE/BE,IAAW,eAAiBJ,EAAK,UAAY,OAC7CE,EAAQ,QAAQI,EAAgB,sBAAuB,iEAAoEC,EAAWP,CAAI,CAAC,EAE/I,IAAMQ,EAAiB,CAAC,EACxB,OAAS,CACL,IAAMC,EAAOP,EAAQ,OAAO,QAAQ,EACpC,GAAIO,IAAS,IAAA,GAAW,CACpBP,EAAQ,MAAMI,EAAgB,kBAAmB,2DAA4DC,EAAWP,CAAI,CAAC,EAC7H,KACJ,CACA,GAAIS,EAAK,IAAI,KAAK,IAAM,MACpB,MAEJ,IAAIC,EAAQ,EACZ,KAAOA,EAAQV,EAAK,QAAUU,EAAQD,EAAK,IAAI,QAAUA,EAAK,IAAIC,KAAW,KACzE,IAEJF,EAAK,KAAKC,EAAK,IAAI,UAAUC,CAAK,CAAC,CACvC,CACA,OAAOF,EAAK,KAAK;CAAI,CACzB,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandDestinationTypes.js","names":["composites","uniqueByName","application","fields","command","result","optional","collection","segment","path","matches","field","type","destination","produced","implicitDestination","context","property"],"sources":["../../../../../../Compiler/Parsing/CommandDestinationTypes.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 { CommandSyntax } from '../Syntax/Commands';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { ProductionDestinationContext } from '../Syntax/ProductionDestinationContext';\nimport { implicitDestination } from '../Syntax/ProductionDestinations';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function commandPathType(command: CommandSyntax, path: string, application: ApplicationSyntax): TypeRefSyntax | null {\n const composites = uniqueByName(application.types);\n let fields = command.properties;\n let result: TypeRefSyntax | null = null;\n let optional = false;\n let collection = false;\n for (const segment of path.split('.')) {\n const matches = fields.filter(field => field.name === segment);\n if (matches.length !== 1) return null;\n const type = matches[0].type;\n optional ||= type.isOptional;\n collection ||= type.isCollection;\n result = { ...type, isOptional: optional, isCollection: collection };\n fields = composites.get(type.name)?.properties ?? [];\n }\n return result;\n}\n\nexport function commandDestinationType(command: CommandSyntax, produced: ProducesSyntax, application: ApplicationSyntax, context: ProductionDestinationContext): TypeRefSyntax | null {\n const destination = produced.for?.kind === 'PathExpressionSyntax' ? produced.for.path : implicitDestination(command, produced, context);\n return destination === 'new event source'\n ? command.properties.find(property => property.isGenerated && property.isIdentifier)?.type ?? { kind: 'TypeRefSyntax', name: 'Uuid', isOptional: false, isCollection: false, location: produced.location }\n : destination === undefined ? null : commandPathType(command, destination, application);\n}\n"],"mappings":"qLAWA,SAAgB,gBAAgB,EAAwB,EAAc,EAAsD,CACxH,IAAMA,EAAaC,EAAaC,EAAY,KAAK,EAC7CC,EAASC,EAAQ,WACjBC,EAA+B,KAC/BC,EAAW,GACXC,EAAa,GACjB,IAAK,IAAMC,KAAWC,EAAK,MAAM,GAAG,EAAG,CACnC,IAAMC,EAAUP,EAAO,OAAO,GAASQ,EAAM,OAASH,CAAO,EAC7D,GAAIE,EAAQ,SAAW,EAAG,OAAO,KACjC,IAAME,EAAOF,EAAQ,EAAE,CAAC,KACxB,IAAaE,EAAK,WAClB,IAAeA,EAAK,aACpB,EAAS,CAAE,GAAGA,EAAM,WAAYN,EAAU,aAAcC,CAAW,EACnE,EAASP,EAAW,IAAIY,EAAK,IAAI,CAAC,EAAE,YAAc,CAAC,CACvD,CACA,OAAOP,CACX,CAEA,SAAgB,uBAAuB,EAAwB,EAA0B,EAAgC,EAA6D,CAClL,IAAMQ,EAAcC,EAAS,KAAK,OAAS,uBAAyBA,EAAS,IAAI,KAAOC,EAAoBX,EAASU,EAAUE,CAAO,EACtI,OAAOH,IAAgB,mBACjBT,EAAQ,WAAW,KAAK,GAAYa,EAAS,aAAeA,EAAS,YAAY,CAAC,EAAE,MAAQ,CAAE,KAAM,gBAAiB,KAAM,OAAQ,WAAY,GAAO,aAAc,GAAO,SAAUH,EAAS,QAAS,EACvMD,IAAgB,IAAA,GAAY,KAAO,gBAAgBT,EAASS,EAAaX,CAAW,CAC9F"}
1
+ {"version":3,"file":"CommandDestinationTypes.js","names":["composites","uniqueByName","application","fields","command","result","optional","collection","segment","path","matches","field","type","destination","produced","implicitDestination","context","property"],"sources":["../../../../../../Compiler/Parsing/CommandDestinationTypes.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 { CommandSyntax } from '../Syntax/Commands';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { ProductionDestinationContext } from '../Syntax/ProductionDestinationContext';\nimport { implicitDestination } from '../Syntax/ProductionDestinations';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function commandPathType(command: CommandSyntax, path: string, application: ApplicationSyntax): TypeRefSyntax | null {\n const composites = uniqueByName(application.types);\n let fields = command.properties;\n let result: TypeRefSyntax | null = null;\n let optional = false;\n let collection = false;\n for (const segment of path.split('.')) {\n const matches = fields.filter(field => field.name === segment);\n if (matches.length !== 1) return null;\n const type = matches[0].type;\n optional ||= type.isOptional;\n collection ||= type.isCollection;\n result = { ...type, isOptional: optional, isCollection: collection };\n fields = composites.get(type.name)?.properties ?? [];\n }\n return result;\n}\n\nexport function commandDestinationType(command: CommandSyntax, produced: ProducesSyntax, application: ApplicationSyntax, context: ProductionDestinationContext): TypeRefSyntax | null {\n const destination = produced.for?.kind === 'PathExpressionSyntax' ? produced.for.path : implicitDestination(command, produced, context);\n return destination === 'new event source'\n ? command.properties.find(property => property.isGenerated && property.isIdentifier)?.type ?? { kind: 'TypeRefSyntax', name: 'Uuid', isOptional: false, isCollection: false, location: produced.location }\n : destination === undefined ? null : commandPathType(command, destination, application);\n}\n"],"mappings":"A,qLAWA,SAAgB,gBAAgB,EAAwB,EAAc,EAAsD,CACxH,IAAMA,EAAaC,EAAaC,EAAY,KAAK,EAC7CC,EAASC,EAAQ,WACjBC,EAA+B,KAC/BC,EAAW,GACXC,EAAa,GACjB,IAAK,IAAMC,KAAWC,EAAK,MAAM,GAAG,EAAG,CACnC,IAAMC,EAAUP,EAAO,OAAO,GAASQ,EAAM,OAASH,CAAO,EAC7D,GAAIE,EAAQ,SAAW,EAAG,OAAO,KACjC,IAAME,EAAOF,EAAQ,EAAE,CAAC,KACxB,IAAaE,EAAK,WAClB,IAAeA,EAAK,aACpB,EAAS,CAAE,GAAGA,EAAM,WAAYN,EAAU,aAAcC,CAAW,EACnE,EAASP,EAAW,IAAIY,EAAK,IAAI,CAAC,EAAE,YAAc,CAAC,CACvD,CACA,OAAOP,CACX,CAEA,SAAgB,uBAAuB,EAAwB,EAA0B,EAAgC,EAA6D,CAClL,IAAMQ,EAAcC,EAAS,KAAK,OAAS,uBAAyBA,EAAS,IAAI,KAAOC,EAAoBX,EAASU,EAAUE,CAAO,EACtI,OAAOH,IAAgB,mBACjBT,EAAQ,WAAW,KAAK,GAAYa,EAAS,aAAeA,EAAS,YAAY,CAAC,EAAE,MAAQ,CAAE,KAAM,gBAAiB,KAAM,OAAQ,WAAY,GAAO,aAAc,GAAO,SAAUH,EAAS,QAAS,EACvMD,IAAgB,IAAA,GAAY,KAAO,gBAAgBT,EAASS,EAAaX,CAAW,CAC9F,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandHandlerValidator.js","names":["handler","hasPending","occurrences","entry","code","DiagnosticCodes","message","context","slice","feature","module","application","handlers","hasProduces","groups","command","commands","group"],"sources":["../../../../../../Compiler/Parsing/CommandHandlerValidator.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 { CommandSyntax } from '../Syntax/Commands';\nimport { HandlerSyntax } from '../Syntax/Implementations';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function isPendingHandler(handler: HandlerSyntax): boolean {\n return handler.implementation != null && handler.file === null && handler.code === null;\n}\n\nexport function validateHandlerOccurrences(occurrences: readonly { handler: HandlerSyntax | null; location: SourceLocation }[], context: ParserContext): void {\n const hasPending = occurrences.some(entry => entry.handler !== null && isPendingHandler(entry.handler));\n const code = hasPending ? DiagnosticCodes.PendingIntentWithOtherHandler : DiagnosticCodes.DuplicateDeclaration;\n const message = hasPending\n ? 'A pending handler intent cannot coexist with another handler on the same command.'\n : 'A command cannot declare more than one handler.';\n for (const entry of occurrences.slice(1)) {\n context.error(code, message, entry.location);\n }\n}\n\nexport function validateApplicationHandlers(application: ApplicationSyntax, context: ParserContext): void {\n const validateFeature = (feature: FeatureSyntax): void => {\n for (const slice of feature.slices) validateCommandHandlers(slice.commands, context);\n feature.features.forEach(validateFeature);\n };\n for (const module of application.modules) module.features.forEach(validateFeature);\n}\n\nexport function validateHandlerContracts(handlers: readonly { handler: HandlerSyntax | null; location: SourceLocation }[], handler: HandlerSyntax | null, hasProduces: boolean, context: ParserContext): void {\n validateHandlerOccurrences(handlers, context);\n validatePossibleEvents(handler, hasProduces, context);\n}\n\nexport function validatePossibleEvents(handler: HandlerSyntax | null | undefined, hasProduces: boolean, context: ParserContext): void {\n if (hasProduces && handler?.possibleEvents != null) {\n context.error(DiagnosticCodes.InvalidPossibleEventsDeclaration, \"A command cannot combine 'produces' with a handler 'may produce' set.\", handler.possibleEvents.location);\n }\n}\n\nexport function validateCommandHandlers(commands: readonly CommandSyntax[], context: ParserContext): void {\n const groups = new Map<string, CommandSyntax[]>();\n for (const command of commands) groups.set(command.name, [...(groups.get(command.name) ?? []), command]);\n for (const group of groups.values()) {\n validateHandlerOccurrences(group.flatMap(command => command.handler == null ? [] : [{ handler: command.handler, location: command.handler.location }]), context);\n const hasProduces = group.some(command => command.produces.length > 0);\n group.forEach(command => validatePossibleEvents(command.handler, hasProduces, context));\n }\n}\n"],"mappings":"yHAUA,SAAgB,iBAAiB,EAAiC,CAC9D,OAAOA,EAAQ,gBAAkB,MAAQA,EAAQ,OAAS,MAAQA,EAAQ,OAAS,IACvF,CAEA,SAAgB,2BAA2B,EAAqF,EAA8B,CAC1J,IAAMC,EAAaC,EAAY,KAAK,GAASC,EAAM,UAAY,MAAQ,iBAAiBA,EAAM,OAAO,CAAC,EAChGC,EAAOH,EAAaI,EAAgB,8BAAgCA,EAAgB,qBACpFC,EAAUL,EACV,oFACA,kDACN,IAAK,IAAME,KAASD,EAAY,MAAM,CAAC,EACnCK,EAAQ,MAAMH,EAAME,EAASH,EAAM,QAAQ,CAEnD,CAEA,SAAgB,4BAA4B,EAAgC,EAA8B,CACtG,IAAM,gBAAmB,GAAiC,CACtD,IAAK,IAAMK,KAASC,EAAQ,OAAQ,wBAAwBD,EAAM,SAAUD,CAAO,EACnFE,EAAQ,SAAS,QAAQ,eAAe,CAC5C,EACA,IAAK,IAAMC,KAAUC,EAAY,QAASD,EAAO,SAAS,QAAQ,eAAe,CACrF,CAEA,SAAgB,yBAAyB,EAAkF,EAA+B,EAAsB,EAA8B,CAC1M,2BAA2BE,EAAUL,CAAO,EAC5C,uBAAuBP,EAASa,EAAaN,CAAO,CACxD,CAEA,SAAgB,uBAAuB,EAA2C,EAAsB,EAA8B,CAC9HM,GAAeb,GAAS,gBAAkB,MAC1CO,EAAQ,MAAMF,EAAgB,iCAAkC,wEAAyEL,EAAQ,eAAe,QAAQ,CAEhL,CAEA,SAAgB,wBAAwB,EAAoC,EAA8B,CACtG,IAAMc,kBAAS,IAAI,IACnB,IAAK,IAAMC,KAAWC,EAAUF,EAAO,IAAIC,EAAQ,KAAM,CAAC,GAAID,EAAO,IAAIC,EAAQ,IAAI,GAAK,CAAC,EAAIA,CAAO,CAAC,EACvG,IAAK,IAAME,KAASH,EAAO,OAAO,EAAG,CACjC,2BAA2BG,EAAM,QAAQ,GAAWF,EAAQ,SAAW,KAAO,CAAC,EAAI,CAAC,CAAE,QAASA,EAAQ,QAAS,SAAUA,EAAQ,QAAQ,QAAS,CAAC,CAAC,EAAGR,CAAO,EAC/J,IAAMM,EAAcI,EAAM,KAAK,GAAWF,EAAQ,SAAS,OAAS,CAAC,EACrEE,EAAM,QAAQ,GAAW,uBAAuBF,EAAQ,QAASF,EAAaN,CAAO,CAAC,CAC1F,CACJ"}
1
+ {"version":3,"file":"CommandHandlerValidator.js","names":["handler","hasPending","occurrences","entry","code","DiagnosticCodes","message","context","slice","feature","module","application","handlers","hasProduces","groups","command","commands","group"],"sources":["../../../../../../Compiler/Parsing/CommandHandlerValidator.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 { CommandSyntax } from '../Syntax/Commands';\nimport { HandlerSyntax } from '../Syntax/Implementations';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function isPendingHandler(handler: HandlerSyntax): boolean {\n return handler.implementation != null && handler.file === null && handler.code === null;\n}\n\nexport function validateHandlerOccurrences(occurrences: readonly { handler: HandlerSyntax | null; location: SourceLocation }[], context: ParserContext): void {\n const hasPending = occurrences.some(entry => entry.handler !== null && isPendingHandler(entry.handler));\n const code = hasPending ? DiagnosticCodes.PendingIntentWithOtherHandler : DiagnosticCodes.DuplicateDeclaration;\n const message = hasPending\n ? 'A pending handler intent cannot coexist with another handler on the same command.'\n : 'A command cannot declare more than one handler.';\n for (const entry of occurrences.slice(1)) {\n context.error(code, message, entry.location);\n }\n}\n\nexport function validateApplicationHandlers(application: ApplicationSyntax, context: ParserContext): void {\n const validateFeature = (feature: FeatureSyntax): void => {\n for (const slice of feature.slices) validateCommandHandlers(slice.commands, context);\n feature.features.forEach(validateFeature);\n };\n for (const module of application.modules) module.features.forEach(validateFeature);\n}\n\nexport function validateHandlerContracts(handlers: readonly { handler: HandlerSyntax | null; location: SourceLocation }[], handler: HandlerSyntax | null, hasProduces: boolean, context: ParserContext): void {\n validateHandlerOccurrences(handlers, context);\n validatePossibleEvents(handler, hasProduces, context);\n}\n\nexport function validatePossibleEvents(handler: HandlerSyntax | null | undefined, hasProduces: boolean, context: ParserContext): void {\n if (hasProduces && handler?.possibleEvents != null) {\n context.error(DiagnosticCodes.InvalidPossibleEventsDeclaration, \"A command cannot combine 'produces' with a handler 'may produce' set.\", handler.possibleEvents.location);\n }\n}\n\nexport function validateCommandHandlers(commands: readonly CommandSyntax[], context: ParserContext): void {\n const groups = new Map<string, CommandSyntax[]>();\n for (const command of commands) groups.set(command.name, [...(groups.get(command.name) ?? []), command]);\n for (const group of groups.values()) {\n validateHandlerOccurrences(group.flatMap(command => command.handler == null ? [] : [{ handler: command.handler, location: command.handler.location }]), context);\n const hasProduces = group.some(command => command.produces.length > 0);\n group.forEach(command => validatePossibleEvents(command.handler, hasProduces, context));\n }\n}\n"],"mappings":"A,yHAUA,SAAgB,iBAAiB,EAAiC,CAC9D,OAAOA,EAAQ,gBAAkB,MAAQA,EAAQ,OAAS,MAAQA,EAAQ,OAAS,IACvF,CAEA,SAAgB,2BAA2B,EAAqF,EAA8B,CAC1J,IAAMC,EAAaC,EAAY,KAAK,GAASC,EAAM,UAAY,MAAQ,iBAAiBA,EAAM,OAAO,CAAC,EAChGC,EAAOH,EAAaI,EAAgB,8BAAgCA,EAAgB,qBACpFC,EAAUL,EACV,oFACA,kDACN,IAAK,IAAME,KAASD,EAAY,MAAM,CAAC,EACnCK,EAAQ,MAAMH,EAAME,EAASH,EAAM,QAAQ,CAEnD,CAEA,SAAgB,4BAA4B,EAAgC,EAA8B,CACtG,IAAM,gBAAmB,GAAiC,CACtD,IAAK,IAAMK,KAASC,EAAQ,OAAQ,wBAAwBD,EAAM,SAAUD,CAAO,EACnFE,EAAQ,SAAS,QAAQ,eAAe,CAC5C,EACA,IAAK,IAAMC,KAAUC,EAAY,QAASD,EAAO,SAAS,QAAQ,eAAe,CACrF,CAEA,SAAgB,yBAAyB,EAAkF,EAA+B,EAAsB,EAA8B,CAC1M,2BAA2BE,EAAUL,CAAO,EAC5C,uBAAuBP,EAASa,EAAaN,CAAO,CACxD,CAEA,SAAgB,uBAAuB,EAA2C,EAAsB,EAA8B,CAC9HM,GAAeb,GAAS,gBAAkB,MAC1CO,EAAQ,MAAMF,EAAgB,iCAAkC,wEAAyEL,EAAQ,eAAe,QAAQ,CAEhL,CAEA,SAAgB,wBAAwB,EAAoC,EAA8B,CACtG,IAAMc,kBAAS,IAAI,IACnB,IAAK,IAAMC,KAAWC,EAAUF,EAAO,IAAIC,EAAQ,KAAM,CAAC,GAAID,EAAO,IAAIC,EAAQ,IAAI,GAAK,CAAC,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