@cratis/screenplay-language 4.170.0 → 4.172.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  2. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  3. package/dist/bundles/compiler/Generation/BoundedRegexSamples.js +1 -0
  4. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -0
  5. package/dist/bundles/compiler/Generation/FinitePatternContainment.js +1 -0
  6. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js +2 -0
  7. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -0
  8. package/dist/bundles/compiler/Generation/GenerationChecksum.js +2 -0
  9. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -0
  10. package/dist/bundles/compiler/Generation/GenerationPattern.js +2 -0
  11. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -0
  12. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js +2 -0
  13. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -0
  14. package/dist/bundles/compiler/Generation/GenerationPatternParser.js +2 -0
  15. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -0
  16. package/dist/bundles/compiler/Generation/GenerationPatternToken.js +2 -0
  17. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -0
  18. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -0
  19. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js +2 -0
  20. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -0
  21. package/dist/bundles/compiler/Generation/RegexCharacters.js +2 -0
  22. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -0
  23. package/dist/bundles/compiler/Generation/RegexExpression.js +2 -0
  24. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -0
  25. package/dist/bundles/compiler/Generation/RegexFragmentR.js +1 -0
  26. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -0
  27. package/dist/bundles/compiler/Generation/index.js +1 -0
  28. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js +2 -0
  29. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -0
  30. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  31. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  32. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +2 -0
  33. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -0
  34. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  35. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  36. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  37. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  38. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  39. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  40. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  41. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  42. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  43. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  44. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  45. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  46. package/dist/bundles/completion-items.js +1 -1
  47. package/dist/bundles/completion-items.js.map +1 -1
  48. package/dist/bundles/completion-planner.js +2 -2
  49. package/dist/bundles/completion-planner.js.map +1 -1
  50. package/dist/bundles/diagnostic-codes.js +1 -1
  51. package/dist/bundles/diagnostic-codes.js.map +1 -1
  52. package/dist/bundles/generation-completions.js +1 -1
  53. package/dist/bundles/generation-completions.js.map +1 -1
  54. package/dist/bundles/hover-content.js +1 -1
  55. package/dist/bundles/hover-content.js.map +1 -1
  56. package/dist/bundles/keyword-docs.js +1 -1
  57. package/dist/bundles/keyword-docs.js.map +1 -1
  58. package/dist/bundles/language.js +1 -1
  59. package/dist/bundles/language.js.map +1 -1
  60. package/dist/bundles/tokens.js +1 -1
  61. package/dist/bundles/tokens.js.map +1 -1
  62. package/dist/bundles/validation.js +1 -1
  63. package/dist/bundles/validation.js.map +1 -1
  64. package/dist/completion-items.d.ts.map +1 -1
  65. package/dist/completion-planner.d.ts.map +1 -1
  66. package/dist/diagnostic-codes.d.ts +4 -0
  67. package/dist/diagnostic-codes.d.ts.map +1 -1
  68. package/dist/generation-completions.d.ts.map +1 -1
  69. package/dist/hover-content.d.ts.map +1 -1
  70. package/dist/keyword-docs.d.ts.map +1 -1
  71. package/dist/language.d.ts.map +1 -1
  72. package/dist/tokens.d.ts.map +1 -1
  73. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CommandParser.js","names":["header","pattern","routeHeader","sourceStreamPattern","severityPattern","messagePattern","stringBodyPattern","rulePattern","operandPattern","ruleNamePattern","optionalReads","operandKinds","severities","opaqueDirectives","propertyShapedDirectives","names","lookahead","ParserContext","context","line","name","DiagnosticCodes","locationOf","properties","responses","identifier","validations","produces","reads","referenceReads","concurrency","description","documentation","authorize","handler","stream","streamCandidates","child","keyword","firstWord","asProperty","tryParseProperty","scalar","scalarResponsePattern","responseNames","parseCommandResponse","reportInvalidModifierOrder","source","streamName","ambiguous","route","parseCommandStream","isReactionIdentityLine","misplacedReactionIdentity","parseDescription","parseDocumentation","combineAuthorize","parseAuthorize","validate","production","parseProduces","parseHandler","reference","parseReads","captureConcurrency","read","candidates","entry","property","discoveredNames","response","removed","parsed","syntax","commandReadSources","dependencySources","reportLegacyOptionalSuffix","commandName","fence","code","parseCode","rules","requirements","wrapperIndent","owner","condition","parseCondition","message","severity","hasSeverity","directive","matched","unescapeString","rule","valueContext","withSeverity","match","body","wrapped","commandOwner","parseImplementationWrapper","isFile","parseFile","isCode","extra","content","text","operand","parseMappingSource"],"sources":["../../../../../../Compiler/Parsing/CommandParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { RequirementSyntax } from '../Syntax/Conditions';\nimport { parseCondition } from './ConditionParser';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { CommandSyntax, ValidateSyntax, ValidationRuleKind, ValidationRuleSyntax, ValidationSeverity } from '../Syntax/Commands';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax } from '../Syntax/EventSources';\nimport { parseCommandStream } from './EventSourceParser';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { CommandResponseSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseCommandResponse, scalarResponsePattern } from './CommandResponseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isCode, isFile, parseCode, parseFile, parseHandler, parseImplementationWrapper } from './ImplementationParser';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationSyntax } from '../Syntax/Implementations';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { isReactionIdentityLine, misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { commandReadSources } from './CommandReadSources';\nimport { dependencySources, ReadsSyntax, ConcurrencySyntax } from '../Syntax/DependencySources';\nimport { captureConcurrency } from './DependencySourceParser';\nimport { parseReads } from './ReadsParser';\nimport { parseProduces } from './ProducesParser';\nimport { reportInvalidModifierOrder, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^command\\\\s+([A-Za-z_]\\\\w*)$');\nconst routeHeader = sourceStreamPattern('^stream\\\\s+[A-Za-z_]\\\\w*\\\\.[A-Za-z_]\\\\w*$');\nconst severityPattern = pattern('\\\\bseverity\\\\s+(\\\\S+)$');\nconst messagePattern = pattern(`\\\\bmessage\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\S*))$`);\nconst rulePattern = pattern('^([\\\\w.]+)\\\\s+(.+)$');\nconst operandPattern = pattern('^(not empty|length ==|all >=|all >|matches|max|min|rule|>=|<=|==|!=|>|<)\\\\s*(.*)$');\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\n// Every operand the pattern matches has a kind, so an operand never goes unrecognized here.\nconst operandKinds: Record<string, ValidationRuleKind> = {\n max: 'Max',\n min: 'Min',\n '>': 'GreaterThan',\n '>=': 'GreaterThanOrEqual',\n '<': 'LessThan',\n '<=': 'LessThanOrEqual',\n '==': 'Equal',\n '!=': 'NotEqual',\n 'length ==': 'Length',\n matches: 'Matches',\n 'all >': 'AllGreaterThan',\n 'all >=': 'AllGreaterThanOrEqual',\n};\n\nconst severities: Record<string, ValidationSeverity> = { information: 'Information', warning: 'Warning', error: 'Error' };\n\n// Command directives this compiler does not model. They are skipped whole.\nconst opaqueDirectives = new Set(['reads', 'concurrency']);\n\n// The bare directives cannot take a type reference, so a line with property shape is a property whatever\n// keyword it starts with - 'description String' declares a property called description.\nconst propertyShapedDirectives = new Set(['description', 'documentation', 'handler', 'concurrency']);\n\nexport function parseCommand(context: ParserContext, line: SourceLine): CommandSyntax {\n // Properties are leaves, not indentation owners. Resolve ambiguous returns spelling\n // before the committed pass decides whether its deeper lines belong to a response.\n const names = new Set<string>();\n const lookahead = new ParserContext(context.reader.fork(), context.path, context.languages);\n lookahead.sourceOptions = context.sourceOptions;\n lookahead.streamCandidates = context.streamCandidates;\n parseCommandBody(lookahead, line, undefined, names);\n return parseCommandBody(context, line, names);\n}\n\nfunction parseCommandBody(context: ParserContext, line: SourceLine, responseNames?: ReadonlySet<string>, discoveredNames?: Set<string>): CommandSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidCommandDeclaration, `Invalid command declaration '${line.content}' - expected 'command <Name>'`, locationOf(line));\n }\n const properties: PropertySyntax[] = [];\n const responses: { line: SourceLine; candidate: PropertySyntax | null; response: CommandResponseSyntax | null }[] = [];\n let identifier: PropertySyntax | undefined;\n const validations: ValidateSyntax[] = [];\n const produces: ProducesSyntax[] = [];\n const reads: { readModel: string; alias: string | null }[] = [];\n const referenceReads: ReadsSyntax[] = [];\n let concurrency: ConcurrencySyntax | undefined;\n let description: string | null = null;\n let documentation: string | null = null;\n let authorize: AuthorizeSyntax | null = null;\n let handler: HandlerSyntax | null = null;\n let stream: CommandStreamSyntax | null = null;\n const streamCandidates: CommandStreamSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n const asProperty = tryParseProperty(child);\n if (asProperty !== undefined && (propertyShapedDirectives.has(keyword) || (keyword === 'validate' && child.content !== 'validate csharp'))) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (keyword === 'returns') {\n const scalar = scalarResponsePattern.exec(child.content);\n if (scalar !== null && !scalar[1].startsWith('@') && asProperty !== undefined) {\n if (responseNames === undefined) {\n properties.push(asProperty);\n responses.push({ line: child, candidate: asProperty, response: null });\n } else if (responseNames.has(asProperty.type.name)) {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n } else {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n }\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (reportInvalidModifierOrder(context, child)) {\n context.skipBlock(child.indent);\n } else {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n }\n } else if (keyword === 'stream' && routeHeader.test(child.content) && asProperty !== undefined && context.streamCandidates?.hasSource(asProperty.type.name.split('.')[0]) === true) {\n const [source, streamName] = asProperty.type.name.split('.');\n const ambiguous = context.streamCandidates.hasPropertyType(asProperty.type.name) && context.streamCandidates.hasUniqueStream(source, streamName);\n const route = parseCommandStream(context, child, asProperty, ambiguous);\n if (stream !== null || streamCandidates.length > 0) context.error(DiagnosticCodes.InvalidCommandStream, 'A command declares at most one stream route.', locationOf(child));\n if (ambiguous || stream !== null) streamCandidates.push(route);\n else stream = route;\n } else if (keyword === 'runs' && isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Command '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Command '${name}'`);\n } else if (keyword === 'authorize') {\n authorize = combineAuthorize(authorize, parseAuthorize(context, child));\n } else if (keyword === 'validate') {\n const validate = parseValidate(context, child, 'command');\n if (validate !== undefined) {\n validations.push(validate);\n }\n } else if (keyword === 'produces') {\n const production = parseProduces(context, child, true);\n if (production !== undefined) produces.push(production);\n } else if (keyword === 'handler') {\n handler = parseHandler(context, child);\n } else if (opaqueDirectives.has(keyword)) {\n const reference = keyword === 'reads' ? parseReads(context, child) : undefined;\n if (reference !== undefined) referenceReads.push(reference);\n if (keyword === 'concurrency' && concurrency === undefined) concurrency = captureConcurrency(context, child);\n const read = /^reads\\s+([A-Z]\\w*)(?:\\s+as\\s+([a-z_]\\w*))?(?:\\s+by\\s+([a-z_]\\w*))?$/.exec(child.content);\n if (read !== null) reads.push({ readModel: read[1], alias: read[2] ?? null });\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n context.skipOpaqueBlock(child.indent);\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else {\n reportInvalidModifierOrder(context, child);\n context.error(DiagnosticCodes.UnknownCommandDirective, `Unexpected '${child.content}' in command body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const candidates = new Set(responses.flatMap(entry => entry.candidate === null ? [] : [entry.candidate]));\n const names = new Set(properties.filter(property => !candidates.has(property)).map(property => property.name));\n if (responses.some(entry => entry.candidate !== null && !names.has(entry.candidate.type.name) && entry.candidate.type.name !== 'returns')) names.add('returns');\n for (const name of names) discoveredNames?.add(name);\n let response: CommandResponseSyntax | null = null;\n const removed = new Set<PropertySyntax>();\n for (const entry of responses) {\n let parsed = entry.response;\n if (entry.candidate !== null) {\n if (!names.has(entry.candidate.type.name)) continue;\n removed.add(entry.candidate);\n parsed = { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: entry.candidate.type.name, location: entry.candidate.type.location }, location: locationOf(entry.line) };\n }\n if (parsed === null) continue;\n if (response !== null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A command declares at most one unconditional response.', locationOf(entry.line));\n } else {\n response = parsed;\n }\n }\n if (handler !== null && produces.length > 0) {\n context.error(DiagnosticCodes.CommandWithProducesAndHandler, `Command '${name}' cannot declare both 'produces' and 'handler'`, locationOf(line));\n }\n const syntax: CommandSyntax = { kind: 'CommandSyntax', name, description, documentation, authorize, properties: properties.filter(property => !removed.has(property)), validations, produces, handler, response, stream, streamCandidates, location: locationOf(line) };\n commandReadSources.set(syntax, reads);\n dependencySources.set(syntax, { reads: referenceReads, concurrency });\n return syntax;\n}\n\nfunction addProperty(context: ParserContext, properties: PropertySyntax[], property: PropertySyntax, commandName: string, line: SourceLine, identifier: PropertySyntax | undefined): PropertySyntax | undefined {\n reportLegacyOptionalSuffix(context, property.type, line);\n if (property.isIdentifier && identifier !== undefined) {\n context.error(DiagnosticCodes.DuplicateCommandIdentifier, `Command '${commandName}' already marks '${identifier.name}' as identifier - only one property can be the identifier`, property.location);\n property = { ...property, isIdentifier: false };\n }\n properties.push(property);\n return identifier ?? (property.isIdentifier ? property : undefined);\n}\n\n// Reads a 'validate' block: declarative rules, or code - which is recognized but not modeled.\nexport function parseValidate(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidateSyntax | undefined {\n if (line.content === 'validate') {\n const fence = context.peekChild(line.indent);\n if (fence !== undefined && fence.content.startsWith('```')) {\n context.reader.takeSignificant();\n const code = parseCode(context.valueContext, fence);\n if (code === null) context.skipFencedBody();\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n const rules: ValidationRuleSyntax[] = [];\n const requirements: RequirementSyntax[] = [];\n let wrapperIndent: number | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (owner === 'concept') {\n if (context.sourceOptions.numericMode === 'legacy' && child.content.startsWith('```')) { context.skipFencedBody(); continue; }\n if (wrapperIndent !== undefined && child.indent <= wrapperIndent) wrapperIndent = undefined;\n if (wrapperIndent !== undefined || firstWord(child.content) === 'implementation') {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${child.content}'`, locationOf(child));\n wrapperIndent ??= child.indent;\n continue;\n }\n }\n if (firstWord(child.content) === 'require') {\n const condition = parseCondition(owner === 'concept' ? context.valueContext : context, child.content.substring('require'.length).trim(), locationOf(child));\n let message: string | null = null;\n let severity: ValidationSeverity = 'Error';\n let hasSeverity = false;\n for (let directive = context.peekChild(child.indent); directive !== undefined; directive = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const matched = messagePattern.exec(directive.content);\n if (matched !== null && matched.index === 0) message = matched[1] !== undefined ? unescapeString(matched[1]) : matched[2];\n else if (firstWord(directive.content) === 'severity') {\n if (!hasSeverity) severity = severities[directive.content.substring('severity'.length).trim()] ?? 'Error';\n hasSeverity = true;\n } else context.skipOpaqueBlock(directive.indent);\n }\n if (condition !== null) requirements.push({ kind: 'RequirementSyntax', condition, message, severity, location: locationOf(child) });\n continue;\n }\n const rule = parseValidationRule(context, owner === 'concept' ? { ...child, content: `value ${child.content}` } : child, owner);\n if (rule !== undefined) {\n rules.push(rule);\n }\n }\n return { kind: 'DeclarativeValidateSyntax', rules, requirements, location: locationOf(line) };\n }\n if (line.content === 'validate csharp') {\n const code = parseCode(context.valueContext, { ...line, content: 'csharp' });\n if (code === null) context.skipOpaqueBlock(line.indent);\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidValidateDeclaration, `Invalid validate declaration '${line.content}' - expected 'validate' or 'validate csharp'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseValidationRule(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidationRuleSyntax | undefined {\n const valueContext = owner === 'concept' ? context.valueContext : context;\n const { content: withSeverity, message } = splitMessage(line.content);\n const severity = splitSeverity(valueContext, line, withSeverity);\n if (severity === undefined) {\n return undefined;\n }\n const match = rulePattern.exec(severity.content);\n if (match === null) {\n valueContext.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n const parsed = parseRule(valueContext, match[2], line);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parsed.kind === 'Rule' ? parseRuleImplementation(context, line, owner === 'command') : { file: null, code: null, implementation: null };\n return {\n kind: 'ValidationRuleSyntax',\n property: match[1],\n rule: parsed.kind,\n value: parsed.value,\n message,\n severity: severity.severity,\n ...source,\n location: locationOf(line),\n };\n}\n\nfunction parseRuleImplementation(context: ParserContext, rule: SourceLine, commandOwner: boolean): { file: FileReferenceSyntax | null; code: CodeBlockSyntax | null; implementation: ImplementationSyntax | null } {\n const body = context.peekChild(rule.indent);\n if (body === undefined) return { file: null, code: null, implementation: null };\n context.reader.takeSignificant();\n const wrapped = commandOwner && firstWord(body.content) === 'implementation';\n const source = wrapped ? parseImplementationWrapper(context, body) : {\n file: isFile(body) ? parseFile(context, body) : null,\n code: !isFile(body) && isCode(context, body) ? parseCode(context, body) : null,\n implementation: null,\n };\n if (!wrapped && source.file === null && source.code === null) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, `Unexpected '${body.content}' in rule implementation - expected 'file <path>' or an inline code block`, locationOf(body));\n context.skipBlock(body.indent);\n }\n for (let extra = context.peekChild(rule.indent); extra !== undefined && (wrapped || (commandOwner && firstWord(extra.content) === 'implementation')); extra = context.peekChild(rule.indent)) {\n context.reader.takeSignificant();\n context.error(wrapped && firstWord(extra.content) === 'implementation' ? DiagnosticCodes.InvalidImplementationBlock : DiagnosticCodes.ConflictingImplementationSources,\n 'A named rule has one implementation wrapper and cannot mix wrapped and direct sources.', locationOf(extra));\n if (isCode(context, extra)) parseCode(context, extra);\n else context.skipBlock(extra.indent);\n }\n return source;\n}\n\nfunction splitMessage(content: string): { content: string; message: string | null } {\n const match = messagePattern.exec(content);\n if (match === null) {\n return { content, message: null };\n }\n const message = match[1] !== undefined ? unescapeString(match[1]) : match[2];\n return { content: content.substring(0, match.index).trimEnd(), message };\n}\n\nfunction splitSeverity(context: ParserContext, line: SourceLine, text: string): { content: string; severity: ValidationSeverity } | undefined {\n const match = severityPattern.exec(text);\n if (match === null) {\n return { content: text, severity: 'Error' };\n }\n const severity = severities[match[1]];\n if (severity === undefined) {\n context.error(DiagnosticCodes.InvalidValidationSeverity, `Unknown validation severity '${match[1]}' - expected information, warning or error`, locationOf(line));\n return undefined;\n }\n return { content: text.substring(0, match.index).trimEnd(), severity };\n}\n\nfunction parseRule(context: ParserContext, rule: string, line: SourceLine): { kind: ValidationRuleKind; value: ExpressionSyntax | null } | undefined {\n if (rule === 'not empty') {\n return { kind: 'NotEmpty', value: null };\n }\n const operand = operandPattern.exec(rule);\n if (operand === null) {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (operand[1] === 'rule') {\n const name = operand[2].trim();\n if (!ruleNamePattern.test(name)) {\n context.error(DiagnosticCodes.InvalidRuleName, `Invalid rule name '${name}' in '${line.content}' - expected 'rule <Name>' with an identifier`, locationOf(line));\n return undefined;\n }\n return { kind: 'Rule', value: { kind: 'PathExpressionSyntax', path: name, location: locationOf(line) } };\n }\n return { kind: operandKinds[operand[1]], value: parseMappingSource(operand[2], locationOf(line), context) };\n}\n"],"mappings":"oiDAmCA,MAAMA,EAASC,EAAQ,8BAA8B,EAC/CC,EAAcC,EAAoB,2CAA2C,EAC7EC,EAAkBH,EAAQ,wBAAwB,EAClDI,EAAiBJ,EAAQ,sBAAsBK,EAAkB,yBAAyB,EAC1FC,EAAcN,EAAQ,qBAAqB,EAC3CO,EAAiBP,EAAQ,mFAAmF,EAC5GQ,EAAkBN,EAAoB,iBAAiB,EACvDO,EAAgBT,EAAQ,0CAA0C,EAGlEU,EAAmD,CACrD,IAAK,MACL,IAAK,MACL,IAAK,cACL,KAAM,qBACN,IAAK,WACL,KAAM,kBACN,KAAM,QACN,KAAM,WACN,YAAa,SACb,QAAS,UACT,QAAS,iBACT,SAAU,uBACd,EAEMC,EAAiD,CAAE,YAAa,cAAe,QAAS,UAAW,MAAO,OAAQ,EAGlHC,kBAAmB,IAAI,IAAI,CAAC,QAAS,aAAa,CAAC,EAInDC,kBAA2B,IAAI,IAAI,CAAC,cAAe,gBAAiB,UAAW,aAAa,CAAC,EAEnG,SAAgB,aAAa,EAAwB,EAAiC,CAGlF,IAAMC,kBAAQ,IAAI,IACZC,EAAY,IAAIC,EAAcC,EAAQ,OAAO,KAAK,EAAGA,EAAQ,KAAMA,EAAQ,SAAS,EAI1F,MAHA,GAAU,cAAgBA,EAAQ,cAClC,EAAU,iBAAmBA,EAAQ,iBACrC,iBAAiBF,EAAWG,EAAM,IAAA,GAAWJ,CAAK,EAC3C,iBAAiBG,EAASC,EAAMJ,CAAK,CAChD,CAEA,SAAS,iBAAiB,EAAwB,EAAkB,EAAqC,EAA8C,CAC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eader","sourceStreamPattern","severityPattern","messagePattern","stringBodyPattern","rulePattern","operandPattern","ruleNamePattern","optionalReads","operandKinds","severities","opaqueDirectives","propertyShapedDirectives","names","lookahead","ParserContext","context","line","name","DiagnosticCodes","locationOf","properties","responses","identifier","validations","produces","reads","referenceReads","concurrency","description","documentation","authorize","handler","stream","streamCandidates","child","keyword","firstWord","asProperty","tryParseProperty","scalar","scalarResponsePattern","responseNames","parseCommandResponse","reportInvalidModifierOrder","source","streamName","ambiguous","route","parseCommandStream","isReactionIdentityLine","misplacedReactionIdentity","parseDescription","parseDocumentation","combineAuthorize","parseAuthorize","validate","production","parseProduces","parseHandler","reference","parseReads","captureConcurrency","read","candidates","entry","property","discoveredNames","response","removed","parsed","syntax","commandReadSources","dependencySources","reportLegacyOptionalSuffix","commandName","fence","code","parseCode","rules","requirements","wrapperIndent","owner","condition","parseCondition","message","severity","hasSeverity","directive","matched","unescapeString","rule","checksum","valueContext","withSeverity","match","body","wrapped","commandOwner","parseImplementationWrapper","isFile","parseFile","isCode","extra","content","text","algorithm","operand","parseMappingSource"],"sources":["../../../../../../Compiler/Parsing/CommandParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { RequirementSyntax } from '../Syntax/Conditions';\nimport { parseCondition } from './ConditionParser';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { CommandSyntax, ValidateSyntax, ValidationRuleKind, ValidationRuleSyntax, ValidationSeverity } from '../Syntax/Commands';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax } from '../Syntax/EventSources';\nimport { parseCommandStream } from './EventSourceParser';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { CommandResponseSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseCommandResponse, scalarResponsePattern } from './CommandResponseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isCode, isFile, parseCode, parseFile, parseHandler, parseImplementationWrapper } from './ImplementationParser';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationSyntax } from '../Syntax/Implementations';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { isReactionIdentityLine, misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { commandReadSources } from './CommandReadSources';\nimport { dependencySources, ReadsSyntax, ConcurrencySyntax } from '../Syntax/DependencySources';\nimport { captureConcurrency } from './DependencySourceParser';\nimport { parseReads } from './ReadsParser';\nimport { parseProduces } from './ProducesParser';\nimport { reportInvalidModifierOrder, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^command\\\\s+([A-Za-z_]\\\\w*)$');\nconst routeHeader = sourceStreamPattern('^stream\\\\s+[A-Za-z_]\\\\w*\\\\.[A-Za-z_]\\\\w*$');\nconst severityPattern = pattern('\\\\bseverity\\\\s+(\\\\S+)$');\nconst messagePattern = pattern(`\\\\bmessage\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\S*))$`);\nconst rulePattern = pattern('^([\\\\w.]+)\\\\s+(.+)$');\nconst operandPattern = pattern('^(not empty|length ==|all >=|all >|matches|max|min|rule|>=|<=|==|!=|>|<)\\\\s*(.*)$');\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\n// Every operand the pattern matches has a kind, so an operand never goes unrecognized here.\nconst operandKinds: Record<string, ValidationRuleKind> = {\n max: 'Max',\n min: 'Min',\n '>': 'GreaterThan',\n '>=': 'GreaterThanOrEqual',\n '<': 'LessThan',\n '<=': 'LessThanOrEqual',\n '==': 'Equal',\n '!=': 'NotEqual',\n 'length ==': 'Length',\n matches: 'Matches',\n 'all >': 'AllGreaterThan',\n 'all >=': 'AllGreaterThanOrEqual',\n};\n\nconst severities: Record<string, ValidationSeverity> = { information: 'Information', warning: 'Warning', error: 'Error' };\n\n// Command directives this compiler does not model. They are skipped whole.\nconst opaqueDirectives = new Set(['reads', 'concurrency']);\n\n// The bare directives cannot take a type reference, so a line with property shape is a property whatever\n// keyword it starts with - 'description String' declares a property called description.\nconst propertyShapedDirectives = new Set(['description', 'documentation', 'handler', 'concurrency']);\n\nexport function parseCommand(context: ParserContext, line: SourceLine): CommandSyntax {\n // Properties are leaves, not indentation owners. Resolve ambiguous returns spelling\n // before the committed pass decides whether its deeper lines belong to a response.\n const names = new Set<string>();\n const lookahead = new ParserContext(context.reader.fork(), context.path, context.languages);\n lookahead.sourceOptions = context.sourceOptions;\n lookahead.streamCandidates = context.streamCandidates;\n parseCommandBody(lookahead, line, undefined, names);\n return parseCommandBody(context, line, names);\n}\n\nfunction parseCommandBody(context: ParserContext, line: SourceLine, responseNames?: ReadonlySet<string>, discoveredNames?: Set<string>): CommandSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidCommandDeclaration, `Invalid command declaration '${line.content}' - expected 'command <Name>'`, locationOf(line));\n }\n const properties: PropertySyntax[] = [];\n const responses: { line: SourceLine; candidate: PropertySyntax | null; response: CommandResponseSyntax | null }[] = [];\n let identifier: PropertySyntax | undefined;\n const validations: ValidateSyntax[] = [];\n const produces: ProducesSyntax[] = [];\n const reads: { readModel: string; alias: string | null }[] = [];\n const referenceReads: ReadsSyntax[] = [];\n let concurrency: ConcurrencySyntax | undefined;\n let description: string | null = null;\n let documentation: string | null = null;\n let authorize: AuthorizeSyntax | null = null;\n let handler: HandlerSyntax | null = null;\n let stream: CommandStreamSyntax | null = null;\n const streamCandidates: CommandStreamSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n const asProperty = tryParseProperty(child);\n if (asProperty !== undefined && (propertyShapedDirectives.has(keyword) || (keyword === 'validate' && child.content !== 'validate csharp'))) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (keyword === 'returns') {\n const scalar = scalarResponsePattern.exec(child.content);\n if (scalar !== null && !scalar[1].startsWith('@') && asProperty !== undefined) {\n if (responseNames === undefined) {\n properties.push(asProperty);\n responses.push({ line: child, candidate: asProperty, response: null });\n } else if (responseNames.has(asProperty.type.name)) {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n } else {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n }\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (reportInvalidModifierOrder(context, child)) {\n context.skipBlock(child.indent);\n } else {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n }\n } else if (keyword === 'stream' && routeHeader.test(child.content) && asProperty !== undefined && context.streamCandidates?.hasSource(asProperty.type.name.split('.')[0]) === true) {\n const [source, streamName] = asProperty.type.name.split('.');\n const ambiguous = context.streamCandidates.hasPropertyType(asProperty.type.name) && context.streamCandidates.hasUniqueStream(source, streamName);\n const route = parseCommandStream(context, child, asProperty, ambiguous);\n if (stream !== null || streamCandidates.length > 0) context.error(DiagnosticCodes.InvalidCommandStream, 'A command declares at most one stream route.', locationOf(child));\n if (ambiguous || stream !== null) streamCandidates.push(route);\n else stream = route;\n } else if (keyword === 'runs' && isReactionIdentityLine(child)) {\n misplacedReactionIdentity(context, child);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Command '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Command '${name}'`);\n } else if (keyword === 'authorize') {\n authorize = combineAuthorize(authorize, parseAuthorize(context, child));\n } else if (keyword === 'validate') {\n const validate = parseValidate(context, child, 'command');\n if (validate !== undefined) {\n validations.push(validate);\n }\n } else if (keyword === 'produces') {\n const production = parseProduces(context, child, true);\n if (production !== undefined) produces.push(production);\n } else if (keyword === 'handler') {\n handler = parseHandler(context, child);\n } else if (opaqueDirectives.has(keyword)) {\n const reference = keyword === 'reads' ? parseReads(context, child) : undefined;\n if (reference !== undefined) referenceReads.push(reference);\n if (keyword === 'concurrency' && concurrency === undefined) concurrency = captureConcurrency(context, child);\n const read = /^reads\\s+([A-Z]\\w*)(?:\\s+as\\s+([a-z_]\\w*))?(?:\\s+by\\s+([a-z_]\\w*))?$/.exec(child.content);\n if (read !== null) reads.push({ readModel: read[1], alias: read[2] ?? null });\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n context.skipOpaqueBlock(child.indent);\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else {\n reportInvalidModifierOrder(context, child);\n context.error(DiagnosticCodes.UnknownCommandDirective, `Unexpected '${child.content}' in command body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const candidates = new Set(responses.flatMap(entry => entry.candidate === null ? [] : [entry.candidate]));\n const names = new Set(properties.filter(property => !candidates.has(property)).map(property => property.name));\n if (responses.some(entry => entry.candidate !== null && !names.has(entry.candidate.type.name) && entry.candidate.type.name !== 'returns')) names.add('returns');\n for (const name of names) discoveredNames?.add(name);\n let response: CommandResponseSyntax | null = null;\n const removed = new Set<PropertySyntax>();\n for (const entry of responses) {\n let parsed = entry.response;\n if (entry.candidate !== null) {\n if (!names.has(entry.candidate.type.name)) continue;\n removed.add(entry.candidate);\n parsed = { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: entry.candidate.type.name, location: entry.candidate.type.location }, location: locationOf(entry.line) };\n }\n if (parsed === null) continue;\n if (response !== null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A command declares at most one unconditional response.', locationOf(entry.line));\n } else {\n response = parsed;\n }\n }\n if (handler !== null && produces.length > 0) {\n context.error(DiagnosticCodes.CommandWithProducesAndHandler, `Command '${name}' cannot declare both 'produces' and 'handler'`, locationOf(line));\n }\n const syntax: CommandSyntax = { kind: 'CommandSyntax', name, description, documentation, authorize, properties: properties.filter(property => !removed.has(property)), validations, produces, handler, response, stream, streamCandidates, location: locationOf(line) };\n commandReadSources.set(syntax, reads);\n dependencySources.set(syntax, { reads: referenceReads, concurrency });\n return syntax;\n}\n\nfunction addProperty(context: ParserContext, properties: PropertySyntax[], property: PropertySyntax, commandName: string, line: SourceLine, identifier: PropertySyntax | undefined): PropertySyntax | undefined {\n reportLegacyOptionalSuffix(context, property.type, line);\n if (property.isIdentifier && identifier !== undefined) {\n context.error(DiagnosticCodes.DuplicateCommandIdentifier, `Command '${commandName}' already marks '${identifier.name}' as identifier - only one property can be the identifier`, property.location);\n property = { ...property, isIdentifier: false };\n }\n properties.push(property);\n return identifier ?? (property.isIdentifier ? property : undefined);\n}\n\n// Reads a 'validate' block: declarative rules, or code - which is recognized but not modeled.\nexport function parseValidate(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidateSyntax | undefined {\n if (line.content === 'validate') {\n const fence = context.peekChild(line.indent);\n if (fence !== undefined && fence.content.startsWith('```')) {\n context.reader.takeSignificant();\n const code = parseCode(context.valueContext, fence);\n if (code === null) context.skipFencedBody();\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n const rules: ValidationRuleSyntax[] = [];\n const requirements: RequirementSyntax[] = [];\n let wrapperIndent: number | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (owner === 'concept') {\n if (context.sourceOptions.numericMode === 'legacy' && child.content.startsWith('```')) { context.skipFencedBody(); continue; }\n if (wrapperIndent !== undefined && child.indent <= wrapperIndent) wrapperIndent = undefined;\n if (wrapperIndent !== undefined || firstWord(child.content) === 'implementation') {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${child.content}'`, locationOf(child));\n wrapperIndent ??= child.indent;\n continue;\n }\n }\n if (firstWord(child.content) === 'require') {\n const condition = parseCondition(owner === 'concept' ? context.valueContext : context, child.content.substring('require'.length).trim(), locationOf(child));\n let message: string | null = null;\n let severity: ValidationSeverity = 'Error';\n let hasSeverity = false;\n for (let directive = context.peekChild(child.indent); directive !== undefined; directive = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const matched = messagePattern.exec(directive.content);\n if (matched !== null && matched.index === 0) message = matched[1] !== undefined ? unescapeString(matched[1]) : matched[2];\n else if (firstWord(directive.content) === 'severity') {\n if (!hasSeverity) severity = severities[directive.content.substring('severity'.length).trim()] ?? 'Error';\n hasSeverity = true;\n } else context.skipOpaqueBlock(directive.indent);\n }\n if (condition !== null) requirements.push({ kind: 'RequirementSyntax', condition, message, severity, location: locationOf(child) });\n continue;\n }\n const rule = parseValidationRule(context, owner === 'concept' ? { ...child, content: `value ${child.content}` } : child, owner);\n if (rule !== undefined) {\n rules.push(rule);\n }\n }\n return { kind: 'DeclarativeValidateSyntax', rules, requirements, location: locationOf(line) };\n }\n if (owner === 'concept' && firstWord(line.content.substring('validate'.length).trimStart()) === 'checksum') {\n const ruleLine = { ...line, content: `value ${line.content.substring('validate'.length).trimStart()}` };\n const rule = parseValidationRule(context, ruleLine, owner);\n return rule === undefined ? undefined : { kind: 'DeclarativeValidateSyntax', rules: [rule], requirements: [], location: locationOf(line) };\n }\n if (line.content === 'validate csharp') {\n const code = parseCode(context.valueContext, { ...line, content: 'csharp' });\n if (code === null) context.skipOpaqueBlock(line.indent);\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidValidateDeclaration, `Invalid validate declaration '${line.content}' - expected 'validate' or 'validate csharp'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseValidationRule(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidationRuleSyntax | undefined {\n // Checksum is a new declaration, not enrichment of a formerly opaque Legacy rule.\n const checksum = firstWord(rulePattern.exec(line.content)?.[2] ?? '') === 'checksum';\n const valueContext = owner === 'concept' && !checksum ? context.valueContext : context;\n const { content: withSeverity, message } = splitMessage(line.content);\n const severity = splitSeverity(valueContext, line, withSeverity);\n if (severity === undefined) {\n return undefined;\n }\n const match = rulePattern.exec(severity.content);\n if (match === null) {\n valueContext.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n const parsed = parseRule(valueContext, match[2], line);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parsed.kind === 'Rule' ? parseRuleImplementation(context, line, owner === 'command') : { file: null, code: null, implementation: null };\n return {\n kind: 'ValidationRuleSyntax',\n property: match[1],\n rule: parsed.kind,\n value: parsed.value,\n message,\n severity: severity.severity,\n ...source,\n location: locationOf(line),\n };\n}\n\nfunction parseRuleImplementation(context: ParserContext, rule: SourceLine, commandOwner: boolean): { file: FileReferenceSyntax | null; code: CodeBlockSyntax | null; implementation: ImplementationSyntax | null } {\n const body = context.peekChild(rule.indent);\n if (body === undefined) return { file: null, code: null, implementation: null };\n context.reader.takeSignificant();\n const wrapped = commandOwner && firstWord(body.content) === 'implementation';\n const source = wrapped ? parseImplementationWrapper(context, body) : {\n file: isFile(body) ? parseFile(context, body) : null,\n code: !isFile(body) && isCode(context, body) ? parseCode(context, body) : null,\n implementation: null,\n };\n if (!wrapped && source.file === null && source.code === null) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, `Unexpected '${body.content}' in rule implementation - expected 'file <path>' or an inline code block`, locationOf(body));\n context.skipBlock(body.indent);\n }\n for (let extra = context.peekChild(rule.indent); extra !== undefined && (wrapped || (commandOwner && firstWord(extra.content) === 'implementation')); extra = context.peekChild(rule.indent)) {\n context.reader.takeSignificant();\n context.error(wrapped && firstWord(extra.content) === 'implementation' ? DiagnosticCodes.InvalidImplementationBlock : DiagnosticCodes.ConflictingImplementationSources,\n 'A named rule has one implementation wrapper and cannot mix wrapped and direct sources.', locationOf(extra));\n if (isCode(context, extra)) parseCode(context, extra);\n else context.skipBlock(extra.indent);\n }\n return source;\n}\n\nfunction splitMessage(content: string): { content: string; message: string | null } {\n const match = messagePattern.exec(content);\n if (match === null) {\n return { content, message: null };\n }\n const message = match[1] !== undefined ? unescapeString(match[1]) : match[2];\n return { content: content.substring(0, match.index).trimEnd(), message };\n}\n\nfunction splitSeverity(context: ParserContext, line: SourceLine, text: string): { content: string; severity: ValidationSeverity } | undefined {\n const match = severityPattern.exec(text);\n if (match === null) {\n return { content: text, severity: 'Error' };\n }\n const severity = severities[match[1]];\n if (severity === undefined) {\n context.error(DiagnosticCodes.InvalidValidationSeverity, `Unknown validation severity '${match[1]}' - expected information, warning or error`, locationOf(line));\n return undefined;\n }\n return { content: text.substring(0, match.index).trimEnd(), severity };\n}\n\nfunction parseRule(context: ParserContext, rule: string, line: SourceLine): { kind: ValidationRuleKind; value: ExpressionSyntax | null } | undefined {\n if (rule === 'not empty') {\n return { kind: 'NotEmpty', value: null };\n }\n if (firstWord(rule) === 'checksum') {\n const algorithm = rule.substring('checksum'.length).trim();\n if (algorithm !== 'luhn' && algorithm !== 'mod11' && algorithm !== 'mod97') {\n context.error(DiagnosticCodes.InvalidGenerationArgument, 'Checksum validation requires luhn, mod11 or mod97.', locationOf(line));\n return undefined;\n }\n return { kind: 'Checksum', value: { kind: 'LiteralExpressionSyntax', value: algorithm, location: locationOf(line) } };\n }\n const operand = operandPattern.exec(rule);\n if (operand === null) {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (operand[1] === 'rule') {\n const name = operand[2].trim();\n if (!ruleNamePattern.test(name)) {\n context.error(DiagnosticCodes.InvalidRuleName, `Invalid rule name '${name}' in '${line.content}' - expected 'rule <Name>' with an identifier`, locationOf(line));\n return undefined;\n }\n return { kind: 'Rule', value: { kind: 'PathExpressionSyntax', path: name, location: locationOf(line) } };\n }\n return { kind: operandKinds[operand[1]], value: parseMappingSource(operand[2], locationOf(line), context) };\n}\n"],"mappings":"oiDAmCA,MAAMA,EAASC,EAAQ,8BAA8B,EAC/CC,EAAcC,EAAoB,2CAA2C,EAC7EC,EAAkBH,EAAQ,wBAAwB,EAClDI,EAAiBJ,EAAQ,sBAAsBK,EAAkB,yBAAyB,EAC1FC,EAAcN,EAAQ,qBAAqB,EAC3CO,EAAiBP,EAAQ,mFAAmF,EAC5GQ,EAAkBN,EAAoB,iBAAiB,EACvDO,EAAgBT,EAAQ,0CAA0C,EAGlEU,EAAmD,CACrD,IAAK,MACL,IAAK,MACL,IAAK,cACL,KAAM,qBACN,IAAK,WACL,KAAM,kBACN,KAAM,QACN,KAAM,WACN,YAAa,SACb,QAAS,UACT,QAAS,iBACT,SAAU,uBACd,EAEMC,EAAiD,CAAE,YAAa,cAAe,QAAS,UAAW,MAAO,OAAQ,EAGlHC,kBAAmB,IAAI,IAAI,CAAC,QAAS,aAAa,CAAC,EAInDC,kBAA2B,IAAI,IAAI,CAAC,cAAe,gBAAiB,UAAW,aAAa,CAAC,EAEnG,SAAgB,aAAa,EAAwB,EAAiC,CAGlF,IAAMC,kBAAQ,IAAI,IACZC,EAAY,IAAIC,EAAcC,EAAQ,OAAO,KAAK,EAAGA,EAAQ,KAAMA,EAAQ,SAAS,EAI1F,MAHA,GAAU,cAAgBA,EAAQ,cAClC,EAAU,iBAAmBA,EAAQ,iBACrC,iBAAiBF,EAAWG,EAAM,IAAA,GAAWJ,CAAK,EAC3C,iBAAiBG,EAASC,EAAMJ,CAAK,CAChD,CAEA,SAAS,iBAAiB,EAAwB,EAAkB,EAAqC,EAA8C,CACnJ,IAAMK,EAAOpB,EAAO,KAAKmB,EAAK,OAAO,CAAC,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,CAAE,KAAM,0BAA2B,MAAOyF,EAAW,SAAUtF,EAAWH,CAAI,CAAE,CAAE,CACxH,CACA,IAAM0F,EAAUrG,EAAe,KAAKqF,CAAI,EACxC,GAAIgB,IAAY,KACZ3F,EAAQ,MAAMG,EAAgB,sBAAuB,4BAA4BF,EAAK,QAAQ,GAAIG,EAAWH,CAAI,CAAC,MAGtH,IAAI0F,EAAQ,KAAO,OAAQ,CACvB,IAAMzF,EAAOyF,EAAQ,EAAE,CAAC,KAAK,EAC7B,GAAI,CAACpG,EAAgB,KAAKW,CAAI,EAAG,CAC7BF,EAAQ,MAAMG,EAAgB,gBAAiB,sBAAsBD,EAAK,QAAQD,EAAK,QAAQ,+CAAgDG,EAAWH,CAAI,CAAC,EAC/J,MACJ,CACA,MAAO,CAAE,KAAM,OAAQ,MAAO,CAAE,KAAM,uBAAwB,KAAMC,EAAM,SAAUE,EAAWH,CAAI,CAAE,CAAE,CAC3G,CACA,MAAO,CAAE,KAAMR,EAAakG,EAAQ,IAAK,MAAOC,EAAmBD,EAAQ,GAAIvF,EAAWH,CAAI,EAAGD,CAAO,CAAE,CAD1G,CAEJ"}
