@cratis/screenplay-language 4.181.1 → 4.183.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.
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js +2 -0
- package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +2 -0
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js +2 -0
- package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PortableMatchPattern.js +2 -0
- package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js +2 -0
- package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -0
- package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
- package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
- package/dist/bundles/completion-items.js +1 -1
- package/dist/bundles/completion-items.js.map +1 -1
- package/dist/bundles/diagnostic-codes.js +1 -1
- package/dist/bundles/diagnostic-codes.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/validation.js +1 -1
- package/dist/bundles/validation.js.map +1 -1
- package/dist/diagnostic-codes.d.ts +7 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- 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","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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C,EAC/H,MACJ,CACA,MAAO,CAAE,KAAM,WAAY,MAAO,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"}
|
|
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","handlers","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","validateHandlerOccurrences","isPendingHandler","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","validateMatchOperand","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 { isPendingHandler, validateHandlerOccurrences } from './CommandHandlerValidator';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\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 { validateMatchOperand } from './MatchOperandValidation';\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 const handlers: { handler: HandlerSyntax | null; location: SourceLocation }[] = [];\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 handlers.push({ handler, location: locationOf(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 validateHandlerOccurrences(handlers, context);\n if (handler !== null && !isPendingHandler(handler) && 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 if (parsed.kind === 'Matches' && parsed.value !== null) validateMatchOperand(context, parsed.value, locationOf(line), line.raw);\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":"usDAsCA,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,GAAG,IAAM,GAC3CC,IAAS,IACTF,EAAQ,MAAMG,EAAgB,0BAA2B,gCAAgCF,EAAK,QAAQ,+BAAgCG,EAA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EACzD,GAAIgB,IAAc,QAAUA,IAAc,SAAWA,IAAc,QAAS,CACxE9F,EAAQ,MAAMG,EAAgB,0BAA2B,qDAAsDC,EAAWH,CAAI,CAAC,EAC/H,MACJ,CACA,MAAO,CAAE,KAAM,WAAY,MAAO,CAAE,KAAM,0BAA2B,MAAO6F,EAAW,SAAU1F,EAAWH,CAAI,CAAE,CAAE,CACxH,CACA,IAAM8F,EAAUzG,EAAe,KAAKwF,CAAI,EACxC,GAAIiB,IAAY,KACZ/F,EAAQ,MAAMG,EAAgB,sBAAuB,4BAA4BF,EAAK,QAAQ,GAAIG,EAAWH,CAAI,CAAC,MAGtH,IAAI8F,EAAQ,KAAO,OAAQ,CACvB,IAAM7F,EAAO6F,EAAQ,EAAE,CAAC,KAAK,EAC7B,GAAI,CAACxG,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,EAAasG,EAAQ,IAAK,MAAOC,EAAmBD,EAAQ,GAAI3F,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{emailMatchPattern as t,validateMatchPattern as n}from"./PortableMatchPattern.js";function validateMatchOperand(r,i,a,o){if(i.kind===`PathExpressionSyntax`&&i.path!==`email`){r.error(e.UnknownMatchPattern,`Named match pattern '${i.path}' is not defined; use 'email' or a quoted portable regular expression.`,a);return}let s=i.kind===`LiteralExpressionSyntax`&&typeof i.value==`string`?i.value:i.kind===`PathExpressionSyntax`?t:void 0;if(s===void 0)return;let c=n(s);if(c===void 0)return;let l=`${c.construct} at offset ${c.offset}. ${c.suggestion??``}`.trimEnd();r.error(c.invalid?e.InvalidMatchPattern:e.PatternOutsidePortableMatchDialect,`Match pattern: ${l}`,patternLocation(o,a,c.offset))}function patternLocation(e,t,n){let r=e.indexOf(`"`,t.column-1);if(r<0)return t;let i=r+1;for(let t=0;t<n&&i<e.length;t++,i++)e[i]===`\\`&&`\\"nrt`.includes(e[i+1]??`\0`)&&i++;return{...t,column:i+1}}export{validateMatchOperand};
|
|
2
|
+
//# sourceMappingURL=MatchOperandValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchOperandValidation.js","names":["value","context","DiagnosticCodes","location","pattern","emailMatchPattern","issue","validateMatchPattern","description","raw","quote","offset","decoded","patternOffset"],"sources":["../../../../../../Compiler/Parsing/MatchOperandValidation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ParserContext } from './ParserContext';\nimport { emailMatchPattern, validateMatchPattern } from './PortableMatchPattern';\n\nexport function validateMatchOperand(context: ParserContext, value: ExpressionSyntax, location: SourceLocation, raw: string): void {\n if (value.kind === 'PathExpressionSyntax' && value.path !== 'email') {\n context.error(DiagnosticCodes.UnknownMatchPattern, `Named match pattern '${value.path}' is not defined; use 'email' or a quoted portable regular expression.`, location);\n return;\n }\n const pattern = value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' ? value.value : value.kind === 'PathExpressionSyntax' ? emailMatchPattern : undefined;\n if (pattern === undefined) return;\n const issue = validateMatchPattern(pattern);\n if (issue === undefined) return;\n const description = `${issue.construct} at offset ${issue.offset}. ${issue.suggestion ?? ''}`.trimEnd();\n context.error(issue.invalid ? DiagnosticCodes.InvalidMatchPattern : DiagnosticCodes.PatternOutsidePortableMatchDialect, `Match pattern: ${description}`, patternLocation(raw, location, issue.offset));\n}\n\nfunction patternLocation(raw: string, location: SourceLocation, patternOffset: number): SourceLocation {\n const quote = raw.indexOf('\"', location.column - 1);\n if (quote < 0) return location;\n let offset = quote + 1;\n for (let decoded = 0; decoded < patternOffset && offset < raw.length; decoded++, offset++) {\n if (raw[offset] === '\\\\' && '\\\\\"nrt'.includes(raw[offset + 1] ?? '\\0')) offset++;\n }\n return { ...location, column: offset + 1 };\n}\n"],"mappings":"iNASA,SAAgB,qBAAqB,EAAwB,EAAyB,EAA0B,EAAmB,CAC/H,GAAIA,EAAM,OAAS,wBAA0BA,EAAM,OAAS,QAAS,CACjEC,EAAQ,MAAMC,EAAgB,oBAAqB,wBAAwBF,EAAM,KAAK,wEAAyEG,CAAQ,EACvK,MACJ,CACA,IAAMC,EAAUJ,EAAM,OAAS,2BAA6B,OAAOA,EAAM,OAAU,SAAWA,EAAM,MAAQA,EAAM,OAAS,uBAAyBK,EAAoB,IAAA,GACxK,GAAID,IAAY,IAAA,GAAW,OAC3B,IAAME,EAAQC,EAAqBH,CAAO,EAC1C,GAAIE,IAAU,IAAA,GAAW,OACzB,IAAME,EAAc,GAAGF,EAAM,UAAU,aAAaA,EAAM,OAAO,IAAIA,EAAM,YAAc,KAAK,QAAQ,EACtGL,EAAQ,MAAMK,EAAM,QAAUJ,EAAgB,oBAAsBA,EAAgB,mCAAoC,kBAAkBM,IAAe,gBAAgBC,EAAKN,EAAUG,EAAM,MAAM,CAAC,CACzM,CAEA,SAAS,gBAAgB,EAAa,EAA0B,EAAuC,CACnG,IAAMI,EAAQD,EAAI,QAAQ,IAAKN,EAAS,OAAS,CAAC,EAClD,GAAIO,EAAQ,EAAG,OAAOP,EACtB,IAAIQ,EAASD,EAAQ,EACrB,IAAK,IAAIE,EAAU,EAAGA,EAAUC,GAAiBF,EAASF,EAAI,OAAQ,IAAW,IACzEA,EAAIE,KAAY,MAAQ,SAAS,SAASF,EAAIE,EAAS,IAAM,IAAI,GAAG,IAE5E,MAAO,CAAE,GAAGR,EAAU,OAAQQ,EAAS,CAAE,CAC7C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";function isJavaScriptGroupName(e){let t=e.replace(/\\u(?:\{([0-9a-fA-F]+)\}|([0-9a-fA-F]{4}))/g,(e,t,n)=>{let r=parseInt(t??n,16);return r<=1114111?String.fromCodePoint(r):`\\`});return/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u.test(t)}export{isJavaScriptGroupName};
|
|
2
|
+
//# sourceMappingURL=PortableMatchGroupName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableMatchGroupName.js","names":["decoded","name","value","braced","fixed"],"sources":["../../../../../../Compiler/Parsing/PortableMatchGroupName.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** RegExpIdentifierName uses Unicode identifiers, even in flagless JavaScript. */\nexport function isJavaScriptGroupName(name: string): boolean {\n const decoded = name.replace(/\\\\u(?:\\{([0-9a-fA-F]+)\\}|([0-9a-fA-F]{4}))/g, (_, braced: string | undefined, fixed: string | undefined) => {\n const value = parseInt(braced ?? fixed!, 16);\n return value <= 0x10ffff ? String.fromCodePoint(value) : '\\\\';\n });\n return /^[$_\\p{ID_Start}][$\\u200c\\u200d\\p{ID_Continue}]*$/u.test(decoded);\n}\n"],"mappings":"qDAIA,SAAgB,sBAAsB,EAAuB,CACzD,IAAMA,EAAUC,EAAK,QAAQ,+CAAgD,EAAG,EAA4B,IAA8B,CACtI,IAAMC,EAAQ,SAASC,GAAUC,EAAQ,EAAE,EAC3C,OAAOF,GAAS,QAAW,OAAO,cAAcA,CAAK,EAAI,IAC7D,CAAC,EACD,MAAO,qDAAqD,KAAKF,CAAO,CAC5E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{isJavaScriptGroupName as e}from"./PortableMatchGroupName.js";import{portableMatchSuggestions as t}from"./PortableMatchSuggestions.js";const n=`^[^\\s@]+@[^\\s@.]+(?:\\.[^\\s@.]+)+$`,r=3e3;function validateMatchPattern(e){return new PortableMatchParser(e).parse()}var PortableMatchParser=class{pattern;offset=0;issue;names=/* @__PURE__ */ new Map;branches=[];scope=0;constructor(e){this.pattern=e}parse(){this.pattern.length>1e3&&this.fail(`pattern length`,1e3);let e=this.expression();return this.issue===void 0&&this.offset!==this.pattern.length&&this.fail(`unmatched closing group`,this.offset,!0),e.size>r&&this.fail(`expanded pattern size`,e.budgetOffset??this.offset),this.issue}expression(){let e=0,t,n={scope:this.scope++,alternative:0};for(this.branches.push(n);this.issue===void 0&&this.offset<this.pattern.length&&!this.at(`)`);){if(this.at(`|`)){e=Math.min(3001,e+1),e>r&&(t??=this.offset),this.offset++,n.alternative++;continue}let i=this.offset,a=this.quantify(this.atom());e=Math.min(3001,e+a.size),e>r&&(t??=a.budgetOffset??i)}return this.branches.pop(),{size:e,quantifiable:!0,budgetOffset:t}}atom(){let e=this.offset,t=this.pattern[this.offset++];return t===`(`?this.group(e):(t===`[`?this.characterClass(e):t===`\\`?this.escape(e,!1):t===`]`?this.fail(`unescaped closing bracket`,e):t===`{`&&/^\{[0-9]+(?:,[0-9]*)?\}/.test(this.pattern.slice(e))?this.fail(`quantifier without an atom`,e,!0):t===`{`||t===`}`?this.fail(`unescaped brace`,e):`*+?`.includes(t)&&this.fail(`quantifier without an atom`,e,!0),{size:1,quantifiable:t!==`^`&&t!==`$`})}group(t){if(this.take(`?`)&&!this.take(`:`)){if(this.at(`=`)||this.at(`!`)||this.at(`<`)&&`=!`.includes(this.pattern[this.offset+1]??` `))this.fail(`lookaround`,t);else if(this.take(`<`)){let t=this.offset;for(;this.offset<this.pattern.length&&!this.at(`>`);)this.offset++;let n=this.pattern.slice(t,this.offset);this.take(`>`)?e(n)?/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)?this.registerName(n,t):this.fail(`group name`,t):this.fail(`group name`,t,!0):this.fail(`unterminated group name`,t,!0)}else this.fail(`ims-`.includes(this.pattern[this.offset]??` `)?`inline options`:`group extension`,t)}let n=this.expression();return this.take(`)`)||this.fail(`unterminated group`,t,!0),n}characterClass(e){let t=this.take(`^`);for(this.at(`]`)&&this.fail(t?`negated empty character class`:`empty character class`,e);this.issue===void 0&&this.offset<this.pattern.length&&!this.at(`]`);){this.at(`-`)&&this.offset+1<this.pattern.length&&this.pattern[this.offset+1]===`[`&&this.fail(`class subtraction`,this.offset);let e=this.classItem();if(this.at(`-`)&&this.offset+1<this.pattern.length&&this.pattern[this.offset+1]!==`]`){let t=this.offset++;this.at(`[`)&&this.fail(`class subtraction`,t);let n=this.classItem();e===void 0||n===void 0?this.fail(`class escape range endpoint`,t):e>n&&this.fail(`reversed character range`,t,!0)}}this.take(`]`)||this.fail(`unterminated character class`,e,!0)}classItem(){if(this.offset>=this.pattern.length){this.fail(`unterminated character class`,this.offset,!0);return}let e=this.offset,t=this.pattern[this.offset++];return t===`\\`?this.escape(e,!0):t.charCodeAt(0)}escape(e,t){if(this.offset===this.pattern.length){this.fail(`trailing backslash`,e,!0);return}let n=this.pattern[this.offset++];if(!`dDwWsS`.includes(n)){if(n===`0`&&/[0-9]/.test(this.pattern[this.offset]??` `))this.fail(`octal escape`,e);else if(`tnrfv0`.includes(n))return{t:9,n:10,r:13,f:12,v:11,0:0}[n];else if(n===`x`||n===`u`&&!this.at(`{`)){let t=n===`x`?2:4,r=this.pattern.slice(this.offset,this.offset+t);if(r.length!==t||!/^[0-9a-fA-F]+$/.test(r))this.fail(`invalid hexadecimal escape`,e,!0);else return this.offset+=t,parseInt(r,16)}else if(`^$\\.*+?()[]{}|/`.includes(n)||t&&n===`-`)return n.charCodeAt(0);else this.fail(escapeConstruct(n,t),e)}}quantify(e){if(this.issue!==void 0||this.offset>=this.pattern.length)return e;let t=this.offset,n=1n,i=1n;if(this.at(`*`)||this.at(`+`)||this.at(`?`))this.offset++;else if(this.take(`{`)){let r=this.digits();if(r===void 0)return this.fail(`unescaped brace`,t),e;if(n=r,i=0n,this.take(`,`)){if(this.at(`}`))n=r+1n,i=1n;else{let a=this.digits();if(a===void 0)return this.fail(`unescaped brace`,t),e;n=a,i=a-r,n<r&&this.fail(`reversed counted repeat`,t,!0)}}this.take(`}`)||this.fail(`unescaped brace`,t)}else return e;e.quantifiable||this.fail(`quantified assertion`,t,!0),this.take(`?`);let a=BigInt(e.size)*n+i,o=Number(a>BigInt(3001)?BigInt(3001):a);return{size:o,quantifiable:!1,budgetOffset:o>r?e.budgetOffset??t:void 0}}digits(){let e=this.offset,t=0n;for(;this.offset<this.pattern.length&&/[0-9]/.test(this.pattern[this.offset]);)t=t*10n+BigInt(this.pattern[this.offset++]);return this.offset===e?void 0:t}registerName(e,t){let n=this.names.get(e)??[],disjoint=e=>e.some(e=>this.branches.some(t=>t.scope===e.scope&&t.alternative!==e.alternative));n.some(e=>!disjoint(e))&&this.fail(`duplicate group name`,t,!0),n.push(this.branches.map(e=>({...e}))),this.names.set(e,n)}at(e){return this.offset<this.pattern.length&&this.pattern[this.offset]===e}take(e){return this.at(e)?(this.offset++,!0):!1}fail(e,n,r=!1){this.issue??={construct:e,offset:n,invalid:r,suggestion:r?void 0:t[e]}}};function escapeConstruct(e,t){return`123456789k`.includes(e)?`backreference`:e===`b`&&t?`class backspace escape`:`bB`.includes(e)?`word boundary`:`pP`.includes(e)?`Unicode property escape`:e===`u`?`Unicode code point escape`:e===`c`?`control escape`:e===`A`?`start of input escape`:`zZ`.includes(e)?`end of input escape`:`identity escape`}export{n as emailMatchPattern,validateMatchPattern};
|
|
2
|
+
//# sourceMappingURL=PortableMatchPattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableMatchPattern.js","names":["emailMatchPattern","sizeLimit","pattern","expression","size","budgetOffset","branch","start","atom","character","nameStart","name","isJavaScriptGroupName","body","negated","left","rangeOffset","right","escape","width","hex","inClass","count","choices","minimum","maximum","expanded","value","occurrences","previous","current","invalid","portableMatchSuggestions","construct"],"sources":["../../../../../../Compiler/Parsing/PortableMatchPattern.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 { isJavaScriptGroupName } from './PortableMatchGroupName';\nimport { portableMatchSuggestions } from './PortableMatchSuggestions';\n\nexport const emailMatchPattern = '^[^\\\\s@]+@[^\\\\s@.]+(?:\\\\.[^\\\\s@.]+)+$';\nexport interface MatchPatternIssue { construct: string; offset: number; invalid: boolean; suggestion?: string }\ninterface Fragment { size: number; quantifiable: boolean; budgetOffset?: number }\ninterface Branch { scope: number; alternative: number }\nconst sizeLimit = 3000;\n\n/** Decision 0084. This validates syntax without invoking a browser's backtracking engine. */\nexport function validateMatchPattern(pattern: string): MatchPatternIssue | undefined {\n return new PortableMatchParser(pattern).parse();\n}\n\nclass PortableMatchParser {\n private offset = 0;\n private issue: MatchPatternIssue | undefined;\n private readonly names = new Map<string, Branch[][]>();\n private readonly branches: Branch[] = [];\n private scope = 0;\n constructor(private readonly pattern: string) { }\n\n parse(): MatchPatternIssue | undefined {\n if (this.pattern.length > 1000) this.fail('pattern length', 1000);\n const expression = this.expression();\n if (this.issue === undefined && this.offset !== this.pattern.length) this.fail('unmatched closing group', this.offset, true);\n if (expression.size > sizeLimit) this.fail('expanded pattern size', expression.budgetOffset ?? this.offset);\n return this.issue;\n }\n\n private expression(): Fragment {\n let size = 0;\n let budgetOffset: number | undefined;\n const branch: Branch = { scope: this.scope++, alternative: 0 };\n this.branches.push(branch);\n while (this.issue === undefined && this.offset < this.pattern.length && !this.at(')')) {\n if (this.at('|')) {\n size = Math.min(sizeLimit + 1, size + 1);\n if (size > sizeLimit) budgetOffset ??= this.offset;\n this.offset++;\n branch.alternative++;\n continue;\n }\n const start = this.offset;\n const atom = this.quantify(this.atom());\n size = Math.min(sizeLimit + 1, size + atom.size);\n if (size > sizeLimit) budgetOffset ??= atom.budgetOffset ?? start;\n }\n this.branches.pop();\n return { size, quantifiable: true, budgetOffset };\n }\n\n private atom(): Fragment {\n const start = this.offset;\n const character = this.pattern[this.offset++];\n if (character === '(') return this.group(start);\n if (character === '[') this.characterClass(start);\n else if (character === '\\\\') this.escape(start, false);\n else if (character === ']') this.fail('unescaped closing bracket', start);\n else if (character === '{' && /^\\{[0-9]+(?:,[0-9]*)?\\}/.test(this.pattern.slice(start))) this.fail('quantifier without an atom', start, true);\n else if (character === '{' || character === '}') this.fail('unescaped brace', start);\n else if ('*+?'.includes(character)) this.fail('quantifier without an atom', start, true);\n return { size: 1, quantifiable: character !== '^' && character !== '$' };\n }\n\n private group(start: number): Fragment {\n if (this.take('?')) {\n if (this.take(':')) { /* Non-capturing group. */ }\n else if (this.at('=') || this.at('!') || (this.at('<') && '=!'.includes(this.pattern[this.offset + 1] ?? ' '))) this.fail('lookaround', start);\n else if (this.take('<')) {\n const nameStart = this.offset;\n while (this.offset < this.pattern.length && !this.at('>')) this.offset++;\n const name = this.pattern.slice(nameStart, this.offset);\n if (!this.take('>')) this.fail('unterminated group name', nameStart, true);\n else if (!isJavaScriptGroupName(name)) this.fail('group name', nameStart, true);\n else if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) this.fail('group name', nameStart);\n else this.registerName(name, nameStart);\n } else this.fail('ims-'.includes(this.pattern[this.offset] ?? ' ') ? 'inline options' : 'group extension', start);\n }\n const body = this.expression();\n if (!this.take(')')) this.fail('unterminated group', start, true);\n return body;\n }\n\n private characterClass(start: number): void {\n const negated = this.take('^');\n if (this.at(']')) this.fail(negated ? 'negated empty character class' : 'empty character class', start);\n while (this.issue === undefined && this.offset < this.pattern.length && !this.at(']')) {\n if (this.at('-') && this.offset + 1 < this.pattern.length && this.pattern[this.offset + 1] === '[') this.fail('class subtraction', this.offset);\n const left = this.classItem();\n if (this.at('-') && this.offset + 1 < this.pattern.length && this.pattern[this.offset + 1] !== ']') {\n const rangeOffset = this.offset++;\n if (this.at('[')) this.fail('class subtraction', rangeOffset);\n const right = this.classItem();\n if (left === undefined || right === undefined) this.fail('class escape range endpoint', rangeOffset);\n else if (left > right) this.fail('reversed character range', rangeOffset, true);\n }\n }\n if (!this.take(']')) this.fail('unterminated character class', start, true);\n }\n\n private classItem(): number | undefined {\n if (this.offset >= this.pattern.length) { this.fail('unterminated character class', this.offset, true); return undefined; }\n const start = this.offset;\n const character = this.pattern[this.offset++];\n return character === '\\\\' ? this.escape(start, true) : character.charCodeAt(0);\n }\n\n private escape(start: number, inClass: boolean): number | undefined {\n if (this.offset === this.pattern.length) { this.fail('trailing backslash', start, true); return undefined; }\n const escape = this.pattern[this.offset++];\n if ('dDwWsS'.includes(escape)) return undefined;\n if (escape === '0' && /[0-9]/.test(this.pattern[this.offset] ?? ' ')) this.fail('octal escape', start);\n else if ('tnrfv0'.includes(escape)) return ({ t: 9, n: 10, r: 13, f: 12, v: 11, '0': 0 } as Record<string, number>)[escape];\n else if (escape === 'x' || (escape === 'u' && !this.at('{'))) {\n const width = escape === 'x' ? 2 : 4;\n const hex = this.pattern.slice(this.offset, this.offset + width);\n if (hex.length !== width || !/^[0-9a-fA-F]+$/.test(hex)) this.fail('invalid hexadecimal escape', start, true);\n else { this.offset += width; return parseInt(hex, 16); }\n } else if ('^$\\\\.*+?()[]{}|/'.includes(escape) || (inClass && escape === '-')) return escape.charCodeAt(0);\n else this.fail(escapeConstruct(escape, inClass), start);\n return undefined;\n }\n\n private quantify(atom: Fragment): Fragment {\n if (this.issue !== undefined || this.offset >= this.pattern.length) return atom;\n const start = this.offset;\n let count = 1n;\n let choices = 1n;\n if (this.at('*') || this.at('+') || this.at('?')) this.offset++;\n else if (this.take('{')) {\n const minimum = this.digits();\n if (minimum === undefined) { this.fail('unescaped brace', start); return atom; }\n count = minimum;\n choices = 0n;\n if (this.take(',')) {\n if (this.at('}')) { count = minimum + 1n; choices = 1n; }\n else {\n const maximum = this.digits();\n if (maximum === undefined) { this.fail('unescaped brace', start); return atom; }\n count = maximum;\n choices = maximum - minimum;\n if (count < minimum) this.fail('reversed counted repeat', start, true);\n }\n }\n if (!this.take('}')) this.fail('unescaped brace', start);\n } else return atom;\n if (!atom.quantifiable) this.fail('quantified assertion', start, true);\n this.take('?');\n const expanded = BigInt(atom.size) * count + choices;\n const size = Number(expanded > BigInt(sizeLimit + 1) ? BigInt(sizeLimit + 1) : expanded);\n return { size, quantifiable: false, budgetOffset: size > sizeLimit ? atom.budgetOffset ?? start : undefined };\n }\n\n private digits(): bigint | undefined {\n const start = this.offset;\n let value = 0n;\n while (this.offset < this.pattern.length && /[0-9]/.test(this.pattern[this.offset])) value = value * 10n + BigInt(this.pattern[this.offset++]);\n return this.offset === start ? undefined : value;\n }\n\n private registerName(name: string, start: number): void {\n const occurrences = this.names.get(name) ?? [];\n const disjoint = (previous: Branch[]) => previous.some(branch => this.branches.some(current => current.scope === branch.scope && current.alternative !== branch.alternative));\n if (occurrences.some(previous => !disjoint(previous))) this.fail('duplicate group name', start, true);\n occurrences.push(this.branches.map(branch => ({ ...branch })));\n this.names.set(name, occurrences);\n }\n\n private at(character: string): boolean { return this.offset < this.pattern.length && this.pattern[this.offset] === character; }\n private take(character: string): boolean { if (!this.at(character)) return false; this.offset++; return true; }\n private fail(construct: string, offset: number, invalid = false): void {\n this.issue ??= { construct, offset, invalid, suggestion: invalid ? undefined : portableMatchSuggestions[construct] };\n }\n}\n\nfunction escapeConstruct(escape: string, inClass: boolean): string {\n if ('123456789k'.includes(escape)) return 'backreference';\n if (escape === 'b' && inClass) return 'class backspace escape';\n if ('bB'.includes(escape)) return 'word boundary';\n if ('pP'.includes(escape)) return 'Unicode property escape';\n if (escape === 'u') return 'Unicode code point escape';\n if (escape === 'c') return 'control escape';\n if (escape === 'A') return 'start of input escape';\n if ('zZ'.includes(escape)) return 'end of input escape';\n return 'identity escape';\n}\n"],"mappings":"kMAMA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AC,EACxKsB,EAAY,KAAK,GAAY,CAAC,SAASC,CAAQ,CAAC,GAAG,KAAK,KAAK,uBAAwBtB,EAAO,EAAI,EACpGqB,EAAY,KAAK,KAAK,SAAS,IAAI,IAAW,CAAE,GAAGtB,CAAO,EAAE,CAAC,EAC7D,KAAK,MAAM,IAAIK,EAAMiB,CAAW,CACpC,CAEA,GAAW,EAA4B,CAAE,OAAO,KAAK,OAAS,KAAK,QAAQ,QAAU,KAAK,QAAQ,KAAK,UAAYnB,CAAW,CAC9H,KAAa,EAA4B,CAAwD,OAAjD,KAAK,GAAGA,CAAS,GAAiB,KAAK,SAAiB,IAA7B,EAAmC,CAC9G,KAAa,EAAmB,EAAgB,EAAU,GAAa,CACnE,KAAK,QAAU,CAAE,YAAW,SAAQ,UAAS,WAAYsB,EAAU,IAAA,GAAYC,EAAyBC,EAAW,CACvH,CACJ,EAEA,SAAS,gBAAgB,EAAgB,EAA0B,CAS/D,MARI,aAAa,SAASf,CAAM,EAAU,gBACtCA,IAAW,KAAOG,EAAgB,yBAClC,KAAK,SAASH,CAAM,EAAU,gBAC9B,KAAK,SAASA,CAAM,EAAU,0BAC9BA,IAAW,IAAY,4BACvBA,IAAW,IAAY,iBACvBA,IAAW,IAAY,wBACvB,KAAK,SAASA,CAAM,EAAU,sBAC3B,iBACX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={lookaround:`There is no general equivalent; a length-only lookahead can be replaced with a {n} counted repeat.`,backreference:`There is no equivalent in the portable match dialect.`,"word boundary":`There is no equivalent word-boundary assertion in the portable match dialect.`,"Unicode property escape":`Use an explicit character class where the required set is known; there is no general equivalent.`,"Unicode code point escape":`Use \\uHHHH escapes for UTF-16 code units.`,"control escape":`Use an explicit hexadecimal escape such as \\x01.`,"class backspace escape":`Use \\x08.`,"start of input escape":`Use ^.`,"end of input escape":`Use $.`,"inline options":`Use explicit case classes such as [aA] for case-insensitive matching; there is no general equivalent for other options.`,"empty character class":`Use [^\\s\\S] to match no UTF-16 code unit.`,"negated empty character class":`Use [\\s\\S].`,"class subtraction":`Use an explicit character class containing the resulting ranges.`,"class escape range endpoint":`Write single-character range endpoints or a union of classes.`,"unescaped closing bracket":`Escape a literal closing bracket as \\].`,"unescaped brace":`Escape a literal brace as \\{ or \\}.`,"identity escape":`Write the literal character without a backslash, or use \\xHH or \\uHHHH.`,"octal escape":`Use \\xHH or \\uHHHH.`,"group name":`Use a name matching [A-Za-z_][A-Za-z0-9_]*.`,"group extension":`Use an ordinary group or a (?:...) non-capturing group.`,"pattern length":`Shorten the pattern to at most 1000 UTF-16 code units.`,"expanded pattern size":`Reduce repeats and alternatives to at most 3000 expanded nodes, including choice points.`};export{e as portableMatchSuggestions};
|
|
2
|
+
//# sourceMappingURL=PortableMatchSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableMatchSuggestions.js","names":["portableMatchSuggestions","\"lookaround\"","\"backreference\""],"sources":["../../../../../../Compiler/Parsing/PortableMatchSuggestions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Held equal to the C# table by the shared portable-match conformance vectors.\nexport const portableMatchSuggestions: Readonly<Record<string, string>> = {\n 'lookaround': 'There is no general equivalent; a length-only lookahead can be replaced with a {n} counted repeat.',\n 'backreference': 'There is no equivalent in the portable match dialect.',\n 'word boundary': 'There is no equivalent word-boundary assertion in the portable match dialect.',\n 'Unicode property escape': 'Use an explicit character class where the required set is known; there is no general equivalent.',\n 'Unicode code point escape': 'Use \\\\uHHHH escapes for UTF-16 code units.',\n 'control escape': 'Use an explicit hexadecimal escape such as \\\\x01.',\n 'class backspace escape': 'Use \\\\x08.',\n 'start of input escape': 'Use ^.',\n 'end of input escape': 'Use $.',\n 'inline options': 'Use explicit case classes such as [aA] for case-insensitive matching; there is no general equivalent for other options.',\n 'empty character class': 'Use [^\\\\s\\\\S] to match no UTF-16 code unit.',\n 'negated empty character class': 'Use [\\\\s\\\\S].',\n 'class subtraction': 'Use an explicit character class containing the resulting ranges.',\n 'class escape range endpoint': 'Write single-character range endpoints or a union of classes.',\n 'unescaped closing bracket': 'Escape a literal closing bracket as \\\\].',\n 'unescaped brace': 'Escape a literal brace as \\\\{ or \\\\}.',\n 'identity escape': 'Write the literal character without a backslash, or use \\\\xHH or \\\\uHHHH.',\n 'octal escape': 'Use \\\\xHH or \\\\uHHHH.',\n 'group name': 'Use a name matching [A-Za-z_][A-Za-z0-9_]*.',\n 'group extension': 'Use an ordinary group or a (?:...) non-capturing group.',\n 'pattern length': 'Shorten the pattern to at most 1000 UTF-16 code units.',\n 'expanded pattern size': 'Reduce repeats and alternatives to at most 3000 expanded nodes, including choice points.',\n};\n"],"mappings":"AAIA,MAAaA,EAA6D,CACtEC,WAAc,qGACdC,cAAiB,wDACjB,gBAAiB,gFACjB,0BAA2B,mGAC3B,4BAA6B,6CAC7B,iBAAkB,oDAClB,yBAA0B,aAC1B,wBAAyB,SACzB,sBAAuB,SACvB,iBAAkB,0HAClB,wBAAyB,8CACzB,gCAAiC,gBACjC,oBAAqB,mEACrB,8BAA+B,gEAC/B,4BAA6B,2CAC7B,kBAAmB,wCACnB,kBAAmB,4EACnB,eAAgB,wBAChB,aAAc,8CACd,kBAAmB,0DACnB,iBAAkB,yDAClB,wBAAyB,0FAC7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"./Parsing/SourceLineSplitter.js";import{validateIdentity as t}from"./Parsing/IdentityValidator.js";import{expandSpecificationExamples as
|
|
1
|
+
import"../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"./Parsing/SourceLineSplitter.js";import{validateIdentity as t}from"./Parsing/IdentityValidator.js";import{validateApplicationHandlers as n}from"./Parsing/CommandHandlerValidator.js";import{expandSpecificationExamples as r,validateSpecificationExampleTypes as i}from"./Parsing/SpecificationCommandExamples.js";import{validateResponses as a}from"./Parsing/ResponseValidator.js";import{validateSpecificationCases as o}from"./Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as s}from"./Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as c}from"./Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as l}from"./Dependencies/DeclaredDependencyTargets.js";import{documentPlacement as u}from"./Files/PlayPlacement.js";import{interactionAncestry as d}from"./Parsing/InteractionAlternatives.js";import"./Parsing/SpecificationParser.js";import"./Parsing/SpecificationExampleParser.js";import"./Parsing/CaptureParser.js";import"./Parsing/ProjectionParser.js";import"./Parsing/ImportDiscovery.js";import{DeclaredDependencies as f}from"./Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as p}from"./Parsing/PublicEventUsageValidator.js";import{sourceContext as m}from"./Parsing/SourceOptionsParser.js";import{validateInlineEvents as h}from"./Parsing/InlineEventValidator.js";import{validateOperations as g}from"./Parsing/OperationValidator.js";import{parseApplication as _}from"./Parsing/ScreenplayParser.js";import{CommandStreamCandidates as v}from"./Parsing/CommandStreamCandidates.js";import{validateEventSources as y}from"./Parsing/EventSourceValidator.js";import{validateProjectionTargets as b}from"./Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as x}from"./Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as S}from"./Parsing/EventSubjectValidator.js";import{validateReadModelKeys as C}from"./Parsing/ReadModelKeyValidator.js";import{validateReactionRefusals as w}from"./Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as T}from"./Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as E}from"./Parsing/GuardedActionValidator.js";import{validatePersonaCallers as D}from"./Parsing/PersonaCallerValidator.js";import{validatePurposes as O}from"./Parsing/PurposeValidator.js";import{timelineOrderDiagnostics as k}from"./Files/TimelineOrder.js";function parseForAuthoring(A,j,M=u,N=!0,P,F){let I=e(A,!1,j),L=m(I,j,F);L.scope=M,L.interactionAncestors=d(I),L.streamCandidates=P??v.capture([I],M,F);let R=_(L,I,M);if(N){n(R,L),t(R,L),O(R,L),h(R,L),c(R,L),g(R,L),p(R,L),o(R,L),i(R,L,!0);let e=r(R);a(e,L),y(R,L),b(R,L),x(e,L),S(R,L),C(R,L),w(R,L),T(R,L),E(R,L),D(R,L),R=l(R,L),f.validate(R,L);for(let e of s(R))L.information(e.code,e.message,e.location);for(let e of k(R))L.information(e.code,e.message,e.location)}return{value:R,diagnostics:L.diagnostics,triggerData:L.triggerData,inputUses:L.inputUses,continuationValues:L.continuationValues,guardedInteractions:L.guardedInteractions,success:!L.diagnostics.some(e=>e.severity===`error`)}}export{parseForAuthoring};
|
|
2
2
|
//# sourceMappingURL=ScreenplayCompiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenplayCompiler.js","names":["documentPlacement","lines","splitLines","source","path","context","sourceContext","languages","placement","interactionAncestry","streamCandidates","CommandStreamCandidates","value","parseApplication","validateResponseContracts","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { ContinuationValueUse } from './Parsing/ContinuationValueUse';\nimport { InputUse } from './Parsing/InputUses';\nimport { GuardedInteractionBinding, interactionAncestry } from './Parsing/InteractionAlternatives';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from './Parsing/ReadModelKeyValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[]; readonly continuationValues: readonly ContinuationValueUse[]; readonly guardedInteractions: readonly GuardedInteractionBinding[] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.interactionAncestors = interactionAncestry(lines);\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n validateSpecificationExampleTypes(value, context, true);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReadModelKeys(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n continuationValues: context.continuationValues,\n guardedInteractions: context.guardedInteractions,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"44EAsEA,SAAgB,kBAAkB,EAAgB,EAAe,EAA2BA,EAAmB,EAA4B,GAAM,EAA4C,EAAwS,CACje,IAAMC,EAAQC,EAAWC,EAAQ,GAAOC,CAAI,EACtCC,EAAUC,EAAcL,EAAOG,EAAMG,CAAS,EACpD,EAAQ,MAAQC,EAChB,EAAQ,qBAAuBC,EAAoBR,CAAK,EACxD,EAAQ,iBAAmBS,GAAoBC,EAAwB,QAAQ,CAACV,CAAK,EAAGO,EAAWD,CAAS,EAC5G,IAAIK,EAAQC,EAAiBR,EAASJ,EAAOO,CAAS,EAEtD,GAAIM,EAA2B,CAC3BC,EAAiBH,EAAOP,CAAO,EAC/BW,EAAiBJ,EAAOP,CAAO,EAC/BY,EAAqBL,EAAOP,CAAO,EACnCa,EAA6BN,EAAOP,CAAO,EAC3Cc,EAAmBP,EAAOP,CAAO,EACjCe,EAAyBR,EAAOP,CAAO,EACvCgB,EAA2BT,EAAOP,CAAO,EACzCiB,EAAkCV,EAAOP,EAAS,EAAI,EACtD,IAAMkB,EAAYC,EAA4BZ,CAAK,EACnDa,EAAkBF,EAAWlB,CAAO,EACpCqB,EAAqBd,EAAOP,CAAO,EACnCsB,EAA0Bf,EAAOP,CAAO,EACxCuB,EAA6BL,EAAWlB,CAAO,EAC/CwB,EAAsBjB,EAAOP,CAAO,EACpCyB,EAAsBlB,EAAOP,CAAO,EACpC0B,EAAyBnB,EAAOP,CAAO,EACvC2B,EAAgCpB,EAAOP,CAAO,EAC9C4B,EAAuBrB,EAAOP,CAAO,EACrC6B,EAAuBtB,EAAOP,CAAO,EACrC,EAAQ8B,EAA+BvB,EAAOP,CAAO,EACrD+B,EAAqB,SAASxB,EAAOP,CAAO,EAC5C,IAAK,IAAMgC,KAAcC,EAAiC1B,CAAK,EAAGP,EAAQ,YAAYgC,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC9I,IAAK,IAAMA,KAAcE,EAAyB3B,CAAK,EAAGP,EAAQ,YAAYgC,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,CAC1I,CACA,MAAO,CACH,QACA,YAAahC,EAAQ,YACrB,YAAaA,EAAQ,YACrB,UAAWA,EAAQ,UACnB,mBAAoBA,EAAQ,mBAC5B,oBAAqBA,EAAQ,oBAC7B,QAAS,CAACA,EAAQ,YAAY,KAAK,GAAcgC,EAAW,WAAa,OAAO,CACpF,CACJ"}
|
|
1
|
+
{"version":3,"file":"ScreenplayCompiler.js","names":["documentPlacement","lines","splitLines","source","path","context","sourceContext","languages","placement","interactionAncestry","streamCandidates","CommandStreamCandidates","value","parseApplication","validateResponseContracts","validateApplicationHandlers","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from './Parsing/CommandHandlerValidator';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { ContinuationValueUse } from './Parsing/ContinuationValueUse';\nimport { InputUse } from './Parsing/InputUses';\nimport { GuardedInteractionBinding, interactionAncestry } from './Parsing/InteractionAlternatives';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from './Parsing/ReadModelKeyValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[]; readonly continuationValues: readonly ContinuationValueUse[]; readonly guardedInteractions: readonly GuardedInteractionBinding[] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.interactionAncestors = interactionAncestry(lines);\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateApplicationHandlers(value, context);\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n validateSpecificationExampleTypes(value, context, true);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReadModelKeys(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n continuationValues: context.continuationValues,\n guardedInteractions: context.guardedInteractions,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"+9EAuEA,SAAgB,kBAAkB,EAAgB,EAAe,EAA2BA,EAAmB,EAA4B,GAAM,EAA4C,EAAwS,CACje,IAAMC,EAAQC,EAAWC,EAAQ,GAAOC,CAAI,EACtCC,EAAUC,EAAcL,EAAOG,EAAMG,CAAS,EACpD,EAAQ,MAAQC,EAChB,EAAQ,qBAAuBC,EAAoBR,CAAK,EACxD,EAAQ,iBAAmBS,GAAoBC,EAAwB,QAAQ,CAACV,CAAK,EAAGO,EAAWD,CAAS,EAC5G,IAAIK,EAAQC,EAAiBR,EAASJ,EAAOO,CAAS,EAEtD,GAAIM,EAA2B,CAC3BC,EAA4BH,EAAOP,CAAO,EAC1CW,EAAiBJ,EAAOP,CAAO,EAC/BY,EAAiBL,EAAOP,CAAO,EAC/Ba,EAAqBN,EAAOP,CAAO,EACnCc,EAA6BP,EAAOP,CAAO,EAC3Ce,EAAmBR,EAAOP,CAAO,EACjCgB,EAAyBT,EAAOP,CAAO,EACvCiB,EAA2BV,EAAOP,CAAO,EACzCkB,EAAkCX,EAAOP,EAAS,EAAI,EACtD,IAAMmB,EAAYC,EAA4Bb,CAAK,EACnDc,EAAkBF,EAAWnB,CAAO,EACpCsB,EAAqBf,EAAOP,CAAO,EACnCuB,EAA0BhB,EAAOP,CAAO,EACxCwB,EAA6BL,EAAWnB,CAAO,EAC/CyB,EAAsBlB,EAAOP,CAAO,EACpC0B,EAAsBnB,EAAOP,CAAO,EACpC2B,EAAyBpB,EAAOP,CAAO,EACvC4B,EAAgCrB,EAAOP,CAAO,EAC9C6B,EAAuBtB,EAAOP,CAAO,EACrC8B,EAAuBvB,EAAOP,CAAO,EACrC,EAAQ+B,EAA+BxB,EAAOP,CAAO,EACrDgC,EAAqB,SAASzB,EAAOP,CAAO,EAC5C,IAAK,IAAMiC,KAAcC,EAAiC3B,CAAK,EAAGP,EAAQ,YAAYiC,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC9I,IAAK,IAAMA,KAAcE,EAAyB5B,CAAK,EAAGP,EAAQ,YAAYiC,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,CAC1I,CACA,MAAO,CACH,QACA,YAAajC,EAAQ,YACrB,YAAaA,EAAQ,YACrB,UAAWA,EAAQ,UACnB,mBAAoBA,EAAQ,mBAC5B,oBAAqBA,EAAQ,oBAC7B,QAAS,CAACA,EAAQ,YAAY,KAAK,GAAciC,EAAW,WAAa,OAAO,CACpF,CACJ"}
|
|
@@ -17,7 +17,7 @@ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}
|
|
|
17
17
|
\${2:argument} = \${3:value}
|
|
18
18
|
then error`,documentation:`Asserts a Validation rejection of one query, with no action or other outcomes. Executable from ESM v18.`},{label:`then error`,insertText:`then error`,documentation:`A rejection, for a reason this specification does not name. After one actionless query, asserts exactly Validation (ESM v18), not a shape error or denial.`},{label:`then error "..."`,insertText:'then error "${1:reason}"',documentation:`A rejection, for the named reason. After one actionless query, asserts exactly Validation (ESM v18); cannot accompany results, no result, denial or another outcome.`},{label:`given clock`,insertText:'given clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does. At most once.`},{label:`given capture`,insertText:"given capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before.`},{label:`when clock`,insertText:'when clock "${1:2026-10-05T09:00:00Z}"',documentation:`The clock reaches an instant, as the action.`},{label:`when trigger`,insertText:"when trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:`An application trigger fires, as the action.`},{label:`when capture`,insertText:"when capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`The record a capture's source holds now, as the action.`},{label:`when query`,insertText:"when query ${1:Query}\n ${2:argument} = ${3:value}",documentation:`Performs a query. Assert results or genuine absence; a concept-rule violation is rejected and can be asserted with then error from ESM v18.`},{label:`then result`,insertText:"then result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:`then no result`,insertText:`then no result`,documentation:"The query performed by `when query` returns nothing."},{label:`then no events`,insertText:`then no events`,documentation:`Asserts the action appended no events, including after when append, where no reaction appended anything. Executable from ESM v17; cannot accompany event, error or denial expectations.`}],A={given:[{label:`operation`,insertText:"operation ${1:Name} fails",documentation:`Syntax-only failure fixture; no children.`},{label:`clock`,insertText:'clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does.`},{label:`capture`,insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before. Repeat it for several records.`},{label:`readmodel`,insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`caller`,insertText:`caller
|
|
19
19
|
\${1:authenticated}`,documentation:`The identity the scenario runs as.`}],when:[{label:`redelivered`,insertText:"redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named reaction; the event is not appended again. Executable from ESM v17.`},{label:`clock`,insertText:'clock "${1:2026-10-05T09:00:00Z}"',documentation:`The clock reaches an instant - what a scheduled reaction responds to.`},{label:`trigger`,insertText:"trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:`An application trigger fires, with the values it carries.`},{label:`capture`,insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`The record a capture's source holds now.`},{label:`query`,insertText:"query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query; assert returned rows with `then result`, genuine absence with `then no result`, or a Validation rejection with `then error` (ESM v18)."},{label:`append`,insertText:"append ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event occurs, instead of a command being executed.`}],then:[{label:`operation`,insertText:"operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Syntax-only partial operation assertion; not admitted by any supported executable model (ESM) version yet.`},{label:`compensated`,insertText:"compensated ${1:Name}",documentation:`Syntax-only compensation assertion; no children.`},{label:`returns value`,insertText:"returns ${1:value}",documentation:`Scalar response expectation, compared by semantic value equality. Executable as ESM v7.`},{label:`returns block`,insertText:"returns\n ${1:field} = ${2:value}",documentation:`Nonempty subset of response fields asserted by name. Executable as ESM v7.`},{label:`result`,insertText:"result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:`result exactly`,insertText:"result exactly\n ${1:property} = ${2:value}",documentation:`One result, with every property asserted.`},{label:`no result`,insertText:`no result`,documentation:"The query performed by `when query` returns nothing."},{label:`no events`,insertText:`no events`,documentation:`Asserts the action appended no events, including after when append. Executable from ESM v17.`},{label:`readmodel`,insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected afterwards.`},{label:`error`,insertText:'error "${1:reason}"',documentation:`A rejection, for the named reason.`},{label:`denied`,insertText:`denied`,documentation:`The action is denied to the caller.`}]},j=[{label:`hint`,insertText:'hint "${1:predicate guidance}"',documentation:`Ordered nonblank authoring guidance. Does not execute or confirm the predicate.`},{label:`file`,insertText:"file ${1:Path}",documentation:`The sole named-rule predicate attachment.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Opaque named-rule predicate returning a bool. Requires an admitting target.`}],M=[{label:`implementation`,insertText:`implementation
|
|
20
|
-
hint "\${1:predicate guidance}"`,documentation:`Command named-rule intent with optional file or tagged fence. Pending intent cannot bind.`},...j.filter(e=>e.label!==`hint`)],N=[{label:`file`,insertText:"file ${1:Path}",documentation:`Gives the named predicate its implementation in an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Gives the named predicate its implementation as inline C# returning a bool.`}],P=[{label:`description`,insertText:'description "${1:authorization intent}"',documentation:`Report-only description; does not supply an implementation.`},{label:`require authenticated`,insertText:`require authenticated`,documentation:`Requires an authenticated caller.`},{label:`require role`,insertText:'require role "${1:role}"',documentation:`Requires the caller to have a role.`},{label:`require not role`,insertText:'require not role "${1:role}"',documentation:`Excludes callers with a role. Add authenticated to require a signed-in caller.`},{label:`require not claim`,insertText:'require not claim "${1:claim}" matches ${2:subject}',documentation:`Requires that no claim value matches the subject or a value.`},{label:`require claim`,insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:`Requires a claim to match the subject or a value.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Fully custom policy logic in C#, returning a bool.`}],F=[{label:`not empty`,insertText:'${1:property} not empty message "${2:message}"',documentation:`Text needs a non-whitespace character; null, empty and whitespace-only text fail. Uses Unicode White_Space (.NET char.IsWhiteSpace), including U+0085 but not U+FEFF, not JavaScript trim(). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged.`},{label:`max`,insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:`Maximum length or value.`},{label:`min`,insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:`Minimum length or value.`},{label:`matches`,insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:`
|
|
20
|
+
hint "\${1:predicate guidance}"`,documentation:`Command named-rule intent with optional file or tagged fence. Pending intent cannot bind.`},...j.filter(e=>e.label!==`hint`)],N=[{label:`file`,insertText:"file ${1:Path}",documentation:`Gives the named predicate its implementation in an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Gives the named predicate its implementation as inline C# returning a bool.`}],P=[{label:`description`,insertText:'description "${1:authorization intent}"',documentation:`Report-only description; does not supply an implementation.`},{label:`require authenticated`,insertText:`require authenticated`,documentation:`Requires an authenticated caller.`},{label:`require role`,insertText:'require role "${1:role}"',documentation:`Requires the caller to have a role.`},{label:`require not role`,insertText:'require not role "${1:role}"',documentation:`Excludes callers with a role. Add authenticated to require a signed-in caller.`},{label:`require not claim`,insertText:'require not claim "${1:claim}" matches ${2:subject}',documentation:`Requires that no claim value matches the subject or a value.`},{label:`require claim`,insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:`Requires a claim to match the subject or a value.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Fully custom policy logic in C#, returning a bool.`}],F=[{label:`not empty`,insertText:'${1:property} not empty message "${2:message}"',documentation:`Text needs a non-whitespace character; null, empty and whitespace-only text fail. Uses Unicode White_Space (.NET char.IsWhiteSpace), including U+0085 but not U+FEFF, not JavaScript trim(). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged.`},{label:`max`,insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:`Maximum length or value.`},{label:`min`,insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:`Minimum length or value.`},{label:`matches`,insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:`Searches text using the portable flagless JavaScript match dialect. Use ^ and $ for the whole input. Lookarounds and backreferences report PLAY0699. Named email rejects JavaScript whitespace, including U+00A0.`},{label:`rule`,insertText:'${1:property} rule ${2:PredicateName} message "${3:message}"',documentation:"Names a predicate — optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists."},{label:`==`,insertText:'${1:property} == ${2:value} message "${3:message}"',documentation:`The property must equal the value.`},{label:`!=`,insertText:'${1:property} != ${2:value} message "${3:message}"',documentation:`The property must not equal the value.`},{label:`length ==`,insertText:'${1:property} length == ${2:3} message "${3:message}"',documentation:`The property must have an exact length.`},{label:`all >`,insertText:'${1:collection}.${2:property} all > ${3:0} message "${4:message}"',documentation:`Every element of a collection must satisfy the comparison.`}],I=[{label:`description`,insertText:'description "${1:screen intent}"',documentation:`Report-only description, not a localizable screen title.`},{label:`data`,insertText:"data ${1:ReadModel} via query ${2:QueryName}",documentation:`Binds a read model to the screen through a query.`},{label:`action`,insertText:"action ${1:CommandName}",documentation:`Makes a command available as an action on the screen.`},{label:`action "…"`,insertText:'action "${1:Label}"\n when item.${2:status} == "${3:open}" execute ${4:CommandName}\n otherwise hidden',documentation:`One labeled button selecting the first matching command; hidden without a subject or match.`},{label:`layout`,insertText:"layout ${1:LayoutName}",documentation:`Uses a layout template and fills its slots.`},{label:`section`,insertText:"section ${1:name}",documentation:`A named structural section of the screen.`},{label:`table`,insertText:'table ${1:name}\n column ${2:property} label "${3:text}"',documentation:`A table widget over a read model or collection.`},{label:`summary`,insertText:'summary ${1:ReadModel}\n field ${2:property} label "${3:text}"',documentation:`A summary widget showing labeled fields.`},{label:`title`,insertText:'title "${1:text}"',documentation:`The title of the screen or section.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Full external implementation — Stage uses the referenced file.`},{label:`react`,insertText:fenced(`react`),documentation:`Inline React/TSX component receiving the data contract as Props.`},{label:`typescript`,insertText:fenced(`typescript`),documentation:`Inline plain TypeScript.`},{label:`html`,insertText:fenced(`html`),documentation:`Inline static HTML.`}],L=[{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to a screen after the action completes.`},{label:`label`,insertText:'label "${1:text}"',documentation:`The display label of the action.`}],R=[{label:`when … execute`,insertText:'when item.${1:status} == "${2:open}" execute ${3:CommandName}',documentation:`First matching alternative selects the command; authorization never falls through.`},{label:`otherwise hidden`,insertText:`otherwise hidden`,documentation:`Hides the action when no alternative matches; also the default.`},{label:`otherwise execute`,insertText:"otherwise execute ${1:CommandName}",documentation:`Selects a fallback command when no alternative matches and a subject exists.`},...L.filter(e=>e.label!==`label`)],z=[{label:`execute`,insertText:"execute ${1:CommandName}",documentation:`Executes a command; denial never selects another alternative.`},{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to the named screen.`},{label:`open dialog`,insertText:"open dialog ${1:DialogTemplate}",documentation:`Opens a dialog.`},{label:`notify`,insertText:'notify info "${1:Message}"',documentation:`Displays a message.`},{label:`confirm`,insertText:`confirm "\${1:Message}"
|
|
21
21
|
on success
|
|
22
22
|
execute \${2:CommandName}`,documentation:`Asks before continuing.`},{label:`refresh`,insertText:"refresh ${1:QueryName}",documentation:`Refreshes a query-backed element.`}],B=[{label:`when …`,insertText:'when item.${1:status} == "${2:open}"\n execute ${3:CommandName}',documentation:`Selects a whole action list once against the rendered subject at gesture time.`},{label:`otherwise`,insertText:`otherwise
|
|
23
23
|
notify info "\${1:Message}"`,documentation:`Final fallback list; without a subject nothing runs, including fallback.`},...z],V=[{label:`with … from`,insertText:"with ${1:property} from item.${2:property}",documentation:`Explicit input binding for this command alternative, before same-name item fields or its form.`}],H=[{label:`column`,insertText:'column ${1:property} label "${2:text}"',documentation:`A column bound to a property.`},{label:`on row-click`,insertText:"on row-click navigate to ${1:ScreenName} by ${2:param}",documentation:`Navigates when a row is clicked.`}],U=[...e.map(e=>({label:`$identity.${e}${e===`claims`?`.`:``}`,insertText:`$identity.${e}${e===`claims`?".${1:name}":``}`,documentation:`The caller's ${e}, equivalent to $context.identity.${e}.`})),{label:`$context.occurred`,insertText:`$context.occurred`,documentation:`When the command or query was received.`},{label:`$context.tenant`,insertText:`$context.tenant`,documentation:`The tenant the command or query is executing for.`},{label:`$context.command.`,insertText:"$context.command.${1:property}",documentation:`A property of the command being handled.`},{label:`$context.arguments.`,insertText:"$context.arguments.${1:name}",documentation:`An argument of the query being performed.`},{label:`$context.causedBy.subject`,insertText:`$context.causedBy.subject`,documentation:`Subject of the identity that caused the command or query.`},{label:`$context.causedBy.name`,insertText:`$context.causedBy.name`,documentation:`Display name of the identity that caused the command or query.`},{label:`$context.causedBy.userName`,insertText:`$context.causedBy.userName`,documentation:`User name of the identity that caused the command or query.`},{label:`$context.causation.type`,insertText:`$context.causation.type`,documentation:`What caused this — a command, a reactor, a schedule.`},{label:`$context.identity.id`,insertText:`$context.identity.id`,documentation:`The identifier of the caller from the auth token.`},{label:`$context.identity.name`,insertText:`$context.identity.name`,documentation:`The display name of the caller.`},{label:`$context.identity.userName`,insertText:`$context.identity.userName`,documentation:`The user name of the caller.`},{label:`$context.identity.isAuthenticated`,insertText:`$context.identity.isAuthenticated`,documentation:`Whether the caller is authenticated.`},{label:`$context.identity.roles`,insertText:`$context.identity.roles`,documentation:`The roles the caller holds.`},{label:`$context.identity.claims.`,insertText:"$context.identity.claims.${1:name}",documentation:`The value of a claim the caller carries.`},{label:`$env.`,insertText:"$env.${1:VAR_NAME}",documentation:`An environment variable.`},...r.filter(e=>e.name!==`value`).map(e=>({label:`$eventContext.${e.path}`,insertText:`$eventContext.${e.path}`,documentation:`${e.description} (PDL)`}))],W={StateChange:[`operation`,`file`,`description`,`event`,`event generation`,`command`,`constraint`,`screen`,`specification`],StateView:[`file`,`description`,`readmodel`,`query`,`query observable`,`projection`,`reducer`,`screen`,`specification`,`event`,`event generation`],Automation:[`operation`,`file`,`description`,`reaction`,`reducer`,`command`,`event`,`event generation`,`readmodel`,`specification`],Translate:[`file`,`description`,`capture`,`event`,`event generation`,`specification`]};function sliceItemsFor(e){let t=e?W[e]:void 0;return t?p.filter(n=>n.label===`purpose`||n.label===`example`||n.label===`documentation`||n.label===`public event`||n.label===`event from`||n.label===`direction`&&e===`Translate`||t.includes(n.label)):p}export{V as actionArgumentItems,L as actionItems,m as commandItems,M as commandRuleItems,d as conceptItems,S as constraintItems,contextVariableEntries,U as contextVariableItems,h as eventItems,R as guardedActionItems,y as handlerItems,o as identityItems,v as implementationItems,g as inlineEventItems,z as interactionActionItems,B as interactionChoiceItems,E as invocationItems,j as namedRuleImplementationItems,l as operationImplementationItems,c as operationItems,u as operationPhaseItems,a as optionalTypeItems,x as performerItems,P as policyItems,_ as producesItems,b as queryItems,C as reactionItems,w as reactionTriggerItems,D as refusalItems,N as ruleItems,I as screenItems,p as sliceItems,sliceItemsFor,k as specificationItems,A as specificationStepItems,H as tableItems,s as topLevelItems,O as triggerItems,f as typeItems,F as validateItems};
|