@cratis/screenplay-language 4.123.0 → 4.124.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/bundles/TypeReferenceSymbol.js +2 -0
- package/dist/bundles/TypeReferenceSymbol.js.map +1 -0
- package/dist/bundles/_virtual/_virtual/_rolldown/runtime.js +1 -0
- package/dist/bundles/bmp-word-characters.js +2 -0
- package/dist/bundles/bmp-word-characters.js.map +1 -0
- package/dist/bundles/case-authoring.js +3 -0
- package/dist/bundles/case-authoring.js.map +1 -0
- package/dist/bundles/code-actions.js +2 -0
- package/dist/bundles/code-actions.js.map +1 -0
- package/dist/bundles/compiler/Authoring/QuickFixes.js +5 -0
- package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js +2 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js +2 -0
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js +2 -0
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/DependencyKind.js +2 -0
- package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js +2 -0
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/SliceReferences.js +2 -0
- package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js +2 -0
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -0
- package/dist/bundles/compiler/Dependencies/index.js +1 -0
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +2 -0
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -0
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +2 -0
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -0
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js +2 -0
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -0
- package/dist/bundles/compiler/Files/AuthoredOrder.js +2 -0
- package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -0
- package/dist/bundles/compiler/Files/OrderingRoot.js +1 -0
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +2 -0
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -0
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +2 -0
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -0
- package/dist/bundles/compiler/Files/PlayImports.js +1 -0
- package/dist/bundles/compiler/Files/PlayPlacement.js +2 -0
- package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -0
- package/dist/bundles/compiler/Files/TimelineOrder.js +2 -0
- package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -0
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js +2 -0
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CaptureParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js +3 -0
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandReadSources.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CompositionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConstraintParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js +2 -0
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DependsOnParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DescriptionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/DocumentationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js +2 -0
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSourceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ExpressionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FeatureBody.js +2 -0
- package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FileImportParser.js +2 -0
- package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/FileReferences.js +2 -0
- package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -0
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentityParser.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/IdentityValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ImplementationParser.js +3 -0
- package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -0
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/InputUses.js +2 -0
- package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -0
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +2 -0
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -0
- package/dist/bundles/compiler/Parsing/LineReader.js +2 -0
- package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -0
- package/dist/bundles/compiler/Parsing/LineText.js +2 -0
- package/dist/bundles/compiler/Parsing/LineText.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ModuleBody.js +2 -0
- package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -0
- package/dist/bundles/compiler/Parsing/OperationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/OperationValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ParserContext.js +2 -0
- package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PolicyParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProducesParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PurposeParser.js +2 -0
- package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PurposeValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/QueryParser.js +2 -0
- package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js +2 -0
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +2 -0
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -0
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js +2 -0
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js +2 -0
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ResponseValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ScreenParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SeedParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SliceParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceLine.js +2 -0
- package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js +3 -0
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -0
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js +3 -0
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js +2 -0
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/UiBindingParser.js +2 -0
- package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -0
- package/dist/bundles/compiler/ScreenplayCompiler.js +2 -0
- package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -0
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js +2 -0
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -0
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js +2 -0
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -0
- package/dist/bundles/compiler/Syntax/DependencySources.js +2 -0
- package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventDeclarations.js +2 -0
- package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js +2 -0
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -0
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js +2 -0
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js +2 -0
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ExactNumber.js +2 -0
- package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -0
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js +2 -0
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -0
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js +2 -0
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -0
- package/dist/bundles/compiler/Syntax/Operations.js +2 -0
- package/dist/bundles/compiler/Syntax/Operations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/PersonaCallers.js +2 -0
- package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js +2 -0
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -0
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js +2 -0
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -0
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +2 -0
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SourceOptions.js +2 -0
- package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js +2 -0
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -0
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js +2 -0
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -0
- package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -0
- package/dist/bundles/compiler/Syntax/Structure.js +2 -0
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -0
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js +2 -0
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -0
- package/dist/bundles/compiler/Syntax/index.js +1 -0
- package/dist/bundles/compiler/Text/ImplementationHintText.js +2 -0
- package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -0
- package/dist/bundles/compiler/Text/ReservedWords.js +2 -0
- package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -0
- package/dist/bundles/compiler/Text/SourceStreamNames.js +2 -0
- package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -0
- package/dist/bundles/compiler/Text/StringLiteral.js +3 -0
- package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -0
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js +2 -0
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -0
- package/dist/bundles/compiler/Text/patterns.js +2 -0
- package/dist/bundles/compiler/Text/patterns.js.map +1 -0
- package/dist/bundles/compiler/index.js +1 -0
- package/dist/bundles/completion-items.js +21 -0
- package/dist/bundles/completion-items.js.map +1 -0
- package/dist/bundles/completion-planner.js +5 -0
- package/dist/bundles/completion-planner.js.map +1 -0
- package/dist/bundles/completions.js +2 -0
- package/dist/bundles/completions.js.map +1 -0
- package/dist/bundles/dependency-completions.js +3 -0
- package/dist/bundles/dependency-completions.js.map +1 -0
- package/dist/bundles/dependency-target-analysis.js +2 -0
- package/dist/bundles/dependency-target-analysis.js.map +1 -0
- package/dist/bundles/diagnostic-codes.js +2 -0
- package/dist/bundles/diagnostic-codes.js.map +1 -0
- package/dist/bundles/diagnostics.js +2 -0
- package/dist/bundles/diagnostics.js.map +1 -0
- package/dist/bundles/document-context.js +2 -0
- package/dist/bundles/document-context.js.map +1 -0
- package/dist/bundles/documentation-item.js +2 -0
- package/dist/bundles/documentation-item.js.map +1 -0
- package/dist/bundles/event-analysis-source.js +2 -0
- package/dist/bundles/event-analysis-source.js.map +1 -0
- package/dist/bundles/event-context-catalog.js +2 -0
- package/dist/bundles/event-context-catalog.js.map +1 -0
- package/dist/bundles/event-context.js +4 -0
- package/dist/bundles/event-context.js.map +1 -0
- package/dist/bundles/event-source-authoring.js +13 -0
- package/dist/bundles/event-source-authoring.js.map +1 -0
- package/dist/bundles/example-analysis.js +3 -0
- package/dist/bundles/example-analysis.js.map +1 -0
- package/dist/bundles/example-authoring.js +3 -0
- package/dist/bundles/example-authoring.js.map +1 -0
- package/dist/bundles/example-declaration-items.js +2 -0
- package/dist/bundles/example-declaration-items.js.map +1 -0
- package/dist/bundles/example-values.js +2 -0
- package/dist/bundles/example-values.js.map +1 -0
- package/dist/bundles/file-imports.js +2 -0
- package/dist/bundles/file-imports.js.map +1 -0
- package/dist/bundles/file-references.js +2 -0
- package/dist/bundles/file-references.js.map +1 -0
- package/dist/bundles/hover-content.js +6 -0
- package/dist/bundles/hover-content.js.map +1 -0
- package/dist/bundles/hover.js +2 -0
- package/dist/bundles/hover.js.map +1 -0
- package/dist/bundles/index.js +2 -104
- package/dist/bundles/index.js.map +1 -7
- package/dist/bundles/inlay-hints.js +2 -0
- package/dist/bundles/inlay-hints.js.map +1 -0
- package/dist/bundles/inline-completions.js +2 -0
- package/dist/bundles/inline-completions.js.map +1 -0
- package/dist/bundles/inline-event-validation.js +2 -0
- package/dist/bundles/inline-event-validation.js.map +1 -0
- package/dist/bundles/keyword-docs.js +2 -0
- package/dist/bundles/keyword-docs.js.map +1 -0
- package/dist/bundles/language.js +2 -0
- package/dist/bundles/language.js.map +1 -0
- package/dist/bundles/named-rule-context.js +2 -0
- package/dist/bundles/named-rule-context.js.map +1 -0
- package/dist/bundles/operation-authoring.js +7 -0
- package/dist/bundles/operation-authoring.js.map +1 -0
- package/dist/bundles/persona-analysis.js +2 -0
- package/dist/bundles/persona-analysis.js.map +1 -0
- package/dist/bundles/production-destinations.js +2 -0
- package/dist/bundles/production-destinations.js.map +1 -0
- package/dist/bundles/purpose-items.js +2 -0
- package/dist/bundles/purpose-items.js.map +1 -0
- package/dist/bundles/reaction-authoring.js +5 -0
- package/dist/bundles/reaction-authoring.js.map +1 -0
- package/dist/bundles/refusal-context.js +2 -0
- package/dist/bundles/refusal-context.js.map +1 -0
- package/dist/bundles/response-analysis.js +7 -0
- package/dist/bundles/response-analysis.js.map +1 -0
- package/dist/bundles/response-completions.js +2 -0
- package/dist/bundles/response-completions.js.map +1 -0
- package/dist/bundles/response-tokens.js +3 -0
- package/dist/bundles/response-tokens.js.map +1 -0
- package/dist/bundles/scope-items.js +18 -0
- package/dist/bundles/scope-items.js.map +1 -0
- package/dist/bundles/structure-completions.js +7 -0
- package/dist/bundles/structure-completions.js.map +1 -0
- package/dist/bundles/sub-language-registry.js +2 -0
- package/dist/bundles/sub-language-registry.js.map +1 -0
- package/dist/bundles/sub-languages/capture/CompletionProvider.js +2 -0
- package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/capture/HoverProvider.js +60 -0
- package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -0
- package/dist/bundles/sub-languages/capture/Validator.js +2 -0
- package/dist/bundles/sub-languages/capture/Validator.js.map +1 -0
- package/dist/bundles/sub-languages/capture/index.js +2 -40
- package/dist/bundles/sub-languages/capture/index.js.map +1 -7
- package/dist/bundles/sub-languages/capture/language.js +2 -0
- package/dist/bundles/sub-languages/capture/language.js.map +1 -0
- package/dist/bundles/sub-languages/cdl.js +2 -0
- package/dist/bundles/sub-languages/cdl.js.map +1 -0
- package/dist/bundles/sub-languages/pdl.js +2 -0
- package/dist/bundles/sub-languages/pdl.js.map +1 -0
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js +2 -0
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/CompletionProvider.js +2 -0
- package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/HoverProvider.js +43 -0
- package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -0
- package/dist/bundles/sub-languages/projection/Validator.js +5 -0
- package/dist/bundles/sub-languages/projection/Validator.js.map +1 -0
- package/dist/bundles/sub-languages/projection/index.js +3 -75
- package/dist/bundles/sub-languages/projection/index.js.map +1 -7
- package/dist/bundles/sub-languages/projection/language.js +2 -0
- package/dist/bundles/sub-languages/projection/language.js.map +1 -0
- package/dist/bundles/symbols.js +3 -0
- package/dist/bundles/symbols.js.map +1 -0
- package/dist/bundles/themes/screenplay-dark.js +2 -0
- package/dist/bundles/themes/screenplay-dark.js.map +1 -0
- package/dist/bundles/themes/screenplay-light.js +2 -0
- package/dist/bundles/themes/screenplay-light.js.map +1 -0
- package/dist/bundles/tokens.js +2 -0
- package/dist/bundles/tokens.js.map +1 -0
- package/dist/bundles/validation.js +3 -0
- package/dist/bundles/validation.js.map +1 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +6 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/bundles/chunk-4CLLEMBX.js +0 -42
- package/dist/bundles/chunk-4CLLEMBX.js.map +0 -7
- package/dist/bundles/chunk-AYDF3IFZ.js +0 -2
- package/dist/bundles/chunk-AYDF3IFZ.js.map +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandParser.js","names":["header","pattern","routeHeader","sourceStreamPattern","severityPattern","messagePattern","stringBodyPattern","rulePattern","operandPattern","ruleNamePattern","optionalReads","operandKinds","severities","opaqueDirectives","propertyShapedDirectives","names","lookahead","ParserContext","context","line","name","DiagnosticCodes","locationOf","properties","responses","identifier","validations","produces","reads","referenceReads","concurrency","description","documentation","authorize","handler","stream","streamCandidates","child","keyword","firstWord","asProperty","tryParseProperty","scalar","scalarResponsePattern","responseNames","parseCommandResponse","reportInvalidModifierOrder","source","streamName","ambiguous","route","parseCommandStream","isReactionIdentityLine","misplacedReactionIdentity","parseDescription","parseDocumentation","combineAuthorize","parseAuthorize","validate","production","parseProduces","parseHandler","reference","captureReads","captureConcurrency","read","candidates","entry","property","discoveredNames","response","removed","parsed","syntax","commandReadSources","dependencySources","reportLegacyOptionalSuffix","commandName","fence","code","parseCode","rules","requirements","wrapperIndent","owner","condition","parseCondition","message","severity","hasSeverity","directive","matched","unescapeString","rule","valueContext","withSeverity","match","body","wrapped","commandOwner","parseImplementationWrapper","isFile","parseFile","isCode","extra","content","text","operand","parseMappingSource"],"sources":["../../../../../../Compiler/Parsing/CommandParser.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 { RequirementSyntax } from '../Syntax/Conditions';\nimport { parseCondition } from './ConditionParser';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { CommandSyntax, ValidateSyntax, ValidationRuleKind, ValidationRuleSyntax, ValidationSeverity } from '../Syntax/Commands';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax } from '../Syntax/EventSources';\nimport { parseCommandStream } from './EventSourceParser';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { CommandResponseSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseCommandResponse, scalarResponsePattern } from './CommandResponseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isCode, isFile, parseCode, parseFile, parseHandler, parseImplementationWrapper } from './ImplementationParser';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationSyntax } from '../Syntax/Implementations';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { isReactionIdentityLine, misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { commandReadSources } from './CommandReadSources';\nimport { dependencySources, ReadsSyntax, ConcurrencySyntax } from '../Syntax/DependencySources';\nimport { captureReads, captureConcurrency } from './DependencySourceParser';\nimport { parseProduces } from './ProducesParser';\nimport { reportInvalidModifierOrder, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^command\\\\s+([A-Za-z_]\\\\w*)$');\nconst routeHeader = sourceStreamPattern('^stream\\\\s+[A-Za-z_]\\\\w*\\\\.[A-Za-z_]\\\\w*$');\nconst severityPattern = pattern('\\\\bseverity\\\\s+(\\\\S+)$');\nconst messagePattern = pattern(`\\\\bmessage\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\S*))$`);\nconst rulePattern = pattern('^([\\\\w.]+)\\\\s+(.+)$');\nconst operandPattern = pattern('^(not empty|length ==|all >=|all >|matches|max|min|rule|>=|<=|==|!=|>|<)\\\\s*(.*)$');\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\n// Every operand the pattern matches has a kind, so an operand never goes unrecognized here.\nconst operandKinds: Record<string, ValidationRuleKind> = {\n max: 'Max',\n min: 'Min',\n '>': 'GreaterThan',\n '>=': 'GreaterThanOrEqual',\n '<': 'LessThan',\n '<=': 'LessThanOrEqual',\n '==': 'Equal',\n '!=': 'NotEqual',\n 'length ==': 'Length',\n matches: 'Matches',\n 'all >': 'AllGreaterThan',\n 'all >=': 'AllGreaterThanOrEqual',\n};\n\nconst severities: Record<string, ValidationSeverity> = { information: 'Information', warning: 'Warning', error: 'Error' };\n\n// Command directives this compiler does not model. They are skipped whole.\nconst opaqueDirectives = new Set(['reads', 'concurrency']);\n\n// The bare directives cannot take a type reference, so a line with property shape is a property whatever\n// keyword it starts with - 'description String' declares a property called description.\nconst propertyShapedDirectives = new Set(['description', 'documentation', 'handler', 'concurrency']);\n\nexport function parseCommand(context: ParserContext, line: SourceLine): CommandSyntax {\n // Properties are leaves, not indentation owners. Resolve ambiguous returns spelling\n // before the committed pass decides whether its deeper lines belong to a response.\n const names = new Set<string>();\n const lookahead = new ParserContext(context.reader.fork(), context.path, context.languages);\n lookahead.sourceOptions = context.sourceOptions;\n lookahead.streamCandidates = context.streamCandidates;\n parseCommandBody(lookahead, line, undefined, names);\n return parseCommandBody(context, line, names);\n}\n\nfunction parseCommandBody(context: ParserContext, line: SourceLine, responseNames?: ReadonlySet<string>, discoveredNames?: Set<string>): CommandSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidCommandDeclaration, `Invalid command declaration '${line.content}' - expected 'command <Name>'`, locationOf(line));\n }\n const properties: PropertySyntax[] = [];\n const responses: { line: SourceLine; candidate: PropertySyntax | null; response: CommandResponseSyntax | null }[] = [];\n let identifier: PropertySyntax | undefined;\n const validations: ValidateSyntax[] = [];\n const produces: ProducesSyntax[] = [];\n const reads: { readModel: string; alias: string | null }[] = [];\n const referenceReads: ReadsSyntax[] = [];\n let concurrency: ConcurrencySyntax | undefined;\n let description: string | null = null;\n let documentation: string | null = null;\n let authorize: AuthorizeSyntax | null = null;\n let handler: HandlerSyntax | null = null;\n let stream: CommandStreamSyntax | null = null;\n const streamCandidates: CommandStreamSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n const asProperty = tryParseProperty(child);\n if (asProperty !== undefined && (propertyShapedDirectives.has(keyword) || (keyword === 'validate' && child.content !== 'validate csharp'))) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (keyword === 'returns') {\n const scalar = scalarResponsePattern.exec(child.content);\n if (scalar !== null && !scalar[1].startsWith('@') && asProperty !== undefined) {\n if (responseNames === undefined) {\n properties.push(asProperty);\n responses.push({ line: child, candidate: asProperty, response: null });\n } else if (responseNames.has(asProperty.type.name)) {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n } else {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n }\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (reportInvalidModifierOrder(context, child)) {\n context.skipBlock(child.indent);\n } else {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n }\n } else if (keyword === 'stream' && routeHeader.test(child.content) && asProperty !== undefined && context.streamCandidates?.hasSource(asProperty.type.name.split('.')[0]) === true) {\n const [source, streamName] = asProperty.type.name.split('.');\n const ambiguous = context.streamCandidates.hasPropertyType(asProperty.type.name) && context.streamCandidates.hasUniqueStream(source, streamName);\n const route = parseCommandStream(context, child, asProperty, ambiguous);\n if (stream !== null || streamCandidates.length > 0) context.error(DiagnosticCodes.InvalidCommandStream, 'A command declares at most one stream route.', locationOf(child));\n if (ambiguous || stream !== null) streamCandidates.push(route);\n else stream = route;\n } else if (keyword === 'runs' && isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Command '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Command '${name}'`);\n } else if (keyword === 'authorize') {\n authorize = combineAuthorize(authorize, parseAuthorize(context, child));\n } else if (keyword === 'validate') {\n const validate = parseValidate(context, child, 'command');\n if (validate !== undefined) {\n validations.push(validate);\n }\n } else if (keyword === 'produces') {\n const production = parseProduces(context, child, true);\n if (production !== undefined) produces.push(production);\n } else if (keyword === 'handler') {\n handler = parseHandler(context, child);\n } else if (opaqueDirectives.has(keyword)) {\n const reference = captureReads(child);\n if (reference !== undefined) referenceReads.push(reference);\n if (keyword === 'concurrency' && concurrency === undefined) concurrency = captureConcurrency(context, child);\n const read = /^reads\\s+([A-Z]\\w*)(?:\\s+as\\s+([a-z_]\\w*))?(?:\\s+by\\s+([a-z_]\\w*))?$/.exec(child.content);\n if (read !== null) reads.push({ readModel: read[1], alias: read[2] ?? null });\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n context.skipOpaqueBlock(child.indent);\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else {\n reportInvalidModifierOrder(context, child);\n context.error(DiagnosticCodes.UnknownCommandDirective, `Unexpected '${child.content}' in command body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const candidates = new Set(responses.flatMap(entry => entry.candidate === null ? [] : [entry.candidate]));\n const names = new Set(properties.filter(property => !candidates.has(property)).map(property => property.name));\n if (responses.some(entry => entry.candidate !== null && !names.has(entry.candidate.type.name) && entry.candidate.type.name !== 'returns')) names.add('returns');\n for (const name of names) discoveredNames?.add(name);\n let response: CommandResponseSyntax | null = null;\n const removed = new Set<PropertySyntax>();\n for (const entry of responses) {\n let parsed = entry.response;\n if (entry.candidate !== null) {\n if (!names.has(entry.candidate.type.name)) continue;\n removed.add(entry.candidate);\n parsed = { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: entry.candidate.type.name, location: entry.candidate.type.location }, location: locationOf(entry.line) };\n }\n if (parsed === null) continue;\n if (response !== null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A command declares at most one unconditional response.', locationOf(entry.line));\n } else {\n response = parsed;\n }\n }\n if (handler !== null && produces.length > 0) {\n context.error(DiagnosticCodes.CommandWithProducesAndHandler, `Command '${name}' cannot declare both 'produces' and 'handler'`, locationOf(line));\n }\n const syntax: CommandSyntax = { kind: 'CommandSyntax', name, description, documentation, authorize, properties: properties.filter(property => !removed.has(property)), validations, produces, handler, response, stream, streamCandidates, location: locationOf(line) };\n commandReadSources.set(syntax, reads);\n dependencySources.set(syntax, { reads: referenceReads, concurrency });\n return syntax;\n}\n\nfunction addProperty(context: ParserContext, properties: PropertySyntax[], property: PropertySyntax, commandName: string, line: SourceLine, identifier: PropertySyntax | undefined): PropertySyntax | undefined {\n reportLegacyOptionalSuffix(context, property.type, line);\n if (property.isIdentifier && identifier !== undefined) {\n context.error(DiagnosticCodes.DuplicateCommandIdentifier, `Command '${commandName}' already marks '${identifier.name}' as identifier - only one property can be the identifier`, property.location);\n property = { ...property, isIdentifier: false };\n }\n properties.push(property);\n return identifier ?? (property.isIdentifier ? property : undefined);\n}\n\n// Reads a 'validate' block: declarative rules, or code - which is recognized but not modeled.\nexport function parseValidate(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidateSyntax | undefined {\n if (line.content === 'validate') {\n const fence = context.peekChild(line.indent);\n if (fence !== undefined && fence.content.startsWith('```')) {\n context.reader.takeSignificant();\n const code = parseCode(context.valueContext, fence);\n if (code === null) context.skipFencedBody();\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n const rules: ValidationRuleSyntax[] = [];\n const requirements: RequirementSyntax[] = [];\n let wrapperIndent: number | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (owner === 'concept') {\n if (context.sourceOptions.numericMode === 'legacy' && child.content.startsWith('```')) { context.skipFencedBody(); continue; }\n if (wrapperIndent !== undefined && child.indent <= wrapperIndent) wrapperIndent = undefined;\n if (wrapperIndent !== undefined || firstWord(child.content) === 'implementation') {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${child.content}'`, locationOf(child));\n wrapperIndent ??= child.indent;\n continue;\n }\n }\n if (firstWord(child.content) === 'require') {\n const condition = parseCondition(owner === 'concept' ? context.valueContext : context, child.content.substring('require'.length).trim(), locationOf(child));\n let message: string | null = null;\n let severity: ValidationSeverity = 'Error';\n let hasSeverity = false;\n for (let directive = context.peekChild(child.indent); directive !== undefined; directive = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const matched = messagePattern.exec(directive.content);\n if (matched !== null && matched.index === 0) message = matched[1] !== undefined ? unescapeString(matched[1]) : matched[2];\n else if (firstWord(directive.content) === 'severity') {\n if (!hasSeverity) severity = severities[directive.content.substring('severity'.length).trim()] ?? 'Error';\n hasSeverity = true;\n } else context.skipOpaqueBlock(directive.indent);\n }\n if (condition !== null) requirements.push({ kind: 'RequirementSyntax', condition, message, severity, location: locationOf(child) });\n continue;\n }\n const rule = parseValidationRule(context, owner === 'concept' ? { ...child, content: `value ${child.content}` } : child, owner);\n if (rule !== undefined) {\n rules.push(rule);\n }\n }\n return { kind: 'DeclarativeValidateSyntax', rules, requirements, location: locationOf(line) };\n }\n if (line.content === 'validate csharp') {\n const code = parseCode(context.valueContext, { ...line, content: 'csharp' });\n if (code === null) context.skipOpaqueBlock(line.indent);\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidValidateDeclaration, `Invalid validate declaration '${line.content}' - expected 'validate' or 'validate csharp'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseValidationRule(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidationRuleSyntax | undefined {\n const valueContext = owner === 'concept' ? context.valueContext : context;\n const { content: withSeverity, message } = splitMessage(line.content);\n const severity = splitSeverity(valueContext, line, withSeverity);\n if (severity === undefined) {\n return undefined;\n }\n const match = rulePattern.exec(severity.content);\n if (match === null) {\n valueContext.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n const parsed = parseRule(valueContext, match[2], line);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parsed.kind === 'Rule' ? parseRuleImplementation(context, line, owner === 'command') : { file: null, code: null, implementation: null };\n return {\n kind: 'ValidationRuleSyntax',\n property: match[1],\n rule: parsed.kind,\n value: parsed.value,\n message,\n severity: severity.severity,\n ...source,\n location: locationOf(line),\n };\n}\n\nfunction parseRuleImplementation(context: ParserContext, rule: SourceLine, commandOwner: boolean): { file: FileReferenceSyntax | null; code: CodeBlockSyntax | null; implementation: ImplementationSyntax | null } {\n const body = context.peekChild(rule.indent);\n if (body === undefined) return { file: null, code: null, implementation: null };\n context.reader.takeSignificant();\n const wrapped = commandOwner && firstWord(body.content) === 'implementation';\n const source = wrapped ? parseImplementationWrapper(context, body) : {\n file: isFile(body) ? parseFile(context, body) : null,\n code: !isFile(body) && isCode(context, body) ? parseCode(context, body) : null,\n implementation: null,\n };\n if (!wrapped && source.file === null && source.code === null) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, `Unexpected '${body.content}' in rule implementation - expected 'file <path>' or an inline code block`, locationOf(body));\n context.skipBlock(body.indent);\n }\n for (let extra = context.peekChild(rule.indent); extra !== undefined && (wrapped || (commandOwner && firstWord(extra.content) === 'implementation')); extra = context.peekChild(rule.indent)) {\n context.reader.takeSignificant();\n context.error(wrapped && firstWord(extra.content) === 'implementation' ? DiagnosticCodes.InvalidImplementationBlock : DiagnosticCodes.ConflictingImplementationSources,\n 'A named rule has one implementation wrapper and cannot mix wrapped and direct sources.', locationOf(extra));\n if (isCode(context, extra)) parseCode(context, extra);\n else context.skipBlock(extra.indent);\n }\n return source;\n}\n\nfunction splitMessage(content: string): { content: string; message: string | null } {\n const match = messagePattern.exec(content);\n if (match === null) {\n return { content, message: null };\n }\n const message = match[1] !== undefined ? unescapeString(match[1]) : match[2];\n return { content: content.substring(0, match.index).trimEnd(), message };\n}\n\nfunction splitSeverity(context: ParserContext, line: SourceLine, text: string): { content: string; severity: ValidationSeverity } | undefined {\n const match = severityPattern.exec(text);\n if (match === null) {\n return { content: text, severity: 'Error' };\n }\n const severity = severities[match[1]];\n if (severity === undefined) {\n context.error(DiagnosticCodes.InvalidValidationSeverity, `Unknown validation severity '${match[1]}' - expected information, warning or error`, locationOf(line));\n return undefined;\n }\n return { content: text.substring(0, match.index).trimEnd(), severity };\n}\n\nfunction parseRule(context: ParserContext, rule: string, line: SourceLine): { kind: ValidationRuleKind; value: ExpressionSyntax | null } | undefined {\n if (rule === 'not empty') {\n return { kind: 'NotEmpty', value: null };\n }\n const operand = operandPattern.exec(rule);\n if (operand === null) {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (operand[1] === 'rule') {\n const name = operand[2].trim();\n if (!ruleNamePattern.test(name)) {\n context.error(DiagnosticCodes.InvalidRuleName, `Invalid rule name '${name}' in '${line.content}' - expected 'rule <Name>' with an identifier`, locationOf(line));\n return undefined;\n }\n return { kind: 'Rule', value: { kind: 'PathExpressionSyntax', path: name, location: locationOf(line) } };\n }\n return { kind: operandKinds[operand[1]], value: parseMappingSource(operand[2], locationOf(line), context) };\n}\n"],"mappings":"wgDAkCA,MAAMA,EAASC,EAAQ,8BAA8B,EAC/CC,EAAcC,EAAoB,2CAA2C,EAC7EC,EAAkBH,EAAQ,wBAAwB,EAClDI,EAAiBJ,EAAQ,sBAAsBK,EAAkB,yBAAyB,EAC1FC,EAAcN,EAAQ,qBAAqB,EAC3CO,EAAiBP,EAAQ,mFAAmF,EAC5GQ,EAAkBN,EAAoB,iBAAiB,EACvDO,EAAgBT,EAAQ,0CAA0C,EAGlEU,EAAmD,CACrD,IAAK,MACL,IAAK,MACL,IAAK,cACL,KAAM,qBACN,IAAK,WACL,KAAM,kBACN,KAAM,QACN,KAAM,WACN,YAAa,SACb,QAAS,UACT,QAAS,iBACT,SAAU,uBACd,EAEMC,EAAiD,CAAE,YAAa,cAAe,QAAS,UAAW,MAAO,OAAQ,EAGlHC,kBAAmB,IAAI,IAAI,CAAC,QAAS,aAAa,CAAC,EAInDC,kBAA2B,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EAAgB,gBAAiB,sBAAsBD,EAAK,QAAQD,EAAK,QAAQ,+CAAgDG,EAAWH,CAAI,CAAC,EAC/J,MACJ,CACA,MAAO,CAAE,KAAM,OAAQ,MAAO,CAAE,KAAM,uBAAwB,KAAMC,EAAM,SAAUE,EAAWH,CAAI,CAAE,CAAE,CAC3G,CACA,MAAO,CAAE,KAAMR,EAAagG,EAAQ,IAAK,MAAOC,EAAmBD,EAAQ,GAAIrF,EAAWH,CAAI,EAAGD,CAAO,CAAE,CAD1G,CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandReadSources.js","names":["commandReadSources"],"sources":["../../../../../../Compiler/Parsing/CommandReadSources.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';\n\n// Reads remain outside the narrowed TypeScript wire contract. Retain source evidence for\n// operation mapping checks without guessing that an unavailable state shape is a command field.\nexport const commandReadSources = new WeakMap<CommandSyntax, readonly { readModel: string; alias: string | null }[]>();\n"],"mappings":"AAOA,MAAaA,kBAAqB,IAAI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{unescapeIdentifier as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";import{parseTypeRef as i,reportLegacyOptionalSuffix as a,tryParseProperty as o}from"./PropertyLineParser.js";const s=t(`^returns\\s+(@?[A-Za-z_]\\w*)$`),c=t(`^(@?[a-z_]\\w*)(?:\\s+([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?))?\\s*=(?!=|>)\\s*(@?[a-z_]\\w*)$`);function parseCommandResponse(t,l){let u=r(l);if(l.content!==`returns`){let i=s.exec(l.content);if(i===null)return t.error(e.InvalidCommandResponse,`Expected 'returns <property>' or an unconditional 'returns' block.`,u),t.skipBlock(l.indent),null;let a=t.peekChild(l.indent);a!==void 0&&(t.error(e.InvalidCommandResponse,`A scalar response cannot have child directives.`,r(a)),t.skipBlock(l.indent));let o=i.index+i[0].length-i[1].length;return{kind:`ScalarCommandResponseSyntax`,source:{kind:`PropertyResponseSourceSyntax`,property:n(i[1]),location:{...u,column:u.column+o}},location:u}}let d=[];for(let s=t.peekChild(l.indent);s!==void 0;s=t.peekChild(l.indent)){t.reader.takeSignificant();let l=c.exec(s.content);if(l===null){o({...s,content:s.content.split(`=`,1)[0].trimEnd()})?.isSubject?t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not response fields (decision 0008: one data subject per event).`,r(s)):t.error(e.InvalidCommandResponse,`Expected '<field> [<Type>] = <property>' in a response block.`,r(s)),t.skipBlock(s.indent);continue}let u=r(s),f=l[2]===void 0?null:i(l[2],{...u,column:u.column+s.content.indexOf(l[2],l[1].length)});f!==null&&a(t,f,s),d.push({kind:`ResponseFieldSyntax`,name:n(l[1]),type:f,source:{kind:`PropertyResponseSourceSyntax`,property:n(l[3]),location:{...u,column:u.column+s.content.lastIndexOf(l[3])}},location:u});let p=t.peekChild(s.indent);p!==void 0&&(t.error(e.InvalidCommandResponse,`A response field cannot have child directives.`,r(p)),t.skipBlock(s.indent))}return{kind:`RecordCommandResponseSyntax`,fields:d,location:u}}export{parseCommandResponse,s as scalarResponsePattern};
|
|
2
|
+
//# sourceMappingURL=CommandResponseParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandResponseParser.js","names":["scalarResponsePattern","pattern","fieldPattern","location","locationOf","line","match","context","DiagnosticCodes","child","sourceOffset","unescapeIdentifier","fields","tryParseProperty","fieldLocation","type","parseTypeRef","reportLegacyOptionalSuffix","nested"],"sources":["../../../../../../Compiler/Parsing/CommandResponseParser.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 { CommandResponseSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const scalarResponsePattern = pattern('^returns\\\\s+(@?[A-Za-z_]\\\\w*)$');\nconst fieldPattern = pattern('^(@?[a-z_]\\\\w*)(?:\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?))?\\\\s*=(?!=|>)\\\\s*(@?[a-z_]\\\\w*)$');\n\nexport function parseCommandResponse(context: ParserContext, line: SourceLine): CommandResponseSyntax | null {\n const location = locationOf(line);\n if (line.content !== 'returns') {\n const match = scalarResponsePattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, \"Expected 'returns <property>' or an unconditional 'returns' block.\", location);\n context.skipBlock(line.indent);\n return null;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A scalar response cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n // The operand capture ends the anchored match, so its offset cannot resolve inside 'returns'.\n const sourceOffset = match.index + match[0].length - match[1].length;\n return { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: unescapeIdentifier(match[1]), location: { ...location, column: location.column + sourceOffset } }, location };\n }\n const fields: ResponseFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = fieldPattern.exec(child.content);\n if (match === null) {\n const candidate = tryParseProperty({ ...child, content: child.content.split('=', 1)[0].trimEnd() });\n if (candidate?.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not response fields (decision 0008: one data subject per event).', locationOf(child));\n else context.error(DiagnosticCodes.InvalidCommandResponse, \"Expected '<field> [<Type>] = <property>' in a response block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const fieldLocation = locationOf(child);\n const type = match[2] === undefined ? null : parseTypeRef(match[2], { ...fieldLocation, column: fieldLocation.column + child.content.indexOf(match[2], match[1].length) });\n if (type !== null) reportLegacyOptionalSuffix(context, type, child);\n fields.push({ kind: 'ResponseFieldSyntax', name: unescapeIdentifier(match[1]), type, source: { kind: 'PropertyResponseSourceSyntax', property: unescapeIdentifier(match[3]), location: { ...fieldLocation, column: fieldLocation.column + child.content.lastIndexOf(match[3]) } }, location: fieldLocation });\n const nested = context.peekChild(child.indent);\n if (nested !== undefined) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A response field cannot have child directives.', locationOf(nested));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'RecordCommandResponseSyntax', fields, location };\n}\n"],"mappings":"oXAWA,MAAaA,EAAwBC,EAAQ,gCAAgC,EACvEC,EAAeD,EAAQ,kGAAkG,EAE/H,SAAgB,qBAAqB,EAAwB,EAAgD,CACzG,IAAME,EAAWC,EAAWC,CAAI,EAChC,GAAIA,EAAK,UAAY,UAAW,CAC5B,IAAMC,EAAQN,EAAsB,KAAKK,EAAK,OAAO,EACrD,GAAIC,IAAU,KAGV,OAFAC,EAAQ,MAAMC,EAAgB,uBAAwB,qEAAsEL,CAAQ,EACpII,EAAQ,UAAUF,EAAK,MAAM,EACtB,KAEX,IAAMI,EAAQF,EAAQ,UAAUF,EAAK,MAAM,EACvCI,IAAU,IAAA,KACVF,EAAQ,MAAMC,EAAgB,uBAAwB,kDAAmDJ,EAAWK,CAAK,CAAC,EAC1HF,EAAQ,UAAUF,EAAK,MAAM,GAGjC,IAAMK,EAAeJ,EAAM,MAAQA,EAAM,EAAE,CAAC,OAASA,EAAM,EAAE,CAAC,OAC9D,MAAO,CAAE,KAAM,8BAA+B,OAAQ,CAAE,KAAM,+BAAg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S,IAAW,IAAA,KACXX,EAAQ,MAAMC,EAAgB,uBAAwB,iDAAkDJ,EAAWc,CAAM,CAAC,EAC1HX,EAAQ,UAAUE,EAAM,MAAM,EAEtC,CACA,MAAO,CAAE,KAAM,8BAA+B,SAAQ,UAAS,CACnE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{documentPlacement as e}from"../Files/PlayPlacement.js";import{sourceContext as t}from"./SourceOptionsParser.js";import{parseApplication as n}from"./ScreenplayParser.js";var r=class CommandStreamCandidates{sources;qualifiedTypes;constructor(e,t){this.sources=e,this.qualifiedTypes=t}hasSource(e){return this.sources.has(e)}hasPropertyType(e){return this.qualifiedTypes.has(e)}hasUniqueStream(e,t){let n=this.sources.get(e);return n?.length===1&&n[0].filter(e=>e===t).length===1}static capture(t,n=e,r){return this.capturePlaced([...t].map(e=>({lines:e,placement:n})),r)}static capturePlaced(e,r){let i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Set;for(let{lines:s,placement:c}of e){let e=t(s,s[0]?.path,r);e.scope=c;let l=n(e,s,c);for(let e of l.types)a.add(e.name);for(let e of l.concepts)a.add(e.name);for(let e of l.imports)o.add(e.qualifiedName);for(let e of l.eventSources??[])i.set(e.name,[...i.get(e.name)??[],e.streams.map(e=>e.name)])}let s=new Set([...o].filter(e=>a.has(e.substring(e.lastIndexOf(`.`)+1))));return new CommandStreamCandidates(i,s)}};export{r as CommandStreamCandidates};
|
|
2
|
+
//# sourceMappingURL=CommandStreamCandidates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandStreamCandidates.js","names":["CommandStreamCandidates","sources","qualifiedTypes","name","parents","source","stream","documentPlacement","documents","languages","types","imports","context","sourceContext","lines","placement","application","parseApplication","type","concept","imported","qualified"],"sources":["../../../../../../Compiler/Parsing/CommandStreamCandidates.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 { documentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { sourceContext } from './SourceOptionsParser';\nimport { parseApplication } from './ScreenplayParser';\nimport { SourceLine } from './SourceLine';\n\n// One noncommitting real parse per immutable document, without stream candidates. Commands retain\n// legacy properties; the parser owns leaf/block/fence rules. Capture never calls itself recursively.\nexport class CommandStreamCandidates {\n private constructor(private readonly sources: ReadonlyMap<string, readonly (readonly string[])[]>, private readonly qualifiedTypes: ReadonlySet<string>) {}\n\n hasSource(name: string): boolean { return this.sources.has(name); }\n hasPropertyType(name: string): boolean { return this.qualifiedTypes.has(name); }\n hasUniqueStream(source: string, stream: string): boolean {\n const parents = this.sources.get(source);\n return parents?.length === 1 && parents[0].filter(name => name === stream).length === 1;\n }\n\n static capture(documents: Iterable<readonly SourceLine[]>, placement: PlayPlacement = documentPlacement, languages?: ReadonlySet<string>): CommandStreamCandidates {\n return this.capturePlaced([...documents].map(lines => ({ lines, placement })), languages);\n }\n\n static capturePlaced(documents: Iterable<{ readonly lines: readonly SourceLine[]; readonly placement: PlayPlacement }>, languages?: ReadonlySet<string>): CommandStreamCandidates {\n const sources = new Map<string, string[][]>();\n const types = new Set<string>();\n const imports = new Set<string>();\n for (const { lines, placement } of documents) {\n const context = sourceContext(lines, lines[0]?.path, languages);\n context.scope = placement;\n const application = parseApplication(context, lines, placement);\n for (const type of application.types) types.add(type.name);\n for (const concept of application.concepts) types.add(concept.name);\n for (const imported of application.imports) imports.add(imported.qualifiedName);\n for (const source of application.eventSources ?? []) {\n sources.set(source.name, [...sources.get(source.name) ?? [], source.streams.map(stream => stream.name)]);\n }\n }\n const qualified = new Set([...imports].filter(name => types.has(name.substring(name.lastIndexOf('.') + 1))));\n return new CommandStreamCandidates(sources, qualified);\n }\n}\n"],"mappings":"qOAUA,IAAaA,EAAb,MAAa,uBAAwB,CACI,QAA+E,eAApH,YAAoB,EAA+E,EAAsD,CAApH,KAAA,QAAAC,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AC,OAAO,GAAQD,EAAM,IAAIP,EAAK,UAAUA,EAAK,YAAY,GAAG,EAAI,CAAC,CAAC,CAAC,CAAC,EAC3G,OAAO,IAAI,wBAAwBF,EAASoB,CAAS,CACzD,CACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";function validateStreamIdParts(e,t,n,r,i,a,o){if(n){a.error(i,`A composite stream requires a streamId part block, not a scalar mapping.`,r);return}let s=e.streamIdParts;for(let e of s.filter(e=>!t.some(t=>t.property===e.name)))a.error(i,`Stream id part '${e.name}' requires a mapping.`,r);let c=/* @__PURE__ */ new Set;for(let e of t){let t=s.find(t=>t.name===e.property);t===void 0?a.error(i,`Unknown stream id part '${e.property}'.`,e.location):c.has(e.property)?a.error(i,`Stream id part '${e.property}' is mapped more than once.`,e.location):(c.add(e.property),o(e,t.type))}}export{validateStreamIdParts};
|
|
2
|
+
//# sourceMappingURL=CompositeStreamIdValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositeStreamIdValidator.js","names":["scalar","context","code","location","parts","stream","part","mappings","mapping","names","validate"],"sources":["../../../../../../Compiler/Parsing/CompositeStreamIdValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventStreamSyntax } from '../Syntax/EventSources';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ParserContext } from './ParserContext';\n\nexport function validateStreamIdParts(stream: EventStreamSyntax, mappings: readonly PropertyMappingSyntax[], scalar: boolean, location: SourceLocation, code: string, context: ParserContext, validate: (mapping: PropertyMappingSyntax, target: TypeRefSyntax) => void): void {\n if (scalar) {\n context.error(code, 'A composite stream requires a streamId part block, not a scalar mapping.', location);\n return;\n }\n const parts = stream.streamIdParts;\n for (const part of parts.filter(part => !mappings.some(mapping => mapping.property === part.name)))\n context.error(code, `Stream id part '${part.name}' requires a mapping.`, location);\n const names = new Set<string>();\n for (const mapping of mappings) {\n const part = parts.find(part => part.name === mapping.property);\n if (part === undefined) context.error(code, `Unknown stream id part '${mapping.property}'.`, mapping.location);\n else if (names.has(mapping.property)) context.error(code, `Stream id part '${mapping.property}' is mapped more than once.`, mapping.location);\n else {\n names.add(mapping.property);\n validate(mapping, part.type);\n }\n }\n}\n"],"mappings":"qDASA,SAAgB,sBAAsB,EAA2B,EAA4C,EAAiB,EAA0B,EAAc,EAAwB,EAAiF,CAC3Q,GAAIA,EAAQ,CACRC,EAAQ,MAAMC,EAAM,2EAA4EC,CAAQ,EACxG,MACJ,CACA,IAAMC,EAAQC,EAAO,cACrB,IAAK,IAAMC,KAAQF,EAAM,OAAO,GAAQ,CAACG,EAAS,KAAK,GAAWC,EAAQ,WAAaF,EAAK,IAAI,CAAC,EAC7FL,EAAQ,MAAMC,EAAM,mBAAmBI,EAAK,KAAK,uBAAwBH,CAAQ,EACrF,IAAMM,kBAAQ,IAAI,IAClB,IAAK,IAAMD,KAAWD,EAAU,CAC5B,IAAMD,EAAOF,EAAM,KAAK,GAAQE,EAAK,OAASE,EAAQ,QAAQ,EAC1DF,IAAS,IAAA,GAAWL,EAAQ,MAAMC,EAAM,2BAA2BM,EAAQ,SAAS,IAAKA,EAAQ,QAAQ,EACpGC,EAAM,IAAID,EAAQ,QAAQ,EAAGP,EAAQ,MAAMC,EAAM,mBAAmBM,EAAQ,SAAS,6BAA8BA,EAAQ,QAAQ,GAExIC,EAAM,IAAID,EAAQ,QAAQ,EAC1BE,EAASF,EAASF,EAAK,IAAI,EAEnC,CACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseMappingSource as i}from"./ExpressionParser.js";import{locationOf as a}from"./SourceLine.js";const o=`(?:([A-Za-z_]\\w*)|"(${n})")\\.(\\w+(?:\\.\\w+)*)`,s=t(`^exposure\\s+for\\s+([A-Za-z_]\\w*)$`),c=t(`^instance\\s+([A-Za-z_]\\w*)$`),l=t(`^property\\s+${o}(?:\\s+label\\s+"(${n})")?(?:\\s+operations\\s+([\\w-]+(?:\\s*,\\s*[\\w-]+)*))?(?:\\s+fields\\s+(\\w+(?:\\s*,\\s*\\w+)*))?(?:\\s+reexposes\\s+([A-Za-z_]\\w*))?$`),u=t(`^set\\s+${o}\\s*=\\s*(.+)$`),d=t(`^items\\s+${o}$`),f=t(`^item\\s+(?:([A-Za-z_][\\w-]*)|"(${n})")$`),p=t(`^([A-Za-z_]\\w*)\\s*=\\s*(.+)$`),m=[`add`,`remove`,`reorder`,`edit-fields`],reference=(e,t)=>e[t]??r(e[t+1]),list=e=>e.trim()===`none`?[]:e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0);function parseExposure(t,n){let r=s.exec(n.content);r===null&&t.error(e.InvalidExposureDeclaration,`Invalid exposure declaration '${n.content}' - expected 'exposure for <Owner>'`,a(n));let i=[];for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseExposedProperty(t,e);n!==void 0&&i.push(n)}return{kind:`ExposureSyntax`,owner:r?.[1]??n.content,properties:i,location:a(n)}}function parseInstance(t,n){let r=c.exec(n.content);r===null&&t.error(e.InvalidInstanceContribution,`Invalid instance declaration '${n.content}' - expected 'instance <Screen or Template>'`,a(n));let i=[];for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseContribution(t,e);n!==void 0&&i.push(n)}return{kind:`InstanceContributionsSyntax`,instance:r?.[1]??n.content,contributions:i,location:a(n)}}function parseExposedProperty(t,n){let i=l.exec(n.content);if(i===null){t.error(e.InvalidExposureDeclaration,`Invalid exposed property '${n.content}' - expected 'property <component>.<path> [label "<text>"] [operations <add|remove|reorder|edit-fields>, ...] [fields <field>, ...] [reexposes <Owner>]'`,a(n));return}let o=i[5]===void 0?[]:list(i[5]),s=o.find(e=>!m.includes(e));if(s!==void 0)t.error(e.InvalidExposureDeclaration,`Unknown collection operation '${s}' - expected add, remove, reorder, edit-fields or none`,a(n));else return{kind:`ExposedPropertySyntax`,component:reference(i,1),path:i[3],label:i[4]===void 0?null:r(i[4]),isCollection:i[5]!==void 0,operations:o,restrictsFields:i[6]!==void 0,editableFields:i[6]===void 0?[]:list(i[6]),reExposes:i[7]??null,location:a(n)}}function parseContribution(t,n){let r=u.exec(n.content);if(r!==null)return t.skipBlock(n.indent),{kind:`InstanceContributionSyntax`,component:reference(r,1),path:r[3],value:i(r[4],a(n),t),items:[],location:a(n)};let o=d.exec(n.content);if(o!==null){let e=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseItem(t,r);n!==void 0&&e.push(n)}return{kind:`InstanceContributionSyntax`,component:reference(o,1),path:o[3],value:null,items:e,location:a(n)}}t.error(e.InvalidInstanceContribution,`Invalid instance contribution '${n.content}' - expected 'set <component>.<path> = <value>' or 'items <component>.<path>'`,a(n)),t.skipBlock(n.indent)}function parseItem(t,n){let r=f.exec(n.content);if(r===null){t.error(e.InvalidInstanceContribution,`Invalid contributed item '${n.content}' - expected 'item <id>'`,a(n)),t.skipBlock(n.indent);return}let o=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=p.exec(r.content);n===null?(t.error(e.InvalidInstanceContribution,`Invalid item value '${r.content}' - expected '<field> = <value>'`,a(r)),t.skipBlock(r.indent)):o.push({kind:`ContributedItemValueSyntax`,field:n[1],value:i(n[2],a(r),t),location:a(r)})}return{kind:`ContributedItemSyntax`,id:reference(r,1),values:o,location:a(n)}}export{parseExposure,parseInstance};
|
|
2
|
+
//# sourceMappingURL=CompositionParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositionParser.js","names":["component","stringBodyPattern","exposureHeader","pattern","instanceHeader","exposedProperty","setPattern","itemsPattern","itemPattern","itemValuePattern","operations","match","group","unescapeString","text","entry","header","context","DiagnosticCodes","locationOf","properties","line","property","contributions","contribution","granted","unknown","operation","set","parseMappingSource","items","parsed","child","item","values","value"],"sources":["../../../../../../Compiler/Parsing/CompositionParser.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 { ContributedItemSyntax, ContributedItemValueSyntax, ExposedPropertySyntax, ExposureSyntax, InstanceContributionSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst component = `(?:([A-Za-z_]\\\\w*)|\"(${stringBodyPattern})\")\\\\.(\\\\w+(?:\\\\.\\\\w+)*)`;\nconst exposureHeader = pattern('^exposure\\\\s+for\\\\s+([A-Za-z_]\\\\w*)$');\nconst instanceHeader = pattern('^instance\\\\s+([A-Za-z_]\\\\w*)$');\nconst exposedProperty = pattern(`^property\\\\s+${component}(?:\\\\s+label\\\\s+\"(${stringBodyPattern})\")?(?:\\\\s+operations\\\\s+([\\\\w-]+(?:\\\\s*,\\\\s*[\\\\w-]+)*))?(?:\\\\s+fields\\\\s+(\\\\w+(?:\\\\s*,\\\\s*\\\\w+)*))?(?:\\\\s+reexposes\\\\s+([A-Za-z_]\\\\w*))?$`);\nconst setPattern = pattern(`^set\\\\s+${component}\\\\s*=\\\\s*(.+)$`);\nconst itemsPattern = pattern(`^items\\\\s+${component}$`);\nconst itemPattern = pattern(`^item\\\\s+(?:([A-Za-z_][\\\\w-]*)|\"(${stringBodyPattern})\")$`);\nconst itemValuePattern = pattern('^([A-Za-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst operations = ['add', 'remove', 'reorder', 'edit-fields'];\nconst exposedPropertyShape = '\\'property <component>.<path> [label \"<text>\"] [operations <add|remove|reorder|edit-fields>, ...] [fields <field>, ...] [reexposes <Owner>]\\'';\n\nconst reference = (match: RegExpExecArray, group: number): string => match[group] ?? unescapeString(match[group + 1]);\nconst list = (text: string): string[] => text.trim() === 'none' ? [] : text.split(',').map(entry => entry.trim()).filter(entry => entry.length > 0);\n\n// 'exposure for <Owner>' - the port of the C# CompositionParser.ParseExposure.\nexport function parseExposure(context: ParserContext, header: SourceLine): ExposureSyntax {\n const match = exposureHeader.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Invalid exposure declaration '${header.content}' - expected 'exposure for <Owner>'`, locationOf(header));\n }\n const properties: ExposedPropertySyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const property = parseExposedProperty(context, line);\n if (property !== undefined) properties.push(property);\n }\n return { kind: 'ExposureSyntax', owner: match?.[1] ?? header.content, properties, location: locationOf(header) };\n}\n\n// 'instance <Instance>' - the port of the C# CompositionParser.ParseInstance.\nexport function parseInstance(context: ParserContext, header: SourceLine): InstanceContributionsSyntax {\n const match = instanceHeader.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid instance declaration '${header.content}' - expected 'instance <Screen or Template>'`, locationOf(header));\n }\n const contributions: InstanceContributionSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const contribution = parseContribution(context, line);\n if (contribution !== undefined) contributions.push(contribution);\n }\n return { kind: 'InstanceContributionsSyntax', instance: match?.[1] ?? header.content, contributions, location: locationOf(header) };\n}\n\nfunction parseExposedProperty(context: ParserContext, line: SourceLine): ExposedPropertySyntax | undefined {\n const match = exposedProperty.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Invalid exposed property '${line.content}' - expected ${exposedPropertyShape}`, locationOf(line));\n return undefined;\n }\n const granted = match[5] === undefined ? [] : list(match[5]);\n const unknown = granted.find(operation => !operations.includes(operation));\n if (unknown !== undefined) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Unknown collection operation '${unknown}' - expected add, remove, reorder, edit-fields or none`, locationOf(line));\n return undefined;\n }\n return {\n kind: 'ExposedPropertySyntax',\n component: reference(match, 1),\n path: match[3],\n label: match[4] === undefined ? null : unescapeString(match[4]),\n isCollection: match[5] !== undefined,\n operations: granted,\n restrictsFields: match[6] !== undefined,\n editableFields: match[6] === undefined ? [] : list(match[6]),\n reExposes: match[7] ?? null,\n location: locationOf(line)\n };\n}\n\nfunction parseContribution(context: ParserContext, line: SourceLine): InstanceContributionSyntax | undefined {\n const set = setPattern.exec(line.content);\n if (set !== null) {\n context.skipBlock(line.indent);\n return { kind: 'InstanceContributionSyntax', component: reference(set, 1), path: set[3], value: parseMappingSource(set[4], locationOf(line), context), items: [], location: locationOf(line) };\n }\n const items = itemsPattern.exec(line.content);\n if (items !== null) {\n const parsed: ContributedItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseItem(context, child);\n if (item !== undefined) parsed.push(item);\n }\n return { kind: 'InstanceContributionSyntax', component: reference(items, 1), path: items[3], value: null, items: parsed, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid instance contribution '${line.content}' - expected 'set <component>.<path> = <value>' or 'items <component>.<path>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseItem(context: ParserContext, line: SourceLine): ContributedItemSyntax | undefined {\n const match = itemPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid contributed item '${line.content}' - expected 'item <id>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const values: ContributedItemValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = itemValuePattern.exec(child.content);\n if (value === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid item value '${child.content}' - expected '<field> = <value>'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n values.push({ kind: 'ContributedItemValueSyntax', field: value[1], value: parseMappingSource(value[2], locationOf(child), context), location: locationOf(child) });\n }\n return { kind: 'ContributedItemSyntax', id: reference(match, 1), values, location: locationOf(line) };\n}\n"],"mappings":"gWAWA,MAAMA,EAAY,wBAAwBC,EAAkB,0BACtDC,EAAiBC,EAAQ,sCAAsC,EAC/DC,EAAiBD,EAAQ,+BAA+B,EACxDE,EAAkBF,EAAQ,gBAAgBH,EAAU,oBAAoBC,EAAkB,2IAA2I,EACrOK,EAAaH,EAAQ,WAAWH,EAAU,eAAe,EACzDO,EAAeJ,EAAQ,aAAaH,EAAU,EAAE,EAChDQ,EAAcL,EAAQ,oCAAoCF,EAAkB,KAAK,EACjFQ,EAAmBN,EAAQ,gCAAgC,EAC3DO,EAAa,CAAC,MAAO,SAAU,UAAW,aAAa,EAGvD,WAAa,EAAwB,IAA0BC,EAAMC,IAAUC,EAAeF,EAAMC,EAAQ,EAAE,EAC9G,KAAQ,GAA2BE,EAAK,KAAK,IAAM,OAAS,CAAC,EAAIA,EAAK,MAAM,GAAG,CAAC,CAAC,IAAI,GAASC,EAAM,KAAK,CAAC,CAAC,CAAC,OAAO,GAASA,EAAM,OAAS,CAAC,EAGlJ,SAAgB,cAAc,EAAwB,EAAoC,CACtF,IAAMJ,EAAQT,EAAe,KAAKc,EAAO,OAAO,EAC5CL,IAAU,MACVM,EAAQ,MAAMC,EAAgB,2BAA4B,iCAAiCF,EAAO,QAAQ,qCAAs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iagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{locationOf as i}from"./SourceLine.js";const a=[`racialOrEthnicOrigin`,`politicalOpinions`,`religiousOrPhilosophicalBeliefs`,`tradeUnionMembership`,`genetic`,`biometric`,`health`,`sexLifeOrSexualOrientation`],o=t(`^(@?[a-z_]\\w*)\\s+(reason|scope|special|criminal)(?:\\s+(.*))?$`),s=t(`^"(${n})"$`);function complianceWireName(e){let t=e.replace(/^@/,``);return t===`personal`?`pii`:t===`secret`?`sensitive`:t}function canonicalComplianceName(e){let t=complianceWireName(e);return t===`sensitive`?`secret`:t}function parseComplianceMarkers(t,n,r){let a=r.trim().split(/\s+/).filter(e=>e.length>0);return reportLegacy(t,n,a),a.map(r=>{let a=complianceWireName(r);return(![`pii`,`sensitive`].includes(a)||r===`@personal`||r===`@secret`)&&t.error(e.UnknownComplianceMarker,`Unknown concept marker '${r}' - expected pii, personal or secret`,i(n)),{kind:`ConceptAttributeSyntax`,name:a,reason:null,scope:null,specialCategory:null,criminal:!1,location:i(n)}})}function parseComplianceDirective(t,n,c,l){let u=o.exec(n.content);if(u===null)return!1;let[,d,f]=u,p=u[3]??``,m=complianceWireName(d),h=canonicalComplianceName(d);if(reportLegacy(t,n,[d]),![`pii`,`sensitive`].includes(m)||d===`@personal`||d===`@secret`)return t.error(e.UnknownComplianceMarker,`Unknown concept marker '${d}' - expected pii, personal or secret`,i(n)),!0;let g=l.findIndex(e=>e.name===m);if(g<0)return t.error(e.AttributeReasonWithoutAttribute,`Concept '${c}' declares '${h} ${f}' without the marker - write 'concept ${c} : <Type> ${h}'`,i(n)),!0;let _=l[g];switch(f){case`reason`:{let a=s.exec(p);return a===null?(t.error(e.UnknownConceptDirective,`Invalid '${h} reason' - expected '${h} reason "<text>"'`,i(n)),!0):_.reason===null?(l[g]={..._,reason:r(a[1])},!0):(t.error(e.DuplicateAttributeReason,`Concept '${c}' already declares a reason for '${h}' - at most one is allowed`,i(n)),!0)}case`scope`:return m!==`sensitive`||![`subject`,`namespace`,`global`].includes(p)?(t.error(e.InvalidSecretScope,`Invalid '${h} scope ${p}' - scope belongs to secret and must be subject, namespace or global`,i(n)),!0):_.scope==null?(l[g]={..._,scope:p},l.some(e=>e.name===`pii`)&&t.warning(e.SecretScopeIgnoredForPii,`Concept '${c}' is pii secret - secret scope is ignored because only Chronicle [PII] renders`,i(n)),!0):(t.error(e.DuplicateSecretScope,`Concept '${c}' already declares secret scope - at most one is allowed`,i(n)),!0);case`special`:case`criminal`:return m!==`pii`||(f===`special`?!a.includes(p):p.length>0)?(t.error(e.InvalidPersonalDataQualifier,`Invalid '${h} ${f}${p.length>0?` ${p}`:``}' - expected 'pii criminal' or 'pii special <category>' with category ${a.join(`, `)}`,i(n)),!0):f===`special`&&_.specialCategory!=null?(t.error(e.DuplicateSpecialCategory,`Concept '${c}' already declares pii special - at most one is allowed`,i(n)),!0):(l[g]=f===`special`?{..._,specialCategory:p}:{..._,criminal:!0},!0);default:return!1}}function reportLegacy(t,n,r){r.some(e=>[`@pii`,`sensitive`,`@sensitive`].includes(e))&&t.information(e.LegacyComplianceMarker,`Legacy compliance spelling - use bare pii for personal data and secret for operational secrets; reason text is preserved`,i(n))}export{canonicalComplianceName,complianceWireName,parseComplianceDirective,parseComplianceMarkers,a as specialCategories};
|
|
2
|
+
//# sourceMappingURL=ConceptComplianceParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConceptComplianceParser.js","names":["specialCategories","directivePattern","pattern","reasonPattern","stringBodyPattern","name","marker","markers","text","context","line","DiagnosticCodes","locationOf","match","setting","value","canonical","index","attributes","attribute","concept","reason","unescapeString"],"sources":["../../../../../../Compiler/Parsing/ConceptComplianceParser.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 { ConceptAttributeSyntax } from '../Syntax/Declarations';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const specialCategories = ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'];\nconst directivePattern = pattern('^(@?[a-z_]\\\\w*)\\\\s+(reason|scope|special|criminal)(?:\\\\s+(.*))?$');\nconst reasonPattern = pattern(`^\"(${stringBodyPattern})\"$`);\n\nexport function complianceWireName(marker: string): string {\n const name = marker.replace(/^@/, '');\n return name === 'personal' ? 'pii' : name === 'secret' ? 'sensitive' : name;\n}\n\nexport function canonicalComplianceName(marker: string): string {\n const name = complianceWireName(marker);\n return name === 'sensitive' ? 'secret' : name;\n}\n\nexport function parseComplianceMarkers(context: ParserContext, line: SourceLine, text: string): ConceptAttributeSyntax[] {\n const markers = text.trim().split(/\\s+/).filter(marker => marker.length > 0);\n reportLegacy(context, line, markers);\n return markers.map(marker => {\n const name = complianceWireName(marker);\n if (!['pii', 'sensitive'].includes(name) || marker === '@personal' || marker === '@secret') {\n context.error(DiagnosticCodes.UnknownComplianceMarker, `Unknown concept marker '${marker}' - expected pii, personal or secret`, locationOf(line));\n }\n return { kind: 'ConceptAttributeSyntax', name, reason: null, scope: null, specialCategory: null, criminal: false, location: locationOf(line) };\n });\n}\n\nexport function parseComplianceDirective(context: ParserContext, line: SourceLine, concept: string, attributes: ConceptAttributeSyntax[]): boolean {\n const match = directivePattern.exec(line.content);\n if (match === null) return false;\n const [, marker, setting] = match;\n const value = match[3] ?? '';\n const name = complianceWireName(marker);\n const canonical = canonicalComplianceName(marker);\n reportLegacy(context, line, [marker]);\n if (!['pii', 'sensitive'].includes(name) || marker === '@personal' || marker === '@secret') {\n context.error(DiagnosticCodes.UnknownComplianceMarker, `Unknown concept marker '${marker}' - expected pii, personal or secret`, locationOf(line));\n return true;\n }\n const index = attributes.findIndex(attribute => attribute.name === name);\n if (index < 0) {\n context.error(DiagnosticCodes.AttributeReasonWithoutAttribute, `Concept '${concept}' declares '${canonical} ${setting}' without the marker - write 'concept ${concept} : <Type> ${canonical}'`, locationOf(line));\n return true;\n }\n const attribute = attributes[index];\n switch (setting) {\n case 'reason': {\n const reason = reasonPattern.exec(value);\n if (reason === null) {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Invalid '${canonical} reason' - expected '${canonical} reason \"<text>\"'`, locationOf(line));\n return true;\n }\n if (attribute.reason !== null) {\n context.error(DiagnosticCodes.DuplicateAttributeReason, `Concept '${concept}' already declares a reason for '${canonical}' - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = { ...attribute, reason: unescapeString(reason[1]) };\n return true;\n }\n case 'scope':\n if (name !== 'sensitive' || !['subject', 'namespace', 'global'].includes(value)) {\n context.error(DiagnosticCodes.InvalidSecretScope, `Invalid '${canonical} scope ${value}' - scope belongs to secret and must be subject, namespace or global`, locationOf(line));\n return true;\n }\n if (attribute.scope != null) {\n context.error(DiagnosticCodes.DuplicateSecretScope, `Concept '${concept}' already declares secret scope - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = { ...attribute, scope: value };\n if (attributes.some(attribute => attribute.name === 'pii')) {\n context.warning(DiagnosticCodes.SecretScopeIgnoredForPii, `Concept '${concept}' is pii secret - secret scope is ignored because only Chronicle [PII] renders`, locationOf(line));\n }\n return true;\n case 'special':\n case 'criminal':\n if (name !== 'pii' || (setting === 'special' ? !specialCategories.includes(value) : value.length > 0)) {\n context.error(DiagnosticCodes.InvalidPersonalDataQualifier, `Invalid '${canonical} ${setting}${value.length > 0 ? ` ${value}` : ''}' - expected 'pii criminal' or 'pii special <category>' with category ${specialCategories.join(', ')}`, locationOf(line));\n return true;\n }\n if (setting === 'special' && attribute.specialCategory != null) {\n context.error(DiagnosticCodes.DuplicateSpecialCategory, `Concept '${concept}' already declares pii special - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = setting === 'special' ? { ...attribute, specialCategory: value } : { ...attribute, criminal: true };\n return true;\n default:\n return false;\n }\n}\n\nfunction reportLegacy(context: ParserContext, line: SourceLine, markers: readonly string[]): void {\n if (markers.some(marker => ['@pii', 'sensitive', '@sensitive'].includes(marker))) {\n context.information(DiagnosticCodes.LegacyComplianceMarker, 'Legacy compliance spelling - use bare pii for personal data and secret for operational secrets; reason text is preserved', locationOf(line));\n }\n}\n"],"mappings":"qSAUA,MAAaA,EAAoB,CAAC,uBAAwB,oBAAqB,kCAAmC,uBAAwB,UAAW,YAAa,SAAU,4BAA4B,EAClMC,EAAmBC,EAAQ,kEAAkE,EAC7FC,EAAgBD,EAAQ,MAAME,EAAkB,IAAI,EAE1D,SAAgB,mBAAmB,EAAwB,CACvD,IAAMC,EAAOC,EAAO,QAAQ,KAAM,EAAE,EACpC,OAAOD,IAAS,WAAa,MAAQA,IAAS,SAAW,YAAcA,CAC3E,CAEA,SAAgB,wBAAwB,EAAwB,CAC5D,IAAMA,EAAO,mBAAmBC,CAAM,EACtC,OAAOD,IAAS,YAAc,SAAWA,CAC7C,CAEA,SAAgB,uBAAuB,EAAwB,EAAkB,EAAwC,CACrH,IAAME,EAAUC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,GAAUF,EAAO,OAAS,CAAC,EAE3E,OADA,aAAaG,EAASC,EAAMH,CAAO,EAC5BA,EAAQ,IAAI,GAAU,CACzB,IAAMF,EAAO,mBAAmBC,CAAM,EAItC,OAHI,CAAC,CAAC,MAAO,WAAW,CAAC,CAAC,SAASD,CAAI,GAAKC,IAAW,aAAeA,IAAW,YAC7EG,EAAQ,MAAME,EAAgB,wBAAyB,2BAA2BL,EAAO,sCAAuCM,EAAWF,CAAI,CAAC,EAE7I,CAAE,KAAM,yBAA0B,OAAM,OAAQ,KAAM,MAAO,KAAM,gBAAiB,KAAM,SAAU,GAAO,SAAUE,EAA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es as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{stringBodyPattern as r}from"../Text/StringLiteral.js";import{parseModeledMappingSource as i}from"./ExpressionParser.js";const a={"==":`Equal`,"!=":`NotEqual`,">":`GreaterThan`,">=":`GreaterThanOrEqual`,"<":`LessThan`,"<=":`LessThanOrEqual`,contains:`Contains`,"starts with":`StartsWith`};function parseCondition(o,s,c,l=!1){l||(o=o.valueContext);let u=l?t:`\\s`,d=o.sourceOptions.numericMode===`exact`?`-?[0-9]+(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|${u}|[()])|`:``,f=o.sourceOptions.numericMode===`exact`&&!l?`[\\w.$-]+|[^\\s]`:`[\\w.$-]+`,p=new RegExp(n(`"${r}"|==|!=|>=|<=|>|<|\\(|\\)|${d}${f}`).source,`gu`);if(l){let n=s.replace(p,``).replace(new RegExp(t,`gu`),``);if(n.length>0)return o.error(e.UnsupportedActionConditionOperand,`Guarded action conditions contain unsupported character '${n[0]}'`,c),null}let m=s.match(p)??[],h=0,group=()=>{if(m[h]===`(`){h++;let t=or();return m[h]===`)`?h++:(l||o.sourceOptions.numericMode===`exact`)&&o.error(e.UnclosedConditionGroup,`Expected ')' in condition`,c),t}let t=m[h++];if(l&&t===void 0)return o.error(e.ExpectedCondition,`Expected a condition`,c),null;let n=m[h++];if(n===`starts`&&m[h]===`with`&&(n+=` with`,h++),l&&!Object.hasOwn(a,n))return o.error(e.ExpectedComparisonOperator,`Expected a comparison operator after '${t}'`,c),null;let r=m[h++];return l&&r===void 0?(o.error(e.ExpectedComparisonValue,`Expected a value to compare against`,c),null):t===void 0||r===void 0||a[n]===void 0?null:{kind:`ComparisonConditionSyntax`,left:t,operator:a[n],right:i(r,c,o),location:c}},and=()=>{let e=group();for(;e!==null&&m[h]===`and`;){h++;let t=group();if(t===null)return null;e={kind:`LogicalConditionSyntax`,left:e,operator:`And`,right:t,location:c}}return e},or=()=>{let e=and();for(;e!==null&&m[h]===`or`;){h++;let t=and();if(t===null)return null;e={kind:`LogicalConditionSyntax`,left:e,operator:`Or`,right:t,location:c}}return e},g=or();return(l||o.sourceOptions.numericMode===`exact`)&&(g===null&&!l?o.error(e.ExpectedCondition,`Expected a condition`,c):g!==null&&h<m.length&&o.error(e.UnexpectedTokenInCondition,`Unexpected '${m[h]}' in condition`,c)),g}export{parseCondition};
|
|
2
|
+
//# sourceMappingURL=ConditionParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionParser.js","names":["parseMappingSource","operators","strict","context","whitespace","dotNetWhitespace","numeric","words","regex","nativePattern","stringBodyPattern","unsupported","text","DiagnosticCodes","location","tokens","position","condition","left","operator","right","parseModeledMappingSource"],"sources":["../../../../../../Compiler/Parsing/ConditionParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ComparisonOperator, ConditionSyntax } from '../Syntax/Conditions';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\n\nconst operators: Record<string, ComparisonOperator> = { '==': 'Equal', '!=': 'NotEqual', '>': 'GreaterThan', '>=': 'GreaterThanOrEqual', '<': 'LessThan', '<=': 'LessThanOrEqual', contains: 'Contains', 'starts with': 'StartsWith' };\n\n// The existing C# condition grammar: comparisons, left-associative and/or, and grouped conditions.\n// Previously omitted Legacy operands gain structure, not new parser diagnostics.\nexport function parseCondition(context: ParserContext, text: string, location: SourceLocation, strict = false): ConditionSyntax | null {\n if (!strict) context = context.valueContext;\n const whitespace = strict ? dotNetWhitespace : '\\\\s';\n const numeric = context.sourceOptions.numericMode === 'exact' ? `-?[0-9]+(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|${whitespace}|[()])|` : '';\n const words = context.sourceOptions.numericMode === 'exact' && !strict ? '[\\\\w.$-]+|[^\\\\s]' : '[\\\\w.$-]+';\n const regex = new RegExp(nativePattern(`\"${stringBodyPattern}\"|==|!=|>=|<=|>|<|\\\\(|\\\\)|${numeric}${words}`).source, 'gu');\n if (strict) {\n const unsupported = text.replace(regex, '').replace(new RegExp(dotNetWhitespace, 'gu'), '');\n if (unsupported.length > 0) {\n context.error(DiagnosticCodes.UnsupportedActionConditionOperand, `Guarded action conditions contain unsupported character '${unsupported[0]}'`, location);\n return null;\n }\n }\n const tokens = text.match(regex) ?? [];\n let position = 0;\n const group = (): ConditionSyntax | null => {\n if (tokens[position] === '(') {\n position++;\n const condition = or();\n if (tokens[position] === ')') position++;\n else if (strict || context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.UnclosedConditionGroup, \"Expected ')' in condition\", location);\n return condition;\n }\n const left = tokens[position++];\n if (strict && left === undefined) {\n context.error(DiagnosticCodes.ExpectedCondition, 'Expected a condition', location);\n return null;\n }\n let operator = tokens[position++];\n if (operator === 'starts' && tokens[position] === 'with') { operator += ' with'; position++; }\n if (strict && !Object.hasOwn(operators, operator)) {\n context.error(DiagnosticCodes.ExpectedComparisonOperator, `Expected a comparison operator after '${left}'`, location);\n return null;\n }\n const right = tokens[position++];\n if (strict && right === undefined) {\n context.error(DiagnosticCodes.ExpectedComparisonValue, 'Expected a value to compare against', location);\n return null;\n }\n return left === undefined || right === undefined || operators[operator] === undefined ? null : { kind: 'ComparisonConditionSyntax', left, operator: operators[operator], right: parseMappingSource(right, location, context), location };\n };\n const and = (): ConditionSyntax | null => {\n let left = group();\n while (left !== null && tokens[position] === 'and') {\n position++;\n const right = group();\n if (right === null) return null;\n left = { kind: 'LogicalConditionSyntax', left, operator: 'And', right, location };\n }\n return left;\n };\n const or = (): ConditionSyntax | null => {\n let left = and();\n while (left !== null && tokens[position] === 'or') {\n position++;\n const right = and();\n if (right === null) return null;\n left = { kind: 'LogicalConditionSyntax', left, operator: 'Or', right, location };\n }\n return left;\n };\n const condition = or();\n if (strict || context.sourceOptions.numericMode === 'exact') {\n if (condition === null && !strict) context.error(DiagnosticCodes.ExpectedCondition, 'Expected a condition', location);\n else if (condition !== null && position < tokens.length) context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Unexpected '${tokens[position]}' in condition`, location);\n }\n return condition;\n}\n"],"mappings":"kUAWA,MAAMC,EAAgD,CAAE,KAAM,QAAS,KAAM,WAAY,IAAK,cAAe,KAAM,qBAAsB,IAAK,WAAY,KAAM,kBAAmB,SAAU,WAAY,cAAe,YAAa,EAIrO,SAAgB,eAAe,EAAwB,EAAc,EAA0B,EAAS,GAA+B,CAC9HC,IAAQ,EAAUC,EAAQ,cAC/B,IAAMC,EAAaF,EAASG,EAAmB,MACzCC,EAAUH,EAAQ,cAAc,cAAgB,QAAU,kDAAkDC,EAAW,SAAW,GAClIG,EAAQJ,EAAQ,cAAc,cAAgB,SAAW,CAACD,EAAS,mBAAqB,YACxFM,EAAQ,IAAI,OAAOC,EAAc,IAAIC,EAAkB,4BAA4BJ,IAAUC,GAAO,CAAC,CAAC,OAAQ,IAAI,EACxH,GAAIL,EAAQ,CACR,IAAMS,EAAcC,EAAK,QAAQJ,EAAO,EAAE,CAAC,CAAC,QAAQ,IAAI,OAAOH,EAAkB,IAAI,EAAG,EAAE,EAC1F,GAAIM,EAAY,OAAS,EAErB,OADAR,EAAQ,MAAMU,EAAgB,kCAAmC,4DAA4DF,EAAY,GAAG,GAAIG,CAAQ,EACjJ,IAEf,CACA,IAAMC,EAASH,EAAK,MAAMJ,CAAK,GAAK,CAAC,EACjCQ,EAAW,EACT,UAAsC,CACxC,GAAID,EAAOC,KAAc,IAAK,CAC1B,IACA,IAAMC,EAAY,GAAG,EAGrB,OAFIF,EAAOC,KAAc,IAAK,KACrBd,GAAUC,EAAQ,cAAc,cAAgB,UAASA,EAAQ,M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5Cc,IAAc,MAAQ,CAACf,EAAQC,EAAQ,MAAMU,EAAgB,kBAAmB,uBAAwBC,CAAQ,EAC3GG,IAAc,MAAQD,EAAWD,EAAO,QAAQZ,EAAQ,MAAMU,EAAgB,2BAA4B,eAAeE,EAAOC,GAAU,gBAAiBF,CAAQ,GAEzKG,CACX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{firstWord as i}from"./LineText.js";import{locationOf as a}from"./SourceLine.js";import{parseDescription as o}from"./DescriptionParser.js";import{isFileDirective as s}from"./FileReferences.js";const c=t(`^constraint\\s+([A-Za-z_]\\w*)$`),l=t(`^unique\\s+event\\s+([A-Z]\\w*)$`),u=t(`^unique\\s+([a-z_][\\w.]*(?:\\s*,\\s*[a-z_][\\w.]*)*)\\s+on\\s+([A-Z]\\w*)$`),d=t(`^released\\s+by\\s+([A-Z]\\w*)$`),f=t(`^message\\s+"(${n})"$`),targetOf=e=>e.kind===`FileConstraintSyntax`?void 0:e.event;function parseConstraint(t,n){let s=c.exec(n.content);s===null&&t.error(e.InvalidConstraintDeclaration,`Invalid constraint declaration '${n.content}' - expected 'constraint <Name>'`,a(n));let l=s?.[1]??i(n.content),u=[],p=[],m=/* @__PURE__ */ new Set,h=/* @__PURE__ */ new Set,g=null,_=null,v=!1;for(let s=t.peekChild(n.indent);s!==void 0;s=t.peekChild(n.indent)){if(t.reader.takeSignificant(),i(s.content)===`description`){_=o(t,s,_,`Constraint '${l}'`);continue}let n=d.exec(s.content),c=f.exec(s.content);n===null?c===null?s.content===`ignore casing`?(v&&t.error(e.DuplicateConstraintBody,`Constraint '${l}' already ignores casing`,a(s)),v=!0):addRule(t,l,s,u,h):g===null?g=r(c[1]):t.error(e.DuplicateConstraintBody,`Constraint '${l}' already has a message`,a(s)):m.has(n[1])?t.error(e.DuplicateConstraintBody,`Constraint '${l}' already releases with event '${n[1]}'`,a(s)):(p.push(n[1]),m.add(n[1]))}for(let r of p.filter(e=>h.has(e)))t.error(e.DuplicateConstraintBody,`Constraint '${l}' cannot target and release event '${r}'`,a(n));return u.length===0&&(t.error(e.ConstraintWithoutRule,`Constraint '${l}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`,a(n)),u.push(rule(l,a(n),{kind:`UniqueEventConstraintSyntax`,event:``}))),u[0].kind===`FileConstraintSyntax`&&(p.length>0||g!==null||v)&&t.error(e.InvalidConstraintBody,`File constraint '${l}' cannot have declarative options`,a(n)),{...u[0],additionalRules:u.slice(1),releasedBy:p,message:g,ignoreCasing:v,description:_}}function addRule(t,n,r,i,o){let s=parseRule(t,n,r);if(s===void 0)return;if(i.length>0&&(s.kind===`FileConstraintSyntax`||i[0].kind===`FileConstraintSyntax`||s.kind===`UniqueEventConstraintSyntax`!=(i[0].kind===`UniqueEventConstraintSyntax`))){t.error(e.DuplicateConstraintBody,`Constraint '${n}' cannot mix constraint kinds`,a(r));return}let c=targetOf(s);c!==void 0&&o.has(c)?t.error(e.DuplicateConstraintBody,`Constraint '${n}' already targets event '${c}'`,a(r)):(c!==void 0&&o.add(c),i.push(s))}function parseRule(t,n,r){let i=a(r),o=l.exec(r.content);if(o!==null)return rule(n,i,{kind:`UniqueEventConstraintSyntax`,event:o[1]});let c=u.exec(r.content);if(c!==null){let r=c[1].split(`,`).map(e=>e.trim());if(new Set(r).size!==r.length){t.error(e.DuplicateConstraintBody,`Constraint '${n}' repeats a property in its composite key`,i);return}return rule(n,i,{kind:`UniquePropertyConstraintSyntax`,property:r[0],additionalProperties:r.slice(1),event:c[2]})}if(s(r))return t.warning(e.FileConstraintOnlySupportsUniqueness,`A file constraint can only declare unique constraints in Chronicle - declare them with 'unique ...' so they are portable; a rule that is not uniqueness belongs in command validation or a 'require' condition`,i),rule(n,i,{kind:`FileConstraintSyntax`,file:{kind:`FileReferenceSyntax`,path:r.content.substring(4).trim(),location:i}});t.error(e.InvalidConstraintBody,`Invalid constraint body '${r.content}'`,i)}function rule(e,t,n){return{...n,name:e,additionalRules:[],releasedBy:[],ignoreCasing:!1,message:null,location:t}}export{parseConstraint};
|
|
2
|
+
//# sourceMappingURL=ConstraintParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstraintParser.js","names":["header","pattern","uniqueEventPattern","uniquePropertyPattern","releasePattern","messagePattern","stringBodyPattern","rule","headerMatch","line","context","DiagnosticCodes","locationOf","name","firstWord","rules","releases","releasedEvents","targets","message","description","ignoreCasing","child","parseDescription","release","text","unescapeString","parsed","target","location","uniqueEvent","uniqueProperty","properties","property","isFileDirective","shape"],"sources":["../../../../../../Compiler/Parsing/ConstraintParser.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 { ConstraintSyntax } from '../Syntax/Constraints';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { parseDescription } from './DescriptionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^constraint\\\\s+([A-Za-z_]\\\\w*)$');\nconst uniqueEventPattern = pattern('^unique\\\\s+event\\\\s+([A-Z]\\\\w*)$');\nconst uniquePropertyPattern = pattern('^unique\\\\s+([a-z_][\\\\w.]*(?:\\\\s*,\\\\s*[a-z_][\\\\w.]*)*)\\\\s+on\\\\s+([A-Z]\\\\w*)$');\nconst releasePattern = pattern('^released\\\\s+by\\\\s+([A-Z]\\\\w*)$');\nconst messagePattern = pattern(`^message\\\\s+\"(${stringBodyPattern})\"$`);\n\nconst targetOf = (rule: ConstraintSyntax): string | undefined => rule.kind === 'FileConstraintSyntax' ? undefined : rule.event;\n\n// The port of the C# ConstraintParser: the first rule is the constraint, any further rules of the same kind\n// are its additional rules.\nexport function parseConstraint(context: ParserContext, line: SourceLine): ConstraintSyntax {\n const headerMatch = header.exec(line.content);\n if (headerMatch === null) {\n context.error(DiagnosticCodes.InvalidConstraintDeclaration, `Invalid constraint declaration '${line.content}' - expected 'constraint <Name>'`, locationOf(line));\n }\n const name = headerMatch?.[1] ?? firstWord(line.content);\n const rules: ConstraintSyntax[] = [];\n const releases: string[] = [];\n const releasedEvents = new Set<string>();\n const targets = new Set<string>();\n let message: string | null = null;\n let description: string | null = null;\n let ignoreCasing = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Constraint '${name}'`);\n continue;\n }\n const release = releasePattern.exec(child.content);\n const text = messagePattern.exec(child.content);\n if (release !== null) {\n if (releasedEvents.has(release[1])) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already releases with event '${release[1]}'`, locationOf(child));\n } else {\n releases.push(release[1]);\n releasedEvents.add(release[1]);\n }\n } else if (text !== null) {\n if (message !== null) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already has a message`, locationOf(child));\n } else {\n message = unescapeString(text[1]);\n }\n } else if (child.content === 'ignore casing') {\n if (ignoreCasing) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already ignores casing`, locationOf(child));\n }\n ignoreCasing = true;\n } else {\n addRule(context, name, child, rules, targets);\n }\n }\n for (const release of releases.filter(release => targets.has(release))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot target and release event '${release}'`, locationOf(line));\n }\n if (rules.length === 0) {\n context.error(DiagnosticCodes.ConstraintWithoutRule, `Constraint '${name}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`, locationOf(line));\n rules.push(rule(name, locationOf(line), { kind: 'UniqueEventConstraintSyntax', event: '' }));\n }\n if (rules[0].kind === 'FileConstraintSyntax' && (releases.length > 0 || message !== null || ignoreCasing)) {\n context.error(DiagnosticCodes.InvalidConstraintBody, `File constraint '${name}' cannot have declarative options`, locationOf(line));\n }\n return { ...rules[0], additionalRules: rules.slice(1), releasedBy: releases, message, ignoreCasing, description };\n}\n\nfunction addRule(context: ParserContext, name: string, line: SourceLine, rules: ConstraintSyntax[], targets: Set<string>): void {\n const parsed = parseRule(context, name, line);\n if (parsed === undefined) {\n return;\n }\n if (rules.length > 0 && (parsed.kind === 'FileConstraintSyntax' || rules[0].kind === 'FileConstraintSyntax' ||\n (parsed.kind === 'UniqueEventConstraintSyntax') !== (rules[0].kind === 'UniqueEventConstraintSyntax'))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot mix constraint kinds`, locationOf(line));\n return;\n }\n const target = targetOf(parsed);\n if (target !== undefined && targets.has(target)) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already targets event '${target}'`, locationOf(line));\n return;\n }\n if (target !== undefined) targets.add(target);\n rules.push(parsed);\n}\n\nfunction parseRule(context: ParserContext, name: string, line: SourceLine): ConstraintSyntax | undefined {\n const location = locationOf(line);\n const uniqueEvent = uniqueEventPattern.exec(line.content);\n if (uniqueEvent !== null) {\n return rule(name, location, { kind: 'UniqueEventConstraintSyntax', event: uniqueEvent[1] });\n }\n const uniqueProperty = uniquePropertyPattern.exec(line.content);\n if (uniqueProperty !== null) {\n const properties = uniqueProperty[1].split(',').map(property => property.trim());\n if (new Set(properties).size !== properties.length) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' repeats a property in its composite key`, location);\n return undefined;\n }\n return rule(name, location, { kind: 'UniquePropertyConstraintSyntax', property: properties[0], additionalProperties: properties.slice(1), event: uniqueProperty[2] });\n }\n if (isFileDirective(line)) {\n context.warning(DiagnosticCodes.FileConstraintOnlySupportsUniqueness, 'A file constraint can only declare unique constraints in Chronicle - declare them with \\'unique ...\\' so they are portable; a rule that is not uniqueness belongs in command validation or a \\'require\\' condition', location);\n const path = line.content.substring('file'.length).trim();\n return rule(name, location, { kind: 'FileConstraintSyntax', file: { kind: 'FileReferenceSyntax', path, location } });\n }\n context.error(DiagnosticCodes.InvalidConstraintBody, `Invalid constraint body '${line.content}'`, location);\n return undefined;\n}\n\ntype RuleShape =\n | { kind: 'UniqueEventConstraintSyntax'; event: string }\n | { kind: 'UniquePropertyConstraintSyntax'; property: string; additionalProperties: string[]; event: string }\n | { kind: 'FileConstraintSyntax'; file: { kind: 'FileReferenceSyntax'; path: string; location: ReturnType<typeof locationOf> } };\n\nfunction rule(name: string, location: ReturnType<typeof locationOf>, shape: RuleShape): ConstraintSyntax {\n return { ...shape, name, additionalRules: [], releasedBy: [], ignoreCasing: false, message: null, location } as ConstraintSyntax;\n}\n"],"mappings":"+bAaA,MAAMA,EAASC,EAAQ,iCAAiC,EAClDC,EAAqBD,EAAQ,kCAAkC,EAC/DE,EAAwBF,EAAQ,6EAA6E,EAC7GG,EAAiBH,EAAQ,iCAAiC,EAC1DI,EAAiBJ,EAAQ,iBAAiBK,EAAkB,IAAI,EAEhE,SAAY,GAA+CC,EAAK,OAAS,uBAAyB,IAAA,GAAYA,EAAK,MAIzH,SAAgB,gBAAgB,EAAwB,EAAoC,CACxF,IAAMC,EAAcR,EAAO,KAAKS,EAAK,OAAO,EACxCD,IAAgB,MAChBE,EAAQ,MAAMC,EAAgB,6BAA8B,mCAAmCF,EAAK,QAAQ,kCAAmCG,EAAWH,CAAI,CAAC,EAEnK,IAAMI,EAAOL,IAAc,IAAMM,EAAUL,EAAK,OAAO,EACjDM,EAA4B,CAAC,EAC7BC,EAAqB,CAAC,EACtBC,kBAAiB,IAAI,IACrBC,kBAAU,IAAI,IAChBC,EAAyB,KACzBC,EAA6B,KAC7BC,EAAe,GACnB,IAAK,IAAIC,EAAQZ,EAAQ,UAAUD,EAAK,MAAM,EAAGa,IAAU,IA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EAAS,KAAK,CAAC,EAC/E,GAAI,IAAI,IAAID,CAAU,CAAC,CAAC,OAASA,EAAW,OAAQ,CAChDtB,EAAQ,MAAMC,EAAgB,wBAAyB,eAAeE,EAAK,2CAA4CgB,CAAQ,EAC/H,MACJ,CACA,OAAO,KAAKhB,EAAMgB,EAAU,CAAE,KAAM,iCAAkC,SAAUG,EAAW,GAAI,qBAAsBA,EAAW,MAAM,CAAC,EAAG,MAAOD,EAAe,EAAG,CAAC,CACxK,CACA,GAAIG,EAAgBzB,CAAI,EAGpB,OAFAC,EAAQ,QAAQC,EAAgB,qCAAsC,iNAAsNkB,CAAQ,EAE7R,KAAKhB,EAAMgB,EAAU,CAAE,KAAM,uBAAwB,KAAM,CAAE,KAAM,sBAAuB,KADpFpB,EAAK,QAAQ,UAAU,CAAa,CAAC,CAAC,KACiD,EAAG,UAAS,CAAE,CAAC,EAEvHC,EAAQ,MAAMC,EAAgB,sBAAuB,4BAA4BF,EAAK,QAAQ,GAAIoB,CAAQ,CAE9G,CAOA,SAAS,KAAK,EAAc,EAAyC,EAAoC,CACrG,MAAO,CAAE,GAAGM,EAAO,OAAM,gBAAiB,CAAC,EAAG,WAAY,CAAC,EAAG,aAAc,GAAO,QAAS,KAAM,UAAS,CAC/G"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{eventDeclarations as t}from"../Syntax/EventDeclarations.js";import{AuthoringProductionResolver as n}from"../Syntax/AuthoringProductionResolver.js";function validateConstraintProperties(r,i){let a=new n(r).slices.map(e=>e.slice),o=a.flatMap(t);for(let t of a)for(let n of t.constraints.flatMap(e=>[e,...e.additionalRules])){if(n.kind!==`UniquePropertyConstraintSyntax`)continue;let t=o.filter(e=>e.name===n.event);if(t.length!==0)for(let r of[n.property,...n.additionalProperties])r.includes(`.`)||t.some(e=>e.properties.some(e=>e.name===r))||i.error(e.UnknownConstraintProperty,`Constraint '${n.name}' names property '${r}', which event '${n.event}' does not declare.`,n.location)}}export{validateConstraintProperties};
|
|
2
|
+
//# sourceMappingURL=ConstraintPropertyValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstraintPropertyValidator.js","names":["slices","AuthoringProductionResolver","application","entry","events","eventDeclarations","slice","rule","constraint","declarations","event","property","field","context","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/ConstraintPropertyValidator.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 { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Mirrors ScreenplayValidator.ValidateConstraintProperties: direct fields only, across all generations.\n// Unknown/imported events, dotted paths and fields removed in a later generation remain C# binder checks.\nexport function validateConstraintProperties(application: ApplicationSyntax, context: ParserContext): void {\n const slices = new AuthoringProductionResolver(application).slices.map(entry => entry.slice);\n const events = slices.flatMap(eventDeclarations);\n for (const slice of slices) {\n for (const rule of slice.constraints.flatMap(constraint => [constraint, ...constraint.additionalRules])) {\n if (rule.kind !== 'UniquePropertyConstraintSyntax') continue;\n const declarations = events.filter(event => event.name === rule.event);\n if (declarations.length === 0) continue;\n for (const property of [rule.property, ...rule.additionalProperties]) {\n if (property.includes('.') || declarations.some(event => event.properties.some(field => field.name === property))) continue;\n context.error(DiagnosticCodes.UnknownConstraintProperty,\n `Constraint '${rule.name}' names property '${property}', which event '${rule.event}' does not declare.`, rule.location);\n }\n }\n }\n}\n"],"mappings":"mRAWA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,EAAS,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,IAAI,GAASC,EAAM,KAAK,EACrFC,EAASJ,EAAO,QAAQK,CAAiB,EAC/C,IAAK,IAAMC,KAASN,EAChB,IAAK,IAAMO,KAAQD,EAAM,YAAY,QAAQ,GAAc,CAACE,EAAY,GAAGA,EAAW,eAAe,CAAC,EAAG,CACrG,GAAID,EAAK,OAAS,iCAAkC,SACpD,IAAME,EAAeL,EAAO,OAAO,GAASM,EAAM,OAASH,EAAK,KAAK,EACrE,GAAIE,EAAa,SAAW,EAC5B,IAAK,IAAME,IAAY,CAACJ,EAAK,SAAU,GAAGA,EAAK,oBAAoB,EAC3DI,EAAS,SAAS,GAAG,GAAKF,EAAa,KAAK,GAASC,EAAM,WAAW,KAAK,GAASE,EAAM,OAASD,CAAQ,CAAC,GAChHE,EAAQ,MAAMC,EAAgB,0BAC1B,eAAeP,EAAK,KAAK,oBAAoBI,EAAS,kBAAkBJ,EAAK,MAAM,qBAAsBA,EAAK,QAAQ,CAElI,CAER"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseMappingSource as i}from"./ExpressionParser.js";import{firstWord as a}from"./LineText.js";import{locationOf as o}from"./SourceLine.js";import{parseProperty as s,tryParseProperty as c}from"./PropertyLineParser.js";import{parseDescription as l}from"./DescriptionParser.js";import{parseDocumentation as u}from"./DocumentationParser.js";import{isFileDirectiveAmongProperties as d}from"./FileReferences.js";import{isBlankPublicEventOrigin as f}from"../Syntax/PublicEventInvariants.js";import{eventBodyReservedWords as p}from"../Text/ReservedWords.js";import{EventMetadataParser as m}from"./EventMetadataParser.js";const h=t(`^type\\s+([A-Za-z_]\\w*)$`),g=t(`^(?:(?<public>public)\\s+)?event\\s+(?<name>[A-Za-z_]\\w*)(?:\\s+generation\\s+(?<generation>[0-9]+))?(?:\\s+from\\s+"(?<origin>${n})")?$`),_=t(`^readmodel\\s+([A-Za-z_]\\w*)$`),v=t(`^[A-Z]\\w*(?:\\[\\])?(?:\\?|\\s+optional)?$`),y=t(`^[A-Za-z_]\\w*$`),isDescription=e=>a(e.content)===`description`&&c(e)===void 0;function withoutIdentifier(e,t,n,r,i){return t.isIdentifier?(e.error(r,i,o(n)),{...t,isIdentifier:!1}):t}function parseType(t,n){let r=h.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidTypeDeclaration,`Invalid type declaration '${n.content}' - expected 'type <Name>'`,o(n));let i=[],a=null;for(let c=t.peekChild(n.indent);c!==void 0;c=t.peekChild(n.indent)){if(t.reader.takeSignificant(),isDescription(c)){a=l(t,c,a,`Type '${r}'`);continue}if(d(c))continue;let n=s(t,c);n===void 0?t.error(e.InvalidPropertyDeclaration,`Invalid property '${c.content}' - expected '<name> <Type>'`,o(c)):i.push(withoutIdentifier(t,n,c,e.IdentifierOutsideCommand,`Property '${n.name}' of type '${r}' cannot be marked identifier - only a command property can be`))}return i.length===0&&t.error(e.TypeWithoutProperties,`Type '${r}' must declare at least one property`,o(n)),{kind:`TypeSyntax`,name:r,properties:i,description:a,location:o(n)}}function parseEvent(t,n){let i=g.exec(n.content),c=i?.groups?.name??``;i===null&&t.error(e.InvalidEventDeclaration,`Invalid event declaration '${n.content}' - expected '[public] event <Name> [generation <N>] [from "<origin>"]'`,o(n));let l=i?.groups?.origin===void 0?null:r(i.groups.origin),u=i?.groups?.public!==void 0||l!==null?`Public`:`Private`;l!==null&&f(l)&&t.error(e.InvalidEventDeclaration,`An event origin must be a nonblank quoted string`,o(n));let h=i?.groups?.generation!==void 0,_=1;if(h){let r=Number(i.groups.generation);!Number.isSafeInteger(r)||r===0||r>=4294967295?t.error(e.InvalidEventGeneration,`Event '${c}' must declare a generation between 1 and 4294967294`,o(n)):_=r}let v=[],y=[],b=new m(c);for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){if(t.reader.takeSignificant(),d(r))continue;if(p.includes(a(r.content))){let e=parseTag(t,r);e!==void 0&&y.push(e);continue}let n=s(t,r);n===void 0?b.tryParse(t,r)||t.error(e.InvalidPropertyDeclaration,`Invalid property '${r.content}' - expected '<name> <Type>'`,o(r)):v.push(withoutIdentifier(t,n,r,e.IdentifierOnEventProperty,`Property '${n.name}' of event '${c}' cannot be marked identifier - an event never carries its event source id`))}return{kind:`EventSyntax`,name:c,properties:v,tags:y,visibility:u,origin:l,generation:_,hasGenerationMarker:h,...b.value,location:o(n)}}function parseTag(t,n,r=!0){let a=n.content.substring(3).trim();if(r&&v.test(a)&&t.warning(e.TagPropertyReadAsTag,`'${n.content}' declares a static tag with the value '${a}', not a property named 'tag' - write 'tag "${a}"' for the tag, or '@${n.content}' for the property`,o(n)),a.length===0){t.error(e.TagWithoutValue,`Expected a value after 'tag' - an identifier, a string literal or a context expression`,o(n));return}if(y.test(a))return{kind:`TagSyntax`,value:{kind:`LiteralExpressionSyntax`,value:a,location:o(n)},location:o(n)};let s=i(a,o(n),t);if(s.kind===`RawExpressionSyntax`)t.error(e.InvalidTagValue,`Invalid tag value '${a}' - expected an identifier, a string literal or a context expression`,o(n));else return{kind:`TagSyntax`,value:s,location:o(n)}}function parseReadModel(t,n){let r=_.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidReadModelDeclaration,`Invalid read model declaration '${n.content}' - expected 'readmodel <Name>'`,o(n));let i=[],f=null,p=null;for(let m=t.peekChild(n.indent);m!==void 0;m=t.peekChild(n.indent))if(t.reader.takeSignificant(),isDescription(m))f=l(t,m,f,`Read model '${r}'`);else if(a(m.content)===`documentation`&&c(m)===void 0)p=u(t,m,p,`Read model '${r}'`);else if(d(m))continue;else{let n=s(t,m);if(n===void 0){t.error(e.InvalidPropertyDeclaration,`Invalid property '${m.content}' - expected '<name> <Type>'`,o(m));continue}i.push(withoutIdentifier(t,n,m,e.IdentifierOutsideCommand,`Property '${n.name}' of read model '${r}' cannot be marked identifier - only a command property can be`))}return{kind:`ReadModelSyntax`,name:r,properties:i,description:f,documentation:p,location:o(n)}}export{parseEvent,parseReadModel,parseTag,parseType};
|
|
2
|
+
//# sourceMappingURL=DeclarationParsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeclarationParsers.js","names":["typeHeader","pattern","eventHeader","stringBodyPattern","readModelHeader","typeShapedPattern","tagIdentifierPattern","firstWord","line","tryParseProperty","property","context","code","message","locationOf","name","header","DiagnosticCodes","properties","description","parseDescription","isFileDirectiveAmongProperties","parseProperty","match","origin","unescapeString","visibility","isBlankPublicEventOrigin","hasGenerationMarker","generation","declared","tags","metadata","EventMetadataParser","eventBodyReservedWords","tag","value","eventDeclaration","expression","parseMappingSource","documentation","parseDocumentation"],"sources":["../../../../../../Compiler/Parsing/DeclarationParsers.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax, PropertySyntax, ReadModelSyntax, TagSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { eventBodyReservedWords } from '../Text/ReservedWords';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { EventMetadataParser } from './EventMetadataParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirectiveAmongProperties } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typeHeader = pattern('^type\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventHeader = pattern(`^(?:(?<public>public)\\\\s+)?event\\\\s+(?<name>[A-Za-z_]\\\\w*)(?:\\\\s+generation\\\\s+(?<generation>[0-9]+))?(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst readModelHeader = pattern('^readmodel\\\\s+([A-Za-z_]\\\\w*)$');\nconst maximumGeneration = 4294967295;\nconst typeShapedPattern = pattern('^[A-Z]\\\\w*(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?$');\nconst tagIdentifierPattern = pattern('^[A-Za-z_]\\\\w*$');\n\n// 'description' takes no type reference, so a line with property shape is a property named description.\nconst isDescription = (line: SourceLine): boolean => firstWord(line.content) === 'description' && tryParseProperty(line) === undefined;\n\nfunction withoutIdentifier(context: ParserContext, property: PropertySyntax, line: SourceLine, code: string, message: string): PropertySyntax {\n if (!property.isIdentifier) {\n return property;\n }\n context.error(code, message, locationOf(line));\n return { ...property, isIdentifier: false };\n}\n\nexport function parseType(context: ParserContext, header: SourceLine): TypeSyntax {\n const name = typeHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidTypeDeclaration, `Invalid type declaration '${header.content}' - expected 'type <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\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 (isDescription(line)) {\n description = parseDescription(context, line, description, `Type '${name}'`);\n continue;\n }\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of type '${name}' cannot be marked identifier - only a command property can be`));\n }\n if (properties.length === 0) {\n context.error(DiagnosticCodes.TypeWithoutProperties, `Type '${name}' must declare at least one property`, locationOf(header));\n }\n return { kind: 'TypeSyntax', name, properties, description, location: locationOf(header) };\n}\n\nexport function parseEvent(context: ParserContext, header: SourceLine): EventSyntax {\n const match = eventHeader.exec(header.content);\n const name = match?.groups?.name ?? '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, `Invalid event declaration '${header.content}' - expected '[public] event <Name> [generation <N>] [from \"<origin>\"]'`, locationOf(header));\n }\n const origin = match?.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n const visibility = match?.groups?.public !== undefined || origin !== null ? EventVisibility.Public : EventVisibility.Private;\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, 'An event origin must be a nonblank quoted string', locationOf(header));\n }\n const hasGenerationMarker = match?.groups?.generation !== undefined;\n let generation = 1;\n if (hasGenerationMarker) {\n const declared = Number(match!.groups!.generation);\n if (!Number.isSafeInteger(declared) || declared === 0 || declared >= maximumGeneration) {\n context.error(DiagnosticCodes.InvalidEventGeneration, `Event '${name}' must declare a generation between 1 and ${maximumGeneration - 1}`, locationOf(header));\n } else {\n generation = declared;\n }\n }\n const properties: PropertySyntax[] = [];\n const tags: TagSyntax[] = [];\n const metadata = new EventMetadataParser(name);\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n if (eventBodyReservedWords.includes(firstWord(line.content))) {\n const tag = parseTag(context, line);\n if (tag !== undefined) {\n tags.push(tag);\n }\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n if (!metadata.tryParse(context, line)) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n }\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOnEventProperty,\n `Property '${property.name}' of event '${name}' cannot be marked identifier - an event never carries its event source id`));\n }\n return { kind: 'EventSyntax', name, properties, tags, visibility, origin, generation, hasGenerationMarker, ...metadata.value, location: locationOf(header) };\n}\n\n// 'tag <value>' - the port of the C# TagParser, with the warning the C# EventParser gives for a tag whose\n// value looks like a type, which is almost always a property named tag written without its '@'.\nexport function parseTag(context: ParserContext, line: SourceLine, eventDeclaration = true): TagSyntax | undefined {\n const value = line.content.substring('tag'.length).trim();\n if (eventDeclaration && typeShapedPattern.test(value)) {\n context.warning(DiagnosticCodes.TagPropertyReadAsTag,\n `'${line.content}' declares a static tag with the value '${value}', not a property named 'tag' - write 'tag \"${value}\"' for the tag, or '@${line.content}' for the property`,\n locationOf(line));\n }\n if (value.length === 0) {\n context.error(DiagnosticCodes.TagWithoutValue, 'Expected a value after \\'tag\\' - an identifier, a string literal or a context expression', locationOf(line));\n return undefined;\n }\n if (tagIdentifierPattern.test(value)) {\n return { kind: 'TagSyntax', value: { kind: 'LiteralExpressionSyntax', value, location: locationOf(line) }, location: locationOf(line) };\n }\n const expression = parseMappingSource(value, locationOf(line), context);\n if (expression.kind === 'RawExpressionSyntax') {\n context.error(DiagnosticCodes.InvalidTagValue, `Invalid tag value '${value}' - expected an identifier, a string literal or a context expression`, locationOf(line));\n return undefined;\n }\n return { kind: 'TagSyntax', value: expression, location: locationOf(line) };\n}\n\nexport function parseReadModel(context: ParserContext, header: SourceLine): ReadModelSyntax {\n const name = readModelHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReadModelDeclaration, `Invalid read model declaration '${header.content}' - expected 'readmodel <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n let documentation: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Read model '${name}'`);\n } else if (firstWord(line.content) === 'documentation' && tryParseProperty(line) === undefined) {\n documentation = parseDocumentation(context, line, documentation, `Read model '${name}'`);\n } else if (isFileDirectiveAmongProperties(line)) {\n continue;\n } else {\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of read model '${name}' cannot be marked identifier - only a command property can be`));\n }\n }\n return { kind: 'ReadModelSyntax', name, properties, description, documentation, location: locationOf(header) };\n}\n"],"mappings":"o2BAoBA,MAAMA,EAAaC,EAAQ,2BAA2B,EAChDC,EAAcD,EAAQ,mIAAmIE,EAAkB,MAAM,EACjLC,EAAkBH,EAAQ,gCAAgC,EAE1DI,EAAoBJ,EAAQ,6CAA6C,EACzEK,EAAuBL,EAAQ,iBAAiB,EAGhD,cAAiB,GAA8BM,EAAUC,EAAK,OAAO,IAAM,eAAiBC,EAAiBD,CAAI,IAAM,IAAA,GAE7H,SAAS,kBAAkB,EAAwB,EAA0B,EAAkB,EAAc,EAAiC,CAK1I,OAJKE,EAAS,cAGdC,EAAQ,MAAMC,EAAMC,EAASC,EAAWN,CAAI,CAAC,EACtC,CAAE,GAAGE,EAAU,aAAc,EAAM,GAH/BA,CAIf,CAEA,SAAgB,UAAU,EAAwB,EAAgC,CAC9E,IAAMK,EAAOf,EAAW,KAAKgB,EAAO,OAAO,CAAC,GAAG,IAAM,GACjDD,IAAS,IACTJ,EAAQ,MAAMM,EAAgB,uBAAwB,6BAA6BD,EAAO,QAAQ,4BAA6BF,EAAWE,CAAM,CAAC,EAErJ,IAAME,EAA+B,CAAC,EAClCC,EAA6B,KACjC,IAAK,IAAIX,EAAOG,EAAQ,UAAUK,EAAO,MAAM,EAAGR,IAAS,IAAA,GAAW,EAAOG,EAAQ,UAAUK,EAAO,MAAM,EAAG,CAE3G,GADAL,EAAQ,OAAO,gBAAgB,EAC3B,cAAcH,CAAI,EAAG,CACrB,EAAcY,EAAiBT,EAASH,EAAMW,EAAa,SAASJ,EAAK,EAAE,EAC3E,QACJ,CACA,GAAIM,EAA+Bb,CAAI,EACnC,SAEJ,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N,CAAI,CAAC,EAC3I,QACJ,CACAU,EAAW,KAAK,kBAAkBP,EAASD,EAAUF,EAAMS,EAAgB,yBACvE,aAAaP,EAAS,KAAK,mBAAmBK,EAAK,+DAA+D,CAAC,CAC3H,CAEJ,MAAO,CAAE,KAAM,kBAAmB,OAAM,aAAY,cAAa,gBAAe,SAAUD,EAAWE,CAAM,CAAE,CACjH"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{dotNetWhitespace as e,nativePattern as t}from"../Text/patterns.js";import{firstWord as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";import{parseDescription as i}from"./DescriptionParser.js";import{ParserContext as a}from"./ParserContext.js";function captureReads(n){let i=t(`^reads${e}+([A-Z]\\w*)(?:${e}+as${e}+([a-z_]\\w*))?(?:${e}+by${e}+([a-z_]\\w*))?$`).exec(n.content);if(!(i===null||[`as`,`by`,`reads`].includes(i[2])))return{kind:`ReadsSyntax`,readModel:i[1],alias:i[2]??null,by:i[3]??null,location:r(n)}}function fork(e){return new a(e.reader.fork(),e.path,e.languages)}function captureConcurrency(i,a){if(a.content!==`concurrency`)return;let o=fork(i),s=!1,c={},l;for(let r=o.peekChild(a.indent);r!==void 0;r=o.peekChild(a.indent))switch(o.reader.takeSignificant(),n(r.content)){case`eventSource`:r.content===`eventSource`&&(s=!0);break;case`sourceType`:case`streamType`:case`streamId`:{let n=t(`^(sourceType|streamType|streamId)${e}+([A-Za-z_]\\w*)$`).exec(r.content);n!==null&&(c[n[1]]??=n[2]);break}case`events`:{if(l!==void 0)break;let n=r.content.slice(6).split(`,`).map(t=>t.replace(RegExp(`^${e}+|${e}+$`,`gu`),``)).filter(Boolean);n.length>0&&n.every(e=>t(`^[A-Z]\\w*$`).test(e))&&(l=n);break}default:o.skipBlock(r.indent)}return{kind:`ConcurrencySyntax`,eventSource:s,eventSourceType:c.sourceType??null,eventStreamType:c.streamType??null,eventStreamId:c.streamId??null,eventTypes:l??[],location:r(a)}}function captureReducer(a,o){let s=t(`^reducer${e}+([A-Za-z_]\\w*)${e}*=>${e}*([A-Za-z_]\\w*)$`).exec(o.content),c=fork(a),l=[];for(let a=c.peekChild(o.indent);a!==void 0;a=c.peekChild(o.indent)){if(c.reader.takeSignificant(),n(a.content)===`description`){i(c,a,null,`Reducer`);continue}let o=t(`^on${e}+([A-Z]\\w*)$`).exec(a.content);o!==null&&l.push({kind:`ReducerRuleSyntax`,event:o[1],file:null,code:null,description:null,location:r(a)}),c.skipOpaqueBlock(a.indent)}return{kind:`ReducerSyntax`,name:s?.[1]??``,readModel:s?.[2]??``,rules:l,description:null,location:r(o)}}export{captureConcurrency,captureReads,captureReducer};
|
|
2
|
+
//# sourceMappingURL=DependencySourceParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencySourceParser.js","names":["match","nativePattern","dotNetWhitespace","line","locationOf","ParserContext","context","body","eventSource","dimensions","eventTypes","child","firstWord","dimension","names","name","rules","parseDescription","rule"],"sources":["../../../../../../Compiler/Parsing/DependencySourceParser.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 { ConcurrencySyntax, ReadsSyntax, ReducerRuleSyntax, ReducerSyntax } from '../Syntax/DependencySources';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reference-only capture does not change the committed parser's diagnostics or opaque-block skipping.\n// Fork before reading a body: code, malformed operands and unsupported realization stay opaque.\nexport function captureReads(line: SourceLine): ReadsSyntax | undefined {\n const match = nativePattern(`^reads${dotNetWhitespace}+([A-Z]\\\\w*)(?:${dotNetWhitespace}+as${dotNetWhitespace}+([a-z_]\\\\w*))?(?:${dotNetWhitespace}+by${dotNetWhitespace}+([a-z_]\\\\w*))?$`).exec(line.content);\n if (match === null || ['as', 'by', 'reads'].includes(match[2])) return undefined;\n return { kind: 'ReadsSyntax', readModel: match[1], alias: match[2] ?? null, by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction fork(context: ParserContext): ParserContext {\n return new ParserContext(context.reader.fork(), context.path, context.languages);\n}\n\nexport function captureConcurrency(context: ParserContext, line: SourceLine): ConcurrencySyntax | undefined {\n if (line.content !== 'concurrency') return undefined;\n const body = fork(context);\n let eventSource = false;\n const dimensions: Record<string, string> = {};\n let eventTypes: string[] | undefined;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n // C# keeps walking every descendant of the header for recognized dimensions, even malformed\n // or duplicate ones. Only an unknown dimension skips its own descendants during recovery.\n switch (firstWord(child.content)) {\n case 'eventSource':\n if (child.content === 'eventSource') eventSource = true;\n break;\n case 'sourceType':\n case 'streamType':\n case 'streamId': {\n const dimension = nativePattern(`^(sourceType|streamType|streamId)${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`).exec(child.content);\n if (dimension !== null) dimensions[dimension[1]] ??= dimension[2];\n break;\n }\n case 'events': {\n if (eventTypes !== undefined) break;\n const names = child.content.slice('events'.length).split(',').map(name => name.replace(new RegExp(`^${dotNetWhitespace}+|${dotNetWhitespace}+$`, 'gu'), '')).filter(Boolean);\n if (names.length > 0 && names.every(name => nativePattern('^[A-Z]\\\\w*$').test(name))) eventTypes = names;\n break;\n }\n default:\n body.skipBlock(child.indent);\n break;\n }\n }\n return { kind: 'ConcurrencySyntax', eventSource, eventSourceType: dimensions.sourceType ?? null, eventStreamType: dimensions.streamType ?? null, eventStreamId: dimensions.streamId ?? null, eventTypes: eventTypes ?? [], location: locationOf(line) };\n}\n\nexport function captureReducer(context: ParserContext, line: SourceLine): ReducerSyntax {\n const match = nativePattern(`^reducer${dotNetWhitespace}+([A-Za-z_]\\\\w*)${dotNetWhitespace}*=>${dotNetWhitespace}*([A-Za-z_]\\\\w*)$`).exec(line.content);\n const body = fork(context);\n const rules: ReducerRuleSyntax[] = [];\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n // Descriptions consume only their fenced text, never the following descendants. Diagnostics\n // stay on the fork, so reference capture does not change the committed parser's behavior.\n parseDescription(body, child, null, 'Reducer');\n continue;\n }\n const rule = nativePattern(`^on${dotNetWhitespace}+([A-Z]\\\\w*)$`).exec(child.content);\n if (rule !== null) rules.push({ kind: 'ReducerRuleSyntax', event: rule[1], file: null, code: null, description: null, location: locationOf(child) });\n body.skipOpaqueBlock(child.indent);\n }\n return { kind: 'ReducerSyntax', name: match?.[1] ?? '', readModel: match?.[2] ?? '', rules, description: null, location: locationOf(line) };\n}\n"],"mappings":"mUAYA,SAAgB,aAAa,EAA2C,CACpE,IAAMA,EAAQC,EAAc,SAASC,EAAiB,iBAAiBA,EAAiB,KAAKA,EAAiB,oBAAoBA,EAAiB,KAAKA,EAAiB,iBAAiB,CAAC,CAAC,KAAKC,EAAK,OAAO,EAC7M,GAAI,MAAU,MAAQ,CAAC,KAAM,KAAM,OAAO,CAAC,CAAC,SAASH,EAAM,EAAE,GAC7D,MAAO,CAAE,KAAM,cAAe,UAAWA,EAAM,GAAI,MAAOA,EAAM,IAAM,KAAM,GAAIA,EAAM,IAAM,KAAM,SAAUI,EAAWD,CAAI,CAAE,CACjI,CAEA,SAAS,KAAK,EAAuC,CACjD,OAAO,IAAIE,EAAcC,EAAQ,OAAO,KAAK,EAAGA,EAAQ,KAAMA,EAAQ,SAAS,CACnF,CAEA,SAAgB,mBAAmB,EAAwB,EAAiD,CACxG,GAAIH,EAAK,UAAY,cAAe,OACpC,IAAMI,EAAO,KAAKD,CAAO,EACrBE,EAAc,GACZC,EAAqC,CAAC,EACxCC,EACJ,IAAK,IAAIC,EAAQJ,EAAK,UAAUJ,EAAK,MAAM,EAAGQ,IAAU,IAAA,GAAW,EAAQJ,EAAK,UAAUJ,EA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AgB,EACxBK,EAAUD,EAAM,OAAO,IAAM,cAAe,CAG5CM,EAAiBV,EAAMI,EAAO,KAAM,SAAS,EAC7C,QACJ,CACA,IAAMO,EAAOjB,EAAc,MAAMC,EAAiB,cAAc,CAAC,CAAC,KAAKS,EAAM,OAAO,EAChFO,IAAS,MAAMF,EAAM,KAAK,CAAE,KAAM,oBAAqB,MAAOE,EAAK,GAAI,KAAM,KAAM,KAAM,KAAM,YAAa,KAAM,SAAUd,EAAWO,CAAK,CAAE,CAAC,EACnJJ,EAAK,gBAAgBI,EAAM,MAAM,CACrC,CACA,MAAO,CAAE,KAAM,gBAAiB,KAAMX,IAAQ,IAAM,GAAI,UAAWA,IAAQ,IAAM,GAAI,QAAO,YAAa,KAAM,SAAUI,EAAWD,CAAI,CAAE,CAC9I"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";const i=n(`^depends${t}+on${t}+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`);function parseDependsOn(t,n,a,o){let s=i.exec(n.content)?.[1];s===void 0?(t.error(o,`Invalid dependency declaration '${n.content}' - expected 'depends on <Name>'`,r(n)),t.skipBlock(n.indent)):a.some(e=>e.target===s)?t.warning(e.RepeatedDependencyDeclaration,`Dependency '${s}' is already declared on this container - this repeated declaration is ignored`,r(n)):a.push({kind:`DependsOnSyntax`,target:s,location:r(n)})}export{parseDependsOn};
|
|
2
|
+
//# sourceMappingURL=DependsOnParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependsOnParser.js","names":["declaration","nativePattern","dotNetWhitespace","target","line","context","errorCode","locationOf","declarations","dependency","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/DependsOnParser.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 { DependsOnSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst declaration = nativePattern(`^depends${dotNetWhitespace}+on${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$`);\n\nexport function parseDependsOn(context: ParserContext, line: SourceLine, declarations: DependsOnSyntax[], errorCode: string): void {\n const target = declaration.exec(line.content)?.[1];\n if (target === undefined) {\n context.error(errorCode, `Invalid dependency declaration '${line.content}' - expected 'depends on <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n if (declarations.some(dependency => dependency.target === target)) {\n context.warning(DiagnosticCodes.RepeatedDependencyDeclaration, `Dependency '${target}' is already declared on this container - this repeated declaration is ignored`, locationOf(line));\n return;\n }\n declarations.push({ kind: 'DependsOnSyntax', target, location: locationOf(line) });\n}\n"],"mappings":"gPASA,MAAMA,EAAcC,EAAc,WAAWC,EAAiB,KAAKA,EAAiB,uCAAuC,EAE3H,SAAgB,eAAe,EAAwB,EAAkB,EAAiC,EAAyB,CAC/H,IAAMC,EAASH,EAAY,KAAKI,EAAK,OAAO,CAAC,GAAG,GAC5CD,IAAW,IAAA,IACXE,EAAQ,MAAMC,EAAW,mCAAmCF,EAAK,QAAQ,kCAAmCG,EAAWH,CAAI,CAAC,EAC5HC,EAAQ,UAAUD,EAAK,MAAM,GAG7BI,EAAa,KAAK,GAAcC,EAAW,SAAWN,CAAM,EAC5DE,EAAQ,QAAQK,EAAgB,8BAA+B,eAAeP,EAAO,gFAAiFI,EAAWH,CAAI,CAAC,EAG1LI,EAAa,KAAK,CAAE,KAAM,kBAAmB,SAAQ,SAAUD,EAAWH,CAAI,CAAE,CAAC,CACrF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{locationOf as i}from"./SourceLine.js";import{parseFencedText as a}from"./CodeBlockParser.js";const o=t(`^description\\s+"(${n})"$`);function parseDescription(t,n,s,c,l=!1){if(n.content===`description`){let r=a(t,`description`,n,l);return r===null?s:r.trim().length===0?(t.error(e.EmptyDescription,`${c} declares an empty description - the fenced block must contain text`,i(n)),s):keep(t,n,s,c,r)}let u=o.exec(n.content);return u===null?(t.error(e.InvalidDescription,`Invalid description '${n.content}' - expected 'description "<text>"'`,i(n)),s):keep(t,n,s,c,r(u[1]))}function keep(t,n,r,a,o){return r===null?o:(t.error(e.DuplicateDescription,`${a} already declares a description - at most one is allowed`,i(n)),r)}export{parseDescription};
|
|
2
|
+
//# sourceMappingURL=DescriptionParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionParser.js","names":["descriptionPattern","pattern","stringBodyPattern","line","text","parseFencedText","context","allowMarkdown","existing","DiagnosticCodes","owner","locationOf","match","unescapeString","description"],"sources":["../../../../../../Compiler/Parsing/DescriptionParser.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 { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst descriptionPattern = pattern(`^description\\\\s+\"(${stringBodyPattern})\"$`);\n\n// Reads 'description \"<text>\"' or a 'description' followed by a ```text fence. A construct keeps its first\n// description; a second one is reported and ignored.\nexport function parseDescription(context: ParserContext, line: SourceLine, existing: string | null, owner: string, allowMarkdown = false): string | null {\n if (line.content === 'description') {\n const text = parseFencedText(context, 'description', line, allowMarkdown);\n if (text === null) {\n return existing;\n }\n if (text.trim().length === 0) {\n context.error(DiagnosticCodes.EmptyDescription, `${owner} declares an empty description - the fenced block must contain text`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, text);\n }\n const match = descriptionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDescription, `Invalid description '${line.content}' - expected 'description \"<text>\"'`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, unescapeString(match[1]));\n}\n\nfunction keep(context: ParserContext, line: SourceLine, existing: string | null, owner: string, description: string): string | null {\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDescription, `${owner} already declares a description - at most one is allowed`, locationOf(line));\n return existing;\n }\n return description;\n}\n"],"mappings":"4VAUA,MAAMA,EAAqBC,EAAQ,qBAAqBC,EAAkB,IAAI,EAI9E,SAAgB,iBAAiB,EAAwB,EAAkB,EAAyB,EAAe,EAAgB,GAAsB,CACrJ,GAAIC,EAAK,UAAY,cAAe,CAChC,IAAMC,EAAOC,EAAgBC,EAAS,cAAeH,EAAMI,CAAa,EAQxE,OAPIH,IAAS,KACFI,EAEPJ,EAAK,KAAK,CAAC,CAAC,SAAW,GACvBE,EAAQ,MAAMG,EAAgB,iBAAkB,GAAGC,EAAM,qEAAsEC,EAAWR,CAAI,CAAC,EACxIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAON,CAAI,CACpD,CACA,IAAMQ,EAAQZ,EAAmB,KAAKG,EAAK,OAAO,EAKlD,OAJIS,IAAU,MACVN,EAAQ,MAAMG,EAAgB,mBAAoB,wBAAwBN,EAAK,QAAQ,qCAAsCQ,EAAWR,CAAI,CAAC,EACtIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAOG,EAAeD,EAAM,EAAE,CAAC,CACxE,CAEA,SAAS,KAAK,EAAwB,EAAkB,EAAyB,EAAe,EAAoC,CAKhI,OAJIJ,IAAa,KAIVM,GAHHR,EAAQ,MAAMG,EAAgB,qBAAsB,GAAGC,EAAM,0DAA2DC,EAAWR,CAAI,CAAC,EACjIK,EAGf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{locationOf as t}from"./SourceLine.js";import{parseFencedText as n}from"./CodeBlockParser.js";function parseDocumentation(r,i,a,o,s=e.InvalidDocumentation){if(i.content!==`documentation`||r.peekChild(i.indent)?.content!=="```markdown")return r.error(s,`${o} documentation requires a fenced markdown block`,t(i)),r.skipOpaqueBlock(i.indent),a;let c=n(r,`markdown`,i);return c===null||c.trim().length===0||a!==null?(r.error(s,`${o} accepts one nonempty documentation block`,t(i)),a):c}export{parseDocumentation};
|
|
2
|
+
//# sourceMappingURL=DocumentationParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentationParser.js","names":["DiagnosticCodes","line","context","code","owner","locationOf","existing","text","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/DocumentationParser.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 { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport function parseDocumentation(context: ParserContext, line: SourceLine, existing: string | null, owner: string, code: string = DiagnosticCodes.InvalidDocumentation): string | null {\n if (line.content !== 'documentation' || context.peekChild(line.indent)?.content !== '```markdown') {\n context.error(code, `${owner} documentation requires a fenced markdown block`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return existing;\n }\n const text = parseFencedText(context, 'markdown', line);\n if (text === null || text.trim().length === 0 || existing !== null) {\n context.error(code, `${owner} accepts one nonempty documentation block`, locationOf(line));\n return existing;\n }\n return text;\n}\n"],"mappings":"6NAQA,SAAgB,mBAAmB,EAAwB,EAAkB,EAAyB,EAAe,EAAeA,EAAgB,qBAAqC,CACrL,GAAIC,EAAK,UAAY,iBAAmBC,EAAQ,UAAUD,EAAK,MAAM,CAAC,EAAE,UAAY,cAGhF,OAFAC,EAAQ,MAAMC,EAAM,GAAGC,EAAM,iDAAkDC,EAAWJ,CAAI,CAAC,EAC/FC,EAAQ,gBAAgBD,EAAK,MAAM,EAC5BK,EAEX,IAAMC,EAAOC,EAAgBN,EAAS,WAAYD,CAAI,EAKtD,OAJIM,IAAS,MAAQA,EAAK,KAAK,CAAC,CAAC,SAAW,GAAKD,IAAa,MAC1DJ,EAAQ,MAAMC,EAAM,GAAGC,EAAM,2CAA4CC,EAAWJ,CAAI,CAAC,EAClFK,GAEJC,CACX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{firstWord as i}from"./LineText.js";import{locationOf as a}from"./SourceLine.js";import{parseDescription as o}from"./DescriptionParser.js";import{parseDocumentation as s}from"./DocumentationParser.js";const c=t(`^id\\s+"(${n})"$`);var EventMetadataParser=class{name;value={id:null,description:null,documentation:null};constructor(e){this.name=e}tryParse(t,n){let l=a(n);switch(i(n.content)){case`id`:{let i=c.exec(n.content),a=i===null?``:r(i[1]);return a.trim().length===0||this.value.id!==null?t.error(e.InvalidEventId,`Event '${this.name}' accepts one nonempty 'id "<old-name>"'`,l):(this.value.id=a,a===this.name&&t.information(e.RedundantEventId,`Event '${this.name}' already has this name as its identity - remove the redundant id`,l)),!0}case`description`:return this.value.description=o(t,n,this.value.description,`Event '${this.name}'`,!0),!0;case`documentation`:return this.value.documentation=s(t,n,this.value.documentation,`Event '${this.name}'`,e.InvalidEventDocumentation),!0;default:return!1}}};export{EventMetadataParser};
|
|
2
|
+
//# sourceMappingURL=EventMetadataParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventMetadataParser.js","names":["idPattern","pattern","stringBodyPattern","name","location","locationOf","line","firstWord","match","id","unescapeString","context","DiagnosticCodes","parseDescription","parseDocumentation"],"sources":["../../../../../../Compiler/Parsing/EventMetadataParser.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 { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst idPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\n\nexport class EventMetadataParser {\n readonly value: { id: string | null; description: string | null; documentation: string | null } = { id: null, description: null, documentation: null };\n\n constructor(readonly name: string) {}\n\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'id': {\n const match = idPattern.exec(line.content);\n const id = match === null ? '' : unescapeString(match[1]);\n if (id.trim().length === 0 || this.value.id !== null) {\n context.error(DiagnosticCodes.InvalidEventId, `Event '${this.name}' accepts one nonempty 'id \"<old-name>\"'`, location);\n } else {\n this.value.id = id;\n if (id === this.name) {\n context.information(DiagnosticCodes.RedundantEventId, `Event '${this.name}' already has this name as its identity - remove the redundant id`, location);\n }\n }\n return true;\n }\n case 'description':\n this.value.description = parseDescription(context, line, this.value.description, `Event '${this.name}'`, true);\n return true;\n case 'documentation':\n this.value.documentation = parseDocumentation(context, line, this.value.documentation, `Event '${this.name}'`, DiagnosticCodes.InvalidEventDocumentation);\n return true;\n default:\n return false;\n }\n }\n}\n"],"mappings":"ucAYA,MAAMA,EAAYC,EAAQ,YAAYC,EAAkB,IAAI,EAE5D,IAAa,oBAAb,KAAiC,CAGR,KAFrB,MAAkG,CAAE,GAAI,KAAM,YAAa,KAAM,cAAe,IAAK,EAErJ,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAEpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAWC,EAAWC,CAAI,EAChC,OAAQC,EAAUD,EAAK,OAAO,EAA9B,CACI,IAAK,KAAM,CACP,IAAME,EAAQR,EAAU,KAAKM,EAAK,OAAO,EACnCG,EAAKD,IAAU,KAAO,GAAKE,EAAeF,EAAM,EAAE,EASxD,OARIC,EAAG,KAAK,CAAC,CAAC,SAAW,GAAK,KAAK,MAAM,KAAO,KAC5CE,EAAQ,MAAMC,EAAgB,eAAgB,UAAU,KAAK,KAAK,0CAA2CR,CAAQ,GAErH,KAAK,MAAM,GAAKK,EACZA,IAAO,KAAK,MACZE,EAAQ,YAAYC,EAAgB,iBAAkB,UAAU,KAAK,KAAK,mEAAoER,CAAQ,GAGvJ,EACX,CACA,IAAK,cAED,MADA,MAAK,MAAM,YAAcS,EAAiBF,EAASL,EAAM,KAAK,MAAM,YAAa,UAAU,KAAK,KAAK,GAAI,EAAI,EACtG,GACX,IAAK,gBAED,MADA,MAAK,MAAM,cAAgBQ,EAAmBH,EAASL,EAAM,KAAK,MAAM,cAAe,UAAU,KAAK,KAAK,GAAIM,EAAgB,yBAAyB,EACjJ,GACX,QACI,MAAO,EACf,CACJ,CACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseMappingSource as i}from"./ExpressionParser.js";import{firstWord as a}from"./LineText.js";import{locationOf as o}from"./SourceLine.js";import{parseTypeRef as s,reportLegacyOptionalSuffix as c}from"./PropertyLineParser.js";import{parseDescription as l}from"./DescriptionParser.js";import{sourceStreamPattern as u}from"../Text/SourceStreamNames.js";const d=t(`^id\\s+"(${n})"$`),f=u(`^(identifier|streamId)\\s+([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)$`),p=u(`^eventsource\\s+([A-Za-z_]\\w*)$`),m=u(`^stream\\s+([A-Za-z_]\\w*)$`);function parseEventSource(e,t){let n=p.exec(t.content)?.[1]??``;n===``&&invalid(e,t,`Expected 'eventsource <Name>'.`);let r=[],i=null,s=null,c=null;for(let o=e.peekChild(t.indent);o!==void 0;o=e.peekChild(t.indent))switch(e.reader.takeSignificant(),a(o.content)){case`stream`:r.push(parseEventStream(e,o));break;case`identifier`:i=parseType(e,o,`identifier`,i);break;case`description`:s=l(e,o,s,`Event source '${n}'`,!0);break;case`id`:c=parsePin(e,o,n,c);break;default:invalid(e,o,`An event source accepts description, id, identifier and stream declarations.`),e.skipBlock(o.indent)}return{kind:`EventSourceSyntax`,name:n,streams:r,identifier:i,description:s,id:c,location:o(t)}}function parseEventStream(e,t){let n=m.exec(t.content)?.[1]??``;n===``&&invalid(e,t,`Expected 'stream <Name>'.`);let r=null,i=[],s=!1,c={},u=null,d=null;for(let f=e.peekChild(t.indent);f!==void 0;f=e.peekChild(t.indent))switch(e.reader.takeSignificant(),a(f.content)){case`streamId`:s?(invalid(e,f,`Declare either one 'streamId <Type>' or one streamId part block.`),e.skipBlock(f.indent)):f.content===`streamId`?(s=!0,c.streamId=o(f),i=parseStreamIdParts(e,f)):(r=parseType(e,f,`streamId`,r),s=r!==null);break;case`description`:u=l(e,f,u,`Stream '${n}'`,!0);break;case`id`:d=parsePin(e,f,n,d);break;default:invalid(e,f,`A stream accepts description, id and streamId declarations.`),e.skipBlock(f.indent)}return{kind:`EventStreamSyntax`,name:n,streamId:r,streamIdParts:i,description:u,id:d,directiveLocations:c,location:o(t)}}function parseType(t,n,r,i){let a=f.exec(n.content);return a===null||i!==null?invalid(t,n,`Declare at most one '${r} <Type>'.`):(i=s(a[2],{...o(n),column:n.indent+1+n.content.indexOf(a[2],r.length)}),c(t,i,n)),rejectChildren(t,n,e.InvalidEventSourceDeclaration),i}function parsePin(t,n,i,a){let s=d.exec(n.content),c=s===null?null:r(s[1]);return c===null||c.trim()===``||a!==null?invalid(t,n,`Declare at most one nonempty rename-only 'id "<old-name>"'.`):(a=c,c===i&&t.information(e.RedundantSourceStreamId,`The rename pin repeats the current name; omit it for a new declaration.`,o(n))),rejectChildren(t,n,e.InvalidEventSourceDeclaration),a}function parseCommandStream(t,n,r,a){let[s,c]=r.type.name.split(`.`),l={kind:`CommandStreamSyntax`,eventSource:s,stream:c,streamId:null,streamIdParts:[],propertyCandidate:null,referenceLocation:r.type.location,referenceLength:r.type.name.length,location:o(n)};if(a)return t.error(e.AmbiguousCommandStream,`'${n.content}' has both a property type and a stream route interpretation; neither is selected.`,o(n)),{...l,propertyCandidate:r};let u=null,d=[],f=!1,p={};for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r.content===`streamId`){u!==null||f?(t.error(e.InvalidCommandStream,`Declare either one 'streamId = <source>' mapping or one streamId part block.`,o(r)),t.skipBlock(r.indent)):(f=!0,p.streamId=o(r),d=parseRouteParts(t,r,e.InvalidCommandStream));continue}let n=/^streamId\s*=\s*(.+)$/.exec(r.content);if(n===null||u!==null||f)t.error(e.InvalidCommandStream,`Declare either one 'streamId = <source>' mapping or one streamId part block.`,o(r)),t.skipBlock(r.indent);else{let a={...o(r),column:r.indent+1+r.content.indexOf(n[1],r.content.indexOf(`=`)+1)};u={kind:`PropertyMappingSyntax`,property:`streamId`,source:i(n[1],a,t),location:o(r)},rejectChildren(t,r,e.InvalidCommandStream)}}return{...l,streamId:u,streamIdParts:d,directiveLocations:p}}function parseStreamIdParts(t,n){let r=[],i=u(`^([A-Za-z_]\\w*)\\s+([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)$`);for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent)){t.reader.takeSignificant();let n=i.exec(a.content);if(n===null){invalid(t,a,`Expected '<part> <Type>' without modifiers in a streamId part block.`),t.skipBlock(a.indent);continue}let l=s(n[2],{...o(a),column:a.indent+1+a.content.indexOf(n[2],n[1].length)});c(t,l,a),r.push({kind:`EventStreamIdPartSyntax`,name:n[1],type:l,location:o(a)}),rejectChildren(t,a,e.InvalidEventSourceDeclaration)}return r.length===0&&invalid(t,n,`A streamId part block cannot be empty.`),r}function parseRouteParts(e,t,n){let r=[],a=u(`^([A-Za-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`);for(let s=e.peekChild(t.indent);s!==void 0;s=e.peekChild(t.indent)){e.reader.takeSignificant();let t=a.exec(s.content);if(t===null){e.error(n,`Expected '<part> = <source>' in a streamId part block.`,o(s)),e.skipBlock(s.indent);continue}let c={...o(s),column:s.indent+1+s.content.indexOf(t[2],s.content.indexOf(`=`)+1)};r.push({kind:`PropertyMappingSyntax`,property:t[1],source:i(t[2],c,e),location:o(s)}),rejectChildren(e,s,n)}return r.length===0&&e.error(n,`A streamId part block cannot be empty.`,o(t)),r}function rejectChildren(e,t,n){let r=e.peekChild(t.indent);r!==void 0&&(e.error(n,`This directive cannot have children.`,o(r)),e.skipBlock(t.indent))}function invalid(t,n,r){t.error(e.InvalidEventSourceDeclaration,r,o(n))}export{parseCommandStream,parseEventSource,parseRouteParts};
|
|
2
|
+
//# sourceMappingURL=EventSourceParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSourceParser.js","names":["pinPattern","pattern","stringBodyPattern","typeDirective","sourceStreamPattern","sourceHeader","streamHeader","name","header","context","streams","identifier","description","id","child","firstWord","parseDescription","locationOf","streamId","streamIdParts","declared","directiveLocations","match","line","previous","keyword","parseTypeRef","reportLegacyOptionalSuffix","DiagnosticCodes","value","unescapeString","eventSource","stream","candidate","route","ambiguous","block","location","parseMappingSource","parts","declaration","type","mapping","code","message"],"sources":["../../../../../../Compiler/Parsing/EventSourceParser.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 { TypeRefSyntax, PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax, EventStreamIdPartSyntax } from '../Syntax/EventSources';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst pinPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\nconst typeDirective = sourceStreamPattern('^(identifier|streamId)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)$');\nconst sourceHeader = sourceStreamPattern('^eventsource\\\\s+([A-Za-z_]\\\\w*)$');\nconst streamHeader = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)$');\n\nexport function parseEventSource(context: ParserContext, header: SourceLine): EventSourceSyntax {\n const name = sourceHeader.exec(header.content)?.[1] ?? '';\n if (name === '') invalid(context, header, \"Expected 'eventsource <Name>'.\");\n const streams: EventStreamSyntax[] = [];\n let identifier: TypeRefSyntax | null = null;\n let description: string | null = null;\n let id: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'stream': streams.push(parseEventStream(context, child)); break;\n case 'identifier': identifier = parseType(context, child, 'identifier', identifier); break;\n case 'description': description = parseDescription(context, child, description, `Event source '${name}'`, true); break;\n case 'id': id = parsePin(context, child, name, id); break;\n default: invalid(context, child, 'An event source accepts description, id, identifier and stream declarations.'); context.skipBlock(child.indent); break;\n }\n }\n return { kind: 'EventSourceSyntax', name, streams, identifier, description, id, location: locationOf(header) };\n}\n\nfunction parseEventStream(context: ParserContext, header: SourceLine): EventStreamSyntax {\n const name = streamHeader.exec(header.content)?.[1] ?? '';\n if (name === '') invalid(context, header, \"Expected 'stream <Name>'.\");\n let streamId: TypeRefSyntax | null = null;\n let streamIdParts: EventStreamIdPartSyntax[] = [];\n let declared = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n let description: string | null = null;\n let id: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'streamId':\n if (declared) {\n invalid(context, child, \"Declare either one 'streamId <Type>' or one streamId part block.\");\n context.skipBlock(child.indent);\n } else if (child.content === 'streamId') {\n declared = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseStreamIdParts(context, child);\n } else {\n streamId = parseType(context, child, 'streamId', streamId);\n declared = streamId !== null;\n }\n break;\n case 'description': description = parseDescription(context, child, description, `Stream '${name}'`, true); break;\n case 'id': id = parsePin(context, child, name, id); break;\n default: invalid(context, child, 'A stream accepts description, id and streamId declarations.'); context.skipBlock(child.indent); break;\n }\n }\n return { kind: 'EventStreamSyntax', name, streamId, streamIdParts, description, id, directiveLocations, location: locationOf(header) };\n}\n\nfunction parseType(context: ParserContext, line: SourceLine, keyword: string, previous: TypeRefSyntax | null): TypeRefSyntax | null {\n const match = typeDirective.exec(line.content);\n if (match === null || previous !== null) invalid(context, line, `Declare at most one '${keyword} <Type>'.`);\n else {\n previous = parseTypeRef(match[2], { ...locationOf(line), column: line.indent + 1 + line.content.indexOf(match[2], keyword.length) });\n reportLegacyOptionalSuffix(context, previous, line);\n }\n rejectChildren(context, line, DiagnosticCodes.InvalidEventSourceDeclaration);\n return previous;\n}\n\nfunction parsePin(context: ParserContext, line: SourceLine, name: string, previous: string | null): string | null {\n const match = pinPattern.exec(line.content);\n const value = match === null ? null : unescapeString(match[1]);\n if (value === null || value.trim() === '' || previous !== null) invalid(context, line, 'Declare at most one nonempty rename-only \\'id \"<old-name>\"\\'.');\n else {\n previous = value;\n if (value === name) context.information(DiagnosticCodes.RedundantSourceStreamId, 'The rename pin repeats the current name; omit it for a new declaration.', locationOf(line));\n }\n rejectChildren(context, line, DiagnosticCodes.InvalidEventSourceDeclaration);\n return previous;\n}\n\nexport function parseCommandStream(context: ParserContext, header: SourceLine, candidate: PropertySyntax, ambiguous: boolean): CommandStreamSyntax {\n const [eventSource, stream] = candidate.type.name.split('.');\n const route: CommandStreamSyntax = { kind: 'CommandStreamSyntax', eventSource, stream, streamId: null, streamIdParts: [], propertyCandidate: null, referenceLocation: candidate.type.location, referenceLength: candidate.type.name.length, location: locationOf(header) };\n if (ambiguous) {\n context.error(DiagnosticCodes.AmbiguousCommandStream, `'${header.content}' has both a property type and a stream route interpretation; neither is selected.`, locationOf(header));\n // Ordinary properties are leaves; preserve deeper legacy command members in this case.\n return { ...route, propertyCandidate: candidate };\n }\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidCommandStream, \"Declare either one 'streamId = <source>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidCommandStream);\n }\n continue;\n }\n const match = /^streamId\\s*=\\s*(.+)$/.exec(child.content);\n if (match === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidCommandStream, \"Declare either one 'streamId = <source>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(match[1], location, context), location: locationOf(child) };\n rejectChildren(context, child, DiagnosticCodes.InvalidCommandStream);\n }\n }\n return { ...route, streamId, streamIdParts, directiveLocations };\n}\n\nfunction parseStreamIdParts(context: ParserContext, header: SourceLine): EventStreamIdPartSyntax[] {\n const parts: EventStreamIdPartSyntax[] = [];\n const declaration = sourceStreamPattern('^([A-Za-z_]\\\\w*)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)$');\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = declaration.exec(child.content);\n if (match === null) {\n invalid(context, child, \"Expected '<part> <Type>' without modifiers in a streamId part block.\");\n context.skipBlock(child.indent);\n continue;\n }\n const type = parseTypeRef(match[2], { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[2], match[1].length) });\n reportLegacyOptionalSuffix(context, type, child);\n parts.push({ kind: 'EventStreamIdPartSyntax', name: match[1], type, location: locationOf(child) });\n rejectChildren(context, child, DiagnosticCodes.InvalidEventSourceDeclaration);\n }\n if (parts.length === 0) invalid(context, header, 'A streamId part block cannot be empty.');\n return parts;\n}\n\nexport function parseRouteParts(context: ParserContext, header: SourceLine, code: string): PropertyMappingSyntax[] {\n const parts: PropertyMappingSyntax[] = [];\n const mapping = sourceStreamPattern('^([A-Za-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = mapping.exec(child.content);\n if (match === null) {\n context.error(code, \"Expected '<part> = <source>' in a streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[2], child.content.indexOf('=') + 1) };\n parts.push({ kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], location, context), location: locationOf(child) });\n rejectChildren(context, child, code);\n }\n if (parts.length === 0) context.error(code, 'A streamId part block cannot be empty.', locationOf(header));\n return parts;\n}\n\nfunction rejectChildren(context: ParserContext, line: SourceLine, code: string): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(code, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction invalid(context: ParserContext, line: SourceLine, message: string): void { context.error(DiagnosticCodes.InvalidEventSourceDeclaration, message, locationOf(line)); }\n"],"mappings":"8lBAiBA,MAAMA,EAAaC,EAAQ,YAAYC,EAAkB,IAAI,EACvDC,EAAgBC,EAAoB,sEAAsE,EAC1GC,EAAeD,EAAoB,kCAAkC,EACrEE,EAAeF,EAAoB,6BAA6B,EAEtE,SAAgB,iBAAiB,EAAwB,EAAuC,CAC5F,IAAMG,EAAOF,EAAa,KAAKG,EAAO,OAAO,CAAC,GAAG,IAAM,GACnDD,IAAS,IAAI,QAAQE,EAASD,EAAQ,gCAAgC,EAC1E,IAAME,EAA+B,CAAC,EAClCC,EAAmC,KACnCC,EAA6B,KAC7BC,EAAoB,KACxB,IAAK,IAAIC,EAAQL,EAAQ,UAAUD,EAAO,MAAM,EAAGM,IAAU,IAAA,GAAW,EAAQL,EAAQ,UAAUD,EAAO,MAAM,EAE3G,OADAC,EAAQ,OAAO,gBAAgB,EACvBM,EAAUD,EAAM,OAAO,EAA/B,CACI,IAAK,SAAUJ,EAAQ,KAAK,iBAAiBD,EAASK,CAAK,CAAC,EAAG,MAC/D,IAAK,aAAc,EAAa,UAAUL,EAASK,EAAO,aAAcH,CAAU,EAAG,MACrF,IAAK,cAAe,EAAcK,EAAiBP,EAASK,EAAOF,EAAa,iBAAiBL,EAAK,GAAI,EAAI,EAAG,MACjH,IAAK,KAAM,E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