@@ -0,0 +1,2 @@
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{locationOf as t}from"./SourceLine.js";import{isFile as n,parseCode as r,parseFile as i}from"./ImplementationParser.js";function parseGenerationBody(a,o,s){let c=!1,l;for(;(l=a.peekChild(o.indent))!==void 0;){a.reader.takeSignificant();let o=n(l),u=l.content.startsWith("```");if(s.strategy!==`rule`||!o&&!u){a.error(e.UnknownRuleImplementationDirective,`Generation rule bodies accept only one 'file <path>' or tagged inline fence.`,t(l)),a.skipBlock(l.indent);continue}c&&a.error(e.ConflictingImplementationSources,`A generation rule has exactly one file or inline payload.`,t(l));let d=o?i(a,l):null,f=u?r(a,l):null;c||(s={...s,file:d,code:f}),c=!0;let p=o?a.peekChild(l.indent):void 0;p!==void 0&&(a.error(e.UnknownRuleImplementationDirective,`A generation file directive cannot have children.`,t(p)),a.skipBlock(l.indent))}return s}export{parseGenerationBody};
2
+ //# sourceMappingURL=GenerationBodyParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerationBodyParser.js","names":["hasBody","child","context","line","file","isFile","fence","generation","DiagnosticCodes","locationOf","parsedFile","parseFile","parsedCode","parseCode","nested"],"sources":["../../../../../../Compiler/Parsing/GenerationBodyParser.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 { GenerationSyntax } from '../Syntax/GenerationSyntax';\nimport { isFile, parseCode, parseFile } from './ImplementationParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport function parseGenerationBody(context: ParserContext, line: SourceLine, generation: GenerationSyntax): GenerationSyntax {\n let hasBody = false;\n let child: SourceLine | undefined;\n while ((child = context.peekChild(line.indent)) !== undefined) {\n context.reader.takeSignificant();\n const file = isFile(child);\n const fence = child.content.startsWith('```');\n if (generation.strategy !== 'rule' || (!file && !fence)) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, \"Generation rule bodies accept only one 'file <path>' or tagged inline fence.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasBody) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A generation rule has exactly one file or inline payload.', locationOf(child));\n const parsedFile = file ? parseFile(context, child) : null;\n const parsedCode = fence ? parseCode(context, child) : null;\n if (!hasBody) generation = { ...generation, file: parsedFile, code: parsedCode };\n hasBody = true;\n const nested = file ? context.peekChild(child.indent) : undefined;\n if (nested !== undefined) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, 'A generation file directive cannot have children.', locationOf(nested));\n context.skipBlock(child.indent);\n }\n }\n return generation;\n}\n"],"mappings":"uPASA,SAAgB,oBAAoB,EAAwB,EAAkB,EAAgD,CAC1H,IAAIA,EAAU,GACVC,EACJ,MAAQ,EAAQC,EAAQ,UAAUC,EAAK,MAAM,KAAO,IAAA,IAAW,CAC3DD,EAAQ,OAAO,gBAAgB,EAC/B,IAAME,EAAOC,EAAOJ,CAAK,EACnBK,EAAQL,EAAM,QAAQ,WAAW,KAAK,EAC5C,GAAIM,EAAW,WAAa,QAAW,CAACH,GAAQ,CAACE,EAAQ,CACrDJ,EAAQ,MAAMM,EAAgB,mCAAoC,+EAAgFC,EAAWR,CAAK,CAAC,EACnKC,EAAQ,UAAUD,EAAM,MAAM,EAC9B,QACJ,CACID,GAASE,EAAQ,MAAMM,EAAgB,iCAAkC,4DAA6DC,EAAWR,CAAK,CAAC,EAC3J,IAAMS,EAAaN,EAAOO,EAAUT,EAASD,CAAK,EAAI,KAChDW,EAAaN,EAAQO,EAAUX,EAASD,CAAK,EAAI,KAClDD,IAAS,EAAa,CAAE,GAAGO,EAAY,KAAMG,EAAY,KAAME,CAAW,GAC/E,EAAU,GACV,IAAME,EAASV,EAAOF,EAAQ,UAAUD,EAAM,MAAM,EAAI,IAAA,GACpDa,IAAW,IAAA,KACXZ,EAAQ,MAAMM,EAAgB,mCAAoC,oDAAqDC,EAAWK,CAAM,CAAC,EACzIZ,EAAQ,UAAUD,EAAM,MAAM,EAEtC,CACA,OAAOM,CACX"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{locationOf as r}from"./SourceLine.js";const i=RegExp(`"${t}"|\\S+`,`g`),a=/^([a-z]([a-z_]{0,61}[a-z])?)?$(?![\s\S])/,printable=e=>[...e].every(e=>e>=` `&&e<=`~`),literal=e=>e!==void 0&&e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?n(e.slice(1,-1)):void 0,integer=e=>e!==void 0&&/^-?[0-9]+$(?![\s\S])/.test(e)&&Number(e)>=-2147483648&&Number(e)<=2147483647?Number(e):void 0;function parseGeneration(t,n,o){let s=[...n.content.matchAll(i)].map(e=>e[0]).slice(1),error=(e,i)=>t.error(e,i,r(n));if(s.length===0)return error(e.InvalidGenerationArgument,`Expected 'generate <strategy> [modifiers]'.`),null;let c=s[0];if(![`uuid`,`uuidv7`,`ulid`,`typeid`,`nanoid`,`bytes`,`pattern`,`random`,`rule`,`sequence`].includes(c))return error(e.UnknownGenerationStrategy,`Unknown generation strategy '${c}'.`),null;let l={kind:`GenerationSyntax`,strategy:c,location:r(n)},u=1,d=!0;switch(c){case`typeid`:case`pattern`:{let e=literal(s[u++]);d=e!==void 0,l=c===`typeid`?{...l,prefix:e}:{...l,pattern:e};break}case`nanoid`:{let e=integer(s[u]);e!==void 0&&(l={...l,size:e},u++);break}case`bytes`:{let e=integer(s[u++]),t=s[u++];d=e!==void 0&&[`base64url`,`hex`,`base32`].includes(t),l={...l,count:e,encoding:t};break}case`random`:{let e=s[u++],t=e?.match(/^(-?(?:0|[1-9][0-9]*))\.\.(-?(?:0|[1-9][0-9]*))$/);d=t!=null&&BigInt(t[1])>=-9223372036854775808n&&BigInt(t[2])<=9223372036854775807n&&BigInt(t[1])<=BigInt(t[2]),l={...l,range:e};break}case`rule`:{let e=s[u++];d=e!==void 0&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e),l={...l,rule:e};break}}if(!d)return error(e.InvalidGenerationArgument,`Missing or invalid argument for generation strategy '${c}'.`),l;let f=/* @__PURE__ */ new Set;for(;u<s.length;){let t=s[u++],n=s[u++];if(f.has(t)&&error(e.DuplicateGenerationModifier,`Generation modifier '${t}' is repeated.`),f.add(t),!allows(c,o,l.encoding,t)){error(e.InvalidGenerationModifier,`Generation modifier '${t}' is not allowed for '${c}' on '${o}'.`);continue}let r=literal(n);if(t===`prefix`||t===`alphabet`?r===void 0:t===`case`?![`lower`,`upper`].includes(n):![`luhn`,`mod11`,`mod97`].includes(n))error(e.InvalidGenerationArgument,`Missing or invalid value for generation modifier '${t}'.`);else switch(t){case`prefix`:l={...l,prefix:r};break;case`alphabet`:l={...l,alphabet:r};break;case`case`:l={...l,case:n};break;default:l={...l,checksum:n}}}return c===`sequence`||(o===`Uuid`?[`uuid`,`uuidv7`].includes(c):o===`String`?c!==`random`:o===`Int`&&c===`random`)||error(e.InvalidGenerationPrimitive,`Generation strategy '${c}' is not allowed on '${o}'.`),l.prefix!==void 0&&l.prefix!==null&&(c===`typeid`?a.test(l.prefix)||error(e.InvalidTypeIdPrefix,`TypeID prefix must be empty or 1..63 lowercase letters and underscores, starting and ending with a letter.`):(l.prefix.length>32||!printable(l.prefix))&&error(e.InvalidGenerationPrefix,`Generation prefix must contain at most 32 printable ASCII characters.`)),l.alphabet!==void 0&&l.alphabet!==null&&(l.alphabet.length<2||l.alphabet.length>256||!printable(l.alphabet)||new Set(l.alphabet).size!==l.alphabet.length)&&error(e.InvalidGenerationAlphabet,`NanoID alphabet must contain 2..256 distinct printable ASCII characters.`),(l.size!==void 0&&l.size!==null&&(l.size<1||l.size>256)||l.count!==void 0&&l.count!==null&&(l.count<1||l.count>512))&&error(e.GenerationSizeOutsideRange,`NanoID size must be 1..256 and bytes count must be 1..512.`),l}function allows(e,t,n,r){switch(r){case`prefix`:return t===`String`&&[`uuid`,`uuidv7`,`ulid`,`nanoid`,`bytes`].includes(e);case`alphabet`:return e===`nanoid`;case`case`:return e===`ulid`||t===`String`&&[`uuid`,`uuidv7`].includes(e)||e===`bytes`&&[`hex`,`base32`].includes(n??``);case`checksum`:return e===`pattern`;default:return!1}}export{parseGeneration};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{locationOf as r}from"./SourceLine.js";import{InvalidGenerationPattern as i}from"../Generation/InvalidGenerationPattern.js";import{parseGenerationPattern as a}from"../Generation/GenerationPattern.js";import"../Generation/index.js";import{parseGenerationBody as o}from"./GenerationBodyParser.js";const s=RegExp(`"${t}"|\\S+`,`g`),c=/^([a-z]([a-z_]{0,61}[a-z])?)?$(?![\s\S])/,printable=e=>[...e].every(e=>e>=` `&&e<=`~`),literal=e=>e!==void 0&&e.length>=2&&e.startsWith(`"`)&&e.endsWith(`"`)?n(e.slice(1,-1)):void 0,integer=e=>e!==void 0&&/^-?[0-9]+$(?![\s\S])/.test(e)&&Number(e)>=-2147483648&&Number(e)<=2147483647?Number(e):void 0;function parseGeneration(t,n,l){let u=[...n.content.matchAll(s)].map(e=>e[0]).slice(1),error=(e,i)=>t.error(e,i,r(n));if(u.length===0)return error(e.InvalidGenerationArgument,`Expected 'generate <strategy> [modifiers]'.`),null;let d=u[0];if(![`uuid`,`uuidv7`,`ulid`,`typeid`,`nanoid`,`bytes`,`pattern`,`random`,`rule`,`sequence`].includes(d))return error(e.UnknownGenerationStrategy,`Unknown generation strategy '${d}'.`),null;let f={kind:`GenerationSyntax`,strategy:d,location:r(n)},p=1,m=!0;switch(d){case`typeid`:case`pattern`:{let e=literal(u[p++]);m=e!==void 0,f=d===`typeid`?{...f,prefix:e}:{...f,pattern:e};break}case`nanoid`:{let e=integer(u[p]);e!==void 0&&(f={...f,size:e},p++);break}case`bytes`:{let e=integer(u[p++]),t=u[p++];m=e!==void 0&&[`base64url`,`hex`,`base32`].includes(t),f={...f,count:e,encoding:t};break}case`random`:{let e=u[p++],t=e?.match(/^(-?(?:0|[1-9][0-9]*))\.\.(-?(?:0|[1-9][0-9]*))$(?![\s\S])/);m=t!=null&&BigInt(t[1])>=-9223372036854775808n&&BigInt(t[2])<=9223372036854775807n&&BigInt(t[1])<=BigInt(t[2]),f={...f,range:e};break}case`rule`:{let e=u[p++];m=e!==void 0&&/^[A-Za-z_][A-Za-z0-9_]*$(?![\s\S])/.test(e),f={...f,rule:e};break}}if(!m)return error(e.InvalidGenerationArgument,`Missing or invalid argument for generation strategy '${d}'.`),f;let h=/* @__PURE__ */ new Set;for(;p<u.length;){let t=u[p++],n=u[p++];if(h.has(t)&&error(e.DuplicateGenerationModifier,`Generation modifier '${t}' is repeated.`),h.add(t),!allows(d,l,f.encoding,t)){error(e.InvalidGenerationModifier,`Generation modifier '${t}' is not allowed for '${d}' on '${l}'.`);continue}let r=literal(n);if(t===`prefix`||t===`alphabet`?r===void 0:t===`case`?![`lower`,`upper`].includes(n):![`luhn`,`mod11`,`mod97`].includes(n))error(e.InvalidGenerationArgument,`Missing or invalid value for generation modifier '${t}'.`);else switch(t){case`prefix`:f={...f,prefix:r};break;case`alphabet`:f={...f,alphabet:r};break;case`case`:f={...f,case:n};break;default:f={...f,checksum:n}}}if(d===`pattern`&&f.pattern!==void 0&&f.pattern!==null)try{a(f.pattern,f.checksum)}catch(t){if(!(t instanceof i))throw t;error(t.message.includes(`expanded length`)?e.GenerationSizeOutsideRange:e.InvalidGenerationArgument,t.message)}return d===`sequence`||(l===`Uuid`?[`uuid`,`uuidv7`].includes(d):l===`String`?d!==`random`:l===`Int`&&d===`random`)||error(e.InvalidGenerationPrimitive,`Generation strategy '${d}' is not allowed on '${l}'.`),f.prefix!==void 0&&f.prefix!==null&&(d===`typeid`?c.test(f.prefix)||error(e.InvalidTypeIdPrefix,`TypeID prefix must be empty or 1..63 lowercase letters and underscores, starting and ending with a letter.`):(f.prefix.length>32||!printable(f.prefix))&&error(e.InvalidGenerationPrefix,`Generation prefix must contain at most 32 printable ASCII characters.`)),f.alphabet!==void 0&&f.alphabet!==null&&(f.alphabet.length<2||f.alphabet.length>256||!printable(f.alphabet)||new Set(f.alphabet).size!==f.alphabet.length)&&error(e.InvalidGenerationAlphabet,`NanoID alphabet must contain 2..256 distinct printable ASCII characters.`),(f.size!==void 0&&f.size!==null&&(f.size<1||f.size>256)||f.count!==void 0&&f.count!==null&&(f.count<1||f.count>512))&&error(e.GenerationSizeOutsideRange,`NanoID size must be 1..256 and bytes count must be 1..512.`),o(t,n,f)}function allows(e,t,n,r){switch(r){case`prefix`:return t===`String`&&[`uuid`,`uuidv7`,`ulid`,`nanoid`,`bytes`].includes(e);case`alphabet`:return e===`nanoid`;case`case`:return e===`ulid`||t===`String`&&[`uuid`,`uuidv7`].includes(e)||e===`bytes`&&[`hex`,`base32`].includes(n??``);case`checksum`:return e===`pattern`;default:return!1}}export{parseGeneration};
2
2
  //# sourceMappingURL=GenerationParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenerationParser.js","names":["tokenPattern","stringBodyPattern","typeIdPrefix","value","character","unescapeString","tokens","line","match","context","code","message","locationOf","DiagnosticCodes","strategy","result","index","valid","text","size","count","encoding","range","rule","seen","modifier","primitive"],"sources":["../../../../../../Compiler/Parsing/GenerationParser.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 { GenerationSyntax } from '../Syntax/GenerationSyntax';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst tokenPattern = new RegExp(`\"${stringBodyPattern}\"|\\\\S+`, 'g');\nconst typeIdPrefix = /^([a-z]([a-z_]{0,61}[a-z])?)?$(?![\\s\\S])/;\nconst printable = (value: string): boolean => [...value].every(character => character >= ' ' && character <= '~');\nconst literal = (value: string | undefined): string | undefined => value !== undefined && value.length >= 2 && value.startsWith('\"') && value.endsWith('\"') ? unescapeString(value.slice(1, -1)) : undefined;\nconst integer = (value: string | undefined): number | undefined => value !== undefined && /^-?[0-9]+$(?![\\s\\S])/.test(value) && Number(value) >= -2147483648 && Number(value) <= 2147483647 ? Number(value) : undefined;\n\nexport function parseGeneration(context: ParserContext, line: SourceLine, primitive: string): GenerationSyntax | null {\n const tokens = [...line.content.matchAll(tokenPattern)].map(match => match[0]).slice(1);\n const error = (code: string, message: string): void => context.error(code, message, locationOf(line));\n if (tokens.length === 0) {\n error(DiagnosticCodes.InvalidGenerationArgument, \"Expected 'generate <strategy> [modifiers]'.\");\n return null;\n }\n const strategy = tokens[0];\n if (!['uuid', 'uuidv7', 'ulid', 'typeid', 'nanoid', 'bytes', 'pattern', 'random', 'rule', 'sequence'].includes(strategy)) {\n error(DiagnosticCodes.UnknownGenerationStrategy, `Unknown generation strategy '${strategy}'.`);\n return null;\n }\n let result: GenerationSyntax = { kind: 'GenerationSyntax', strategy, location: locationOf(line) };\n let index = 1;\n let valid = true;\n switch (strategy) {\n case 'typeid':\n case 'pattern': {\n const text = literal(tokens[index++]);\n valid = text !== undefined;\n result = strategy === 'typeid' ? { ...result, prefix: text } : { ...result, pattern: text };\n break;\n }\n case 'nanoid': {\n const size = integer(tokens[index]);\n if (size !== undefined) { result = { ...result, size }; index++; }\n break;\n }\n case 'bytes': {\n const count = integer(tokens[index++]);\n const encoding = tokens[index++];\n valid = count !== undefined && ['base64url', 'hex', 'base32'].includes(encoding);\n result = { ...result, count, encoding };\n break;\n }\n case 'random': {\n const range = tokens[index++];\n const match = range?.match(/^(-?(?:0|[1-9][0-9]*))\\.\\.(-?(?:0|[1-9][0-9]*))$/);\n valid = match !== null && match !== undefined && BigInt(match[1]) >= -9223372036854775808n && BigInt(match[2]) <= 9223372036854775807n && BigInt(match[1]) <= BigInt(match[2]);\n result = { ...result, range };\n break;\n }\n case 'rule': {\n const rule = tokens[index++];\n valid = rule !== undefined && /^[A-Za-z_][A-Za-z0-9_]*$/.test(rule);\n result = { ...result, rule };\n break;\n }\n }\n if (!valid) {\n error(DiagnosticCodes.InvalidGenerationArgument, `Missing or invalid argument for generation strategy '${strategy}'.`);\n return result;\n }\n const seen = new Set<string>();\n while (index < tokens.length) {\n const modifier = tokens[index++];\n const value = tokens[index++];\n if (seen.has(modifier)) error(DiagnosticCodes.DuplicateGenerationModifier, `Generation modifier '${modifier}' is repeated.`);\n seen.add(modifier);\n if (!allows(strategy, primitive, result.encoding, modifier)) {\n error(DiagnosticCodes.InvalidGenerationModifier, `Generation modifier '${modifier}' is not allowed for '${strategy}' on '${primitive}'.`);\n continue;\n }\n const text = literal(value);\n if (modifier === 'prefix' || modifier === 'alphabet' ? text === undefined : modifier === 'case' ? !['lower', 'upper'].includes(value) : !['luhn', 'mod11', 'mod97'].includes(value)) {\n error(DiagnosticCodes.InvalidGenerationArgument, `Missing or invalid value for generation modifier '${modifier}'.`);\n continue;\n }\n switch (modifier) {\n case 'prefix': result = { ...result, prefix: text }; break;\n case 'alphabet': result = { ...result, alphabet: text }; break;\n case 'case': result = { ...result, case: value }; break;\n default: result = { ...result, checksum: value };\n }\n }\n const allowed = strategy === 'sequence' || (primitive === 'Uuid' ? ['uuid', 'uuidv7'].includes(strategy) : primitive === 'String' ? strategy !== 'random' : primitive === 'Int' && strategy === 'random');\n if (!allowed) error(DiagnosticCodes.InvalidGenerationPrimitive, `Generation strategy '${strategy}' is not allowed on '${primitive}'.`);\n if (result.prefix !== undefined && result.prefix !== null) {\n if (strategy === 'typeid') {\n if (!typeIdPrefix.test(result.prefix)) error(DiagnosticCodes.InvalidTypeIdPrefix, 'TypeID prefix must be empty or 1..63 lowercase letters and underscores, starting and ending with a letter.');\n } else if (result.prefix.length > 32 || !printable(result.prefix)) error(DiagnosticCodes.InvalidGenerationPrefix, 'Generation prefix must contain at most 32 printable ASCII characters.');\n }\n if (result.alphabet !== undefined && result.alphabet !== null && (result.alphabet.length < 2 || result.alphabet.length > 256 || !printable(result.alphabet) || new Set(result.alphabet).size !== result.alphabet.length)) {\n error(DiagnosticCodes.InvalidGenerationAlphabet, 'NanoID alphabet must contain 2..256 distinct printable ASCII characters.');\n }\n if ((result.size !== undefined && result.size !== null && (result.size < 1 || result.size > 256)) || (result.count !== undefined && result.count !== null && (result.count < 1 || result.count > 512))) {\n error(DiagnosticCodes.GenerationSizeOutsideRange, 'NanoID size must be 1..256 and bytes count must be 1..512.');\n }\n return result;\n}\n\nfunction allows(strategy: string, primitive: string, encoding: string | null | undefined, modifier: string): boolean {\n switch (modifier) {\n case 'prefix': return primitive === 'String' && ['uuid', 'uuidv7', 'ulid', 'nanoid', 'bytes'].includes(strategy);\n case 'alphabet': return strategy === 'nanoid';\n case 'case': return strategy === 'ulid' || (primitive === 'String' && ['uuid', 'uuidv7'].includes(strategy)) || (strategy === 'bytes' && ['hex', 'base32'].includes(encoding ?? ''));\n case 'checksum': return strategy === 'pattern';\n default: return false;\n }\n}\n"],"mappings":"uPASA,MAAMA,EAAmB,OAAO,IAAIC,EAAkB,QAAS,GAAG,EAC5DC,EAAe,2CACf,UAAa,GAA2B,CAAC,GAAGC,CAAK,CAAC,CAAC,MAAM,GAAaC,GAAa,KAAOA,GAAa,GAAG,EAC1G,QAAW,GAAkDD,IAAU,IAAA,IAAaA,EAAM,QAAU,GAAKA,EAAM,WAAW,GAAG,GAAKA,EAAM,SAAS,GAAG,EAAIE,EAAeF,EAAM,MAAM,EAAG,EAAE,CAAC,EAAI,IAAA,GAC7L,QAAW,GAAkDA,IAAU,IAAA,IAAa,uBAAuB,KAAKA,CAAK,GAAK,OAAOA,CAAK,GAAK,aAAe,OAAOA,CAAK,GAAK,WAAa,OAAOA,CAAK,EAAI,IAAA,GAE9M,SAAgB,gBAAgB,EAAwB,EAAkB,EAA4C,CAClH,IAAMG,EAAS,CAAC,GAAGC,EAAK,QAAQ,SAASP,CAAY,CAAC,CAAC,CAAC,IAAI,GAASQ,EAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAChF,OAAS,EAAc,IAA0BC,EAAQ,MAAMC,EAAMC,EAASC,EAAWL,CAAI,CAAC,EACpG,GAAID,EAAO,SAAW,EAElB,OADA,MAAMO,EAAgB,0BAA2B,6CAA6C,EACvF,KAEX,IAAMC,EAAWR,EAAO,GACxB,GAAI,CAAC,CAAC,OAAQ,SAAU,OAAQ,SAAU,SAAU,QAAS,UAAW,SAAU,OAAQ,UAAU,CAAC,CAAC,SAASQ,CAAQ,EAEnH,OADA,MAAMD,EAAgB,0BAA2B,gCAAgCC,EAAS,GAAG,EACtF,KAE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O,OAAS,IAAM,CAAC,UAAUA,EAAO,MAAM,IAAG,MAAMF,EAAgB,wBAAyB,uEAAuE,GAEzLE,EAAO,WAAa,IAAA,IAAaA,EAAO,WAAa,OAASA,EAAO,SAAS,OAAS,GAAKA,EAAO,SAAS,OAAS,KAAO,CAAC,UAAUA,EAAO,QAAQ,GAAK,IAAI,IAAIA,EAAO,QAAQ,CAAC,CAAC,OAASA,EAAO,SAAS,SAC7M,MAAMF,EAAgB,0BAA2B,0EAA0E,GAE1HE,EAAO,OAAS,IAAA,IAAaA,EAAO,OAAS,OAASA,EAAO,KAAO,GAAKA,EAAO,KAAO,MAAUA,EAAO,QAAU,IAAA,IAAaA,EAAO,QAAU,OAASA,EAAO,MAAQ,GAAKA,EAAO,MAAQ,OAC7L,MAAMF,EAAgB,2BAA4B,4DAA4D,EAE3GE,CACX,CAEA,SAAS,OAAO,EAAkB,EAAmB,EAAqC,EAA2B,CACjH,OAAQU,EAAR,CACI,IAAK,SAAU,OAAOC,IAAc,UAAY,CAAC,OAAQ,SAAU,OAAQ,SAAU,OAAO,CAAC,CAAC,SAASZ,CAAQ,EAC/G,IAAK,WAAY,OAAOA,IAAa,SACrC,IAAK,OAAQ,OAAOA,IAAa,QAAWY,IAAc,UAAY,CAAC,OAAQ,QAAQ,CAAC,CAAC,SAASZ,CAAQ,GAAOA,IAAa,SAAW,CAAC,MAAO,QAAQ,CAAC,CAAC,SAASO,GAAY,EAAE,EAClL,IAAK,WAAY,OAAOP,IAAa,UACrC,QAAS,MAAO,EACpB,CACJ"}
