@cratis/screenplay-language 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
- package/dist/bundles/action-subject-authoring.js.map +1 -1
- package/dist/bundles/bmp-word-characters.js.map +1 -1
- package/dist/bundles/case-authoring.js +1 -1
- package/dist/bundles/case-authoring.js.map +1 -1
- package/dist/bundles/code-actions.js.map +1 -1
- package/dist/bundles/command-read-completions.js.map +1 -1
- package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
- package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
- package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
- package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
- package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
- package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
- package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
- package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
- package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
- package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
- package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayImports.js +1 -1
- package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
- package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
- package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
- package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
- package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
- package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
- package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
- package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
- package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
- package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
- package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
- package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
- package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
- package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
- package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
- package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
- package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
- package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
- package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
- package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
- package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
- package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
- package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
- package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
- package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
- package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
- package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
- package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
- package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
- package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
- package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
- package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
- package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
- package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
- package/dist/bundles/compiler/Syntax/index.js +1 -1
- package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
- package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
- package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
- package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
- package/dist/bundles/compiler/Text/patterns.js.map +1 -1
- package/dist/bundles/compiler/index.js +1 -1
- package/dist/bundles/completion-items.js +18 -17
- package/dist/bundles/completion-items.js.map +1 -1
- package/dist/bundles/completion-planner.js +2 -2
- package/dist/bundles/completion-planner.js.map +1 -1
- package/dist/bundles/completions.js +1 -1
- package/dist/bundles/completions.js.map +1 -1
- package/dist/bundles/continuation-responses.js +1 -1
- package/dist/bundles/continuation-responses.js.map +1 -1
- package/dist/bundles/declarations.js.map +1 -1
- package/dist/bundles/dependency-completions.js.map +1 -1
- package/dist/bundles/dependency-target-analysis.js.map +1 -1
- package/dist/bundles/diagnostic-codes.js +1 -1
- package/dist/bundles/diagnostic-codes.js.map +1 -1
- package/dist/bundles/diagnostics.js +1 -1
- package/dist/bundles/diagnostics.js.map +1 -1
- package/dist/bundles/document-context.js.map +1 -1
- package/dist/bundles/documentation-item.js.map +1 -1
- package/dist/bundles/event-analysis-source.js.map +1 -1
- package/dist/bundles/event-context-catalog.js.map +1 -1
- package/dist/bundles/event-context.js.map +1 -1
- package/dist/bundles/event-source-authoring.js +11 -11
- package/dist/bundles/event-source-authoring.js.map +1 -1
- package/dist/bundles/example-analysis.js +2 -2
- package/dist/bundles/example-analysis.js.map +1 -1
- package/dist/bundles/example-authoring.js +2 -2
- package/dist/bundles/example-authoring.js.map +1 -1
- package/dist/bundles/example-declaration-items.js.map +1 -1
- package/dist/bundles/example-values.js.map +1 -1
- package/dist/bundles/file-imports.js.map +1 -1
- package/dist/bundles/file-references.js.map +1 -1
- package/dist/bundles/generation-completions.js.map +1 -1
- package/dist/bundles/hover-content.js +5 -5
- package/dist/bundles/hover-content.js.map +1 -1
- package/dist/bundles/hover.js.map +1 -1
- package/dist/bundles/index.js +1 -1
- package/dist/bundles/index.js.map +1 -1
- package/dist/bundles/inlay-hints.js.map +1 -1
- package/dist/bundles/inline-completions.js +1 -1
- package/dist/bundles/inline-completions.js.map +1 -1
- package/dist/bundles/inline-event-validation.js +1 -1
- package/dist/bundles/inline-event-validation.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/language.js +1 -1
- package/dist/bundles/language.js.map +1 -1
- package/dist/bundles/named-rule-context.js.map +1 -1
- package/dist/bundles/operation-authoring.js +6 -6
- package/dist/bundles/operation-authoring.js.map +1 -1
- package/dist/bundles/persona-analysis.js +1 -1
- package/dist/bundles/persona-analysis.js.map +1 -1
- package/dist/bundles/production-destinations.js +1 -1
- package/dist/bundles/production-destinations.js.map +1 -1
- package/dist/bundles/purpose-items.js.map +1 -1
- package/dist/bundles/reaction-authoring.js +3 -3
- package/dist/bundles/reaction-authoring.js.map +1 -1
- package/dist/bundles/read-model-key-completions.js +1 -1
- package/dist/bundles/read-model-key-completions.js.map +1 -1
- package/dist/bundles/refusal-context.js.map +1 -1
- package/dist/bundles/response-analysis.js +1 -1
- package/dist/bundles/response-analysis.js.map +1 -1
- package/dist/bundles/response-completions.js +1 -1
- package/dist/bundles/response-completions.js.map +1 -1
- package/dist/bundles/response-tokens.js +2 -2
- package/dist/bundles/response-tokens.js.map +1 -1
- package/dist/bundles/scope-items.js +3 -3
- package/dist/bundles/scope-items.js.map +1 -1
- package/dist/bundles/structure-completions.js.map +1 -1
- package/dist/bundles/sub-language-registry.js.map +1 -1
- package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
- package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
- package/dist/bundles/sub-languages/capture/index.js.map +1 -1
- package/dist/bundles/sub-languages/capture/language.js.map +1 -1
- package/dist/bundles/sub-languages/cdl.js.map +1 -1
- package/dist/bundles/sub-languages/pdl.js.map +1 -1
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
- package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
- package/dist/bundles/sub-languages/projection/index.js.map +1 -1
- package/dist/bundles/sub-languages/projection/language.js.map +1 -1
- package/dist/bundles/symbols.js +2 -2
- package/dist/bundles/symbols.js.map +1 -1
- package/dist/bundles/themes/screenplay-dark.js.map +1 -1
- package/dist/bundles/themes/screenplay-light.js.map +1 -1
- package/dist/bundles/tokens.js +1 -1
- package/dist/bundles/tokens.js.map +1 -1
- package/dist/bundles/validation.js +2 -2
- package/dist/bundles/validation.js.map +1 -1
- package/dist/completion-items.d.ts +1 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.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/scope-items.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionParser.js","names":["parseMappingSource","header","pattern","whenPattern","everyPattern","atPattern","clauseKeywords","invokesPattern","mappingPattern","nativePattern","refusalPrefix","refusalHeader","optionalReads","name","line","context","DiagnosticCodes","locationOf","description","documentation","where","from","runsAs","identityDeclared","triggers","sources","reported","child","keyword","firstWord","parseDescription","parseDocumentation","parseObserverFilter","parseReactionIdentity","parseCondition","source","key","produces","invokes","reads","data","implementation","isReactionIdentityLine","misplacedReactionIdentity","produced","parseProduces","match","uses","ParserContext","collectInputUses","mappings","onRefused","value","refusal","mapped","structured","tryParseStructuredMapping","diagnosticText","parseModeledMappingSource","read","parseReads","start","parseTriggerData","property","syntax","dependencySources","acknowledge","location","amount","time","day","hours","minutes","text"],"sources":["../../../../../../Compiler/Parsing/ReactionParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { parseCondition } from './ConditionParser';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { parseObserverFilter } from './ObserverFilterParser';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { DayOfWeek, IntervalUnit, InvokesSyntax, ProducesSyntax, ReactionSyntax, ReactionTriggerSyntax, TriggerSourceSyntax } from '../Syntax/Reactions';\nimport { nativePattern, pattern } from '../Text/patterns';\nimport { ReactionIdentitySyntax } from '../Syntax/ReactionIdentitySyntax';\nimport { isReactionIdentityLine, misplacedReactionIdentity, parseReactionIdentity } from './ReactionIdentityParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTriggerData } from './TriggerDataParser';\nimport { dependencySources, ReadsSyntax, TriggerDataSyntax } from '../Syntax/DependencySources';\nimport { parseReads } from './ReadsParser';\nimport { parseProduces } from './ProducesParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst header = pattern('^reaction\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenPattern = pattern('^when\\\\s+([A-Za-z_]\\\\w*)$');\nconst everyPattern = pattern('^every\\\\s+(\\\\d+)\\\\s+(seconds?|minutes?|hours?|days?)$');\nconst atPattern = pattern('^at\\\\s+(\\\\d{2}:\\\\d{2})(?:\\\\s+on\\\\s+(?:(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)|day\\\\s+(\\\\d{1,2})))?$');\nconst clauseKeywords = new Set(['when', 'every', 'at']);\nconst invokesPattern = pattern('^invokes\\\\s+([A-Z]\\\\w*)$');\nconst mappingPattern = nativePattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst refusalPrefix = nativePattern('^on\\\\s+refused\\\\b(?=$|\\\\s+by\\\\b)');\nconst refusalHeader = nativePattern('^on\\\\s+refused(?:\\\\s+by\\\\s+(validation|constraint|authorization)(?:\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*))?)?$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\nexport function parseReaction(context: ParserContext, line: SourceLine): ReactionSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReactionDeclaration, `Invalid reaction declaration '${line.content}' - expected 'reaction <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n let documentation: string | null = null;\n let where: ConditionSyntax | null = null;\n let from: ObserverFilterSyntax | null = null;\n let runsAs: ReactionIdentitySyntax | null = null;\n let identityDeclared = false;\n const triggers: ReactionTriggerSyntax[] = [];\n const sources = new Set<string>();\n // A reaction whose only trigger is misspelled has no trigger, but saying so as well turns one mistake\n // into two diagnostics.\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'from') {\n from = parseObserverFilter(context, child, from);\n continue;\n }\n if (keyword === 'runs') {\n runsAs = parseReactionIdentity(context, child, identityDeclared) ?? runsAs;\n identityDeclared = true;\n continue;\n }\n if (keyword === 'where') {\n where = parseCondition(context, child.content.substring('where'.length).trim(), locationOf(child));\n continue;\n }\n if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n if (!clauseKeywords.has(keyword)) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Expected a trigger in reaction body, got '${child.content}' - a reaction is set off by 'when <Name>', 'every <n> <unit>' or 'at <HH:mm>'`, locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n const source = parseTriggerSource(context, child);\n if (source === undefined) {\n reported = true;\n continue;\n }\n const key = sourceKey(source);\n if (sources.has(key)) {\n context.error(DiagnosticCodes.DuplicateReactionTrigger, `Reaction '${name}' already declares '${child.content}' - a second says nothing the first did not`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n sources.add(key);\n triggers.push(parseTrigger(context, child, source));\n }\n if (triggers.length === 0 && !reported) {\n context.error(DiagnosticCodes.ReactionWithoutTrigger, `Reaction '${name}' must declare at least one trigger - nothing sets it off`, locationOf(line));\n }\n return { kind: 'ReactionSyntax', name, description, documentation, from, runsAs, where, triggers, location: locationOf(line) };\n}\n\n// What a trigger does - the events it produces and the commands it invokes - is read by name; its reads,\n// values and code are not modeled. The C# compiler remains the authority on whether what is skipped is valid.\nfunction parseTrigger(context: ParserContext, line: SourceLine, source: TriggerSourceSyntax): ReactionTriggerSyntax {\n let description: string | null = null;\n const produces: ProducesSyntax[] = [];\n const invokes: InvokesSyntax[] = [];\n const reads: ReadsSyntax[] = [];\n const data: TriggerDataSyntax[] = [];\n let implementation = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'runs' && isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Trigger '${child.content}'`);\n } else if (keyword === 'produces') {\n const produced = parseProduces(context, child);\n if (produced !== undefined) {\n produces.push(produced);\n }\n } else if (keyword === 'invokes') {\n const match = invokesPattern.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInvokesDeclaration, `Invalid invokes declaration '${child.content}' - expected 'invokes <Command>'`, locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const uses = new ParserContext(context.reader.fork(), context.path, context.languages);\n uses.scope = context.scope;\n uses.sourceOptions = context.sourceOptions;\n collectInputUses(uses, child);\n context.inputUses.push(...uses.inputUses);\n const mappings: PropertyMappingSyntax[] = [];\n const onRefused: InvocationRefusalSyntax[] = [];\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (isReactionIdentityLine(value)) {\n misplacedReactionIdentity(context, value);\n continue;\n }\n if (refusalPrefix.test(value.content)) {\n const refusal = parseRefusal(context, value);\n if (refusal !== undefined) onRefused.push(refusal);\n continue;\n }\n const mapped = mappingPattern.exec(value.content);\n const structured = mapped === null ? tryParseStructuredMapping(context.valueContext, value) : undefined;\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: mapped[1].replaceAll('@', ''), source: parseMappingSource(mapped[2], locationOf(value), context.valueContext), location: locationOf(value) });\n else if (structured !== undefined) mappings.push(structured);\n else context.error(DiagnosticCodes.InvalidPropertyMapping, `Invalid property mapping '${value.content}' - expected '<property> = <source>'`, locationOf(value), diagnosticText('text', value.content));\n }\n invokes.push({ kind: 'InvokesSyntax', command: match[1], mappings, onRefused, location: locationOf(child) });\n }\n } else if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n } else if (keyword === 'reads' || keyword === 'file' || child.content === 'csharp' || child.content.startsWith('```')) {\n implementation ||= keyword === 'file' || child.content === 'csharp' || child.content.startsWith('```');\n const read = keyword === 'reads' ? parseReads(context, child) : undefined;\n if (read !== undefined) reads.push(read);\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n if (child.content.startsWith('```')) {\n context.skipFencedBody();\n }\n context.skipOpaqueBlock(child.indent);\n } else {\n const start = context.triggerData.length;\n parseTriggerData(context, child);\n for (const property of context.triggerData.slice(start)) data.push({ kind: 'TriggerDataSyntax', name: property.name, type: property.type, location: property.location });\n }\n }\n const syntax: ReactionTriggerSyntax = { kind: 'ReactionTriggerSyntax', source, description, produces, invokes, location: locationOf(line) };\n dependencySources.set(syntax, { reads, data, implementation });\n return syntax;\n}\n\nfunction parseRefusal(context: ParserContext, line: SourceLine): InvocationRefusalSyntax | undefined {\n const match = refusalHeader.exec(line.content);\n if (match === null || (match[2] !== undefined && match[1] !== 'constraint')) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"Expected 'on refused [by validation | by constraint [<Name>] | by authorization]'.\", locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const produces: ProducesSyntax[] = [];\n let acknowledge = false;\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n reported = true;\n } else if (child.content === 'acknowledge') {\n if (acknowledge || produces.length > 0 || context.peekChild(child.indent) !== undefined) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch contains 'acknowledge' alone or one or more 'produces' blocks.\", locationOf(child));\n reported = true;\n }\n acknowledge = true;\n context.skipBlock(child.indent);\n } else if (firstWord(child.content) === 'produces') {\n if (acknowledge) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch cannot combine 'acknowledge' and 'produces'.\", locationOf(child));\n reported = true;\n }\n const produced = parseProduces(context, child);\n if (produced !== undefined) produces.push(produced);\n else reported = true;\n } else {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"Expected 'acknowledge' or 'produces <Event>' in a refusal branch.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n }\n }\n if (!acknowledge && produces.length === 0 && !reported) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, 'A refusal branch must acknowledge or produce an event.', locationOf(line));\n }\n return { kind: 'InvocationRefusalSyntax', selector: match[1] ?? 'any', constraint: match[2] ?? null, acknowledge, produces, location: locationOf(line) };\n}\n\nfunction sourceKey(source: TriggerSourceSyntax): string {\n switch (source.kind) {\n case 'NamedTriggerSourceSyntax': return JSON.stringify([source.kind, source.name]);\n case 'IntervalTriggerSourceSyntax': return JSON.stringify([source.kind, source.amount, source.unit]);\n case 'ScheduleTriggerSourceSyntax': return JSON.stringify([source.kind, source.time, source.dayOfWeek, source.dayOfMonth]);\n }\n}\n\n// Reads a 'when', 'every' or 'at' clause - the port of the C# TriggerParser.ParseSource. The caller only\n// hands it a line starting with one of the three, so anything that is not 'when' or 'every' is 'at'.\nexport function parseTriggerSource(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'when': {\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Invalid trigger '${line.content}' - expected 'when <Name>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'NamedTriggerSourceSyntax', name: match[1], location };\n }\n case 'every': {\n const match = everyPattern.exec(line.content);\n const amount = match === null ? NaN : Number(match[1]);\n if (match === null || !Number.isInteger(amount) || amount < 1 || amount > 2147483647) {\n context.error(DiagnosticCodes.InvalidIntervalTrigger, `Invalid interval '${line.content}' - expected 'every <n> <seconds|minutes|hours|days>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'IntervalTriggerSourceSyntax', amount, unit: unitOf(match[2]), location };\n }\n default:\n return parseSchedule(context, line);\n }\n}\n\nfunction parseSchedule(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n const match = atPattern.exec(line.content);\n const time = match === null ? undefined : timeOf(match[1]);\n if (match === null || time === undefined) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid schedule '${line.content}' - expected 'at <HH:mm>', optionally followed by 'on <Weekday>' or 'on day <n>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n if (match[3] !== undefined) {\n const day = Number(match[3]);\n if (day < 1 || day > 31) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid day of month '${day}' in '${line.content}' - a day of the month is between 1 and 31`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: null, dayOfMonth: day, location };\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: (match[2] as DayOfWeek | undefined) ?? null, dayOfMonth: null, location };\n}\n\n// 'HH:mm' as SyntaxJson writes a TimeOnly, or undefined when it is not a time of day.\nfunction timeOf(text: string): string | undefined {\n const [hours, minutes] = text.split(':').map(Number);\n if (!(hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59)) {\n return undefined;\n }\n return `${text}:00.0000000`;\n}\n\nfunction unitOf(text: string): IntervalUnit {\n switch (text.replace(/s+$/, '')) {\n case 'second':\n return 'Seconds';\n case 'minute':\n return 'Minutes';\n case 'hour':\n return 'Hours';\n default:\n return 'Days';\n }\n}\n"],"mappings":"ipCA4BA,MAAMC,EAASC,EAAQ,+BAA+B,EAChDC,EAAcD,EAAQ,2BAA2B,EACjDE,EAAeF,EAAQ,uDAAuD,EAC9EG,EAAYH,EAAQ,wHAAwH,EAC5II,kBAAiB,IAAI,IAAI,CAAC,OAAQ,QAAS,IAAI,CAAC,EAChDC,EAAiBL,EAAQ,0BAA0B,EACnDM,EAAiBC,EAAc,mCAAmC,EAClEC,EAAgBD,EAAc,kCAAkC,EAChEE,EAAgBF,EAAc,yGAAyG,EACvIG,EAAgBV,EAAQ,0CAA0C,EAExE,SAAgB,cAAc,EAAwB,EAAkC,CACpF,IAAMW,EAAOZ,EAAO,KAAKa,EAAK,OAAO,CAAC,GAAG,IAAM,GAC3CD,IAAS,IACTE,EAAQ,MAAMC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AA4B,CACxC,OAAQA,EAAK,QAAQ,MAAO,EAAE,EAA9B,CACI,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,UACX,IAAK,OACD,MAAO,QACX,QACI,MAAO,MACf,CACJ"}
|
|
1
|
+
{"version":3,"file":"ReactionParser.js","names":["parseMappingSource","header","pattern","whenPattern","everyPattern","atPattern","clauseKeywords","invokesPattern","mappingPattern","nativePattern","refusalPrefix","refusalHeader","optionalReads","name","line","context","DiagnosticCodes","locationOf","description","documentation","where","from","runsAs","identityDeclared","triggers","sources","reported","child","keyword","firstWord","parseDescription","parseDocumentation","parseObserverFilter","parseReactionIdentity","parseCondition","source","key","produces","invokes","reads","data","implementation","isReactionIdentityLine","misplacedReactionIdentity","produced","parseProduces","match","uses","ParserContext","collectInputUses","mappings","onRefused","value","refusal","mapped","structured","tryParseStructuredMapping","diagnosticText","parseModeledMappingSource","read","parseReads","start","parseTriggerData","property","syntax","dependencySources","acknowledge","location","amount","time","day","hours","minutes","text"],"sources":["../../../../../../Compiler/Parsing/ReactionParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { parseCondition } from './ConditionParser';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { parseObserverFilter } from './ObserverFilterParser';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { DayOfWeek, IntervalUnit, InvokesSyntax, ProducesSyntax, ReactionSyntax, ReactionTriggerSyntax, TriggerSourceSyntax } from '../Syntax/Reactions';\nimport { nativePattern, pattern } from '../Text/patterns';\nimport { ReactionIdentitySyntax } from '../Syntax/ReactionIdentitySyntax';\nimport { isReactionIdentityLine, misplacedReactionIdentity, parseReactionIdentity } from './ReactionIdentityParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTriggerData } from './TriggerDataParser';\nimport { dependencySources, ReadsSyntax, TriggerDataSyntax } from '../Syntax/DependencySources';\nimport { parseReads } from './ReadsParser';\nimport { parseProduces } from './ProducesParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst header = pattern('^reaction\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenPattern = pattern('^when\\\\s+([A-Za-z_]\\\\w*)$');\nconst everyPattern = pattern('^every\\\\s+(\\\\d+)\\\\s+(seconds?|minutes?|hours?|days?)$');\nconst atPattern = pattern('^at\\\\s+(\\\\d{2}:\\\\d{2})(?:\\\\s+on\\\\s+(?:(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)|day\\\\s+(\\\\d{1,2})))?$');\nconst clauseKeywords = new Set(['when', 'every', 'at']);\nconst invokesPattern = pattern('^invokes\\\\s+([A-Z]\\\\w*)$');\nconst mappingPattern = nativePattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst refusalPrefix = nativePattern('^on\\\\s+refused\\\\b(?=$|\\\\s+by\\\\b)');\nconst refusalHeader = nativePattern('^on\\\\s+refused(?:\\\\s+by\\\\s+(validation|constraint|authorization)(?:\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*))?)?$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\nexport function parseReaction(context: ParserContext, line: SourceLine): ReactionSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReactionDeclaration, `Invalid reaction declaration '${line.content}' - expected 'reaction <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n let documentation: string | null = null;\n let where: ConditionSyntax | null = null;\n let from: ObserverFilterSyntax | null = null;\n let runsAs: ReactionIdentitySyntax | null = null;\n let identityDeclared = false;\n const triggers: ReactionTriggerSyntax[] = [];\n const sources = new Set<string>();\n // A reaction whose only trigger is misspelled has no trigger, but saying so as well turns one mistake\n // into two diagnostics.\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'from') {\n from = parseObserverFilter(context, child, from);\n continue;\n }\n if (keyword === 'runs') {\n runsAs = parseReactionIdentity(context, child, identityDeclared) ?? runsAs;\n identityDeclared = true;\n continue;\n }\n if (keyword === 'where') {\n where = parseCondition(context, child.content.substring('where'.length).trim(), locationOf(child));\n continue;\n }\n if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n if (!clauseKeywords.has(keyword)) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Expected a trigger in reaction body, got '${child.content}' - a reaction is set off by 'when <Name>', 'every <n> <unit>' or 'at <HH:mm>'`, locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n const source = parseTriggerSource(context, child);\n if (source === undefined) {\n reported = true;\n continue;\n }\n const key = sourceKey(source);\n if (sources.has(key)) {\n context.error(DiagnosticCodes.DuplicateReactionTrigger, `Reaction '${name}' already declares '${child.content}' - a second says nothing the first did not`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n sources.add(key);\n triggers.push(parseTrigger(context, child, source));\n }\n if (triggers.length === 0 && !reported) {\n context.error(DiagnosticCodes.ReactionWithoutTrigger, `Reaction '${name}' must declare at least one trigger - nothing sets it off`, locationOf(line));\n }\n return { kind: 'ReactionSyntax', name, description, documentation, from, runsAs, where, triggers, location: locationOf(line) };\n}\n\n// What a trigger does - the events it produces and the commands it invokes - is read by name; its reads,\n// values and code are not modeled. The C# compiler remains the authority on whether what is skipped is valid.\nfunction parseTrigger(context: ParserContext, line: SourceLine, source: TriggerSourceSyntax): ReactionTriggerSyntax {\n let description: string | null = null;\n const produces: ProducesSyntax[] = [];\n const invokes: InvokesSyntax[] = [];\n const reads: ReadsSyntax[] = [];\n const data: TriggerDataSyntax[] = [];\n let implementation = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'runs' && isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Trigger '${child.content}'`);\n } else if (keyword === 'produces') {\n const produced = parseProduces(context, child);\n if (produced !== undefined) {\n produces.push(produced);\n }\n } else if (keyword === 'invokes') {\n const match = invokesPattern.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInvokesDeclaration, `Invalid invokes declaration '${child.content}' - expected 'invokes <Command>'`, locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const uses = new ParserContext(context.reader.fork(), context.path, context.languages);\n uses.scope = context.scope;\n uses.sourceOptions = context.sourceOptions;\n collectInputUses(uses, child);\n context.inputUses.push(...uses.inputUses);\n const mappings: PropertyMappingSyntax[] = [];\n const onRefused: InvocationRefusalSyntax[] = [];\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (isReactionIdentityLine(value)) {\n misplacedReactionIdentity(context, value);\n continue;\n }\n if (refusalPrefix.test(value.content)) {\n const refusal = parseRefusal(context, value);\n if (refusal !== undefined) onRefused.push(refusal);\n continue;\n }\n const mapped = mappingPattern.exec(value.content);\n const structured = mapped === null ? tryParseStructuredMapping(context.valueContext, value) : undefined;\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: mapped[1].replaceAll('@', ''), source: parseMappingSource(mapped[2], locationOf(value), context.valueContext), location: locationOf(value) });\n else if (structured !== undefined) mappings.push(structured);\n else context.error(DiagnosticCodes.InvalidPropertyMapping, `Invalid property mapping '${value.content}' - expected '<property> = <source>'`, locationOf(value), diagnosticText('text', value.content));\n }\n invokes.push({ kind: 'InvokesSyntax', command: match[1], mappings, onRefused, location: locationOf(child) });\n }\n } else if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n } else if (keyword === 'reads' || keyword === 'file' || child.content === 'csharp' || child.content.startsWith('```')) {\n implementation ||= keyword === 'file' || child.content === 'csharp' || child.content.startsWith('```');\n const read = keyword === 'reads' ? parseReads(context, child) : undefined;\n if (read !== undefined) reads.push(read);\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n if (child.content.startsWith('```')) {\n context.skipFencedBody();\n }\n context.skipOpaqueBlock(child.indent);\n } else {\n const start = context.triggerData.length;\n parseTriggerData(context, child);\n for (const property of context.triggerData.slice(start)) data.push({ kind: 'TriggerDataSyntax', name: property.name, type: property.type, location: property.location });\n }\n }\n const syntax: ReactionTriggerSyntax = { kind: 'ReactionTriggerSyntax', source, description, produces, invokes, location: locationOf(line) };\n dependencySources.set(syntax, { reads, data, implementation });\n return syntax;\n}\n\nfunction parseRefusal(context: ParserContext, line: SourceLine): InvocationRefusalSyntax | undefined {\n const match = refusalHeader.exec(line.content);\n if (match === null || (match[2] !== undefined && match[1] !== 'constraint')) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"Expected 'on refused [by validation | by constraint [<Name>] | by authorization]'.\", locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const produces: ProducesSyntax[] = [];\n let acknowledge = false;\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n reported = true;\n } else if (child.content === 'acknowledge') {\n if (acknowledge || produces.length > 0 || context.peekChild(child.indent) !== undefined) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch contains 'acknowledge' alone or one or more 'produces' blocks.\", locationOf(child));\n reported = true;\n }\n acknowledge = true;\n context.skipBlock(child.indent);\n } else if (firstWord(child.content) === 'produces') {\n if (acknowledge) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch cannot combine 'acknowledge' and 'produces'.\", locationOf(child));\n reported = true;\n }\n const produced = parseProduces(context, child);\n if (produced !== undefined) produces.push(produced);\n else reported = true;\n } else {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"Expected 'acknowledge' or 'produces <Event>' in a refusal branch.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n }\n }\n if (!acknowledge && produces.length === 0 && !reported) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, 'A refusal branch must acknowledge or produce an event.', locationOf(line));\n }\n return { kind: 'InvocationRefusalSyntax', selector: match[1] ?? 'any', constraint: match[2] ?? null, acknowledge, produces, location: locationOf(line) };\n}\n\nfunction sourceKey(source: TriggerSourceSyntax): string {\n switch (source.kind) {\n case 'NamedTriggerSourceSyntax': return JSON.stringify([source.kind, source.name]);\n case 'IntervalTriggerSourceSyntax': return JSON.stringify([source.kind, source.amount, source.unit]);\n case 'ScheduleTriggerSourceSyntax': return JSON.stringify([source.kind, source.time, source.dayOfWeek, source.dayOfMonth]);\n }\n}\n\n// Reads a 'when', 'every' or 'at' clause - the port of the C# TriggerParser.ParseSource. The caller only\n// hands it a line starting with one of the three, so anything that is not 'when' or 'every' is 'at'.\nexport function parseTriggerSource(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'when': {\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Invalid trigger '${line.content}' - expected 'when <Name>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'NamedTriggerSourceSyntax', name: match[1], location };\n }\n case 'every': {\n const match = everyPattern.exec(line.content);\n const amount = match === null ? NaN : Number(match[1]);\n if (match === null || !Number.isInteger(amount) || amount < 1 || amount > 2147483647) {\n context.error(DiagnosticCodes.InvalidIntervalTrigger, `Invalid interval '${line.content}' - expected 'every <n> <seconds|minutes|hours|days>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'IntervalTriggerSourceSyntax', amount, unit: unitOf(match[2]), location };\n }\n default:\n return parseSchedule(context, line);\n }\n}\n\nfunction parseSchedule(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n const match = atPattern.exec(line.content);\n const time = match === null ? undefined : timeOf(match[1]);\n if (match === null || time === undefined) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid schedule '${line.content}' - expected 'at <HH:mm>', optionally followed by 'on <Weekday>' or 'on day <n>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n if (match[3] !== undefined) {\n const day = Number(match[3]);\n if (day < 1 || day > 31) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid day of month '${day}' in '${line.content}' - a day of the month is between 1 and 31`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: null, dayOfMonth: day, location };\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: (match[2] as DayOfWeek | undefined) ?? null, dayOfMonth: null, location };\n}\n\n// 'HH:mm' as SyntaxJson writes a TimeOnly, or undefined when it is not a time of day.\nfunction timeOf(text: string): string | undefined {\n const [hours, minutes] = text.split(':').map(Number);\n if (!(hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59)) {\n return undefined;\n }\n return `${text}:00.0000000`;\n}\n\nfunction unitOf(text: string): IntervalUnit {\n switch (text.replace(/s+$/, '')) {\n case 'second':\n return 'Seconds';\n case 'minute':\n return 'Minutes';\n case 'hour':\n return 'Hours';\n default:\n return 'Days';\n }\n}\n"],"mappings":"A,ipCA4BA,MAAMC,EAASC,EAAQ,+BAA+B,EAChDC,EAAcD,EAAQ,2BAA2B,EACjDE,EAAeF,EAAQ,uDAAuD,EAC9EG,EAAYH,EAAQ,wHAAwH,EAC5II,kBAAiB,IAAI,IAAI,CAAC,OAAQ,QAAS,IAAI,CAAC,EAChDC,EAAiBL,EAAQ,0BAA0B,EACnDM,EAAiBC,EAAc,mCAAmC,EAClEC,EAAgBD,EAAc,kCAAkC,EAChEE,EAAgBF,EAAc,yGAAyG,EACvIG,EAAgBV,EAAQ,0CAA0C,EAExE,SAAgB,cAAc,EAAwB,EAAkC,CACpF,IAAMW,EAAOZ,EAAO,KAAKa,EAAK,OAAO,CAAC,GAAG,IAAM,GAC3CD,IAAS,IACTE,EAAQ,MAAMC,EAAgB,2BAA4B,iCAAiCF,EAAK,QAAQ,gCAAiCG,EAAWH,CAAI,CAAC,EAE7J,IAAII,EAA6B,KAC7BC,EAA+B,KAC/BC,EAAgC,KAChCC,EAAoC,KACpCC,EAAwC,KACxCC,EAAmB,GACjBC,EAAoC,CAAC,EACrCC,kBAAU,IAAI,IAGhBC,EAAW,GACf,IAAK,IAAIC,EAAQZ,EAAQ,UAAUD,EAAK,MAAM,EAAGa,IAAU,IAAA,GAAW,EAAQZ,EAAQ,UAAUD,EAAK,MAAM,EAAG,CAC1GC,EAAQ,OAAO,gBAAgB,EAC/B,IAAMa,EAAUC,EAAUF,EAAM,OAAO,EACvC,GAAIC,IAAY,cAAe,CAC3B,EAAcE,EAAiBf,EAASY,EAAOT,EAA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,EAAQ,MAAMC,EAAgB,uBAAwB,qBAAqBF,EAAK,QAAQ,kFAAmFqD,CAAQ,EACnLpD,EAAQ,UAAUD,EAAK,MAAM,MAGjC,IAAIgC,EAAM,KAAO,IAAA,GAAW,CACxB,IAAMwB,EAAM,OAAOxB,EAAM,EAAE,EAC3B,GAAIwB,EAAM,GAAKA,EAAM,GAAI,CACrBvD,EAAQ,MAAMC,EAAgB,uBAAwB,yBAAyBsD,EAAI,QAAQxD,EAAK,QAAQ,4CAA6CqD,CAAQ,EAC7JpD,EAAQ,UAAUD,EAAK,MAAM,EAC7B,MACJ,CACA,MAAO,CAAE,KAAM,8BAA+B,OAAM,UAAW,KAAM,WAAYwD,EAAK,UAAS,CACnG,CACA,MAAO,CAAE,KAAM,8BAA+B,OAAM,UAAYxB,EAAM,IAAgC,KAAM,WAAY,KAAM,UAAS,CADvI,CAEJ,CAGA,SAAS,OAAO,EAAkC,CAC9C,GAAM,CAACyB,EAAOC,GAAWC,EAAK,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,EACnD,GAAMF,GAAS,GAAKA,GAAS,IAAMC,GAAW,GAAKA,GAAW,GAG9D,MAAO,GAAGC,EAAK,YACnB,CAEA,SAAS,OAAO,EAA4B,CACxC,OAAQA,EAAK,QAAQ,MAAO,EAAE,EAA9B,CACI,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,UACX,IAAK,OACD,MAAO,QACX,QACI,MAAO,MACf,CACJ,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dependencySourcesOf as t}from"../Syntax/DependencySources.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dependencySourcesOf as t}from"../Syntax/DependencySources.js";import{RefusalDeclarations as n}from"./RefusalDeclarations.js";import{RefusalValueWalker as r}from"./RefusalValueWalker.js";import{expandSpecificationExamples as i}from"./SpecificationCommandExamples.js";function authorizationGatedSlices(e){let t=/* @__PURE__ */ new Set,collect=(e,n)=>{let r=n||e.authorize!==null;r&&e.slices.forEach(e=>t.add(e)),e.features.forEach(e=>collect(e,r))};return e.modules.forEach(e=>e.features.forEach(t=>collect(t,e.authorize!==null))),t}function validateReactionRefusals(a,o){let s=new n(i(a));new r(s,o).visitApplication(s.application);let c=authorizationGatedSlices(s.application);for(let{slice:n}of s.slices){let constraintOf=e=>s.resolve(e,n,e=>e.constraints),sameConstraint=(e,t)=>e===t||constraintOf(e)!==null&&constraintOf(e)?.node===constraintOf(t)?.node,covers=(e,t)=>e.selector===`any`&&[`any`,`validation`,`constraint`].includes(t.selector)||e.selector===t.selector&&(e.selector!==`constraint`||e.constraint===null||t.constraint!==null&&sameConstraint(e.constraint,t.constraint));for(let r of n.reactions)r.runsAs!=null&&!r.triggers.some(e=>e.invokes.length>0||t(e).implementation)&&o.warning(e.UnusedReactionIdentity,`Reaction '${r.name}' declares an identity but has no invocations or implementation body.`,r.runsAs.location);for(let{reaction:t,invocation:r}of n.reactions.flatMap(e=>e.triggers.flatMap(e=>e.invokes).map(t=>({reaction:e,invocation:t})))){let i=s.resolve(r.command,n,e=>e.commands),a=i!==null&&(i.node.authorize!==null||c.has(i.slice)),l=r.onRefused?.find(e=>e.selector===`authorization`);t.runsAs==null&&a&&l===void 0&&o.warning(e.GatedInvocationWithoutIdentity,`Command '${r.command}' is authorization-gated, but reaction '${t.name}' has no declared identity. Declare 'runs as system role "<Role>"'.`,r.location);let u=[];for(let n of r.onRefused??[]){if(u.some(e=>covers(e,n))&&o.warning(e.UnreachableRefusalBranch,`This refusal selector is covered by an earlier branch; the first matching branch wins.`,n.location),u.push(n),n===l&&t.runsAs==null&&a&&o.warning(e.AuthorizationRefusalWithoutIdentity,`Command '${r.command}' is authorization-gated, but this invocation has no declared identity. This authorization refusal branch always fires in the reference runner because there is no caller. Declare 'runs as system role "<Role>"'; Arc runs commands as the system only for a reactor carrying [ExecuteCommandsAsSystem].`,n.location),n.constraint===null)continue;let c=constraintOf(n.constraint);if(c===null){o.error(e.UnknownRefusalConstraint,`Unknown or ambiguous refusal constraint '${n.constraint}'.`,n.location);continue}if(i===null||i.node.handler!==null)continue;let d=[c.node,...c.node.additionalRules];if(d.some(e=>e.kind===`FileConstraintSyntax`))continue;let f=d.map(e=>e.kind===`FileConstraintSyntax`?null:s.event(e.event,c.slice)),p=i.node.produces.map(e=>s.event(e.event,i.slice));f.every(e=>e!==null)&&p.every(e=>e!==null)&&!f.some(e=>p.includes(e))&&o.warning(e.UnreachableRefusalBranch,`Constraint '${n.constraint}' targets none of the events produced by '${r.command}'.`,n.location)}}}}export{validateReactionRefusals};
|
|
2
2
|
//# sourceMappingURL=ReactionRefusalValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionRefusalValidator.js","names":["slices","gated","inherited","feature","slice","child","application","module","declarations","RefusalDeclarations","expandSpecificationExamples","RefusalValueWalker","context","gatedSlices","name","owner","left","right","previous","branch","reaction","trigger","dependencySourcesOf","DiagnosticCodes","invoked","invocation","authorizationGated","authorizationBranch","earlier","constraint","rules","rule","targets","productions","produced","target"],"sources":["../../../../../../Compiler/Parsing/ReactionRefusalValidator.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 { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RefusalValueWalker } from './RefusalValueWalker';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\nfunction authorizationGatedSlices(application: ApplicationSyntax): Set<SliceSyntax> {\n const slices = new Set<SliceSyntax>();\n const collect = (feature: FeatureSyntax, inherited: boolean): void => {\n const gated = inherited || feature.authorize !== null;\n if (gated) feature.slices.forEach(slice => slices.add(slice));\n feature.features.forEach(child => collect(child, gated));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, module.authorize !== null)));\n return slices;\n}\n\nexport function validateReactionRefusals(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(expandSpecificationExamples(application));\n new RefusalValueWalker(declarations, context).visitApplication(declarations.application);\n const gatedSlices = authorizationGatedSlices(declarations.application);\n for (const { slice } of declarations.slices) {\n const constraintOf = (name: string) => declarations.resolve(name, slice, owner => owner.constraints);\n const sameConstraint = (left: string, right: string) => left === right || constraintOf(left) !== null && constraintOf(left)?.node === constraintOf(right)?.node;\n const covers = (previous: InvocationRefusalSyntax, branch: InvocationRefusalSyntax) =>\n previous.selector === 'any' && ['any', 'validation', 'constraint'].includes(branch.selector) ||\n previous.selector === branch.selector && (previous.selector !== 'constraint' || previous.constraint === null || branch.constraint !== null && sameConstraint(previous.constraint, branch.constraint));\n for (const reaction of slice.reactions) {\n if (reaction.runsAs != null && !reaction.triggers.some(trigger => trigger.invokes.length > 0 || dependencySourcesOf(trigger).implementation)) {\n context.warning(DiagnosticCodes.UnusedReactionIdentity, `Reaction '${reaction.name}' declares an identity but has no invocations or implementation body.`, reaction.runsAs.location);\n }\n }\n for (const { reaction, invocation } of slice.reactions.flatMap(reaction => reaction.triggers.flatMap(trigger => trigger.invokes).map(invocation => ({ reaction, invocation })))) {\n const invoked = declarations.resolve(invocation.command, slice, owner => owner.commands);\n const authorizationGated = invoked !== null && (invoked.node.authorize !== null || gatedSlices.has(invoked.slice));\n const authorizationBranch = invocation.onRefused?.find(branch => branch.selector === 'authorization');\n if (reaction.runsAs == null && authorizationGated && authorizationBranch === undefined) {\n context.warning(DiagnosticCodes.GatedInvocationWithoutIdentity, `Command '${invocation.command}' is authorization-gated, but reaction '${reaction.name}' has no declared identity. Declare 'runs as system role \"<Role>\"'.`, invocation.location);\n }\n const earlier: InvocationRefusalSyntax[] = [];\n for (const branch of invocation.onRefused ?? []) {\n if (earlier.some(previous => covers(previous, branch))) context.warning(DiagnosticCodes.UnreachableRefusalBranch, 'This refusal selector is covered by an earlier branch; the first matching branch wins.', branch.location);\n earlier.push(branch);\n if (branch === authorizationBranch && reaction.runsAs == null && authorizationGated) {\n context.warning(DiagnosticCodes.AuthorizationRefusalWithoutIdentity,\n `Command '${invocation.command}' is authorization-gated, but this invocation has no declared identity. This authorization refusal branch always fires in the reference runner because there is no caller. Declare 'runs as system role \"<Role>\"'; Arc runs commands as the system only for a reactor carrying [ExecuteCommandsAsSystem].`,\n branch.location);\n }\n if (branch.constraint === null) continue;\n const constraint = constraintOf(branch.constraint);\n if (constraint === null) {\n context.error(DiagnosticCodes.UnknownRefusalConstraint, `Unknown or ambiguous refusal constraint '${branch.constraint}'.`, branch.location);\n continue;\n }\n if (invoked === null || invoked.node.handler !== null) continue;\n const rules = [constraint.node, ...constraint.node.additionalRules];\n if (rules.some(rule => rule.kind === 'FileConstraintSyntax')) continue;\n const targets = rules.map(rule => rule.kind === 'FileConstraintSyntax' ? null : declarations.event(rule.event, constraint.slice));\n const productions = invoked.node.produces.map(produced => declarations.event(produced.event, invoked.slice));\n if (targets.every(target => target !== null) && productions.every(produced => produced !== null) && !targets.some(target => productions.includes(target)))\n context.warning(DiagnosticCodes.UnreachableRefusalBranch, `Constraint '${branch.constraint}' targets none of the events produced by '${invocation.command}'.`, branch.location);\n }\n }\n }\n}\n"],"mappings":"0YAYA,SAAS,yBAAyB,EAAkD,CAChF,IAAMA,kBAAS,IAAI,IACb,SAAW,EAAwB,IAA6B,CAClE,IAAMC,EAAQC,GAAaC,EAAQ,YAAc,KAC7CF,GAAOE,EAAQ,OAAO,QAAQ,GAASH,EAAO,IAAII,CAAK,CAAC,EAC5DD,EAAQ,SAAS,QAAQ,GAAS,QAAQE,EAAOJ,CAAK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B,EAAa,MAAM0B,EAAS,MAAOV,EAAQ,KAAK,CAAC,EACvGQ,EAAQ,MAAM,GAAUG,IAAW,IAAI,GAAKF,EAAY,MAAM,GAAYC,IAAa,IAAI,GAAK,CAACF,EAAQ,KAAK,GAAUC,EAAY,SAASE,CAAM,CAAC,GACpJvB,EAAQ,QAAQW,EAAgB,yBAA0B,eAAeJ,EAAO,WAAW,4CAA4CM,EAAW,QAAQ,IAAKN,EAAO,QAAQ,CACtL,CACJ,CACJ,CACJ"}
|
|
1
|
+
{"version":3,"file":"ReactionRefusalValidator.js","names":["slices","gated","inherited","feature","slice","child","application","module","declarations","RefusalDeclarations","expandSpecificationExamples","RefusalValueWalker","context","gatedSlices","name","owner","left","right","previous","branch","reaction","trigger","dependencySourcesOf","DiagnosticCodes","invoked","invocation","authorizationGated","authorizationBranch","earlier","constraint","rules","rule","targets","productions","produced","target"],"sources":["../../../../../../Compiler/Parsing/ReactionRefusalValidator.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 { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RefusalValueWalker } from './RefusalValueWalker';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\nfunction authorizationGatedSlices(application: ApplicationSyntax): Set<SliceSyntax> {\n const slices = new Set<SliceSyntax>();\n const collect = (feature: FeatureSyntax, inherited: boolean): void => {\n const gated = inherited || feature.authorize !== null;\n if (gated) feature.slices.forEach(slice => slices.add(slice));\n feature.features.forEach(child => collect(child, gated));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, module.authorize !== null)));\n return slices;\n}\n\nexport function validateReactionRefusals(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(expandSpecificationExamples(application));\n new RefusalValueWalker(declarations, context).visitApplication(declarations.application);\n const gatedSlices = authorizationGatedSlices(declarations.application);\n for (const { slice } of declarations.slices) {\n const constraintOf = (name: string) => declarations.resolve(name, slice, owner => owner.constraints);\n const sameConstraint = (left: string, right: string) => left === right || constraintOf(left) !== null && constraintOf(left)?.node === constraintOf(right)?.node;\n const covers = (previous: InvocationRefusalSyntax, branch: InvocationRefusalSyntax) =>\n previous.selector === 'any' && ['any', 'validation', 'constraint'].includes(branch.selector) ||\n previous.selector === branch.selector && (previous.selector !== 'constraint' || previous.constraint === null || branch.constraint !== null && sameConstraint(previous.constraint, branch.constraint));\n for (const reaction of slice.reactions) {\n if (reaction.runsAs != null && !reaction.triggers.some(trigger => trigger.invokes.length > 0 || dependencySourcesOf(trigger).implementation)) {\n context.warning(DiagnosticCodes.UnusedReactionIdentity, `Reaction '${reaction.name}' declares an identity but has no invocations or implementation body.`, reaction.runsAs.location);\n }\n }\n for (const { reaction, invocation } of slice.reactions.flatMap(reaction => reaction.triggers.flatMap(trigger => trigger.invokes).map(invocation => ({ reaction, invocation })))) {\n const invoked = declarations.resolve(invocation.command, slice, owner => owner.commands);\n const authorizationGated = invoked !== null && (invoked.node.authorize !== null || gatedSlices.has(invoked.slice));\n const authorizationBranch = invocation.onRefused?.find(branch => branch.selector === 'authorization');\n if (reaction.runsAs == null && authorizationGated && authorizationBranch === undefined) {\n context.warning(DiagnosticCodes.GatedInvocationWithoutIdentity, `Command '${invocation.command}' is authorization-gated, but reaction '${reaction.name}' has no declared identity. Declare 'runs as system role \"<Role>\"'.`, invocation.location);\n }\n const earlier: InvocationRefusalSyntax[] = [];\n for (const branch of invocation.onRefused ?? []) {\n if (earlier.some(previous => covers(previous, branch))) context.warning(DiagnosticCodes.UnreachableRefusalBranch, 'This refusal selector is covered by an earlier branch; the first matching branch wins.', branch.location);\n earlier.push(branch);\n if (branch === authorizationBranch && reaction.runsAs == null && authorizationGated) {\n context.warning(DiagnosticCodes.AuthorizationRefusalWithoutIdentity,\n `Command '${invocation.command}' is authorization-gated, but this invocation has no declared identity. This authorization refusal branch always fires in the reference runner because there is no caller. Declare 'runs as system role \"<Role>\"'; Arc runs commands as the system only for a reactor carrying [ExecuteCommandsAsSystem].`,\n branch.location);\n }\n if (branch.constraint === null) continue;\n const constraint = constraintOf(branch.constraint);\n if (constraint === null) {\n context.error(DiagnosticCodes.UnknownRefusalConstraint, `Unknown or ambiguous refusal constraint '${branch.constraint}'.`, branch.location);\n continue;\n }\n if (invoked === null || invoked.node.handler !== null) continue;\n const rules = [constraint.node, ...constraint.node.additionalRules];\n if (rules.some(rule => rule.kind === 'FileConstraintSyntax')) continue;\n const targets = rules.map(rule => rule.kind === 'FileConstraintSyntax' ? null : declarations.event(rule.event, constraint.slice));\n const productions = invoked.node.produces.map(produced => declarations.event(produced.event, invoked.slice));\n if (targets.every(target => target !== null) && productions.every(produced => produced !== null) && !targets.some(target => productions.includes(target)))\n context.warning(DiagnosticCodes.UnreachableRefusalBranch, `Constraint '${branch.constraint}' targets none of the events produced by '${invocation.command}'.`, branch.location);\n }\n }\n }\n}\n"],"mappings":"A,0YAYA,SAAS,yBAAyB,EAAkD,CAChF,IAAMA,kBAAS,IAAI,IACb,SAAW,EAAwB,IAA6B,CAClE,IAAMC,EAAQC,GAAaC,EAAQ,YAAc,KAC7CF,GAAOE,EAAQ,OAAO,QAAQ,GAASH,EAAO,IAAII,CAAK,CAAC,EAC5DD,EAAQ,SAAS,QAAQ,GAAS,QAAQE,EAAOJ,CAAK,CAAC,CAC3D,EAEA,OADAK,EAAY,QAAQ,QAAQ,GAAUC,EAAO,SAAS,QAAQ,GAAW,QAAQJ,EAASI,EAAO,YAAc,IAAI,CAAC,CAAC,EAC9GP,CACX,CAEA,SAAgB,yBAAyB,EAAgC,EAA8B,CACnG,IAAMQ,EAAe,IAAIC,EAAoBC,EAA4BJ,CAAW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eAAeJ,EAAO,WAAW,4CAA4CM,EAAW,QAAQ,IAAKN,EAAO,QAAQ,CACtL,CACJ,CACJ,CACJ,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadModelKeyValidator.js","names":["models","AuthoringProductionResolver","application","slice","allowed","model","ScreenplaySyntaxWalker","syntax","context","DiagnosticCodes","keys","property","names","type"],"sources":["../../../../../../Compiler/Parsing/ReadModelKeyValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Only key-owner and property-shape checks are shared. Lookup resolution remains C# only.\nexport function validateReadModelKeys(application: ApplicationSyntax, context: ParserContext): void {\n const models = new AuthoringProductionResolver(application).slices.flatMap(({ slice }) => slice.readModels);\n const allowed = new Set(models.flatMap(model => model.properties));\n class KeyOwners extends ScreenplaySyntaxWalker {\n visitProperty(syntax: PropertySyntax): void {\n if (syntax.isKey && !allowed.has(syntax)) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', syntax.location);\n }\n super.visitProperty(syntax);\n }\n }\n new KeyOwners().visitApplication(application);\n for (const model of models) {\n const keys = model.properties.filter(property => property.isKey);\n const names = new Set<string>();\n for (const property of keys) {\n if (names.has(property.name)) context.error(DiagnosticCodes.InvalidReadModelKey, `Read-model key part '${property.name}' must be declared exactly once.`, property.location);\n names.add(property.name);\n }\n for (const property of keys) {\n if (keys.length > 1 && application.types.filter(type => type.name === property.type.name).length === 1) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'A read-model key part must be required and noncollection, cannot combine modifiers, and a multipart key must have scalar parts.', property.location);\n }\n }\n }\n}\n"],"mappings":"6RAWA,SAAgB,sBAAsB,EAAgC,EAA8B,CAChG,IAAMA,EAAS,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,SAAS,CAAE,WAAYC,EAAM,UAAU,EACpGC,EAAU,IAAI,IAAIJ,EAAO,QAAQ,GAASK,EAAM,UAAU,CAAC,EACjE,MAAM,kBAAkBC,CAAuB,CAC3C,cAAc,EAA8B,CACpCC,EAAO,OAAS,CAACH,EAAQ,IAAIG,CAAM,GACnCC,EAAQ,MAAMC,EAAgB,oBAAqB,qEAAsEF,EAAO,QAAQ,EAE5I,MAAM,cAAcA,CAAM,CAC9B,CACJ,CACA,IAAI,UAAU,CAAC,CAAC,iBAAiBL,CAAW,EAC5C,IAAK,IAAMG,KAASL,EAAQ,CACxB,IAAMU,EAAOL,EAAM,WAAW,OAAO,GAAYM,EAAS,KAAK,EACzDC,kBAAQ,IAAI,IAClB,IAAK,IAAMD,KAAYD,EACfE,EAAM,IAAID,EAAS,IAAI,GAAGH,EAAQ,MAAMC,EAAgB,oBAAqB,wBAAwBE,EAAS,KAAK,kCAAmCA,EAAS,QAAQ,EAC3KC,EAAM,IAAID,EAAS,IAAI,EAE3B,IAAK,IAAMA,KAAYD,EACfA,EAAK,OAAS,GAAKR,EAAY,MAAM,OAAO,GAAQW,EAAK,OAASF,EAAS,KAAK,IAAI,CAAC,CAAC,SAAW,GACjGH,EAAQ,MAAMC,EAAgB,oBAAqB,kIAAmIE,EAAS,QAAQ,CAGnN,CACJ"}
|
|
1
|
+
{"version":3,"file":"ReadModelKeyValidator.js","names":["models","AuthoringProductionResolver","application","slice","allowed","model","ScreenplaySyntaxWalker","syntax","context","DiagnosticCodes","keys","property","names","type"],"sources":["../../../../../../Compiler/Parsing/ReadModelKeyValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Only key-owner and property-shape checks are shared. Lookup resolution remains C# only.\nexport function validateReadModelKeys(application: ApplicationSyntax, context: ParserContext): void {\n const models = new AuthoringProductionResolver(application).slices.flatMap(({ slice }) => slice.readModels);\n const allowed = new Set(models.flatMap(model => model.properties));\n class KeyOwners extends ScreenplaySyntaxWalker {\n visitProperty(syntax: PropertySyntax): void {\n if (syntax.isKey && !allowed.has(syntax)) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', syntax.location);\n }\n super.visitProperty(syntax);\n }\n }\n new KeyOwners().visitApplication(application);\n for (const model of models) {\n const keys = model.properties.filter(property => property.isKey);\n const names = new Set<string>();\n for (const property of keys) {\n if (names.has(property.name)) context.error(DiagnosticCodes.InvalidReadModelKey, `Read-model key part '${property.name}' must be declared exactly once.`, property.location);\n names.add(property.name);\n }\n for (const property of keys) {\n if (keys.length > 1 && application.types.filter(type => type.name === property.type.name).length === 1) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'A read-model key part must be required and noncollection, cannot combine modifiers, and a multipart key must have scalar parts.', property.location);\n }\n }\n }\n}\n"],"mappings":"A,6RAWA,SAAgB,sBAAsB,EAAgC,EAA8B,CAChG,IAAMA,EAAS,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,SAAS,CAAE,WAAYC,EAAM,UAAU,EACpGC,EAAU,IAAI,IAAIJ,EAAO,QAAQ,GAASK,EAAM,UAAU,CAAC,EACjE,MAAM,kBAAkBC,CAAuB,CAC3C,cAAc,EAA8B,CACpCC,EAAO,OAAS,CAACH,EAAQ,IAAIG,CAAM,GACnCC,EAAQ,MAAMC,EAAgB,oBAAqB,qEAAsEF,EAAO,QAAQ,EAE5I,MAAM,cAAcA,CAAM,CAC9B,CACJ,CACA,IAAI,UAAU,CAAC,CAAC,iBAAiBL,CAAW,EAC5C,IAAK,IAAMG,KAASL,EAAQ,CACxB,IAAMU,EAAOL,EAAM,WAAW,OAAO,GAAYM,EAAS,KAAK,EACzDC,kBAAQ,IAAI,IAClB,IAAK,IAAMD,KAAYD,EACfE,EAAM,IAAID,EAAS,IAAI,GAAGH,EAAQ,MAAMC,EAAgB,oBAAqB,wBAAwBE,EAAS,KAAK,kCAAmCA,EAAS,QAAQ,EAC3KC,EAAM,IAAID,EAAS,IAAI,EAE3B,IAAK,IAAMA,KAAYD,EACfA,EAAK,OAAS,GAAKR,EAAY,MAAM,OAAO,GAAQW,EAAK,OAASF,EAAS,KAAK,IAAI,CAAC,CAAC,SAAW,GACjGH,EAAQ,MAAMC,EAAgB,oBAAqB,kIAAmIE,EAAS,QAAQ,CAGnN,CACJ,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadModelMemberTypeValidator.js","names":["types","application","concept","type","imported","slices","AuthoringProductionResolver","slice","models","readModels","model","dependencySourcesOf","reducer","variants","projection","block","variant","property","context","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/ReadModelMemberTypeValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// A read model has an identity; only primitives, concepts, top-level types and imported names\n// belong to the reusable value-type namespace. Validate after file composition.\nexport function validateReadModelMemberTypes(application: ApplicationSyntax, context: ParserContext): void {\n const types = new Set([\n 'Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime',\n ...application.concepts.map(concept => concept.name),\n ...application.types.map(type => type.name),\n ...application.imports.map(imported => imported.qualifiedName.split('.').at(-1)!),\n ]);\n const slices = new AuthoringProductionResolver(application).slices.map(({ slice }) => slice);\n const models = slices.flatMap(slice => slice.readModels);\n const readModels = new Set([\n ...models.map(model => model.name),\n ...slices.flatMap(slice => (dependencySourcesOf(slice).reducers ?? []).map(reducer => reducer.readModel)),\n ...slices.flatMap(slice => slice.projections.flatMap(projection => {\n const variants = projection.blocks.filter(block => block.kind === 'ProjectionVariantSyntax');\n return variants.length > 0 ? variants.map(variant => variant.name) : [projection.readModel ?? projection.name];\n })),\n ]);\n for (const model of models) {\n for (const property of model.properties.filter(property => !types.has(property.type.name) && readModels.has(property.type.name))) {\n context.error(DiagnosticCodes.InvalidSemanticBinding,\n `Read model '${model.name}' member '${property.name}' references unsupported type '${property.type.name}'. Use a primitive, concept or top-level 'type'; read-model shapes and slice-local 'type' declarations are not member types.`,\n property.type.location);\n }\n }\n}\n"],"mappings":"qRAWA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,kBAAQ,IAAI,IAAI,CAClB,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,WACpD,GAAGC,EAAY,SAAS,IAAI,GAAWC,EAAQ,IAAI,EACnD,GAAGD,EAAY,MAAM,IAAI,GAAQE,EAAK,IAAI,EAC1C,GAAGF,EAAY,QAAQ,IAAI,GAAYG,EAAS,cAAc,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAE,CACpF,CAAC,EACKC,EAAS,IAAIC,EAA4BL,CAAW,CAAC,CAAC,OAAO,KAAK,CAAE,WAAYM,CAAK,EACrFC,EAASH,EAAO,QAAQ,GAASE,EAAM,UAAU,EACjDE,kBAAa,IAAI,IAAI,CACvB,GAAGD,EAAO,IAAI,GAASE,EAAM,IAAI,EACjC,GAAGL,EAAO,QAAQ,IAAUM,EAAoBJ,CAAK,CAAC,CAAC,UAAY,CAAC,EAAA,CAAG,IAAI,GAAWK,EAAQ,SAAS,CAAC,EACxG,GAAGP,EAAO,QAAQ,GAASE,EAAM,YAAY,QAAQ,GAAc,CAC/D,IAAMM,EAAWC,EAAW,OAAO,OAAO,GAASC,EAAM,OAAS,yBAAyB,EAC3F,OAAOF,EAAS,OAAS,EAAIA,EAAS,IAAI,GAAWG,EAAQ,IAAI,EAAI,CAACF,EAAW,WAAaA,EAAW,IAAI,CACjH,CAAC,CAAC,CACN,CAAC,EACD,IAAK,IAAMJ,KAASF,EAChB,IAAK,IAAMS,KAAYP,EAAM,WAAW,OAAO,GAAY,CAACV,EAAM,IAAIiB,EAAS,KAAK,IAAI,GAAKR,EAAW,IAAIQ,EAAS,KAAK,IAAI,CAAC,EAC3HC,EAAQ,MAAMC,EAAgB,uBAC1B,eAAeT,EAAM,KAAK,YAAYO,EAAS,KAAK,iCAAiCA,EAAS,KAAK,KAAK,8HACxGA,EAAS,KAAK,QAAQ,CAGtC"}
|
|
1
|
+
{"version":3,"file":"ReadModelMemberTypeValidator.js","names":["types","application","concept","type","imported","slices","AuthoringProductionResolver","slice","models","readModels","model","dependencySourcesOf","reducer","variants","projection","block","variant","property","context","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/ReadModelMemberTypeValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// A read model has an identity; only primitives, concepts, top-level types and imported names\n// belong to the reusable value-type namespace. Validate after file composition.\nexport function validateReadModelMemberTypes(application: ApplicationSyntax, context: ParserContext): void {\n const types = new Set([\n 'Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime',\n ...application.concepts.map(concept => concept.name),\n ...application.types.map(type => type.name),\n ...application.imports.map(imported => imported.qualifiedName.split('.').at(-1)!),\n ]);\n const slices = new AuthoringProductionResolver(application).slices.map(({ slice }) => slice);\n const models = slices.flatMap(slice => slice.readModels);\n const readModels = new Set([\n ...models.map(model => model.name),\n ...slices.flatMap(slice => (dependencySourcesOf(slice).reducers ?? []).map(reducer => reducer.readModel)),\n ...slices.flatMap(slice => slice.projections.flatMap(projection => {\n const variants = projection.blocks.filter(block => block.kind === 'ProjectionVariantSyntax');\n return variants.length > 0 ? variants.map(variant => variant.name) : [projection.readModel ?? projection.name];\n })),\n ]);\n for (const model of models) {\n for (const property of model.properties.filter(property => !types.has(property.type.name) && readModels.has(property.type.name))) {\n context.error(DiagnosticCodes.InvalidSemanticBinding,\n `Read model '${model.name}' member '${property.name}' references unsupported type '${property.type.name}'. Use a primitive, concept or top-level 'type'; read-model shapes and slice-local 'type' declarations are not member types.`,\n property.type.location);\n }\n }\n}\n"],"mappings":"A,qRAWA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,kBAAQ,IAAI,IAAI,CAClB,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,WACpD,GAAGC,EAAY,SAAS,IAAI,GAAWC,EAAQ,IAAI,EACnD,GAAGD,EAAY,MAAM,IAAI,GAAQE,EAAK,IAAI,EAC1C,GAAGF,EAAY,QAAQ,IAAI,GAAYG,EAAS,cAAc,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAE,CACpF,CAAC,EACKC,EAAS,IAAIC,EAA4BL,CAAW,CAAC,CAAC,OAAO,KAAK,CAAE,WAAYM,CAAK,EACrFC,EAASH,EAAO,QAAQ,GAASE,EAAM,UAAU,EACjDE,kBAAa,IAAI,IAAI,CACvB,GAAGD,EAAO,IAAI,GAASE,EAAM,IAAI,EACjC,GAAGL,EAAO,QAAQ,IAAUM,EAAoBJ,CAAK,CAAC,CAAC,UAAY,CAAC,EAAA,CAAG,IAAI,GAAWK,EAAQ,SAAS,CAAC,EACxG,GAAGP,EAAO,QAAQ,GAASE,EAAM,YAAY,QAAQ,GAAc,CAC/D,IAAMM,EAAWC,EAAW,OAAO,OAAO,GAASC,EAAM,OAAS,yBAAyB,EAC3F,OAAOF,EAAS,OAAS,EAAIA,EAAS,IAAI,GAAWG,EAAQ,IAAI,EAAI,CAACF,EAAW,WAAaA,EAAW,IAAI,CACjH,CAAC,CAAC,CACN,CAAC,EACD,IAAK,IAAMJ,KAASF,EAChB,IAAK,IAAMS,KAAYP,EAAM,WAAW,OAAO,GAAY,CAACV,EAAM,IAAIiB,EAAS,KAAK,IAAI,GAAKR,EAAW,IAAIQ,EAAS,KAAK,IAAI,CAAC,EAC3HC,EAAQ,MAAMC,EAAgB,uBAC1B,eAAeT,EAAM,KAAK,YAAYO,EAAS,KAAK,iCAAiCA,EAAS,KAAK,KAAK,8HACxGA,EAAS,KAAK,QAAQ,CAGtC,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{captureReads as n}from"./DependencySourceParser.js";import{parseMappingSource as r}from"./ExpressionParser.js";import{locationOf as i}from"./SourceLine.js";const a=t(`^([a-z_]\\w*)\\s*=\\s*(.+)$`);function parseReads(t,o){let s=n(o);if(s===void 0){t.skipOpaqueBlock(o.indent);return}let c=[],l=!1;for(let n=t.peekChild(o.indent);n!==void 0;n=t.peekChild(o.indent))if(t.reader.takeSignificant(),n.content!==`by`||l||s.by!==null)t.error(e.ReadsWithChildren,`A reads line allows only one by child block, without a single by value.`,i(n)),t.skipBlock(n.indent);else{l=!0;for(let o=t.peekChild(n.indent);o!==void 0;o=t.peekChild(n.indent)){t.reader.takeSignificant();let n=a.exec(o.content);if(n===null){t.error(e.InvalidReadModelKeyLookup,`A reads by part must be '<part> = <source>'.`,i(o)),t.skipBlock(o.indent);continue}let s=o.content.indexOf(`=`)+1,l=s+o.content.substring(s).length-o.content.substring(s).trimStart().length;c.push({kind:`PropertyMappingSyntax`,property:n[1],source:r(n[2],{...i(o),column:o.indent+1+l},t.valueContext),location:i(o)})}}return l&&(c.length<2||new Set(c.map(e=>e.property)).size!==c.length)&&t.error(e.InvalidReadModelKeyLookup,`A reads by block requires at least two distinct named key parts.`,i(o)),{...s,...l?{byParts:c}:{}}}export{parseReads};
|
|
2
2
|
//# sourceMappingURL=ReadsParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadsParser.js","names":["partPattern","pattern","read","captureReads","line","context","parts","hasBlock","child","DiagnosticCodes","locationOf","part","match","offset","sourceOffset","parseMappingSource"],"sources":["../../../../../../Compiler/Parsing/ReadsParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ReadsSyntax } from '../Syntax/ReadsSyntax';\nimport { pattern } from '../Text/patterns';\nimport { captureReads } from './DependencySourceParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst partPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\n\nexport function parseReads(context: ParserContext, line: SourceLine): ReadsSyntax | undefined {\n const read = captureReads(line);\n if (read === undefined) {\n context.skipOpaqueBlock(line.indent);\n return undefined;\n }\n const parts: PropertyMappingSyntax[] = [];\n let hasBlock = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content !== 'by' || hasBlock || read.by !== null) {\n context.error(DiagnosticCodes.ReadsWithChildren, 'A reads line allows only one by child block, without a single by value.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n hasBlock = true;\n for (let part = context.peekChild(child.indent); part !== undefined; part = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const match = partPattern.exec(part.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelKeyLookup, \"A reads by part must be '<part> = <source>'.\", locationOf(part));\n context.skipBlock(part.indent);\n continue;\n }\n const offset = part.content.indexOf('=') + 1;\n const sourceOffset = offset + part.content.substring(offset).length - part.content.substring(offset).trimStart().length;\n parts.push({ kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], { ...locationOf(part), column: part.indent + 1 + sourceOffset }, context.valueContext), location: locationOf(part) });\n }\n }\n if (hasBlock && (parts.length < 2 || new Set(parts.map(part => part.property)).size !== parts.length)) {\n context.error(DiagnosticCodes.InvalidReadModelKeyLookup, 'A reads by block requires at least two distinct named key parts.', locationOf(line));\n }\n return { ...read, ...(hasBlock ? { byParts: parts } : {}) };\n}\n"],"mappings":"0UAYA,MAAMA,EAAcC,EAAQ,6BAA6B,EAEzD,SAAgB,WAAW,EAAwB,EAA2C,CAC1F,IAAMC,EAAOC,EAAaC,CAAI,EAC9B,GAAIF,IAAS,IAAA,GAAW,CACpBG,EAAQ,gBAAgBD,EAAK,MAAM,EACnC,MACJ,CACA,IAAME,EAAiC,CAAC,EACpCC,EAAW,GACf,IAAK,IAAIC,EAAQH,EAAQ,UAAUD,EAAK,MAAM,EAAGI,IAAU,IAAA,GAAW,EAAQH,EAAQ,UAAUD,EAAK,MAAM,EAEvG,GADAC,EAAQ,OAAO,gBAAgB,EAC3BG,EAAM,UAAY,MAAQD,GAAYL,EAAK,KAAO,KAClDG,EAAQ,MAAMI,EAAgB,kBAAmB,0EAA2EC,EAAWF,CAAK,CAAC,EAC7IH,EAAQ,UAAUG,EAAM,MAAM,MAGlC,GAAW,GACX,IAAK,IAAIG,EAAON,EAAQ,UAAUG,EAAM,MAAM,EAAGG,IAAS,IAAA,GAAW,EAAON,EAAQ,UAAUG,EAAM,MAAM,EAAG,CACzGH,EAAQ,OAAO,gBAAgB,EAC/B,IAAMO,EAAQZ,EAAY,KAAKW,EAAK,OAAO,EAC3C,GAAIC,IAAU,KAAM,CAChBP,EAAQ,MAAMI,EAAgB,0BAA2B,+CAAgDC,EAAWC,CAAI,CAAC,EACzHN,EAAQ,UAAUM,EAAK,MAAM,EAC7B,QACJ,CACA,IAAME,EAASF,EAAK,QAAQ,QAAQ,GAAG,EAAI,EACrCG,EAAeD,EAASF,EAAK,QAAQ,UAAUE,CAAM,CAAC,CAAC,OAASF,EAAK,QAAQ,UAAUE,CAAM,CAAC,CAAC,UAAU,CAAC,CAAC,OACjHP,EAAM,KAAK,CAAE,KAAM,wBAAyB,SAAUM,EAAM,GAAI,OAAQG,EAAmBH,EAAM,GAAI,CAAE,GAAGF,EAAWC,CAAI,EAAG,OAAQA,EAAK,OAAS,EAAIG,CAAa,EAAGT,EAAQ,YAAY,EAAG,SAAUK,EAAWC,CAAI,CAAE,CAAC,CAC7N,CAZW,CAiBf,OAHIJ,IAAaD,EAAM,OAAS,GAAK,IAAI,IAAIA,EAAM,IAAI,GAAQK,EAAK,QAAQ,CAAC,CAAC,CAAC,OAASL,EAAM,SAC1FD,EAAQ,MAAMI,EAAgB,0BAA2B,mEAAoEC,EAAWN,CAAI,CAAC,EAE1I,CAAE,GAAGF,EAAM,GAAIK,EAAW,CAAE,QAASD,CAAM,EAAI,CAAC,CAAG,CAC9D"}
|
|
1
|
+
{"version":3,"file":"ReadsParser.js","names":["partPattern","pattern","read","captureReads","line","context","parts","hasBlock","child","DiagnosticCodes","locationOf","part","match","offset","sourceOffset","parseMappingSource"],"sources":["../../../../../../Compiler/Parsing/ReadsParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ReadsSyntax } from '../Syntax/ReadsSyntax';\nimport { pattern } from '../Text/patterns';\nimport { captureReads } from './DependencySourceParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst partPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\n\nexport function parseReads(context: ParserContext, line: SourceLine): ReadsSyntax | undefined {\n const read = captureReads(line);\n if (read === undefined) {\n context.skipOpaqueBlock(line.indent);\n return undefined;\n }\n const parts: PropertyMappingSyntax[] = [];\n let hasBlock = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content !== 'by' || hasBlock || read.by !== null) {\n context.error(DiagnosticCodes.ReadsWithChildren, 'A reads line allows only one by child block, without a single by value.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n hasBlock = true;\n for (let part = context.peekChild(child.indent); part !== undefined; part = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const match = partPattern.exec(part.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelKeyLookup, \"A reads by part must be '<part> = <source>'.\", locationOf(part));\n context.skipBlock(part.indent);\n continue;\n }\n const offset = part.content.indexOf('=') + 1;\n const sourceOffset = offset + part.content.substring(offset).length - part.content.substring(offset).trimStart().length;\n parts.push({ kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], { ...locationOf(part), column: part.indent + 1 + sourceOffset }, context.valueContext), location: locationOf(part) });\n }\n }\n if (hasBlock && (parts.length < 2 || new Set(parts.map(part => part.property)).size !== parts.length)) {\n context.error(DiagnosticCodes.InvalidReadModelKeyLookup, 'A reads by block requires at least two distinct named key parts.', locationOf(line));\n }\n return { ...read, ...(hasBlock ? { byParts: parts } : {}) };\n}\n"],"mappings":"A,0UAYA,MAAMA,EAAcC,EAAQ,6BAA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AHIJ,IAAaD,EAAM,OAAS,GAAK,IAAI,IAAIA,EAAM,IAAI,GAAQK,EAAK,QAAQ,CAAC,CAAC,CAAC,OAASL,EAAM,SAC1FD,EAAQ,MAAMI,EAAgB,0BAA2B,mEAAoEC,EAAWN,CAAI,CAAC,EAE1I,CAAE,GAAGF,EAAM,GAAIK,EAAW,CAAE,QAASD,CAAM,EAAI,CAAC,CAAG,CAC9D,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedeliveryValues.js","names":["concept","type","declarations","enumeration","text","expression","items","item","properties","members","property","left","right","value","canonicalExactText","first","second"],"sources":["../../../../../../Compiler/Parsing/RedeliveryValues.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { canonicalExactText } from '../Syntax/ExactMathFacts';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RedeliveryValue } from './RedeliveryValue';\n\n// Undefined means undecidable, not the authored null literal. Mirror TryValue in the C#\n// specification consistency validator, including nominal enums and structured fixture values.\nexport function redeliveryValue(expression: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): RedeliveryValue | undefined {\n const concept = type === null || type.isCollection ? undefined : declarations.concepts.get(type.name);\n const enumeration = concept !== undefined && concept.type === 'Enum' ? concept : null;\n const member = (text: string) => enumeration !== null && text.startsWith(`${enumeration.name}.`) ? text.substring(enumeration.name.length + 1) : text;\n if (type?.isCollection && expression.kind === 'ListExpressionSyntax' && declarations.compatible({ ...type, isCollection: false }, { ...type, isCollection: false }) === true) {\n const items = expression.items.map(item => redeliveryValue(item, { ...type, isCollection: false, isOptional: false }, declarations));\n return items.some(item => item === undefined) ? undefined : { canonical: `[${items.map(canonical).join(',')}]` };\n }\n const properties = type === null ? undefined : declarations.types.get(type.name)?.properties;\n if (type !== null && !type.isCollection && expression.kind === 'ObjectExpressionSyntax' && properties !== undefined) {\n const members = expression.members.map(item => {\n const property = declarations.property(properties, item.name);\n return { name: item.name, value: property === null ? undefined : redeliveryValue(item.value, property.type, declarations) };\n });\n return members.some(item => item.value === undefined) ? undefined : { canonical: `{${members.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0).map(item => `${JSON.stringify(item.name)}:${canonical(item.value)}`).join(',')}}` };\n }\n if (expression.kind === 'LiteralExpressionSyntax') return enumeration !== null && typeof expression.value === 'string' ? member(expression.value) : expression.value;\n if (expression.kind === 'PathExpressionSyntax' && enumeration !== null) return member(expression.path);\n return undefined;\n}\n\nfunction canonical(value: RedeliveryValue | undefined): string {\n if (typeof value === 'object' && value !== null) return 'canonical' in value ? value.canonical : canonicalExactText(value);\n return JSON.stringify(value)!;\n}\n\nexport function sameRedeliveryValue(left: ExpressionSyntax, right: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): boolean | null {\n const first = redeliveryValue(left, type, declarations);\n const second = redeliveryValue(right, type, declarations);\n if (first === undefined || second === undefined) return null;\n return canonical(first) === canonical(second);\n}\n"],"mappings":"sHAWA,SAAgB,gBAAgB,EAA8B,EAA4B,EAAgE,CACtJ,IAAMA,EAAUC,IAAS,MAAQA,EAAK,aAAe,IAAA,GAAYC,EAAa,SAAS,IAAID,EAAK,IAAI,EAC9FE,EAAcH,IAAY,IAAA,IAAaA,EAAQ,OAAS,OAASA,EAAU,KAC3E,OAAU,GAAiBG,IAAgB,MAAQC,EAAK,WAAW,GAAGD,EAAY,KAAK,EAAE,EAAIC,EAAK,UAAUD,EAAY,KAAK,OAAS,CAAC,EAAIC,EACjJ,GAAIH,GAAM,cAAgBI,EAAW,OAAS,wBAA0BH,EAAa,WAAW,CAAE,GAAGD,EAAM,aAAc,EAAM,EAAG,CAAE,GAAGA,EAAM,aAAc,EAAM,CAAC,IAAM,GAAM,CAC1K,IAAMK,EAAQD,EAAW,MAAM,IAAI,GAAQ,gBA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BD,CAAK,EAClH,KAAK,UAAUA,CAAK,CAC/B,CAEA,SAAgB,oBAAoB,EAAwB,EAAyB,EAA4B,EAAmD,CAChK,IAAME,EAAQ,gBAAgBJ,EAAMV,EAAMC,CAAY,EAChDc,EAAS,gBAAgBJ,EAAOX,EAAMC,CAAY,EAExD,OADIa,IAAU,IAAA,IAAaC,IAAW,IAAA,GAAkB,KACjD,UAAUD,CAAK,IAAM,UAAUC,CAAM,CAChD"}
|
|
1
|
+
{"version":3,"file":"RedeliveryValues.js","names":["concept","type","declarations","enumeration","text","expression","items","item","properties","members","property","left","right","value","canonicalExactText","first","second"],"sources":["../../../../../../Compiler/Parsing/RedeliveryValues.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { canonicalExactText } from '../Syntax/ExactMathFacts';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RedeliveryValue } from './RedeliveryValue';\n\n// Undefined means undecidable, not the authored null literal. Mirror TryValue in the C#\n// specification consistency validator, including nominal enums and structured fixture values.\nexport function redeliveryValue(expression: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): RedeliveryValue | undefined {\n const concept = type === null || type.isCollection ? undefined : declarations.concepts.get(type.name);\n const enumeration = concept !== undefined && concept.type === 'Enum' ? concept : null;\n const member = (text: string) => enumeration !== null && text.startsWith(`${enumeration.name}.`) ? text.substring(enumeration.name.length + 1) : text;\n if (type?.isCollection && expression.kind === 'ListExpressionSyntax' && declarations.compatible({ ...type, isCollection: false }, { ...type, isCollection: false }) === true) {\n const items = expression.items.map(item => redeliveryValue(item, { ...type, isCollection: false, isOptional: false }, declarations));\n return items.some(item => item === undefined) ? undefined : { canonical: `[${items.map(canonical).join(',')}]` };\n }\n const properties = type === null ? undefined : declarations.types.get(type.name)?.properties;\n if (type !== null && !type.isCollection && expression.kind === 'ObjectExpressionSyntax' && properties !== undefined) {\n const members = expression.members.map(item => {\n const property = declarations.property(properties, item.name);\n return { name: item.name, value: property === null ? undefined : redeliveryValue(item.value, property.type, declarations) };\n });\n return members.some(item => item.value === undefined) ? undefined : { canonical: `{${members.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0).map(item => `${JSON.stringify(item.name)}:${canonical(item.value)}`).join(',')}}` };\n }\n if (expression.kind === 'LiteralExpressionSyntax') return enumeration !== null && typeof expression.value === 'string' ? member(expression.value) : expression.value;\n if (expression.kind === 'PathExpressionSyntax' && enumeration !== null) return member(expression.path);\n return undefined;\n}\n\nfunction canonical(value: RedeliveryValue | undefined): string {\n if (typeof value === 'object' && value !== null) return 'canonical' in value ? value.canonical : canonicalExactText(value);\n return JSON.stringify(value)!;\n}\n\nexport function sameRedeliveryValue(left: ExpressionSyntax, right: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): boolean | null {\n const first = redeliveryValue(left, type, declarations);\n const second = redeliveryValue(right, type, declarations);\n if (first === undefined || second === undefined) return null;\n return canonical(first) === canonical(second);\n}\n"],"mappings":"A,sHAWA,SAAgB,gBAAgB,EAA8B,EAA4B,EAAgE,CACtJ,IAAMA,EAAUC,IAAS,MAAQA,EAAK,aAAe,IAAA,GAAYC,EAAa,SAAS,IAAID,EAAK,IAAI,EAC9FE,EAAcH,IAAY,IAAA,IAAaA,EAAQ,OAAS,OAASA,EAAU,KAC3E,OAAU,GAAiBG,IAAgB,MAAQC,EAAK,WAAW,GAAGD,EAAY,KAAK,EAAE,EAAIC,EAAK,UAAUD,EAAY,KAAK,OAAS,CAAC,EAAIC,EACjJ,GAAIH,GAAM,cAAgBI,EAAW,OAAS,wBAA0BH,EAAa,WAAW,CAAE,GAAGD,EAAM,aAAc,EAAM,EAAG,CAAE,GAAGA,EAAM,aAAc,EAAM,CAAC,IAAM,GAAM,CAC1K,IAAMK,EAAQD,EAAW,MAAM,IAAI,GAAQ,g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AmBD,CAAK,EAClH,KAAK,UAAUA,CAAK,CAC/B,CAEA,SAAgB,oBAAoB,EAAwB,EAAyB,EAA4B,EAAmD,CAChK,IAAME,EAAQ,gBAAgBJ,EAAMV,EAAMC,CAAY,EAChDc,EAAS,gBAAgBJ,EAAOX,EAAMC,CAAY,EAExD,OADIa,IAAU,IAAA,IAAaC,IAAW,IAAA,GAAkB,KACjD,UAAUD,CAAK,IAAM,UAAUC,CAAM,CAChD,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{AuthoringProductionResolver as e}from"../Syntax/AuthoringProductionResolver.js";import{eventDeclarations as t}from"../Syntax/EventDeclarations.js";import{uniqueByName as n}from"./ResponseValidator.js";const r=/* @__PURE__ */ new Set([`String`,`Uuid`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`]);var RefusalDeclarations=class{application;slices;types;concepts;events;knownTypes;constructor(i){this.application=i,this.slices=new e(i).slices,this.types=n(i.types),this.concepts=n(i.concepts),this.knownTypes=/* @__PURE__ */ new Set([...r,...i.types.map(e=>e.name),...i.concepts.map(e=>e.name)]),this.events=new Map(this.slices.map(({slice:e})=>{let n=/* @__PURE__ */ new Map;for(let r of t(e))(!n.has(r.name)||n.get(r.name).generation<r.generation)&&n.set(r.name,r);return[e,[...n.values()]]}))}resolve(e,t,n){let r=this.slices.flatMap(({slice:e,scope:t})=>n(e).map(n=>({node:n,slice:e,scope:t}))),i=this.slices.find(e=>e.slice===t)?.scope??[],candidates=e=>{let t=e.split(`.`),n=r.filter(e=>e.node.name===t.at(-1)),a=t.slice(0,-1);if(a.length>0)return n.filter(e=>a.length<=e.scope.length&&a.every((t,n)=>e.scope[e.scope.length-a.length+n]===t));for(let e=i.length;e>=0;e--){let t=n.filter(t=>e<=t.scope.length&&i.slice(0,e).every((e,n)=>t.scope[n]===e));if(t.length>0)return t}return[]},a=candidates(e);if(a.length===0){let t=this.application.imports.filter(t=>t.qualifiedName.split(`.`).at(-1)===e);t.length===1&&(a=candidates(t[0].qualifiedName))}return a.length===1?a[0]:null}event(e,t){return this.resolve(e,t,e=>this.events.get(e)??[])?.node??null}property(e,t){let n=t.split(`.`);for(let[t,i]of n.entries()){let a=e?.filter(e=>e.name===i)??[];if(a.length!==1)return null;let o=a[0];if(t===n.length-1)return o;if(r.has(o.type.name)||this.concepts.has(o.type.name)&&!this.application.types.some(e=>e.name===o.type.name))return null;e=this.types.get(o.type.name)?.properties??null}return null}compatible(e,t){return this.knownTypes.has(e.name)&&this.knownTypes.has(t.name)?e.name===t.name&&e.isCollection===t.isCollection&&(!e.isOptional||t.isOptional):null}};export{RefusalDeclarations};
|
|
2
2
|
//# sourceMappingURL=RefusalDeclarations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefusalDeclarations.js","names":["primitives","application","AuthoringProductionResolver","uniqueByName","type","concept","latest","event","eventDeclarations","slice","entries","select","scope","entry","from","parts","reference","named","qualifiers","index","part","depth","visible","matches","name","imports","imported","path","properties","property","source","target"],"sources":["../../../../../../Compiler/Parsing/RefusalDeclarations.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 { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nconst primitives = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// The scoped declaration facts used by the C# refusal and redelivery consistency validators.\nexport class RefusalDeclarations {\n readonly slices: AuthoringProductionResolver['slices'];\n readonly types;\n readonly concepts;\n private readonly events;\n private readonly knownTypes: Set<string>;\n\n constructor(readonly application: ApplicationSyntax) {\n this.slices = new AuthoringProductionResolver(application).slices;\n this.types = uniqueByName(application.types);\n this.concepts = uniqueByName(application.concepts);\n this.knownTypes = new Set([...primitives, ...application.types.map(type => type.name), ...application.concepts.map(concept => concept.name)]);\n this.events = new Map(this.slices.map(({ slice }) => {\n const latest = new Map<string, ReturnType<typeof eventDeclarations>[number]>();\n for (const event of eventDeclarations(slice)) {\n if (!latest.has(event.name) || latest.get(event.name)!.generation < event.generation) latest.set(event.name, event);\n }\n return [slice, [...latest.values()]];\n }));\n }\n\n resolve<T extends { readonly name: string }>(name: string, from: SliceSyntax | undefined, select: (slice: SliceSyntax) => readonly T[]): { node: T; slice: SliceSyntax } | null {\n const entries = this.slices.flatMap(({ slice, scope }) => select(slice).map(node => ({ node, slice, scope })));\n const scope = this.slices.find(entry => entry.slice === from)?.scope ?? [];\n const candidates = (reference: string) => {\n const parts = reference.split('.');\n const named = entries.filter(entry => entry.node.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((part, index) => entry.scope[entry.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((part, index) => entry.scope[index] === part));\n if (visible.length > 0) return visible;\n }\n return [];\n };\n let matches = candidates(name);\n if (matches.length === 0) {\n const imports = this.application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name);\n if (imports.length === 1) matches = candidates(imports[0].qualifiedName);\n }\n return matches.length === 1 ? matches[0] : null;\n }\n\n event(name: string, from: SliceSyntax) {\n return this.resolve(name, from, slice => this.events.get(slice) ?? [])?.node ?? null;\n }\n\n property(properties: readonly PropertySyntax[] | null, path: string): PropertySyntax | null {\n const parts = path.split('.');\n for (const [index, part] of parts.entries()) {\n const matches: readonly PropertySyntax[] = properties?.filter(property => property.name === part) ?? [];\n if (matches.length !== 1) return null;\n const property = matches[0];\n if (index === parts.length - 1) return property;\n if (primitives.has(property.type.name) || this.concepts.has(property.type.name) && !this.application.types.some(type => type.name === property.type.name)) return null;\n properties = this.types.get(property.type.name)?.properties ?? null;\n }\n return null;\n }\n\n compatible(source: TypeRefSyntax, target: TypeRefSyntax): boolean | null {\n return this.knownTypes.has(source.name) && this.knownTypes.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n }\n}\n"],"mappings":"qQASA,MAAMA,kBAAa,IAAI,IAAI,CAAC,SAAU,OAAQ,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG3F,IAAa,oBAAb,KAAiC,CAOR,YANrB,OACA,MACA,SACA,OACA,WAEA,YAAY,EAAyC,CAAhC,KAAA,YAAAC,EACjB,KAAK,OAAS,IAAIC,EAA4BD,CAAW,CAAC,CAAC,OAC3D,KAAK,MAAQE,EAAaF,EAAY,KAAK,EAC3C,KAAK,SAAWE,EAAaF,EAAY,QAAQ,EACjD,KAAK,2BAAa,IAAI,IAAI,CAAC,GAAGD,EAAY,GAAGC,EAAY,MAAM,IAAI,GAAQG,EAAK,IAAI,EAAG,GAAGH,EAAY,SAAS,IAAI,GAAWI,EAAQ,IAAI,CAAC,CAAC,EAC5I,KAAK,OAAS,IAAI,IAAI,KAAK,OAAO,KAAK,CAAE,WAAY,CACjD,IAAMC,kBAAS,IAAI,IACnB,IAAK,IAAMC,KAASC,EAAkBC,CAAK,GACnC,CAACH,EAAO,IAAIC,EAAM,IAAI,GAAKD,EAAO,IAAIC,EAAM,IAAI,CAAC,CAAE,WAAaA,EAAM,aAAYD,EAAO,IAAIC,EAAM,KAAMA,CAAK,EAEtH,MAAO,CAACE,EAAO,CAAC,GAAGH,EAAO,OAAO,CAAC,CAAC,CACvC,CAAC,CAAC,CACN,CAEA,QAA6C,EAAc,EAA+B,EAAsF,CAC5K,IAAMI,EAAU,KAAK,OAAO,SAAS,CAAE,QAAO,WAAYC,EAAOF,CAAK,CAAC,CAAC,IAAI,I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Y,EAAK,MAAM,GAAG,EAC5B,IAAK,GAAM,CAACR,EAAOC,KAASL,EAAM,QAAQ,EAAG,CACzC,IAAMQ,EAAqCK,GAAY,OAAO,GAAYC,EAAS,OAAST,CAAI,GAAK,CAAC,EACtG,GAAIG,EAAQ,SAAW,EAAG,OAAO,KACjC,IAAMM,EAAWN,EAAQ,GACzB,GAAIJ,IAAUJ,EAAM,OAAS,EAAG,OAAOc,EACvC,GAAI7B,EAAW,IAAI6B,EAAS,KAAK,IAAI,GAAK,KAAK,SAAS,IAAIA,EAAS,KAAK,IAAI,GAAK,CAAC,KAAK,YAAY,MAAM,KAAK,GAAQzB,EAAK,OAASyB,EAAS,KAAK,IAAI,EAAG,OAAO,KAClK,EAAa,KAAK,MAAM,IAAIA,EAAS,KAAK,IAAI,CAAC,EAAE,YAAc,IACnE,CACA,OAAO,IACX,CAEA,WAAW,EAAuB,EAAuC,CACrE,OAAO,KAAK,WAAW,IAAIC,EAAO,IAAI,GAAK,KAAK,WAAW,IAAIC,EAAO,IAAI,EACpED,EAAO,OAASC,EAAO,MAAQD,EAAO,eAAiBC,EAAO,eAAiB,CAACD,EAAO,YAAcC,EAAO,YAAc,IACpI,CACJ"}
|
|
1
|
+
{"version":3,"file":"RefusalDeclarations.js","names":["primitives","application","AuthoringProductionResolver","uniqueByName","type","concept","latest","event","eventDeclarations","slice","entries","select","scope","entry","from","parts","reference","named","qualifiers","index","part","depth","visible","matches","name","imports","imported","path","properties","property","source","target"],"sources":["../../../../../../Compiler/Parsing/RefusalDeclarations.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 { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nconst primitives = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// The scoped declaration facts used by the C# refusal and redelivery consistency validators.\nexport class RefusalDeclarations {\n readonly slices: AuthoringProductionResolver['slices'];\n readonly types;\n readonly concepts;\n private readonly events;\n private readonly knownTypes: Set<string>;\n\n constructor(readonly application: ApplicationSyntax) {\n this.slices = new AuthoringProductionResolver(application).slices;\n this.types = uniqueByName(application.types);\n this.concepts = uniqueByName(application.concepts);\n this.knownTypes = new Set([...primitives, ...application.types.map(type => type.name), ...application.concepts.map(concept => concept.name)]);\n this.events = new Map(this.slices.map(({ slice }) => {\n const latest = new Map<string, ReturnType<typeof eventDeclarations>[number]>();\n for (const event of eventDeclarations(slice)) {\n if (!latest.has(event.name) || latest.get(event.name)!.generation < event.generation) latest.set(event.name, event);\n }\n return [slice, [...latest.values()]];\n }));\n }\n\n resolve<T extends { readonly name: string }>(name: string, from: SliceSyntax | undefined, select: (slice: SliceSyntax) => readonly T[]): { node: T; slice: SliceSyntax } | null {\n const entries = this.slices.flatMap(({ slice, scope }) => select(slice).map(node => ({ node, slice, scope })));\n const scope = this.slices.find(entry => entry.slice === from)?.scope ?? [];\n const candidates = (reference: string) => {\n const parts = reference.split('.');\n const named = entries.filter(entry => entry.node.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((part, index) => entry.scope[entry.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((part, index) => entry.scope[index] === part));\n if (visible.length > 0) return visible;\n }\n return [];\n };\n let matches = candidates(name);\n if (matches.length === 0) {\n const imports = this.application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name);\n if (imports.length === 1) matches = candidates(imports[0].qualifiedName);\n }\n return matches.length === 1 ? matches[0] : null;\n }\n\n event(name: string, from: SliceSyntax) {\n return this.resolve(name, from, slice => this.events.get(slice) ?? [])?.node ?? null;\n }\n\n property(properties: readonly PropertySyntax[] | null, path: string): PropertySyntax | null {\n const parts = path.split('.');\n for (const [index, part] of parts.entries()) {\n const matches: readonly PropertySyntax[] = properties?.filter(property => property.name === part) ?? [];\n if (matches.length !== 1) return null;\n const property = matches[0];\n if (index === parts.length - 1) return property;\n if (primitives.has(property.type.name) || this.concepts.has(property.type.name) && !this.application.types.some(type => type.name === property.type.name)) return null;\n properties = this.types.get(property.type.name)?.properties ?? null;\n }\n return null;\n }\n\n compatible(source: TypeRefSyntax, target: TypeRefSyntax): boolean | null {\n return this.knownTypes.has(source.name) && this.knownTypes.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n }\n}\n"],"mappings":"A,qQASA,MAAMA,kBAAa,IAAI,IAAI,CAAC,SAAU,OAAQ,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG3F,IAAa,oBAAb,KAAiC,CAOR,YANrB,OACA,MACA,SACA,OACA,WAEA,YAAY,EAAyC,CAAhC,KAAA,YAAAC,EACjB,KAAK,OAAS,IAAIC,EAA4BD,CAAW,CAAC,CAAC,OAC3D,KAAK,MAAQE,EAAaF,EAAY,KAAK,EAC3C,KAAK,SAAWE,EAAaF,EAAY,QAAQ,EACjD,KAAK,2BAAa,IAAI,IAAI,CAAC,GAAGD,EAAY,GAAGC,EAAY,MAAM,IAAI,GAAQG,EAAK,IAAI,EAAG,GAAGH,EAAY,SAAS,IAAI,GAAWI,EAAQ,IAAI,CAAC,CAAC,EAC5I,KAAK,OAAS,IAAI,IAAI,KAAK,OAAO,KAAK,CAAE,WAAY,CACjD,IAAMC,kBAAS,IAAI,IACnB,IAAK,IAAMC,KAASC,EAAkBC,CAAK,GACnC,CAACH,EAAO,IAAIC,EAAM,IAAI,GAAKD,EAAO,IAAIC,EAAM,IAAI,CAAC,CAAE,WAAaA,EAAM,aAAYD,EAAO,IAAIC,EAAM,KAAM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,SAAW,EAAIA,EAAQ,GAAK,IAC/C,CAEA,MAAM,EAAc,EAAmB,CACnC,OAAO,KAAK,QAAQC,EAAMV,EAAM,GAAS,KAAK,OAAO,IAAIL,CAAK,GAAK,CAAC,CAAC,CAAC,EAAE,MAAQ,IACpF,CAEA,SAAS,EAA8C,EAAqC,CACxF,IAAMM,EAAQY,EAAK,MAAM,GAAG,EAC5B,IAAK,GAAM,CAACR,EAAOC,KAASL,EAAM,QAAQ,EAAG,CACzC,IAAMQ,EAAqCK,GAAY,OAAO,GAAYC,EAAS,OAAST,CAAI,GAAK,CAAC,EACtG,GAAIG,EAAQ,SAAW,EAAG,OAAO,KACjC,IAAMM,EAAWN,EAAQ,GACzB,GAAIJ,IAAUJ,EAAM,OAAS,EAAG,OAAOc,EACvC,GAAI7B,EAAW,IAAI6B,EAAS,KAAK,IAAI,GAAK,KAAK,SAAS,IAAIA,EAAS,KAAK,IAAI,GAAK,CAAC,KAAK,YAAY,MAAM,KAAK,GAAQzB,EAAK,OAASyB,EAAS,KAAK,IAAI,EAAG,OAAO,KAClK,EAAa,KAAK,MAAM,IAAIA,EAAS,KAAK,IAAI,CAAC,EAAE,YAAc,IACnE,CACA,OAAO,IACX,CAEA,WAAW,EAAuB,EAAuC,CACrE,OAAO,KAAK,WAAW,IAAIC,EAAO,IAAI,GAAK,KAAK,WAAW,IAAIC,EAAO,IAAI,EACpED,EAAO,OAASC,EAAO,MAAQD,EAAO,eAAiBC,EAAO,eAAiB,CAACD,EAAO,YAAcC,EAAO,YAAc,IACpI,CACJ,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefusalValueWalker.js","names":["ScreenplaySyntaxWalker","declarations","context","syntax","tag","mapping","parent","DiagnosticCodes","concept"],"sources":["../../../../../../Compiler/Parsing/RefusalValueWalker.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nexport class RefusalValueWalker extends ScreenplaySyntaxWalker {\n private slice: SliceSyntax | null = null;\n private branch: InvocationRefusalSyntax | null = null;\n private properties: readonly PropertySyntax[] | null = null;\n private target: TypeRefSyntax | null = null;\n private mapping = false;\n\n constructor(private readonly declarations: RefusalDeclarations, private readonly context: ParserContext) { super(); }\n\n visitSlice(syntax: SliceSyntax): void {\n this.slice = syntax;\n super.visitSlice(syntax);\n this.slice = null;\n }\n\n visitInvocationRefusal(syntax: InvocationRefusalSyntax): void {\n this.branch = syntax;\n super.visitInvocationRefusal(syntax);\n this.branch = null;\n }\n\n visitProduces(syntax: ProducesSyntax): void {\n if (this.branch === null || this.slice === null) { super.visitProduces(syntax); return; }\n this.visitNode(syntax);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n if (syntax.when != null) this.visitCondition(syntax.when);\n syntax.tags.forEach(tag => this.visitTag(tag));\n this.properties = this.declarations.event(syntax.event, this.slice)?.properties ?? null;\n syntax.mappings.forEach(mapping => this.visitPropertyMapping(mapping));\n this.properties = null;\n }\n\n visitPropertyMapping(syntax: PropertyMappingSyntax): void {\n this.mapping = this.branch !== null;\n this.target = this.declarations.property(this.properties, syntax.property)?.type ?? null;\n super.visitPropertyMapping(syntax);\n this.target = null;\n this.mapping = false;\n }\n\n visitObjectMember(syntax: ObjectMemberSyntax): void {\n const parent = this.target;\n this.target = this.declarations.property(parent === null ? null : this.declarations.types.get(parent.name)?.properties ?? null, syntax.name)?.type ?? null;\n super.visitObjectMember(syntax);\n this.target = parent;\n }\n\n visitExpression(syntax: ExpressionSyntax): void {\n if (syntax.kind === 'RefusalExpressionSyntax') {\n if (!this.mapping || this.branch === null || !['reason', 'constraint', 'message'].includes(syntax.member) || syntax.member === 'constraint' && this.branch.selector !== 'constraint') {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is only available in a refusal branch's event mapping; constraint requires 'by constraint'.`, syntax.location);\n } else if (this.target !== null && (this.target.isCollection || this.declarations.compatible({ ...this.target, name: 'String', isOptional: false, isCollection: false }, this.target) === false && !this.declarations.application.concepts.some(concept => concept.name === this.target!.name && concept.type === 'String'))) {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is a String value, incompatible with '${this.target.name}'.`, syntax.location);\n }\n }\n const parent = this.target;\n if (syntax.kind === 'ListExpressionSyntax' && parent !== null) this.target = { ...parent, isCollection: false };\n super.visitExpression(syntax);\n this.target = parent;\n }\n}\n"],"mappings":"sMAaA,IAAa,mBAAb,cAAwCA,CAAuB,CAO9B,aAAoD,QANjF,MAAoC,KACpC,OAAiD,KACjD,WAAuD,KACvD,OAAuC,KACvC,QAAkB,GAElB,YAAY,EAAoD,EAAyC,CAAE,MAAM,EAApF,KAAA,aAAAC,EAAoD,KAAA,QAAAC,CAAmC,CAEpH,WAAW,EAA2B,CAClC,KAAK,MAAQC,EACb,MAAM,WAAWA,CAAM,EACvB,KAAK,MAAQ,IACjB,CAEA,uBAAuB,EAAuC,CAC1D,KAAK,OAASA,EACd,MAAM,uBAAuBA,CAAM,EACnC,KAAK,OAAS,IAClB,CAEA,cAAc,EAA8B,CACpC,KAAK,SAAW,MAAQ,KAAK,QAAU,KAAQ,MAAM,cAAcA,CAAM,GAC7E,KAAK,UAAUA,CAAM,EACjBA,EAAO,MAAQ,MAAM,KAAK,gBAAgBA,EAAO,GAAG,EACpDA,EAAO,MAAQ,MAAM,KAAK,eAAeA,EAAO,I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EAAgB,oBAAqB,aAAaJ,EAAO,OAAO,0CAA0C,KAAK,OAAO,KAAK,IAAKA,EAAO,QAAQ,GAG1K,IAAMG,EAAS,KAAK,OAChBH,EAAO,OAAS,wBAA0BG,IAAW,OAAM,KAAK,OAAS,CAAE,GAAGA,EAAQ,aAAc,EAAM,GAC9G,MAAM,gBAAgBH,CAAM,EAC5B,KAAK,OAASG,CAClB,CACJ"}
|
|
1
|
+
{"version":3,"file":"RefusalValueWalker.js","names":["ScreenplaySyntaxWalker","declarations","context","syntax","tag","mapping","parent","DiagnosticCodes","concept"],"sources":["../../../../../../Compiler/Parsing/RefusalValueWalker.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nexport class RefusalValueWalker extends ScreenplaySyntaxWalker {\n private slice: SliceSyntax | null = null;\n private branch: InvocationRefusalSyntax | null = null;\n private properties: readonly PropertySyntax[] | null = null;\n private target: TypeRefSyntax | null = null;\n private mapping = false;\n\n constructor(private readonly declarations: RefusalDeclarations, private readonly context: ParserContext) { super(); }\n\n visitSlice(syntax: SliceSyntax): void {\n this.slice = syntax;\n super.visitSlice(syntax);\n this.slice = null;\n }\n\n visitInvocationRefusal(syntax: InvocationRefusalSyntax): void {\n this.branch = syntax;\n super.visitInvocationRefusal(syntax);\n this.branch = null;\n }\n\n visitProduces(syntax: ProducesSyntax): void {\n if (this.branch === null || this.slice === null) { super.visitProduces(syntax); return; }\n this.visitNode(syntax);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n if (syntax.when != null) this.visitCondition(syntax.when);\n syntax.tags.forEach(tag => this.visitTag(tag));\n this.properties = this.declarations.event(syntax.event, this.slice)?.properties ?? null;\n syntax.mappings.forEach(mapping => this.visitPropertyMapping(mapping));\n this.properties = null;\n }\n\n visitPropertyMapping(syntax: PropertyMappingSyntax): void {\n this.mapping = this.branch !== null;\n this.target = this.declarations.property(this.properties, syntax.property)?.type ?? null;\n super.visitPropertyMapping(syntax);\n this.target = null;\n this.mapping = false;\n }\n\n visitObjectMember(syntax: ObjectMemberSyntax): void {\n const parent = this.target;\n this.target = this.declarations.property(parent === null ? null : this.declarations.types.get(parent.name)?.properties ?? null, syntax.name)?.type ?? null;\n super.visitObjectMember(syntax);\n this.target = parent;\n }\n\n visitExpression(syntax: ExpressionSyntax): void {\n if (syntax.kind === 'RefusalExpressionSyntax') {\n if (!this.mapping || this.branch === null || !['reason', 'constraint', 'message'].includes(syntax.member) || syntax.member === 'constraint' && this.branch.selector !== 'constraint') {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is only available in a refusal branch's event mapping; constraint requires 'by constraint'.`, syntax.location);\n } else if (this.target !== null && (this.target.isCollection || this.declarations.compatible({ ...this.target, name: 'String', isOptional: false, isCollection: false }, this.target) === false && !this.declarations.application.concepts.some(concept => concept.name === this.target!.name && concept.type === 'String'))) {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is a String value, incompatible with '${this.target.name}'.`, syntax.location);\n }\n }\n const parent = this.target;\n if (syntax.kind === 'ListExpressionSyntax' && parent !== null) this.target = { ...parent, isCollection: false };\n super.visitExpression(syntax);\n this.target = parent;\n }\n}\n"],"mappings":"A,sMAaA,IAAa,mBAAb,cAAwCA,CAAuB,CAO9B,aAAoD,QANjF,MAAoC,KACpC,OAAiD,KACjD,WAA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,CAAC,KAAK,SAAW,KAAK,SAAW,MAAQ,CAAC,CAAC,SAAU,aAAc,SAAS,CAAC,CAAC,SAASA,EAAO,MAAM,GAAKA,EAAO,SAAW,cAAgB,KAAK,OAAO,WAAa,aACpK,KAAK,QAAQ,MAAMI,EAAgB,oBAAqB,aAAaJ,EAAO,OAAO,+FAAgGA,EAAO,QAAQ,EAC3L,KAAK,SAAW,OAAS,KAAK,OAAO,cAAgB,KAAK,aAAa,WAAW,CAAE,GAAG,KAAK,OAAQ,KAAM,SAAU,WAAY,GAAO,aAAc,EAAM,EAAG,KAAK,MAAM,IAAM,IAAS,CAAC,KAAK,aAAa,YAAY,SAAS,KAAK,GAAWK,EAAQ,OAAS,KAAK,OAAQ,MAAQA,EAAQ,OAAS,QAAQ,IACtT,KAAK,QAAQ,MAAMD,EAAgB,oBAAqB,aAAaJ,EAAO,OAAO,0CAA0C,KAAK,OAAO,KAAK,IAAKA,EAAO,QAAQ,GAG1K,IAAMG,EAAS,KAAK,OAChBH,EAAO,OAAS,wBAA0BG,IAAW,OAAM,KAAK,OAAS,CAAE,GAAGA,EAAQ,aAAc,EAAM,GAC9G,MAAM,gBAAgBH,CAAM,EAC5B,KAAK,OAASG,CAClB,CACJ,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseCommandResolver.js","names":["resolved","key","from","name","imported","imports","entry","segments","entries","candidates","qualifiers","index","value","depth","visible","command"],"sources":["../../../../../../Compiler/Parsing/ResponseCommandResolver.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\n\n// Shared authoring resolution for input/response validation and continuation editor scopes.\nexport function responseCommandResolver(entries: readonly { command: CommandSyntax; scope: readonly string[] }[], imports: readonly { qualifiedName: string }[]): (name: string, from: readonly string[]) => CommandSyntax | null {\n const resolved = new Map<string, CommandSyntax | null>();\n return (name, from) => {\n const key = `${from.join('.')}|${name}`;\n if (resolved.has(key)) return resolved.get(key)!;\n const imported = imports.filter(entry => entry.qualifiedName.split('.').at(-1) === name);\n const local = entries.filter(entry => entry.command.name === name.split('.').at(-1));\n const reference = local.length === 0 && imported.length === 1 ? imported[0].qualifiedName : name;\n const segments = reference.split('.');\n let candidates = entries.filter(entry => entry.command.name === segments.at(-1));\n if (segments.length > 1) {\n const qualifiers = segments.slice(0, -1);\n candidates = candidates.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n } else {\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = candidates.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) { candidates = visible; break; }\n }\n }\n const command = candidates.length === 1 ? candidates[0].command : null;\n resolved.set(key, command);\n return command;\n };\n}\n"],"mappings":"qDAMA,SAAgB,wBAAwB,EAA0E,EAAgH,CAC9N,IAAMA,kBAAW,IAAI,IACrB,OAAQ,EAAM,IAAS,CACnB,IAAMC,EAAM,GAAGC,EAAK,KAAK,GAAG,EAAE,GAAGC,IACjC,GAAIH,EAAS,IAAIC,CAAG,EAAG,OAAOD,EAAS,IAAIC,CAAG,EAC9C,IAAMG,EAAWC,EAAQ,OAAO,GAASC,EAAM,cAAc,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,IAAMH,CAAI,EAGjFI,GAFQC,EAAQ,OAAO,GAASF,EAAM,QAAQ,OAASH,EAAK,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAC5D,CAAC,CAAC,SAAW,GAAKC,EAAS,SAAW,EAAIA,EAAS,EAAE,CAAC,cAAgBD,EAAA,CACjE,MAAM,GAAG,EAChCM,EAAaD,EAAQ,OAAO,GAASF,EAAM,QAAQ,OAASC,EAAS,GAAG,EAAE,CAAC,EAC/E,GAAIA,EAAS,OAAS,EAAG,CACrB,IAAMG,EAAaH,EAAS,MAAM,EAAG,EAAE,EACvC,EAAaE,EAAW,OAAO,GAASC,EAAW,QAAUJ,EAAM,MAAM,QAAUI,EAAW,OAAO,EAAO,IAAUJ,EAAM,MAAMA,EAAM,MAAM,OAASI,EAAW,OAASC,KAAWC,CAAK,CAAC,CAChM,MACI,IAAK,IAAIC,EAAQX,EAAK,OAAQW,GAAS,EAAG,IAAS,CAC/C,IAAMC,EAAUL,EAAW,OAAO,GAASI,GAASP,EAAM,MAAM,QAAUJ,EAAK,MAAM,EAAGW,CAAK,CAAC,CAAC,OAAO,EAAO,IAAUP,EAAM,MAAMK,KAAWC,CAAK,CAAC,EACpJ,GAAIE,EAAQ,OAAS,EAAG,CAAE,EAAaA,EAAS,KAAO,CAC3D,CAEJ,IAAMC,EAAUN,EAAW,SAAW,EAAIA,EAAW,EAAE,CAAC,QAAU,KAElE,OADAT,EAAS,IAAIC,EAAKc,CAAO,EAClBA,CACX,CACJ"}
|
|
1
|
+
{"version":3,"file":"ResponseCommandResolver.js","names":["resolved","key","from","name","imported","imports","entry","segments","entries","candidates","qualifiers","index","value","depth","visible","command"],"sources":["../../../../../../Compiler/Parsing/ResponseCommandResolver.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\n\n// Shared authoring resolution for input/response validation and continuation editor scopes.\nexport function responseCommandResolver(entries: readonly { command: CommandSyntax; scope: readonly string[] }[], imports: readonly { qualifiedName: string }[]): (name: string, from: readonly string[]) => CommandSyntax | null {\n const resolved = new Map<string, CommandSyntax | null>();\n return (name, from) => {\n const key = `${from.join('.')}|${name}`;\n if (resolved.has(key)) return resolved.get(key)!;\n const imported = imports.filter(entry => entry.qualifiedName.split('.').at(-1) === name);\n const local = entries.filter(entry => entry.command.name === name.split('.').at(-1));\n const reference = local.length === 0 && imported.length === 1 ? imported[0].qualifiedName : name;\n const segments = reference.split('.');\n let candidates = entries.filter(entry => entry.command.name === segments.at(-1));\n if (segments.length > 1) {\n const qualifiers = segments.slice(0, -1);\n candidates = candidates.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n } else {\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = candidates.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) { candidates = visible; break; }\n }\n }\n const command = candidates.length === 1 ? candidates[0].command : null;\n resolved.set(key, command);\n return command;\n };\n}\n"],"mappings":"A,qDAMA,SAAgB,wBAAwB,EAA0E,EAAgH,CAC9N,IAAMA,kBAAW,IAAI,IACrB,OAAQ,EAAM,IAAS,CACnB,IAAMC,EAAM,GAAGC,EAAK,KAAK,GAAG,EAAE,GAAGC,IACjC,GAAIH,EAAS,IAAIC,CAAG,EAAG,OAAOD,EAAS,IAAIC,CAAG,EAC9C,IAAMG,EAAWC,EAAQ,OAAO,GAASC,EAAM,cAAc,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,IAAMH,CAAI,EAGjFI,GAFQC,EAAQ,OAAO,GAASF,EAAM,QAAQ,OAASH,EAAK,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAC5D,CAAC,CAAC,SAAW,GAAKC,EAAS,SAAW,EAAIA,EAAS,EAAE,CAAC,cAAgBD,EAAA,CACjE,MAAM,GAAG,EAChCM,EAAaD,EAAQ,OAAO,GAASF,EAAM,QAAQ,OAASC,EAAS,GAAG,EAAE,CAAC,EAC/E,GAAIA,EAAS,OAAS,EAAG,CACrB,IAAMG,EAAaH,EAAS,MAAM,EAAG,EAAE,EACvC,EAAaE,EAAW,OAAO,GAASC,EAAW,QAAUJ,EAAM,MAAM,QAAUI,EAAW,OAAO,EAAO,IAAUJ,EAAM,MAAMA,EAAM,MAAM,OAASI,EAAW,OAASC,KAAWC,CAAK,CAAC,CAChM,MACI,IAAK,IAAIC,EAAQX,EAAK,OAAQW,GAAS,EAAG,IAAS,CAC/C,IAAMC,EAAUL,EAAW,OAAO,GAASI,GAASP,EAAM,MAAM,QAAUJ,EAAK,MAAM,EAAGW,CAAK,CAAC,CAAC,OAAO,EAAO,IAAUP,EAAM,MAAMK,KAAWC,CAAK,CAAC,EACpJ,GAAIE,EAAQ,OAAS,EAAG,CAAE,EAAaA,EAAS,KAAO,CAC3D,CAEJ,IAAMC,EAAUN,EAAW,SAAW,EAAIA,EAAW,EAAE,CAAC,QAAU,KAElE,OADAT,EAAS,IAAIC,EAAKc,CAAO,EAClBA,CACX,CACJ,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseDateValues.js","names":["date","dateTime","match","includeTime","text","year","month","day","days","hours","minutes"],"sources":["../../../../../../Compiler/Parsing/ResponseDateValues.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\nconst date = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;\nconst dateTime = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\\.[0-9]{1,7})?(?:Z|[+-]([0-9]{2}):([0-9]{2}))$/;\n\n// Only response/fixture compatibility uses this grammar; general literal parsing stays unchanged.\nexport function responseDateValue(text: string, includeTime: boolean): boolean {\n const match = (includeTime ? dateTime : date).exec(text);\n if (match === null || match[0].length !== text.length) return false;\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > days[month - 1]) return false;\n if (!includeTime) return true;\n if (Number(match[4]) > 23 || Number(match[5]) > 59 || Number(match[6]) > 59) return false;\n if (match[7] === undefined) return true;\n const hours = Number(match[7]);\n const minutes = Number(match[8]);\n return hours <= 14 && minutes <= 59 && (hours !== 14 || minutes === 0);\n}\n"],"mappings":"qDAGA,MAAMA,EAAO,qCACPC,EAAW,sHAGjB,SAAgB,kBAAkB,EAAc,EAA+B,CAC3E,IAAMC,GAASC,EAAcF,EAAWD,EAAA,CAAM,KAAKI,CAAI,EACvD,GAAIF,IAAU,MAAQA,EAAM,EAAE,CAAC,SAAWE,EAAK,OAAQ,MAAO,GAC9D,IAAMC,EAAO,OAAOH,EAAM,EAAE,EACtBI,EAAQ,OAAOJ,EAAM,EAAE,EACvBK,EAAM,OAAOL,EAAM,EAAE,EAErBM,EAAO,CAAC,GADDH,EAAO,GAAM,IAAMA,EAAO,KAAQ,GAAKA,EAAO,KAAQ,GAC1C,GAAK,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAAE,EACxE,GAAIA,EAAO,GAAKC,EAAQ,GAAKA,EAAQ,IAAMC,EAAM,GAAKA,EAAMC,EAAKF,EAAQ,GAAI,MAAO,GACpF,GAAI,CAACH,EAAa,MAAO,GACzB,GAAI,OAAOD,EAAM,EAAE,EAAI,IAAM,OAAOA,EAAM,EAAE,EAAI,IAAM,OAAOA,EAAM,EAAE,EAAI,GAAI,MAAO,GACpF,GAAIA,EAAM,KAAO,IAAA,GAAW,MAAO,GACnC,IAAMO,EAAQ,OAAOP,EAAM,EAAE,EACvBQ,EAAU,OAAOR,EAAM,EAAE,EAC/B,OAAOO,GAAS,IAAMC,GAAW,KAAOD,IAAU,IAAMC,IAAY,EACxE"}
|
|
1
|
+
{"version":3,"file":"ResponseDateValues.js","names":["date","dateTime","match","includeTime","text","year","month","day","days","hours","minutes"],"sources":["../../../../../../Compiler/Parsing/ResponseDateValues.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\nconst date = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;\nconst dateTime = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\\.[0-9]{1,7})?(?:Z|[+-]([0-9]{2}):([0-9]{2}))$/;\n\n// Only response/fixture compatibility uses this grammar; general literal parsing stays unchanged.\nexport function responseDateValue(text: string, includeTime: boolean): boolean {\n const match = (includeTime ? dateTime : date).exec(text);\n if (match === null || match[0].length !== text.length) return false;\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > days[month - 1]) return false;\n if (!includeTime) return true;\n if (Number(match[4]) > 23 || Number(match[5]) > 59 || Number(match[6]) > 59) return false;\n if (match[7] === undefined) return true;\n const hours = Number(match[7]);\n const minutes = Number(match[8]);\n return hours <= 14 && minutes <= 59 && (hours !== 14 || minutes === 0);\n}\n"],"mappings":"A,qDAGA,MAAMA,EAAO,qCACPC,EAAW,sHAGjB,SAAgB,kBAAkB,EAAc,EAA+B,CAC3E,IAAMC,GAASC,EAAcF,EAAWD,EAAA,CAAM,KAAKI,CAAI,EACvD,GAAIF,IAAU,MAAQA,EAAM,EAAE,CAAC,SAAWE,EAAK,OAAQ,MAAO,GAC9D,IAAMC,EAAO,OAAOH,EAAM,EAAE,EACtBI,EAAQ,OAAOJ,EAAM,EAAE,EACvBK,EAAM,OAAOL,EAAM,EAAE,EAErBM,EAAO,CAAC,GADDH,EAAO,GAAM,IAAMA,EAAO,KAAQ,GAAKA,EAAO,KAAQ,GAC1C,GAAK,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAAE,EACxE,GAAIA,EAAO,GAAKC,EAAQ,GAAKA,EAAQ,IAAMC,EAAM,GAAKA,EAAMC,EAAKF,EAAQ,GAAI,MAAO,GACpF,GAAI,CAACH,EAAa,MAAO,GACzB,GAAI,OAAOD,EAAM,EAAE,EAAI,IAAM,OAAOA,EAAM,EAAE,EAAI,IAAM,OAAOA,EAAM,EAAE,EAAI,GAAI,MAAO,GACpF,GAAIA,EAAM,KAAO,IAAA,GAAW,MAAO,GACnC,IAAMO,EAAQ,OAAOP,EAAM,EAAE,EACvBQ,EAAU,OAAOR,EAAM,EAAE,EAC/B,OAAOO,GAAS,IAAMC,GAAW,KAAOD,IAAU,IAAMC,IAAY,EACxE,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{nativePattern as e}from"../Text/patterns.js";import{exactIsIntegral as t}from"../Syntax/ExactMathFacts.js";import{DiagnosticCodes as n}from"../Diagnostics/DiagnosticCodes.js";import{responseCommandResolver as r}from"./ResponseCommandResolver.js";import{responseDateValue as i}from"./ResponseDateValues.js";import{specificationCommandExamples as a}from"./SpecificationCommandExamples.js";const o=e(`^[A-Za-z_]\\w*$`),s=/* @__PURE__ */ new Set([`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`]);function validateResponses(e,t,i=t.inputUses){let c=a(e),l=[],collect=(e,t)=>{let n=[...t,e.name];e.slices.forEach(e=>l.push({slice:e,scope:[...n,e.name]})),e.features.forEach(e=>collect(e,n))};e.modules.forEach(e=>e.features.forEach(t=>collect(t,[e.name])));let u=/* @__PURE__ */ new Map,d=/* @__PURE__ */ new Map,f=/* @__PURE__ */ new Map;for(let{slice:e,scope:t}of l)for(let n of e.commands){let e=u.get(n.name)??[];e.push({command:n,scope:t}),u.set(n.name,e),d.set(n,uniqueByName(n.properties)),n.response?.kind===`RecordCommandResponseSyntax`&&f.set(n,uniqueByName(n.response.fields))}let p=r([...u.values()].flat(),e.imports),m=uniqueByName(e.concepts),h=new Set(e.concepts.map(e=>e.name)),g=new Map([...uniqueByName(e.types)].map(([e,t])=>[e,uniqueByName(t.properties)])),_=new Set(l.flatMap(e=>e.slice.readModels.map(e=>e.name))),v=new Set([...d.keys()].flatMap(e=>[...e.properties])),checkDeclarations=e=>{for(let r of e)r.isGenerated&&!v.has(r)&&t.error(n.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,r.location)},checkFeature=e=>{e.features.forEach(checkFeature);for(let t of e.slices){for(let e of t.commands)for(let t of e.produces)t.inlineEvent!==null&&checkDeclarations(t.inlineEvent.properties);t.events.forEach(e=>checkDeclarations(e.properties)),t.readModels.forEach(e=>checkDeclarations(e.properties));for(let e of t.reactions)for(let t of e.triggers)for(let e of t.produces)e.inlineEvent!==null&&checkDeclarations(e.inlineEvent.properties)}};e.types.forEach(e=>checkDeclarations(e.properties)),e.modules.forEach(e=>e.features.forEach(checkFeature));let validateSource=(e,r,i)=>{let a=d.get(i).get(e.property);if(a===void 0){t.error(n.InvalidResponseSource,`Response source '${e.property}' must reference one direct command property.`,e.location);return}let o=a.type;(o.isCollection||_.has(o.name))&&t.error(n.InvalidResponseShape,`Collection and whole-read-model responses are not supported.`,e.location),r!==null&&(r.name!==o.name||r.isCollection!==o.isCollection||r.isOptional!==o.isOptional)&&t.error(n.InvalidResponseShape,`An explicit response field type must match its source's declared type, collection shape and optionality.`,r.location)};for(let e of d.keys()){for(let r of e.properties){if(!r.isGenerated)continue;let e=m.get(r.type.name);(r.type.isOptional||r.type.isCollection||(e===void 0?s.has(r.type.name)||g.has(r.type.name)||h.has(r.type.name)||_.has(r.type.name):e.type!==`Uuid`&&e.generation==null))&&t.error(n.InvalidGeneratedType,`A generated property must be a required, noncollection generatable concept.`,r.location)}let r=e.response;if(r?.kind===`ScalarCommandResponseSyntax`)validateSource(r.source,null,e);else if(r?.kind===`RecordCommandResponseSyntax`){r.fields.length===0&&t.error(n.InvalidCommandResponse,`A response block requires at least one field.`,r.location);let i=/* @__PURE__ */ new Set;for(let a of r.fields)i.has(a.name)&&t.error(n.DuplicateResponseField,`Duplicate response field '${a.name}'.`,a.location),i.add(a.name),validateSource(a.source,a.type,e)}}let validateSpecification=(e,r)=>{let i=c(e.when,r),a=i===null?null:p(i.commandType,r);if(i!==null&&a!==null){let e=d.get(a);for(let r of i.values)e.get(r.property.split(`.`)[0])?.isGenerated&&t.error(n.GeneratedPropertySuppliedAsInput,`Generated property '${r.property}' cannot be supplied as request or form input.`,r.location);let r=[...e.values()].filter(e=>e.isIdentifier);if(i.for!==null&&r.length===1&&r[0].isGenerated){let e=r[0].type;(s.has(e.name)||m.has(e.name)||g.has(e.name))&&(e.isOptional||e.isCollection||![`Uuid`,`String`].includes(m.get(e.name)?.type??``)||!compatibleValue(i.for,e,m,g))&&t.error(n.InvalidGeneratedFixture,`A generated identifier fixture must supply one compatible concrete UUID value through 'for'.`,i.for.location)}let o=/* @__PURE__ */ new Set;for(let r of i.generatedValues??[]){let i=e.get(r.property);(o.has(r.property)||i===void 0||!i.isGenerated||i.isIdentifier||!compatibleValue(r.source,i.type,m,g))&&t.error(n.InvalidGeneratedFixture,`A generated fixture must uniquely supply a compatible value for a nonidentifier generated command property.`,r.location),o.add(r.property)}}let o=e.thenReturns;if(o==null||((i===null||e.thenErrors.length>0||e.thenDenied!=null)&&t.error(n.InvalidReturnExpectation,`A return expectation requires a command action and cannot accompany an error or denial.`,o.location),a===null))return;let l=a.response,u=d.get(a);if(o.kind===`ScalarSpecificationReturnSyntax`&&l?.kind===`ScalarCommandResponseSyntax`&&u.has(l.source.property))compatibleValue(o.value,u.get(l.source.property).type,m,g)||t.error(n.InvalidReturnExpectation,`The expected return value must match the response source's type.`,o.location);else if(o.kind===`RecordSpecificationReturnSyntax`&&l?.kind===`RecordCommandResponseSyntax`){o.fields.length===0&&t.error(n.InvalidReturnExpectation,`A record return expectation requires at least one field.`,o.location);let e=f.get(a),r=/* @__PURE__ */ new Set;for(let i of o.fields){let a=e.get(i.property),o=a===void 0?void 0:u.get(a.source.property);(r.has(i.property)||o===void 0||!compatibleValue(i.source,o.type,m,g))&&t.error(n.InvalidReturnExpectation,`A return assertion must uniquely name a response field and supply a compatible concrete value.`,i.location),r.add(i.property)}}else t.error(n.InvalidReturnExpectation,`The return expectation must match the command's scalar or record response shape.`,o.location)};for(let{slice:e,scope:t}of l)e.specifications.forEach(e=>validateSpecification(e,t));let returned=(e,t)=>e.response?.kind===`ScalarCommandResponseSyntax`?e.response.source.property===t:f.get(e)?.has(t)===!0;for(let e of t.continuationValues){if(!o.test(e.text)||e.locals.includes(e.text))continue;let scopedCommands=t=>t.filter(t=>!e.parameters.includes(t)).flatMap(t=>{let n=p(t,e.scope);return n===null?[]:[n]});if(scopedCommands(e.success).some(t=>returned(t,e.text)))continue;let r=scopedCommands(e.failure).reverse().find(t=>returned(t,e.text));r&&t.error(n.ResponseNameUsedOnFailure,`'${e.text}' is returned by '${r.name}' only on success`,e.location)}for(let e of i){if(e.isParameter===!0)continue;let r=p(e.command,e.scope);r!==null&&d.get(r).get(e.property.split(`.`)[0])?.isGenerated&&t.error(n.GeneratedPropertySuppliedAsInput,`Generated property '${e.property}' cannot be supplied as request or form input.`,e.location)}}function uniqueByName(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set;for(let r of e)t.has(r.name)&&n.add(r.name),t.set(r.name,r);return n.forEach(e=>t.delete(e)),t}function compatibleValue(e,n,r,a){if(e.kind===`LiteralExpressionSyntax`&&e.value===null)return n.isOptional;if(n.isCollection)return e.kind===`ListExpressionSyntax`&&e.items.every(e=>compatibleValue(e,{...n,isCollection:!1,isOptional:!1},r,a));let o=a.get(n.name);if(o!==void 0)return e.kind===`ObjectExpressionSyntax`&&e.members.every(e=>{let t=o.get(e.name);return t!==void 0&&compatibleValue(e.value,t.type,r,a)});let c=r.get(n.name),l=c?.type??n.name;if(c?.type===`Enum`)return e.kind===`LiteralExpressionSyntax`&&typeof e.value==`string`&&c.values.includes(e.value);if(e.kind===`LiteralExpressionSyntax`)switch(l){case`Uuid`:return typeof e.value==`string`&&uuidValue(e.value);case`String`:return typeof e.value==`string`;case`Bool`:return typeof e.value==`boolean`;case`Int`:return typeof e.value==`number`?Number.isFinite(e.value)&&Number.isInteger(e.value):typeof e.value==`object`&&e.value!==null&&t(e.value);case`Decimal`:return typeof e.value==`number`?Number.isFinite(e.value):typeof e.value==`object`&&e.value!==null&&e.value.literalType===`ExactNumber`;case`Date`:return typeof e.value==`string`&&i(e.value,!1);case`DateTime`:return typeof e.value==`string`&&i(e.value,!0);default:return!s.has(l)}return!s.has(l)&&c===void 0}const c=/^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\}|\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\))(?![\s\S])/i;function uuidValue(e){return c.test(e)}export{compatibleValue,uniqueByName,validateResponses};
|
|
2
2
|
//# sourceMappingURL=ResponseValidator.js.map
|