@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":"DiagnosticCodes.js","names":["DiagnosticCodes"],"sources":["../../../../../../Compiler/Diagnostics/DiagnosticCodes.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\n// Shared diagnostic names, including the explicitly C#-only checks below. Catalogue membership does\n// not imply TypeScript validation support; see Documentation/screenplay/editor-diagnostics.md.\nexport const DiagnosticCodes = {\n InvalidIdentityDeclaration: 'PLAY0633',\n DuplicateIdentity: 'PLAY0634',\n InvalidIdentityDetail: 'PLAY0635',\n UnknownIdentitySource: 'PLAY0636',\n IdentityDetailWithoutSource: 'PLAY0637',\n IdentitySourceWithBody: 'PLAY0638',\n DuplicateIdentityDetail: 'PLAY0639',\n BuiltInIdentityDetail: 'PLAY0640',\n UnknownIdentityQuery: 'PLAY0641',\n InvalidIdentityQuery: 'PLAY0642',\n IdentityQueryWithoutKey: 'PLAY0643',\n InvalidIdentityQueryKey: 'PLAY0644',\n IdentityQueryAuthorizationDependency: 'PLAY0645',\n IdentityQueryTypeMismatch: 'PLAY0646',\n InvalidReactionIdentity: 'PLAY0647',\n GatedInvocationWithoutIdentity: 'PLAY0648',\n UnusedReactionIdentity: 'PLAY0649',\n UnusedReactionRole: 'PLAY0650',\n UnsatisfiedReactionIdentity: 'PLAY0651',\n ReactionPrivilegeEscalation: 'PLAY0652',\n // C#-only whole-model public event boundaries; membership is not TypeScript validation support.\n CommandProducesPublicEvent: 'PLAY0607',\n PublicEventRequiresOutboundTranslation: 'PLAY0608',\n OutboundPublicEventCount: 'PLAY0609',\n ForeignPublicEventConsumer: 'PLAY0610',\n OutboundTranslationInput: 'PLAY0611',\n InboundTranslationOutput: 'PLAY0612',\n ForeignPublicEventProduced: 'PLAY0613',\n PublicTranslationRequiresDirection: 'PLAY0614',\n TranslationConstructDirection: 'PLAY0615',\n InboundTranslationInput: 'PLAY0616',\n OutboundTranslationOutput: 'PLAY0617',\n EventTargetOutsideOutboundTranslation: 'PLAY0618',\n EventsSourceOutsideInboundTranslation: 'PLAY0619',\n InvalidCaptureEventsSource: 'PLAY0620',\n // Syntax shared with C#; the reference checks (owners, instances, cycles, outlets, scopes, packages) are C#-only.\n InvalidExposureDeclaration: 'PLAY0621',\n UnknownExposureOwner: 'PLAY0622',\n ReExposureCycle: 'PLAY0623',\n ReExposureBroken: 'PLAY0624',\n InvalidInstanceContribution: 'PLAY0625',\n UnknownContributionInstance: 'PLAY0626',\n ContributionNotExposed: 'PLAY0627',\n ContributionTypeMismatch: 'PLAY0628',\n UnknownTemplateContentSlot: 'PLAY0629',\n UnknownNavigationOutlet: 'PLAY0630',\n TemplateScopeMismatch: 'PLAY0631',\n IncompatibleComponentPackage: 'PLAY0632',\n LegacyComplianceMarker: 'PLAY0565',\n UnknownComplianceMarker: 'PLAY0566',\n InvalidSecretScope: 'PLAY0567',\n DuplicateSecretScope: 'PLAY0568',\n SecretScopeIgnoredForPii: 'PLAY0569',\n InvalidPersonalDataQualifier: 'PLAY0570',\n DuplicateSpecialCategory: 'PLAY0571',\n InvalidPurposeDeclaration: 'PLAY0596',\n InvalidPurposeVocabulary: 'PLAY0597',\n DuplicatePurposeField: 'PLAY0598',\n DuplicatePurposeDeclaration: 'PLAY0599',\n UnknownPurpose: 'PLAY0600',\n PurposeInterestMismatch: 'PLAY0601',\n PersonalDataWithoutPurpose: 'PLAY0602',\n SpecialDataWithoutCondition: 'PLAY0603',\n CriminalDataWithoutAuthorization: 'PLAY0604',\n PurposeWithoutBasis: 'PLAY0605',\n UnusedPurpose: 'PLAY0606',\n // C#-only: opt-in completeness, scoped action/refusal reference validation, and semantic binding.\n ConflictingScreenDataBinding: 'PLAY0530',\n ScreenDataQueryMismatch: 'PLAY0531',\n ActionWithoutInputSurface: 'PLAY0532',\n CommandWithoutInputSurface: 'PLAY0533',\n ReadModelFieldWithoutOrigin: 'PLAY0534',\n QueryParameterNotHeldByView: 'PLAY0535',\n UnconsumedEvent: 'PLAY0536',\n UnreachableScreen: 'PLAY0537',\n UnknownActionSubjectField: 'PLAY0345',\n UnresolvedActionSubject: 'PLAY0346',\n UnreachableActionAlternative: 'PLAY0347',\n UnknownActionArgumentProperty: 'PLAY0348',\n UnreachableRefusalBranch: 'PLAY0540',\n InvalidRefusalValue: 'PLAY0541',\n UnknownRefusalConstraint: 'PLAY0542',\n UnknownRedeliveryReaction: 'PLAY0544',\n IndeterminateNegatedClaimTarget: 'PLAY0546',\n InvalidRefusalBranch: 'PLAY0538',\n InvalidRefusalBranchBody: 'PLAY0539',\n UnmatchedRedeliveredOccurrence: 'PLAY0543',\n InvalidNoEventsExpectation: 'PLAY0545',\n InvalidProducesDeclaration: 'PLAY0042',\n ProducesWhenWithoutEvent: 'PLAY0043',\n InvalidPropertyMapping: 'PLAY0044',\n DuplicateProducesTarget: 'PLAY0193',\n EventSourceIdInPayload: 'PLAY0469',\n ExplicitProducesTargetsRequired: 'PLAY0470',\n RedundantEventId: 'PLAY0471',\n InvalidEventId: 'PLAY0472',\n InlineEventCollision: 'PLAY0473',\n InlineEventOutsideCommand: 'PLAY0474',\n InlineEventGeneration: 'PLAY0475',\n ReservedProductionMetadata: 'PLAY0476',\n InvalidEventDocumentation: 'PLAY0477',\n OmittedProductionDestination: 'PLAY0478',\n UnknownConstraintProperty: 'PLAY0391',\n UnknownTopLevelConstruct: 'PLAY0001',\n InvalidDomainDeclaration: 'PLAY0002',\n DuplicateDomain: 'PLAY0003',\n DomainNotFirst: 'PLAY0004',\n InvalidImportDeclaration: 'PLAY0005',\n TabIndentation: 'PLAY0006',\n InvalidConceptDeclaration: 'PLAY0007',\n UnknownPrimitiveType: 'PLAY0008',\n InvalidEnumerationValue: 'PLAY0009',\n UnknownConceptDirective: 'PLAY0010',\n ValidateReadAsEnumerationBlock: 'PLAY0011',\n AttributeReasonWithoutAttribute: 'PLAY0012',\n DuplicateAttributeReason: 'PLAY0013',\n InvalidTypeDeclaration: 'PLAY0014',\n TypeWithoutProperties: 'PLAY0015',\n InvalidPropertyDeclaration: 'PLAY0016',\n IdentifierOutsideCommand: 'PLAY0017',\n InvalidEventDeclaration: 'PLAY0018',\n IdentifierOnEventProperty: 'PLAY0019',\n TagPropertyReadAsTag: 'PLAY0020',\n InvalidModuleDeclaration: 'PLAY0021',\n UnknownModuleDirective: 'PLAY0022',\n InvalidFeatureDeclaration: 'PLAY0023',\n UnknownFeatureDirective: 'PLAY0024',\n InvalidSliceDeclaration: 'PLAY0027',\n UnknownSliceType: 'PLAY0028',\n UnknownSliceDirective: 'PLAY0029',\n InvalidPersonaDeclaration: 'PLAY0030',\n InvalidPersonaPolicyReference: 'PLAY0031',\n UnknownPersonaDirective: 'PLAY0032',\n InvalidCommandDeclaration: 'PLAY0033',\n UnknownCommandDirective: 'PLAY0034',\n DuplicateCommandIdentifier: 'PLAY0036',\n InvalidQueryDeclaration: 'PLAY0047',\n UnknownQueryDirective: 'PLAY0048',\n InvalidQueryParameter: 'PLAY0049',\n InvalidProjectionDeclaration: 'PLAY0056',\n EmptyProjection: 'PLAY0057',\n UnknownProjectionDirective: 'PLAY0058',\n FromWithoutEvent: 'PLAY0061',\n InvalidEventReference: 'PLAY0062',\n InvalidJoinDeclaration: 'PLAY0063',\n JoinWithoutEvent: 'PLAY0064',\n InvalidChildrenDeclaration: 'PLAY0065',\n InvalidNestedDeclaration: 'PLAY0066',\n NestedBlockWithoutFrom: 'PLAY0067',\n InvalidRemoveDeclaration: 'PLAY0068',\n UnknownRemoveDirective: 'PLAY0069',\n InvalidClearDeclaration: 'PLAY0070',\n ClearWithOutsideNestedBlock: 'PLAY0071',\n InvalidSpecificationDeclaration: 'PLAY0094',\n UnknownSpecificationDirective: 'PLAY0095',\n InvalidSpecificationWhen: 'PLAY0096',\n DuplicateSpecificationWhen: 'PLAY0097',\n InvalidThenError: 'PLAY0098',\n InvalidReadModelStep: 'PLAY0099',\n InvalidEventStep: 'PLAY0100',\n InvalidSpecificationValue: 'PLAY0101',\n InvalidScreenDeclaration: 'PLAY0102',\n UnknownScreenDirective: 'PLAY0103',\n InvalidDataDirective: 'PLAY0104',\n InvalidActionDirective: 'PLAY0105',\n UnknownActionDirective: 'PLAY0106',\n InvalidNavigation: 'PLAY0107',\n InvalidScreenLayoutSlot: 'PLAY0108',\n InvalidTitleDirective: 'PLAY0109',\n UnknownTableDirective: 'PLAY0110',\n UnknownSummaryDirective: 'PLAY0111',\n AuthorizeWithoutPolicy: 'PLAY0122',\n InvalidPolicyReference: 'PLAY0123',\n InvalidConstraintDeclaration: 'PLAY0132',\n ConstraintWithoutRule: 'PLAY0133',\n InvalidConstraintBody: 'PLAY0134',\n DuplicateConstraintBody: 'PLAY0135',\n InvalidReactionDeclaration: 'PLAY0136',\n InvalidReactionTrigger: 'PLAY0137',\n ReactionWithoutTrigger: 'PLAY0138',\n InvalidValidateDeclaration: 'PLAY0140',\n InvalidValidationRule: 'PLAY0141',\n InvalidRuleName: 'PLAY0143',\n UnknownRuleImplementationDirective: 'PLAY0144',\n InvalidDescription: 'PLAY0145',\n EmptyDescription: 'PLAY0146',\n DuplicateDescription: 'PLAY0147',\n TagWithoutValue: 'PLAY0148',\n InvalidTagValue: 'PLAY0149',\n UnknownContextPath: 'PLAY0153',\n UnknownContextCausedByProperty: 'PLAY0154',\n UnknownContextIdentityProperty: 'PLAY0155',\n ExpectedCodeFence: 'PLAY0163',\n UnclosedCodeBlock: 'PLAY0164',\n DuplicateDeclaration: 'PLAY0168',\n RepeatedSingularDeclarationAcrossFiles: 'PLAY0172',\n RepeatedDeclarationAcrossFiles: 'PLAY0173',\n ConflictingDescriptionAcrossFiles: 'PLAY0174',\n UnexpectedTokenInAuthorize: 'PLAY0184',\n UnclosedAuthorizeGroup: 'PLAY0185',\n InvalidReadModelDeclaration: 'PLAY0186',\n InvalidInvokesDeclaration: 'PLAY0194',\n InvalidScopeDeclaration: 'PLAY0199',\n DuplicateScope: 'PLAY0200',\n InvalidIntervalTrigger: 'PLAY0249',\n InvalidScheduleTrigger: 'PLAY0250',\n DuplicateReactionTrigger: 'PLAY0253',\n InvalidSpecificationEventSource: 'PLAY0275',\n DuplicateSpecificationEventSource: 'PLAY0276',\n InvalidProjectionVariantDeclaration: 'PLAY0277',\n InvalidEntersOnDeclaration: 'PLAY0279',\n NestedProjectionVariantNotAllowed: 'PLAY0280',\n InvalidStructuredValue: 'PLAY0291',\n DuplicateStructuredValueMember: 'PLAY0294',\n ConflictingSpecificationActions: 'PLAY0358',\n InvalidSpecificationEventOrder: 'PLAY0359',\n InvalidValidationSeverity: 'PLAY0368',\n VariantRequiresEnteringEvent: 'PLAY0382',\n DuplicateProjectionVariant: 'PLAY0384',\n DuplicateVariantEnteringEvent: 'PLAY0385',\n InvalidSpecificationDenied: 'PLAY0388',\n DuplicateAuthorizationAcrossFiles: 'PLAY0394',\n FileConstraintOnlySupportsUniqueness: 'PLAY0396',\n LegacyInlineCodeFence: 'PLAY0397',\n InvalidEventGeneration: 'PLAY0446',\n InvalidFileImport: 'PLAY0454',\n FileImportMatchesNothing: 'PLAY0455',\n ImportedFileNotFound: 'PLAY0456',\n ConflictingImportPlacement: 'PLAY0457',\n ImportCycle: 'PLAY0458',\n ModuleInPlacedFile: 'PLAY0459',\n UnexpectedInPlacedFile: 'PLAY0460',\n InvalidSpecificationClock: 'PLAY0461',\n InvalidSpecificationTrigger: 'PLAY0462',\n InvalidSpecificationCapture: 'PLAY0463',\n InvalidSpecificationQueryAction: 'PLAY0464',\n InvalidSpecificationQuery: 'PLAY0265',\n UnknownSpecificationQueryDirective: 'PLAY0266',\n DuplicateSpecificationQueryArguments: 'PLAY0267',\n InvalidAbsentReadModelStep: 'PLAY0453',\n LegacyOptionalSuffix: 'PLAY0479',\n InvalidOptionalModifierOrder: 'PLAY0480',\n OptionalReadsNotSupported: 'PLAY0481',\n InvalidSpecificationCaller: 'PLAY0386',\n DuplicateSpecificationCallerOrDenied: 'PLAY0387',\n GeneratedPropertyOutsideCommand: 'PLAY0482',\n InvalidGeneratedType: 'PLAY0483',\n InvalidGeneratedModifierOrder: 'PLAY0484',\n DuplicateEventSubject: 'PLAY0590',\n InvalidSubjectType: 'PLAY0591',\n ProtectedSubjectType: 'PLAY0592',\n InvalidSubjectOwner: 'PLAY0593',\n ReadModelSubjectNotSupported: 'PLAY0594',\n InvalidSubjectModifierOrder: 'PLAY0595',\n GeneratedPropertySuppliedAsInput: 'PLAY0485',\n InvalidCommandResponse: 'PLAY0486',\n InvalidResponseSource: 'PLAY0487',\n DuplicateResponseField: 'PLAY0488',\n InvalidResponseShape: 'PLAY0489',\n InvalidGeneratedFixture: 'PLAY0490',\n InvalidReturnExpectation: 'PLAY0491',\n InvalidImplementationBlock: 'PLAY0492',\n InvalidImplementationHint: 'PLAY0493',\n ConflictingImplementationSources: 'PLAY0494',\n UnknownType: 'PLAY0165',\n InvalidSystemDeclaration: 'PLAY0495',\n InvalidOperationDeclaration: 'PLAY0496',\n InvalidProductionReference: 'PLAY0497',\n ProductionDeclarationCollision: 'PLAY0498',\n OperationOutsideCommand: 'PLAY0499',\n InvalidSystemReference: 'PLAY0500',\n InvalidOperationMapping: 'PLAY0501',\n InvalidOperationSpecification: 'PLAY0502',\n InvalidCaptureDeclaration: 'PLAY0078',\n UnknownCaptureDirective: 'PLAY0079',\n InvalidMapEntry: 'PLAY0080',\n InvalidTranslation: 'PLAY0081',\n InvalidSplitDeclaration: 'PLAY0082',\n InvalidSplitTarget: 'PLAY0083',\n InvalidAppendDeclaration: 'PLAY0084',\n UnknownAppendDirective: 'PLAY0085',\n WhenWithoutTrigger: 'PLAY0086',\n InvalidWhenClause: 'PLAY0087',\n InvalidWhenTransitionClause: 'PLAY0088',\n MixedWhenCombinators: 'PLAY0089',\n WhenCombinatorWithoutProperty: 'PLAY0090',\n UnknownCaptureBlockDirective: 'PLAY0091',\n InvalidCompositeKeyPart: 'PLAY0072',\n TemplateInCompositeKey: 'PLAY0073',\n EmptyCompositeKey: 'PLAY0074',\n InvalidProjectionMapping: 'PLAY0075',\n ExpectedLiteralValue: 'PLAY0150',\n InvalidExpression: 'PLAY0152',\n UnterminatedInterpolation: 'PLAY0157',\n UnterminatedTemplateExpression: 'PLAY0156',\n ProjectionDocumentWithoutProjection: 'PLAY0055',\n CaptureDocumentWithoutCapture: 'PLAY0077',\n SpecificationDocumentWithoutSpecification: 'PLAY0093',\n InvalidSeedDeclaration: 'PLAY0128',\n InvalidSeedGroup: 'PLAY0129',\n InvalidSeedEvent: 'PLAY0130',\n InvalidSeedPropertyAssignment: 'PLAY0131',\n InvalidPolicyDeclaration: 'PLAY0112',\n UnknownPolicyDirective: 'PLAY0113',\n PolicyWithoutRequirement: 'PLAY0114',\n ExpectedRoleName: 'PLAY0118',\n ExpectedClaimName: 'PLAY0119',\n ExpectedClaimMatches: 'PLAY0120',\n ExpectedClaimMatchTarget: 'PLAY0121',\n MixedPolicyImplementation: 'PLAY0440',\n RepeatedPolicyRequirement: 'PLAY0441',\n UnexpectedTokenInPolicyCondition: 'PLAY0115',\n ExpectedPolicyCondition: 'PLAY0116',\n UnclosedPolicyConditionGroup: 'PLAY0117',\n UnexpectedTokenInCondition: 'PLAY0158',\n ExpectedCondition: 'PLAY0159',\n ExpectedComparisonOperator: 'PLAY0161',\n ExpectedComparisonValue: 'PLAY0162',\n InvalidActionAlternative: 'PLAY0341',\n GuardedActionWithoutAlternatives: 'PLAY0342',\n MisplacedActionOtherwise: 'PLAY0343',\n UnsupportedActionConditionOperand: 'PLAY0344',\n InvalidInteractionArgument: 'PLAY0319',\n UnclosedConditionGroup: 'PLAY0160',\n InvalidNumericDirective: 'PLAY0508',\n DuplicateNumericDirective: 'PLAY0509',\n LateNumericDirective: 'PLAY0510',\n InexactNumericLiteral: 'PLAY0511',\n MixedNumericModes: 'PLAY0512',\n IncompatibleNumericSource: 'PLAY0513',\n EventFromLaterSlice: 'PLAY0516',\n TimelineCycleGroup: 'PLAY0517',\n InvalidSpecificationExample: 'PLAY0518',\n DuplicateSpecificationAssignment: 'PLAY0519',\n UnresolvedSpecificationExampleType: 'PLAY0520',\n SpecificationExampleNameCollision: 'PLAY0521',\n SpecificationExampleKindMismatch: 'PLAY0522',\n InvalidSpecificationExampleValue: 'PLAY0523',\n MissingSpecificationProperty: 'PLAY0524',\n UnadmittedSpecificationExampleValue: 'PLAY0525',\n InvalidSpecificationExampleBody: 'PLAY0526',\n AmbiguousReference: 'PLAY0198',\n InvalidSpecificationStream: 'PLAY0547',\n SpecificationStreamOnCommand: 'PLAY0548',\n InvalidSpecificationStreamRoute: 'PLAY0549',\n InvalidSpecificationStreamEventSource: 'PLAY0550',\n SpecificationStreamContradictsCommand: 'PLAY0551',\n InvalidDependencyTarget: 'PLAY0554',\n RepeatedDependencyDeclaration: 'PLAY0555',\n UndeclaredDependency: 'PLAY0552',\n UnusedDependencyDeclaration: 'PLAY0553',\n MutualDependencyDeclarations: 'PLAY0556',\n AuthorizationRefusalWithoutIdentity: 'PLAY0557',\n InvalidDocumentation: 'PLAY0558',\n ConflictingDocumentationAcrossFiles: 'PLAY0559',\n InvalidSpecificationCallerPersona: 'PLAY0572',\n UnsynthesizablePersonaCaller: 'PLAY0573',\n PersonaWithoutGate: 'PLAY0574',\n GateWithoutPersona: 'PLAY0575',\n AmbiguousPersonaCaller: 'PLAY0576',\n InvalidSpecificationParameter: 'PLAY0577',\n InvalidSpecificationCase: 'PLAY0578',\n DuplicateSpecificationParameter: 'PLAY0579',\n DuplicateSpecificationCase: 'PLAY0580',\n IncompleteSpecificationTable: 'PLAY0581',\n InvalidSpecificationCaseAssignment: 'PLAY0582',\n InvalidSpecificationCaseValue: 'PLAY0583',\n InvalidSpecificationCaseReference: 'PLAY0584',\n OptionalSpecificationParameterTarget: 'PLAY0585',\n SpecificationCaseNameCollision: 'PLAY0586',\n IncompatibleSpecificationParameterType: 'PLAY0587',\n UnusedSpecificationParameter: 'PLAY0588',\n SingularSpecificationTableExpansion: 'PLAY0589',\n UnsupportedInteractionAlternatives: 'PLAY0560',\n MixedInteractionAlternatives: 'PLAY0561',\n InteractionAlternativeWithoutActions: 'PLAY0562',\n InlineInteractionAlternative: 'PLAY0563',\n LegacyInteractionWhere: 'PLAY0564',\n InvalidEventSourceDeclaration: 'PLAY0503',\n InvalidCommandStream: 'PLAY0504',\n AmbiguousCommandStream: 'PLAY0505',\n UnsupportedStreamIdType: 'PLAY0506',\n RedundantSourceStreamId: 'PLAY0507',\n UnknownEvent: 'PLAY0166',\n UnknownReadModelProperty: 'PLAY0514',\n PiiNotSupportedOnIdentifier: 'PLAY0515',\n HandlerWithoutImplementation: 'PLAY0045',\n UnknownHandlerDirective: 'PLAY0046',\n CommandWithProducesAndHandler: 'PLAY0035',\n AbsoluteFileReference: 'PLAY0264',\n InvalidTriggerData: 'PLAY0246',\n} as const;\n"],"mappings":"AAKA,MAAaA,EAAkB,CAC3B,2BAA4B,WAC5B,kBAAmB,WACnB,sBAAuB,WACvB,sBAAuB,WACvB,4BAA6B,WAC7B,uBAAwB,WACxB,wBAAyB,WACzB,sBAAuB,WACvB,qBAAsB,WACtB,qBAAsB,WACtB,wBAAyB,WACzB,wBAAyB,WACzB,qCAAsC,WACtC,0BAA2B,WAC3B,wBAAyB,WACzB,+BAAgC,WAChC,uBAAwB,WACxB,mBAAoB,WACpB,4BAA6B,WAC7B,4BAA6B,WAE7B,2BAA4B,WAC5B,uCAAwC,WACxC,yBAA0B,WAC1B,2BAA4B,WAC5B,yBAA0B,WAC1B,yBAA0B,WAC1B,2BAA4B,WAC5B,mCAAoC,WACpC,8BAA+B,WAC/B,wBAAyB,WACzB,0BAA2B,WAC3B,sCAAuC,WACvC,sCAAuC,WACvC,2BAA4B,WAE5B,2BAA4B,WAC5B,qBAAsB,WACtB,gBAAiB,WACjB,iBAAkB,WAClB,4BAA6B,WAC7B,4BAA6B,WAC7B,uBAAwB,WACxB,yBAA0B,WAC1B,2BAA4B,WAC5B,wBAAyB,WACzB,sBAAuB,WACvB,6BAA8B,WAC9B,uBAAwB,WACxB,wBAAyB,WACzB,mBAAoB,WACpB,qBAAsB,WACtB,yBAA0B,WAC1B,6BAA8B,WAC9B,yBAA0B,WAC1B,0BAA2B,WAC3B,yBAA0B,WAC1B,sBAAuB,WACvB,4BAA6B,WAC7B,eAAgB,WAChB,wBAAyB,WACzB,2BAA4B,WAC5B,4BAA6B,WAC7B,iCAAkC,WAClC,oBAAqB,WACrB,cAAe,WAEf,6BAA8B,WAC9B,wB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BAAyB,WACzB,yBAA0B,WAC1B,iCAAkC,WAClC,yBAA0B,WAC1B,kCAAmC,WACnC,2BAA4B,WAC5B,uBAAwB,WACxB,wBAAyB,WACzB,0BAA2B,WAC3B,qBAAsB,WACtB,sBAAuB,WACvB,kBAAmB,WACnB,0BAA2B,WAC3B,oBAAqB,WACrB,mBAAoB,WACpB,4BAA6B,WAC7B,iCAAkC,WAClC,mCAAoC,WACpC,kCAAmC,WACnC,iCAAkC,WAClC,iCAAkC,WAClC,6BAA8B,WAC9B,oCAAqC,WACrC,gCAAiC,WACjC,mBAAoB,WACpB,2BAA4B,WAC5B,6BAA8B,WAC9B,gCAAiC,WACjC,sCAAuC,WACvC,sCAAuC,WACvC,wBAAyB,WACzB,8BAA+B,WAC/B,qBAAsB,WACtB,4BAA6B,WAC7B,6BAA8B,WAC9B,oCAAqC,WACrC,qBAAsB,WACtB,oCAAqC,WACrC,kCAAmC,WACnC,6BAA8B,WAC9B,mBAAoB,WACpB,mBAAoB,WACpB,uBAAwB,WACxB,8BAA+B,WAC/B,yBAA0B,WAC1B,gCAAiC,WACjC,2BAA4B,WAC5B,6BAA8B,WAC9B,mCAAoC,WACpC,8BAA+B,WAC/B,kCAAmC,WACnC,qCAAsC,WACtC,+BAAgC,WAChC,uCAAwC,WACxC,6BAA8B,WAC9B,oCAAqC,WACrC,mCAAoC,WACpC,6BAA8B,WAC9B,qCAAsC,WACtC,6BAA8B,WAC9B,uBAAwB,WACxB,8BAA+B,WAC/B,qBAAsB,WACtB,uBAAwB,WACxB,wBAAyB,WACzB,wBAAyB,WACzB,aAAc,WACd,yBAA0B,WAC1B,4BAA6B,WAC7B,6BAA8B,WAC9B,wBAAyB,WACzB,8BAA+B,WAC/B,sBAAuB,WACvB,mBAAoB,UACxB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"./DiagnosticCodes.js";import{AuthoringProductionResolver as t}from"../Syntax/AuthoringProductionResolver.js";function productionDestinationDiagnostics(n){let r=new t(n);return r.slices.flatMap(({slice:t})=>t.commands.flatMap(n=>{let i=n.properties.filter(e=>e.isIdentifier&&!e.type.isOptional&&!e.type.isCollection);return i.length===1?n.produces.filter(e=>r.isEventProduction(e,t)&&e.inlineEvent===null&&e.when===null&&e.for===null).map(t=>({severity:`information`,code:e.OmittedProductionDestination,message:`Plain 'produces ${t.event}' omits its destination - use 'for ${i[0].name}' to explicitly select the command's identifier.`,location:t.location})):[]}))}export{productionDestinationDiagnostics};
|
|
2
|
+
//# sourceMappingURL=ProductionDestinationDiagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductionDestinationDiagnostics.js","names":["resolver","AuthoringProductionResolver","application","slice","identifiers","command","property","production","DiagnosticCodes"],"sources":["../../../../../../Compiler/Diagnostics/ProductionDestinationDiagnostics.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 { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { Diagnostic } from './Diagnostic';\nimport { DiagnosticCodes } from './DiagnosticCodes';\n\n// Routing advice is appended after source validation, as in the C# compiler. It changes no default.\nexport function productionDestinationDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const resolver = new AuthoringProductionResolver(application);\n return resolver.slices.flatMap(({ slice }) => slice.commands.flatMap(command => {\n const identifiers = command.properties.filter(property => property.isIdentifier && !property.type.isOptional && !property.type.isCollection);\n if (identifiers.length !== 1) return [];\n return command.produces.filter(production => resolver.isEventProduction(production, slice) && production.inlineEvent === null && production.when === null && production.for === null)\n .map(production => ({ severity: 'information' as const, code: DiagnosticCodes.OmittedProductionDestination,\n message: `Plain 'produces ${production.event}' omits its destination - use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`, location: production.location }));\n }));\n}\n"],"mappings":"mMASA,SAAgB,iCAAiC,EAA8C,CAC3F,IAAMA,EAAW,IAAIC,EAA4BC,CAAW,EAC5D,OAAOF,EAAS,OAAO,SAAS,CAAE,WAAYG,EAAM,SAAS,QAAQ,GAAW,CAC5E,IAAMC,EAAcC,EAAQ,WAAW,OAAO,GAAYC,EAAS,cAAgB,CAACA,EAAS,KAAK,YAAc,CAACA,EAAS,KAAK,YAAY,EAE3I,OADIF,EAAY,SAAW,EACpBC,EAAQ,SAAS,OAAO,GAAcL,EAAS,kBAAkBO,EAAYJ,CAAK,GAAKI,EAAW,cAAgB,MAAQA,EAAW,OAAS,MAAQA,EAAW,MAAQ,IAAI,CAAC,CAChL,IAAI,IAAe,CAAE,SAAU,cAAwB,KAAMC,EAAgB,6BAC1E,QAAS,mBAAmBD,EAAW,MAAM,qCAAqCH,EAAY,EAAE,CAAC,KAAK,kDAAmD,SAAUG,EAAW,QAAS,EAAE,EAH5J,CAAC,CAI1C,CAAC,CAAC,CACN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceLocation.js","names":["path"],"sources":["../../../../../../Compiler/Diagnostics/SourceLocation.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\n// Where a syntax node or a diagnostic came from: a one-based line and column, and the file when the\n// document was compiled as part of a folder. Mirrors the C# SourceLocation record.\nexport interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly path?: string;\n}\n\nexport const sourceLocation = (line: number, column: number, path?: string): SourceLocation =>\n path === undefined ? { line, column } : { line, column, path };\n"],"mappings":"qDAWA,MAAa,gBAAkB,EAAc,EAAgB,IACzDA,IAAS,IAAA,GAAY,CAAE,OAAM,QAAO,EAAI,CAAE,OAAM,SAAQ,MAAK"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import"../Parsing/ImportDiscovery.js";import"../ScreenplayCompiler.js";const e=/* @__PURE__ */ new WeakMap,authoredOrderKey=e=>JSON.stringify(e);function authoredOrderOf(t){return e.get(t)??/* @__PURE__ */ new Map}export{authoredOrderKey,authoredOrderOf};
|
|
2
|
+
//# sourceMappingURL=AuthoredOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthoredOrder.js","names":["orders","scope","application"],"sources":["../../../../../../Compiler/Files/AuthoredOrder.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 { DiscoveredImport, placementFrom } from '../Parsing/ImportDiscovery';\nimport { discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\nimport { samePlacement } from './PlayPlacement';\nimport { AuthoredDeclaration } from './AuthoredDeclaration';\n\n// Presentation metadata never enters syntax JSON, semantic bytes or identity. Merging and diagnostics\n// still use the original document order; only a consumer explicitly requesting authored order sees it.\nconst orders = new WeakMap<ApplicationSyntax, ReadonlyMap<string, number>>();\nexport const authoredOrderKey = (scope: readonly string[]): string => JSON.stringify(scope);\n\nexport function authoredOrderOf(application: ApplicationSyntax): ReadonlyMap<string, number> {\n return orders.get(application) ?? new Map();\n}\n\n// A board may narrow an application without changing the order of its remaining declarations.\nexport function copyAuthoredOrder(original: ApplicationSyntax, narrowed: ApplicationSyntax): ApplicationSyntax {\n const order = orders.get(original);\n if (order !== undefined) orders.set(narrowed, order);\n return narrowed;\n}\n\nfunction declarations(application: ApplicationSyntax): AuthoredDeclaration[] {\n const found: AuthoredDeclaration[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[]) => {\n const scope = [...outer, syntax.name];\n found.push({ scope, ...syntax.location, implicit: syntax.isPlacement, isContainer: true });\n syntax.features.forEach(child => feature(child, scope));\n syntax.slices.forEach(slice => found.push({ scope: [...scope, slice.name], ...slice.location, implicit: false, isContainer: false }));\n };\n application.modules.forEach(module => {\n found.push({ scope: [module.name], ...module.location, implicit: module.isPlacement, isContainer: true });\n module.features.forEach(child => feature(child, [module.name]));\n });\n return found;\n}\n\n// A root's explicit declarations, or those in an enclosing container's own named file, define container\n// order before globbed slice files that merely restate the same containers. Prefer the outer named\n// composite, then the shallower path; absent one, the text walk keeps the first explicit occurrence.\nfunction containerOwners(own: ReadonlyMap<string, readonly AuthoredDeclaration[]>, roots: ReadonlySet<string>): ReadonlyMap<string, string> {\n const owners = new Map<string, { path: string; priority: number; depth: number }>();\n for (const [path, declarations] of own) {\n const segments = path.split('/');\n const name = segments[segments.length - 1].slice(0, -5);\n for (const declaration of declarations.filter(declaration => declaration.isContainer && !declaration.implicit)) {\n const ancestor = declaration.scope.indexOf(name);\n if (!roots.has(path) && ancestor === -1) continue;\n const priority = roots.has(path) ? 0 : ancestor + 1;\n const key = authoredOrderKey(declaration.scope);\n const current = owners.get(key);\n if (current === undefined || priority < current.priority || (priority === current.priority && segments.length < current.depth)) {\n owners.set(key, { path, priority, depth: segments.length });\n }\n }\n }\n return new Map([...owners].map(([key, owner]) => [key, owner.path]));\n}\n\n// Walk text, not the merged tree: placement stubs must not claim the position of a declaration that is\n// written elsewhere. Expand an import only if it contributes the file's settled (deepest) placement.\nexport function recordAuthoredOrder(application: ApplicationSyntax, roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, parsed?: ReadonlyMap<string, ApplicationSyntax>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): void {\n const files = new Map(documents.map(document => [document.path, document]));\n const own = new Map(documents.filter(document => document.isPlacementResolved !== false).map(document => [document.path, declarations(parsed?.get(document.path) ?? parseForAuthoring(document.source, document.path, document.placement, false, undefined, languages).value)]));\n const owners = containerOwners(own, new Set(roots.map(normalizePlayPath)));\n const explicit = new Set([...own.values()].flat().filter(declaration => !declaration.implicit).map(declaration => authoredOrderKey(declaration.scope)));\n const order = new Map<string, number>();\n const visited = new Set<string>();\n const visit = (path: string) => {\n const document = files.get(path);\n if (document === undefined || document.isPlacementResolved === false || visited.has(path)) return;\n visited.add(path);\n const entries = [\n ...(own.get(path) ?? []).filter(declaration => {\n const key = authoredOrderKey(declaration.scope);\n return (!declaration.implicit || !explicit.has(key)) && (!declaration.isContainer || !owners.has(key) || owners.get(key) === path);\n })\n .map(declaration => ({ line: declaration.line, column: declaration.column, run: () => {\n const key = authoredOrderKey(declaration.scope);\n if (!order.has(key)) order.set(key, order.size);\n } })),\n ...(imports?.get(path) ?? discoverImports(document.source, path, languages)).map(imported => ({\n ...imported.fileImport.location,\n run: () => {\n const placement = placementFrom(imported, document.placement);\n if (placement === undefined) return;\n const pattern = resolvePlayPattern(path, imported.fileImport.pattern);\n [...files.keys()].filter(target => target !== path && matchesPlayPattern(pattern, target)).sort().forEach(target => {\n if (samePlacement(files.get(target)!.placement, placement)) visit(target);\n });\n },\n })),\n ];\n entries.sort((left, right) => left.line - right.line || left.column - right.column).forEach(entry => entry.run());\n };\n roots.map(normalizePlayPath).forEach(path => {\n const document = files.get(path);\n // A broad root glob can discover a file before the import that actually places it.\n if (document?.placement.length === 0) visit(path);\n });\n orders.set(application, order);\n}\n"],"mappings":"4HAaA,MAAMA,kBAAS,IAAI,QACN,iBAAoB,GAAqC,KAAK,UAAUC,CAAK,EAE1F,SAAgB,gBAAgB,EAA6D,CACzF,OAAOD,EAAO,IAAIE,CAAW,mBAAK,IAAI,GAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../ScreenplayCompiler.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"../Parsing/SourceLineSplitter.js";import{expandSpecificationExamples as t}from"../Parsing/SpecificationCommandExamples.js";import{validateResponses as n}from"../Parsing/ResponseValidator.js";import{validateSpecificationCases as r}from"../Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as i}from"../Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as a}from"../Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as o}from"../Dependencies/DeclaredDependencyTargets.js";import{LineReader as s}from"../Parsing/LineReader.js";import{ParserContext as c}from"../Parsing/ParserContext.js";import"./AuthoredOrder.js";import{DeclaredDependencies as l}from"../Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as u}from"../Parsing/PublicEventUsageValidator.js";import{validateInlineEvents as d}from"../Parsing/InlineEventValidator.js";import{validateOperations as f}from"../Parsing/OperationValidator.js";import{CommandStreamCandidates as p}from"../Parsing/CommandStreamCandidates.js";import{validateEventSources as m}from"../Parsing/EventSourceValidator.js";import{validateProjectionTargets as h}from"../Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as g}from"../Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as _}from"../Parsing/EventSubjectValidator.js";import{validateReactionRefusals as v}from"../Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as y}from"../Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as b}from"../Parsing/GuardedActionValidator.js";import{validatePersonaCallers as x}from"../Parsing/PersonaCallerValidator.js";import{validatePurposes as S}from"../Parsing/PurposeValidator.js";import"./TimelineOrder.js";import{parseForAuthoring as C}from"../ScreenplayCompiler.js";import{EventSourceReadConfidence as w}from"../Syntax/EventSourceReadConfidence.js";import"./OrderingRoot.js";import{mergeDocuments as T}from"./PlayFolderMerge.js";import"./PlayImports.js";function parsePlacedDocuments(e,t){return parsePlacedDocumentsWithSyntax(e,t).result}function parsePlacedDocumentsWithSyntax(E,D){let O=p.capturePlaced(E.filter(e=>e.isPlacementResolved!==!1).map(t=>({lines:e(t.source,!1,t.path),placement:t.placement})),D),k=E.map(e=>C(e.source,e.path,e.isPlacementResolved===!1?[]:e.placement,!1,O,D)),A=k.flatMap((e,t)=>(e.value.eventSources??[]).map(e=>({source:e,placementResolved:E[t].isPlacementResolved!==!1}))),j=E.every(e=>e.isPlacementResolved!==!1)&&k.every(e=>!w.hasUnknownExtent(e.diagnostics)),M=k.map((e,t)=>E[t].isPlacementResolved===!1?{...e,value:{...e.value,eventSources:[]}}:e),N=T(M),P=new c(new s([]),void 0,D);N.value.sourceOptions!==void 0&&(P.sourceOptions=N.value.sourceOptions),r(N.value,P);let F=t(N.value);m(N.value,P),f(N.value,P),u(N.value,P),d(N.value,P),a(N.value,P),n(F,P,M.flatMap(e=>e.inputUses)),h(N.value,P),g(F,P),_(N.value,P),v(N.value,P),y(N.value,P),b(N.value,P),x(N.value,P),S(N.value,P);let I=o(N.value,P);l.validate(I,P);for(let e of i(I))P.information(e.code,e.message,e.location);let L=N.diagnostics,R=new Set(L.map(diagnosticKey)),z=[...L,...P.diagnostics.filter(e=>!R.has(diagnosticKey(e)))];return{result:{...N,value:I,diagnostics:z,success:!z.some(e=>e.severity===`error`),physicalEventSources:A,sourceInventoryComplete:j},syntax:new Map(M.map((e,t)=>[E[t].path,e.value]))}}function diagnosticKey(e){return JSON.stringify([e.code,e.location.path,e.location.line,e.location.column])}export{parsePlacedDocuments};
|
|
2
|
+
//# sourceMappingURL=PlayApplicationAssembly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayApplicationAssembly.js","names":["documents","languages","candidates","CommandStreamCandidates","document","splitLines","physical","parseForAuthoring","physicalEventSources","result","index","sourceInventoryComplete","EventSourceReadConfidence","parsed","merged","mergeDocuments","context","ParserContext","LineReader","validateSpecificationCases","effective","expandSpecificationExamples","validateEventSources","validateOperations","validatePublicEventUsage","validateInlineEvents","validateConstraintProperties","validateResponses","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validatePurposes","value","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","existing","reported","all"],"sources":["../../../../../../Compiler/Files/PlayApplicationAssembly.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n validateSpecificationCases(merged.value, context);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n"],"mappings":"4nEAoEA,SAAgB,qBAAqB,EAA0C,EAG7E,CACE,OAAO,+BAA+BA,EAAWC,CAAS,CAAC,CAAC,MAChE,CAEA,SAAS,+BAA+B,EAA0C,EAAiC,CAC/G,IAAMC,EAAaC,EAAwB,cAAcH,EAAU,OAAO,GAAYI,EAAS,sBAAwB,EAAK,CAAC,CAAC,IAAI,IAAa,CAAE,MAAOC,EAAWD,EAAS,OAAQ,GAAOA,EAAS,IAAI,EAAG,UAAWA,EAAS,SAAU,EAAE,EAAGH,CAAS,EACjPK,EAAWN,EAAU,IAAI,G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,MAAOE,CAAO,EACrDiB,EAAuBnB,EAAO,MAAOE,CAAO,EAC5CkB,EAAuBpB,EAAO,MAAOE,CAAO,EAC5CmB,EAAiBrB,EAAO,MAAOE,CAAO,EACtC,IAAMoB,EAAQC,EAA+BvB,EAAO,MAAOE,CAAO,EAClEsB,EAAqB,SAASF,EAAOpB,CAAO,EAC5C,IAAK,IAAMuB,KAAcC,EAAiCJ,CAAK,EAAGpB,EAAQ,YAAYuB,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC9I,IAAME,EAAW3B,EAAO,YAClB4B,EAAW,IAAI,IAAID,EAAS,IAAI,aAAa,CAAC,EAC9CE,EAAM,CAAC,GAAGF,EAAU,GAAGzB,EAAQ,YAAY,OAAO,GAAc,CAAC0B,EAAS,IAAI,cAAcH,CAAU,CAAC,CAAC,CAAC,EAC/G,MAAO,CACH,OAAQ,CAAE,GAAGzB,EAAQ,QAAO,YAAa6B,EAAK,QAAS,CAACA,EAAI,KAAK,GAAcJ,EAAW,WAAa,OAAO,EAAG,uBAAsB,yBAAwB,EAC/J,OAAQ,IAAI,IAAI1B,EAAO,KAAK,EAAQ,IAAU,CAACb,EAAUU,EAAM,CAAC,KAAMD,EAAO,KAAK,CAAC,CAAC,CACxF,CACJ,CAEA,SAAS,cAAc,EAAgC,CACnD,OAAO,KAAK,UAAU,CAAC8B,EAAW,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,MAAM,CAAC,CAC3H"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{validateIdentity as t}from"../Parsing/IdentityValidator.js";import{combineAuthorize as n}from"../Parsing/AuthorizeParser.js";import{LineReader as r}from"../Parsing/LineReader.js";import{InvalidSyntaxJson as i}from"../Syntax/InvalidSyntaxJson.js";import{invalidSourceOptions as a,isAuthoredDocument as o,legacySourceOptions as s,validatedSourceOptions as c}from"../Syntax/SourceOptions.js";import{ParserContext as l}from"../Parsing/ParserContext.js";import{toSyntaxJson as u}from"../Syntax/SyntaxJson.js";function mergeDocuments(n){let o=[],u=n.map(e=>e.value),d=/* @__PURE__ */ new Map,f=!1;for(let t of u)try{d.set(t,Object.hasOwn(t,`sourceOptions`)?c(t.sourceOptions):s)}catch(n){if(!(n instanceof i))throw n;f=!0,o.push(error(e.IncompatibleNumericSource,n.message,t.location))}let p=u.filter(e=>d.get(e)?.numericMode===`exact`||hasDeclarations(e)),m=d.get(p[0])??s;for(let t of p.slice(1))d.get(t)?.numericMode!==m.numericMode&&(f=!0,o.push(error(e.MixedNumericModes,`Declaration-bearing documents and marked import barrels must independently select the same numeric mode.`,t.location)));f&&(m=a);let h=/* @__PURE__ */ new Map,g=declaredInOneFile(u.flatMap(e=>e.concepts),`declaration of`,o,void 0,h),_=declaredInOneFile(u.flatMap(e=>e.types),`declaration of`,o,void 0,h),v=u.flatMap(e=>e.identity==null?[]:[e.identity]);for(let t of v.slice(1))o.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares an identity block in '${describe(v[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let y=u.map(e=>e.domain).filter(e=>e!==null);for(let t of y.slice(1))o.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a domain in '${describe(y[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let b=mergeModules(u.flatMap(e=>e.modules),o),x=declaredInOneFile(u.flatMap(e=>e.personas),`persona`,o),S={kind:`ApplicationSyntax`,sourceOptions:m,...v.length===0?{}:{identity:v[0]},domain:y[0]??null,imports:firstOfEach(u.flatMap(e=>e.imports),e=>e.qualifiedName),concepts:g,types:_,examples:u.flatMap(e=>e.examples??[]),systems:u.flatMap(e=>e.systems??[]),purposes:declaredInOneFile(u.flatMap(e=>e.purposes??[]),`purpose`,o),eventSources:u.flatMap(e=>e.eventSources??[]),declaredTriggers:u.flatMap(e=>e.declaredTriggers??[]),modules:b,personas:x,policies:u.flatMap(e=>e.policies??[]),seeds:u.flatMap(e=>e.seeds??[]),fileImports:u.flatMap(e=>e.fileImports),...presentOnly(`exposures`,u.flatMap(e=>e.exposures??[])),...presentOnly(`instanceContributions`,u.flatMap(e=>e.instanceContributions??[])),location:u[0]?.location??{line:1,column:1}},C=new l(new r([]));t(S,C),o.push(...C.diagnostics);let w=[...n.flatMap(e=>e.diagnostics),...o];return{value:S,diagnostics:w,success:!w.some(e=>e.severity===`error`)}}function hasDeclarations(e){if(o(e)||e.identity!=null||e.domain!==null||e.concepts.length>0||e.types.length>0||e.personas.length>0||(e.policies?.length??0)>0||(e.purposes?.length??0)>0||(e.seeds?.length??0)>0||(e.systems?.length??0)>0||(e.eventSources?.length??0)>0||(e.examples?.length??0)>0)return!0;let feature=e=>!e.isPlacement||(e.examples?.length??0)>0||e.slices.length>0||e.features.some(feature);return e.modules.some(e=>!e.isPlacement||(e.examples?.length??0)>0||e.features.some(feature))}function mergeModules(e,t){return groupByName(e).map(placedLast).map(e=>e.length===1?{...e[0],isPlacement:!1,features:e[0].features.map(unplaced)}:{...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`module '${e[0].name}'`,t),documentation:firstDocumentation(e,`module '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`module '${e[0].name}'`,t),dependsOn:groupDependencies(e),features:mergeFeatures(e.flatMap(e=>e.features),t)})}function mergeFeatures(e,t){return groupByName(e).map(placedLast).map(e=>e.length===1?unplaced(e[0]):{...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`feature '${e[0].name}'`,t),documentation:firstDocumentation(e,`feature '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`feature '${e[0].name}'`,t),dependsOn:groupDependencies(e),features:mergeFeatures(e.flatMap(e=>e.features),t),slices:declaredInOneFile(e.flatMap(e=>e.slices),`slice`,t,`feature '${e[0].name}'`)})}function groupDependencies(e){return[...e].sort((e,t)=>(e.location.path??``)<(t.location.path??``)?-1:+((e.location.path??``)>(t.location.path??``))).flatMap(e=>e.dependsOn??[])}function placedLast(e){return[...e.filter(e=>!e.isPlacement),...e.filter(e=>e.isPlacement)]}function unplaced(e){return{...e,isPlacement:!1,features:e.features.map(unplaced)}}function combineAuthorization(t,r,i){let a=[];for(let n of t.filter(e=>e!==null)){let t=a.find(e=>e.location.path!==n.location.path&&JSON.stringify(u(e))===JSON.stringify(u(n)));t===void 0?a.push(n):i.push(warning(e.DuplicateAuthorizationAcrossFiles,`An identical authorization is already declared on the ${r} in '${describe(t.location.path)}' - this repeated gate is ignored`,n.location))}return a.reduce((e,t)=>n(e,t),null)}function firstOfEach(e,t){let n=/* @__PURE__ */ new Set;return e.filter(e=>!n.has(t(e))&&n.add(t(e))!==void 0)}function groupByName(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,[...t.get(n.name)??[],n]);return[...t.values()]}function firstDocumentation(t,n,r){let i=t.filter(e=>e.documentation!=null);for(let t of i.slice(1).filter(e=>e.documentation!==i[0].documentation))r.push(warning(e.ConflictingDocumentationAcrossFiles,`The ${n} is already documented in '${describe(i[0].location.path)}' - keeping that documentation`,t.location));return i[0]?.documentation??null}function firstDescription(t,n,r){let i=t.filter(e=>e.description!==null);for(let t of i.slice(1).filter(e=>e.description!==i[0].description))r.push(warning(e.ConflictingDescriptionAcrossFiles,`The ${n} is already described in '${describe(i[0].location.path)}' - keeping that description`,t.location));return i[0]?.description??null}function declaredInOneFile(t,n,r,i,a=/* @__PURE__ */ new Map){let o=[];for(let s of t){let t=a.get(s.name);t!==void 0&&t.path!==s.location.path?r.push(error(e.RepeatedDeclarationAcrossFiles,`Duplicate ${n} '${s.name}'${i===void 0?``:` in ${i}`} - already declared in '${describe(t.path)}'`,s.location)):(t===void 0&&a.set(s.name,s.location),o.push(s))}return o}const describe=e=>e??`another file`,error=(e,t,n)=>({severity:`error`,code:e,message:t,location:n}),warning=(e,t,n)=>({severity:`warning`,code:e,message:t,location:n});function presentOnly(e,t){return t.length===0?{}:{[e]:t}}export{mergeDocuments};
|
|
2
|
+
//# sourceMappingURL=PlayFolderMerge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayFolderMerge.js","names":["diagnostics","applications","documents","document","options","invalid","application","validatedSourceOptions","legacySourceOptions","failure","InvalidSyntaxJson","DiagnosticCodes","asserted","sourceOptions","invalidSourceOptions","named","concepts","types","identities","extra","domains","domain","modules","personas","value","item","identityContext","ParserContext","LineReader","validateIdentity","all","diagnostic","isAuthoredDocument","node","module","parts","part","reference","features","left","right","feature","kept","authorization","declarations","declaration","first","earlier","toSyntaxJson","owner","combineAuthorize","combined","next","seen","items","key","groups","documented","disagreeing","described","claimed","keyword","within","path","values"],"sources":["../../../../../../Compiler/Files/PlayFolderMerge.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 { validateIdentity } from '../Parsing/IdentityValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies: applications.flatMap(application => application.policies ?? []),\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n const identityContext = new ParserContext(new LineReader([]));\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const all = [...documents.flatMap(document => document.diagnostics), ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => parts.length === 1 ? { ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) } : {\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => parts.length === 1 ? unplaced(parts[0]) : {\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return { ...feature, isPlacement: false, features: feature.features.map(unplaced) };\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && JSON.stringify(toSyntaxJson(earlier)) === JSON.stringify(toSyntaxJson(authorization)));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n return kept.reduce<AuthorizeSyntax | null>((combined, next) => combineAuthorize(combined, next), null);\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n"],"mappings":"wnBAqBA,SAAgB,eAAe,EAAkG,CAC7H,IAAMA,EAA4B,CAAC,EAC7BC,EAAeC,EAAU,IAAI,GAAYC,EAAS,KAAK,EACvDC,kBAAU,IAAI,IAChBC,EAAU,GACd,IAAK,IAAMC,KAAeL,EACtB,GAAI,CACAG,EAAQ,IAAIE,EAAa,OAAO,OAAOA,EAAa,eAAe,EAAIC,EAAuBD,EAAY,aAAa,EAAIE,CAAmB,CAClJ,OAASC,EAAS,CACd,GAAI,EAAEA,aAAmBC,GAAoB,MAAMD,EACnD,EAAU,GACVT,EAAY,KAAK,MAAMW,EAAgB,0BAA2BF,EAAQ,QAASH,EAAY,QAAQ,CAAC,CAC5G,CAEJ,IAAMM,EAAWX,EAAa,OAAO,GAAeG,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgB,SAAW,gBAAgBA,CAAW,CAAC,EACjIO,EAAgBT,EAAQ,IAAIQ,EAAS,EAAE,GAAKJ,EAChD,IAAK,IAAMF,KAAeM,EAAS,MAAM,CAAC,EAClCR,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgBO,EAAc,cACxD,EAAU,GACVb,EAAY,KAAK,MAAMW,EAAgB,kBAAmB,2GAA4GL,EAAY,QAAQ,CAAC,GAG/LD,IAAS,EAAgBS,GAC7B,IAAMC,kBAAQ,IAAI,IACZC,EAAW,kBAAiCf,EAAa,QAAQ,GAAeK,EAAY,QAAQ,EAAG,iBAAkBN,EAAa,IAAA,GAAWe,CAAK,EACtJE,EAAQ,kBAA8BhB,EAAa,QAAQ,GAAeK,EAAY,KAAK,EAAG,iBAAkBN,EAAa,IAAA,GAAWe,CAAK,EAC7IG,EAAajB,EAAa,QAAQ,GAAeK,EA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+1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";const e=[],isDocumentPlacement=e=>e.length===0;function describePlacement(e){return e.length===0?`the application`:e.length===1?`module '${e[0]}'`:`feature '${e.join(`.`)}'`}export{describePlacement,e as documentPlacement,isDocumentPlacement};
|
|
2
|
+
//# sourceMappingURL=PlayPlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayPlacement.js","names":["documentPlacement","placement"],"sources":["../../../../../../Compiler/Files/PlayPlacement.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\n// Where the top level of a .play file belongs: the module name followed by the names of the nested features,\n// outermost first, and empty for the application itself - the port of the C# PlayPlacement. A file is placed\n// by the import that brings it in: written inside 'module Ordering' and 'feature Orders', it places the\n// imported file at Ordering.Orders, so what the file declares at its top level is the body of that feature.\nexport type PlayPlacement = readonly string[];\n\n// The placement of a whole document - its top level is the application's.\nexport const documentPlacement: PlayPlacement = [];\n\n// Whether a file is a whole document rather than placed in a module or feature.\nexport const isDocumentPlacement = (placement: PlayPlacement): boolean => placement.length === 0;\n\n// The placement as it reads in a diagnostic, such as module 'Ordering' or feature 'Ordering.Orders'.\nexport function describePlacement(placement: PlayPlacement): string {\n if (placement.length === 0) return 'the application';\n if (placement.length === 1) return `module '${placement[0]}'`;\n return `feature '${placement.join('.')}'`;\n}\n\n// Whether one placement lies inside another, or is the same - the other's scope is a prefix of this one.\nexport const isWithinOrSame = (placement: PlayPlacement, other: PlayPlacement): boolean =>\n other.length <= placement.length && other.every((name, index) => name === placement[index]);\n\nexport const samePlacement = (left: PlayPlacement, right: PlayPlacement): boolean =>\n left.length === right.length && isWithinOrSame(left, right);\n"],"mappings":"qDAUA,MAAaA,EAAmC,CAAC,EAGpC,oBAAuB,GAAsCC,EAAU,SAAW,EAG/F,SAAgB,kBAAkB,EAAkC,CAGhE,OAFIA,EAAU,SAAW,EAAU,kBAC/BA,EAAU,SAAW,EAAU,WAAWA,EAAU,GAAG,GACpD,YAAYA,EAAU,KAAK,GAAG,EAAE,EAC3C"}
|
|
@@ -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{authoredOrderKey as n,authoredOrderOf as r}from"./AuthoredOrder.js";import{buildingReadModelReferences as i,sliceReferences as a}from"../Dependencies/SliceReferences.js";import{stronglyConnectedGroups as o}from"../Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as s}from"../Dependencies/DependencyGraph.js";import{ordinalIgnoreCaseKey as c}from"../Text/ordinalIgnoreCaseKey.js";function timelineOrderDiagnostics(l){let u=r(l),ordered=(e,t)=>e.map(e=>({syntax:e,rank:u.get(n([...t,e.name]))??2**53-1})).sort((e,t)=>e.rank-t.rank).map(e=>e.syntax),d=[],feature=(e,t)=>{let n=[...t,e.name];for(let t of ordered(e.slices,n))d.push({syntax:t,scope:[...n,t.name],identity:[...n.map(e=>`container:${e}`),`slice:${t.name}`],index:d.length});for(let t of ordered(e.features,n))feature(t,n)};for(let e of ordered(l.modules,[]))for(let t of ordered(e.features,[e.name]))feature(t,[e.name]);let f=new Map(d.map(e=>[e,/* @__PURE__ */ new Set([...t(e.syntax).map(e=>c(e.name)),...e.syntax.commands.flatMap(e=>e.produces.map(e=>c(e.event))),...e.syntax.reactions.flatMap(e=>e.triggers.flatMap(e=>e.produces.map(e=>c(e.event))))])])),p=/* @__PURE__ */ new Map;for(let e of d)for(let n of t(e.syntax)){let t=c(n.name);p.has(t)||p.set(t,e)}let m=/* @__PURE__ */ new Map;for(let e of d){let t=n(e.scope);m.has(t)||m.set(t,e)}let h=/* @__PURE__ */ new Map;for(let e of s.for(l,u).edges.filter(e=>e.kind===`decidesFrom`))for(let t of e.evidence){let r=n([...e.consumer.scope,t.name.toLowerCase()]);h.has(r)||h.set(r,m.get(n(e.producer.scope)))}let g=[];for(let e of d){let t=/* @__PURE__ */ new Set,r=a(e.syntax).references.filter(e=>e.timeline).map(e=>({event:e.name,location:e.location,readModel:e.targetKind===`ReadModel`}));for(let a of r){let r=c(a.event),o=`${a.readModel?`ReadModel`:`Event`}:${r}`;if(t.has(o))continue;t.add(o);let s=a.readModel?h.get(n([...e.scope,a.event.toLowerCase()])):p.get(r);if(s===void 0||s===e)continue;let l=0;for(;l<e.scope.length&&l<s.scope.length&&e.identity[l]===s.identity[l];)l++;if(l!==e.scope.length&&l!==s.scope.length){if(a.readModel){let t=e.identity.slice(0,l+1),n=new Set(d.filter(e=>t.every((t,n)=>e.identity[n]===t)).flatMap(e=>[...f.get(e)]));if(i(s.syntax,a.event).some(e=>e.timeline&&e.kind===`usesFactsFrom`&&e.targetKind===`Event`&&n.has(c(e.name))))continue}g.push({...a,consumer:e,producer:s,container:n(e.identity.slice(0,l)),left:e.identity[l],right:s.identity[l]})}}}let compare=(e,t)=>e.consumer.index-t.consumer.index||e.location.line-t.location.line||e.location.column-t.location.column,_=/* @__PURE__ */ new Set,v=[];for(let t of new Set(g.map(e=>e.container))){let r=g.filter(e=>e.container===t),i=/* @__PURE__ */ new Map;for(let e of r)i.has(e.left)||i.set(e.left,/* @__PURE__ */ new Set),i.has(e.right)||i.set(e.right,/* @__PURE__ */ new Set),i.get(e.left).add(e.right);for(let a of o(i).filter(e=>e.length>1)){let i=new Set(a),o=r.filter(e=>i.has(e.left)&&i.has(e.right));o.forEach(e=>_.add(e));let s=o.filter(e=>e.consumer.index<e.producer.index).sort(compare)[0];if(s===void 0)continue;let memberIndex=e=>Math.min(...o.flatMap(e=>[e.consumer,e.producer]).filter(n=>{let r=JSON.parse(t);return n.identity[r.length]===e}).map(e=>e.index));a.sort((e,t)=>memberIndex(e)-memberIndex(t)),v.push({edge:s,diagnostic:{severity:`information`,code:e.TimelineCycleGroup,message:`Timeline group ${a.map(e=>`${e.startsWith(`slice:`)?`slice`:t===n([])?`module`:`feature`} '${e.slice(e.indexOf(`:`)+1)}'`).join(`, `)} depend on each other's events or read models; reordering these members cannot make every dependency flow left to right.`,location:s.location}})}}for(let t of g){if(t.consumer.index>=t.producer.index||_.has(t))continue;let n=t.consumer.scope.slice(0,-1),r=t.producer.scope.length>t.consumer.scope.length&&n.every((e,n)=>t.producer.scope[n]===e)?` The producer is in the consumer's own sub-feature; this cannot be fixed by reordering.`:` Consider drawing the producer before the consumer.`,i=t.readModel?`reads read model '${t.event}' built by`:`uses event '${t.event}' produced by`;v.push({edge:t,diagnostic:{severity:`information`,code:e.EventFromLaterSlice,message:`Slice '${t.consumer.syntax.name}' ${i} slice '${t.producer.syntax.name}' drawn after it.${r}`,location:t.location}})}return v.sort((e,t)=>compare(e.edge,t.edge)).map(e=>e.diagnostic)}export{timelineOrderDiagnostics};
|
|
2
|
+
//# sourceMappingURL=TimelineOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineOrder.js","names":["order","authoredOrderOf","application","items","authoredOrderKey","outer","syntax","left","right","item","slices","scope","slice","name","child","module","produced","eventDeclarations","ordinalIgnoreCaseKey","event","command","value","reaction","trigger","producers","byScope","key","readers","decision","DependencyGraph","edge","reference","edges","consumer","seen","references","sliceReferences","producer","common","side","facts","index","buildingReadModelReferences","suppressed","findings","container","local","graph","group","stronglyConnectedGroups","members","internal","first","member","DiagnosticCodes","parent","consequence","use","finding"],"sources":["../../../../../../Compiler/Files/TimelineOrder.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { buildingReadModelReferences, sliceReferences } from '../Dependencies/SliceReferences';\nimport { DependencyGraph } from '../Dependencies/DependencyGraph';\nimport { stronglyConnectedGroups } from '../Dependencies/StronglyConnectedGroups';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { authoredOrderKey, authoredOrderOf } from './AuthoredOrder';\nimport { ordinalIgnoreCaseKey } from '../Text/ordinalIgnoreCaseKey';\n\ninterface Slice {\n syntax: SliceSyntax;\n scope: readonly string[];\n identity: readonly string[];\n index: number;\n}\ninterface Reference { event: string; location: SourceLocation; readModel: boolean }\ninterface Edge extends Reference { consumer: Slice; producer: Slice; left: string; right: string; container: string }\n\n// This pass only observes syntax. Its ranks and graph never enter the persisted model.\nexport function timelineOrderDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const order = authoredOrderOf(application);\n const ordered = <T extends { name: string }>(items: readonly T[], outer: readonly string[]): T[] => items\n .map(syntax => ({ syntax, rank: order.get(authoredOrderKey([...outer, syntax.name])) ?? Number.MAX_SAFE_INTEGER }))\n .sort((left, right) => left.rank - right.rank).map(item => item.syntax);\n const slices: Slice[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[]) => {\n const scope = [...outer, syntax.name];\n for (const slice of ordered(syntax.slices, scope)) slices.push({ syntax: slice, scope: [...scope, slice.name], identity: [...scope.map(name => `container:${name}`), `slice:${slice.name}`], index: slices.length });\n for (const child of ordered(syntax.features, scope)) feature(child, scope);\n };\n for (const module of ordered(application.modules, [])) {\n for (const child of ordered(module.features, [module.name])) feature(child, [module.name]);\n }\n const produced = new Map(slices.map(slice => [slice, new Set([\n ...eventDeclarations(slice.syntax).map(event => ordinalIgnoreCaseKey(event.name)),\n ...slice.syntax.commands.flatMap(command => command.produces.map(value => ordinalIgnoreCaseKey(value.event))),\n ...slice.syntax.reactions.flatMap(reaction => reaction.triggers.flatMap(trigger => trigger.produces.map(value => ordinalIgnoreCaseKey(value.event)))),\n ])]));\n const producers = new Map<string, Slice>();\n for (const slice of slices) {\n for (const event of eventDeclarations(slice.syntax)) {\n const name = ordinalIgnoreCaseKey(event.name);\n if (!producers.has(name)) producers.set(name, slice);\n }\n }\n // Use decidesFrom resolution, including builder preference and declaration fallback.\n const byScope = new Map<string, Slice>();\n for (const slice of slices) {\n const key = authoredOrderKey(slice.scope);\n if (!byScope.has(key)) byScope.set(key, slice);\n }\n const readers = new Map<string, Slice>();\n for (const decision of DependencyGraph.for(application, order).edges.filter(edge => edge.kind === 'decidesFrom')) {\n for (const reference of decision.evidence) {\n const key = authoredOrderKey([...decision.consumer.scope, reference.name.toLowerCase()]);\n if (!readers.has(key)) readers.set(key, byScope.get(authoredOrderKey(decision.producer.scope))!);\n }\n }\n const edges: Edge[] = [];\n for (const consumer of slices) {\n const seen = new Set<string>();\n const references = sliceReferences(consumer.syntax).references.filter(reference => reference.timeline)\n .map(reference => ({ event: reference.name, location: reference.location, readModel: reference.targetKind === 'ReadModel' }));\n for (const reference of references) {\n const name = ordinalIgnoreCaseKey(reference.event);\n const key = `${reference.readModel ? 'ReadModel' : 'Event'}:${name}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const producer = reference.readModel ? readers.get(authoredOrderKey([...consumer.scope, reference.event.toLowerCase()])) : producers.get(name);\n if (producer === undefined || producer === consumer) continue;\n let common = 0;\n while (common < consumer.scope.length && common < producer.scope.length && consumer.identity[common] === producer.identity[common]) common++;\n if (common === consumer.scope.length || common === producer.scope.length) continue;\n // At the lowest common container, the reader's whole child supplies feedback\n // only for builders of the read model being read.\n // Exclude this read before SCC grouping, not just backward-edge emission.\n if (reference.readModel) {\n const side = consumer.identity.slice(0, common + 1);\n const facts = new Set(slices.filter(slice => side.every((name, index) => slice.identity[index] === name)).flatMap(slice => [...produced.get(slice)!]));\n if (buildingReadModelReferences(producer.syntax, reference.event).some(value => value.timeline && value.kind === 'usesFactsFrom' && value.targetKind === 'Event' && facts.has(ordinalIgnoreCaseKey(value.name)))) continue;\n }\n edges.push({ ...reference, consumer, producer, container: authoredOrderKey(consumer.identity.slice(0, common)), left: consumer.identity[common], right: producer.identity[common] });\n }\n }\n const compare = (left: Edge, right: Edge) => left.consumer.index - right.consumer.index || left.location.line - right.location.line || left.location.column - right.location.column;\n const suppressed = new Set<Edge>();\n const findings: { edge: Edge; diagnostic: Diagnostic }[] = [];\n for (const container of new Set(edges.map(edge => edge.container))) {\n const local = edges.filter(edge => edge.container === container);\n const graph = new Map<string, Set<string>>();\n for (const edge of local) {\n if (!graph.has(edge.left)) graph.set(edge.left, new Set());\n if (!graph.has(edge.right)) graph.set(edge.right, new Set());\n graph.get(edge.left)!.add(edge.right);\n }\n for (const group of stronglyConnectedGroups(graph).filter(group => group.length > 1)) {\n const members = new Set(group);\n const internal = local.filter(edge => members.has(edge.left) && members.has(edge.right));\n internal.forEach(edge => suppressed.add(edge));\n const first = internal.filter(edge => edge.consumer.index < edge.producer.index).sort(compare)[0];\n if (first === undefined) continue;\n const memberIndex = (member: string) => Math.min(...internal.flatMap(edge => [edge.consumer, edge.producer]).filter(slice => {\n const scope = JSON.parse(container) as string[];\n return slice.identity[scope.length] === member;\n }).map(slice => slice.index));\n group.sort((left, right) => memberIndex(left) - memberIndex(right));\n findings.push({ edge: first, diagnostic: { severity: 'information', code: DiagnosticCodes.TimelineCycleGroup, message: `Timeline group ${group.map(member => `${member.startsWith('slice:') ? 'slice' : container === authoredOrderKey([]) ? 'module' : 'feature'} '${member.slice(member.indexOf(':') + 1)}'`).join(', ')} depend on each other's events or read models; reordering these members cannot make every dependency flow left to right.`, location: first.location } });\n }\n }\n for (const edge of edges) {\n if (edge.consumer.index >= edge.producer.index || suppressed.has(edge)) continue;\n const parent = edge.consumer.scope.slice(0, -1);\n const ownSubFeature = edge.producer.scope.length > edge.consumer.scope.length && parent.every((name, index) => edge.producer.scope[index] === name);\n const consequence = ownSubFeature ? ' The producer is in the consumer\\'s own sub-feature; this cannot be fixed by reordering.' : ' Consider drawing the producer before the consumer.';\n const use = edge.readModel ? `reads read model '${edge.event}' built by` : `uses event '${edge.event}' produced by`;\n findings.push({ edge, diagnostic: { severity: 'information', code: DiagnosticCodes.EventFromLaterSlice, message: `Slice '${edge.consumer.syntax.name}' ${use} slice '${edge.producer.syntax.name}' drawn after it.${consequence}`, location: edge.location } });\n }\n return findings.sort((left, right) => compare(left.edge, right.edge)).map(finding => finding.diagnostic);\n}\n"],"mappings":"8kBAwBA,SAAgB,yBAAyB,EAA8C,CACnF,IAAMA,EAAQC,EAAgBC,CAAW,EACnC,SAAuC,EAAqB,IAAkCC,EAC/F,IAAI,IAAW,CAAE,SAAQ,KAAMH,EAAM,IAAII,EAAiB,CAAC,GAAGC,EAAOC,EAAO,IAAI,CAAC,CAAC,UAA6B,EAAE,CAAC,CAClH,MAAM,EAAM,IAAUC,EAAK,KAAOC,EAAM,IAAI,CAAC,CAAC,IAAI,GAAQC,EAAK,MAAM,EACpEC,EAAkB,CAAC,EACnB,SAAW,EAAuB,IAA6B,CACjE,IAAMC,EAAQ,CAAC,GAAGN,EAAOC,EAAO,IAAI,EACpC,IAAK,IAAMM,KAAS,QAAQN,EAAO,OAAQK,CAAK,EAAGD,EAAO,KAAK,CAAE,OAAQE,EAAO,MAAO,CAAC,GAAGD,EAAOC,EAAM,IAAI,EAAG,SAAU,CAAC,GAAGD,EAAM,IAAI,GAAQ,aAAaE,GAAM,EAAG,SAASD,EAAM,MAAM,EAAG,MAAOF,EAAO,MAAO,CAAC,EACnN,IAAK,IAAMI,KAAS,QAAQR,EAAO,SAAUK,CAAK,EAAG,QAAQG,EAAOH,CAAK,CAC7E,EACA,IAAK,IAAMI,KAAU,QAAQb,EAAY,QAAS,CAAC,CAAC,EAChD,IAAK,IAAMY,KAAS,QAAQC,EAAO,SAAU,CAACA,EAAO,IAAI,CAAC,EAAG,QAAQD,EAAO,CAACC,EAAO,IAAI,CAAC,EAE7F,IAAMC,EAAW,IAAI,IAAIN,EAAO,IAAI,GAAS,CAACE,kBAAO,IAAI,IAAI,CACzD,GAAGK,EAAkBL,EAAM,MAAM,CAAC,CAAC,IAAI,GAASM,EAAqBC,EAAM,IAAI,CAAC,EAChF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AC,CAAC,CAAC,IAAI,GAAWkD,EAAQ,UAAU,CAC3G"}
|
|
@@ -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{locationOf as n}from"./SourceLine.js";const r=t(`^(?:(?:or|and)\\s+)?[A-Za-z_(][\\w\\s()]*$`),i=new RegExp(t(`\\(|\\)|[A-Za-z_]\\w*`).source,`gu`),a=t(`^[A-Z]\\w*$`);function parseAuthorize(t,i){let a=i.content.substring(9);for(let e=t.peekChild(i.indent);e!==void 0&&r.test(e.content);e=t.peekChild(i.indent))t.reader.takeSignificant(),a+=` ${e.content}`;let o=tokenize(a),s=n(i);if(o.length===0)return t.error(e.AuthorizeWithoutPolicy,`Expected at least one policy after 'authorize'`,s),null;let c=new RequirementParser(t,o,s).parse();return c===null?null:{kind:`AuthorizeSyntax`,requirement:c,location:s}}function combineAuthorize(e,t){return e===null?t:t===null?e:{kind:`AuthorizeSyntax`,requirement:{kind:`LogicalPolicyRequirementSyntax`,left:e.requirement,operator:`And`,right:t.requirement,location:e.location},location:e.location}}function tokenize(e){let t=[];for(let n of e.match(i)??[])t.length>0&&isOperandEnd(t[t.length-1])&&isOperandStart(n)&&t.push(`and`),t.push(n);return t}const isName=e=>e!==`(`&&e!==`)`&&e!==`and`&&e!==`or`,isOperandEnd=e=>e===`)`||isName(e),isOperandStart=e=>e===`(`||isName(e);var RequirementParser=class{context;tokens;location;#e=0;constructor(e,t,n){this.context=e,this.tokens=t,this.location=n}parse(){let t=this.#t();return t!==null&&this.#e<this.tokens.length&&this.context.error(e.UnexpectedTokenInAuthorize,`Unexpected '${this.tokens[this.#e]}' in authorize`,this.location),t}#t(){return this.#r(`or`,`Or`,()=>this.#n())}#n(){return this.#r(`and`,`And`,()=>this.#i())}#r(e,t,n){let r=n();for(;r!==null&&this.tokens[this.#e]===e;){this.#e++;let e=n();if(e===null)return null;r={kind:`LogicalPolicyRequirementSyntax`,left:r,operator:t,right:e,location:this.location}}return r}#i(){if(this.tokens[this.#e]!==`(`)return this.#a();this.#e++;let t=this.#t();return this.tokens[this.#e]===`)`?this.#e++:this.context.error(e.UnclosedAuthorizeGroup,`Expected ')' in authorize`,this.location),t}#a(){if(this.#e>=this.tokens.length)return this.context.error(e.AuthorizeWithoutPolicy,`Expected a policy name`,this.location),null;let t=this.tokens[this.#e++];return a.test(t)?{kind:`PolicyReferenceSyntax`,name:t,location:this.location}:(this.context.error(e.InvalidPolicyReference,`Invalid policy reference '${t}' - policy names are PascalCase identifiers`,this.location),null)}};export{combineAuthorize,parseAuthorize};
|
|
2
|
+
//# sourceMappingURL=AuthorizeParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthorizeParser.js","names":["continuationPattern","pattern","tokenPattern","namePattern","text","line","child","context","tokens","location","locationOf","DiagnosticCodes","requirement","first","next","token","#or","#position","#chain","#and","#groupOrReference","left","operand","right","#reference"],"sources":["../../../../../../Compiler/Parsing/AuthorizeParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax, LogicalOperator, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst continuationPattern = pattern('^(?:(?:or|and)\\\\s+)?[A-Za-z_(][\\\\w\\\\s()]*$');\nconst tokenPattern = new RegExp(pattern('\\\\(|\\\\)|[A-Za-z_]\\\\w*').source, 'gu');\nconst namePattern = pattern('^[A-Z]\\\\w*$');\n\n// The port of the C# AuthorizeParser: the requirement may continue on the lines below the 'authorize', and\n// two operands written side by side are joined by an implicit 'and'.\nexport function parseAuthorize(context: ParserContext, line: SourceLine): AuthorizeSyntax | null {\n let text = line.content.substring('authorize'.length);\n for (let child = context.peekChild(line.indent); child !== undefined && continuationPattern.test(child.content); child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n text += ` ${child.content}`;\n }\n const tokens = tokenize(text);\n const location = locationOf(line);\n if (tokens.length === 0) {\n context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected at least one policy after \\'authorize\\'', location);\n return null;\n }\n const parser = new RequirementParser(context, tokens, location);\n const requirement = parser.parse();\n return requirement === null ? null : { kind: 'AuthorizeSyntax', requirement, location };\n}\n\n// Several 'authorize' lines on one construct all have to hold, so they combine with 'and'.\nexport function combineAuthorize(first: AuthorizeSyntax | null, next: AuthorizeSyntax | null): AuthorizeSyntax | null {\n if (first === null) return next;\n if (next === null) return first;\n return {\n kind: 'AuthorizeSyntax',\n requirement: { kind: 'LogicalPolicyRequirementSyntax', left: first.requirement, operator: 'And', right: next.requirement, location: first.location },\n location: first.location,\n };\n}\n\nfunction tokenize(text: string): string[] {\n const tokens: string[] = [];\n for (const token of text.match(tokenPattern) ?? []) {\n if (tokens.length > 0 && isOperandEnd(tokens[tokens.length - 1]) && isOperandStart(token)) {\n tokens.push('and');\n }\n tokens.push(token);\n }\n return tokens;\n}\n\nconst isName = (token: string): boolean => token !== '(' && token !== ')' && token !== 'and' && token !== 'or';\nconst isOperandEnd = (token: string): boolean => token === ')' || isName(token);\nconst isOperandStart = (token: string): boolean => token === '(' || isName(token);\n\n// The port of the C# LogicalConditionParser: 'or' over 'and' over a group or a policy name.\nclass RequirementParser {\n #position = 0;\n\n constructor(private readonly context: ParserContext, private readonly tokens: readonly string[], private readonly location: SourceLocation) {}\n\n parse(): PolicyRequirementSyntax | null {\n const requirement = this.#or();\n if (requirement !== null && this.#position < this.tokens.length) {\n this.context.error(DiagnosticCodes.UnexpectedTokenInAuthorize, `Unexpected '${this.tokens[this.#position]}' in authorize`, this.location);\n }\n return requirement;\n }\n\n #or(): PolicyRequirementSyntax | null {\n return this.#chain('or', 'Or', () => this.#and());\n }\n\n #and(): PolicyRequirementSyntax | null {\n return this.#chain('and', 'And', () => this.#groupOrReference());\n }\n\n #chain(token: string, operator: LogicalOperator, operand: () => PolicyRequirementSyntax | null): PolicyRequirementSyntax | null {\n let left = operand();\n while (left !== null && this.tokens[this.#position] === token) {\n this.#position++;\n const right = operand();\n if (right === null) {\n return null;\n }\n left = { kind: 'LogicalPolicyRequirementSyntax', left, operator, right, location: this.location };\n }\n return left;\n }\n\n #groupOrReference(): PolicyRequirementSyntax | null {\n if (this.tokens[this.#position] !== '(') {\n return this.#reference();\n }\n this.#position++;\n const requirement = this.#or();\n if (this.tokens[this.#position] === ')') {\n this.#position++;\n } else {\n this.context.error(DiagnosticCodes.UnclosedAuthorizeGroup, 'Expected \\')\\' in authorize', this.location);\n }\n return requirement;\n }\n\n #reference(): PolicyRequirementSyntax | null {\n if (this.#position >= this.tokens.length) {\n this.context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected a policy name', this.location);\n return null;\n }\n const token = this.tokens[this.#position++];\n if (!namePattern.test(token)) {\n this.context.error(DiagnosticCodes.InvalidPolicyReference, `Invalid policy reference '${token}' - policy names are PascalCase identifiers`, this.location);\n return null;\n }\n return { kind: 'PolicyReferenceSyntax', name: token, location: this.location };\n }\n}\n"],"mappings":"oNAUA,MAAMA,EAAsBC,EAAQ,4CAA4C,EAC1EC,EAAe,IAAI,OAAOD,EAAQ,uBAAuB,CAAC,CAAC,OAAQ,IAAI,EACvEE,EAAcF,EAAQ,aAAa,EAIzC,SAAgB,eAAe,EAAwB,EAA0C,CAC7F,IAAIG,EAAOC,EAAK,QAAQ,UAAU,CAAkB,EACpD,IAAK,IAAIC,EAAQC,EAAQ,UAAUF,EAAK,MAAM,EAAGC,IAAU,IAAA,IAAaN,EAAoB,KAAKM,EAAM,OAAO,EAAG,EAAQC,EAAQ,UAAUF,EAAK,MAAM,EAClJE,EAAQ,OAAO,gBAAgB,EAC/B,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import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{nativePattern as t,pattern as n}from"../Text/patterns.js";import{stringBodyPattern as r,unescapeString as i}from"../Text/StringLiteral.js";import{parseModeledMappingSource as a}from"./ExpressionParser.js";import{firstWord as o,unescapeIdentifier as s}from"./LineText.js";import{locationOf as c}from"./SourceLine.js";import"../Syntax/CaptureEventsSource.js";import{parseTag as l}from"./DeclarationParsers.js";import{parseProjectionExpression as u}from"./ProjectionExpressionParser.js";const grammar=e=>({legacy:n(e),native:t(e)}),d=grammar(`^capture\\s+([A-Za-z_]\\w*)$`),f=/^[A-Za-z_][\w.]*$/,p=grammar(`^append\\s+([A-Z]\\w*)$`),m=grammar(`^children\\s+([a-z_]\\w*)\\s+identified\\s+by\\s+([\\w.]+)$`),h=grammar(`^nested\\s+([\\w.]+)$`),select=(e,t)=>e.sourceOptions.numericMode===`exact`?t.native:t.legacy,g=t(`^(@?[\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),_=t(`^([a-z_]\\w*)\\s*=\\s*(.+)$`),v=t(`^"(${r})"\\s*=>\\s*(\\w+)$`),y=t(`^split\\s+(\\S+)\\s+by\\s+"(${r})"$`),b=new RegExp(t(`"${r}"|[\\w.]+`).source,`gu`),x=t(`^[\\w.]+$`);function parseCapture(t,n){let r=t;t=t.valueContext;let i=select(t,d).exec(n.content)?.[1]??``;i===``&&t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidCaptureDeclaration,`Invalid capture declaration '${n.content}' - expected 'capture <Name>'`,c(n));let a=null,s=null,l=[],u=[],f=[],p=[];for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent))switch(t.reader.takeSignificant(),o(i.content)){case`source`:a=parseSource(t,i,r);break;case`key`:s=i.content.substring(3).trim();break;case`map`:l.push(...parseMap(t,i));break;case`append`:pushAppend(t,i,u);break;case`children`:{let n=select(t,m).exec(i.content);if(n===null){t.error(e.InvalidChildrenDeclaration,`Invalid children declaration '${i.content}' - expected 'children <collection> identified by <key>'`,c(i)),t.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(t,i);n!==null&&f.push({kind:`CaptureChildrenSyntax`,property:n[1],identifiedBy:n[2],...r,location:c(i)});break}case`nested`:{let n=select(t,h).exec(i.content);if(n===null){t.error(e.InvalidNestedDeclaration,`Invalid nested declaration '${i.content}' - expected 'nested <Property>'`,c(i)),t.skipOpaqueBlock(i.indent);break}let r=mapAndAppends(t,i);n!==null&&p.push({kind:`CaptureNestedSyntax`,property:n[1],...r,location:c(i)});break}default:t.error(e.UnknownCaptureDirective,`Unexpected '${i.content}' in capture body`,c(i)),t.skipOpaqueBlock(i.indent)}return{kind:`CaptureSyntax`,sourceOptions:t.sourceOptions,name:i,source:a,key:s,map:l,appends:u,children:f,nested:p,location:c(n)}}function parseSource(e,t,n){let r=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){e.reader.takeSignificant();let t=o(n.content);r.push({kind:`CaptureSourceSettingSyntax`,name:t,value:n.content.substring(t.length).trim(),location:c(n)})}let i=t.content.substring(6).trim();return i===`events`&&validateEventsSource(n,t,r),{kind:`CaptureSourceSyntax`,syntaxKind:i,settings:r,location:c(t)}}function validateEventsSource(t,n,r){r.length===0&&t.error(e.InvalidCaptureEventsSource,`'source events' needs at least one 'from <Event>' line naming a public event to consume`,c(n));let i=/* @__PURE__ */ new Set;for(let n of r)n.name===`from`?f.test(n.value)?i.has(n.value)?t.error(e.InvalidCaptureEventsSource,`Event '${n.value}' is already consumed by this 'source events'`,n.location):i.add(n.value):t.error(e.InvalidCaptureEventsSource,`Invalid event '${n.value}' - expected 'from <Event>', optionally qualified with dots`,n.location):t.error(e.InvalidCaptureEventsSource,`'source events' accepts only 'from <Event>' lines, got '${n.name}'`,n.location)}function parseMap(t,n){let r=[];for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent)){t.reader.takeSignificant();let n=c(a);if(o(a.content)===`split`){let o=y.exec(a.content);if(o===null){t.error(e.InvalidSplitDeclaration,`Invalid split operation '${a.content}' - expected 'split <property> by "<separator>"'`,n),t.skipOpaqueBlock(a.indent);continue}let s=[];for(let n=t.peekChild(a.indent);n!==void 0;n=t.peekChild(a.indent))t.reader.takeSignificant(),x.test(n.content)?s.push(n.content):t.error(e.InvalidSplitTarget,`Invalid split target '${n.content}' - expected a property path`,c(n));o!==null&&r.push({kind:`CaptureSplitSyntax`,source:u(o[1],n,t),separator:i(o[2]),targets:s,location:n});continue}let s=_.exec(a.content);if(s===null){t.error(e.InvalidMapEntry,`Invalid map entry '${a.content}' - expected '<property> = <source> [translate]'`,n),t.skipOpaqueBlock(a.indent);continue}let l=s[2].trim(),d=l.startsWith("`")?l.indexOf("`",1):-1,f=l.startsWith("`")?d>=0&&l.substring(d+1).trim()===`translate`:l.endsWith(` translate`),p=l.startsWith("`")&&d>=0&&(t.sourceOptions.numericMode!==`exact`||f||l.substring(d+1).trim()===``)?l.substring(0,d+1):f?l.substring(0,l.length-10).trimEnd():l,m=[];if(f)for(let n=t.peekChild(a.indent);n!==void 0;n=t.peekChild(a.indent)){t.reader.takeSignificant();let r=v.exec(n.content);r===null?t.error(e.InvalidTranslation,`Invalid translation '${n.content}' - expected '"<source>" => <target>'`,c(n)):m.push({kind:`CaptureTranslationSyntax`,from:i(r[1]),to:r[2],location:c(n)})}r.push({kind:`CaptureMapEntrySyntax`,property:s[1],source:u(p,n,t),translations:m,location:n})}return r}function mapAndAppends(t,n){let r=[],i=[];for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent))t.reader.takeSignificant(),o(a.content)===`map`?r=parseMap(t,a):o(a.content)===`append`?pushAppend(t,a,i):(t.error(e.UnknownCaptureBlockDirective,`Unexpected '${a.content}' in ${o(n.content)} block - expected 'map' or 'append <EventType>'`,c(a)),t.skipOpaqueBlock(a.indent));return{map:r,appends:i}}function pushAppend(t,n,r){let i=select(t,p).exec(n.content);if(i===null){t.error(e.InvalidAppendDeclaration,`Invalid append declaration '${n.content}' - expected 'append <EventType>'`,c(n)),t.skipOpaqueBlock(n.indent);return}let u=[],d=[],f=null,mapping=(n,r=!1)=>{let i=c(n);if(o(n.content)===`tag`){let e=l(t.valueContext,n,!1);e!==void 0&&d.push(e);return}let f=g.exec(n.content);f===null?t.error(r?e.InvalidPropertyMapping:e.UnknownAppendDirective,`Unexpected '${n.content}' in append body`,i):u.push({kind:`PropertyMappingSyntax`,property:s(f[1]),source:a(f[2],i,t.valueContext),location:i})};for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),o(e.content)===`when`){f=parseWhen(t,e);for(let n=t.peekChild(e.indent);n!==void 0;n=t.peekChild(e.indent))t.reader.takeSignificant(),mapping(n,!0)}else mapping(e);r.push({kind:`CaptureAppendSyntax`,event:i[1],when:f,mappings:u,tags:d,location:c(n)})}function parseWhen(t,n){let r=n.content.substring(4).trim(),a=c(n),value=(e,t=[],n=null,r=null,i=null)=>({kind:`CaptureWhenSyntax`,syntaxKind:e,properties:t,fromValue:n,toValue:r,expression:i,location:a});if(r===`added`)return value(`Added`);if(r===`removed`)return value(`Removed`);if(r.startsWith("`"))return(!r.endsWith("`")||r.length<2)&&t.error(e.UnterminatedTemplateExpression,`Unterminated template expression in 'when' - expected a closing backtick`,a),value(`Expression`,[],null,null,r);if(r.length===0)return t.error(e.WhenWithoutTrigger,`Expected a trigger after 'when'`,a),null;let o=[...r.match(t.sourceOptions.numericMode===`exact`?/* @__PURE__ */ RegExp(`"(?:[^"\\\\]|\\\\.)*"|[^\\s]+`,`gu`):b)??[]],unquote=e=>e.startsWith(`"`)&&e.endsWith(`"`)?i(e.substring(1,e.length-1)):e;if(o.length===0)return t.error(e.InvalidWhenClause,`Invalid 'when' clause '${n.content}'`,a),null;if(o.length===1)return value(`PropertyChanged`,[unquote(o[0])]);if(o[1]===`from`)return o.length===5&&o[3]===`to`?value(`ValueTransition`,[unquote(o[0])],unquote(o[2]),unquote(o[4])):(t.error(e.InvalidWhenTransitionClause,`Invalid 'when ... from ... to ...' clause '${n.content}'`,a),null);if(o[1]!==`or`&&o[1]!==`and`)return t.error(e.InvalidWhenClause,`Invalid 'when' clause '${n.content}'`,a),null;if(o.length%2==0)return t.error(e.WhenCombinatorWithoutProperty,`Expected a property after '${o[1]}'`,a),null;let s=[unquote(o[0])];for(let r=1;r<o.length-1;r+=2){if(o[r]!==o[1])return t.error(e.MixedWhenCombinators,`Cannot mix 'and' and 'or' in a single 'when' clause '${n.content}'`,a),null;s.push(unquote(o[r+1]))}return value(o[1]===`or`?`LogicalOr`:`LogicalAnd`,s)}export{parseCapture};
|
|
2
|
+
//# sourceMappingURL=CaptureParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptureParser.js","names":["legacyPattern","pattern","parseMappingSource","pattern","source","nativePattern","headerRules","eventNameRules","appendRules","childrenRules","nestedRules","context","rules","mappingPattern","mapEntryPattern","translationPattern","stringBodyPattern","splitPattern","whenTokens","splitTarget","owner","name","line","DiagnosticCodes","locationOf","key","map","appends","children","nested","child","firstWord","match","body","settings","settingName","syntaxKind","seen","setting","location","targets","target","parseProjectionExpression","unescapeString","raw","closing","translate","text","translations","entry","translated","mappings","tags","when","tag","parseTag","mapped","unescapeIdentifier","parseModeledMappingSource","value","trigger","from","to","tokens","properties","index"],"sources":["../../../../../../Compiler/Parsing/CaptureParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CaptureAppendSyntax, CaptureChildrenSyntax, CaptureMapOperationSyntax, CaptureNestedSyntax, CaptureSourceSettingSyntax, CaptureSourceSyntax, CaptureSyntax, CaptureTranslationSyntax, CaptureWhenSyntax } from '../Syntax/Captures';\nimport { eventsSourceKind, fromSetting } from '../Syntax/CaptureEventsSource';\nimport { TagSyntax } from '../Syntax/Declarations';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { nativePattern as pattern, pattern as legacyPattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseTag } from './DeclarationParsers';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// The grammar Legacy already modeled keeps its original patterns; native patterns apply to Exact documents.\nconst grammar = (source: string): { legacy: RegExp; native: RegExp } => ({ legacy: legacyPattern(source), native: pattern(source) });\nconst headerRules = grammar('^capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventNameRules = /^[A-Za-z_][\\w.]*$/;\nconst appendRules = grammar('^append\\\\s+([A-Z]\\\\w*)$');\nconst childrenRules = grammar('^children\\\\s+([a-z_]\\\\w*)\\\\s+identified\\\\s+by\\\\s+([\\\\w.]+)$');\nconst nestedRules = grammar('^nested\\\\s+([\\\\w.]+)$');\nconst select = (context: ParserContext, rules: { legacy: RegExp; native: RegExp }): RegExp => context.sourceOptions.numericMode === 'exact' ? rules.native : rules.legacy;\nconst mappingPattern = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst mapEntryPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst translationPattern = pattern(`^\"(${stringBodyPattern})\"\\\\s*=>\\\\s*(\\\\w+)$`);\nconst splitPattern = pattern(`^split\\\\s+(\\\\S+)\\\\s+by\\\\s+\"(${stringBodyPattern})\"$`);\nconst whenTokens = new RegExp(pattern(`\"${stringBodyPattern}\"|[\\\\w.]+`).source, 'gu');\nconst splitTarget = pattern('^[\\\\w.]+$');\n\n// A structural port of the existing capture grammar. Transition operands remain authored strings, as\n// C# models them; exact numeric mode is not admitted by any supported executable model (ESM) version yet (#285).\nexport function parseCapture(context: ParserContext, line: SourceLine): CaptureSyntax {\n // The events source is new grammar, so its violations reach the owning context rather than the quiet value context.\n const owner = context;\n context = context.valueContext;\n const name = select(context, headerRules).exec(line.content)?.[1] ?? '';\n if (name === '' && context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCaptureDeclaration, `Invalid capture declaration '${line.content}' - expected 'capture <Name>'`, locationOf(line));\n let source: CaptureSourceSyntax | null = null;\n let key: string | null = null;\n const map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n const children: CaptureChildrenSyntax[] = [];\n const nested: CaptureNestedSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'source': source = parseSource(context, child, owner); break;\n case 'key': key = child.content.substring('key'.length).trim(); break;\n case 'map': map.push(...parseMap(context, child)); break;\n case 'append': pushAppend(context, child, appends); break;\n case 'children': {\n const match = select(context, childrenRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${child.content}' - expected 'children <collection> identified by <key>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) children.push({ kind: 'CaptureChildrenSyntax', property: match[1], identifiedBy: match[2], ...body, location: locationOf(child) });\n break;\n }\n case 'nested': {\n const match = select(context, nestedRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${child.content}' - expected 'nested <Property>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) nested.push({ kind: 'CaptureNestedSyntax', property: match[1], ...body, location: locationOf(child) });\n break;\n }\n default:\n context.error(DiagnosticCodes.UnknownCaptureDirective, `Unexpected '${child.content}' in capture body`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'CaptureSyntax', sourceOptions: context.sourceOptions, name, source, key, map, appends, children, nested, location: locationOf(line) };\n}\n\nfunction parseSource(context: ParserContext, line: SourceLine, owner: ParserContext): CaptureSourceSyntax {\n const settings: CaptureSourceSettingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const settingName = firstWord(child.content);\n settings.push({ kind: 'CaptureSourceSettingSyntax', name: settingName, value: child.content.substring(settingName.length).trim(), location: locationOf(child) });\n }\n const syntaxKind = line.content.substring('source'.length).trim();\n if (syntaxKind === eventsSourceKind) validateEventsSource(owner, line, settings);\n return { kind: 'CaptureSourceSyntax', syntaxKind, settings, location: locationOf(line) };\n}\n\nfunction validateEventsSource(context: ParserContext, line: SourceLine, settings: readonly CaptureSourceSettingSyntax[]): void {\n if (settings.length === 0) context.error(DiagnosticCodes.InvalidCaptureEventsSource, \"'source events' needs at least one 'from <Event>' line naming a public event to consume\", locationOf(line));\n const seen = new Set<string>();\n for (const setting of settings) {\n if (setting.name !== fromSetting) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `'source events' accepts only 'from <Event>' lines, got '${setting.name}'`, setting.location);\n else if (!eventNameRules.test(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Invalid event '${setting.value}' - expected 'from <Event>', optionally qualified with dots`, setting.location);\n else if (seen.has(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Event '${setting.value}' is already consumed by this 'source events'`, setting.location);\n else seen.add(setting.value);\n }\n}\n\nfunction parseMap(context: ParserContext, line: SourceLine): CaptureMapOperationSyntax[] {\n const map: CaptureMapOperationSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const location = locationOf(child);\n if (firstWord(child.content) === 'split') {\n const match = splitPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidSplitDeclaration, `Invalid split operation '${child.content}' - expected 'split <property> by \"<separator>\"'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const targets: string[] = [];\n for (let target = context.peekChild(child.indent); target !== undefined; target = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (splitTarget.test(target.content)) targets.push(target.content);\n else context.error(DiagnosticCodes.InvalidSplitTarget, `Invalid split target '${target.content}' - expected a property path`, locationOf(target));\n }\n if (match !== null) map.push({ kind: 'CaptureSplitSyntax', source: parseProjectionExpression(match[1], location, context), separator: unescapeString(match[2]), targets, location });\n continue;\n }\n const match = mapEntryPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidMapEntry, `Invalid map entry '${child.content}' - expected '<property> = <source> [translate]'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const raw = match[2].trim();\n const closing = raw.startsWith('`') ? raw.indexOf('`', 1) : -1;\n const translate = raw.startsWith('`') ? closing >= 0 && raw.substring(closing + 1).trim() === 'translate' : raw.endsWith(' translate');\n const text = raw.startsWith('`') && closing >= 0 && (context.sourceOptions.numericMode !== 'exact' || translate || raw.substring(closing + 1).trim() === '') ? raw.substring(0, closing + 1) : translate ? raw.substring(0, raw.length - ' translate'.length).trimEnd() : raw;\n const translations: CaptureTranslationSyntax[] = [];\n if (translate) {\n for (let entry = context.peekChild(child.indent); entry !== undefined; entry = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const translated = translationPattern.exec(entry.content);\n if (translated !== null) translations.push({ kind: 'CaptureTranslationSyntax', from: unescapeString(translated[1]), to: translated[2], location: locationOf(entry) });\n else context.error(DiagnosticCodes.InvalidTranslation, `Invalid translation '${entry.content}' - expected '\"<source>\" => <target>'`, locationOf(entry));\n }\n }\n map.push({ kind: 'CaptureMapEntrySyntax', property: match[1], source: parseProjectionExpression(text, location, context), translations, location });\n }\n return map;\n}\n\nfunction mapAndAppends(context: ParserContext, line: SourceLine): { map: CaptureMapOperationSyntax[]; appends: CaptureAppendSyntax[] } {\n let map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'map') map = parseMap(context, child);\n else if (firstWord(child.content) === 'append') pushAppend(context, child, appends);\n else {\n context.error(DiagnosticCodes.UnknownCaptureBlockDirective, `Unexpected '${child.content}' in ${firstWord(line.content)} block - expected 'map' or 'append <EventType>'`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { map, appends };\n}\n\nfunction pushAppend(context: ParserContext, line: SourceLine, appends: CaptureAppendSyntax[]): void {\n const match = select(context, appendRules).exec(line.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidAppendDeclaration, `Invalid append declaration '${line.content}' - expected 'append <EventType>'`, locationOf(line)); context.skipOpaqueBlock(line.indent); return; }\n const mappings: PropertyMappingSyntax[] = [];\n const tags: TagSyntax[] = [];\n let when: CaptureWhenSyntax | null = null;\n const mapping = (child: SourceLine, nested = false): void => {\n const location = locationOf(child);\n if (firstWord(child.content) === 'tag') {\n const tag = parseTag(context.valueContext, child, false);\n if (tag !== undefined) tags.push(tag);\n return;\n }\n const mapped = mappingPattern.exec(child.content);\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: unescapeIdentifier(mapped[1]), source: parseMappingSource(mapped[2], location, context.valueContext), location });\n else context.error(nested ? DiagnosticCodes.InvalidPropertyMapping : DiagnosticCodes.UnknownAppendDirective, `Unexpected '${child.content}' in append body`, location);\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'when') {\n when = parseWhen(context, child);\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n mapping(value, true);\n }\n } else mapping(child);\n }\n appends.push({ kind: 'CaptureAppendSyntax', event: match[1], when, mappings, tags, location: locationOf(line) });\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine): CaptureWhenSyntax | null {\n const trigger = line.content.substring('when'.length).trim();\n const location = locationOf(line);\n const value = (syntaxKind: CaptureWhenSyntax['syntaxKind'], properties: string[] = [], from: string | null = null, to: string | null = null, expression: string | null = null): CaptureWhenSyntax => ({ kind: 'CaptureWhenSyntax', syntaxKind, properties, fromValue: from, toValue: to, expression, location });\n if (trigger === 'added') return value('Added');\n if (trigger === 'removed') return value('Removed');\n if (trigger.startsWith('`')) {\n if (!trigger.endsWith('`') || trigger.length < 2) context.error(DiagnosticCodes.UnterminatedTemplateExpression, \"Unterminated template expression in 'when' - expected a closing backtick\", location);\n return value('Expression', [], null, null, trigger);\n }\n if (trigger.length === 0) { context.error(DiagnosticCodes.WhenWithoutTrigger, \"Expected a trigger after 'when'\", location); return null; }\n const tokens: string[] = [...(trigger.match(context.sourceOptions.numericMode === 'exact' ? new RegExp(`\"${stringBodyPattern}\"|[^\\\\s]+`, 'gu') : whenTokens) ?? [])];\n const unquote = (text: string): string => text.startsWith('\"') && text.endsWith('\"') ? unescapeString(text.substring(1, text.length - 1)) : text;\n if (tokens.length === 0) { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length === 1) return value('PropertyChanged', [unquote(tokens[0])]);\n if (tokens[1] === 'from') {\n if (tokens.length === 5 && tokens[3] === 'to') return value('ValueTransition', [unquote(tokens[0])], unquote(tokens[2]), unquote(tokens[4]));\n context.error(DiagnosticCodes.InvalidWhenTransitionClause, `Invalid 'when ... from ... to ...' clause '${line.content}'`, location); return null;\n }\n if (tokens[1] !== 'or' && tokens[1] !== 'and') { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length % 2 === 0) { context.error(DiagnosticCodes.WhenCombinatorWithoutProperty, `Expected a property after '${tokens[1]}'`, location); return null; }\n const properties = [unquote(tokens[0])];\n for (let index = 1; index < tokens.length - 1; index += 2) {\n if (tokens[index] !== tokens[1]) { context.error(DiagnosticCodes.MixedWhenCombinators, `Cannot mix 'and' and 'or' in a single 'when' clause '${line.content}'`, location); return null; }\n properties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C,EACtC,IAAK,IAAIE,EAAQ,EAAGA,EAAQF,EAAO,OAAS,EAAG,GAAS,EAAG,CACvD,GAAIA,EAAOE,KAAWF,EAAO,GAA8I,OAAxIpD,EAAQ,MAAMY,EAAgB,qBAAsB,wDAAwDD,EAAK,QAAQ,GAAIiB,CAAQ,EAAU,KAClLyB,EAAW,KAAK,QAAQD,EAAOE,EAAQ,EAAE,CAAC,CAC9C,CACA,OAAO,MAAMF,EAAO,KAAO,KAAO,YAAc,aAAcC,CAAU,CAC5E"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{locationOf as t}from"./SourceLine.js";function parseFencedText(n,r,i,a=!1){let o=i.content.startsWith("```")?i:n.reader.peekSignificant(),s=r===`description`?"```text":`\`\`\`${r}`;if(o===void 0||o!==i&&o.indent<=i.indent||o.content!==s&&!(a&&r===`description`&&o.content==="```markdown")&&(o.content!=="```"||o===i))return n.error(e.ExpectedCodeFence,`Expected an opening \`\`\`${r===`description`?`text`:r} fence after '${r}'`,t(i)),null;o!==i&&n.reader.takeSignificant(),r===`description`&&o.content==="```"&&n.warning(e.LegacyInlineCodeFence,"A bare description fence is deprecated - use '```text' instead",t(o));let c=[];for(;;){let r=n.reader.takeRaw();if(r===void 0){n.error(e.UnclosedCodeBlock,"Unclosed inline code block - expected a closing ``` line",t(o));break}if(r.raw.trim()==="```")break;let i=0;for(;i<o.indent&&i<r.raw.length&&r.raw[i]===` `;)i++;c.push(r.raw.substring(i))}return c.join(`
|
|
2
|
+
`)}export{parseFencedText};
|
|
3
|
+
//# sourceMappingURL=CodeBlockParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlockParser.js","names":["open","tagLine","context","expectedFence","opener","allowMarkdown","DiagnosticCodes","locationOf","code","line","strip"],"sources":["../../../../../../Compiler/Parsing/CodeBlockParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads the body of a fenced block that follows a directive, the way the C# CodeBlockParser does: the\n// opening fence is either on the directive's own line or the next deeper line, and the body runs to a line\n// holding only the closing fence. Body lines lose up to the opening fence's indent.\nexport function parseFencedText(context: ParserContext, opener: string, tagLine: SourceLine, allowMarkdown = false): string | null {\n const onTagLine = tagLine.content.startsWith('```');\n const open = onTagLine ? tagLine : context.reader.peekSignificant();\n const expectedFence = opener === 'description' ? '```text' : `\\`\\`\\`${opener}`;\n if (open === undefined || (open !== tagLine && open.indent <= tagLine.indent) ||\n (open.content !== expectedFence && !(allowMarkdown && opener === 'description' && open.content === '```markdown') && !(open.content === '```' && open !== tagLine))) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected an opening \\`\\`\\`${opener === 'description' ? 'text' : opener} fence after '${opener}'`, locationOf(tagLine));\n return null;\n }\n if (open !== tagLine) {\n context.reader.takeSignificant();\n }\n if (opener === 'description' && open.content === '```') {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, 'A bare description fence is deprecated - use \\'```text\\' instead', locationOf(open));\n }\n const code: string[] = [];\n for (;;) {\n const line = context.reader.takeRaw();\n if (line === undefined) {\n context.error(DiagnosticCodes.UnclosedCodeBlock, 'Unclosed inline code block - expected a closing ``` line', locationOf(open));\n break;\n }\n if (line.raw.trim() === '```') {\n break;\n }\n let strip = 0;\n while (strip < open.indent && strip < line.raw.length && line.raw[strip] === ' ') {\n strip++;\n }\n code.push(line.raw.substring(strip));\n }\n return code.join('\\n');\n}\n"],"mappings":"sKAUA,SAAgB,gBAAgB,EAAwB,EAAgB,EAAqB,EAAgB,GAAsB,CAE/H,IAAMA,EADYC,EAAQ,QAAQ,WAAW,KACxB,EAAIA,EAAUC,EAAQ,OAAO,gBAAgB,EAC5DC,EAAgBC,IAAW,cAAgB,UAAY,SAASA,IACtE,GAAIJ,IAAS,IAAA,IAAcA,IAASC,GAAWD,EAAK,QAAUC,EAAQ,QACjED,EAAK,UAAYG,GAAiB,EAAEE,GAAiBD,IAAW,eAAiBJ,EAAK,UAAY,iBAAoBA,EAAK,UAAY,OAASA,IAASC,GAE1J,OADAC,EAAQ,MAAMI,EAAgB,kBAAmB,6BAA6BF,IAAW,cAAgB,OAASA,EAAO,gBAAgBA,EAAO,GAAIG,EAAWN,CAAO,CAAC,EAChK,KAEPD,IAASC,GACTC,EAAQ,OAAO,gBAAgB,EAE/BE,IAAW,eAAiBJ,EAAK,UAAY,OAC7CE,EAAQ,QAAQI,EAAgB,sBAAuB,iEAAoEC,EAAWP,CAAI,CAAC,EAE/I,IAAMQ,EAAiB,CAAC,EACxB,OAAS,CACL,IAAMC,EAAOP,EAAQ,OAAO,QAAQ,EACpC,GAAIO,IAAS,IAAA,GAAW,CACpBP,EAAQ,MAAMI,EAAgB,kBAAmB,2DAA4DC,EAAWP,CAAI,CAAC,EAC7H,KACJ,CACA,GAAIS,EAAK,IAAI,KAAK,IAAM,MACpB,MAEJ,IAAIC,EAAQ,EACZ,KAAOA,EAAQV,EAAK,QAAUU,EAAQD,EAAK,IAAI,QAAUA,EAAK,IAAIC,KAAW,KACzE,IAEJF,EAAK,KAAKC,EAAK,IAAI,UAAUC,CAAK,CAAC,CACvC,CACA,OAAOF,EAAK,KAAK;CAAI,CACzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{implicitDestination as e}from"../Syntax/ProductionDestinations.js";import{uniqueByName as t}from"./ResponseValidator.js";function commandPathType(e,n,r){let i=t(r.types),a=e.properties,o=null,s=!1,c=!1;for(let e of n.split(`.`)){let t=a.filter(t=>t.name===e);if(t.length!==1)return null;let n=t[0].type;s||=n.isOptional,c||=n.isCollection,o={...n,isOptional:s,isCollection:c},a=i.get(n.name)?.properties??[]}return o}function commandDestinationType(t,n,r,i){let a=n.for?.kind===`PathExpressionSyntax`?n.for.path:e(t,n,i);return a===`new event source`?t.properties.find(e=>e.isGenerated&&e.isIdentifier)?.type??{kind:`TypeRefSyntax`,name:`Uuid`,isOptional:!1,isCollection:!1,location:n.location}:a===void 0?null:commandPathType(t,a,r)}export{commandDestinationType,commandPathType};
|
|
2
|
+
//# sourceMappingURL=CommandDestinationTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandDestinationTypes.js","names":["composites","uniqueByName","application","fields","command","result","optional","collection","segment","path","matches","field","type","destination","produced","implicitDestination","context","property"],"sources":["../../../../../../Compiler/Parsing/CommandDestinationTypes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { ProductionDestinationContext } from '../Syntax/ProductionDestinationContext';\nimport { implicitDestination } from '../Syntax/ProductionDestinations';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function commandPathType(command: CommandSyntax, path: string, application: ApplicationSyntax): TypeRefSyntax | null {\n const composites = uniqueByName(application.types);\n let fields = command.properties;\n let result: TypeRefSyntax | null = null;\n let optional = false;\n let collection = false;\n for (const segment of path.split('.')) {\n const matches = fields.filter(field => field.name === segment);\n if (matches.length !== 1) return null;\n const type = matches[0].type;\n optional ||= type.isOptional;\n collection ||= type.isCollection;\n result = { ...type, isOptional: optional, isCollection: collection };\n fields = composites.get(type.name)?.properties ?? [];\n }\n return result;\n}\n\nexport function commandDestinationType(command: CommandSyntax, produced: ProducesSyntax, application: ApplicationSyntax, context: ProductionDestinationContext): TypeRefSyntax | null {\n const destination = produced.for?.kind === 'PathExpressionSyntax' ? produced.for.path : implicitDestination(command, produced, context);\n return destination === 'new event source'\n ? command.properties.find(property => property.isGenerated && property.isIdentifier)?.type ?? { kind: 'TypeRefSyntax', name: 'Uuid', isOptional: false, isCollection: false, location: produced.location }\n : destination === undefined ? null : commandPathType(command, destination, application);\n}\n"],"mappings":"qLAWA,SAAgB,gBAAgB,EAAwB,EAAc,EAAsD,CACxH,IAAMA,EAAaC,EAAaC,EAAY,KAAK,EAC7CC,EAASC,EAAQ,WACjBC,EAA+B,KAC/BC,EAAW,GACXC,EAAa,GACjB,IAAK,IAAMC,KAAWC,EAAK,MAAM,GAAG,EAAG,CACnC,IAAMC,EAAUP,EAAO,OAAO,GAASQ,EAAM,OAASH,CAAO,EAC7D,GAAIE,EAAQ,SAAW,EAAG,OAAO,KACjC,IAAME,EAAOF,EAAQ,EAAE,CAAC,KACxB,IAAaE,EAAK,WAClB,IAAeA,EAAK,aACpB,EAAS,CAAE,GAAGA,EAAM,WAAYN,EAAU,aAAcC,CAAW,EACnE,EAASP,EAAW,IAAIY,EAAK,IAAI,CAAC,EAAE,YAAc,CAAC,CACvD,CACA,OAAOP,CACX,CAEA,SAAgB,uBAAuB,EAAwB,EAA0B,EAAgC,EAA6D,CAClL,IAAMQ,EAAcC,EAAS,KAAK,OAAS,uBAAyBA,EAAS,IAAI,KAAOC,EAAoBX,EAASU,EAAUE,CAAO,EACtI,OAAOH,IAAgB,mBACjBT,EAAQ,WAAW,KAAK,GAAYa,EAAS,aAAeA,EAAS,YAAY,CAAC,EAAE,MAAQ,CAAE,KAAM,gBAAiB,KAAM,OAAQ,WAAY,GAAO,aAAc,GAAO,SAAUH,EAAS,QAAS,EACvMD,IAAgB,IAAA,GAAY,KAAO,gBAAgBT,EAASS,EAAaX,CAAW,CAC9F"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{dependencySources as n}from"../Syntax/DependencySources.js";import{stringBodyPattern as r,unescapeString as i}from"../Text/StringLiteral.js";import{parseMappingSource as a}from"./ExpressionParser.js";import{firstWord as o}from"./LineText.js";import{locationOf as s}from"./SourceLine.js";import{reportInvalidModifierOrder as c,reportLegacyOptionalSuffix as l,tryParseProperty as u}from"./PropertyLineParser.js";import{combineAuthorize as d,parseAuthorize as f}from"./AuthorizeParser.js";import{parseDescription as p}from"./DescriptionParser.js";import{parseDocumentation as m}from"./DocumentationParser.js";import{parseCondition as h}from"./ConditionParser.js";import{ParserContext as g}from"./ParserContext.js";import{isReactionIdentityLine as _,misplacedReactionIdentity as v}from"./ReactionIdentityParser.js";import{sourceStreamPattern as y}from"../Text/SourceStreamNames.js";import{parseCommandStream as b}from"./EventSourceParser.js";import{isCode as x,isFile as S,parseCode as C,parseFile as w,parseHandler as T,parseImplementationWrapper as E}from"./ImplementationParser.js";import{parseCommandResponse as D,scalarResponsePattern as O}from"./CommandResponseParser.js";import{commandReadSources as k}from"./CommandReadSources.js";import{captureConcurrency as A,captureReads as j}from"./DependencySourceParser.js";import{parseProduces as M}from"./ProducesParser.js";const N=t(`^command\\s+([A-Za-z_]\\w*)$`),P=y(`^stream\\s+[A-Za-z_]\\w*\\.[A-Za-z_]\\w*$`),F=t(`\\bseverity\\s+(\\S+)$`),I=t(`\\bmessage\\s+(?:"(${r})"|(\\$strings\\.\\S*))$`),L=t(`^([\\w.]+)\\s+(.+)$`),R=t(`^(not empty|length ==|all >=|all >|matches|max|min|rule|>=|<=|==|!=|>|<)\\s*(.*)$`),z=y(`^[A-Za-z_]\\w*$`),B=t(`^reads\\s+[A-Z]\\w*\\s+optional(?:\\s|$)`),V={max:`Max`,min:`Min`,">":`GreaterThan`,">=":`GreaterThanOrEqual`,"<":`LessThan`,"<=":`LessThanOrEqual`,"==":`Equal`,"!=":`NotEqual`,"length ==":`Length`,matches:`Matches`,"all >":`AllGreaterThan`,"all >=":`AllGreaterThanOrEqual`},H={information:`Information`,warning:`Warning`,error:`Error`},U=/* @__PURE__ */ new Set([`reads`,`concurrency`]),W=/* @__PURE__ */ new Set([`description`,`documentation`,`handler`,`concurrency`]);function parseCommand(e,t){let n=/* @__PURE__ */ new Set,r=new g(e.reader.fork(),e.path,e.languages);return r.sourceOptions=e.sourceOptions,r.streamCandidates=e.streamCandidates,parseCommandBody(r,t,void 0,n),parseCommandBody(e,t,n)}function parseCommandBody(t,r,i,a){let l=N.exec(r.content)?.[1]??``;l===``&&t.error(e.InvalidCommandDeclaration,`Invalid command declaration '${r.content}' - expected 'command <Name>'`,s(r));let h=[],g=[],y,x=[],S=[],C=[],w=[],E,F=null,I=null,L=null,R=null,z=null,V=[];for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){t.reader.takeSignificant();let r=o(n.content),a=u(n);if(a!==void 0&&(W.has(r)||r===`validate`&&n.content!==`validate csharp`))y=addProperty(t,h,a,l,n,y);else if(r===`returns`){let e=O.exec(n.content);e!==null&&!e[1].startsWith(`@`)&&a!==void 0?i===void 0?(h.push(a),g.push({line:n,candidate:a,response:null})):i.has(a.type.name)?g.push({line:n,candidate:null,response:D(t,n)}):y=addProperty(t,h,a,l,n,y):a===void 0?c(t,n)?t.skipBlock(n.indent):g.push({line:n,candidate:null,response:D(t,n)}):y=addProperty(t,h,a,l,n,y)}else if(r===`stream`&&P.test(n.content)&&a!==void 0&&t.streamCandidates?.hasSource(a.type.name.split(`.`)[0])===!0){let[r,i]=a.type.name.split(`.`),o=t.streamCandidates.hasPropertyType(a.type.name)&&t.streamCandidates.hasUniqueStream(r,i),c=b(t,n,a,o);(z!==null||V.length>0)&&t.error(e.InvalidCommandStream,`A command declares at most one stream route.`,s(n)),o||z!==null?V.push(c):z=c}else if(r===`runs`&&_(n))v(t,n);else if(r===`description`)F=p(t,n,F,`Command '${l}'`);else if(r===`documentation`)I=m(t,n,I,`Command '${l}'`);else if(r===`authorize`)L=d(L,f(t,n));else if(r===`validate`){let e=parseValidate(t,n,`command`);e!==void 0&&x.push(e)}else if(r===`produces`){let e=M(t,n,!0);e!==void 0&&S.push(e)}else if(r===`handler`)R=T(t,n);else if(U.has(r)){let i=j(n);i!==void 0&&w.push(i),r===`concurrency`&&E===void 0&&(E=A(t,n));let a=/^reads\s+([A-Z]\w*)(?:\s+as\s+([a-z_]\w*))?(?:\s+by\s+([a-z_]\w*))?$/.exec(n.content);a!==null&&C.push({readModel:a[1],alias:a[2]??null}),B.test(n.content)&&t.error(e.OptionalReadsNotSupported,`Optional reads are not yet supported (see #308).`,s(n)),t.skipOpaqueBlock(n.indent)}else a===void 0?(c(t,n),t.error(e.UnknownCommandDirective,`Unexpected '${n.content}' in command body`,s(n)),t.skipBlock(n.indent)):y=addProperty(t,h,a,l,n,y)}let H=new Set(g.flatMap(e=>e.candidate===null?[]:[e.candidate])),G=new Set(h.filter(e=>!H.has(e)).map(e=>e.name));g.some(e=>e.candidate!==null&&!G.has(e.candidate.type.name)&&e.candidate.type.name!==`returns`)&&G.add(`returns`);for(let e of G)a?.add(e);let K=null,q=/* @__PURE__ */ new Set;for(let n of g){let r=n.response;if(n.candidate!==null){if(!G.has(n.candidate.type.name))continue;q.add(n.candidate),r={kind:`ScalarCommandResponseSyntax`,source:{kind:`PropertyResponseSourceSyntax`,property:n.candidate.type.name,location:n.candidate.type.location},location:s(n.line)}}r!==null&&(K===null?K=r:t.error(e.InvalidCommandResponse,`A command declares at most one unconditional response.`,s(n.line)))}R!==null&&S.length>0&&t.error(e.CommandWithProducesAndHandler,`Command '${l}' cannot declare both 'produces' and 'handler'`,s(r));let J={kind:`CommandSyntax`,name:l,description:F,documentation:I,authorize:L,properties:h.filter(e=>!q.has(e)),validations:x,produces:S,handler:R,response:K,stream:z,streamCandidates:V,location:s(r)};return k.set(J,C),n.set(J,{reads:w,concurrency:E}),J}function addProperty(t,n,r,i,a,o){return l(t,r.type,a),r.isIdentifier&&o!==void 0&&(t.error(e.DuplicateCommandIdentifier,`Command '${i}' already marks '${o.name}' as identifier - only one property can be the identifier`,r.location),r={...r,isIdentifier:!1}),n.push(r),o??(r.isIdentifier?r:void 0)}function parseValidate(t,n,r){if(n.content===`validate`){let a=t.peekChild(n.indent);if(a!==void 0&&a.content.startsWith("```")){t.reader.takeSignificant();let e=C(t.valueContext,a);return e===null&&t.skipFencedBody(),{kind:`CodeValidateSyntax`,code:e,location:s(n)}}let c=[],l=[],u;for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r===`concept`){if(t.sourceOptions.numericMode===`legacy`&&a.content.startsWith("```")){t.skipFencedBody();continue}if(u!==void 0&&a.indent<=u&&(u=void 0),u!==void 0||o(a.content)===`implementation`){t.error(e.InvalidValidationRule,`Invalid validation rule '${a.content}'`,s(a)),u??=a.indent;continue}}if(o(a.content)===`require`){let e=h(r===`concept`?t.valueContext:t,a.content.substring(7).trim(),s(a)),n=null,c=`Error`,u=!1;for(let e=t.peekChild(a.indent);e!==void 0;e=t.peekChild(a.indent)){t.reader.takeSignificant();let r=I.exec(e.content);r!==null&&r.index===0?n=r[1]===void 0?r[2]:i(r[1]):o(e.content)===`severity`?(u||(c=H[e.content.substring(8).trim()]??`Error`),u=!0):t.skipOpaqueBlock(e.indent)}e!==null&&l.push({kind:`RequirementSyntax`,condition:e,message:n,severity:c,location:s(a)});continue}let n=parseValidationRule(t,r===`concept`?{...a,content:`value ${a.content}`}:a,r);n!==void 0&&c.push(n)}return{kind:`DeclarativeValidateSyntax`,rules:c,requirements:l,location:s(n)}}if(n.content===`validate csharp`){let e=C(t.valueContext,{...n,content:`csharp`});return e===null&&t.skipOpaqueBlock(n.indent),{kind:`CodeValidateSyntax`,code:e,location:s(n)}}t.error(e.InvalidValidateDeclaration,`Invalid validate declaration '${n.content}' - expected 'validate' or 'validate csharp'`,s(n)),t.skipBlock(n.indent)}function parseValidationRule(t,n,r){let i=r===`concept`?t.valueContext:t,{content:a,message:o}=splitMessage(n.content),c=splitSeverity(i,n,a);if(c===void 0)return;let l=L.exec(c.content);if(l===null){i.error(e.InvalidValidationRule,`Invalid validation rule '${n.content}'`,s(n));return}let u=parseRule(i,l[2],n);if(u===void 0)return;let d=u.kind===`Rule`?parseRuleImplementation(t,n,r===`command`):{file:null,code:null,implementation:null};return{kind:`ValidationRuleSyntax`,property:l[1],rule:u.kind,value:u.value,message:o,severity:c.severity,...d,location:s(n)}}function parseRuleImplementation(t,n,r){let i=t.peekChild(n.indent);if(i===void 0)return{file:null,code:null,implementation:null};t.reader.takeSignificant();let a=r&&o(i.content)===`implementation`,c=a?E(t,i):{file:S(i)?w(t,i):null,code:!S(i)&&x(t,i)?C(t,i):null,implementation:null};!a&&c.file===null&&c.code===null&&(t.error(e.UnknownRuleImplementationDirective,`Unexpected '${i.content}' in rule implementation - expected 'file <path>' or an inline code block`,s(i)),t.skipBlock(i.indent));for(let i=t.peekChild(n.indent);i!==void 0&&(a||r&&o(i.content)===`implementation`);i=t.peekChild(n.indent))t.reader.takeSignificant(),t.error(a&&o(i.content)===`implementation`?e.InvalidImplementationBlock:e.ConflictingImplementationSources,`A named rule has one implementation wrapper and cannot mix wrapped and direct sources.`,s(i)),x(t,i)?C(t,i):t.skipBlock(i.indent);return c}function splitMessage(e){let t=I.exec(e);if(t===null)return{content:e,message:null};let n=t[1]===void 0?t[2]:i(t[1]);return{content:e.substring(0,t.index).trimEnd(),message:n}}function splitSeverity(t,n,r){let i=F.exec(r);if(i===null)return{content:r,severity:`Error`};let a=H[i[1]];if(a===void 0)t.error(e.InvalidValidationSeverity,`Unknown validation severity '${i[1]}' - expected information, warning or error`,s(n));else return{content:r.substring(0,i.index).trimEnd(),severity:a}}function parseRule(t,n,r){if(n===`not empty`)return{kind:`NotEmpty`,value:null};let i=R.exec(n);if(i===null)t.error(e.InvalidValidationRule,`Invalid validation rule '${r.content}'`,s(r));else{if(i[1]===`rule`){let n=i[2].trim();if(!z.test(n)){t.error(e.InvalidRuleName,`Invalid rule name '${n}' in '${r.content}' - expected 'rule <Name>' with an identifier`,s(r));return}return{kind:`Rule`,value:{kind:`PathExpressionSyntax`,path:n,location:s(r)}}}return{kind:V[i[1]],value:a(i[2],s(r),t)}}}export{parseCommand,parseValidate};
|
|
2
|
+
//# sourceMappingURL=CommandParser.js.map
|