1
+ {"version":3,"file":"GenerationParser.js","names":["tokenPattern","stringBodyPattern","typeIdPrefix","value","character","unescapeString","tokens","line","match","context","code","message","locationOf","DiagnosticCodes","strategy","result","index","valid","text","size","count","encoding","range","rule","seen","modifier","primitive","parseGenerationPattern","failure","InvalidGenerationPattern","parseGenerationBody"],"sources":["../../../../../../Compiler/Parsing/GenerationParser.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 { ChecksumAlgorithm, InvalidGenerationPattern, parseGenerationPattern } from '../Generation';\nimport { GenerationSyntax } from '../Syntax/GenerationSyntax';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { ParserContext } from './ParserContext';\nimport { parseGenerationBody } from './GenerationBodyParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst tokenPattern = new RegExp(`\"${stringBodyPattern}\"|\\\\S+`, 'g');\nconst typeIdPrefix = /^([a-z]([a-z_]{0,61}[a-z])?)?$(?![\\s\\S])/;\nconst printable = (value: string): boolean => [...value].every(character => character >= ' ' && character <= '~');\nconst literal = (value: string | undefined): string | undefined => value !== undefined && value.length >= 2 && value.startsWith('\"') && value.endsWith('\"') ? unescapeString(value.slice(1, -1)) : undefined;\nconst integer = (value: string | undefined): number | undefined => value !== undefined && /^-?[0-9]+$(?![\\s\\S])/.test(value) && Number(value) >= -2147483648 && Number(value) <= 2147483647 ? Number(value) : undefined;\n\nexport function parseGeneration(context: ParserContext, line: SourceLine, primitive: string): GenerationSyntax | null {\n const tokens = [...line.content.matchAll(tokenPattern)].map(match => match[0]).slice(1);\n const error = (code: string, message: string): void => context.error(code, message, locationOf(line));\n if (tokens.length === 0) {\n error(DiagnosticCodes.InvalidGenerationArgument, \"Expected 'generate <strategy> [modifiers]'.\");\n return null;\n }\n const strategy = tokens[0];\n if (!['uuid', 'uuidv7', 'ulid', 'typeid', 'nanoid', 'bytes', 'pattern', 'random', 'rule', 'sequence'].includes(strategy)) {\n error(DiagnosticCodes.UnknownGenerationStrategy, `Unknown generation strategy '${strategy}'.`);\n return null;\n }\n let result: GenerationSyntax = { kind: 'GenerationSyntax', strategy, location: locationOf(line) };\n let index = 1;\n let valid = true;\n switch (strategy) {\n case 'typeid':\n case 'pattern': {\n const text = literal(tokens[index++]);\n valid = text !== undefined;\n result = strategy === 'typeid' ? { ...result, prefix: text } : { ...result, pattern: text };\n break;\n }\n case 'nanoid': {\n const size = integer(tokens[index]);\n if (size !== undefined) { result = { ...result, size }; index++; }\n break;\n }\n case 'bytes': {\n const count = integer(tokens[index++]);\n const encoding = tokens[index++];\n valid = count !== undefined && ['base64url', 'hex', 'base32'].includes(encoding);\n result = { ...result, count, encoding };\n break;\n }\n case 'random': {\n const range = tokens[index++];\n const match = range?.match(/^(-?(?:0|[1-9][0-9]*))\\.\\.(-?(?:0|[1-9][0-9]*))$(?![\\s\\S])/);\n valid = match !== null && match !== undefined && BigInt(match[1]) >= -9223372036854775808n && BigInt(match[2]) <= 9223372036854775807n && BigInt(match[1]) <= BigInt(match[2]);\n result = { ...result, range };\n break;\n }\n case 'rule': {\n const rule = tokens[index++];\n valid = rule !== undefined && /^[A-Za-z_][A-Za-z0-9_]*$(?![\\s\\S])/.test(rule);\n result = { ...result, rule };\n break;\n }\n }\n if (!valid) {\n error(DiagnosticCodes.InvalidGenerationArgument, `Missing or invalid argument for generation strategy '${strategy}'.`);\n return result;\n }\n const seen = new Set<string>();\n while (index < tokens.length) {\n const modifier = tokens[index++];\n const value = tokens[index++];\n if (seen.has(modifier)) error(DiagnosticCodes.DuplicateGenerationModifier, `Generation modifier '${modifier}' is repeated.`);\n seen.add(modifier);\n if (!allows(strategy, primitive, result.encoding, modifier)) {\n error(DiagnosticCodes.InvalidGenerationModifier, `Generation modifier '${modifier}' is not allowed for '${strategy}' on '${primitive}'.`);\n continue;\n }\n const text = literal(value);\n if (modifier === 'prefix' || modifier === 'alphabet' ? text === undefined : modifier === 'case' ? !['lower', 'upper'].includes(value) : !['luhn', 'mod11', 'mod97'].includes(value)) {\n error(DiagnosticCodes.InvalidGenerationArgument, `Missing or invalid value for generation modifier '${modifier}'.`);\n continue;\n }\n switch (modifier) {\n case 'prefix': result = { ...result, prefix: text }; break;\n case 'alphabet': result = { ...result, alphabet: text }; break;\n case 'case': result = { ...result, case: value }; break;\n default: result = { ...result, checksum: value };\n }\n }\n if (strategy === 'pattern' && result.pattern !== undefined && result.pattern !== null) {\n try { parseGenerationPattern(result.pattern, result.checksum as ChecksumAlgorithm | undefined); }\n catch (failure) {\n if (!(failure instanceof InvalidGenerationPattern)) throw failure;\n error(failure.message.includes('expanded length') ? DiagnosticCodes.GenerationSizeOutsideRange : DiagnosticCodes.InvalidGenerationArgument, failure.message);\n }\n }\n const allowed = strategy === 'sequence' || (primitive === 'Uuid' ? ['uuid', 'uuidv7'].includes(strategy) : primitive === 'String' ? strategy !== 'random' : primitive === 'Int' && strategy === 'random');\n if (!allowed) error(DiagnosticCodes.InvalidGenerationPrimitive, `Generation strategy '${strategy}' is not allowed on '${primitive}'.`);\n if (result.prefix !== undefined && result.prefix !== null) {\n if (strategy === 'typeid') {\n if (!typeIdPrefix.test(result.prefix)) error(DiagnosticCodes.InvalidTypeIdPrefix, 'TypeID prefix must be empty or 1..63 lowercase letters and underscores, starting and ending with a letter.');\n } else if (result.prefix.length > 32 || !printable(result.prefix)) error(DiagnosticCodes.InvalidGenerationPrefix, 'Generation prefix must contain at most 32 printable ASCII characters.');\n }\n if (result.alphabet !== undefined && result.alphabet !== null && (result.alphabet.length < 2 || result.alphabet.length > 256 || !printable(result.alphabet) || new Set(result.alphabet).size !== result.alphabet.length)) {\n error(DiagnosticCodes.InvalidGenerationAlphabet, 'NanoID alphabet must contain 2..256 distinct printable ASCII characters.');\n }\n if ((result.size !== undefined && result.size !== null && (result.size < 1 || result.size > 256)) || (result.count !== undefined && result.count !== null && (result.count < 1 || result.count > 512))) {\n error(DiagnosticCodes.GenerationSizeOutsideRange, 'NanoID size must be 1..256 and bytes count must be 1..512.');\n }\n return parseGenerationBody(context, line, result);\n}\n\nfunction allows(strategy: string, primitive: string, encoding: string | null | undefined, modifier: string): boolean {\n switch (modifier) {\n case 'prefix': return primitive === 'String' && ['uuid', 'uuidv7', 'ulid', 'nanoid', 'bytes'].includes(strategy);\n case 'alphabet': return strategy === 'nanoid';\n case 'case': return strategy === 'ulid' || (primitive === 'String' && ['uuid', 'uuidv7'].includes(strategy)) || (strategy === 'bytes' && ['hex', 'base32'].includes(encoding ?? ''));\n case 'checksum': return strategy === 'pattern';\n default: return false;\n }\n}\n"],"mappings":"ufAWA,MAAMA,EAAmB,OAAO,IAAIC,EAAkB,QAAS,GAAG,EAC5DC,EAAe,2CACf,UAAa,GAA2B,CAAC,GAAGC,CAAK,CAAC,CAAC,MAAM,GAAaC,GAAa,KAAOA,GAAa,GAAG,EAC1G,QAAW,GAAkDD,IAAU,IAAA,IAAaA,EAAM,QAAU,GAAKA,EAAM,WAAW,GAAG,GAAKA,EAAM,SAAS,GAAG,EAAIE,EAAeF,EAAM,MAAM,EAAG,EAAE,CAAC,EAAI,IAAA,GAC7L,QAAW,GAAkDA,IAAU,IAAA,IAAa,uBAAuB,KAAKA,CAAK,GAAK,OAAOA,CAAK,GAAK,aAAe,OAAOA,CAAK,GAAK,WAAa,OAAOA,CAAK,EAAI,IAAA,GAE9M,SAAgB,gBAAgB,EAAwB,EAAkB,EAA4C,CAClH,IAAMG,EAAS,CAAC,GAAGC,EAAK,QAAQ,SAASP,CAAY,CAAC,CAAC,CAAC,IAAI,GAASQ,EAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAChF,OAAS,EAAc,IAA0BC,EAAQ,MAAMC,EAAMC,EAASC,EAAWL,CAAI,CAAC,EACpG,GAAID,EAAO,SAAW,EAElB,OADA,MAAMO,EAAgB,0BAA2B,6CAA6C,EACvF,KAEX,IAAMC,EAAWR,EAAO,GACxB,GAAI,CAAC,CAAC,OAAQ,SAAU,OAAQ,SAAU,SAAU,QAAS,UAAW,SAAU,OAAQ,UAAU,CAAC,CAAC,SAASQ,CAAQ,EAEnH,OADA,MAAMD,EAAgB,0BAA2B,gCAAgCC,EAAS,GAAG,EACtF,KAEX,IAAIC,EAA2B,CAAE,KAAM,mBAAoB,WAAU,SAAUH,EAAWL,CAAI,CAAE,EAC5FS,EAAQ,EACRC,EAAQ,GACZ,OAAQH,E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"../Diagnostics/DiagnosticCodes.js";import{eventDeclarations as t}from"../Syntax/EventDeclarations.js";import{AuthoringProductionResolver as n}from"../Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as r}from"../Syntax/DependencySources.js";import{consumedEvents as i,isEventsSource as a}from"../Syntax/CaptureEventsSource.js";import{PublicEventUsageCollector as o}from"./PublicEventUsageCollector.js";import{validatePublicEventMetadata as s}from"./PublicEventMetadataValidator.js";function validatePublicEventUsage(t,r){s(t,r);let i=new n(t);if(!i.declarations.some(e=>e.node.kind===`EventSyntax`&&(e.node.visibility===`Public`||e.node.origin!=null))&&!t.imports.some(e=>e.visibility===`Public`||e.origin!=null)&&!i.slices.some(({slice:e})=>e.direction!=null||usesEventSource(e)||targetsEvent(e,i)))return;let a=new n(t,i.declarations.filter(e=>e.kind===`event`));for(let{slice:e,scope:n}of i.slices)validateSlice(t,e,n,i,a,r);for(let n of t.seeds?.flatMap(e=>e.groups.flatMap(e=>e.events))??[]){let i=resolve(t,a,[],n.event,n,!0,r);if(i?.visibility!==`Public`)continue;let o=i.origin==null?e.PublicEventRequiresOutboundTranslation:e.ForeignPublicEventProduced;r.error(o,`Seed cannot append public event '${n.event}'; public production belongs to outbound translation, and foreign contracts cannot be produced locally.`,n.location)}}function validateSlice(n,r,i,a,s,c){let l=new o;l.visitSlice(r);let u=[],d=r.type===`Translate`&&r.direction===`Outbound`,f=new Set(r.readModels.map(e=>e.name));for(let{target:t,node:a}of l.projectionTargets){let o=f.has(t)?void 0:resolve(n,s,i,t,a,!1,c);o!==void 0&&(d?(u.push({node:o,output:!0}),validateUse(r,t,a,!0,!1,o,c)):c.error(e.EventTargetOutsideOutboundTranslation,`'${t}' is an event: a projection or reducer may only target an event in an explicitly outbound Translate slice.`,a.location))}if((r.type!==`Translate`||r.direction!==`Inbound`)&&!d)for(let t of l.eventSources)c.error(e.EventsSourceOutsideInboundTranslation,`'source events' reads another application's public events and belongs to a Translate slice with 'direction inbound', not '${r.name}'.`,t.location);let p=/* @__PURE__ */ new Map;for(let e of l.uses){let t=resolve(n,e.node.kind===`ProducesSyntax`?a:s,i,e.name,e.node,e.output,c);t!==void 0&&(u.push({node:t,output:e.output}),validateUse(r,e.name,e.node,e.output,e.command,t,c),recordCaptureOrigin(e.node,t,p))}validateCaptureOrigins(r,p,c);for(let e of l.allEvents){let t=a.declarations.filter(e=>e.kind===`event`).map(e=>e.node);for(let i of[...t,...n.imports.filter(e=>e.visibility===`Public`)])u.push({node:i,output:!1}),validateUse(r,i.kind===`ImportSyntax`?i.qualifiedName:i.name,e,!1,!1,i,c)}if(r.type!==`Translate`||(r.direction==null&&(t(r).some(e=>e.visibility===`Public`)||u.some(e=>e.node.visibility===`Public`))&&c.error(e.PublicTranslationRequiresDirection,`A Translate slice using public events requires an explicit 'direction inbound' or 'direction outbound'. Legacy translations without public metadata remain inbound.`,r.location),r.direction!==`Outbound`))return;let m=new Set(u.filter(e=>e.output&&e.node.visibility===`Public`&&e.node.origin==null).map(e=>e.node)).size;m!==1&&c.error(e.OutboundPublicEventCount,`Outbound Translate slice '${r.name}' must produce exactly one local public event type; found ${m}.`,r.location);for(let t of r.captures)c.error(e.TranslationConstructDirection,`An outbound translation consumes private local events, not an external-data capture. Capture belongs to inbound translation.`,t.location)}function recordCaptureOrigin(e,t,n){if(e.kind!==`CaptureSourceSettingSyntax`)return;let r=publicOrigin(t);r!==void 0&&n.set(e,r)}function publicOrigin(e){if(e.visibility!==`Public`)return;let t=e.origin??``;return t.trim().length>0?t:void 0}function validateCaptureOrigins(t,n,r){for(let o of t.captures){let t=o.source;if(t==null||!a(t))continue;let s=[...new Set(i(t).flatMap(e=>{let t=n.get(e);return t==null?[]:[t]}))].sort();s.length<2||r.error(e.CaptureEventsFromSeveralOrigins,`The 'from' events of capture '${o.name}' originate from several event stores (${s.join(`, `)}); a capture reads one event store - split it into one capture per origin.`,t.location)}}function validateUse(t,n,r,i,a,o,s){let c=o.origin!=null,l=o.visibility===`Public`,error=(e,t)=>s.error(e,t,r.location);i?(a&&l&&error(e.CommandProducesPublicEvent,`Command cannot produce public event '${n}'; publish through an outbound Translate slice.`),t.type===`Translate`&&t.direction===`Outbound`&&!l&&error(e.OutboundTranslationOutput,`Outbound translation must produce its one local public event, not private event '${n}'.`),c&&error(e.ForeignPublicEventProduced,`Foreign public event '${n}' cannot be produced locally; translate it into a private local event.`),l&&!c&&(t.type!==`Translate`||t.direction!==`Outbound`)&&error(e.PublicEventRequiresOutboundTranslation,`Local public event '${n}' may only be produced by an explicitly outbound Translate slice.`),t.type===`Translate`&&(t.direction??`Inbound`)===`Inbound`&&(l||c)&&error(e.InboundTranslationOutput,`Inbound translation must produce private local events, not '${n}'.`)):(c&&(t.type!==`Translate`||t.direction!==`Inbound`)&&error(e.ForeignPublicEventConsumer,`Foreign public event '${n}' may only be consumed by an explicitly inbound Translate slice.`),t.type===`Translate`&&t.direction===`Outbound`&&(l||c)&&error(e.OutboundTranslationInput,`Outbound translation must consume private local events, not '${n}'.`),t.type===`Translate`&&t.direction===`Inbound`&&(!l||!c)&&error(e.InboundTranslationInput,`Explicitly inbound translation must consume foreign public events, not '${n}'.`))}function resolve(t,n,r,i,a,o,s){let c=n.resolveFromScope(i,r);if(c.declaration?.node.kind===`EventSyntax`)return c.declaration.node;if(c.kind===`operation`)return;if(c.kind===`ambiguous`){s.warning(e.AmbiguousReference,`Ambiguous event reference '${i}'; qualify it with its owning module, feature and slice.`,a.location);return}let l=t.imports.filter(e=>e.qualifiedName.split(`.`).at(-1)===i||e.qualifiedName===i);if(l.length===1){let t=l[0],o=n.resolveFromScope(t.qualifiedName,r);if(o.declaration?.node.kind===`EventSyntax`)return o.declaration.node;if(o.kind===`ambiguous`){s.warning(e.AmbiguousReference,`Ambiguous imported event reference '${i}'; qualify its declaration.`,a.location);return}return t.visibility===`Public`?t:void 0}l.length>1?s.warning(e.AmbiguousReference,`Ambiguous imported event reference '${i}'; use its qualified name.`,a.location):(o&&a.kind!==`CaptureAppendSyntax`||a.kind===`CaptureSourceSettingSyntax`)&&!s.diagnostics.some(t=>t.code===e.UnknownEvent&&t.location.path===a.location.path&&t.location.line===a.location.line&&t.location.column===a.location.column)&&s.warning(e.UnknownEvent,`Unknown event '${i}' - declare its contract before classifying its usage.`,a.location)}function usesEventSource(e){return e.captures.some(e=>e.source!=null&&a(e.source))}function targetsEvent(e,t){return[...e.projections.map(e=>e.readModel),...(r(e).reducers??[]).map(e=>e.readModel)].some(e=>e!=null&&t.declarations.some(t=>t.kind===`event`&&t.name===e))}export{validatePublicEventUsage};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{eventDeclarations as t}from"../Syntax/EventDeclarations.js";import{AuthoringProductionResolver as n}from"../Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as r}from"../Syntax/DependencySources.js";import{consumedEvents as i,isEventsSource as a}from"../Syntax/CaptureEventsSource.js";import{PublicEventUsageCollector as o}from"./PublicEventUsageCollector.js";import{validatePublicEventMetadata as s}from"./PublicEventMetadataValidator.js";import{validateCaptureEventFixtures as c}from"./CaptureEventFixturesValidator.js";function validatePublicEventUsage(t,r){s(t,r);let i=new n(t);if(!i.declarations.some(e=>e.node.kind===`EventSyntax`&&(e.node.visibility===`Public`||e.node.origin!=null))&&!t.imports.some(e=>e.visibility===`Public`||e.origin!=null)&&!i.slices.some(({slice:e})=>e.direction!=null||usesEventSource(e)||targetsEvent(e,i)))return;let a=new n(t,i.declarations.filter(e=>e.kind===`event`));for(let{slice:e,scope:n}of i.slices)validateSlice(t,e,n,i,a,r);for(let n of t.seeds?.flatMap(e=>e.groups.flatMap(e=>e.events))??[]){let i=resolve(t,a,[],n.event,n,!0,r);if(i?.visibility!==`Public`)continue;let o=i.origin==null?e.PublicEventRequiresOutboundTranslation:e.ForeignPublicEventProduced;r.error(o,`Seed cannot append public event '${n.event}'; public production belongs to outbound translation, and foreign contracts cannot be produced locally.`,n.location)}}function validateSlice(n,r,i,a,s,l){let u=new o;u.visitSlice(r);let d=[],f=r.type===`Translate`&&r.direction===`Outbound`,p=new Set(r.readModels.map(e=>e.name));for(let{target:t,node:a}of u.projectionTargets){let o=p.has(t)?void 0:resolve(n,s,i,t,a,!1,l);o!==void 0&&(f?(d.push({node:o,output:!0}),validateUse(r,t,a,!0,!1,o,l)):l.error(e.EventTargetOutsideOutboundTranslation,`'${t}' is an event: a projection or reducer may only target an event in an explicitly outbound Translate slice.`,a.location))}if((r.type!==`Translate`||r.direction!==`Inbound`)&&!f)for(let t of u.eventSources)l.error(e.EventsSourceOutsideInboundTranslation,`'source events' reads another application's public events and belongs to a Translate slice with 'direction inbound', not '${r.name}'.`,t.location);let m=/* @__PURE__ */ new Map;for(let e of u.uses){let t=resolve(n,e.node.kind===`ProducesSyntax`?a:s,i,e.name,e.node,e.output,l);t!==void 0&&(d.push({node:t,output:e.output}),validateUse(r,e.name,e.node,e.output,e.command,t,l),recordCaptureOrigin(e.node,t,m))}validateCaptureOrigins(r,m,l),c(r,i,s,l);for(let e of u.allEvents){let t=a.declarations.filter(e=>e.kind===`event`).map(e=>e.node);for(let i of[...t,...n.imports.filter(e=>e.visibility===`Public`)])d.push({node:i,output:!1}),validateUse(r,i.kind===`ImportSyntax`?i.qualifiedName:i.name,e,!1,!1,i,l)}if(r.type!==`Translate`||(r.direction==null&&(t(r).some(e=>e.visibility===`Public`)||d.some(e=>e.node.visibility===`Public`))&&l.error(e.PublicTranslationRequiresDirection,`A Translate slice using public events requires an explicit 'direction inbound' or 'direction outbound'. Legacy translations without public metadata remain inbound.`,r.location),r.direction!==`Outbound`))return;let h=new Set(d.filter(e=>e.output&&e.node.visibility===`Public`&&e.node.origin==null).map(e=>e.node)).size;h!==1&&l.error(e.OutboundPublicEventCount,`Outbound Translate slice '${r.name}' must produce exactly one local public event type; found ${h}.`,r.location);for(let t of r.captures)l.error(e.TranslationConstructDirection,`An outbound translation consumes private local events, not an external-data capture. Capture belongs to inbound translation.`,t.location)}function recordCaptureOrigin(e,t,n){if(e.kind!==`CaptureSourceSettingSyntax`)return;let r=publicOrigin(t);r!==void 0&&n.set(e,r)}function publicOrigin(e){if(e.visibility!==`Public`)return;let t=e.origin??``;return t.trim().length>0?t:void 0}function validateCaptureOrigins(t,n,r){for(let o of t.captures){let t=o.source;if(t==null||!a(t))continue;let s=[...new Set(i(t).flatMap(e=>{let t=n.get(e);return t==null?[]:[t]}))].sort();s.length<2||r.error(e.CaptureEventsFromSeveralOrigins,`The 'from' events of capture '${o.name}' originate from several event stores (${s.join(`, `)}); a capture reads one event store - split it into one capture per origin.`,t.location)}}function validateUse(t,n,r,i,a,o,s){let c=o.origin!=null,l=o.visibility===`Public`,error=(e,t)=>s.error(e,t,r.location);i?(a&&l&&error(e.CommandProducesPublicEvent,`Command cannot produce public event '${n}'; publish through an outbound Translate slice.`),t.type===`Translate`&&t.direction===`Outbound`&&!l&&error(e.OutboundTranslationOutput,`Outbound translation must produce its one local public event, not private event '${n}'.`),c&&error(e.ForeignPublicEventProduced,`Foreign public event '${n}' cannot be produced locally; translate it into a private local event.`),l&&!c&&(t.type!==`Translate`||t.direction!==`Outbound`)&&error(e.PublicEventRequiresOutboundTranslation,`Local public event '${n}' may only be produced by an explicitly outbound Translate slice.`),t.type===`Translate`&&(t.direction??`Inbound`)===`Inbound`&&(l||c)&&error(e.InboundTranslationOutput,`Inbound translation must produce private local events, not '${n}'.`)):(c&&(t.type!==`Translate`||t.direction!==`Inbound`)&&error(e.ForeignPublicEventConsumer,`Foreign public event '${n}' may only be consumed by an explicitly inbound Translate slice.`),t.type===`Translate`&&t.direction===`Outbound`&&(l||c)&&error(e.OutboundTranslationInput,`Outbound translation must consume private local events, not '${n}'.`),t.type===`Translate`&&t.direction===`Inbound`&&(!l||!c)&&error(e.InboundTranslationInput,`Explicitly inbound translation must consume foreign public events, not '${n}'.`))}function resolve(t,n,r,i,a,o,s){let c=n.resolveFromScope(i,r);if(c.declaration?.node.kind===`EventSyntax`)return c.declaration.node;if(c.kind===`operation`)return;if(c.kind===`ambiguous`){s.warning(e.AmbiguousReference,`Ambiguous event reference '${i}'; qualify it with its owning module, feature and slice.`,a.location);return}let l=t.imports.filter(e=>e.qualifiedName.split(`.`).at(-1)===i||e.qualifiedName===i);if(l.length===1){let t=l[0],o=n.resolveFromScope(t.qualifiedName,r);if(o.declaration?.node.kind===`EventSyntax`)return o.declaration.node;if(o.kind===`ambiguous`){s.warning(e.AmbiguousReference,`Ambiguous imported event reference '${i}'; qualify its declaration.`,a.location);return}return t.visibility===`Public`?t:void 0}l.length>1?s.warning(e.AmbiguousReference,`Ambiguous imported event reference '${i}'; use its qualified name.`,a.location):(o&&a.kind!==`CaptureAppendSyntax`||a.kind===`CaptureSourceSettingSyntax`)&&!s.diagnostics.some(t=>t.code===e.UnknownEvent&&t.location.path===a.location.path&&t.location.line===a.location.line&&t.location.column===a.location.column)&&s.warning(e.UnknownEvent,`Unknown event '${i}' - declare its contract before classifying its usage.`,a.location)}function usesEventSource(e){return e.captures.some(e=>e.source!=null&&a(e.source))}function targetsEvent(e,t){return[...e.projections.map(e=>e.readModel),...(r(e).reducers??[]).map(e=>e.readModel)].some(e=>e!=null&&t.declarations.some(t=>t.kind===`event`&&t.name===e))}export{validatePublicEventUsage};
2
2
  //# sourceMappingURL=PublicEventUsageValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PublicEventUsageValidator.js","names":["validatePublicEventMetadata","application","context","resolver","AuthoringProductionResolver","declaration","imported","slice","events","scope","seed","group","contract","code","DiagnosticCodes","collector","PublicEventUsageCollector","contracts","explicitOutbound","readModels","readModel","target","node","source","captureOrigins","use","all","declarations","eventDeclarations","event","outputs","capture","origin","isEventsSource","origins","consumedEvents","setting","foreign","publicEvent","message","output","command","name","resolution","imports","local","diagnostic","projection","dependencySourcesOf","reducer"],"sources":["../../../../../../Compiler/Parsing/PublicEventUsageValidator.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 { AuthoringProductionKind, AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { EventSyntax, ImportSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { consumedEvents, isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ParserContext } from './ParserContext';\nimport { PublicEventUsageCollector } from './PublicEventUsageCollector';\nimport { validatePublicEventMetadata } from './PublicEventMetadataValidator';\n\n/** Validates public contract boundaries against the complete assembled declaration inventory. */\nexport function validatePublicEventUsage(application: ApplicationSyntax, context: ParserContext): void {\n validatePublicEventMetadata(application, context);\n const resolver = new AuthoringProductionResolver(application);\n if (!resolver.declarations.some(declaration => declaration.node.kind === 'EventSyntax' && ((declaration.node as EventSyntax).visibility === EventVisibility.Public || (declaration.node as EventSyntax).origin != null)) &&\n !application.imports.some(imported => imported.visibility === EventVisibility.Public || imported.origin != null) &&\n !resolver.slices.some(({ slice }) => slice.direction != null || usesEventSource(slice) || targetsEvent(slice, resolver))) return;\n const events = new AuthoringProductionResolver(application, resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event));\n for (const { slice, scope } of resolver.slices) validateSlice(application, slice, scope, resolver, events, context);\n for (const seed of application.seeds?.flatMap(seed => seed.groups.flatMap(group => group.events)) ?? []) {\n const contract = resolve(application, events, [], seed.event, seed, true, context);\n if (contract?.visibility !== EventVisibility.Public) continue;\n const code = contract.origin == null ? DiagnosticCodes.PublicEventRequiresOutboundTranslation : DiagnosticCodes.ForeignPublicEventProduced;\n context.error(code, `Seed cannot append public event '${seed.event}'; public production belongs to outbound translation, and foreign contracts cannot be produced locally.`, seed.location);\n }\n}\n\nfunction validateSlice(application: ApplicationSyntax, slice: SliceSyntax, scope: readonly string[], resolver: AuthoringProductionResolver, events: AuthoringProductionResolver, context: ParserContext): void {\n const collector = new PublicEventUsageCollector();\n collector.visitSlice(slice);\n const contracts: { node: EventSyntax | ImportSyntax; output: boolean }[] = [];\n const explicitOutbound = slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound;\n const readModels = new Set(slice.readModels.map(readModel => readModel.name));\n for (const { target, node } of collector.projectionTargets) {\n // '=> Name' names a read model unless it resolves to an event: then the projection or reducer publishes that event.\n const contract = readModels.has(target) ? undefined : resolve(application, events, scope, target, node, false, context);\n if (contract === undefined) continue;\n if (!explicitOutbound) {\n context.error(DiagnosticCodes.EventTargetOutsideOutboundTranslation, `'${target}' is an event: a projection or reducer may only target an event in an explicitly outbound Translate slice.`, node.location);\n continue;\n }\n contracts.push({ node: contract, output: true });\n validateUse(slice, target, node, true, false, contract, context);\n }\n // An outbound slice with a capture is already refused as a whole by the translation-direction check below.\n if (!(slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound) && !explicitOutbound) {\n for (const source of collector.eventSources) context.error(DiagnosticCodes.EventsSourceOutsideInboundTranslation, `'source events' reads another application's public events and belongs to a Translate slice with 'direction inbound', not '${slice.name}'.`, source.location);\n }\n const captureOrigins = new Map<SyntaxNode, string>();\n for (const use of collector.uses) {\n const contract = resolve(application, use.node.kind === 'ProducesSyntax' ? resolver : events, scope, use.name, use.node, use.output, context);\n if (contract === undefined) continue;\n contracts.push({ node: contract, output: use.output });\n validateUse(slice, use.name, use.node, use.output, use.command, contract, context);\n recordCaptureOrigin(use.node, contract, captureOrigins);\n }\n validateCaptureOrigins(slice, captureOrigins, context);\n // 'all' subscribes to every event type; 'every' maps only the projection's existing inputs.\n for (const all of collector.allEvents) {\n const declarations = resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event).map(declaration => declaration.node as EventSyntax);\n for (const contract of [...declarations, ...application.imports.filter(imported => imported.visibility === EventVisibility.Public)]) {\n contracts.push({ node: contract, output: false });\n validateUse(slice, contract.kind === 'ImportSyntax' ? contract.qualifiedName : contract.name, all, false, false, contract, context);\n }\n }\n if (slice.type !== 'Translate') return;\n if (slice.direction == null && (eventDeclarations(slice).some(event => event.visibility === EventVisibility.Public) || contracts.some(contract => contract.node.visibility === EventVisibility.Public))) {\n context.error(DiagnosticCodes.PublicTranslationRequiresDirection, \"A Translate slice using public events requires an explicit 'direction inbound' or 'direction outbound'. Legacy translations without public metadata remain inbound.\", slice.location);\n }\n if (slice.direction !== TranslationDirection.Outbound) return;\n const outputs = new Set(contracts.filter(contract => contract.output && contract.node.visibility === EventVisibility.Public && contract.node.origin == null).map(contract => contract.node)).size;\n if (outputs !== 1) context.error(DiagnosticCodes.OutboundPublicEventCount, `Outbound Translate slice '${slice.name}' must produce exactly one local public event type; found ${outputs}.`, slice.location);\n for (const capture of slice.captures) context.error(DiagnosticCodes.TranslationConstructDirection, 'An outbound translation consumes private local events, not an external-data capture. Capture belongs to inbound translation.', capture.location);\n}\n\nfunction recordCaptureOrigin(node: SyntaxNode, contract: EventSyntax | ImportSyntax, captureOrigins: Map<SyntaxNode, string>): void {\n if (node.kind !== 'CaptureSourceSettingSyntax') return;\n const origin = publicOrigin(contract);\n if (origin !== undefined) captureOrigins.set(node, origin);\n}\n\nfunction publicOrigin(contract: EventSyntax | ImportSyntax): string | undefined {\n if (contract.visibility !== EventVisibility.Public) return undefined;\n const origin = contract.origin ?? '';\n return origin.trim().length > 0 ? origin : undefined;\n}\n\nfunction validateCaptureOrigins(slice: SliceSyntax, captureOrigins: Map<SyntaxNode, string>, context: ParserContext): void {\n for (const capture of slice.captures) {\n const source = capture.source;\n if (source == null || !isEventsSource(source)) continue;\n const origins = [...new Set(consumedEvents(source).flatMap(setting => {\n const origin = captureOrigins.get(setting);\n return origin == null ? [] : [origin];\n }))].sort();\n if (origins.length < 2) continue;\n context.error(DiagnosticCodes.CaptureEventsFromSeveralOrigins, `The 'from' events of capture '${capture.name}' originate from several event stores (${origins.join(', ')}); a capture reads one event store - split it into one capture per origin.`, source.location);\n }\n}\n\nfunction validateUse(slice: SliceSyntax, name: string, node: SyntaxNode, output: boolean, command: boolean, contract: EventSyntax | ImportSyntax, context: ParserContext): void {\n const foreign = contract.origin != null;\n const publicEvent = contract.visibility === EventVisibility.Public;\n const error = (code: string, message: string) => context.error(code, message, node.location);\n if (output) {\n if (command && publicEvent) error(DiagnosticCodes.CommandProducesPublicEvent, `Command cannot produce public event '${name}'; publish through an outbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && !publicEvent) error(DiagnosticCodes.OutboundTranslationOutput, `Outbound translation must produce its one local public event, not private event '${name}'.`);\n if (foreign) error(DiagnosticCodes.ForeignPublicEventProduced, `Foreign public event '${name}' cannot be produced locally; translate it into a private local event.`);\n if (publicEvent && !foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Outbound)) error(DiagnosticCodes.PublicEventRequiresOutboundTranslation, `Local public event '${name}' may only be produced by an explicitly outbound Translate slice.`);\n if (slice.type === 'Translate' && (slice.direction ?? TranslationDirection.Inbound) === TranslationDirection.Inbound && (publicEvent || foreign)) error(DiagnosticCodes.InboundTranslationOutput, `Inbound translation must produce private local events, not '${name}'.`);\n } else {\n if (foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Inbound)) error(DiagnosticCodes.ForeignPublicEventConsumer, `Foreign public event '${name}' may only be consumed by an explicitly inbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && (publicEvent || foreign)) error(DiagnosticCodes.OutboundTranslationInput, `Outbound translation must consume private local events, not '${name}'.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound && (!publicEvent || !foreign)) error(DiagnosticCodes.InboundTranslationInput, `Explicitly inbound translation must consume foreign public events, not '${name}'.`);\n }\n}\n\nfunction resolve(application: ApplicationSyntax, resolver: AuthoringProductionResolver, scope: readonly string[], name: string, use: SyntaxNode, output: boolean, context: ParserContext): EventSyntax | ImportSyntax | undefined {\n const resolution = resolver.resolveFromScope(name, scope);\n if (resolution.declaration?.node.kind === 'EventSyntax') return resolution.declaration.node as EventSyntax;\n if (resolution.kind === AuthoringProductionKind.Operation) return undefined;\n if (resolution.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous event reference '${name}'; qualify it with its owning module, feature and slice.`, use.location);\n return undefined;\n }\n const imports = application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name || imported.qualifiedName === name);\n if (imports.length === 1) {\n const imported = imports[0];\n const local = resolver.resolveFromScope(imported.qualifiedName, scope);\n if (local.declaration?.node.kind === 'EventSyntax') return local.declaration.node as EventSyntax;\n if (local.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; qualify its declaration.`, use.location);\n return undefined;\n }\n return imported.visibility === EventVisibility.Public ? imported : undefined;\n }\n if (imports.length > 1) context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; use its qualified name.`, use.location);\n else if (((output && use.kind !== 'CaptureAppendSyntax') || use.kind === 'CaptureSourceSettingSyntax') && !context.diagnostics.some(diagnostic => diagnostic.code === DiagnosticCodes.UnknownEvent && diagnostic.location.path === use.location.path && diagnostic.location.line === use.location.line && diagnostic.location.column === use.location.column)) {\n context.warning(DiagnosticCodes.UnknownEvent, `Unknown event '${name}' - declare its contract before classifying its usage.`, use.location);\n }\n return undefined;\n}\n\nfunction usesEventSource(slice: SliceSyntax): boolean {\n return slice.captures.some(capture => capture.source != null && isEventsSource(capture.source));\n}\n\nfunction targetsEvent(slice: SliceSyntax, resolver: AuthoringProductionResolver): boolean {\n const targets = [...slice.projections.map(projection => projection.readModel), ...(dependencySourcesOf(slice).reducers ?? []).map(reducer => reducer.readModel)];\n return targets.some(target => target != null && resolver.declarations.some(declaration => declaration.kind === AuthoringProductionKind.Event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AgB,mBAAoB,uCAAuC4B,EAAK,4BAA6BjB,EAAI,QAAQ,GACtJe,GAAUf,EAAI,OAAS,uBAA0BA,EAAI,OAAS,+BAAiC,CAACvB,EAAQ,YAAY,KAAK,GAAc4C,EAAW,OAAShC,EAAgB,cAAgBgC,EAAW,SAAS,OAASrB,EAAI,SAAS,MAAQqB,EAAW,SAAS,OAASrB,EAAI,SAAS,MAAQqB,EAAW,SAAS,SAAWrB,EAAI,SAAS,MAAM,GACxVvB,EAAQ,QAAQY,EAAgB,aAAc,kBAAkB4B,EAAK,wDAAyDjB,EAAI,QAAQ,CAGlJ,CAEA,SAAS,gBAAgB,EAA6B,CAClD,OAAOlB,EAAM,SAAS,KAAK,GAAWwB,EAAQ,QAAU,MAAQE,EAAeF,EAAQ,MAAM,CAAC,CAClG,CAEA,SAAS,aAAa,EAAoB,EAAgD,CAEtF,MAAO,CADU,GAAGxB,EAAM,YAAY,IAAI,GAAcwC,EAAW,SAAS,EAAG,IAAIC,EAAoBzC,CAAK,CAAC,CAAC,UAAY,CAAC,EAAA,CAAG,IAAI,GAAW0C,EAAQ,SAAS,CACjJ,CAAC,CAAC,KAAK,GAAU5B,GAAU,MAAQlB,EAAS,aAAa,KAAK,GAAeE,EAAY,OAAA,SAA0CA,EAAY,OAASgB,CAAM,CAAC,CAChL"}
1
+ {"version":3,"file":"PublicEventUsageValidator.js","names":["validatePublicEventMetadata","application","context","resolver","AuthoringProductionResolver","declaration","imported","slice","events","scope","seed","group","contract","code","DiagnosticCodes","collector","PublicEventUsageCollector","contracts","explicitOutbound","readModels","readModel","target","node","source","captureOrigins","use","validateCaptureEventFixtures","all","declarations","eventDeclarations","event","outputs","capture","origin","isEventsSource","origins","consumedEvents","setting","foreign","publicEvent","message","output","command","name","resolution","imports","local","diagnostic","projection","dependencySourcesOf","reducer"],"sources":["../../../../../../Compiler/Parsing/PublicEventUsageValidator.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 { AuthoringProductionKind, AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { EventSyntax, ImportSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { consumedEvents, isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ParserContext } from './ParserContext';\nimport { PublicEventUsageCollector } from './PublicEventUsageCollector';\nimport { validatePublicEventMetadata } from './PublicEventMetadataValidator';\nimport { validateCaptureEventFixtures } from './CaptureEventFixturesValidator';\n\n/** Validates public contract boundaries against the complete assembled declaration inventory. */\nexport function validatePublicEventUsage(application: ApplicationSyntax, context: ParserContext): void {\n validatePublicEventMetadata(application, context);\n const resolver = new AuthoringProductionResolver(application);\n if (!resolver.declarations.some(declaration => declaration.node.kind === 'EventSyntax' && ((declaration.node as EventSyntax).visibility === EventVisibility.Public || (declaration.node as EventSyntax).origin != null)) &&\n !application.imports.some(imported => imported.visibility === EventVisibility.Public || imported.origin != null) &&\n !resolver.slices.some(({ slice }) => slice.direction != null || usesEventSource(slice) || targetsEvent(slice, resolver))) return;\n const events = new AuthoringProductionResolver(application, resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event));\n for (const { slice, scope } of resolver.slices) validateSlice(application, slice, scope, resolver, events, context);\n for (const seed of application.seeds?.flatMap(seed => seed.groups.flatMap(group => group.events)) ?? []) {\n const contract = resolve(application, events, [], seed.event, seed, true, context);\n if (contract?.visibility !== EventVisibility.Public) continue;\n const code = contract.origin == null ? DiagnosticCodes.PublicEventRequiresOutboundTranslation : DiagnosticCodes.ForeignPublicEventProduced;\n context.error(code, `Seed cannot append public event '${seed.event}'; public production belongs to outbound translation, and foreign contracts cannot be produced locally.`, seed.location);\n }\n}\n\nfunction validateSlice(application: ApplicationSyntax, slice: SliceSyntax, scope: readonly string[], resolver: AuthoringProductionResolver, events: AuthoringProductionResolver, context: ParserContext): void {\n const collector = new PublicEventUsageCollector();\n collector.visitSlice(slice);\n const contracts: { node: EventSyntax | ImportSyntax; output: boolean }[] = [];\n const explicitOutbound = slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound;\n const readModels = new Set(slice.readModels.map(readModel => readModel.name));\n for (const { target, node } of collector.projectionTargets) {\n // '=> Name' names a read model unless it resolves to an event: then the projection or reducer publishes that event.\n const contract = readModels.has(target) ? undefined : resolve(application, events, scope, target, node, false, context);\n if (contract === undefined) continue;\n if (!explicitOutbound) {\n context.error(DiagnosticCodes.EventTargetOutsideOutboundTranslation, `'${target}' is an event: a projection or reducer may only target an event in an explicitly outbound Translate slice.`, node.location);\n continue;\n }\n contracts.push({ node: contract, output: true });\n validateUse(slice, target, node, true, false, contract, context);\n }\n // An outbound slice with a capture is already refused as a whole by the translation-direction check below.\n if (!(slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound) && !explicitOutbound) {\n for (const source of collector.eventSources) context.error(DiagnosticCodes.EventsSourceOutsideInboundTranslation, `'source events' reads another application's public events and belongs to a Translate slice with 'direction inbound', not '${slice.name}'.`, source.location);\n }\n const captureOrigins = new Map<SyntaxNode, string>();\n for (const use of collector.uses) {\n const contract = resolve(application, use.node.kind === 'ProducesSyntax' ? resolver : events, scope, use.name, use.node, use.output, context);\n if (contract === undefined) continue;\n contracts.push({ node: contract, output: use.output });\n validateUse(slice, use.name, use.node, use.output, use.command, contract, context);\n recordCaptureOrigin(use.node, contract, captureOrigins);\n }\n validateCaptureOrigins(slice, captureOrigins, context);\n validateCaptureEventFixtures(slice, scope, events, context);\n // 'all' subscribes to every event type; 'every' maps only the projection's existing inputs.\n for (const all of collector.allEvents) {\n const declarations = resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event).map(declaration => declaration.node as EventSyntax);\n for (const contract of [...declarations, ...application.imports.filter(imported => imported.visibility === EventVisibility.Public)]) {\n contracts.push({ node: contract, output: false });\n validateUse(slice, contract.kind === 'ImportSyntax' ? contract.qualifiedName : contract.name, all, false, false, contract, context);\n }\n }\n if (slice.type !== 'Translate') return;\n if (slice.direction == null && (eventDeclarations(slice).some(event => event.visibility === EventVisibility.Public) || contracts.some(contract => contract.node.visibility === EventVisibility.Public))) {\n context.error(DiagnosticCodes.PublicTranslationRequiresDirection, \"A Translate slice using public events requires an explicit 'direction inbound' or 'direction outbound'. Legacy translations without public metadata remain inbound.\", slice.location);\n }\n if (slice.direction !== TranslationDirection.Outbound) return;\n const outputs = new Set(contracts.filter(contract => contract.output && contract.node.visibility === EventVisibility.Public && contract.node.origin == null).map(contract => contract.node)).size;\n if (outputs !== 1) context.error(DiagnosticCodes.OutboundPublicEventCount, `Outbound Translate slice '${slice.name}' must produce exactly one local public event type; found ${outputs}.`, slice.location);\n for (const capture of slice.captures) context.error(DiagnosticCodes.TranslationConstructDirection, 'An outbound translation consumes private local events, not an external-data capture. Capture belongs to inbound translation.', capture.location);\n}\n\nfunction recordCaptureOrigin(node: SyntaxNode, contract: EventSyntax | ImportSyntax, captureOrigins: Map<SyntaxNode, string>): void {\n if (node.kind !== 'CaptureSourceSettingSyntax') return;\n const origin = publicOrigin(contract);\n if (origin !== undefined) captureOrigins.set(node, origin);\n}\n\nfunction publicOrigin(contract: EventSyntax | ImportSyntax): string | undefined {\n if (contract.visibility !== EventVisibility.Public) return undefined;\n const origin = contract.origin ?? '';\n return origin.trim().length > 0 ? origin : undefined;\n}\n\nfunction validateCaptureOrigins(slice: SliceSyntax, captureOrigins: Map<SyntaxNode, string>, context: ParserContext): void {\n for (const capture of slice.captures) {\n const source = capture.source;\n if (source == null || !isEventsSource(source)) continue;\n const origins = [...new Set(consumedEvents(source).flatMap(setting => {\n const origin = captureOrigins.get(setting);\n return origin == null ? [] : [origin];\n }))].sort();\n if (origins.length < 2) continue;\n context.error(DiagnosticCodes.CaptureEventsFromSeveralOrigins, `The 'from' events of capture '${capture.name}' originate from several event stores (${origins.join(', ')}); a capture reads one event store - split it into one capture per origin.`, source.location);\n }\n}\n\nfunction validateUse(slice: SliceSyntax, name: string, node: SyntaxNode, output: boolean, command: boolean, contract: EventSyntax | ImportSyntax, context: ParserContext): void {\n const foreign = contract.origin != null;\n const publicEvent = contract.visibility === EventVisibility.Public;\n const error = (code: string, message: string) => context.error(code, message, node.location);\n if (output) {\n if (command && publicEvent) error(DiagnosticCodes.CommandProducesPublicEvent, `Command cannot produce public event '${name}'; publish through an outbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && !publicEvent) error(DiagnosticCodes.OutboundTranslationOutput, `Outbound translation must produce its one local public event, not private event '${name}'.`);\n if (foreign) error(DiagnosticCodes.ForeignPublicEventProduced, `Foreign public event '${name}' cannot be produced locally; translate it into a private local event.`);\n if (publicEvent && !foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Outbound)) error(DiagnosticCodes.PublicEventRequiresOutboundTranslation, `Local public event '${name}' may only be produced by an explicitly outbound Translate slice.`);\n if (slice.type === 'Translate' && (slice.direction ?? TranslationDirection.Inbound) === TranslationDirection.Inbound && (publicEvent || foreign)) error(DiagnosticCodes.InboundTranslationOutput, `Inbound translation must produce private local events, not '${name}'.`);\n } else {\n if (foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Inbound)) error(DiagnosticCodes.ForeignPublicEventConsumer, `Foreign public event '${name}' may only be consumed by an explicitly inbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && (publicEvent || foreign)) error(DiagnosticCodes.OutboundTranslationInput, `Outbound translation must consume private local events, not '${name}'.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound && (!publicEvent || !foreign)) error(DiagnosticCodes.InboundTranslationInput, `Explicitly inbound translation must consume foreign public events, not '${name}'.`);\n }\n}\n\nfunction resolve(application: ApplicationSyntax, resolver: AuthoringProductionResolver, scope: readonly string[], name: string, use: SyntaxNode, output: boolean, context: ParserContext): EventSyntax | ImportSyntax | undefined {\n const resolution = resolver.resolveFromScope(name, scope);\n if (resolution.declaration?.node.kind === 'EventSyntax') return resolution.declaration.node as EventSyntax;\n if (resolution.kind === AuthoringProductionKind.Operation) return undefined;\n if (resolution.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous event reference '${name}'; qualify it with its owning module, feature and slice.`, use.location);\n return undefined;\n }\n const imports = application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name || imported.qualifiedName === name);\n if (imports.length === 1) {\n const imported = imports[0];\n const local = resolver.resolveFromScope(imported.qualifiedName, scope);\n if (local.declaration?.node.kind === 'EventSyntax') return local.declaration.node as EventSyntax;\n if (local.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; qualify its declaration.`, use.location);\n return undefined;\n }\n return imported.visibility === EventVisibility.Public ? imported : undefined;\n }\n if (imports.length > 1) context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; use its qualified name.`, use.location);\n else if (((output && use.kind !== 'CaptureAppendSyntax') || use.kind === 'CaptureSourceSettingSyntax') && !context.diagnostics.some(diagnostic => diagnostic.code === DiagnosticCodes.UnknownEvent && diagnostic.location.path === use.location.path && diagnostic.location.line === use.location.line && diagnostic.location.column === use.location.column)) {\n context.warning(DiagnosticCodes.UnknownEvent, `Unknown event '${name}' - declare its contract before classifying its usage.`, use.location);\n }\n return undefined;\n}\n\nfunction usesEventSource(slice: SliceSyntax): boolean {\n return slice.captures.some(capture => capture.source != null && isEventsSource(capture.source));\n}\n\nfunction targetsEvent(slice: SliceSyntax, resolver: AuthoringProductionResolver): boolean {\n const targets = [...slice.projections.map(projection => projection.readModel), ...(dependencySourcesOf(slice).reducers ?? []).map(reducer => reducer.readModel)];\n return targets.some(target => target != null && resolver.declarations.some(declaration => declaration.kind === AuthoringProductionKind.Event && declaration.name === target));\n}\n"],"mappings":"2pBAmBA,SAAgB,yBAAyB,EAAgC,EAA8B,CACnGA,EAA4BC,EAAaC,CAAO,EAChD,IAAMC,EAAW,IAAIC,EAA4BH,CAAW,EAC5D,GAAI,CAACE,EAAS,aAAa,KAAK,GAAeE,EAAY,KAAK,OAAS,gBAAmBA,EAAY,KAAqB,aAAA,UAA0CA,EAAY,KAAqB,QAAU,KAAK,GACnN,CAACJ,EAAY,QAAQ,KAAK,GAAYK,EAAS,aAAA,UAAyCA,EAAS,QAAU,IAAI,GAC/G,CAACH,EAAS,OAAO,MAAM,CAAE,WAAYI,EAAM,WAAa,MAAQ,gBAAgBA,CAAK,GAAK,aAAaA,EAAOJ,CAAQ,CAAC,EAAG,OAC9H,IAAMK,EAAS,IAAIJ,EAA4BH,EAAaE,EAAS,aAAa,OAAO,GAAeE,EAAY,OAAA,OAAsC,CAAC,EAC3J,IAAK,GAAM,CAAE,QAAO,WAAWF,EAAS,OAAQ,cAAcF,EAAaM,EAAOE,EAAON,EAAUK,EAAQN,CAAO,EAClH,IAAK,IAAMQ,KAAQT,EAAY,OAAO,QAAQ,GAAQS,EAAK,OAAO,QAAQ,GAASC,EAAM,MAAM,CAAC,GAAK,CAAC,EAAG,CACrG,IAAMC,EAAW,QAAQX,EAAaO,EAAQ,CAAC,EAAGE,EAAK,MAAOA,EAAM,GAAMR,CAAO,EACjF,GAAIU,GAAU,aAAA,SAAuC,SACrD,IAAMC,EAAOD,EAAS,QAAU,KAAOE,EAAgB,uCAAyCA,EAAgB,2BAChHZ,EAAQ,MAAMW,EAAM,oCAAoCH,EAAK,MAAM,yGAA0GA,EAAK,QAAQ,CAC9L,CACJ,CAEA,SAAS,cAAc,EAAgC,EAAoB,EAA0B,EAAuC,EAAqC,EAA8B,CAC3M,IAAMK,EAAY,IAAIC,EACtBD,EAAU,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8BlB,EAAI,QAAQ,EAC1I,MACJ,CACA,OAAOnB,EAAS,aAAA,SAAwCA,EAAW,IAAA,EACvE,CACIuC,EAAQ,OAAS,EAAG3C,EAAQ,QAAQY,EAAgB,mBAAoB,uCAAuC6B,EAAK,4BAA6BlB,EAAI,QAAQ,GACtJgB,GAAUhB,EAAI,OAAS,uBAA0BA,EAAI,OAAS,+BAAiC,CAACvB,EAAQ,YAAY,KAAK,GAAc6C,EAAW,OAASjC,EAAgB,cAAgBiC,EAAW,SAAS,OAAStB,EAAI,SAAS,MAAQsB,EAAW,SAAS,OAAStB,EAAI,SAAS,MAAQsB,EAAW,SAAS,SAAWtB,EAAI,SAAS,MAAM,GACxVvB,EAAQ,QAAQY,EAAgB,aAAc,kBAAkB6B,EAAK,wDAAyDlB,EAAI,QAAQ,CAGlJ,CAEA,SAAS,gBAAgB,EAA6B,CAClD,OAAOlB,EAAM,SAAS,KAAK,GAAWyB,EAAQ,QAAU,MAAQE,EAAeF,EAAQ,MAAM,CAAC,CAClG,CAEA,SAAS,aAAa,EAAoB,EAAgD,CAEtF,MAAO,CADU,GAAGzB,EAAM,YAAY,IAAI,GAAcyC,EAAW,SAAS,EAAG,IAAIC,EAAoB1C,CAAK,CAAC,CAAC,UAAY,CAAC,EAAA,CAAG,IAAI,GAAW2C,EAAQ,SAAS,CACjJ,CAAC,CAAC,KAAK,GAAU7B,GAAU,MAAQlB,EAAS,aAAa,KAAK,GAAeE,EAAY,OAAA,SAA0CA,EAAY,OAASgB,CAAM,CAAC,CAChL"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";var ScreenplaySyntaxWalker=class{visitNode(e){}visitApplication(e){this.visitNode(e),e.domain!==null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))});break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";var ScreenplaySyntaxWalker=class{visitNode(e){}visitApplication(e){this.visitNode(e),e.domain!==null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e),e.file&&this.visitFileReference(e.file),e.code&&this.visitCodeBlock(e.code)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))});break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
2
2
  //# sourceMappingURL=ScreenplaySyntaxWalker.js.map